code wiki / _hdl_build / nx_external_corpus.nx

nx_external_corpus.nx

buildroot/runtime/_hdl_build/nx_external_corpus.nx

4651 B72 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic external
docsdependenciesstructsconstsfunctions

about

nx_external_corpus.nx -- EXTERNAL (offsite) search corpus builder: turns the team's SOVEREIGN-FETCHED web pages (knowledge/fetched/*.raw -- real pages pulled over the Nishi TLS-1.3 stack this session, NOT a browser) into the same `id<TAB>text` source the reusable ingestor (nx_onsite_index) consumes. This is the OFFSITE half of the charter's scope=onsite|offsite|both: ONE engine, two scopes. id = the real Wikipedia title (so the result URL https://en.wikipedia.org/wiki/<id> is CORRECT + clickable), text = the page bytes with tabs/ newlines normalized to spaces (HTML tags become corpus-wide low-IDF tokens BM25 down-weights, so content terms still discriminate). Bounded reads (no 4GB sys_read_file reservation). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_external_corpus.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 ec_puts sys_write sys_openat_wr sys_exit sys_mmap ec_emit ec_read_file sys_openat_rd sys_read sys_close ec_puts ↻ sys_write ↻ ec_strlen ec_num sys_mmap ↻ sys_write ↻ sys_close ↻ ec_num ↻

structs

none

consts

10const EC_READ: i64 = 524288 // read up to 512KB of each fetched page
11const EC_TEXTCAP: i64 = 65536 // emit up to 64KB of normalized text per doc
12const EC_OUT: *u8 = "knowledge/index/web_src.tsv" as *u8

functions

14func ec_puts(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 2: ec_emitmain calls 1: sys_write
15func ec_num(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=(48 as u8);k=1}; while m>0{t[k]=((48+(m%10)) as u8);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 }
called by 2: ec_emitmain calls 2: sys_mmapsys_write
16func ec_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: ec_emit
19func ec_read_file(path: *u8, buf: *u8, cap: i64) -> i64
30func ec_emit(ofd: i64, id: *u8, path: *u8, rbuf: *u8, tbuf: *u8) -> i64
49func main() -> i64