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