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