00001 /* inflate9.h -- internal inflate state definition 00002 * Copyright (C) 1995-2003 Mark Adler 00003 * For conditions of distribution and use, see copyright notice in zlib.h 00004 */ 00005 00006 /* WARNING: this file should *not* be used by applications. It is 00007 part of the implementation of the compression library and is 00008 subject to change. Applications should only use zlib.h. 00009 */ 00010 00011 /* Possible inflate modes between inflate() calls */ 00012 typedef enum { 00013 TYPE, /* i: waiting for type bits, including last-flag bit */ 00014 STORED, /* i: waiting for stored size (length and complement) */ 00015 TABLE, /* i: waiting for dynamic block table lengths */ 00016 LEN, /* i: waiting for length/lit code */ 00017 DONE, /* finished check, done -- remain here until reset */ 00018 BAD /* got a data error -- remain here until reset */ 00019 } inflate_mode; 00020 00021 /* 00022 State transitions between above modes - 00023 00024 (most modes can go to the BAD mode -- not shown for clarity) 00025 00026 Read deflate blocks: 00027 TYPE -> STORED or TABLE or LEN or DONE 00028 STORED -> TYPE 00029 TABLE -> LENLENS -> CODELENS -> LEN 00030 Read deflate codes: 00031 LEN -> LEN or TYPE 00032 */ 00033 00034 /* state maintained between inflate() calls. Approximately 7K bytes. */ 00035 struct inflate_state { 00036 /* sliding window */ 00037 unsigned char FAR *window; /* allocated sliding window, if needed */ 00038 /* dynamic table building */ 00039 unsigned ncode; /* number of code length code lengths */ 00040 unsigned nlen; /* number of length code lengths */ 00041 unsigned ndist; /* number of distance code lengths */ 00042 unsigned have; /* number of code lengths in lens[] */ 00043 code FAR *next; /* next available space in codes[] */ 00044 unsigned short lens[320]; /* temporary storage for code lengths */ 00045 unsigned short work[288]; /* work area for code table building */ 00046 code codes[ENOUGH]; /* space for code tables */ 00047 };