code wiki / _hdl_build / nx_nbk_gate.nx

nx_nbk_gate.nx

buildroot/runtime/_hdl_build/nx_nbk_gate.nx

6523 B100 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_nbk_gate.nx -- liar-kill gate for the sovereign Nishi container (.nbk), the owned media format every lock-in format migrates into. Asserts: MIGRATE : an EPUB book -> .nbk; nbk_get("book.json") round-trips the manifest (title intact). INTEGRITY : nbk_check passes on the packed file; flipping ONE byte -> nbk_check FAILS (content-addressed CID + per-entry hashes DETECT corruption -- which MOBI/EPUB cannot). DETERMINISM: packing the same inputs twice -> BYTE-IDENTICAL .nbk (reproducible CID). CONVERGE : a MOBI book ALSO -> .nbk (format=mobi in the packed manifest) -- one owned format, many inputs. GREEN = lock-in formats migrate into one self-contained, integrity-verified, deterministic file we own. expect_exit:0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_nbk.nx nx_nbk_gate.nx

imports: nx_syscalls.nxnx_nbk.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gp sys_write spawn sys_fork sys_openat_wr sys_dup3 sys_mmap sys_execve sys_exit sys_wait4 sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sys_exit ↻ nbk_get nbk_be32 nbk_slen nbk_be16 nbk_check nbk_be32 ↻ nbk_be64 nbk_be16 ↻ nbk_djb2 gnum sys_write ↻ sys_mmap ↻ ghas

structs

none

consts

none

functions

12func gp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
13func gnum(v0: i64) -> i64 { var v: i64=v0; if v<0 { sys_write(1,"-" as *u8,1); v=0-v } let b: *u8=sys_mmap(24); var k: i64=0; if v==0 {b[0]=48 as u8;k=1} while v>0 {b[k]=(48+(v%10)) as u8; v=v/10; k=k+1} let o: *u8=sys_mmap(24); var j: i64=0; while j<k {o[j]=b[k-1-j];j=j+1} sys_write(1,o,k); return 0 }
called by 1: main calls 2: sys_writesys_mmap
15func spawn(path: *u8, a0: *u8, a1: *u8, redir: *u8) -> i64
35func ghas(hay: *u8, hl: i64, needle: *u8) -> i64
called by 1: main
43func main() -> i64