code wiki / _hdl_build / nx_inbook_search.nx

nx_inbook_search.nx

buildroot/runtime/_hdl_build/nx_inbook_search.nx

7687 B145 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_inbook_search.nx -- SC21: sovereign IN-BOOK full-text search (find-in-book) over a reader book's extracted chapters. Companion to SC20 nx_book_search (library-level): this searches WITHIN one book, ranks its chapters by match count, and returns the best chapter + a context SNIPPET around the first hit. Reuses nx_research_extract (re_count / re_find). Case-insensitive (lowercased mirror). Runs over the in-repo extracted chapters (reader/<slug>/chapN.txt) -> NO live-NAS / sqlite / server dependency, no collision with the ark-beat loop. Self-gated by KATs over the real "Dissolution" book text. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_research_extract.nx nx_itoa_lib.nx nx_syscalls.nx nx_inbook_search.nx

imports: nx_research_extract.nxnx_itoa_lib.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main ib_p sys_write sys_mmap ib_search ib_chap_path ib_cpstr sys_mmap ↻ ib_read sys_openat_rd sys_read sys_close ib_lc re_count re_strlen re_find re_strlen ↻ ib_n nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap ib_snippet ib_chap_path ↻ ib_read ↻ ib_p ↻ sys_write ↻ sys_openat_append ib_fp sys_write ↻ ib_fn nxi_fd ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real sys_close ↻ sys_exit

structs

none

consts

11const IB_MAGIC_262144: i64 = 262144
12const IB_MAGIC_8192: i64 = 8192
14const IB_DIR: *u8 = "knowledge/staging/media/reader/dissolution_wotsq_b1/"
15const IB_LOG: *u8 = "knowledge/status/inbook_search.log"
16const IB_MAXCH: i64 = 256

functions

18func ib_p(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: ib_snippetmain calls 1: sys_write
23func ib_n(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
24func ib_fp(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
29func ib_fn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 1: main calls 1: nxi_fd
30func ib_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: ib_search
32func ib_read(path: *u8, buf: *u8, cap: i64) -> i64
43func ib_cpstr(dst: *u8, at: i64, src: *u8) -> i64 { var w: i64 = at; var d: i64 = 0; while src[d] != (0 as u8) { dst[w] = src[d]; w = w + 1; d = d + 1 } return w }
called by 1: ib_chap_path
46func ib_chap_path(i: i64, out: *u8) -> i64
91func ib_snippet( chidx: i64, off: i64, buf: *u8, lc: *u8, pathbuf: *u8 ) -> i64
103func main() -> i64