code wiki / _hdl_build / nx_prim_query.nx

nx_prim_query.nx

buildroot/runtime/_hdl_build/nx_prim_query.nx

8307 B148 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic prim
docsdependenciesstructsconstsfunctions

about

nx_prim_query.nx -- prim lane F782 (query_primitives: the 'what do I have' half of meet-in-the-middle). Reads the F781 manifest knowledge/store/prim_registry.json and returns every primitive object whose text matches the query (substring facet over domain/capabilities/signature/output/id) -- the sovereign query the top-down orchestrator (F783) calls to find matching blocks. Objects copied VERBATIM (already valid JSON). Result to stdout AND an atomic out-file (verifiable). READ-ONLY. Empty query = match-all. Object boundaries found via PLAIN-WORD anchors + numeric-byte confirm ({\x22 before primitive_id) so the match logic carries NO string-escape dependency (cannot silently 0-match). nx_prim_query <query> [manifest.json] [out.json] exit: 0 GREEN | 4 ABSENT/MALFORMED | 2 usage. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_prim_query.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 pq_w sys_write sys_exit pq_slen sys_mmap pq_reads sys_openat_rd sys_read sys_close pq_off pq_b pq_q pq_je pq_has pq_cp pq_bn sys_mmap ↻ sys_write ↻ sys_openat_wr sys_close ↻ sys_renameat

structs

none

consts

12const K_MAGIC_2048: i64 = 2048
13const K_MAGIC_262100: i64 = 262100
14const K_MAGIC_1048576: i64 = 1048576

functions

16func pq_w(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
17func pq_b(rep: *u8, pos: i64, s: *u8) -> i64 { var p: i64 = pos; var i: i64 = 0; while s[i] != (0 as u8) { if p < K_MAGIC_262100 { rep[p] = s[i]; p = p + 1 } i = i + 1 } return p }
called by 1: main
18func pq_bn(rep: *u8, pos: i64, v: i64) -> i64 { var p: i64 = pos; var m: i64 = v; if m < 0 { if p < K_MAGIC_262100 { rep[p] = 45 as u8; p = p + 1 } m = 0 - m } 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 { if p < K_MAGIC_262100 { rep[p] = t[k - 1 - i]; p = p + 1 } i = i + 1 } return p }
called by 1: main calls 1: sys_mmap
19func pq_q(rep: *u8, pos: i64) -> i64 { var p: i64 = pos; if p < K_MAGIC_262100 { rep[p] = 34 as u8; p = p + 1 } return p }
called by 1: main
20func pq_je(rep: *u8, pos: i64, src: *u8, s: i64, e: i64) -> i64
called by 1: main
33func pq_cp(rep: *u8, pos: i64, src: *u8, s: i64, e: i64) -> i64 { var p: i64 = pos; var i: i64 = s; while i < e { if p < K_MAGIC_262100 { rep[p] = src[i]; p = p + 1 } i = i + 1 } return p }
called by 1: main
34func pq_reads(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
43func pq_has(buf: *u8, s: i64, e: i64, pat: *u8, pl: i64) -> i64
called by 1: main
55func pq_off(buf: *u8, s: i64, e: i64, pat: *u8, pl: i64) -> i64
called by 1: main
67func pq_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
68func main(argc: i64, argv: *i64) -> i64