code wiki / _hdl_build / nx_flip_lib.nx

nx_flip_lib.nx

buildroot/runtime/_hdl_build/nx_flip_lib.nx

8397 B244 linesdepth 5pulls 6 transitivereach 5 importersview sourcekind librarytopic flip
docsdependenciesstructsconstsfunctions

about

nx_flip_lib.nx -- THE BASE for the FlipOrgan family (rule #6 OO base, rule #15 DRY, rule #22). NishiLang has no classes, so the base-class contract is expressed as a shared library every organ in the family imports and specialises. Before this, nx_flip_score / _real / _defl / _worklist / _gate each carried their OWN copy of the SAME ~17 primitives under a private prefix (fl_ fr_ fd_ fw_ fg_) -- five copies of column parsing, five of integer printing, five of the line-scan idiom. A fix to any one of them fixed only one organ. That does not scale and it is how the family drifts. THE FAMILY CONTRACT every FlipOrgan honours (enforced by nx_flip_gate, 16 cases): 1. summary + `verdict=` FIRST, detail buffered and flushed last (nx_plan_run caps snippets at 200B) 2. FAIL-CLOSED on absent input -- an absent finding/component/observation is a FINDING, not a neutral 3. every threshold read from a plane, never a literal in code (rule #11) 4. integer-only arithmetic, basis points for ratios (no-float substrate) 5. a `verdict=` anchor so the ecosystem judge can read the result (D001) TAB-separated, newline-terminated plane rows are the ONE wire format (rule: planes > tsv). license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 5 importers

nx_store_seed_lib.nx nx_seg_store.nx nx_syscalls.nx nx_flip_lib.nx nx_flip_defl.nx nx_flip_gate.nx nx_flip_real.nx nx_flip_score.nx nx_flip_worklist.nx

imports: nx_store_seed_lib.nxnx_seg_store.nxnx_syscalls.nx

imported by: nx_flip_defl.nxnx_flip_gate.nxnx_flip_real.nxnx_flip_score.nxnx_flip_worklist.nx

structs

none

consts

22const FX_TAB: i64 = 9
23const FX_NL: i64 = 10
24const FX_MINUS: i64 = 45
25const FX_D0: i64 = 48
26const FX_D9: i64 = 57
27const FX_BPS: i64 = 10000
28const FX_BUF: i64 = 262144
29const FX_OUT: i64 = 1
30const FX_SCRATCH: i64 = 32
31const FX_PFXCAP: i64 = 256
32const FX_NUMCAP: i64 = 40
33const FX_TMPCAP: i64 = 32
34const FX_BASE10: i64 = 10
35const FX_EXIT_USAGE: i64 = 2
36const FX_EXIT_REFUSED: i64 = 4

functions

39func fx_puts(s: *u8) -> i64
44func fx_putn(n: i64) -> i64
59func fx_kv(k: *u8, v: i64) -> i64
called by 4: mainmainmainmain calls 2: fx_putsfx_putn
66func fx_putslice(b: *u8, a: i64, e: i64) -> i64
calls 1: sys_write
72func fx_bcat(b: *u8, o: i64, s: *u8) -> i64
called by 4: fg_bcatmainmainmain
78func fx_bcatn(b: *u8, o: i64, n: i64) -> i64
called by 3: fg_bcatnmainmain calls 1: sts_mm
90func fx_bcatsl(b: *u8, o: i64, src: *u8, a: i64, e: i64) -> i64
called by 3: mainmainmain
98func fx_atoi(s: *u8) -> i64
called by 3: mainmainmain
114func fx_line_end(b: *u8, n: i64, i: i64) -> i64
122func fx_col(b: *u8, ls: i64, le: i64, idx: i64, out: *i64) -> i64
140func fx_slice_atoi(b: *u8, a: i64, e: i64) -> i64
158func fx_col_atoi(b: *u8, ls: i64, le: i64, idx: i64, sp: *i64) -> i64
called by 3: mainmainmain calls 2: fx_colfx_slice_atoi
162func fx_slice_eqs(b: *u8, a: i64, e: i64, s: *u8) -> i64
170func fx_slice_eq(a: *u8, a0: i64, a1: i64, b: *u8, b0: i64, b1: i64) -> i64
179func fx_row_by_id(b: *u8, n: i64, key: *u8, out: *i64, sp: *i64) -> i64
193func fx_row_by_slice(b: *u8, n: i64, kb: *u8, k0: i64, k1: i64, out: *i64, sp: *i64) -> i64
called by 1: main calls 3: fx_line_endfx_colfx_slice_eq
209func fx_has_finding(bf: *u8, nf: i64, deal: *u8, dealcol: i64, compcol: i64, kb: *u8, k0: i64, k1: i64, sp: *i64) -> i64
229func fx_cat2(root: *u8, tail: *u8) -> *u8
called by 4: mainfx_planemainmain calls 1: sts_mm
240func fx_plane(root: *u8, tail: *u8, nout: *i64) -> *u8