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