code wiki / _hdl_build / nx_figure_gate.nx

nx_figure_gate.nx

buildroot/runtime/_hdl_build/nx_figure_gate.nx

14542 B306 linesdepth 6pulls 9 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_figure_gate.nx -- IMS Thrust D R2 REFEREE: proves nx_chart (native SVG) + nx_dataset_export (CSV/JSON/TSV) are CORRECT and HONEST, with negative-control TEETH (a green can't be faked). REAL DATASET (not invented): the live wiki's own page-count growth across the IMS rungs -- 8 -> 12 -> 13 -> 20 -> 21 pages (the documented arc progression; the corpus is at 21 today and becomes 22 with this very page). Labels = the rung tags, values = the page count at each. CHECKS: (a) CHART well-formed: A1 balanced: exactly one "<svg" and one "</svg>" in the output. A2 bar count: exactly N occurrences of "<rect class=\"bar\"" for N data values. A3 value->height: a known value's bar height equals the INDEPENDENTLY recomputed scaled height vs_linear(0, nice_top, 0, CH_PLOT_H, v) -- read back from the emitted height="..". (b) BYTE-FAITHFUL multi-format export (the round-trip oracle dx_equal): B1 CSV -> parse -> dx_equal(original) (identical records) B2 JSON -> parse -> dx_equal(original) B3 TSV -> parse -> dx_equal(original) B4 CROSS chain: original -> CSV -> ds1 -> JSON -> ds2 -> TSV -> ds3, all == original. B5 ESCAPING TEETH: a cell containing a comma AND a double-quote (`a,"b`) survives the CSV round trip byte-exact AND the CSV bytes actually quote+double it ("a,""b"). A naive emitter that forgot to escape would corrupt the parse -> this check would FAIL. (c) GRACEFUL edges: C1 empty dataset (0 rows): CSV emits header-only (valid), chart emits 0 bars + stays balanced. C2 malformed JSON ("not json") -> dx_parse_json returns a NEGATIVE verdict, no crash. GREEN iff all pass. Evidence -> knowledge/status/figure_gate.log. Sovereign: imports the two organs + nx_framed_append + nx_syscalls. license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_chart.nx nx_dataset_export.nx nx_framed_append.nx nx_syscalls.nx nx_figure_gate.nx

imports: nx_chart.nxnx_dataset_export.nxnx_framed_append.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main fg_w sys_write sys_mmap dx_alloc sys_mmap ↻ dx_set_hdr dx_set_cell_z dx_set_cell dx_cell_ptr dx_cell_len chart_svg ch_maxv ch_nice_top vsh_lit vsh_n sys_mmap ↻ sys_mmap ↻ va_axis_left sys_mmap ↻ vs_ticks vs_linear vsh_lit ↻ vsh_n ↻ vs_linear ↻ fg_count ch_nice_top ↻ vs_linear ↻ fg_find fg_first_height fg_row sys_mmap ↻ fg_cat fa_appendz fa_append sys_mmap ↻ sys_openat_append sys_flock fa_write_all sys_write ↻

structs

none

consts

33const FG_LOG: *u8 = "knowledge/status/figure_gate.log"
34const FG_CAP: i64 = 512

functions

36func fg_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: fg_rowmain calls 1: sys_write
37func fg_num(v: i64) -> i64
45func fg_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != 0 as u8 { dst[off + i] = s[i]; i = i + 1 } return off + i }
called by 2: fg_rowmain
46func fg_catn(dst: *u8, off: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
56func fg_row(name: *u8, pass: i64) -> i64
called by 1: main calls 4: sys_mmapfg_catfa_appendzfg_w
69func fg_count(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: main
84func fg_find(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: main
100func fg_first_height(buf: *u8, n: i64, from: i64) -> i64
called by 1: main
119func main() -> i64