code wiki / _hdl_build / nx_gate_gn_gate.nx

nx_gate_gn_gate.nx

buildroot/runtime/_hdl_build/nx_gate_gn_gate.nx

4052 B92 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic gate
docsdependenciesstructsconstsfunctions

about

nx_gate_gn_gate.nx -- the gate for the integer printer 437 GATES IMPORT. WHY THIS EXISTS: nx_gensota's worklist ranked the unattached organs of generation 3 by importers, and rank 1 was nx_gate_gn itself -- the number-printer at the bottom of the verification fleet had no verification of its own. A printer that silently mis-renders a count would corrupt EVERY gate verdict that quotes a number, and nothing would catch it. HOW IT IS TESTED HONESTLY: gn() writes straight to fd 1, so asserting on a return value would prove nothing. This gate REDIRECTS fd 1 to a file (dup3), calls gn, restores fd 1, and READS THE BYTES BACK -- a writer is only tested by a read-back. TEETH: zero (the special case that returns early) - single digit - multi digit - the decade boundary - negative sign placement - a large value - and a NEGATIVE CONTROL that must FAIL if the comparator is vacuous. license_tier: ORIGINAL expect_exit: 0 No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_gate_gn.nx nx_gate_gn_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_gate_gn.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 gv_head gv_puts sys_write sys_mmap ↻ gg_check_val gg_capture sys_openat_wr sys_dup3 sys_close gn sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ↻ gg_eq gv_check gv_puts ↻ gv_puts ↻ gg_capture ↻ gg_eq ↻ gv_check ↻ gv_verdict gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_journal sys_openat_append sys_mmap ↻ gv_catn sys_mmap ↻ sys_munmap ↻ sys_now_realtime_sec

structs

none

consts

17const GG_SAVEFD: i64 = 19
18const GG_TMPMODE: i64 = 0x1a4
19const GG_BUFCAP: i64 = 256

functions

21func gg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
24func gg_capture(v: i64, path: *u8, out: *u8) -> i64
45func gg_eq(a: *u8, b: *u8) -> i64
called by 2: gg_check_valmain
55func gg_check_val(v: i64, want: *u8, ctr: *i64, name: *u8, path: *u8, buf: *u8) -> i64
called by 1: main calls 4: gg_capturegg_eqgv_checkgv_puts
69func main() -> i64