ini.nx
buildroot/runtime/ini.nx
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
imports: syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| 34 | struct IniEntry { |
consts
| 32 | const INI_ERR_OVERFLOW: i64 = -1 |
functions
| 41 | func ini_is_ws(b: i64) -> i64 { |
| 50 | func ini_eol(buf: *u8, n: i64, off: i64) -> i64 {
called by 1: ini_parse |
| 60 | func ini_rtrim(buf: *u8, start: i64, end: i64) -> i64 { |
| 70 | func ini_ltrim(buf: *u8, off: i64, end: i64) -> i64 { |
| 81 | func ini_parse(buf: *u8, n: i64, |
| 163 | func ini_find(buf: *u8, entries: *IniEntry, count: i64,
called by 1: main |
| 199 | func main() -> i64 { |