nx_txtscan.nx
buildroot/runtime/nx_txtscan.nx
about
nx_txtscan.nx -- CLI over nx_txtscan_lib: sovereign, BYTE-ORIENTED text search.
The estate already had two sovereign greps (nx_codegrep, nx_shelltool grep) and both are
line-oriented, because both reimplemented grep's worldview rather than only its independence.
On knowledge/library/write_nsfwbot_flowgpt_2601_14324.txt -- 112,755 bytes, ONE line, which is
what scraped text normally looks like -- asking for a pattern returns the whole file as a single
"match". This organ reports OFFSETS, which every byte stream has, instead of lines, which only
some text has.
nx_txtscan find <path> <pattern> [ctx] every hit: offset + a clamped context window
nx_txtscan count <path> <pattern> occurrences (overlapping)
nx_txtscan ctl <path> non-tab/LF/CR control bytes + run lengths
`ctl` is not a bonus mode: it is the capability that found 211 corrupted sources in the local
tree, each carrying one 119-byte run of 0x0E where a migration should have rewritten a number
formatter. nx_cc accepts 0x0E as whitespace, so every one of those files compiles clean.
u2605HONEST TRUNCATION IS PART OF THE CONTRACT. This organ prints `truncated=1` with the counts
whenever it did not see everything -- because a capped listing that reports absence is a silent
wrong answer, and that exact defect cost this session a job that sat enqueued and ignored while
a worker reported "queue empty".
license_tier: ORIGINAL
module: nishi-core.text.scan.cli
capability: TEXT_SCAN_BYTE_ORIENTED
dependencies 3 imports · 0 importers
imports: nx_estate_path.nxnx_itoa_lib.nxnx_txtscan_lib.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
| 32 | const TS_BUF_BYTES: i64 = 33554432 |
| 37 | const TS_SHOW_MAX: i64 = 64 |
| 39 | const TS_CTX_DEFAULT: i64 = 60 |
| 40 | const TS_CTX_MAX: i64 = 400 |
functions
| 42 | func tw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 43 | func te(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 } |
| 47 | func ts_show(buf: *u8, lo: i64, hi: i64) -> i64 |
| 61 | func ts_slurp(path: *u8, buf: *u8, cap: i64, more: *i64) -> i64 |
| 83 | func ts_note_trunc(more: i64, n: i64) -> i64 |
| 91 | func ts_find(path: *u8, pat: *u8, ctx: i64) -> i64 |
| 126 | func ts_count(path: *u8, pat: *u8) -> i64 |
| 140 | func ts_ctl(path: *u8) -> i64 |
| 180 | func ts_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 187 | func ts_atoi(s: *u8) -> i64 called by 1: main |
| 200 | func main(argc: i64, argv: *i64) -> i64 |