code wiki / _hdl_build / nx_cms_blocks_team.nx
nx_cms_blocks_team.nx source
↩ module page · 28 lines · 2169 B
1// nx_cms_blocks_team.nx -- the TEAM authoring the BLOCK RENDERER core for the CMS arc (C11, no
2// Claude logic). The table IS the block vocabulary (Gutenberg-class, as DATA): kind 1=p (rich,
3// pre-sanitized -> raw), 2=h2, 3=h3 (escaped), 4=quote (rich -> raw), 5=img (two-slot src|alt,
4// BOTH attribute-escaped). Per-kind markup lives nowhere but this table; adding a block kind =
5// adding a row. Engineer verifies the emitted byte-exact KATs (incl. escape + unknown-kind refusal).
6import "nx_pattern_emit12.nx"
7import "nx_syscalls.nx"
8
9func cbt_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
10
11func main() -> i64 {
12 let t: *i64 = sys_mmap(8*5*5) as *i64
13 var n: i64 = 0
14 // mid = 0 (not an empty literal) marks single-slot rows: an "" literal proved to alias the
15 // NEXT literal's pointer on this lane (caught 2026-06-10 by reviewing the authored module:
16 // every row went two-slot with mid==close) -- NULL is unambiguous.
17 t[n*5]=1; t[n*5+1]="<div class=\"blk\">" as *u8 as i64; t[n*5+2]=0; t[n*5+3]="</div>" as *u8 as i64; t[n*5+4]=1; n=n+1 // p: rich, sanitized on write
18 t[n*5]=2; t[n*5+1]="<h2>" as *u8 as i64; t[n*5+2]=0; t[n*5+3]="</h2>" as *u8 as i64; t[n*5+4]=0; n=n+1 // h2: escaped
19 t[n*5]=3; t[n*5+1]="<h3>" as *u8 as i64; t[n*5+2]=0; t[n*5+3]="</h3>" as *u8 as i64; t[n*5+4]=0; n=n+1 // h3: escaped
20 t[n*5]=4; t[n*5+1]="<blockquote>" as *u8 as i64; t[n*5+2]=0; t[n*5+3]="</blockquote>" as *u8 as i64; t[n*5+4]=1; n=n+1 // quote: rich
21 t[n*5]=5; t[n*5+1]="<img src=\"" as *u8 as i64; t[n*5+2]="\" alt=\"" as *u8 as i64; t[n*5+3]="\">" as *u8 as i64; t[n*5+4]=0; n=n+1 // img: src|alt, attr-escaped
22 let a: i64 = pe12_author_template_table("_pe_blockr" as *u8,
23 "runtime/_hdl_build/_pe_blockr.nx" as *u8,
24 "runtime/_hdl_build/_pe_blockr_test.nx" as *u8, t, n)
25 if a == 1 { cbt_w("TEAM AUTHORED CORE: _pe_blockr (TEMPLATE_TABLE block renderer, 5 kinds + refuse) -- verify with Engineer\n" as *u8); sys_exit(0) }
26 cbt_w("author failed\n" as *u8); sys_exit(1)
27 return 1
28}