io.l0

io.l0

Module: std.io

Source: compiler/shared/l0/stdlib/std/io.l0 Language: Dea/L0

Imports / Includes

  • std.unit
  • std.assert
  • std.array
  • sys.memory
  • sys.rt

Symbols

Function read_line

1
func read_line() -> string?

Read a line from standard input.

Returns: The line read, or null on EOF or error.

Function read_char

1
func read_char() -> int?

Read a single character from standard input.

Returns: The character read as an integer, or null on EOF or error.

Function read_char_or_eof

1
func read_char_or_eof() -> int

Read a single character from standard input.

Returns: The character read, or -1 on EOF or error.

Function _io_check_byte_range

1
func _io_check_byte_range(buf: ByteArray*, start: int, count: int)

Validate one byte-array subrange before raw I/O.

Parameters:

  • buf: Byte array to inspect.
  • start: Start offset within the array.
  • count: Number of bytes in range.

Function read_stdin_some

1
func read_stdin_some(buf: ByteArray*, start: int, count: int) -> int?

Read up to count raw bytes from standard input into one byte-array subrange.

Parameters:

  • buf: Destination buffer.
  • start: Start offset within the buffer.
  • count: Maximum number of bytes to read.

Returns: Bytes read, 0 on EOF, or null on error.

Function write_stdout_some

1
func write_stdout_some(buf: ByteArray*, start: int, count: int) -> int?

Write up to count raw bytes from one byte-array subrange to standard output.

Parameters:

  • buf: Source buffer.
  • start: Start offset within the buffer.
  • count: Maximum number of bytes to write.

Returns: Bytes written, or null on error.

Function write_stderr_some

1
func write_stderr_some(buf: ByteArray*, start: int, count: int) -> int?

Write up to count raw bytes from one byte-array subrange to standard error.

Parameters:

  • buf: Source buffer.
  • start: Start offset within the buffer.
  • count: Maximum number of bytes to write.

Returns: Bytes written, or null on error.

Function write_stdout_all

1
func write_stdout_all(buf: ByteArray*, start: int, count: int) -> Unit?

Write exactly count raw bytes from one byte-array subrange to standard output.

Parameters:

  • buf: Source buffer.
  • start: Start offset within the buffer.
  • count: Exact number of bytes to write.

Returns: present() on success, or null on error.

Function write_stderr_all

1
func write_stderr_all(buf: ByteArray*, start: int, count: int) -> Unit?

Write exactly count raw bytes from one byte-array subrange to standard error.

Parameters:

  • buf: Source buffer.
  • start: Start offset within the buffer.
  • count: Exact number of bytes to write.

Returns: present() on success, or null on error.

Function flush_stdout

1
func flush_stdout() -> void

Flush the standard output buffer.

Function flush_stderr

1
func flush_stderr() -> void

Flush the standard error buffer.

Function printl

1
func printl() -> void

Print a newline to standard output.

Function print_s

1
func print_s(s: string) -> void

Print a string to standard output.

Parameters:

  • s: The string to print.

Function print_i

1
func print_i(x: int) -> void

Print an integer to standard output.

Parameters:

  • x: The integer to print.

Function print_b

1
func print_b(x: bool) -> void

Print a boolean to standard output.

Parameters:

  • x: The boolean to print.

Function printl_s

1
func printl_s(s: string) -> void

Print a string to standard output followed by a newline.

Parameters:

  • s: The string to print.

Function printl_i

1
func printl_i(x: int) -> void

Print an integer to standard output followed by a newline.

Parameters:

  • x: The integer to print.

Function printl_b

1
func printl_b(x: bool) -> void

Print a boolean to standard output followed by a newline.

Parameters:

  • x: The boolean to print.

Function print_ss

1
func print_ss(s1: string, s2: string) -> void

Print two strings to standard output separated by a space.

Parameters:

  • s1: The first string.
  • s2: The second string.

Function print_si

1
func print_si(s: string, x: int) -> void

Print a string and an integer to standard output separated by a space.

Parameters:

  • s: The string to print.
  • x: The integer to print.

Function print_sb

1
func print_sb(s: string, b: bool) -> void

Print a string and a boolean to standard output separated by a space.

Parameters:

  • s: The string to print.
  • b: The boolean to print.

Function print_is

1
func print_is(x: int, s: string) -> void

Print an integer and a string to standard output separated by a space.

Parameters:

  • x: The integer to print.
  • s: The string to print.

Function print_ii

1
func print_ii(x1: int, x2: int) -> void

Print two integers to standard output separated by a space.

Parameters:

  • x1: The first integer.
  • x2: The second integer.

Function print_ib

1
func print_ib(x: int, b: bool) -> void

Print an integer and a boolean to standard output separated by a space.

Parameters:

  • x: The integer to print.
  • b: The boolean to print.

Function print_bs

1
func print_bs(b: bool, s: string) -> void

Print a boolean and a string to standard output separated by a space.

Parameters:

  • b: The boolean to print.
  • s: The string to print.

Function print_bi

1
func print_bi(b: bool, x: int) -> void

Print a boolean and an integer to standard output separated by a space.

Parameters:

  • b: The boolean to print.
  • x: The integer to print.

Function print_bb

1
func print_bb(b1: bool, b2: bool) -> void

Print two booleans to standard output separated by a space.

Parameters:

  • b1: The first boolean.
  • b2: The second boolean.

Function printl_ss

1
func printl_ss(s1: string, s2: string) -> void

Print two strings to standard output separated by a space, followed by a newline.

Parameters:

  • s1: The first string.
  • s2: The second string.

Function printl_si

1
func printl_si(s: string, x: int) -> void

Print a string and an integer to standard output separated by a space, followed by a newline.

Parameters:

  • s: The string to print.
  • x: The integer to print.

Function printl_sb

1
func printl_sb(s: string, b: bool) -> void

Print a string and a boolean to standard output separated by a space, followed by a newline.

Parameters:

  • s: The string to print.
  • b: The boolean to print.

Function printl_is

1
func printl_is(x: int, s: string) -> void

Print an integer and a string to standard output separated by a space, followed by a newline.

Parameters:

  • x: The integer to print.
  • s: The string to print.

Function printl_ii

1
func printl_ii(x1: int, x2: int) -> void

Print two integers to standard output separated by a space, followed by a newline.

Parameters:

  • x1: The first integer.
  • x2: The second integer.

Function printl_ib

1
func printl_ib(x: int, b: bool) -> void

Print an integer and a boolean to standard output separated by a space, followed by a newline.

Parameters:

  • x: The integer to print.
  • b: The boolean to print.

Function printl_bs

1
func printl_bs(b: bool, s: string) -> void

Print a boolean and a string to standard output separated by a space, followed by a newline.

Parameters:

  • b: The boolean to print.
  • s: The string to print.

Function printl_bi

1
func printl_bi(b: bool, x: int) -> void

Print a boolean and an integer to standard output separated by a space, followed by a newline.

Parameters:

  • b: The boolean to print.
  • x: The integer to print.

Function printl_bb

1
func printl_bb(b1: bool, b2: bool) -> void

Print two booleans to standard output separated by a space, followed by a newline.

Parameters:

  • b1: The first boolean.
  • b2: The second boolean.

Function err_printl

1
func err_printl() -> void

Print a newline to standard error.

Function err_print_s

1
func err_print_s(s: string) -> void

Print a string to standard error.

Parameters:

  • s: The string to print.

Function err_print_i

1
func err_print_i(x: int) -> void

Print an integer to standard error.

Parameters:

  • x: The integer to print.

Function err_print_b

1
func err_print_b(x: bool) -> void

Print a boolean to standard error.

Parameters:

  • x: The boolean to print.

Function err_printl_s

1
func err_printl_s(s: string) -> void

Print a string to standard error followed by a newline.

Parameters:

  • s: The string to print.

Function err_printl_i

1
func err_printl_i(x: int) -> void

Print an integer to standard error followed by a newline.

Parameters:

  • x: The integer to print.

Function err_printl_b

1
func err_printl_b(x: bool) -> void

Print a boolean to standard error followed by a newline.

Parameters:

  • x: The boolean to print.

Function err_print_ss

1
func err_print_ss(s1: string, s2: string) -> void

Print two strings to standard error separated by a space.

Parameters:

  • s1: The first string.
  • s2: The second string.

Function err_print_si

1
func err_print_si(s: string, x: int) -> void

Print a string and an integer to standard error separated by a space.

Parameters:

  • s: The string to print.
  • x: The integer to print.

Function err_print_sb

1
func err_print_sb(s: string, b: bool) -> void

Print a string and a boolean to standard error separated by a space.

Parameters:

  • s: The string to print.
  • b: The boolean to print.

Function err_print_is

1
func err_print_is(x: int, s: string) -> void

Print an integer and a string to standard error separated by a space.

Parameters:

  • x: The integer to print.
  • s: The string to print.

Function err_print_ii

1
func err_print_ii(x1: int, x2: int) -> void

Print two integers to standard error separated by a space.

Parameters:

  • x1: The first integer.
  • x2: The second integer.

Function err_print_ib

1
func err_print_ib(x: int, b: bool) -> void

Print an integer and a boolean to standard error separated by a space.

Parameters:

  • x: The integer to print.
  • b: The boolean to print.

Function err_print_bs

1
func err_print_bs(b: bool, s: string) -> void

Print a boolean and a string to standard error separated by a space.

Parameters:

  • b: The boolean to print.
  • s: The string to print.

Function err_print_bi

1
func err_print_bi(b: bool, x: int) -> void

Print a boolean and an integer to standard error separated by a space.

Parameters:

  • b: The boolean to print.
  • x: The integer to print.

Function err_print_bb

1
func err_print_bb(b1: bool, b2: bool) -> void

Print two booleans to standard error separated by a space.

Parameters:

  • b1: The first boolean.
  • b2: The second boolean.