compiler/shared/l0/stdlib/std/io.l0

Module std.io

Overview Symbols grouped by source file: compiler/shared/l0/stdlib/std/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

func read_line() -> string?

Read a line from standard input.

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

Function read_char

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

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

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

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

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

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

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

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

func flush_stdout() -> void

Flush the standard output buffer.

Function flush_stderr

func flush_stderr() -> void

Flush the standard error buffer.

Function printl

func printl() -> void

Print a newline to standard output.

Function print_s

func print_s(s: string) -> void

Print a string to standard output.

Parameters:

  • s: The string to print.

Function print_i

func print_i(x: int) -> void

Print an integer to standard output.

Parameters:

  • x: The integer to print.

Function print_b

func print_b(x: bool) -> void

Print a boolean to standard output.

Parameters:

  • x: The boolean to print.

Function printl_s

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func err_printl() -> void

Print a newline to standard error.

Function err_print_s

func err_print_s(s: string) -> void

Print a string to standard error.

Parameters:

  • s: The string to print.

Function err_print_i

func err_print_i(x: int) -> void

Print an integer to standard error.

Parameters:

  • x: The integer to print.

Function err_print_b

func err_print_b(x: bool) -> void

Print a boolean to standard error.

Parameters:

  • x: The boolean to print.

Function err_printl_s

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

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

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

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

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

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

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

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

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

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

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

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.