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