code wiki / _hdl_build / nx_ciq_publish.nx
nx_ciq_publish.nx
buildroot/runtime/_hdl_build/nx_ciq_publish.nx
about
nx_ciq_publish.nx -- the CIQ PUBLISH bundle: parses the finished analysis OUT of the sovereign seg_store
into THREE readability modalities (operator: "parse out s class exceed for human and ai and machine
readability"), all authored byte-by-byte (no 3rd-party format):
HUMAN -> knowledge/staging/ciq_report.html (exec summary + portfolio table + per-market links +
honest caveats; wiki-guard-compatible: epoch= freshness footer, no placeholder, no dead links;
family-gated dest marker /wiki/family/ciq.html = opaque-gate behind family level)
AI -> knowledge/staging/ciq_report_ai.md (semantic markdown: per-market claim+evidence, LLM-ingestible)
MACHINE -> knowledge/staging/ciq_report_machine.nxr (sovereign labeled records, one per (market,entity),
deterministic + parseable; the faithfulness substrate the S-class gate cross-checks vs the store)
Reads markets registry + per-market placements/gaps. The actual outward push is routed through the
publisher (pub_submit, family-gated dest) as a separate governed step. 100% sovereign. license_tier: ORIGINAL expect_exit: 0
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_canon_cid.nxnx_seg_store.nxnx_uxf_decode.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
| 16 | const CP_MAGIC_1024: i64 = 1024 |
| 17 | const CP_MAGIC_262144: i64 = 262144 |
| 19 | const CP_STORE: *u8 = "knowledge/store/ciq-" |
| 20 | const CP_HUMAN: *u8 = "knowledge/staging/ciq_report.html" |
| 21 | const CP_AI: *u8 = "knowledge/staging/ciq_report_ai.md" |
| 22 | const CP_MACHINE: *u8 = "knowledge/staging/ciq_report_machine.nxr" |
functions
| 24 | func pw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 25 | func pn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} 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{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } |
| 26 | func p_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i]{return 0} i=i+1 } if b[i]!=(0 as u8){return 0} return 1 } |
| 27 | func p_pint(s: *u8) -> i64 { var v: i64=0; var i: i64=0; var go: i64=1; while go==1 { let c: i64=s[i]; if c>=48 { if c<=57 { v=v*10+(c-48); i=i+1 } else { go=0 } } else { go=0 } } return v } called by 1: main |
| 28 | func p_field(dk: *i64, dv: *i64, nf: i64, name: *u8) -> *u8 { var f: i64=0; while f<nf { if p_streq(dk[f] as *u8, name)==1 { return dv[f] as *u8 } f=f+1 } return 0 as *u8 } |
| 29 | func p_split(buf: *u8, delim: i64, out: *i64, maxn: i64) -> i64 { var n: i64=0; var i: i64=0; var intok: i64=0; while buf[i]!=(0 as u8) { let c: i64=buf[i]; if c==delim { buf[i]=0 as u8; intok=0 } else { if intok==0 { if n<maxn { out[n]=(buf as i64)+i; n=n+1 } intok=1 } } i=i+1 } return n } called by 1: main |
| 30 | func p_copy(src: *u8, dst: *u8) -> i64 { var i: i64=0; while src[i]!=(0 as u8){ dst[i]=src[i]; i=i+1 } dst[i]=0 as u8; return i } called by 1: main |
| 31 | func bcat(buf: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ buf[off+i]=s[i]; i=i+1 } return off+i } called by 1: main |
| 32 | func bint(buf: *u8, off: i64, v: i64) -> i64 { var m: i64=v; var o: i64=off; if m<0{ buf[o]=45 as u8; o=o+1; m=0-m } let t: *u8=sys_mmap(32); 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{ buf[o+i]=t[k-1-i]; i=i+1 } return o+k } |
| 33 | func p_key(buf: *u8, market: *u8, suffix: *u8) -> i64 { var o: i64=0; o=ss_cat(buf,o,"ciq:" as *u8); o=ss_cat(buf,o,market); o=ss_cat(buf,o,":" as *u8); o=ss_cat(buf,o,suffix); buf[o]=0 as u8; return o } |
| 35 | func p_write(path: *u8, buf: *u8, n: i64) -> i64 { let fd: i64 = sys_openat_wr(path, 420); if fd < 0 { return 0 - 1 } sys_write(fd, buf, n); sys_close(fd); return n } |
| 37 | func main() -> i64 |