code wiki / _hdl_build / nx_doctor_import.nx

nx_doctor_import.nx

buildroot/runtime/_hdl_build/nx_doctor_import.nx

4828 B105 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic doctor
docsdependenciesstructsconstsfunctions

about

nx_doctor_import.nx -- DOCTOR sub-organ (the IMPORT-FIXER role; sibling of nx_doctor_fix). Turns the CC-UNDEFFN known-issue ("call to undefined function: X") from recall-and-REPORT into a real AUTO-FIX for the resolvable case: most such failures are a MISSING IMPORT, and every sys_* primitive lives in nx_syscalls.nx (verified sys_write @ nx_syscalls.nx:79). So: extract the named function from the Engineer's diagnostic, resolve it to the organ that defines it, and write a healed candidate with the import prepended (ADDITIVE -- new file, the protected source is never clobbered). RACI: the Doctor produces a CANDIDATE only; it does NOT verify (the Engineer re-compiles) and does NOT admit (Warden/Council). di_resolve returns 0 for names it cannot resolve -> the caller falls back to recall-and-report (NO false fix -- honest). v1 rule = sys_*->nx_syscalls.nx (deterministic); a general symbol-index over the corpus is the next extension. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_doctor_import.nx nx_doctor_import_gate.nx

imports: nx_syscalls.nx

imported by: nx_doctor_import_gate.nx

structs

none

consts

none

functions

14func di_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
21func di_find(hay: *u8, hlen: i64, needle: *u8) -> i64
called by 1: di_undef_fn calls 1: di_len
36func di_undef_fn(diag_path: *u8, out: *u8) -> i64
63func di_resolve(name: *u8, out_import: *u8) -> i64
called by 1: main
83func di_heal(src_path: *u8, out_path: *u8, imp: *u8) -> i64