code wiki / _hdl_build / nx_codewiki_lib.nx

nx_codewiki_lib.nx

buildroot/runtime/_hdl_build/nx_codewiki_lib.nx

262144 B4797 linesdepth 6pulls 7 transitivereach 3 importersview sourcekind librarytopic codewiki
docsdependenciesstructsconstsfunctions

about

nx_codewiki_lib.nx -- THE CODE WIKI: an always-regenerable wiki OF the source tree. ===== WHY THIS EXISTS ============================================ The ecosystem has a charter wiki (runtime/wiki/, ~100 curated pages) and a corpus search (nishi_search), but NOTHING that answers, for a given module: what does it do, what does it import, WHO IMPORTS IT, what functions does it export, and where do I look next. That is the Google-Code-Wiki class of artifact: generated FROM the code, never hand-maintained, stale-proof because regeneration is one command and the output is deterministic. It is deliberately a STATIC generator, not a daemon: - the charter wiki daemon is sized for ~100 docs (docs_cap) and serves public charter sites; 17k code pages do not belong in its pools - static bytes are gateable (byte-identical re-run), diffable, and servable by any route -- or browsable as local files with zero infra ===== WHAT IS REUSED (the dupfunc law: the tool must not duplicate) ====== gl_walk / gl_read (nx_gatelib) -- the ONE tree walk + file read nis_scan (nx_import_scan) -- the ONE accurate import scanner EcoGraph (nx_eco_graph) -- intern + CSR fan-in/fan-out gl_walk's edge mode is NOT used: it interns import paths verbatim, so a subdir import ("wiki/nx_foo.nx") would become a node DISTINCT from the basename node of the actual file and every such link would dangle. We intern the BASENAME of each import ourselves -- same convention as file nodes -- so links resolve, and what still cannot resolve is reported as an honest unresolved count instead of a dead href. ===== ENVELOPES (declared, per the scale law) ===================== CW_MAXNODE 24000 nodes | CW_EDGECAP 262144 edges | file cap GL_FILECAP CW_PAGECAP 4 MiB/page -- overflow appends a LOUD PAGE-TRUNCATED banner CW_MAXDIRS 256 | desc arena 2 MiB | per-file import dedup window 128 license_tier: ORIGINAL

dependencies 4 imports · 3 importers

nx_syscalls.nx nx_eco_graph.nx nx_gatelib.nx nx_import_scan.nx nx_codewiki_lib.nx nx_codewiki.nx nx_codewiki_ask.nx nx_codewiki_gate.nx

imports: nx_syscalls.nxnx_eco_graph.nxnx_gatelib.nxnx_import_scan.nx

imported by: nx_codewiki.nxnx_codewiki_ask.nxnx_codewiki_gate.nx

structs

none

consts

41const CW_MAGIC_2166136261: i64 = 2166136261
42const CW_MAGIC_16777619: i64 = 16777619
43const CW_MAGIC_1024: i64 = 1024
44const CW_MAGIC_65536: i64 = 65536
45const CW_MAGIC_262144: i64 = 262144
46const CW_MAGIC_86400: i64 = 86400
47const CW_MAGIC_131072: i64 = 131072
48const CW_MAGIC_4096: i64 = 4096
49const CW_MAGIC_1469598103934665603: i64 = 1469598103934665603
50const CW_MAGIC_1099511628211: i64 = 1099511628211
52const CW_MAXNODE: i64 = 24000 // units=modules; tree measured 17,491 today (2026-07-29 census) = 37% headroom
53const CW_ARENA: i64 = 4194304
54const CW_HASH: i64 = 65536
55const CW_PATHARENA: i64 = 8388608
56const CW_EDGECAP: i64 = 262144 // units=import edges; measured 44,399 (2026-07-27) = 5.9x headroom
59const CW_PAGECAP: i64 = 4194304 // units=bytes; == the measured 4MB edge serving cap (a bigger page cannot ship); overflow -> loud banner (T8)
60const CW_PAGERESERVE: i64 = 192
61const CW_MAXDIRS: i64 = 256 // units=dirs; tree measured 13 today -- headroom visible on purpose
62const CW_DESCARENA: i64 = 2097152
63const CW_DESCMAX: i64 = 160
64const CW_TOPK: i64 = 20
65const CW_IMPDEDUP: i64 = 128
66const CW_SHOWIN: i64 = 100
68const CW_MAXFN: i64 = 131072 // units=funcs; measured 91,067 today (2026-07-29 regen) = 1.4x headroom; cap declared on the search page
69const CW_FNARENA: i64 = 4194304
71const CW_SVGN: i64 = 36
73const CW_MAXFAM: i64 = 4096 // units=families; measured ~750 today (threshold-4 rule) = 5x headroom
74const CW_FAMARENA: i64 = 131072
75const CW_FAMMIN: i64 = 4
76const CW_SBFAM: i64 = 16
78const CW_MAXSITE: i64 = 2097152
79const CW_SITEARENA: i64 = 33554432
80const CW_DEFHASH: i64 = 262144
81const CW_CALLSHOW: i64 = 6
82const CW_CALLDEDUP: i64 = 64
86const CW_NKIND: i64 = 11
87const CW_K_ARCHIVED: i64 = 0
88const CW_K_GATE: i64 = 1
89const CW_K_BENCH: i64 = 2
90const CW_K_PROBE: i64 = 3
91const CW_K_SMOKE: i64 = 4
92const CW_K_SKETCH: i64 = 5
93const CW_K_GENFIX: i64 = 6
94const CW_K_SERVICE: i64 = 7
95const CW_K_TOOL: i64 = 8
96const CW_K_LIB: i64 = 9
97const CW_K_ORPHAN: i64 = 10
98const CW_GENFIX_FAM: i64 = 200
99const CW_GENFIX_LOC: i64 = 40
100const CW_KINDSHOW: i64 = 24
106const CW_FINDCAP: i64 = 65536 // units=bytes; findings feed measured ~30 rows x ~200B today = 10x headroom
107const CW_SPRAWLMAX: i64 = 12
112const CW_NCAT: i64 = 8
113const CW_CAT_LANDMINE: i64 = 0
114const CW_CAT_WORKAROUND: i64 = 1
115const CW_CAT_GOTCHA: i64 = 2
116const CW_CAT_TODO: i64 = 3
117const CW_CAT_THIRDPARTY: i64 = 4
118const CW_CAT_SECURITY: i64 = 5
119const CW_CAT_PERF: i64 = 6
120const CW_CAT_DEPRECATED: i64 = 7
121const CW_CATSHOW: i64 = 20
122const CW_LANGSHOW: i64 = 24
126const CW_TGTCAP: i64 = 8
127const CW_TGTSEV: i64 = 7
129const CW_EXPCONF: i64 = 1048576
130const CW_EXPELFS: i64 = 4096 // units=elfs; deployed set measured ~700 (496 exposed + 211 dark) = 5x headroom
131const CW_EXPARENA: i64 = 262144
132const CW_EXPSHOW: i64 = 40
137const CW_SDOCMAX: i64 = 1400
138const CW_SDOCARENA: i64 = 41943040
139const CW_ASKDESCMAX: i64 = 150
140const CW_ASKCAP: i64 = 41943040
146const CW_ASKIDXCAP: i64 = 67108864 // units=bytes; sized for the measured 108.9k-record corpus w/ headroom; truncation REFUSES loudly (T33 + rc=4)
147const CW_ASKTOP: i64 = 10
148const CW_ASKQTOK: i64 = 16
149const CW_ASKMINTOK: i64 = 3
154const CW_IDF_P1: i64 = 5
155const CW_IDF_W1: i64 = 12
156const CW_IDF_P2: i64 = 30
157const CW_IDF_W2: i64 = 8
158const CW_IDF_P3: i64 = 100
159const CW_IDF_W3: i64 = 5
160const CW_IDF_P4: i64 = 300
161const CW_IDF_W4: i64 = 3
162const CW_IDF_W5: i64 = 1
163const CW_ASKNAMEX: i64 = 2

functions

167func cw_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
170func cw_app(buf: *u8, pos: *i64, cap: i64, s: *u8, n: i64) -> i64
178func cw_apps(buf: *u8, pos: *i64, cap: i64, s: *u8) -> i64 { return cw_app(buf, pos, cap, s, cw_slen(s)) }
181func cw_appn(buf: *u8, pos: *i64, cap: i64, v: i64) -> i64
198func cw_appe(buf: *u8, pos: *i64, cap: i64, s: *u8, n: i64) -> i64
216func cw_flush(path: *u8, buf: *u8, pos: *i64, cap: i64) -> i64
237func cw_base(path: *u8) -> i64
248func cw_stemlen(nm: *u8) -> i64
254func cw_rawcpy(dst: *u8, at: i64, s: *u8) -> i64
262func cw_pagepath(dst: *u8, outdir: *u8, nm: *u8) -> i64
284func cw_applink2(buf: *u8, pos: *i64, cap: i64, nm: *u8, noext: i64) -> i64
305func cw_appext(buf: *u8, pos: *i64, cap: i64, noext: i64) -> i64
312func cw_appjse(buf: *u8, pos: *i64, cap: i64, s: *u8, n: i64) -> i64
called by 2: cw_fnd_modcw_atlas calls 1: cw_app
334func cw_css(buf: *u8, pos: *i64, cap: i64) -> i64
called by 1: cw_head3 calls 1: cw_apps
374func cw_head3(buf: *u8, pos: *i64, cap: i64, title: *u8, tn: i64, sb: *u8) -> i64
called by 1: cw_atlas calls 3: cw_appscw_appecw_css
396func cw_crumb(buf: *u8, pos: *i64, cap: i64, noext: i64, dlabel: *u8, dslug: *u8, self: *u8, sn: i64) -> i64
416func cw_foot(buf: *u8, pos: *i64, cap: i64) -> i64
called by 1: cw_atlas calls 1: cw_apps
423func cw_filterjs(buf: *u8, pos: *i64, cap: i64) -> i64
called by 1: cw_atlas calls 1: cw_apps
432func cw_line_starts(buf: *u8, ls: i64, le: i64, kw: *u8) -> i64
calls 1: cw_slen
441func cw_sigend(buf: *u8, ls: i64, le: i64) -> i64
458func cw_impquote(buf: *u8, ls: i64, le: i64, out: *i64) -> i64
474func cw_impbase(buf: *u8, s: i64, n: i64, out: *i64) -> i64
502func cw_reach_maxmt(g: *EcoGraph, start: i64, stampv: *i64, epoch: i64, stack: *i64, srcmt: *i64) -> i64
called by 2: maincw_atlas
527func cw_reach_count(g: *EcoGraph, start: i64, dirn: i64, stampv: *i64, epoch: i64, stack: *i64) -> i64
556func cw_depth_of(g: *EcoGraph, u: i64, memo: *i64) -> i64
called by 1: cw_depth_of calls 1: cw_depth_of
580func cw_namecmp(g: *EcoGraph, a: i64, b: i64) -> i64
called by 1: cw_sortnodes
598func cw_sortnodes(g: *EcoGraph, idx: *i64, tmp: *i64, n: i64) -> i64
calls 1: cw_namecmp
631func cw_appstem(buf: *u8, pos: *i64, cap: i64, nm: *u8) -> i64
643func cw_outpath(dst: *u8, outdir: *u8, name: *u8) -> i64
called by 1: cw_atlas calls 1: cw_rawcpy
655func cwc_hash(s: *u8, n: i64) -> i64
called by 1: cwc_scan
669func cwc_scan(strip: *u8, sn: i64, mod: i64,
752func cw_famkey(nm: *u8, out: *u8) -> i64
790func cw_callflow(buf: *u8, pos: *i64, cap: i64, g: *EcoGraph, dmodv: *i64, dnamesv: *u8, dnoffv: *i64, dnlenv: *i64,
886func cw_nar_include(page: *u8, pos: *i64, cap: i64, outdir: *u8, opath: *u8, name: *u8) -> i64
923func cw_nbr(buf: *u8, pos: *i64, cap: i64, g: *EcoGraph, v: i64, pathoff: *i64, noext: i64) -> i64
1022func cw_kindname(k: i64) -> *u8
1037func cw_namehas(nm: *u8, sub: *u8) -> i64
1053func cw_catname(k: i64) -> *u8
1064func cw_catdesc(k: i64) -> *u8
1074func cw_catsev(k: i64) -> i64
1094func cw_resolved(src: *u8, s: i64, e: i64) -> i64
1115func cw_secmit(src: *u8, s: i64, e: i64) -> i64 { return cw_resolved(src, s, e) }
1120func cw_markscan(src: *u8, n: i64, m1: *u8, l1: i64, m2: *u8, l2: i64, m3: *u8, l3: i64, m4: *u8, l4: i64) -> i64
1160func cw_secscan(src: *u8, n: i64) -> i64
1166func cw_lmscan(src: *u8, n: i64) -> i64
1172func cw_catscan(src: *u8, n: i64) -> i64
1230func cw_mtime(path: *u8) -> i64
1273func cw_hasraw(src: *u8, s: i64, e: i64, needle: *u8, nl: i64) -> i64
1296func cw_substrclass(src: *u8, n: i64) -> i64
1330func cw_bs_prov(src: *u8, s: i64, e: i64) -> i64
1343func cw_boundscan(src: *u8, n: i64) -> i64
1398func cw_langscan(src: *u8, n: i64) -> i64
1420func cw_fnd_mod(fbuf: *u8, fpos: *i64, sev: i64, cat: *u8, mstem: *u8, mstem_n: i64) -> i64
1436func cw_fnd(fbuf: *u8, fpos: *i64, sev: i64, scope: *u8, desc: *u8) -> i64
1454func cw_atoi(b: *u8, s: i64, e: i64) -> i64
1465func cw_submatch(hay: *u8, hs: i64, he: i64, needle: *u8) -> i64
1482func cw_plpts(page: *u8, pos: *i64, cap: i64, vals: *i64, mx: i64, x0: i64, y0: i64, w: i64, h: i64) -> i64
1497func cw_spark(page: *u8, pos: *i64, cap: i64, vals: *i64) -> i64
1510func cw_dpill(page: *u8, pos: *i64, cap: i64, dv: i64, goodup: i64, unit: *u8) -> i64
1524func cw_pulse(page: *u8, pos: *i64, cap: i64, jrnlpath: *u8, meterpath: *u8, noext2: i64) -> i64
1762func cw_schemarow(sch: *u8, schn: i64, conf: *u8, ns: i64, ne: i64, box: *i64) -> i64
1799func cw_tools(page: *u8, pos: *i64, cap: i64, tix: *u8, tpos: *i64,
1863func cw_asktools(abuf: *u8, apos: *i64, acap: i64, allowpath: *u8, schemapath: *u8) -> i64
1904func cw_atlas(page: *u8, pos: *i64, cap: i64,
2042func cw_nameidx(name: *u8, needle: *u8) -> i64
2066func cw_has_base_sibling(earena: *u8, eoff: *i64, nelf: i64, cut: i64, snm: *u8) -> i64
2101func cw_exposure(page: *u8, pos: *i64, cap: i64, g: *EcoGraph, pathoff: *i64,
2445func cw_apptsv(buf: *u8, pos: *i64, cap: i64, s: *u8, n: i64) -> i64
2456func cw_lc(c: i64) -> i64
2470func cw_hastok(hay: *u8, hs: i64, he: i64, tok: *u8, tl: i64) -> i64
2488func cw_fld(buf: *u8, s: i64, e: i64) -> i64
2502func cw_qtok(words: *i64, wn: i64, first: i64, toks: *u8, toff: *i64, tlen: *i64) -> i64
2537func cw_ask(idxpath: *u8, qtoks: *u8, qoff: *i64, qlen: *i64, nq: i64, urlbase: *u8, topname: *u8) -> i64
2802func cw_generate2(root: *u8, outdir: *u8, noext: i64, st: *i64, allowpath: *u8, schemapath: *u8, atlaspath: *u8) -> i64