Module io

Module io 

Source
Expand description

I/O Operations for Seq

These functions are exported with C ABI for LLVM codegen to call.

§Safety Contract

IMPORTANT: These functions are designed to be called ONLY by compiler-generated code, not by end users or arbitrary C code. The compiler is responsible for:

  • Ensuring stack has correct types (verified by type checker)
  • Passing valid, null-terminated C strings to push_string
  • Never calling these functions directly from user code

§String Handling

String literals from the compiler must be valid UTF-8 C strings (null-terminated). Currently, each string literal is allocated as an owned String. See docs/STRING_INTERNING_DESIGN.md for discussion of future optimizations (interning, static references, etc.).

Re-exports§

pub use patch_seq_exit_op as exit_op;
pub use patch_seq_int_to_string as int_to_string;
pub use patch_seq_push_seqstring as push_seqstring;
pub use patch_seq_push_string as push_string;
pub use patch_seq_read_line as read_line;
pub use patch_seq_read_line_plus as read_line_plus;
pub use patch_seq_write_line as write_line;

Functions§

patch_seq_exit_op
Exit the program with a status code
patch_seq_int_to_string
Convert an integer to a string
patch_seq_push_seqstring
Push a SeqString value onto the stack
patch_seq_push_string
Push a C string literal onto the stack (for compiler-generated code)
patch_seq_read_line
Read a line from stdin
patch_seq_read_line_plus
Read a line from stdin with explicit EOF detection
patch_seq_write_line
Write a string to stdout followed by a newline