code wiki / _hdl_build / nx_prim_registry.nx
nx_prim_registry.nx
buildroot/runtime/_hdl_build/nx_prim_registry.nx
about
nx_prim_registry.nx -- prim lane F781 (BOTTOM-UP pillar of the meet-in-the-middle synthesis engine).
Tier-1: read knowledge/tool_schemas.conf (name|title|readOnly|destructive|idempotent|openWorld|
output-desc|argv-grammar[col8]) and EMIT a sovereign primitives manifest knowledge/store/prim_registry.json
-- one primitive per MCP tool: primitive_id, title, domain (name-prefix-derived), capabilities
(structural facets from data, NOT hallucinated verbs -- rule 4), signature (the col8 typed argv grammar
VERBATIM, or a flagged generic when absent = back-compat), output, safety{ro/destr/idem/open}, typed.
The 'what do I have' half of meet-in-the-middle; F782 query_primitives reads this. ATOMIC (tmp+rename,
no torn read). READ-ONLY over the source (Rule 26). Declares its envelope (scanned/typed/generic/cap).
nx_prim_registry run [schema.conf] [out.json] [tmp.json]
exit: 0 GREEN | 4 ABSENT-INPUT (schema unreadable) | 5 WRITE-FAIL | 2 usage.
license_tier: ORIGINAL expect_exit: 0
dependencies 1 imports · 0 importers
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
structs
| none |
consts
| 13 | const K_MAGIC_1024: i64 = 1024 |
| 14 | const K_MAGIC_1048500: i64 = 1048500 |
| 15 | const K_MAGIC_1048576: i64 = 1048576 |
| 16 | const K_MAGIC_2048: i64 = 2048 |
functions
| 18 | func pr_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 } |
| 19 | func pr_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_1048500 { rep[p] = s[i]; p = p + 1 } i = i + 1 } return p } |
| 20 | func pr_bn(rep: *u8, pos: i64, v: i64) -> i64 { var p: i64 = pos; var m: i64 = v; if m < 0 { if p < K_MAGIC_1048500 { 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_1048500 { rep[p] = t[k - 1 - i]; p = p + 1 } i = i + 1 } return p } |
| 21 | func pr_q(rep: *u8, pos: i64) -> i64 { var p: i64 = pos; if p < K_MAGIC_1048500 { rep[p] = 34 as u8; p = p + 1 } return p } |
| 22 | func pr_key(rep: *u8, pos: i64, k: *u8) -> i64 { var p: i64 = pos; p = pr_q(rep, p); p = pr_b(rep, p, k); p = pr_q(rep, p); p = pr_b(rep, p, ":" as *u8); return p } |
| 23 | func pr_je(rep: *u8, pos: i64, src: *u8, s: i64, e: i64) -> i64 called by 1: main |
| 36 | func pr_reads(path: *u8, buf: *u8, cap: i64) -> i64 |
| 45 | func pr_domain(src: *u8, s: i64, e: i64, dom: *u8) -> i64 called by 1: main |
| 57 | func main(argc: i64, argv: *i64) -> i64 |