Chris@4
|
1 /* inflate9.h -- internal inflate state definition
|
Chris@4
|
2 * Copyright (C) 1995-2003 Mark Adler
|
Chris@4
|
3 * For conditions of distribution and use, see copyright notice in zlib.h
|
Chris@4
|
4 */
|
Chris@4
|
5
|
Chris@4
|
6 /* WARNING: this file should *not* be used by applications. It is
|
Chris@4
|
7 part of the implementation of the compression library and is
|
Chris@4
|
8 subject to change. Applications should only use zlib.h.
|
Chris@4
|
9 */
|
Chris@4
|
10
|
Chris@4
|
11 /* Possible inflate modes between inflate() calls */
|
Chris@4
|
12 typedef enum {
|
Chris@4
|
13 TYPE, /* i: waiting for type bits, including last-flag bit */
|
Chris@4
|
14 STORED, /* i: waiting for stored size (length and complement) */
|
Chris@4
|
15 TABLE, /* i: waiting for dynamic block table lengths */
|
Chris@4
|
16 LEN, /* i: waiting for length/lit code */
|
Chris@4
|
17 DONE, /* finished check, done -- remain here until reset */
|
Chris@4
|
18 BAD /* got a data error -- remain here until reset */
|
Chris@4
|
19 } inflate_mode;
|
Chris@4
|
20
|
Chris@4
|
21 /*
|
Chris@4
|
22 State transitions between above modes -
|
Chris@4
|
23
|
Chris@4
|
24 (most modes can go to the BAD mode -- not shown for clarity)
|
Chris@4
|
25
|
Chris@4
|
26 Read deflate blocks:
|
Chris@4
|
27 TYPE -> STORED or TABLE or LEN or DONE
|
Chris@4
|
28 STORED -> TYPE
|
Chris@4
|
29 TABLE -> LENLENS -> CODELENS -> LEN
|
Chris@4
|
30 Read deflate codes:
|
Chris@4
|
31 LEN -> LEN or TYPE
|
Chris@4
|
32 */
|
Chris@4
|
33
|
Chris@4
|
34 /* state maintained between inflate() calls. Approximately 7K bytes. */
|
Chris@4
|
35 struct inflate_state {
|
Chris@4
|
36 /* sliding window */
|
Chris@4
|
37 unsigned char FAR *window; /* allocated sliding window, if needed */
|
Chris@4
|
38 /* dynamic table building */
|
Chris@4
|
39 unsigned ncode; /* number of code length code lengths */
|
Chris@4
|
40 unsigned nlen; /* number of length code lengths */
|
Chris@4
|
41 unsigned ndist; /* number of distance code lengths */
|
Chris@4
|
42 unsigned have; /* number of code lengths in lens[] */
|
Chris@4
|
43 code FAR *next; /* next available space in codes[] */
|
Chris@4
|
44 unsigned short lens[320]; /* temporary storage for code lengths */
|
Chris@4
|
45 unsigned short work[288]; /* work area for code table building */
|
Chris@4
|
46 code codes[ENOUGH]; /* space for code tables */
|
Chris@4
|
47 };
|