code wiki / _hdl_build / nx_gate_anchor_edit.nx

nx_gate_anchor_edit.nx

buildroot/runtime/_hdl_build/nx_gate_anchor_edit.nx

10237 B249 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind orphan librarytopic gate
docsdependenciesstructsconstsfunctions

about

nx_gate_anchor_edit.nx -- THE MECHANICAL HALF OF THE D001 ANCHOR RUNG (seq585; D001-B lane 2026-07-31). nx_gate_migrate is deliberately a VERIFIER and NEVER an auto-editor, so that it can never mangle 1918 bespoke gates. That is the right call -- but it leaves the ~953 unjudgeable gates with no mechanical EDIT step, and an edit-per-gate routed through a session context does not scale to a 1057-gate lane. This organ is that missing step. The division of labour is PRESERVED, not weakened: THE EDITOR PROPOSES A CANDIDATE FILE, THE VERIFIER (nx_gate_migrate anchor) REMAINS THE SOLE AUTHORITY ON WHETHER IT MAY BE COMMITTED. This organ never writes a gate in place -- only ever a separate candidate path -- so its blast radius is bounded BY CONSTRUCTION, not by promise (rule 26 posture). THE TRANSFORM (narrow by construction; the local awk v4.x failures are encoded here as REFUSALS, not hopes). Insert verdict= immediately before a GREEN or RED token, but ONLY where ALL of these hold: (a) the line is NOT a comment (first non-blank bytes are not //). A mangled comment is invisible to a behaviour-preserving oracle -- which is exactly how MEASURED -> MEASUverdict=RED shipped locally. (b) the line ALSO contains sys_exit( or return -- the verdict line is the one that decides the exit. (c) the token is STANDALONE: neither neighbouring byte is [A-Za-z0-9_], so MEASURED / RECOVERED / TEXTURED can never be glued mid-word (MEASURED literally contains RED at index 5). (d) the token is not ALREADY preceded by verdict= -- idempotent (rule 10), so re-runs are no-ops. Every other byte is copied VERBATIM. Exit codes are distinct so a batch driver can branch without parsing prose: 0 = candidate written 5 = NOEDIT (nothing matched -> hand-treat; never a silent success) 2 = usage 4 = I/O error license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_estr.nx nx_gate_anchor_edit.nx

imports: nx_syscalls.nxnx_estr.nx

imported by: nobody (leaf or entry point)

structs

none

consts

28const AE_CAP: i64 = 1048576
29const AE_MODE: i64 = 0x1a4
30const AE_USAGE: i64 = 2
31const AE_IOERR: i64 = 4
32const AE_NOEDIT: i64 = 5
33const AE_SLASH: i64 = 47
34const AE_SPACE: i64 = 32
35const AE_TABCH: i64 = 9
36const AE_ANCHLEN: i64 = 8

functions

40func ae_idch(c: i64) -> i64
called by 1: ae_emit
49func ae_read(path: *u8, buf: *u8, cap: i64) -> i64
64func ae_write(path: *u8, buf: *u8, n: i64) -> i64
82func ae_at(buf: *u8, n: i64, i: i64, s: *u8, sl: i64) -> i64
called by 2: ae_line_hasae_emit
92func ae_line_has(buf: *u8, a: i64, b: i64, s: *u8) -> i64
called by 1: ae_emit calls 2: es_lenae_at
103func ae_is_comment(buf: *u8, a: i64, b: i64) -> i64
called by 1: ae_emit
118func ae_emit(buf: *u8, a: i64, b: i64, out: *u8, o: i64, nedit: *i64) -> i64
150func ae_transform(buf: *u8, n: i64, out: *u8, nedit: *i64) -> i64
called by 1: ae_t calls 1: ae_emit
162func ae_t(src: *u8, want: *u8, name: *u8, pass: *i64, tot: *i64) -> i64
182func ae_selftest() -> i64
204func main(argc: i64, argv: *i64) -> i64