"""
Auto-generated Python stub file from zlib.zdef.py
Module: zlib.zdef
"""


from stdint import *
import stddef
import string
import stdlib
import memhub
import t, c

ZDEFLATE_WINDOW_BITS: t.CDefine = 15
ZDEFLATE_WINDOW_SIZE: t.CDefine =    (1 << ZDEFLATE_WINDOW_BITS)
ZDEFLATE_WINDOW_MASK: t.CDefine =    (ZDEFLATE_WINDOW_SIZE - 1)
ZDEFLATE_MIN_MATCH: t.CDefine =      3
ZDEFLATE_MAX_MATCH: t.CDefine =      258
ZDEFLATE_HASH_BITS: t.CDefine =      15
ZDEFLATE_HASH_SIZE: t.CDefine =      (1 << ZDEFLATE_HASH_BITS)
ZDEFLATE_HASH_MASK: t.CDefine =      (ZDEFLATE_HASH_SIZE - 1)
ZDEFLATE_MAX_CODES:         t.CDefine =      288
ZDEFLATE_MAX_DIST_CODES:    t.CDefine = 32
ZDEFLATE_MAX_BITS:          t.CDefine =       15
ZDEFLATE_MAX_CODELEN_CODES: t.CDefine = 19
ZDEFLATE_LIT_COUNT:  t.CDefine =      286
ZDEFLATE_DIST_COUNT: t.CDefine =     30
ZDEFLATE_LEN_SYMBOLS_BASE: t.CDefine = 257
ZDEFLATE_END_OF_BLOCK:     t.CDefine =     256
zdeflate_len_extra_bits: t.CExtern | t.CArray[t.CInt, 29]
zdeflate_len_base: t.CExtern | t.CArray[t.CInt, 29]
zdeflate_dist_extra_bits: t.CExtern | t.CArray[t.CInt, 30]
zdeflate_dist_base: t.CExtern | t.CArray[t.CInt, 30]
zdeflate_codelen_order: t.CExtern | t.CArray[int, 19]

@t.Object
class zbit_writer:
    pool: memhub.MemManager | t.CPtr
    buf: BYTE | t.CPtr
    cap: t.CSizeT
    byte_pos: t.CSizeT
    bit_pos: t.CInt
    def __init__(self: zbit_writer, pool: memhub.MemManager | t.CPtr) -> t.CInt: pass
    def ensure(self: zbit_writer, need: t.CSizeT) -> t.CInt: pass
    def write_bits(self: zbit_writer, value: UINT, nbits: t.CInt) -> t.CInt: pass
    def write_bits_rev(self: zbit_writer, code: UINT, nbits: t.CInt) -> t.CInt: pass
    def stored_block(self: zbit_writer, data: UINT8PTR, length: t.CSizeT, final: t.CInt) -> t.CInt: pass
    def write_zlib_header(self: zbit_writer, wbits: t.CInt, level: t.CInt) -> t.CInt: pass
    def write_gzip_header(self: zbit_writer) -> t.CInt: pass
    def align(self: zbit_writer) -> t.CInt: pass
    def total(self: zbit_writer) -> t.CSizeT: pass
    def free(self: zbit_writer) -> t.CInt: pass
    def __del__(self: zbit_writer) -> t.CInt: pass
@t.Object
class zbit_reader:
    buf: BYTE | t.CPtr
    length: t.CSizeT
    byte_pos: t.CSizeT
    bit_pos: t.CInt
    def init(self: zbit_reader, buf: BYTE | t.CPtr, length: t.CSizeT) -> t.CInt: pass
    def read_bits(self: zbit_reader, nbits: t.CInt, out: UINTPTR) -> t.CInt: pass
    def read_bits_rev(self: zbit_reader, nbits: t.CInt, out: UINTPTR) -> t.CInt: pass
    def align(self: zbit_reader) -> t.CInt: pass

def zdef_alloc(pool: memhub.MemManager | t.CPtr, n: t.CSizeT) -> VOIDPTR: pass

def zdef_free(pool: memhub.MemManager | t.CPtr, p: VOIDPTR) -> t.CInt: pass
