inftrees.h revision 131377
1153151Sjkim/* inftrees.h -- header to use inftrees.c 2181648Sjkim * Copyright (C) 1995-2003 Mark Adler 3199492Sjkim * For conditions of distribution and use, see copyright notice in zlib.h 4153151Sjkim */ 5153151Sjkim 6153151Sjkim/* WARNING: this file should *not* be used by applications. It is 7153151Sjkim part of the implementation of the compression library and is 8153151Sjkim subject to change. Applications should only use zlib.h. 9153151Sjkim */ 10153151Sjkim 11153151Sjkim/* Structure for decoding tables. Each entry provides either the 12153151Sjkim information needed to do the operation requested by the code that 13153151Sjkim indexed that table entry, or it provides a pointer to another 14153151Sjkim table that indexes more bits of the code. op indicates whether 15153151Sjkim the entry is a pointer to another table, a literal, a length or 16153151Sjkim distance, an end-of-block, or an invalid code. For a table 17153151Sjkim pointer, the low four bits of op is the number of index bits of 18153151Sjkim that table. For a length or distance, the low four bits of op 19153151Sjkim is the number of extra bits to get after the code. bits is 20153151Sjkim the number of bits in this code or part of the code to drop off 21153151Sjkim of the bit buffer. val is the actual byte to output in the case 22153151Sjkim of a literal, the base length or distance, or the offset from 23153151Sjkim the current table to the next table. Each entry is four bytes. */ 24153151Sjkimtypedef struct { 25153151Sjkim unsigned char op; /* operation, extra bits, table bits */ 26182173Sjkim unsigned char bits; /* bits in this part of the code */ 27153151Sjkim unsigned short val; /* offset in table or code value */ 28153151Sjkim} code; 29153151Sjkim 30153151Sjkim/* op values as set by inflate_table(): 31153151Sjkim 00000000 - literal 32153151Sjkim 0000tttt - table link, tttt != 0 is the number of table index bits 33153151Sjkim 0001eeee - length or distance, eeee is the number of extra bits 34153151Sjkim 01100000 - end of block 35181846Sjkim 01000000 - invalid code 36153151Sjkim */ 37153151Sjkim 38153151Sjkim/* Maximum size of dynamic tree. The maximum found in a long but non- 39153151Sjkim exhaustive search was 1004 code structures (850 for length/literals 40153151Sjkim and 154 for distances, the latter actually the result of an 41153151Sjkim exhaustive search). The true maximum is not known, but the value 42181846Sjkim below is more than safe. */ 43181846Sjkim#define ENOUGH 1440 44181846Sjkim#define MAXD 154 45199615Sjkim 46199492Sjkim/* Type of code to build for inftable() */ 47199492Sjkimtypedef enum { 48181846Sjkim CODES, 49153151Sjkim LENS, 50181846Sjkim DISTS 51181846Sjkim} codetype; 52153151Sjkim 53153151Sjkimextern int inflate_table OF((codetype type, unsigned short FAR *lens, 54153151Sjkim unsigned codes, code FAR * FAR *table, 55153151Sjkim unsigned FAR *bits, unsigned short FAR *work)); 56153151Sjkim