1ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease/* inftrees.h -- header to use inftrees.c
2ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease * Copyright (C) 1995-2002 Mark Adler
3ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease * For conditions of distribution and use, see copyright notice in zlib.h
4ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease */
5ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
6ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease/* WARNING: this file should *not* be used by applications. It is
7ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease   part of the implementation of the compression library and is
8ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease   subject to change. Applications should only use zlib.h.
9ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease */
10ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
11ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease/* Huffman code lookup table entry--this entry is four bytes for machines
12ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease   that have 16-bit pointers (e.g. PC's in the small or medium model). */
13ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
14ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease#ifndef _INFTREES_H
15ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease#define _INFTREES_H
16ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
17ec0bab5697bb31ba980810145f62e3799946ec60Victoria Leasetypedef struct inflate_huft_s FAR inflate_huft;
18ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
19ec0bab5697bb31ba980810145f62e3799946ec60Victoria Leasestruct inflate_huft_s {
20ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease  union {
21ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    struct {
22ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease      Byte Exop;        /* number of extra bits or operation */
23ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease      Byte Bits;        /* number of bits in this code or subcode */
24ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    } what;
25ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    uInt pad;           /* pad structure to a power of 2 (4 bytes for */
26ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease  } word;               /*  16-bit, 8 bytes for 32-bit int's) */
27ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease  uInt base;            /* literal, length base, distance base,
28ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease                           or table offset */
29ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease};
30ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
31ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease/* Maximum size of dynamic tree.  The maximum found in a long but non-
32ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease   exhaustive search was 1004 huft structures (850 for length/literals
33ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease   and 154 for distances, the latter actually the result of an
34ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease   exhaustive search).  The actual maximum is not known, but the
35ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease   value below is more than safe. */
36ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease#define MANY 1440
37ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
38ec0bab5697bb31ba980810145f62e3799946ec60Victoria Leaselocal  int inflate_trees_bits OF((
39ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    uIntf *,                    /* 19 code lengths */
40ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    uIntf *,                    /* bits tree desired/actual depth */
41ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    inflate_huft * FAR *,       /* bits tree result */
42ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    inflate_huft *,             /* space for trees */
43ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    z_streamp));                /* for messages */
44ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
45ec0bab5697bb31ba980810145f62e3799946ec60Victoria Leaselocal  int inflate_trees_dynamic OF((
46ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    uInt,                       /* number of literal/length codes */
47ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    uInt,                       /* number of distance codes */
48ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    uIntf *,                    /* that many (total) code lengths */
49ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    uIntf *,                    /* literal desired/actual bit depth */
50ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    uIntf *,                    /* distance desired/actual bit depth */
51ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    inflate_huft * FAR *,       /* literal/length tree result */
52ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    inflate_huft * FAR *,       /* distance tree result */
53ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    inflate_huft *,             /* space for trees */
54ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    z_streamp));                /* for messages */
55ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
56ec0bab5697bb31ba980810145f62e3799946ec60Victoria Leaselocal  int inflate_trees_fixed OF((
57ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    uIntf *,                    /* literal desired/actual bit depth */
58ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    uIntf *,                    /* distance desired/actual bit depth */
59ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    const inflate_huft * FAR *, /* literal/length tree result */
60ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    const inflate_huft * FAR *, /* distance tree result */
61ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    z_streamp));                /* for memory allocation */
62ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
63ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease#endif /* _INFTREES_H */
64