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