3
|
1 /* inftrees.h -- header to use inftrees.c
|
|
2 * Copyright (C) 1995 Mark Adler
|
|
3 * For conditions of distribution and use, see copyright notice in zlib.h
|
|
4 */
|
|
5
|
|
6 /* WARNING: this file should *not* be used by applications. It is
|
|
7 part of the implementation of the compression library and is
|
|
8 subject to change. Applications should only use zlib.h.
|
|
9 */
|
|
10
|
|
11 /* Huffman code lookup table entry--this entry is four bytes for machines
|
|
12 that have 16-bit pointers (e.g. PC's in the small or medium model).
|
|
13 Valid extra bits (exop) are 0..13. exop == -64 is EOB (end of block),
|
|
14 exop == 16 means that v is a literal, exop < 0 means that v is a pointer
|
|
15 to the next table, which codes -exop bits, and lastly exop == -128
|
|
16 indicates an unused code. If a code with exop == -128 is looked up,
|
|
17 this implies an error in the data. */
|
|
18
|
|
19 #if defined(STDC) || defined(sgi)
|
|
20 typedef signed char Char;
|
|
21 #else
|
|
22 typedef char Char; /* just hope that char is signed */
|
|
23 #endif
|
|
24
|
|
25 typedef struct inflate_huft_s inflate_huft;
|
|
26 struct inflate_huft_s {
|
|
27 union {
|
|
28 struct {
|
|
29 Char Exop; /* number of extra bits or operation */
|
|
30 Byte Bits; /* number of bits in this code or subcode */
|
|
31 } what;
|
|
32 Byte *pad; /* pad structure to a power of 2 (4 bytes for */
|
|
33 } word; /* 16-bit, 8 bytes for 32-bit machines) */
|
|
34 union {
|
|
35 uInt Base; /* literal, length base, or distance base */
|
|
36 inflate_huft *Next; /* pointer to next level of table */
|
|
37 } more;
|
|
38 };
|
|
39
|
|
40 #ifdef DEBUG
|
|
41 extern uInt inflate_hufts;
|
|
42 #endif
|
|
43
|
|
44 extern int inflate_trees_bits __P((
|
|
45 uInt *, /* 19 code lengths */
|
|
46 uInt *, /* bits tree desired/actual depth */
|
|
47 inflate_huft **, /* bits tree result */
|
|
48 z_stream *)); /* for zalloc, zfree functions */
|
|
49
|
|
50 extern int inflate_trees_dynamic __P((
|
|
51 uInt, /* number of literal/length codes */
|
|
52 uInt, /* number of distance codes */
|
|
53 uInt *, /* that many (total) code lengths */
|
|
54 uInt *, /* literal desired/actual bit depth */
|
|
55 uInt *, /* distance desired/actual bit depth */
|
|
56 inflate_huft **, /* literal/length tree result */
|
|
57 inflate_huft **, /* distance tree result */
|
|
58 z_stream *)); /* for zalloc, zfree functions */
|
|
59
|
|
60 extern int inflate_trees_fixed __P((
|
|
61 uInt *, /* literal desired/actual bit depth */
|
|
62 uInt *, /* distance desired/actual bit depth */
|
|
63 inflate_huft **, /* literal/length tree result */
|
|
64 inflate_huft **)); /* distance tree result */
|
|
65
|
|
66 extern int inflate_trees_free __P((
|
|
67 inflate_huft *, /* tables to free */
|
|
68 z_stream *)); /* for zfree function */
|