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