code wiki / (root) / nx_ini.nx

nx_ini.nx

buildroot/runtime/nx_ini.nx

7289 B233 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic ini
docsdependenciesstructsconstsfunctions

about

ini.nx -- parse INI-style configuration files. Classic [section] / key = value format. Simpler than TOML, used by 30+ years of Windows config + a lot of C daemons (php.ini, systemd unit files, mumble / xmms / qt config). Format: [section_name] <- section header, any leading/trailing ws ok key = value <- key/value, '=' or ':' separator ; comment <- semicolon # comment <- hash (blank line) We return a flat array of (section_off, section_len, key_off, key_len, val_off, val_len) tuples. The section fields are zero if a key appears before any [section] header. Like query.nx, this is zero-alloc -- we emit offsets into the caller's buffer and never copy. Whitespace around keys/values is trimmed (not stored). Inline comments are NOT supported (value runs to end-of-line). Invariants: I1 Empty input -> zero entries. I2 Keys with no '=' or ':' are silently dropped (warning would be logged in a production parser; we stay quiet). I3 Sections persist down until next [section] header. I4 Duplicate keys: all are emitted; caller picks which wins.

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_ini.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap ini_parse ini_eol ini_ltrim ini_is_ws ini_rtrim ini_is_ws ↻ ini_find

structs

41struct IniEntry

consts

37const INI_MAGIC_1024: i64 = 1024
39const INI_ERR_OVERFLOW: i64 = -1

functions

48func ini_is_ws(b: i64) -> i64
called by 2: ini_rtrimini_ltrim
57func ini_eol(buf: *u8, n: i64, off: i64) -> i64
called by 1: ini_parse
67func ini_rtrim(buf: *u8, start: i64, end: i64) -> i64
called by 1: ini_parse calls 1: ini_is_ws
77func ini_ltrim(buf: *u8, off: i64, end: i64) -> i64
called by 1: ini_parse calls 1: ini_is_ws
88func ini_parse(buf: *u8, n: i64,
called by 1: main calls 3: ini_eolini_ltrimini_rtrim
170func ini_find(buf: *u8, entries: *IniEntry, count: i64,
called by 1: main
206func main() -> i64