Chris@4: /* inflate9.h -- internal inflate state definition Chris@4: * Copyright (C) 1995-2003 Mark Adler Chris@4: * For conditions of distribution and use, see copyright notice in zlib.h Chris@4: */ Chris@4: Chris@4: /* WARNING: this file should *not* be used by applications. It is Chris@4: part of the implementation of the compression library and is Chris@4: subject to change. Applications should only use zlib.h. Chris@4: */ Chris@4: Chris@4: /* Possible inflate modes between inflate() calls */ Chris@4: typedef enum { Chris@4: TYPE, /* i: waiting for type bits, including last-flag bit */ Chris@4: STORED, /* i: waiting for stored size (length and complement) */ Chris@4: TABLE, /* i: waiting for dynamic block table lengths */ Chris@4: LEN, /* i: waiting for length/lit code */ Chris@4: DONE, /* finished check, done -- remain here until reset */ Chris@4: BAD /* got a data error -- remain here until reset */ Chris@4: } inflate_mode; Chris@4: Chris@4: /* Chris@4: State transitions between above modes - Chris@4: Chris@4: (most modes can go to the BAD mode -- not shown for clarity) Chris@4: Chris@4: Read deflate blocks: Chris@4: TYPE -> STORED or TABLE or LEN or DONE Chris@4: STORED -> TYPE Chris@4: TABLE -> LENLENS -> CODELENS -> LEN Chris@4: Read deflate codes: Chris@4: LEN -> LEN or TYPE Chris@4: */ Chris@4: Chris@4: /* state maintained between inflate() calls. Approximately 7K bytes. */ Chris@4: struct inflate_state { Chris@4: /* sliding window */ Chris@4: unsigned char FAR *window; /* allocated sliding window, if needed */ Chris@4: /* dynamic table building */ Chris@4: unsigned ncode; /* number of code length code lengths */ Chris@4: unsigned nlen; /* number of length code lengths */ Chris@4: unsigned ndist; /* number of distance code lengths */ Chris@4: unsigned have; /* number of code lengths in lens[] */ Chris@4: code FAR *next; /* next available space in codes[] */ Chris@4: unsigned short lens[320]; /* temporary storage for code lengths */ Chris@4: unsigned short work[288]; /* work area for code table building */ Chris@4: code codes[ENOUGH]; /* space for code tables */ Chris@4: };