nx_substrate_diagram.nx
buildroot/runtime/nx_substrate_diagram.nx
about
nx_substrate_diagram.nx -- substrate-walker that BUILDS an
nx_diagram and emits any of 4 formats (Mermaid / DOT / ASCII / JSON).
Refactored 2026-05-13 to consume the nx_diagram primitive instead
of hand-rolling Mermaid output. Reduces ~260 LOC to ~170 LOC and
gives the substrate-walker 4 output formats for free.
DEFAULT EMITTER: Mermaid (backward-compatible with prior tool).
To emit other formats, edit the call near the bottom of main() --
nx_diagram_emit_dot(d) / nx_diagram_emit_ascii(d) / nx_diagram_emit_json(d).
genealogy_id: mermaid_2015_javascript_diagram_text + graphviz_dot
+ plain_text_diagram_lineage
lineage_id: graph_visualization_text_format
axioms: NX_AX_REL_TRANSITIVITY (depends-on transitive)
dependencies 7 imports · 0 importers
imports: nx_syscalls.nxnx_runtime.nxnx_axioms.nxnx_dirent.nxnx_fcntl.nxnx_tier.nxnx_diagram.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 31 | const NX_DIA_MAX_MODULES: nx_idx = 400 |
| 32 | const NX_DIA_MAX_EDGES: nx_idx = 4096 |
| 33 | const NX_DIA_MAX_NAME: nx_size = 96 |
| 34 | const NX_DIA_DIR_BUF: nx_size = 16384 |
functions
| 38 | func dia_name_matches(name: *u8, name_len: nx_size) -> nx_int called by 1: dia_collect_into_diagram |
| 63 | func dia_module_from_filename(name: *u8, name_len: nx_size, out: *u8) -> nx_size called by 1: dia_collect_into_diagram |
| 76 | func dia_collect_into_diagram(dir_path: *u8, d: *Diagram, names_buf: *u8) -> nx_idx called by 1: main calls 9: nx_openatsys_mmapnx_dirent_readnx_dirent_iternx_dirent_name_lendia_name_matches+3 |
| 113 | func dia_find_module_idx(d: *Diagram, names_buf: *u8, name: *u8, name_len: nx_size) -> nx_idx |
| 127 | func dia_add_edges_for_module(d: *Diagram, names_buf: *u8, from_idx: nx_idx) -> nx_int |
| 215 | func main() -> i64 |