Debian Codegraph @

src/lib/inflate_tree.h

raw symbols SCIP
1 /* inflate_tree.h -- header to use inflate_tree.c
2 * Copyright (C) 1995-2008 Mark Adler
3 */
4
5 /* Structure for decoding tables. Each entry provides either the
6 information needed to do the operation requested by the code that
7 indexed that table entry, or it provides a pointer to another
8 table that indexes more bits of the code. op indicates whether
9 the entry is a pointer to another table, a literal, a length or
10 distance, an end-of-block, or an invalid code. For a table
11 pointer, the low four bits of op is the number of index bits of
12 that table. For a length or distance, the low four bits of op
13 is the number of extra bits to get after the code. bits is
14 the number of bits in this code or part of the code to drop off
15 of the bit buffer. val is the actual byte to output in the case
16 of a literal, the base length or distance, or the offset from
17 the current table to the next table. Each entry is four bytes. */
18 typedef struct {
19 unsigned char op; /* operation, extra bits, table bits */
20 unsigned char bits; /* bits in this part of the code */
21 unsigned short val; /* offset in table or code value */
22 } code;
23
24 /* op values as set by inflate_table():
25 00000000 - literal
26 0000tttt - table link, tttt != 0 is the number of table index bits
27 100eeeee - length or distance, eeee is the number of extra bits
28 01100000 - end of block
29 01000000 - invalid code
30 */
31
32 /* Maximum size of the dynamic table. The maximum number of code structures is
33 1446, which is the sum of 852 for literal/length codes and 594 for distance
34 codes. These values were found by exhaustive searches using the program
35 examples/enough.c found in the zlib distribution. The arguments to that
36 program are the number of symbols, the initial root table size, and the
37 maximum bit length of a code. "enough 286 9 15" for literal/length codes
38 returns 852, and "enough 32 6 15" for distance codes returns 594.
39 The initial root table size (9 or 6) is found in the fifth argument of the
40 inflate_table() calls in infback9.c. If the root table size is changed,
41 then these maximum sizes would be need to be recalculated and updated. */
42 #define ENOUGH_LENS 852
43 #define ENOUGH_DISTS 594
44 #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
45
46 /* Type of code to build for inflate_table9() */
47 typedef enum {
48 CODES,
49 LENS,
50 DISTS
51 } codetype;
52
53 extern int inflate_table9 OF((codetype type, unsigned short FAR *lens,
54 unsigned codes, code FAR * FAR *table,
55 unsigned FAR *bits, unsigned short FAR *work));