code wiki / _hdl_build / nx_nmz_author.nx
nx_nmz_author.nx
buildroot/runtime/_hdl_build/nx_nmz_author.nx
about
nx_nmz_author.nx -- NATIVE authoring into .nmz (operator: "make sure our format isnt just a translation layer but
actually a SUPERIOR format on its own if people want to use it natively like ourselves for GENERATED content").
This authors content DIRECTLY into .nmz from raw generated text -- NO lock-in source format involved -- and adds
the features that make .nmz superior to EPUB/MOBI/PDF as a native format, especially for generated content:
@kind -- the media kind (first-class)
@provenance -- FIRST-CLASS generation lineage (generator/method/origin/license). EPUB/MOBI have NO native
provenance; for AI/generated content this is the authenticity record.
content-addressed CID (sha256, uxf_cid) -- tamper-evident integrity. EPUB/MOBI can't detect a flipped byte.
DETERMINISTIC -- same inputs -> byte-identical -> same CID. (zip-based formats vary by timestamp/order.)
Also writes reader/<slug>/{book.json,chap0.txt} so native content renders in the SAME zero-JS reader (one pipeline
for liberated AND generated). Usage: nx_nmz_author [slug]. expect_exit: 0 license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_canon_bin.nxnx_uxf_cid.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
| 15 | const K_MAGIC_8192: i64 = 8192 |
| 16 | const K_MAGIC_1024: i64 = 1024 |
| 17 | const K_MAGIC_1048576: i64 = 1048576 |
functions
| 19 | func au_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 20 | func au_p(s: *u8) -> i64 { sys_write(1, s, au_slen(s)); return 0 } |
| 21 | func au_pn(v: i64) -> i64 { let b: *u8=sys_mmap(24); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(24); 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{b[i]=t[k-1-i];i=i+1}; sys_write(1,b,k); return 0 } |
| 22 | func ensure_dir(path: *u8) -> i64 { __syscall(258, 0-100, path, 0x1ed, 0, 0, 0); return 0 } called by 1: main |
| 23 | func cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){d[o+i]=s[i];i=i+1} return o+i } called by 1: main |
| 24 | func catn(d: *u8, o0: i64, v: i64) -> i64 { var o: i64=o0; var m: i64=v; let t: *u8=sys_mmap(24); 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{d[o+i]=t[k-1-i];i=i+1} return o+k } |
| 25 | func writef(path: *u8, buf: *u8, n: i64) -> i64 { let fd: i64=sys_openat_wr(path, 0x1a4); if fd<0 {return 0-1} sys_write(fd, buf, n); sys_close(fd); return 0 } |
| 27 | func main(argc: i64, argv: *i64) -> i64 |