code wiki / _hdl_build / nx_nbk_pack.nx

nx_nbk_pack.nx

buildroot/runtime/_hdl_build/nx_nbk_pack.nx

5173 B104 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_nbk_pack.nx -- migrate a decoded book (reader/<slug>/ : book.json + chap*.txt + assets + xray.json) INTO the sovereign Nishi container <slug>.nbk. EPUB (nx_epub_book) and MOBI (nx_mobi_book) both emit that same reader/<slug>/ layout, so this is the single convergence point: any lock-in format -> one owned, content-addressed file. Usage: nx_nbk_pack <slug>. expect_exit: 0 license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_nbk.nx nx_nbk_pack.nx

imports: nx_syscalls.nxnx_itoa_lib.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 sys_mmap cat sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close pk_p sys_write pk_slen sys_exit jfrom pk_slen ↻ jstr add_file sys_mmap ↻ cat ↻ sys_read_file ↻ ensure_dir nbk_pack sys_mmap ↻ nbk_djb2 nbk_slen nbk_put16 nbk_put32 nbk_put64 sys_openat_wr sys_write ↻ sys_close ↻ pk_n nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap

structs

none

consts

8const K_MAGIC_2048: i64 = 2048
9const K_MAGIC_1024: i64 = 1024
41const ECAP: i64 = 1024

functions

11func pk_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: pk_pjfrom
12func pk_p(s: *u8) -> i64 { sys_write(1, s, pk_slen(s)); return 0 }
called by 1: main calls 2: sys_writepk_slen
17func pk_n(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
18func ensure_dir(path: *u8) -> i64 { __syscall(258, 0-100, path, 0x1ed, 0, 0, 0); return 0 }
called by 1: main
19func cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[off+i]=s[i];i=i+1} return off+i }
called by 2: add_filemain
21func jfrom(hay: *u8, hl: i64, start: i64, needle: *u8) -> i64
called by 1: main calls 1: pk_slen
28func jstr(hay: *u8, hl: i64, pos: i64, out: *u8, cap: i64) -> i64
called by 1: main
44func add_file(dir: *u8, name: *u8, names: *i64, datas: *i64, lens: *i64, idx: i64) -> i64
called by 1: main calls 3: sys_mmapcatsys_read_file
56func main(argc: i64, argv: *i64) -> i64