code wiki / (root) / nx_gzip_wrap.nx

nx_gzip_wrap.nx

buildroot/runtime/nx_gzip_wrap.nx

12845 B379 linesdepth 6pulls 8 transitivereach 332 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 · 15 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_fetchprobeb.nx nx_gzip_inflate_kat_test.nx nx_https_fetch_follow.nx

diagram shows first 10 each side; +0 more imports, +5 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_fetchprobeb.nxnx_gzip_inflate_kat_test.nxnx_https_fetch_follow.nxnx_https_get_cli2.nxnx_lib_pow_decomp.nxnx_libdata.nxnx_page_ingest.nxnx_research_engine.nx

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

main sys_mmap 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 ↻ _deflate_build_static_dist sys_mmap ↻ nx_huffman_build ↻ _deflate_decode_huffman_bl nx_huffman_decode_lsb nx_bitstream_read_lsb ↻ _deflate_length_base _deflate_length_extra nx_bitstream_read_lsb ↻ _deflate_distance_base _deflate_distance_extra _deflate_copy_overlap sys_mmap ↻ _deflate_build_dynamic_tre

structs

72struct 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
63const NX_GZ_FTEXT: nx_int = 1 // bit 0
64const NX_GZ_FHCRC: nx_int = 2 // bit 1
65const NX_GZ_FEXTRA: nx_int = 4 // bit 2
66const NX_GZ_FNAME: nx_int = 8 // bit 3
67const NX_GZ_FCOMMENT: nx_int = 16 // bit 4
68const NX_GZ_FRESERVED: nx_int = 224 // bits 5-7
86const NX_GZ_RESULT_BYTES: nx_size = 96

functions

90func _gz_read_u16_le(buf: *u8, off: nx_int) -> nx_int
called by 1: nx_gzip_inflate
96func _gz_read_u32_le(buf: *u8, off: nx_int) -> nx_int
called by 1: nx_gzip_inflate
106func _gz_skip_cstring(buf: *u8, off: nx_int, end: nx_int) -> nx_int
called by 1: nx_gzip_inflate
117func nx_gzip_inflate(input: *u8, input_size: nx_int,
261func main() -> nx_int