code wiki / (root) / nx_bright_reasoned_import_gate.nx

nx_bright_reasoned_import_gate.nx

buildroot/runtime/nx_bright_reasoned_import_gate.nx

17460 B279 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic bright
docsdependenciesstructsconstsfunctions

about

nx_bright_reasoned_import_gate.nx -- GATE for nx_bright_reasoned_import (the referee-replay importer), driven IN-PROCESS on a fixture tree under /tmp: a three-pair JSON whose key carries an escaped newline and whose value carries an escaped quote, an escaped backslash, a two-byte \u escape, a surrogate-pair \u escape and an escaped tab; a biology queries.tsv whose second row ends in CRLF; an economics queries.tsv whose only row has no rewrite (the neg-control). Every expected byte string is BUILT at run time from named pieces and byte constants, so no tooth depends on the lexer's escape contract. Proves: both walk passes agree on the pair count, the decoded key equals the prep organ's flattened cell, the decoded value carries the exact UTF-8 bytes, reason and concat rows are byte-exact, a CRLF row still matches, staging is idempotent, a BOM is skipped, an unmatched row is COUNTED and the ONE decision function refuses it, an unreadable split refuses, a truncated object is malformed, and the split table is nx_beir_eval's. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_bright_reasoned_import.nx nx_bright_reasoned_import_gate

imports: nx_syscalls.nxnx_gate_verdict.nxnx_bright_reasoned_import.nx

imported by: nobody (leaf or entry point)

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

main gv_head gv_puts sys_write 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 ↻ sys_mkdir sys_mmap ↻ x_build_json x_catb x_cat x_slen x_esc x_catb ↻ x_cat ↻ x_build_q_bio x_cat ↻ x_catb ↻ x_build_q_econ x_cat ↻ x_catb ↻ gv_check gv_puts ↻ x_write sys_openat_wr sys_write ↻

structs

none

consts

15const X_ROOT: *u8 = "/tmp/nx_bright_reasoned_import_gate"
16const X_BRIGHT: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright"
17const X_D_BIO: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/biology"
18const X_D_ECON: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/economics"
19const X_Q_BIO: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/biology/queries.tsv"
20const X_Q_ECON: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/economics/queries.tsv"
21const X_JSON: *u8 = "/tmp/nx_bright_reasoned_import_gate/reasoned.json"
22const X_JSON_BOM: *u8 = "/tmp/nx_bright_reasoned_import_gate/reasoned_bom.json"
23const X_JSON_CUT: *u8 = "/tmp/nx_bright_reasoned_import_gate/reasoned_cut.json"
24const X_OUT_REASON: *u8 = "queries.fx_reason.tsv"
25const X_OUT_CONCAT: *u8 = "queries.fx_concat.tsv"
26const X_TMP_REASON: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/biology/queries.fx_reason.tsv.tmp"
27const X_TMP_CONCAT: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/biology/queries.fx_concat.tsv.tmp"
28const X_TMP_REASON2: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/biology/queries.fx_reason2.tsv.tmp"
29const X_OUT_REASON2: *u8 = "queries.fx_reason2.tsv"
30const X_MODE_DIR: i64 = 0x1ed
31const X_CELL: i64 = 8
32const X_CAP: i64 = 4096
33const X_PAIRS: i64 = 3
34const X_BOM_0: i64 = 0xEF
35const X_BOM_1: i64 = 0xBB
36const X_BOM_2: i64 = 0xBF
37const X_E_ACUTE_0: i64 = 0xC3
38const X_E_ACUTE_1: i64 = 0xA9
39const X_SMILE_0: i64 = 0xF0
40const X_SMILE_1: i64 = 0x9F
41const X_SMILE_2: i64 = 0x98
42const X_SMILE_3: i64 = 0x80
44const X_W_ALPHA: *u8 = "alpha"
45const X_W_BETA: *u8 = "beta"
46const X_W_GAMMA: *u8 = "gamma"
47const X_W_DELTA: *u8 = "delta"
48const X_W_SECOND: *u8 = "second"
49const X_W_UNUSED: *u8 = "unused"
50const X_W_V: *u8 = "v"
51const X_W_1: *u8 = "1"
52const X_W_TAIL: *u8 = "tail"
53const X_W_NOPE: *u8 = "nope"
54const X_W_ID0: *u8 = "0"
55const X_W_ID1: *u8 = "1"
56const X_H_E9: *u8 = "00e9"
57const X_H_D83D: *u8 = "d83d"
58const X_H_DE00: *u8 = "de00"
59const X_W_N: *u8 = "n"
60const X_W_T: *u8 = "t"
61const X_W_U: *u8 = "u"
62const X_SPLIT0: *u8 = "biology"
63const X_SPLIT11: *u8 = "theoremqa_theorems"

functions

65func x_slen(s: *u8) -> i64 { var n: i64 = 0; while ((s[n] as i64) & RI_BYTE) != 0 { n = n + 1 } return n }
called by 2: x_catmain
66func x_cat(dst: *u8, off: i64, s: *u8) -> i64 { let n: i64 = x_slen(s); var i: i64 = 0; while i < n { dst[off + i] = s[i]; i = i + 1 } dst[off + n] = 0 as u8; return off + n }
67func x_catb(dst: *u8, off: i64, b: i64) -> i64 { dst[off] = b as u8; dst[off + 1] = 0 as u8; return off + 1 }
69func x_esc(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64 = x_catb(dst, off, RI_BACKSLASH); return x_cat(dst, o, s) }
called by 1: x_build_json calls 2: x_catbx_cat
70func x_write(path: *u8, buf: *u8, n: i64) -> i64
78func x_read(path: *u8, lenp: *i64) -> *u8 { lenp[0] = 0; return sys_read_file(path, lenp) }
called by 2: x_file_eqx_decode calls 1: sys_read_file
79func x_bytes_eq(a: *u8, an: i64, b: *u8, bn: i64) -> i64 { if an != bn { return 0 } return ri_memeq(a, b, an) }
called by 2: x_file_eqmain calls 1: ri_memeq
80func x_file_eq(path: *u8, want: *u8, wn: i64) -> i64
called by 1: main calls 3: sys_mmapx_readx_bytes_eq
87func x_expect_value_a(dst: *u8) -> i64
called by 1: main calls 2: x_catx_catb
104func x_expect_key_a(dst: *u8) -> i64 { var o: i64 = x_cat(dst, 0, X_W_ALPHA); o = x_catb(dst, o, RI_SPACE); return x_cat(dst, o, X_W_BETA) }
called by 1: main calls 2: x_catx_catb
106func x_build_json(dst: *u8, bom: i64) -> i64
called by 1: main calls 3: x_catbx_catx_esc
127func x_build_q_bio(dst: *u8) -> i64
called by 1: main calls 2: x_catx_catb
132func x_build_q_econ(dst: *u8) -> i64 { var o: i64 = x_cat(dst, 0, X_W_ID0); o = x_catb(dst, o, RI_TAB); o = x_cat(dst, o, X_W_NOPE); return x_catb(dst, o, RI_NL) }
called by 1: main calls 2: x_catx_catb
134func x_expect_reason(dst: *u8, va: *u8, val: i64) -> i64
called by 1: main calls 2: x_catx_catb
140func x_expect_concat(dst: *u8, va: *u8, val: i64) -> i64
called by 1: main calls 2: x_catx_catb
146func x_decode(path: *u8, out: *i64) -> i64
called by 1: main calls 3: sys_mmapx_readri_walk
175func main() -> i64