code wiki / (root) / nx_npy_gate.nx

nx_npy_gate.nx

buildroot/runtime/nx_npy_gate.nx

7672 B150 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_npy_gate.nx -- proves the .npy parser reads what is there and REFUSES the three things that corrupt silently. procgen PG38's opening move, gateable on its own before any model byte is fetched. WHY THE NEG-CONTROLS ARE THE POINT. A forward-only suite here would pass for a parser that ignores fortran_order, guesses an itemsize and trusts the declared shape -- and every one of those returns PLAUSIBLE NUMBERS rather than an error. A transposed basis, a factor-of-two offset walk, or a read past the end of a member all look like data. So T7-T10 are the load-bearing teeth. THE FIXTURE IS ASSEMBLED AT RUNTIME, never read from disk: the parser's own subject is a byte layout, so a byte layout built in memory is the honest fixture and there is no file to go stale. The teeth are ARITHMETIC over that layout (count = product of dims; data_off + count*itemsize = total), which makes them their own oracle in the mathcore sense -- no second implementation to disagree with. license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_npy_lib.nx nx_npy_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_npy_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_mmap ↻ ng_mk ng_putb ng_puts gv_check_eq gv_check gv_puts ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap npy_is_npy npy_streq_at npy_major npy_is_npy ↻ npy_open npy_is_npy ↻ npy_data_off npy_hdr_off

structs

none

consts

22const NG_CAP: i64 = 262144
23const NG_Q: i64 = 39 // '\'' by name, the header's own quoting

functions

25func ng_puts(b: *u8, o0: i64, s: *u8) -> i64
called by 1: ng_mk
32func ng_putb(b: *u8, o: i64, v: i64) -> i64 { b[o] = v as u8; return o + 1 }
called by 1: ng_mk
36func ng_mk(b: *u8, descr: *u8, fortran: *u8, shape_txt: *u8, nbytes: i64) -> i64
called by 1: main calls 2: ng_putbng_puts
67func main() -> i64