56 sys standard library
The sys module exposes process-level primitives: command-line argument access (argv), standard stream descriptor constants, null-pointer safety helpers, and process termination.
#use sys56.1 Constants
sys::STDIN: Standard input descriptor (0).sys::STDOUT: Standard output descriptor (1).sys::STDERR: Standard error descriptor (2).sys::addr_null: Canonical null address constant (Addr(0)).
56.2 Command-line arguments
| Function | Signature | Description |
|---|---|---|
sys::argc |
Int |
Total count of command-line arguments passed to process |
sys::argv |
Int => < String | > |
Safely retrieves argument by 0-based index as RamPN |
sys::argv_string |
Int => String |
Retrieves argument string, returning "" on invalid index |
sys::argv_matches |
Int, String => <> |
Tests whether argv[n] equals specified string |
sys::raw_argv |
Int => Addr |
Returns raw C-string pointer Addr for FFI use |
sys::argv(1)
| file => io::out("Target file: " + file)
| io::err("Usage: program <file>")56.3 Address and pointer helpers
sys::addr_is_null(a: Addr) => <>: Returns<+>if address equalssys::addr_null.sys::addr_opt(a: Addr) => < Addr | >: Wraps an address in aRamPNoption, returning<-->if null.sys::c_str(raw: Addr) => String: Copies a null-terminated C string into a newly allocated, immutable EdvaString.
56.4 Process termination
sys::exit(code: Int) => (): Terminates the host process immediately with status codecode.