code wiki / _hdl_build / nx_axis_taxonomy_gate.nx
nx_axis_taxonomy_gate.nx source
↩ module page · 155 lines · 7164 B
1// nx_axis_taxonomy_gate.nx -- THE UNIVERSAL INSTRUMENT (operator 2026-07-09: "if its a legal item, a physical
2// product, a digital product, etc it can capture all the correct axes and we can truly bank and get to state
3// of the art and beyond"). Proves the instrument generalizes across SUBJECT CLASSES: per-class axis TAXONOMIES
4// as DATA (knowledge/compare/axes/<class>.axes: layer<TAB>axis<TAB>bar-source-class) + per-class BANKED bars
5// via the same zero-code researcher. Teeth: 3 diverse classes (digital/physical/legal) load with their
6// class-correct axes; every class has REAL banked bars on disk; the physical taxonomy maps onto our own
7// metrology work (cadtwin) = template applies to what we build. expect_exit: 0 license_tier: ORIGINAL
8import "nx_syscalls.nx"
9
10func ax_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
11func ax_n(v: i64) -> i64 {
12 let bb: *u8 = sys_mmap(28)
13 var m: i64 = v
14 if m < 0 { ax_w("-" as *u8); m = 0 - m }
15 let t: *u8 = sys_mmap(28)
16 var k: i64 = 0
17 if m == 0 { t[0] = 48 as u8; k = 1 }
18 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
19 var i: i64 = 0
20 while i < k { bb[i] = t[k - 1 - i]; i = i + 1 }
21 sys_write(1, bb, k)
22 return 0
23}
24func ax_find(buf: *u8, n: i64, pat: *u8) -> i64 {
25 var pl: i64 = 0
26 while pat[pl] != (0 as u8) { pl = pl + 1 }
27 if pl == 0 { return 0 - 1 }
28 var i: i64 = 0
29 while i + pl <= n {
30 var j: i64 = 0
31 var ok: i64 = 1
32 while j < pl {
33 if buf[i + j] != pat[j] { ok = 0; j = pl } else { j = j + 1 }
34 }
35 if ok == 1 { return i }
36 i = i + 1
37 }
38 return 0 - 1
39}
40func ax_read(path: *u8, buf: *u8, cap: i64) -> i64 {
41 let fd: i64 = sys_openat_rd(path)
42 if fd < 0 { return 0 - 1 }
43 var tot: i64 = 0
44 var going: i64 = 1
45 while going == 1 {
46 if tot >= cap { going = 0 } else {
47 let r: i64 = sys_read(fd, ((buf as i64) + tot) as *u8, cap - tot)
48 if r <= 0 { going = 0 } else { tot = tot + r }
49 }
50 }
51 sys_close(fd)
52 return tot
53}
54// count non-comment axis lines (contain a TAB)
55func ax_lines(buf: *u8, n: i64) -> i64 {
56 var c: i64 = 0
57 var i: i64 = 0
58 while i < n {
59 var e: i64 = i
60 var hastab: i64 = 0
61 var going: i64 = 1
62 while going == 1 {
63 if e >= n { going = 0 } else {
64 if buf[e] == (10 as u8) { going = 0 } else {
65 if buf[e] == (9 as u8) { hastab = 1 }
66 e = e + 1
67 }
68 }
69 }
70 if hastab == 1 { if buf[i] != (35 as u8) { c = c + 1 } }
71 i = e + 1
72 }
73 return c
74}
75func ax_tooth(name: *u8, pass: i64, fails: *i64) -> i64 {
76 ax_w(" " as *u8)
77 ax_w(name)
78 ax_w(" -> " as *u8)
79 if pass == 1 { ax_w("PASS\n" as *u8); return 0 }
80 ax_w("FAIL\n" as *u8)
81 fails[0] = fails[0] + 1
82 return 0
83}
84
85func main() -> i64 {
86 ax_w("=== nx_axis_taxonomy_gate -- UNIVERSAL classes: digital / physical / legal axes + banked bars ===\n" as *u8)
87 let fails: *i64 = sys_mmap(8) as *i64
88 fails[0] = 0
89 let buf: *u8 = sys_mmap(1048576)
90
91 // T1 DIGITAL taxonomy: class-correct axes incl the operator's full-stack layers (mobile, a11y, infra, ui)
92 let nd: i64 = ax_read("knowledge/compare/axes/digital.axes" as *u8, buf, 1048576)
93 var t1: i64 = 0
94 if nd > 100 { if ax_lines(buf, nd) >= 10 {
95 if ax_find(buf, nd, "mobile" as *u8) >= 0 { if ax_find(buf, nd, "accessibility" as *u8) >= 0 {
96 if ax_find(buf, nd, "deploy" as *u8) >= 0 { if ax_find(buf, nd, "visual-fidelity" as *u8) >= 0 { t1 = 1 } }
97 } }
98 } }
99 ax_tooth("T1 DIGITAL axes: >=10 rows incl ui/mobile/a11y/infra (full stack top to bottom)" as *u8, t1, fails)
100
101 // T2 PHYSICAL taxonomy: metrology/materials/safety/fit -- the engineering-twin axis world
102 let np: i64 = ax_read("knowledge/compare/axes/physical.axes" as *u8, buf, 1048576)
103 var t2: i64 = 0
104 if np > 100 { if ax_lines(buf, np) >= 7 {
105 if ax_find(buf, np, "tolerances" as *u8) >= 0 { if ax_find(buf, np, "material" as *u8) >= 0 {
106 if ax_find(buf, np, "safety" as *u8) >= 0 { if ax_find(buf, np, "threads" as *u8) >= 0 { t2 = 1 } }
107 } }
108 } }
109 ax_tooth("T2 PHYSICAL axes: >=7 rows incl tolerances/materials/safety/thread-fit" as *u8, t2, fails)
110
111 // T3 LEGAL taxonomy: formation/jurisdiction/clauses/execution
112 let nl: i64 = ax_read("knowledge/compare/axes/legal.axes" as *u8, buf, 1048576)
113 var t3: i64 = 0
114 if nl > 100 { if ax_lines(buf, nl) >= 7 {
115 if ax_find(buf, nl, "consideration" as *u8) >= 0 { if ax_find(buf, nl, "jurisdiction" as *u8) >= 0 {
116 if ax_find(buf, nl, "clauses" as *u8) >= 0 { if ax_find(buf, nl, "esign" as *u8) >= 0 { t3 = 1 } }
117 } }
118 } }
119 ax_tooth("T3 LEGAL axes: >=7 rows incl formation/jurisdiction/clauses/e-sign execution" as *u8, t3, fails)
120
121 // T4 BANKED BARS per class (the researcher generalizes: digital pb_godot, physical phb_iso, legal lb_ucc)
122 let b1: i64 = ax_read("knowledge/library/pb_godot_layers.txt" as *u8, buf, 1048576)
123 let b2: i64 = ax_read("knowledge/library/phb_iso2768_tolerances.txt" as *u8, buf, 1048576)
124 var hasiso: i64 = 0
125 if b2 > 5000 { if ax_find(buf, b2, "2768" as *u8) >= 0 { hasiso = 1 } }
126 let b3: i64 = ax_read("knowledge/library/lb_ucc_overview.txt" as *u8, buf, 1048576)
127 var hasucc: i64 = 0
128 if b3 > 5000 { if ax_find(buf, b3, "Uniform Commercial" as *u8) >= 0 { hasucc = 1 } }
129 var t4: i64 = 0
130 if b1 > 5000 { if hasiso == 1 { if hasucc == 1 { t4 = 1 } } }
131 ax_tooth("T4 BANKED bars in all 3 classes (godot repo / ISO-2768 tolerances / UCC statute text)" as *u8, t4, fails)
132
133 // T5 the PHYSICAL taxonomy maps onto our own engineering-twin work (cadtwin census carries metrology cells)
134 let nc: i64 = ax_read("runtime/_hdl_build/nx_cadtwin_census.nx" as *u8, buf, 1048576)
135 var t5: i64 = 0
136 if nc > 1000 { if ax_find(buf, nc, "metrology" as *u8) >= 0 { if ax_find(buf, nc, "interop" as *u8) >= 0 { t5 = 1 } } }
137 ax_tooth("T5 physical taxonomy MAPS onto real work (cadtwin has metrology+interop cells)" as *u8, t5, fails)
138
139 // T6 determinism
140 let nd2: i64 = ax_read("knowledge/compare/axes/digital.axes" as *u8, buf, 1048576)
141 var t6: i64 = 0
142 if nd2 == nd { t6 = 1 }
143 ax_tooth("T6 deterministic" as *u8, t6, fails)
144
145 ax_w("\nUNIVERSAL INSTRUMENT: subject class -> its .axes taxonomy (DATA) + its .q bar spec (DATA) -> the SAME\n" as *u8)
146 ax_w("zero-code researcher banks the bars -> the census generator consumes class-correct axes -> the coach\n" as *u8)
147 ax_w("enforces citations. New class = 2 spec files, 0 code. HONEST: legal deep sources (law.cornell/govinfo)\n" as *u8)
148 ax_w("behind the cloudflare wall -> accessible references banked, LII = the neutral-access rung.\n" as *u8)
149 ax_w("\nfails=" as *u8)
150 ax_n(fails[0])
151 ax_w("\n" as *u8)
152 if fails[0] == 0 { ax_w("GREEN -- universal axis taxonomy 6/6 (digital+physical+legal, axes+bars)\n" as *u8); return 0 }
153 ax_w("RED\n" as *u8)
154 return 1
155}