code wiki / (root) / ini.nx

ini.nx

buildroot/runtime/ini.nx

7218 B226 linesdepth 3pulls 3 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

syscalls.nx ini.nx

imports: syscalls.nx

imported by: nobody (leaf or entry point)

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

main ini_parse ini_eol ini_ltrim ini_is_ws ini_rtrim ini_is_ws ↻ ini_find

structs

34struct IniEntry {

consts

32const INI_ERR_OVERFLOW: i64 = -1

functions

41func ini_is_ws(b: i64) -> i64 {
called by 2: ini_rtrimini_ltrim
50func ini_eol(buf: *u8, n: i64, off: i64) -> i64 {
called by 1: ini_parse
60func ini_rtrim(buf: *u8, start: i64, end: i64) -> i64 {
called by 1: ini_parse calls 1: ini_is_ws
70func ini_ltrim(buf: *u8, off: i64, end: i64) -> i64 {
called by 1: ini_parse calls 1: ini_is_ws
81func ini_parse(buf: *u8, n: i64,
called by 1: main calls 3: ini_eolini_ltrimini_rtrim
163func ini_find(buf: *u8, entries: *IniEntry, count: i64,
called by 1: main
199func main() -> i64 {