code wiki / _hdl_build / nx_mobi_fixture_build.nx

nx_mobi_fixture_build.nx

buildroot/runtime/_hdl_build/nx_mobi_fixture_build.nx

20650 B298 linesdepth 2pulls 3 transitivereach 0 importersview sourcekind tooltopic mobi
docsdependenciesstructsconstsfunctions

about

nx_mobi_fixture_build.nx -- build a DRM-free MOBI (Kindle) fixture sovereignly, so the MOBI reader rung can be gated end-to-end against the REAL on-disk format (PDB container + PalmDOC-compressed text + EXTH metadata), the way nx_epub_fixture_build gives the EPUB rungs a controlled real EPUB. Also writes a DRM-FLAGGED variant (encryptionType=2) so the reader's "detect + DECLINE DRM" path is gated (we read DRM-FREE files; we never circumvent DRM). Structure: 78-byte PDB header + 2 record-info entries + record0 (PalmDOC hdr + minimal MOBI hdr + EXTH author/title) + record1 (PalmDOC-compressed XHTML). expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_palmdoc.nx nx_mobi_fixture_build.nx

imports: nx_syscalls.nxnx_palmdoc.nx

imported by: nobody (leaf or entry point)

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

main ensure_dir mf_slen sys_mmap puts put16 put32 palmdoc_compress sys_openat_wr mf_p sys_write mf_slen ↻ sys_exit sys_write ↻ sys_close mf_n sys_mmap ↻ sys_write ↻

structs

none

consts

9const K_MAGIC_262144: i64 = 262144
10const K_MAGIC_4096: i64 = 4096
11const K_MAGIC_65001: i64 = 65001
12const K_MAGIC_17480: i64 = 17480
13const K_MAGIC_1040: i64 = 1040
14const K_MAGIC_1296: i64 = 1296

functions

16func mf_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: mf_pmain
17func mf_p(s: *u8) -> i64 { sys_write(1, s, mf_slen(s)); return 0 }
called by 1: main calls 2: sys_writemf_slen
18func mf_n(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 }
called by 1: main calls 2: sys_mmapsys_write
19func ensure_dir(path: *u8) -> i64 { __syscall(258, 0-100, path, 0x1ed, 0, 0, 0); return 0 }
called by 1: main
21func put16(m: *u8, o: i64, v: i64) -> i64 { m[o]=((v>>8)&0xff) as u8; m[o+1]=(v&0xff) as u8; return o+2 }
called by 1: main
22func put32(m: *u8, o: i64, v: i64) -> i64 { m[o]=((v>>24)&0xff) as u8; m[o+1]=((v>>16)&0xff) as u8; m[o+2]=((v>>8)&0xff) as u8; m[o+3]=(v&0xff) as u8; return o+4 }
called by 1: main
23func puts(m: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ m[o+i]=s[i]; i=i+1 } return o+i }
called by 1: main
25func main() -> i64