code wiki / _hdl_build / nx_mobi_inspect.nx

nx_mobi_inspect.nx

buildroot/runtime/_hdl_build/nx_mobi_inspect.nx

6742 B104 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic mobi
docsdependenciesstructsconstsfunctions

about

nx_mobi_inspect.nx -- diagnostic: dump a MOBI's PDB/PalmDOC/MOBI-header structure + LOCATE the HUFF/CDIC records by scanning every PDB record for the "HUFF"/"CDIC" magics, so we can see why the Huffman Record Offset field read disagrees with reality on a real kindlegen file. Usage: nx_mobi_inspect <mobi-path>. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_mobi_inspect.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ip sys_write sys_exit be16 be32 inum sys_write ↻ sys_mmap ↻ sys_write ↻ tag4 sys_write ↻ find_sub islen

structs

none

consts

none

functions

6func ip(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
7func inum(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
8func be16(b: *u8, o: i64) -> i64 { return ((b[o] as i64)<<8)|(b[o+1] as i64) }
called by 1: main
9func be32(b: *u8, o: i64) -> i64 { return ((b[o] as i64)<<24)|((b[o+1] as i64)<<16)|((b[o+2] as i64)<<8)|(b[o+3] as i64) }
called by 1: main
10func tag4(z: *u8, o: i64) -> i64 { sys_write(1, (z as i64 + o) as *u8, 4); return 0 }
called by 1: main calls 1: sys_write
11func islen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: find_sub
12func find_sub(hay: *u8, hl: i64, needle: *u8) -> i64
called by 1: main calls 1: islen
19func main(argc: i64, argv: *i64) -> i64