code wiki / (root) / nx_zip_extract1.nx

nx_zip_extract1.nx

buildroot/runtime/nx_zip_extract1.nx

6629 B164 linesdepth 6pulls 6 transitivereach 0 importersview sourcekind tooltopic zip
docsdependenciesstructsconstsfunctions

about

nx_zip_extract1.nx -- sovereign single-entry ZIP extractor (STORED or DEFLATE). Reads a .zip whose FIRST local file entry is the payload (the shape HF ships for small single-file dataset archives, e.g. whyen-wang/coco_keypoints/data/ keypoints_validation.zip -> keypoints_validation.json), inflates it with the shipped sovereign nx_deflate_inflate, and writes the decompressed bytes out. This is the "eat the debt" companion to the main-API dataset fetch: the HF datasets-server (datasets-server.huggingface.co) 503s our client for EVERY route (its own /healthcheck 503s -> HF-side/edge, not a fetcher bug), so dataset CONTENT is reached via the WORKING main API (tree -> LFS resolve -> file) and decompressed here. 100% sovereign: own TLS fetch (upstream) + own DEFLATE (here); the only non-Nishi input is the fetched archive bytes. Config (relative to nxc2 cwd; the build/run launcher does not forward argv): data/mp_zip_in.txt -- path to the .zip on disk data/mp_zip_out.txt -- path to write the decompressed entry nx_safety_envelope: intended_use: decompress a fetched dataset archive (offline, local file) sil_target: SIL1 verdict: NOT_YET_EVALUATED genealogy_id: pkware/appnote + ietf/rfc_1951 lineage_id: nx_zip_extract1_v1

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_deflate.nx nx_zip_extract1.nx

imports: nx_syscalls.nxnx_deflate.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 ze_cfg sys_openat_rd sys_mmap ↻ sys_read sys_close ze_puts sys_write ze_read_all sys_openat_rd ↻ sys_read ↻ sys_close ↻ ze_putn sys_mmap ↻ sys_write ↻ sys_exit ze_u16 ze_u32 sys_write ↻ nx_deflate_inflate sys_mmap ↻ nx_bitstream_alloc sys_mmap ↻ _deflate_inflate_block nx_bitstream_read_lsb nx_bitstream_bits_remainin _bs_peek_byte nx_bitstream_byte_align nx_bitstream_read_byte_ali nx_bitstream_byte_align ↻ _deflate_build_static_litl sys_mmap ↻ nx_huffman_build sys_mmap ↻ _deflate_build_static_dist sys_mmap ↻ nx_huffman_build ↻ _deflate_decode_huffman_bl nx_huffman_decode_lsb

structs

none

consts

25const K_MAGIC_4096: i64 = 4096
26const K_MAGIC_1024: i64 = 1024
27const K_MAGIC_65536: i64 = 65536

functions

29func ze_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return n }
called by 1: main calls 1: sys_write
30func ze_putn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
45func ze_u16(b: *u8, o: i64) -> i64 { return (b[o] as i64) + ((b[o+1] as i64) << 8) }
called by 1: main
46func ze_u32(b: *u8, o: i64) -> i64
called by 1: main
51func ze_read_all(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
65func ze_write_all(path: *u8, buf: *u8, n: i64) -> i64
79func ze_cfg(path: *u8, out: *u8, cap: i64) -> i64
105func main() -> i64