code wiki / (root) / nx_gzip_wrap.nx

nx_gzip_wrap.nx

buildroot/runtime/nx_gzip_wrap.nx

12992 B381 linesdepth 6pulls 8 transitivereach 393 importersview sourcekind tooltopic gzip
docsdependenciesstructsconstsfunctions

about

nx_gzip_wrap.nx -- RFC 1952 gzip container (DEFLATE + magic + CRC32 + size). CAPABILITY_COMPLETENESS: FULL gzip stream layout per RFC 1952: +---+---+---+---+---+---+---+---+---+---+ |ID1|ID2|CM |FLG| MTIME |XFL|OS | 10-byte fixed header +---+---+---+---+---+---+---+---+---+---+ [ XLEN | <extra field> ] if FLG.FEXTRA set [ FNAME (zero-terminated) ] if FLG.FNAME set [ FCOMMENT (zero-terminated) ] if FLG.FCOMMENT set [ CRC16-of-header-so-far ] if FLG.FHCRC set +-----------------------------+ | ... | DEFLATE-compressed data +-----------------------------+ | CRC32 | 4-byte LE CRC-32 of UNCOMPRESSED +-----------------------------+ | ISIZE | 4-byte LE uncompressed size mod 2^32 +-----------------------------+ FLG bits: 0 FTEXT -- ASCII hint (advisory) 1 FHCRC -- 2-byte header CRC16 trailer present 2 FEXTRA -- 2-byte XLEN + extra field present 3 FNAME -- zero-terminated filename present 4 FCOMMENT -- zero-terminated comment present 5-7 -- reserved; must be 0 (BAD_FLAGS otherwise) CM must be 8 (deflate) -- only legal value per spec. genealogy_id: rfc1952_gzip_1996 lineage_id: nx_gzip_wrap_v1 Composes: nx_deflate + nx_crc32 (already shipped).

dependencies 5 imports · 18 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_deflate.nx nx_crc32.nx nx_gzip_wrap.nx nishi.nx nx_bam_file_compose_test.nx nx_barcheck.nx nx_bgzf_test.nx nx_cc_ingest.nx nx_cc_warc_fetch.nx nx_cc_warc_ingest.nx nx_domain_map.nx nx_fetchprobeb.nx nx_gzip_inflate_kat_test.nx

diagram shows first 10 each side; +0 more imports, +8 more importers in the complete lists below.

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_deflate.nxnx_crc32.nx

imported by: nishi.nxnx_bam_file_compose_test.nxnx_barcheck.nxnx_bgzf_test.nxnx_cc_ingest.nxnx_cc_warc_fetch.nxnx_cc_warc_ingest.nxnx_domain_map.nxnx_fetchprobeb.nxnx_gzip_inflate_kat_test.nxnx_https_fetch_follow.nxnx_https_fetch_lib.nxnx_lib_pow_decomp.nxnx_libdata.nxnx_meal_capture.nxnx_page_ingest.nxnx_research_engine.nxnx_research_engine_admission_t68.nx

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

main sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ nx_crc32 nx_crc32_update nx_crc32_init nx_crc32_table_at nx_gzip_inflate sys_mmap ↻ _gz_read_u32_le _gz_read_u16_le _gz_skip_cstring 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 ↻

structs

73struct NxGzipResult

consts

48const NX_MAGIC_4294967295: i64 = 4294967295
52const NX_GZ_OK: nx_int = 0
53const NX_GZ_ERR_TOO_SHORT: nx_int = 1
54const NX_GZ_ERR_BAD_MAGIC: nx_int = 2
55const NX_GZ_ERR_BAD_METHOD: nx_int = 3
56const NX_GZ_ERR_BAD_FLAGS: nx_int = 4
57const NX_GZ_ERR_FIELD_OVERRUN: nx_int = 5
58const NX_GZ_ERR_DEFLATE: nx_int = 6
59const NX_GZ_ERR_CRC_MISMATCH: nx_int = 7
60const NX_GZ_ERR_SIZE_MISMATCH: nx_int = 8
61const NX_GZ_ERR_OUTPUT_CAPACITY: nx_int = 9
64const NX_GZ_FTEXT: nx_int = 1 // bit 0
65const NX_GZ_FHCRC: nx_int = 2 // bit 1
66const NX_GZ_FEXTRA: nx_int = 4 // bit 2
67const NX_GZ_FNAME: nx_int = 8 // bit 3
68const NX_GZ_FCOMMENT: nx_int = 16 // bit 4
69const NX_GZ_FRESERVED: nx_int = 224 // bits 5-7
87const NX_GZ_RESULT_BYTES: nx_size = 96

functions

91func _gz_read_u16_le(buf: *u8, off: nx_int) -> nx_int
called by 1: nx_gzip_inflate
97func _gz_read_u32_le(buf: *u8, off: nx_int) -> nx_int
called by 2: mainnx_gzip_inflate
107func _gz_skip_cstring(buf: *u8, off: nx_int, end: nx_int) -> nx_int
called by 1: nx_gzip_inflate
118func nx_gzip_inflate(input: *u8, input_size: nx_int,
263func main() -> nx_int