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