1*c1cb2cd8Shaad /* inftrees.h -- header to use inftrees.c 2*c1cb2cd8Shaad * Copyright (C) 1995-2005 Mark Adler 3*c1cb2cd8Shaad * For conditions of distribution and use, see copyright notice in zlib.h 4*c1cb2cd8Shaad */ 5*c1cb2cd8Shaad 6*c1cb2cd8Shaad #pragma ident "%Z%%M% %I% %E% SMI" 7*c1cb2cd8Shaad 8*c1cb2cd8Shaad /* WARNING: this file should *not* be used by applications. It is 9*c1cb2cd8Shaad part of the implementation of the compression library and is 10*c1cb2cd8Shaad subject to change. Applications should only use zlib.h. 11*c1cb2cd8Shaad */ 12*c1cb2cd8Shaad 13*c1cb2cd8Shaad /* Structure for decoding tables. Each entry provides either the 14*c1cb2cd8Shaad information needed to do the operation requested by the code that 15*c1cb2cd8Shaad indexed that table entry, or it provides a pointer to another 16*c1cb2cd8Shaad table that indexes more bits of the code. op indicates whether 17*c1cb2cd8Shaad the entry is a pointer to another table, a literal, a length or 18*c1cb2cd8Shaad distance, an end-of-block, or an invalid code. For a table 19*c1cb2cd8Shaad pointer, the low four bits of op is the number of index bits of 20*c1cb2cd8Shaad that table. For a length or distance, the low four bits of op 21*c1cb2cd8Shaad is the number of extra bits to get after the code. bits is 22*c1cb2cd8Shaad the number of bits in this code or part of the code to drop off 23*c1cb2cd8Shaad of the bit buffer. val is the actual byte to output in the case 24*c1cb2cd8Shaad of a literal, the base length or distance, or the offset from 25*c1cb2cd8Shaad the current table to the next table. Each entry is four bytes. */ 26*c1cb2cd8Shaad typedef struct { 27*c1cb2cd8Shaad unsigned char op; /* operation, extra bits, table bits */ 28*c1cb2cd8Shaad unsigned char bits; /* bits in this part of the code */ 29*c1cb2cd8Shaad unsigned short val; /* offset in table or code value */ 30*c1cb2cd8Shaad } code; 31*c1cb2cd8Shaad 32*c1cb2cd8Shaad /* op values as set by inflate_table(): 33*c1cb2cd8Shaad 00000000 - literal 34*c1cb2cd8Shaad 0000tttt - table link, tttt != 0 is the number of table index bits 35*c1cb2cd8Shaad 0001eeee - length or distance, eeee is the number of extra bits 36*c1cb2cd8Shaad 01100000 - end of block 37*c1cb2cd8Shaad 01000000 - invalid code 38*c1cb2cd8Shaad */ 39*c1cb2cd8Shaad 40*c1cb2cd8Shaad /* Maximum size of dynamic tree. The maximum found in a long but non- 41*c1cb2cd8Shaad exhaustive search was 1444 code structures (852 for length/literals 42*c1cb2cd8Shaad and 592 for distances, the latter actually the result of an 43*c1cb2cd8Shaad exhaustive search). The true maximum is not known, but the value 44*c1cb2cd8Shaad below is more than safe. */ 45*c1cb2cd8Shaad #define ENOUGH 2048 46*c1cb2cd8Shaad #define MAXD 592 47*c1cb2cd8Shaad 48*c1cb2cd8Shaad /* Type of code to build for inftable() */ 49*c1cb2cd8Shaad typedef enum { 50*c1cb2cd8Shaad CODES, 51*c1cb2cd8Shaad LENS, 52*c1cb2cd8Shaad DISTS 53*c1cb2cd8Shaad } codetype; 54*c1cb2cd8Shaad 55*c1cb2cd8Shaad extern int inflate_table OF((codetype type, unsigned short FAR *lens, 56*c1cb2cd8Shaad unsigned codes, code FAR * FAR *table, 57*c1cb2cd8Shaad unsigned FAR *bits, unsigned short FAR *work)); 58