code wiki / _hdl_build / nx_auto_builder.nx

nx_auto_builder.nx source

↩ module page · 441 lines · 18995 B

1// nx_auto_builder.nx -- the BUILDER's SELF-BUILD organ (the S-class-exceed rung of build-code 2// synthesis): a NEW CAPABILITY IS A SPEC FILE. Reads a build-spec grammar, routes the shape via 3// the CLASSIFIER (no human/Claude shape decision), dispatches the right pattern emitter, then 4// builds AND RUNS the authored KAT sovereignly -- spec in, gated capability out, hands-off. 5// name <module> the authored module name (paths derived) 6// feature <fname> classifier feature vector rows (in_table, in_state, ...) 7// param <ints...> shape-specific parameter vector, meaning per routed shape: 8// shape 12 WIRE_TLV: type_w len_w type_first len_le pad2 trail_w (pe7 v3) 9// shape 13 STRUCT_WALK: nfields k0 w0 k1 w1 ... (pe8 v2) 10// shape 18 STATE_MACHINE nstates nevents s0 t[0] t[1] ... (pe13) 11// VERDICTS (honest, exit-coded): GREEN(0) authored + KAT green; RED(1) KAT failed; 12// REFUSED(2) malformed spec or emitter rail refused; NEEDS-TUTOR(3) classifier routed a shape 13// this organ has no dispatch row for (NOVEL stays measured, never silently absorbed). 14// Durable: AUTOBUILD rows w/ measured ms -> knowledge/status/auto_builder.log. 15// EXCEEDS manual authoring: zero marginal Claude lines per capability, ms-scale latency, 16// byte-REPRODUCIBLE output (same spec -> identical module), classifier-routed dispatch. 17// Usage: nx_auto_builder <specpath> 18// LAWS: struct-free, integer-only, flat ifs (per-row parse helpers), no &&/||, <=6 args. 19// license_tier: ORIGINAL 20import "nx_pattern_classify.nx" 21import "nx_pattern_emit7.nx" 22import "nx_pattern_emit8.nx" 23import "nx_pattern_emit10.nx" 24import "nx_pattern_emit13.nx" 25import "nx_pattern_emit14.nx" 26import "nx_pattern_emit15.nx" 27import "nx_pattern_emit6.nx" 28import "nx_pattern_emit6_erf.nx" 29import "nx_syscalls.nx" 30const K_MAGIC_1000000: i64 = 1000000 31const K_MAGIC_2048: i64 = 2048 32 33func ab_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd, s, n); return 0 } 34func ab_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 } 35 36func ab_ms() -> i64 { 37 let ts: *i64 = sys_mmap(16) as *i64 38 sys_clock_gettime_mono(ts) 39 return ts[0] * 1000 + ts[1] / K_MAGIC_1000000 40} 41 42func ab_cat(dst: *u8, o: i64, s: *u8) -> i64 { 43 var i: i64 = 0 44 while s[i] != (0 as u8) { dst[o + i] = s[i]; i = i + 1 } 45 dst[o + i] = 0 as u8 46 return o + i 47} 48 49// ---- spec tokenizer (the proven flag pattern) ---- 50func ab_tok(buf: *u8, ls: i64, le: i64, idx: i64, se: *i64) -> i64 { 51 var i: i64 = ls 52 var cur: i64 = 0 53 var scanning: i64 = 1 54 var ret: i64 = 0 55 while scanning == 1 { 56 var skipping: i64 = 1 57 while skipping == 1 { 58 if i >= le { skipping = 0 } 59 if skipping == 1 { if buf[i] != (32 as u8) { skipping = 0 } } 60 if skipping == 1 { i = i + 1 } 61 } 62 if i >= le { scanning = 0 } 63 if scanning == 1 { 64 var j: i64 = i 65 var walking: i64 = 1 66 while walking == 1 { 67 if j >= le { walking = 0 } 68 if walking == 1 { if buf[j] == (32 as u8) { walking = 0 } } 69 if walking == 1 { j = j + 1 } 70 } 71 if cur == idx { se[0] = i; se[1] = j; ret = 1; scanning = 0 } 72 if scanning == 1 { cur = cur + 1; i = j } 73 } 74 } 75 return ret 76} 77 78func ab_teq(buf: *u8, s: i64, e: i64, lit: *u8) -> i64 { 79 var n: i64 = 0 80 while lit[n] != (0 as u8) { n = n + 1 } 81 if e - s != n { return 0 } 82 var i: i64 = 0 83 while i < n { 84 if buf[s + i] != lit[i] { return 0 } 85 i = i + 1 86 } 87 return 1 88} 89 90// signed decimal token (build specs carry -1 table entries) 91func ab_tint(buf: *u8, s: i64, e: i64) -> i64 { 92 var v: i64 = 0 93 var neg: i64 = 0 94 var i: i64 = s 95 if buf[i] == (45 as u8) { neg = 1; i = i + 1 } 96 while i < e { 97 let c: i64 = buf[i] as i64 98 if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } 99 i = i + 1 100 } 101 if neg == 1 { return 0 - v } 102 return v 103} 104 105func ab_tcopy(buf: *u8, s: i64, e: i64, pool: *u8, pp: *i64) -> i64 { 106 let base: i64 = (pool as i64) + pp[0] 107 var i: i64 = 0 108 while s + i < e { pool[pp[0] + i] = buf[s + i]; i = i + 1 } 109 pool[pp[0] + i] = 0 as u8 110 pp[0] = pp[0] + i + 1 111 return base 112} 113 114// feature name -> classifier index (the PLC_ contract as data); -1 unknown 115func ab_feat_idx(buf: *u8, s: i64, e: i64) -> i64 { 116 if ab_teq(buf, s, e, "in_bytes" as *u8) == 1 { return 0 } 117 if ab_teq(buf, s, e, "in_array" as *u8) == 1 { return 1 } 118 if ab_teq(buf, s, e, "in_pair" as *u8) == 1 { return 2 } 119 if ab_teq(buf, s, e, "in_state" as *u8) == 1 { return 3 } 120 if ab_teq(buf, s, e, "in_table" as *u8) == 1 { return 4 } 121 if ab_teq(buf, s, e, "in_coords" as *u8) == 1 { return 5 } 122 if ab_teq(buf, s, e, "has_time" as *u8) == 1 { return 6 } 123 if ab_teq(buf, s, e, "has_plant" as *u8) == 1 { return 7 } 124 if ab_teq(buf, s, e, "out_verdict" as *u8) == 1 { return 8 } 125 if ab_teq(buf, s, e, "out_value" as *u8) == 1 { return 9 } 126 if ab_teq(buf, s, e, "is_meta" as *u8) == 1 { return 10 } 127 if ab_teq(buf, s, e, "in_coeffs" as *u8) == 1 { return 11 } 128 if ab_teq(buf, s, e, "in_framed" as *u8) == 1 { return 12 } 129 if ab_teq(buf, s, e, "in_marked" as *u8) == 1 { return 13 } 130 if ab_teq(buf, s, e, "has_inverse" as *u8) == 1 { return 14 } 131 if ab_teq(buf, s, e, "in_ingest" as *u8) == 1 { return 15 } 132 if ab_teq(buf, s, e, "reads_log" as *u8) == 1 { return 16 } 133 if ab_teq(buf, s, e, "derives_permil" as *u8) == 1 { return 17 } 134 return 0 - 1 135} 136 137// parse one spec line into (namep, feats, params); returns 0 ok, -1 malformed 138func ab_parse_line(spec: *u8, ls: i64, le: i64, st: *i64) -> i64 { 139 // st[0]=name ptr st[1]=nparams st[2]=feats ptr st[3]=params ptr st[4]=pool ptr st[5]=pp ptr 140 if le <= ls { return 0 } 141 if spec[ls] == (35 as u8) { return 0 } 142 let se: *i64 = sys_mmap(32) as *i64 143 if ab_tok(spec, ls, le, 0, se) != 1 { return 0 } 144 let k0s: i64 = se[0] 145 let k0e: i64 = se[1] 146 if ab_teq(spec, k0s, k0e, "name" as *u8) == 1 { 147 if ab_tok(spec, ls, le, 1, se) != 1 { return 0 - 1 } 148 st[0] = ab_tcopy(spec, se[0], se[1], st[4] as *u8, st[5] as *i64) 149 return 0 150 } 151 if ab_teq(spec, k0s, k0e, "feature" as *u8) == 1 { 152 if ab_tok(spec, ls, le, 1, se) != 1 { return 0 - 1 } 153 let fi: i64 = ab_feat_idx(spec, se[0], se[1]) 154 if fi < 0 { return 0 - 1 } 155 let f: *i64 = st[2] as *i64 156 f[fi] = 1 157 return 0 158 } 159 if ab_teq(spec, k0s, k0e, "specfile" as *u8) == 1 { 160 if ab_tok(spec, ls, le, 1, se) != 1 { return 0 - 1 } 161 st[6] = ab_tcopy(spec, se[0], se[1], st[4] as *u8, st[5] as *i64) 162 return 0 163 } 164 if ab_teq(spec, k0s, k0e, "param" as *u8) == 1 { 165 let p: *i64 = st[3] as *i64 166 var ti: i64 = 1 167 var going: i64 = 1 168 while going == 1 { 169 if ab_tok(spec, ls, le, ti, se) != 1 { going = 0 } 170 if going == 1 { 171 if st[1] >= 300 { return 0 - 1 } 172 p[st[1]] = ab_tint(spec, se[0], se[1]) 173 st[1] = st[1] + 1 174 ti = ti + 1 175 } 176 } 177 return 0 178 } 179 return 0 180} 181 182// dispatch rows: route a classified shape to its emitter author. Adding emitter 183// support = adding a row function (rule 11 in code form: one row, one shape). 184func ab_author_12(name: *u8, mp: *u8, tp: *u8, p: *i64, np: i64) -> i64 { 185 if np < 6 { return 0 } 186 return pe7_author_wire_tlv3(name, mp, tp, p) 187} 188func ab_author_13(name: *u8, mp: *u8, tp: *u8, p: *i64, np: i64) -> i64 { 189 if np < 1 { return 0 } 190 let nf: i64 = p[0] 191 if np < 1 + nf * 2 { return 0 } 192 let kinds: *i64 = sys_mmap(8 * 32) as *i64 193 let widths: *i64 = sys_mmap(8 * 32) as *i64 194 var i: i64 = 0 195 while i < nf { kinds[i] = p[1 + i * 2]; widths[i] = p[2 + i * 2]; i = i + 1 } 196 return pe8_author_struct_walk2(name, mp, tp, kinds, widths, nf) 197} 198func ab_author_18(name: *u8, mp: *u8, tp: *u8, p: *i64, np: i64) -> i64 { 199 if np < 3 { return 0 } 200 if np < 3 + p[0] * p[1] { return 0 } 201 return pe13_author_state_machine(name, mp, tp, p) 202} 203// PNG_INGEST (shape 19, the COMPOSE-shape) -- DECLARED-SCAFFOLD route (R3, X-AUT-NCF-001). 204// pe15 authors <name>_ingest(buf,flen,prefix) composing the green PNG/canon/store organs. 205// Param vector: p[0]=nkeys p[1]=chunk-FourCC p[2]=segid p[3..]=per-key <klen> <bytes...>. 206func ab_author_19(name: *u8, mp: *u8, tp: *u8, p: *i64, np: i64) -> i64 { 207 if np < 3 { return 0 } 208 return pe15_author_png_ingest(name, mp, tp, p, np) 209} 210// THRESHOLD_TABLE (shape 4) -- emitter-of-emitters bootstrap: pe14 PERMIL_VERDICT bakes 211// permil=count*1000/total + an ordered verdict-band ladder from a DATA table. Fills the 212// classifier PL_THRESHOLD_TABLE route (in_table+out_value) that had no emitter. 213// p[0]=total p[1]=nbands p[2+2i]=threshold_permil p[3+2i]=verdict_code. 214func ab_author_4(name: *u8, mp: *u8, tp: *u8, p: *i64, np: i64) -> i64 { 215 if np < 4 { return 0 } 216 if np < 2 + p[1] * 2 { return 0 } 217 return pe14_author_permil_verdict(name, mp, tp, p) 218} 219// LOG_SCAN (shape 20, X-AUT-004b) -- the PERMIL_VERDICT scoreboard core. Same pe14 emitter rail as 220// shape 4 (in_table+out_value), reached via the distinct reads_log+derives_permil feature vector so 221// a log-coverage scorecard routes here explicitly (composes the census_run scan/count substrate). 222// p[0]=total p[1]=nbands p[2+2i]=threshold_permil p[3+2i]=verdict_code. 223func ab_author_20(name: *u8, mp: *u8, tp: *u8, p: *i64, np: i64) -> i64 { 224 if np < 4 { return 0 } 225 if np < 2 + p[1] * 2 { return 0 } 226 return pe14_author_permil_verdict(name, mp, tp, p) 227} 228// WIRE_MARKER (shape 15, X-GALX-001 wiring): route a PLC_IN_MARKED spec to the existing 229// pe10 prefix-marker emitter. Param vector: p[0]=prefix p[1]=count p[2..2+count]=marker table 230// p[2+count]=terminator. sa[] is repacked as [count, m0, m1, ...] for pe10's rail. 231// NOTE: pe10 bakes a JPEG-class frame (1-byte prefix + 1-byte marker + 2-byte BE inclusive 232// length). It does NOT cover the PNG chunk frame (4-byte BE exclusive len + 4-byte ASCII type 233// + crc32); a PNG tEXt/iTXt reader needs a distinct emitter shape (still NEEDS-TUTOR). 234func ab_author_15(name: *u8, mp: *u8, tp: *u8, p: *i64, np: i64) -> i64 { 235 if np < 3 { return 0 } 236 let count: i64 = p[1] 237 if count < 1 { return 0 } 238 if np < 3 + count { return 0 } 239 let sa: *i64 = sys_mmap(8 * 16) as *i64 240 sa[0] = count 241 var i: i64 = 0 242 while i < count { sa[1 + i] = p[2 + i]; i = i + 1 } 243 let term: i64 = p[2 + count] 244 return pe10_author_wire_marker(name, mp, tp, p[0], sa, term) 245} 246// MATH_KERNEL (shape 11, X-AUT-004): the Builder is GIVEN what to emit -- a template 247// id + the oracle CONSTANT TABLE from a GENERATED spec file (the nx_mathspec_* 248// emission format: "c[<i>] = <int>" rows, negatives as "0 - <int>"). No grammar 249// strings beyond the path; every number stays oracle-derived. 250func ab_load_spec(path: *u8, c: *i64) -> i64 { 251 let lenp: *i64 = sys_mmap(16) as *i64 252 let fb: *u8 = sys_read_file(path, lenp) 253 let n: i64 = lenp[0] 254 if n <= 0 { return 0 } 255 var cnt: i64 = 0 256 var ls: i64 = 0 257 while ls < n { 258 var le: i64 = ls 259 var s: i64 = 1 260 while s == 1 { if le >= n { s = 0 } else { if fb[le] == (10 as u8) { s = 0 } else { le = le + 1 } } } 261 var i: i64 = ls 262 var pos: i64 = 0 - 1 263 while i + 1 < le { 264 if fb[i] == (99 as u8) { if fb[i+1] == (91 as u8) { pos = i + 2; i = le } } 265 i = i + 1 266 } 267 if pos >= 0 { 268 var idx: i64 = 0 269 var j: i64 = pos 270 var dig: i64 = 1 271 while dig == 1 { 272 if j >= le { dig = 0 } 273 else { if fb[j] < (48 as u8) { dig = 0 } else { if fb[j] > (57 as u8) { dig = 0 } else { idx = idx * 10 + ((fb[j] as i64) - 48); j = j + 1 } } } 274 } 275 var eq: i64 = 0 - 1 276 while j < le { if fb[j] == (61 as u8) { eq = j; j = le } else { j = j + 1 } } 277 if eq >= 0 { 278 var k2: i64 = eq + 1 279 var sk: i64 = 1 280 while sk == 1 { if k2 >= le { sk = 0 } else { if fb[k2] == (32 as u8) { k2 = k2 + 1 } else { sk = 0 } } } 281 var negv: i64 = 0 282 if k2 + 2 < le { if fb[k2] == (48 as u8) { if fb[k2+1] == (32 as u8) { if fb[k2+2] == (45 as u8) { negv = 1; k2 = k2 + 4 } } } } 283 var v: i64 = 0 284 var dg: i64 = 1 285 while dg == 1 { 286 if k2 >= le { dg = 0 } 287 else { if fb[k2] < (48 as u8) { dg = 0 } else { if fb[k2] > (57 as u8) { dg = 0 } else { v = v * 10 + ((fb[k2] as i64) - 48); k2 = k2 + 1 } } } 288 } 289 if negv == 1 { v = 0 - v } 290 if idx < 64 { c[idx] = v; if idx + 1 > cnt { cnt = idx + 1 } } 291 } 292 } 293 ls = le + 1 294 } 295 return cnt 296} 297func ab_author_11(name: *u8, mp: *u8, tp: *u8, p: *i64, np: i64, sf: *u8) -> i64 { 298 if np < 1 { return 0 } 299 if (sf as i64) == 0 { return 0 } 300 let c: *i64 = sys_mmap(8 * 64) as *i64 301 let cnt: i64 = ab_load_spec(sf, c) 302 if cnt < 4 { return 0 } 303 let mfn: *u8 = sys_mmap(256) 304 let o2: i64 = ab_cat(mfn, 0, name) 305 ab_cat(mfn, o2, ".nx" as *u8) 306 if p[0] == 1 { 307 if np < 2 { return 0 } 308 return pe6_author_logf64(name, mfn, mp, tp, c, p[1]) 309 } 310 if p[0] == 2 { 311 if cnt < 38 { return 0 } 312 return pe6_author_erf(mfn, mp, tp, c) 313 } 314 return 0 315} 316 317// build + RUN the authored KAT through the sovereign runner; returns wait status 318func ab_kat(testname: *u8) -> i64 { 319 let pid: i64 = sys_fork() 320 if pid == 0 { 321 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 322 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 323 let argv: *i64 = sys_mmap(32) as *i64 324 argv[0] = "_offc/nx_sov_build_run.elf" as *u8 as i64 325 argv[1] = testname as i64 326 argv[2] = 0 327 let envp: *i64 = sys_mmap(16) as *i64 328 envp[0] = 0 329 sys_execve("_offc/nx_sov_build_run.elf" as *u8, argv, envp) 330 sys_exit(127) 331 } 332 let st: *i64 = sys_mmap(16) as *i64 333 sys_wait4(pid, st, 0) 334 return st[0] 335} 336 337func ab_log(name: *u8, shape: i64, ms: i64, verdict: *u8) -> i64 { 338 let lfd: i64 = sys_openat_append("knowledge/status/auto_builder.log" as *u8, 0x1a4) 339 if lfd < 0 { return 0 - 1 } 340 ab_w(lfd, "AUTOBUILD name=" as *u8); ab_w(lfd, name) 341 ab_w(lfd, " shape=" as *u8); ab_wn(lfd, shape) 342 ab_w(lfd, " ms=" as *u8); ab_wn(lfd, ms) 343 ab_w(lfd, " verdict=" as *u8); ab_w(lfd, verdict); ab_w(lfd, "\n" as *u8) 344 sys_close(lfd) 345 return 0 346} 347 348func main(argc: i64, argv: *i64) -> i64 { 349 if argc < 2 { ab_w(1, "usage: nx_auto_builder <specpath>\n" as *u8); sys_exit(2); return 2 } 350 let t0: i64 = ab_ms() 351 let sp: *u8 = argv[1] as *u8 352 let lenp: *i64 = sys_mmap(16) as *i64 353 let spec: *u8 = sys_read_file(sp, lenp) 354 let sn: i64 = lenp[0] 355 if sn <= 0 { 356 ab_w(1, "AUTO-BUILD REFUSED: spec missing " as *u8); ab_w(1, sp); ab_w(1, "\n" as *u8) 357 ab_log("(missing)" as *u8, 0, 0, "REFUSED" as *u8) 358 sys_exit(2); return 2 359 } 360 let st: *i64 = sys_mmap(8 * 8) as *i64 361 let feats: *i64 = plc_new_features() 362 let params: *i64 = sys_mmap(8 * 320) as *i64 363 let pool: *u8 = sys_mmap(K_MAGIC_2048) 364 let pp: *i64 = sys_mmap(16) as *i64 365 st[0] = 0; st[1] = 0; st[6] = 0 366 st[2] = feats as i64; st[3] = params as i64; st[4] = pool as i64; st[5] = pp as i64 367 var ls: i64 = 0 368 var bad: i64 = 0 369 while ls < sn { 370 var le: i64 = ls 371 var seeking: i64 = 1 372 while seeking == 1 { 373 if le >= sn { seeking = 0 } 374 if seeking == 1 { if spec[le] == (10 as u8) { seeking = 0 } } 375 if seeking == 1 { le = le + 1 } 376 } 377 if ab_parse_line(spec, ls, le, st) < 0 { bad = 1 } 378 ls = le + 1 379 } 380 if st[0] == 0 { bad = 1 } 381 if bad == 1 { 382 ab_w(1, "AUTO-BUILD REFUSED: malformed spec (name row + known features required)\n" as *u8) 383 ab_log("(malformed)" as *u8, 0, ab_ms() - t0, "REFUSED" as *u8) 384 sys_exit(2); return 2 385 } 386 let name: *u8 = st[0] as *u8 387 388 // the classifier routes the shape -- no human/Claude shape decision 389 let shape: i64 = plc_match_spec(feats) 390 ab_w(1, "AUTO-BUILD: " as *u8); ab_w(1, name) 391 ab_w(1, " classified shape=" as *u8); ab_wn(1, shape); ab_w(1, "\n" as *u8) 392 393 // derive authored paths 394 let mp: *u8 = sys_mmap(256) 395 var o: i64 = ab_cat(mp, 0, "runtime/_hdl_build/" as *u8) 396 o = ab_cat(mp, o, name) 397 ab_cat(mp, o, ".nx" as *u8) 398 let tp: *u8 = sys_mmap(256) 399 o = ab_cat(tp, 0, "runtime/_hdl_build/" as *u8) 400 o = ab_cat(tp, o, name) 401 ab_cat(tp, o, "_test.nx" as *u8) 402 let tn: *u8 = sys_mmap(256) 403 o = ab_cat(tn, 0, name) 404 ab_cat(tn, o, "_test" as *u8) 405 406 var authored: i64 = 0 - 1 407 if shape == 11 { authored = ab_author_11(name, mp, tp, params, st[1], st[6] as *u8) } 408 if shape == 12 { authored = ab_author_12(name, mp, tp, params, st[1]) } 409 if shape == 13 { authored = ab_author_13(name, mp, tp, params, st[1]) } 410 if shape == 15 { authored = ab_author_15(name, mp, tp, params, st[1]) } 411 if shape == 18 { authored = ab_author_18(name, mp, tp, params, st[1]) } 412 if shape == 19 { authored = ab_author_19(name, mp, tp, params, st[1]) } 413 if shape == 4 { authored = ab_author_4(name, mp, tp, params, st[1]) } 414 if shape == 20 { authored = ab_author_20(name, mp, tp, params, st[1]) } 415 if authored == (0 - 1) { 416 ab_w(1, "AUTO-BUILD NEEDS-TUTOR: shape " as *u8); ab_wn(1, shape) 417 ab_w(1, " has no dispatch row yet (honest, never silently absorbed)\n" as *u8) 418 ab_log(name, shape, ab_ms() - t0, "NEEDS-TUTOR" as *u8) 419 sys_exit(3); return 3 420 } 421 if authored == 0 { 422 ab_w(1, "AUTO-BUILD REFUSED: emitter rail rejected the param vector\n" as *u8) 423 ab_log(name, shape, ab_ms() - t0, "REFUSED" as *u8) 424 sys_exit(2); return 2 425 } 426 427 // the authored KAT must build and RUN green, sovereignly 428 let kst: i64 = ab_kat(tn) 429 let ms: i64 = ab_ms() - t0 430 if kst == 0 { 431 ab_w(1, "AUTO-BUILD GREEN: " as *u8); ab_w(1, name) 432 ab_w(1, " shape=" as *u8); ab_wn(1, shape) 433 ab_w(1, " KAT green, ms=" as *u8); ab_wn(1, ms); ab_w(1, " (spec in, gated capability out)\n" as *u8) 434 ab_log(name, shape, ms, "GREEN" as *u8) 435 sys_exit(0); return 0 436 } 437 ab_w(1, "AUTO-BUILD RED: authored KAT failed (fix the emitter or the spec, never the gate)\n" as *u8) 438 ab_log(name, shape, ms, "RED" as *u8) 439 sys_exit(1) 440 return 1 441}