code wiki / _hdl_build / _wiki_backlinks_gate.nx

_wiki_backlinks_gate.nx

buildroot/runtime/_hdl_build/_wiki_backlinks_gate.nx

13565 B307 linesdepth 7pulls 8 transitivereach 0 importersview sourcekind gate/prooftopic wiki
docsdependenciesstructsconstsfunctions

about

_wiki_backlinks_gate.nx -- WIKI R4 GATE: backlinks + auto-TOC + static graph. Re-proves, from a REAL run (no fabricated GREEN), the three R4 affordances on GROUND TRUTH (substrings + ground-truth counts in the actually-produced output), never a bare rc==const: SEED a doc store with three pages: alpha -- body has NO wikilinks. beta -- body is "[[alpha]]". gamma -- body is "[[alpha]] [[beta]] [[ZzqMissing]]". backlinks_ok alpha's backlinks include BOTH beta AND gamma; beta's backlinks include gamma; gamma's are EMPTY. (the inversion of the forward [[wikilinks]] is correct) toc_ok the TOC for a body "# Title / ## Section A / ## Section B" contains BOTH "#section-a" and "#section-b" anchor links, AND id-injection stamps id="section-a" onto the <h2>. (TOC links jump to real injected ids) graph_ok node_count==3 AND edge_count==3 (beta->alpha, gamma->alpha, gamma->beta). The [[ZzqMissing]] reference is NOT a node and NOT an edge -- it is rot. rot_ok gamma's [[ZzqMissing]] is flagged broken (broken_count>=1). Verdict line (judged by this marker; stdout + knowledge/status): WIKIBACKLINKS backlinks_ok=<0|1> toc_ok=<0|1> graph_ok=<0|1> rot_ok=<0|1> verdict=GREEN|RED Pure NishiLang, NO SQL, NO .sh/.py/.js, no new .tsv/.conf. nx_sites_daemon UNTOUCHED. Imports the three R4 organs under test; each shared base module is imported via a single consistent path (the doc-store + syscalls come in transitively through the R4 organs -- imported here only as needed) to avoid the double-import nxasm rc6 trap. license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_wiki_index_builder.nx nx_wiki_backlinks.nx nx_wiki_toc.nx nx_wiki_graph.nx _wiki_backlinks_gate.nx

imports: nx_syscalls.nxnx_wiki_index_builder.nxnx_wiki_backlinks.nxnx_wiki_toc.nxnx_wiki_graph.nx

imported by: nobody (leaf or entry point)

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

main wbg_p wbg_w sys_write sys_mmap nx_wiki_doc_store_init sys_mmap ↻ wbg_pn wbg_n sys_mmap ↻ sys_write ↻ nx_wiki_doc_store_add sys_mmap ↻ nx_wib_pool_alloc wbg_slen nx_wiki_doc_store_count nx_wiki_backlinks_of nx_wiki_doc_store_count ↻ sys_mmap ↻ nx_wiki_doc_store_lookup nx_wiki_forward_links nx_wiki_backlink_slug_matc sys_mmap ↻ nx_wbl_strip_wiki wbg_rowid_in nx_wiki_backlinks_panel sys_mmap ↻ nx_wiki_backlinks_of ↻ nx_wbl_emit nx_wiki_doc_store_lookup ↻ nx_wbl_strip_wiki ↻ nx_wbl_emit_bytes sys_write ↻ nx_wiki_toc_build sys_mmap ↻ nx_wiki_toc_slugify nx_wtoc_emit nx_wtoc_emit_bytes wbg_has wbg_find

structs

none

consts

40const WBG_LOG: *u8 = "knowledge/status/wiki_backlinks_gate.log"
41const WBG_OUTCAP: i64 = 262144 // per-render output buffer (256 KiB)

functions

44func wbg_w(fd: i64, s: *u8) -> i64
called by 2: wbg_w2wbg_p calls 1: sys_write
50func wbg_n(fd: i64, v: i64) -> i64
called by 2: wbg_n2wbg_pn calls 2: sys_mmapsys_write
64func wbg_w2(lfd: i64, s: *u8) -> i64 { wbg_w(1, s); if lfd >= 0 { wbg_w(lfd, s) } return 0 }
called by 1: main calls 1: wbg_w
65func wbg_n2(lfd: i64, v: i64) -> i64 { wbg_n(1, v); if lfd >= 0 { wbg_n(lfd, v) } return 0 }
called by 1: main calls 1: wbg_n
66func wbg_p(s: *u8) -> i64 { wbg_w(1, s); return 0 }
called by 1: main calls 1: wbg_w
67func wbg_pn(v: i64) -> i64 { wbg_n(1, v); return 0 }
called by 1: main calls 1: wbg_n
68func wbg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: wbg_findmain
71func wbg_find(hay: *u8, hn: i64, needle: *u8) -> i64
called by 1: wbg_has calls 1: wbg_slen
89func wbg_has(hay: *u8, hn: i64, needle: *u8) -> i64
called by 1: main calls 1: wbg_find
95func wbg_rowid_in(arr: *i64, cnt: i64, r: i64) -> i64
called by 1: main
104func main() -> i64