code wiki / _hdl_build / nx_buildroot_guard.nx
nx_buildroot_guard.nx
buildroot/runtime/_hdl_build/nx_buildroot_guard.nx
about
nx_buildroot_guard.nx -- SELF-HEALING buildroot integrity (eats seq140: the recurring lib-drift that
breaks EVERY store-lib organ build when a sibling ships/reverts an OLD nx_seg_store.nx without ss_begin_cap).
Data-driven (rule 11): a manifest of <buildroot-lib-path> <required-symbol> <pinned-good-path> rows. The
drift signal is SEMANTIC (missing a required symbol = broken), NOT byte-equality -- so a legitimately-newer
lib that still has the symbol survives; only a BROKEN revert is healed. Fail-safe BY CONSTRUCTION: `pin`
refuses to snapshot a lib that lacks the symbol, and `heal` refuses to restore from a pin that lacks it
-- the guard can never make a build WORSE, only restore a known-good.
nx_buildroot_guard pin [manifest] (snapshot each currently-GOOD buildroot lib to its pinned-good path)
nx_buildroot_guard check [manifest] (JSON: per lib -- has_symbol, pinned_ok, drifted)
nx_buildroot_guard heal [manifest] (restore drifted libs from their pinned-good; JSON report)
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 1 imports · 0 importers
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
structs
| none |
consts
| 14 | const BG_CAP: i64 = 1048576 |
| 15 | const BG_TAB: i64 = 9 |
| 16 | const BG_NL: i64 = 10 |
| 17 | const BG_HASH: i64 = 35 |
| 18 | const BG_STDERR: i64 = 2 |
| 19 | const BG_MODE: i64 = 420 |
| 20 | const BG_SPAN: i64 = 16 |
| 21 | const BG_EXIT_USAGE: i64 = 2 |
functions
| 23 | func bg_werr(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(BG_STDERR, s, n); return 0 } |
| 24 | func bg_vlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: main |
| 25 | func bg_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o] = s[i]; o = o + 1; i = i + 1 } return o } called by 1: main |
| 26 | func bg_catn(d: *u8, o: i64, v: i64) -> i64 { let t: *u8 = sys_mmap(28); var m: i64 = v; if m < 0 { m = 0 } var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } var i: i64 = 0; while i < k { d[o] = t[k-1-i]; o = o + 1; i = i + 1 } return o } |
| 27 | func bg_cat_esc(d: *u8, o: i64, q: *u8, s: i64, e: i64) -> i64 { var i: i64 = s; while i < e { var c: i64 = q[i] as i64; if c == 34 { c = 39 } if c == 92 { c = 47 } if c < 32 { c = 32 } d[o] = c as u8; o = o + 1; i = i + 1 } return o } called by 1: main |
| 29 | func bg_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 39 | func bg_write(path: *u8, buf: *u8, n: i64) -> i64 |
| 47 | func bg_contains(buf: *u8, n: i64, lit: *u8) -> i64 called by 1: main |
| 61 | func bg_le(q: *u8, i: i64, n: i64) -> i64 { var e: i64 = i; var s: i64 = 1; while s == 1 { if e >= n { s = 0 } else { if q[e] == (BG_NL as u8) { s = 0 } else { e = e + 1 } } } return e } called by 1: main |
| 62 | func bg_col(q: *u8, ls: i64, le: i64, c: i64, out: *i64) -> i64 called by 1: main |
| 79 | func bg_cstr(q: *u8, s: i64, e: i64, dst: *u8) -> i64 { var i: i64 = 0; while s + i < e { dst[i] = q[s+i]; i = i + 1 } dst[i] = 0 as u8; return i } called by 1: main |
| 80 | func main(argc: i64, argv: *i64) -> i64 |