code wiki / _hdl_build / nx_build_imports_gate.nx

nx_build_imports_gate.nx

buildroot/runtime/_hdl_build/nx_build_imports_gate.nx

8956 B173 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/prooftopic build
docsdependenciesstructsconstsfunctions

about

nx_build_imports_gate.nx -- SECOND genealogy LENS (operator: "multiple ways to look at ancestors and descendants, fine with all ... rooted from god so we can rebuild anything"). Where nx_build_lineage_gate gives the genesis-anchor view (organ -> DESC-ORGANS -> god), THIS gives the IMPORT-DEPENDENCY view = the REAL rebuild DAG: an organ's true ancestors are the organs it `import`s, recursively, bottoming out at nx_syscalls (the toolchain leaf, which roots to god via DESC-TOOLCHAIN). To REBUILD an organ you must first build its imports -> the import graph IS the rebuild order. A dangling import (names a file that does not exist) = a broken-lineage orphan = forbidden. BOTH directions: ANCESTORS(organ) = its imports; DESCENDANTS(lib) = who imports it. GATE w/ NEG-CONTROL: GREEN iff EVERY registered organ's imports all RESOLVE (0 dangling) AND a bogus import name is detected as unresolvable. Self-contained. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_build_imports_gate.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ip sys_write sys_mmap iread sys_openat_rd sys_read sys_close sys_exit ifind ilen istreq iorgan_path ijoin iexists sys_openat_rd ↻ sys_close ↻ imp_scan ifind ↻ sys_mmap ↻ iresolve sys_mmap ↻ ijoin ↻ iexists ↻ ipn sys_mmap ↻ sys_write ↻ imports_target sys_mmap ↻ iorgan_path ↻ iread ↻ imp_scan ↻ istreq ↻

structs

none

consts

13const REG: *u8 = "knowledge/registry/build_registry.log"
14const FB: i64 = 262144
15const MAXO: i64 = 8192
16const SLOT: i64 = 160

functions

18func ip(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main calls 1: sys_write
19func ilen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: ifind
20func ipn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
29func istreq(a: *u8, b: *u8) -> i64
called by 2: imports_targetmain
35func iread(path: *u8, buf: *u8, cap: i64) -> i64
41func iexists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
42func ijoin(pfx: *u8, name: *u8, out: *u8) -> i64
called by 2: iresolveiorgan_path
49func iresolve(name: *u8) -> i64
called by 1: main calls 3: sys_mmapijoiniexists
56func iorgan_path(name: *u8, out: *u8) -> i64
called by 2: imports_targetmain calls 2: ijoiniexists
61func ifind(buf: *u8, from: i64, to: i64, pat: *u8) -> i64
called by 2: imp_scanmain calls 1: ilen
68func imp_scan(buf: *u8, n: i64, out: *i64, cap: i64) -> i64
called by 2: imports_targetmain calls 2: ifindsys_mmap
88func imports_target(organ: *u8, target: *u8) -> i64
100func main() -> i64