code wiki / _hdl_build / nx_meta_schema.nx
nx_meta_schema.nx
buildroot/runtime/_hdl_build/nx_meta_schema.nx
about
nx_meta_schema.nx -- X-CAP-001 (CALLOUT-012 unblocker; universal-capture.md).
The MODALITY-AGNOSTIC LOSSLESS META RECORD = the crown-jewel intermediate every app
reads/writes (companion / apparel store / writer-ingest / media-library, X-CAP-006).
A record is structured DATA: key=value lines (modality, cid, origin, gen_modality,
source_model, consent, license, attr.* content). "Lossless" here = EXACT byte round-trip
of the structured record (self-model lay118: that is a DIFFERENT objective than perceptual
fidelity of regenerated media -- this layer is exactly-lossless). Proven by emit->parse->emit
byte-identical. CONSENT HARD LINE (X-CAP-005, anti-deepfake): a record with consent=NONE or
missing modality/cid is INVALID -> ms_valid=0. Self-validating gate (METAGATE) for nx_reconcile.
MLIB-003 media records + COMP-004 person records are PROFILES of this one schema (no parallel
substrate). Built sovereignly (nx_cc->nxasm_x86, no gcc). license_tier: ORIGINAL
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_extract.nxnx_media_record.nxnx_meta_consumers.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 13 | const MS_MAGIC_16384: i64 = 16384 |
| 15 | const MS_MAXF: i64 = 64 |
functions
| 17 | func ms_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 18 | func ms_putn(v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64=v; if m<0 {m=0-m}; let t: *u8 = sys_mmap(28); var k: i64=0; if m==0 {t[0]=48;k=1}; while m>0 {t[k]=48+(m%10); m=m/10; k=k+1}; var i: i64=0; while i<k {bb[i]=t[k-1-i]; i=i+1}; sys_write(1, bb, k); return 0 } |
| 20 | func ms_strlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 21 | func ms_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; var s: i64 = 1; while s == 1 { if a[i] != b[i] { s = 0 } else { if a[i] == (0 as u8) { return 1 } else { i = i + 1 } } } return 0 } |
| 22 | func ms_bufeq(a: *u8, b: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { if a[i] != b[i] { return 0 } i = i + 1 } return 1 } called by 1: ms_roundtrip |
| 23 | func ms_app(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i } |
| 24 | func ms_scan(buf: *u8, n: i64, start: i64, delim: i64) -> i64 { var i: i64 = start; var s: i64 = 1; while s == 1 { if i >= n { s = 0 } else { if buf[i] == (delim as u8) { s = 0 } else { i = i + 1 } } } return i } called by 1: ms_parse |
| 27 | func ms_emit(keys: *i64, vals: *i64, n: i64, out: *u8) -> i64 |
| 41 | func ms_parse(buf: *u8, blen: i64, keys: *i64, vals: *i64) -> i64 |
| 59 | func ms_get(keys: *i64, vals: *i64, n: i64, key: *u8) -> i64 |
| 66 | func ms_valid(keys: *i64, vals: *i64, n: i64) -> i64 |
| 76 | func ms_roundtrip(keys: *i64, vals: *i64, n: i64) -> i64 |
| 93 | func ms_set(keys: *i64, vals: *i64, i: i64, k: *u8, v: *u8) -> i64 { keys[i] = (k as *u8) as i64; vals[i] = (v as *u8) as i64; return 0 } |
| 95 | func main() -> i64 |