code wiki / (root) / nx_nif_gate.nx

nx_nif_gate.nx

buildroot/runtime/nx_nif_gate.nx

17835 B349 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_nif_gate.nx -- BITE-PROOF for the NIF structural probe + geometry leg, both directions. IT DRIVES THE SHIPPING CODE: every tooth calls nx_nif_lib directly -- the same nif_probe, nif_types and nif_geom the CLI calls. FIXTURES ARE ASSEMBLED AT RUNTIME under /tmp/<gate>/ by a byte builder (binary format; no literal fixture bytes exist in this source). Idempotent. FIXTURE HONESTY, DECLARED: the good fixtures are SYNTHETIC minimal modern-layout NIFs derived from the mirrored nif.xml and the hex-measured real SE + FO76 files; the REAL corpus (nifly test nifs, hex-verified 2026-08-30) rides the CLI smoke and the banked-mirror watch row. license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_nif_lib.nx nx_nif_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_nif_lib.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ sys_mkdir sys_mmap ↻ ng_build_good ng_raw ng_u8 ng_u32 ng_export_empty ng_u8 ↻ ng_u16 ng_sized ng_u32 ↻ ng_slen ng_raw ↻ ng_zeros ng_write sys_unlinkat sys_openat_wr sys_write ↻ sys_close ng_build_bs155

structs

none

consts

16const NG_DIR: *u8 = "/tmp/nx_nif_gate" as *u8
17const NG_F_GOOD: *u8 = "/tmp/nx_nif_gate/good.nif" as *u8
18const NG_F_BS155: *u8 = "/tmp/nx_nif_gate/bs155.nif" as *u8
19const NG_F_OOB: *u8 = "/tmp/nx_nif_gate/oob.nif" as *u8
20const NG_F_JUNK: *u8 = "/tmp/nx_nif_gate/junk.bin" as *u8
21const NG_F_OLDVER: *u8 = "/tmp/nx_nif_gate/oldver.nif" as *u8
22const NG_F_ABSURD: *u8 = "/tmp/nx_nif_gate/absurd.nif" as *u8
23const NG_F_EMPTY: *u8 = "/tmp/nx_nif_gate/empty.nif" as *u8
24const NG_BUFCAP: i64 = 8192
25const NG_VER_OLD: i64 = 335544323 // 0x14000003 = 20.0.0.3 -- recognized magic, unsupported layout
27const NG_GEO_DESCLO: i64 = 5
28const NG_GEO_VERTS: i64 = 2
29const NG_GEO_TRIS: i64 = 1
30const NG_GEO_DSIZE: i64 = 46
31const NG_GEO_BLOCK: i64 = 162 // 100 prefix (0 extras) + 8 desc + 2 tri + 2 vert + 4 dsize + 46 data
32const NG_F32_ONE: i64 = 1065353216 // 1.0f -- vertex 0 x
33const NG_F32_ONEP5: i64 = 1069547520 // 1.5f -- vertex 1 y
34const NG_F32_TWO: i64 = 1073741824 // 2.0f -- the good NiBound radius (covers both verts)
35const NG_F32_HALF: i64 = 1056964608 // 0.5f -- the out-of-bound radius (covers neither)
36const NG_BLOCKBYTES: i64 = 212 // 20 (NiNode) + 162 (real BSTriShape) + 30 (undersized BSTriShape)

functions

38func ng_u8(dst: *u8, at: i64, v: i64) -> i64 { dst[at] = v as u8; return at + 1 }
39func ng_u16(dst: *u8, at: i64, v: i64) -> i64 { dst[at] = (v & 0xff) as u8; dst[at + 1] = ((v >> 8) & 0xff) as u8; return at + 2 }
40func ng_u32(dst: *u8, at: i64, v: i64) -> i64
47func ng_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: ng_sized
48func ng_raw(dst: *u8, at: i64, s: *u8) -> i64
54func ng_sized(dst: *u8, at: i64, s: *u8) -> i64
59func ng_export_empty(dst: *u8, at: i64) -> i64
63func ng_zeros(dst: *u8, at: i64, count: i64) -> i64
69func ng_write(path: *u8, body: *u8, n: i64) -> i64
81func ng_build_good(dst: *u8, ver: i64, rbits: i64) -> i64
135func ng_build_bs155(dst: *u8) -> i64
158func ng_build_absurd(dst: *u8) -> i64
173func main(argc: i64, argv: *i64) -> i64