/* deflate.h -- internal compression state * Copyright (C) 1995-2024 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* @(#) $Id$ */ #ifndef DEFLATE_H #define DEFLATE_H #include "zutil.h" /* define NO_GZIP when compiling if you want to disable gzip header and trailer creation by deflate(). NO_GZIP would be used to avoid linking in the crc code when it is not needed. For shared libraries, gzip encoding should be left enabled. */ #ifndef NO_GZIP #define GZIP #endif /* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at the cost of a larger memory footprint */ /* #define LIT_MEM */ /* =========================================================================== * Internal compression state. */ #define LENGTH_CODES … /* number of length codes, not counting the special END_BLOCK code */ #define LITERALS … /* number of literal bytes 0..255 */ #define L_CODES … /* number of Literal or Length codes, including the END_BLOCK code */ #define D_CODES … /* number of distance codes */ #define BL_CODES … /* number of codes used to transfer the bit lengths */ #define HEAP_SIZE … /* maximum heap size */ #define MAX_BITS … /* All codes must not exceed MAX_BITS bits */ #define Buf_size … /* size of bit buffer in bi_buf */ #define INIT_STATE … #ifdef GZIP #define GZIP_STATE … #endif #define EXTRA_STATE … #define NAME_STATE … #define COMMENT_STATE … #define HCRC_STATE … #define BUSY_STATE … #define FINISH_STATE … /* Stream status */ /* Data structure describing a single value and its code string. */ ct_data; #define Freq … #define Code … #define Dad … #define Len … static_tree_desc; tree_desc; Pos; Posf; IPos; /* A Pos is an index in the character window. We use short instead of int to * save space in the various tables. IPos is used only for parameter passing. */ deflate_state; /* Output a byte on the stream. * IN assertion: there is enough room in pending_buf. */ #define put_byte(s, c) … #define MIN_LOOKAHEAD … /* Minimum amount of lookahead, except at the end of the input file. * See deflate.c for comments about the MIN_MATCH+1. */ #define MAX_DIST(s) … /* In order to simplify the code, particularly on 16 bit machines, match * distances are limited to MAX_DIST instead of WSIZE. */ #define WIN_INIT … /* Number of bytes after end of data in window to initialize in order to avoid memory checker errors from longest match routines */ /* in trees.c */ void ZLIB_INTERNAL _tr_init(deflate_state *s); int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc); void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len, int last); void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s); void ZLIB_INTERNAL _tr_align(deflate_state *s); void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf, ulg stored_len, int last); #define d_code(dist) … /* Mapping from a distance to a distance code. dist is the distance - 1 and * must not have side effects. _dist_code[256] and _dist_code[257] are never * used. */ #ifndef ZLIB_DEBUG /* Inline versions of _tr_tally for speed: */ #if defined(GEN_TREES_H) || !defined(STDC) extern uch ZLIB_INTERNAL _length_code[]; extern uch ZLIB_INTERNAL _dist_code[]; #else extern const uch ZLIB_INTERNAL _length_code[]; extern const uch ZLIB_INTERNAL _dist_code[]; #endif #ifdef LIT_MEM #define _tr_tally_lit … #define _tr_tally_dist … #else #define _tr_tally_lit(s, c, flush) … #define _tr_tally_dist(s, distance, length, flush) … #endif #else #define _tr_tally_lit … #define _tr_tally_dist … #endif #endif /* DEFLATE_H */