code wiki / _hdl_build / _race5_team_author2.nx
_race5_team_author2.nx source
↩ module page · 71 lines · 3455 B
1// _race5_team_author2.nx -- the BUILDER re-authoring the race-5 team lane AFTER the growth
2// rungs (race-5b). The three concepts race-5a's loss NAMED are now emitter spec params:
3// emit8 v2: MAGIC4 + TAILREST -> _pe_riffhdr (validated RIFF/WAVE header, block = chunk area)
4// emit7 v2: len_le + pad2 -> _pe_riff2 (FourCC + u32le length + even padding)
5// emit9 v2: locator + raw key -> _pe_lane_riff2 (block-relative census + RSZ= header scalar)
6// Refusal rails proven: a 2-valued len_le, a mid-table TAILREST, and a zero raw label are all
7// REFUSED. Zero Claude walk logic in the authored lane. license_tier: ORIGINAL
8import "nx_pattern_emit7.nx"
9import "nx_pattern_emit8.nx"
10import "nx_pattern_emit9.nx"
11import "nx_syscalls.nx"
12
13func rb_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
14
15func main() -> i64 {
16 // locator: MAGIC4("RIFF") FIXED(4 size bytes) MAGIC4("WAVE") TAILREST
17 let kinds: *i64 = sys_mmap(64) as *i64
18 let widths: *i64 = sys_mmap(64) as *i64
19 kinds[0] = 4; widths[0] = 0x52494646
20 kinds[1] = 0; widths[1] = 4
21 kinds[2] = 4; widths[2] = 0x57415645
22 kinds[3] = 5; widths[3] = 0
23 let h: i64 = pe8_author_struct_walk2("_pe_riffhdr" as *u8,
24 "runtime/_hdl_build/_pe_riffhdr.nx" as *u8,
25 "runtime/_hdl_build/_pe_riffhdr_test.nx" as *u8,
26 kinds, widths, 4)
27
28 // core: FourCC type(4) + length(4) type-first, LITTLE-endian length, even padding
29 let spec: *i64 = sys_mmap(64) as *i64
30 spec[0] = 4; spec[1] = 4; spec[2] = 1; spec[3] = 1; spec[4] = 1
31 let a: i64 = pe7_author_wire_tlv2("_pe_riff2" as *u8,
32 "runtime/_hdl_build/_pe_riff2.nx" as *u8,
33 "runtime/_hdl_build/_pe_riff2_test.nx" as *u8,
34 spec)
35
36 // lane: census keys + locator + raw RSZ scalar (u32le at byte 4) as DATA
37 let types: *i64 = sys_mmap(64) as *i64
38 let labels: *i64 = sys_mmap(64) as *i64
39 types[0] = 0x666d7420; labels[0] = "FMT=" as *u8 as i64
40 types[1] = 0x64617461; labels[1] = "DATA=" as *u8 as i64
41 types[2] = 0x4c495354; labels[2] = "LIST=" as *u8 as i64
42 let ext: *i64 = sys_mmap(64) as *i64
43 ext[0] = "NCHK=" as *u8 as i64
44 ext[1] = "_pe_riffhdr" as *u8 as i64
45 ext[2] = "RSZ=" as *u8 as i64
46 ext[3] = 4; ext[4] = 4; ext[5] = 1
47 let l: i64 = pe9_author_census_lane2("runtime/_hdl_build/_pe_lane_riff2.nx" as *u8,
48 "_pe_riff2" as *u8, types, labels, 3, ext)
49
50 // refusal rails: bad len_le, mid-table TAILREST, zero raw label
51 spec[3] = 2
52 let r1: i64 = pe7_author_wire_tlv2("_pe_badle" as *u8, "/tmp/_pe_badle.nx" as *u8, "/tmp/_pe_badle_test.nx" as *u8, spec)
53 spec[3] = 1
54 kinds[1] = 5
55 let r2: i64 = pe8_author_struct_walk2("_pe_badtr" as *u8, "/tmp/_pe_badtr.nx" as *u8, "/tmp/_pe_badtr_test.nx" as *u8, kinds, widths, 4)
56 kinds[1] = 0
57 ext[2] = 0
58 let r3: i64 = pe9_author_census_lane2("/tmp/_pe_badraw.nx" as *u8, "_pe_riff2" as *u8, types, labels, 3, ext)
59
60 var ok: i64 = 0
61 if h == 1 { if a == 1 { if l == 1 { ok = 1 } } }
62 var rails: i64 = 0
63 if r1 == 0 { if r2 == 0 { if r3 == 0 { rails = 1 } } }
64 if ok == 1 { if rails == 1 {
65 rb_w("TEAM AUTHORED race-5b lane: _pe_riffhdr (STRUCT_WALK v2) + _pe_riff2 (WIRE_TLV v2 le/pad) + _pe_lane_riff2 (IO_CONTRACT v2) -- growth rungs live, rails proven\n" as *u8)
66 sys_exit(0)
67 } }
68 rb_w("author FAILED (growth defect or rail broken)\n" as *u8)
69 sys_exit(1)
70 return 1
71}