code wiki / _hdl_build / nx_pattern_emit7.nx

nx_pattern_emit7.nx

buildroot/runtime/_hdl_build/nx_pattern_emit7.nx

21515 B356 linesdepth 2pulls 2 transitivereach 12 importersview sourcekind librarytopic pattern
docsdependenciesstructsconstsfunctions

about

nx_pattern_emit7.nx -- PATTERN EMITTER: WIRE_TLV (shape 12 -- the browser-grade binary-parser shape; the BROWSER arc's autonomy lever). The single most recurring browser core is the [type][length][body] wire walk: TLS extensions + handshake messages (type-first, widths 2/2 or 1/3), PNG chunks (length-first, 4/4), JPEG segments (1/2). emit4's PARSER_KAT covers text->int; this authors the BINARY wire walker from 3 spec params: type_w bytes in the type field (1/2/4) len_w bytes in the length field (1/2/4) type_first 1 = [type][len] (TLS/JPEG), 0 = [len][type] (PNG) Field offsets are COMPUTED AT EMIT TIME and baked as integer literals -- the spec is the config (rule 11); the authored core has ZERO layout branching. Authored functions: <name>_rdbe(b,off,w) big-endian field read <name>_count(b,n) well-formed entry count; -1 = TRUNCATED ENTRY REFUSED (never clipped) <name>_find(b,n,t) body offset of first entry of type t; -1 absent; -2 malformed Test KATs are COMPUTED BY THE EMITTER from the same spec (synthetic 2-entry image: exact count, exact body offsets, absent type, truncation refusal). REFUSAL RAILS at author time: widths must be 1/2/4 and type_first 0/1 -- a bad spec is REFUSED, never authored. Drives the BROWSER arc's bp_claude_touch toward 0 (B2 ClientHello census + B5 PNG/JPEG walks are this shape). Extends emit(231)/emit2(235)/emit3(241)/emit4(262)/emit5(264)/emit6(MATH_KERNEL). LAWS: struct-free, integer-only, flat ifs, no &&/||, <=6 args per func. license_tier: ORIGINAL

dependencies 1 imports · 9 importers

nx_syscalls.nx nx_pattern_emit7.nx _race5_team_author.nx _race5_team_author2.nx _race6_team_author.nx _race6_team_author2.nx nx_auto_builder.nx nx_auto_builder_s20.nx nx_pattern_emit10_demo.nx nx_pattern_emit7_demo.nx nx_warden_build.nx

imports: nx_syscalls.nx

imported by: _race5_team_author.nx_race5_team_author2.nx_race6_team_author.nx_race6_team_author2.nxnx_auto_builder.nxnx_auto_builder_s20.nxnx_pattern_emit10_demo.nxnx_pattern_emit7_demo.nxnx_warden_build.nx

structs

none

consts

none

functions

22func p7_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 }
23func p7_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 }
26func p7_put_be(b: *u8, off: i64, v: i64, w: i64) -> i64
33func p7_spec_ok(type_w: i64, len_w: i64, type_first: i64) -> i64
50func pe7_emit_wire_tlv(fd: i64, name: *u8, type_w: i64, len_w: i64, type_first: i64) -> i64
called by 1: pe7_author_wire_tlv calls 2: p7_wp7_wn
77func pe7_emit_wire_tlv_test(fd: i64, name: *u8, type_w: i64, len_w: i64, type_first: i64) -> i64
111func pe7_author_wire_tlv(name: *u8, modpath: *u8, testpath: *u8, type_w: i64, len_w: i64, type_first: i64) -> i64
126func p7_put_le(b: *u8, off: i64, v: i64, w: i64) -> i64
133func p7_spec2_ok(spec: *i64) -> i64
146func p7_emit_lenread(fd: i64, name: *u8, spec: *i64, loff: i64) -> i64
155func p7_emit_adv(fd: i64, hdrw: i64, pad2: i64) -> i64
162func pe7_emit_wire_tlv2(fd: i64, name: *u8, spec: *i64) -> i64
194func pe7_emit_wire_tlv_test2(fd: i64, name: *u8, spec: *i64) -> i64
234func pe7_author_wire_tlv2(name: *u8, modpath: *u8, testpath: *u8, spec: *i64) -> i64
248func p7_spec3_ok(spec: *i64) -> i64
256func p7_emit_guard3(fd: i64, hdrw: i64, trail: i64, rc: *u8) -> i64
263func p7_emit_adv3(fd: i64, hdrw: i64, pad2: i64, trail: i64) -> i64
270func pe7_emit_wire_tlv3(fd: i64, name: *u8, spec: *i64) -> i64
303func pe7_emit_wire_tlv_test3(fd: i64, name: *u8, spec: *i64) -> i64
349func pe7_author_wire_tlv3(name: *u8, modpath: *u8, testpath: *u8, spec: *i64) -> i64