nx_nif_gate.nx
buildroot/runtime/nx_nif_gate.nx
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
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
structs
| none |
consts
| 16 | const NG_DIR: *u8 = "/tmp/nx_nif_gate" as *u8 |
| 17 | const NG_F_GOOD: *u8 = "/tmp/nx_nif_gate/good.nif" as *u8 |
| 18 | const NG_F_BS155: *u8 = "/tmp/nx_nif_gate/bs155.nif" as *u8 |
| 19 | const NG_F_OOB: *u8 = "/tmp/nx_nif_gate/oob.nif" as *u8 |
| 20 | const NG_F_JUNK: *u8 = "/tmp/nx_nif_gate/junk.bin" as *u8 |
| 21 | const NG_F_OLDVER: *u8 = "/tmp/nx_nif_gate/oldver.nif" as *u8 |
| 22 | const NG_F_ABSURD: *u8 = "/tmp/nx_nif_gate/absurd.nif" as *u8 |
| 23 | const NG_F_EMPTY: *u8 = "/tmp/nx_nif_gate/empty.nif" as *u8 |
| 24 | const NG_BUFCAP: i64 = 8192 |
| 25 | const NG_VER_OLD: i64 = 335544323 // 0x14000003 = 20.0.0.3 -- recognized magic, unsupported layout |
| 27 | const NG_GEO_DESCLO: i64 = 5 |
| 28 | const NG_GEO_VERTS: i64 = 2 |
| 29 | const NG_GEO_TRIS: i64 = 1 |
| 30 | const NG_GEO_DSIZE: i64 = 46 |
| 31 | const NG_GEO_BLOCK: i64 = 162 // 100 prefix (0 extras) + 8 desc + 2 tri + 2 vert + 4 dsize + 46 data |
| 32 | const NG_F32_ONE: i64 = 1065353216 // 1.0f -- vertex 0 x |
| 33 | const NG_F32_ONEP5: i64 = 1069547520 // 1.5f -- vertex 1 y |
| 34 | const NG_F32_TWO: i64 = 1073741824 // 2.0f -- the good NiBound radius (covers both verts) |
| 35 | const NG_F32_HALF: i64 = 1056964608 // 0.5f -- the out-of-bound radius (covers neither) |
| 36 | const NG_BLOCKBYTES: i64 = 212 // 20 (NiNode) + 162 (real BSTriShape) + 30 (undersized BSTriShape) |
functions
| 38 | func ng_u8(dst: *u8, at: i64, v: i64) -> i64 { dst[at] = v as u8; return at + 1 } |
| 39 | func 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 } |
| 40 | func ng_u32(dst: *u8, at: i64, v: i64) -> i64 |
| 47 | func 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 |
| 48 | func ng_raw(dst: *u8, at: i64, s: *u8) -> i64 |
| 54 | func ng_sized(dst: *u8, at: i64, s: *u8) -> i64 |
| 59 | func ng_export_empty(dst: *u8, at: i64) -> i64 |
| 63 | func ng_zeros(dst: *u8, at: i64, count: i64) -> i64 |
| 69 | func ng_write(path: *u8, body: *u8, n: i64) -> i64 |
| 81 | func ng_build_good(dst: *u8, ver: i64, rbits: i64) -> i64 |
| 135 | func ng_build_bs155(dst: *u8) -> i64 |
| 158 | func ng_build_absurd(dst: *u8) -> i64 |
| 173 | func main(argc: i64, argv: *i64) -> i64 |