code wiki / _hdl_build / nx_pattern_emit10.nx
nx_pattern_emit10.nx
buildroot/runtime/_hdl_build/nx_pattern_emit10.nx
about
nx_pattern_emit10.nx -- PATTERN EMITTER: WIRE_MARKER (shape 15 -- grown FROM a measured race
loss: race 4a runs the team's closest covered pattern, WIRE_TLV, against a JPEG marker stream
and loses; THIS emitter closes exactly the three spec gaps that loss names):
prefix every segment starts with a prefix byte (JPEG 0xFF) -- TLV has none
standalone a TABLE of marker values with NO length field (SOI/EOI/RSTn) -- TLV has none
terminator a marker after which entropy/wire data follows (SOS): count/find STOP there
inclusive the 2-byte BE length INCLUDES itself (JPEG) -- TLV lengths exclude the header
Authored fns: <name>_count(b,n) -> segments through the terminator, -1 = bad prefix/short/
len<2 REFUSED; <name>_find(b,n,m) -> content offset (standalone: after marker; lengthed:
after length), -1 absent (or behind the terminator), -2 malformed. All spec values BAKED at
emit time (rule 11). Test KATs computed by the emitter from a synthetic marker image it
constructs to the same spec (count, two finds, absent, truncation + garbage refusals).
REFUSAL RAILS: prefix outside 1..255, terminator listed standalone, standalone table empty
or >12 -> spec REFUSED. Extends ..emit7(WIRE_TLV)/emit8/emit9. Covers B5's JPEG segment walk
(SOF2 progressive incl.) + any prefix-marker wire format.
LAWS: struct-free, integer-only, flat ifs, no &&/||, <=6 args per func. license_tier: ORIGINAL
dependencies 1 imports · 4 importers
imports: nx_syscalls.nx
imported by: nx_auto_builder.nxnx_auto_builder_s20.nxnx_pattern_emit10_demo.nxnx_warden_build.nx
structs
| none |
consts
| none |
functions
| 19 | func pa_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 } |
| 20 | func pa_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 } called by 3: pa_emit_sa_ifspe10_emit_wire_markerpe10_emit_wire_marker_test calls 2: sys_mmapsys_write |
| 23 | func pa_spec_ok(prefix: i64, sa: *i64, term: i64) -> i64 called by 1: pe10_author_wire_marker |
| 42 | func pa_emit_sa_ifs(fd: i64, sa: *i64) -> i64 |
| 52 | func pe10_emit_wire_marker(fd: i64, name: *u8, prefix: i64, sa: *i64, term: i64) -> i64 |
| 95 | func pe10_emit_wire_marker_test(fd: i64, name: *u8, prefix: i64, sa: *i64, term: i64) -> i64 |
| 129 | func pe10_author_wire_marker(name: *u8, modpath: *u8, testpath: *u8, prefix: i64, sa: *i64, term: i64) -> i64 |