code wiki / _hdl_build / nx_inbook_search.nx
nx_inbook_search.nx
buildroot/runtime/_hdl_build/nx_inbook_search.nx
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
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
structs
| none |
consts
| 11 | const IB_MAGIC_262144: i64 = 262144 |
| 12 | const IB_MAGIC_8192: i64 = 8192 |
| 14 | const IB_DIR: *u8 = "knowledge/staging/media/reader/dissolution_wotsq_b1/" |
| 15 | const IB_LOG: *u8 = "knowledge/status/inbook_search.log" |
| 16 | const IB_MAXCH: i64 = 256 |
functions
| 18 | func 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 } |
| 23 | func ib_n(v: i64) -> i64 { nxi_out(v); return 0 } |
| 24 | func 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 } |
| 29 | func ib_fn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 } |
| 30 | func ib_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c } called by 1: ib_search |
| 32 | func ib_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 43 | func 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 |
| 46 | func ib_chap_path(i: i64, out: *u8) -> i64 |
| 67 | func ib_search(buf: *u8, lc: *u8, pathbuf: *u8, term: *u8, out: *i64) -> i64 |
| 91 | func ib_snippet( chidx: i64, off: i64, buf: *u8, lc: *u8, pathbuf: *u8 ) -> i64 |
| 103 | func main() -> i64 |