code wiki / _hdl_build / nx_emit_guard.nx

nx_emit_guard.nx

buildroot/runtime/_hdl_build/nx_emit_guard.nx

2507 B61 linesdepth 2pulls 2 transitivereach 4 importersview sourcekind librarytopic emit
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_emit_guard.nx nx_outbench.nx nx_retire_path.nx nx_uigen_refine.nx nx_uigen_sitegen.nx

imports: nx_syscalls.nx

imported by: nx_outbench.nxnx_retire_path.nxnx_uigen_refine.nxnx_uigen_sitegen.nx

structs

none

consts

16const EG_MIN_PAGE: i64 = 2000

functions

18func 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 }
21func eg_buf(size: i64, what: *u8) -> *u8
33func eg_assert_size(len: i64, what: *u8) -> i64
called by 2: mainmain calls 2: eg_saysys_exit
44func eg_have(path: *u8) -> i64
53func eg_assert_present(path: *u8) -> i64
called by 2: mainmain calls 3: eg_haveeg_saysys_exit