1168404Spjd/* inftrees.h -- header to use inftrees.c 2168404Spjd * Copyright (C) 1995-2005 Mark Adler 3168404Spjd * For conditions of distribution and use, see copyright notice in zlib.h 4168404Spjd */ 5168404Spjd 6168404Spjd#pragma ident "%Z%%M% %I% %E% SMI" 7168404Spjd 8168404Spjd/* WARNING: this file should *not* be used by applications. It is 9168404Spjd part of the implementation of the compression library and is 10168404Spjd subject to change. Applications should only use zlib.h. 11168404Spjd */ 12168404Spjd 13168404Spjd/* Structure for decoding tables. Each entry provides either the 14168404Spjd information needed to do the operation requested by the code that 15168404Spjd indexed that table entry, or it provides a pointer to another 16168404Spjd table that indexes more bits of the code. op indicates whether 17168404Spjd the entry is a pointer to another table, a literal, a length or 18168404Spjd distance, an end-of-block, or an invalid code. For a table 19168404Spjd pointer, the low four bits of op is the number of index bits of 20168404Spjd that table. For a length or distance, the low four bits of op 21168404Spjd is the number of extra bits to get after the code. bits is 22168404Spjd the number of bits in this code or part of the code to drop off 23168404Spjd of the bit buffer. val is the actual byte to output in the case 24168404Spjd of a literal, the base length or distance, or the offset from 25168404Spjd the current table to the next table. Each entry is four bytes. */ 26168404Spjdtypedef struct { 27168404Spjd unsigned char op; /* operation, extra bits, table bits */ 28168404Spjd unsigned char bits; /* bits in this part of the code */ 29168404Spjd unsigned short val; /* offset in table or code value */ 30168404Spjd} code; 31168404Spjd 32168404Spjd/* op values as set by inflate_table(): 33168404Spjd 00000000 - literal 34168404Spjd 0000tttt - table link, tttt != 0 is the number of table index bits 35168404Spjd 0001eeee - length or distance, eeee is the number of extra bits 36168404Spjd 01100000 - end of block 37168404Spjd 01000000 - invalid code 38168404Spjd */ 39168404Spjd 40168404Spjd/* Maximum size of dynamic tree. The maximum found in a long but non- 41168404Spjd exhaustive search was 1444 code structures (852 for length/literals 42168404Spjd and 592 for distances, the latter actually the result of an 43168404Spjd exhaustive search). The true maximum is not known, but the value 44168404Spjd below is more than safe. */ 45168404Spjd#define ENOUGH 2048 46168404Spjd#define MAXD 592 47168404Spjd 48168404Spjd/* Type of code to build for inftable() */ 49168404Spjdtypedef enum { 50168404Spjd CODES, 51168404Spjd LENS, 52168404Spjd DISTS 53168404Spjd} codetype; 54168404Spjd 55168404Spjdextern int inflate_table OF((codetype type, unsigned short FAR *lens, 56168404Spjd unsigned codes, code FAR * FAR *table, 57168404Spjd unsigned FAR *bits, unsigned short FAR *work)); 58