code wiki / _hdl_build / nx_pattern_emit89_demo.nx
nx_pattern_emit89_demo.nx source
↩ module page · 61 lines · 2859 B
1// nx_pattern_emit89_demo.nx -- the TEAM authoring race-1's two named growth rungs (no Claude
2// logic): _pe_chwalk = STRUCT_WALK over the ClientHello field table (hdr4/ver2/random32/sidVAR8/
3// suitesVAR16/compVAR8/extTAIL16) and _pe_lane_tlv = the complete IO_CONTRACT census lane over
4// the emit7-authored _pe_tlv core. Refusal rails proven: tail-not-last + unknown-kind tables and
5// an empty-types lane spec must be REFUSED. license_tier: ORIGINAL
6import "nx_pattern_emit8.nx"
7import "nx_pattern_emit9.nx"
8import "nx_syscalls.nx"
9
10func d89_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
11
12func main() -> i64 {
13 // ---- STRUCT_WALK: the ClientHello field table ----
14 let kinds: *i64 = sys_mmap(64) as *i64
15 let widths: *i64 = sys_mmap(64) as *i64
16 kinds[0] = 0; widths[0] = 4
17 kinds[1] = 0; widths[1] = 2
18 kinds[2] = 0; widths[2] = 32
19 kinds[3] = 1; widths[3] = 0
20 kinds[4] = 2; widths[4] = 0
21 kinds[5] = 1; widths[5] = 0
22 kinds[6] = 3; widths[6] = 0
23 let a: i64 = pe8_author_struct_walk("_pe_chwalk" as *u8,
24 "runtime/_hdl_build/_pe_chwalk.nx" as *u8,
25 "runtime/_hdl_build/_pe_chwalk_test.nx" as *u8,
26 kinds, widths, 7)
27
28 // refusal: tail not last
29 let badk: *i64 = sys_mmap(32) as *i64
30 let badw: *i64 = sys_mmap(32) as *i64
31 badk[0] = 3; badw[0] = 0
32 badk[1] = 0; badw[1] = 4
33 let r1: i64 = pe8_author_struct_walk("_pe_badtail" as *u8,
34 "/tmp/_pe_badtail.nx" as *u8, "/tmp/_pe_badtail_test.nx" as *u8, badk, badw, 2)
35 // refusal: unknown kind
36 badk[0] = 7; badw[0] = 0
37 let r2: i64 = pe8_author_struct_walk("_pe_badkind" as *u8,
38 "/tmp/_pe_badkind.nx" as *u8, "/tmp/_pe_badkind_test.nx" as *u8, badk, badw, 2)
39
40 // ---- IO_CONTRACT lane over the emit7-authored core ----
41 let types: *i64 = sys_mmap(64) as *i64
42 let labels: *i64 = sys_mmap(64) as *i64
43 types[0] = 0; labels[0] = "SNI=\x00" as *u8 as i64
44 types[1] = 10; labels[1] = "GR=\x00" as *u8 as i64
45 types[2] = 13; labels[2] = "SG=\x00" as *u8 as i64
46 types[3] = 43; labels[3] = "SV=\x00" as *u8 as i64
47 types[4] = 51; labels[4] = "KS=\x00" as *u8 as i64
48 let b: i64 = pe9_author_census_lane("runtime/_hdl_build/_pe_lane_tlv.nx" as *u8,
49 "_pe_tlv" as *u8, types, labels, 5, "EXTN=\x00" as *u8)
50 // refusal: empty types
51 let r3: i64 = pe9_author_census_lane("/tmp/_pe_badlane.nx" as *u8,
52 "_pe_tlv" as *u8, types, labels, 0, "EXTN=\x00" as *u8)
53
54 if a == 1 { if b == 1 { if r1 == 0 { if r2 == 0 { if r3 == 0 {
55 d89_w("TEAM AUTHORED: _pe_chwalk (STRUCT_WALK, CH table) + _pe_lane_tlv (IO_CONTRACT lane over _pe_tlv) + 3 bad specs REFUSED -- verify with Engineer\n" as *u8)
56 sys_exit(0)
57 } } } } }
58 d89_w("author failed (or a refusal rail broke)\n" as *u8)
59 sys_exit(1)
60 return 1
61}