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