code wiki / _hdl_build / nx_ag_lib.nx
nx_ag_lib.nx
buildroot/runtime/_hdl_build/nx_ag_lib.nx
about
nx_ag_lib.nx -- shared gate helpers (atoi / itoa / strlen / single-read) extracted from nx_gated_edit_gate
+ nx_consol_apply_gate, which carried byte-identical copies (rule 15: pattern in 2+ -> shared/). Bodies are
VERBATIM -> behaviour-preserving by construction; proven by re-running the consumer gate GREEN after delegation.
license_tier: ORIGINAL No hw writes (Rule 26). Consumers: nx_gated_edit_gate (+ nx_consol_apply_gate pending NAS sync).
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_itoa_lib.nx
imported by: nx_gated_edit_gate.nxnx_gated_edit_multi_gate.nx
structs
| none |
consts
| none |
functions
| 7 | func ag_atoi(s: *u8) -> i64 { var v: i64 = 0; var i: i64 = 0; while s[i] != (0 as u8) { let c: i64 = s[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } i = i + 1 } return v } |
| 15 | func ag_itoa(dst: *u8, v: i64) -> i64 { return ccz_cat_num(dst, 0, v) } |
| 16 | func ag_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 17 | func ag_read(path: *u8, buf: *u8, cap: i64) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 - 1 } let n: i64 = sys_read(fd, buf, cap - 1); sys_close(fd); return n } |