code wiki / _hdl_build / nx_mobi_huff_gate.nx
nx_mobi_huff_gate.nx
buildroot/runtime/_hdl_build/nx_mobi_huff_gate.nx
about
nx_mobi_huff_gate.nx -- end-to-end gate for HUFF/CDIC MOBI liberation (compression 17480):
nx_mobi_fixture_build -> nishi_mobi_huff.mobi (PDB w/ compression=17480 + HUFF record + CDIC record + a
HUFF-compressed text record) -> nx_mobi_book (now routes 17480 through nx_huffcdic) -> reader/<slug>/.
Asserts the Kindle HUFF container flows ALL THE WAY to a readable book.json: format=mobi, EXTH title+author, and
the HUFF-decoded prose ("Alice was beginning" from phrase0 + "White Rabbit" from phrase1). This proves the 17480
pipeline -- Huffman-record gathering (MOBI 0x70/0x74) + huff_load + cdic_load + hc_unpack + text assembly --
end to end on a real on-disk MOBI. HONEST: the fixture is the minimal all-terminal codelen-1 Huffman case; real
multi-codelen Kindle HUFF (the mincode-walk + recursive phrases) needs a real DRM-free file (no open HUFF encoder
exists to synthesize a richer one). expect_exit: 0 license_tier: ORIGINAL
dependencies 1 imports · 0 importers
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
structs
| none |
consts
| none |
functions
| 12 | func gp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 13 | func 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 } |
| 14 | func ghas(hay: *u8, hl: i64, needle: *u8) -> i64 called by 1: main |
| 21 | func rd(path: *u8, lenp: *i64) -> *u8 { lenp[0]=0; return sys_read_file(path, lenp) } |
| 23 | func spawn(path: *u8, a0: *u8, a1: *u8, redir: *u8) -> i64 |
| 44 | func main() -> i64 |