code wiki / _hdl_build / nx_emit_guard.nx
nx_emit_guard.nx
buildroot/runtime/_hdl_build/nx_emit_guard.nx
about
nx_emit_guard.nx -- the ONE set of guards every emitter CLI in this lane uses (rule 15: written twice
is once too many, and these encode a LAW rather than a convenience).
★WHY: an emitter that writes a SET of files can fail in three ways that all LOOK like success --
1. an unchecked sys_mmap returns null, so every subsequent write goes nowhere;
2. the emitter produces a technically-valid but empty page (a few dozen bytes);
3. individual writes are checked, but nobody asks afterwards whether the SET actually exists.
(3) is the one that bit this lane: refine's per-file writes were fail-loud, yet a run that produced
zero files still printed a success envelope, because nothing verified the set. A tool that emits a set
must PROVE the set before it claims success. Dependency-light on purpose (nx_syscalls only) so any
emitter can compose it without dragging a page kit in. license_tier: ORIGINAL
dependencies 1 imports · 4 importers
imports: nx_syscalls.nx
imported by: nx_outbench.nxnx_retire_path.nxnx_uigen_refine.nxnx_uigen_sitegen.nx
structs
| none |
consts
| 16 | const EG_MIN_PAGE: i64 = 2000 |
functions
| 18 | func eg_say(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 } |
| 21 | func eg_buf(size: i64, what: *u8) -> *u8 |
| 33 | func eg_assert_size(len: i64, what: *u8) -> i64 |
| 44 | func eg_have(path: *u8) -> i64 |
| 53 | func eg_assert_present(path: *u8) -> i64 |