162306a36Sopenharmony_ci#ifndef INFTREES_H
262306a36Sopenharmony_ci#define INFTREES_H
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci/* inftrees.h -- header to use inftrees.c
562306a36Sopenharmony_ci * Copyright (C) 1995-2005 Mark Adler
662306a36Sopenharmony_ci * For conditions of distribution and use, see copyright notice in zlib.h
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/* WARNING: this file should *not* be used by applications. It is
1062306a36Sopenharmony_ci   part of the implementation of the compression library and is
1162306a36Sopenharmony_ci   subject to change. Applications should only use zlib.h.
1262306a36Sopenharmony_ci */
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/* Structure for decoding tables.  Each entry provides either the
1562306a36Sopenharmony_ci   information needed to do the operation requested by the code that
1662306a36Sopenharmony_ci   indexed that table entry, or it provides a pointer to another
1762306a36Sopenharmony_ci   table that indexes more bits of the code.  op indicates whether
1862306a36Sopenharmony_ci   the entry is a pointer to another table, a literal, a length or
1962306a36Sopenharmony_ci   distance, an end-of-block, or an invalid code.  For a table
2062306a36Sopenharmony_ci   pointer, the low four bits of op is the number of index bits of
2162306a36Sopenharmony_ci   that table.  For a length or distance, the low four bits of op
2262306a36Sopenharmony_ci   is the number of extra bits to get after the code.  bits is
2362306a36Sopenharmony_ci   the number of bits in this code or part of the code to drop off
2462306a36Sopenharmony_ci   of the bit buffer.  val is the actual byte to output in the case
2562306a36Sopenharmony_ci   of a literal, the base length or distance, or the offset from
2662306a36Sopenharmony_ci   the current table to the next table.  Each entry is four bytes. */
2762306a36Sopenharmony_citypedef struct {
2862306a36Sopenharmony_ci    unsigned char op;           /* operation, extra bits, table bits */
2962306a36Sopenharmony_ci    unsigned char bits;         /* bits in this part of the code */
3062306a36Sopenharmony_ci    unsigned short val;         /* offset in table or code value */
3162306a36Sopenharmony_ci} code;
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/* op values as set by inflate_table():
3462306a36Sopenharmony_ci    00000000 - literal
3562306a36Sopenharmony_ci    0000tttt - table link, tttt != 0 is the number of table index bits
3662306a36Sopenharmony_ci    0001eeee - length or distance, eeee is the number of extra bits
3762306a36Sopenharmony_ci    01100000 - end of block
3862306a36Sopenharmony_ci    01000000 - invalid code
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci/* Maximum size of dynamic tree.  The maximum found in a long but non-
4262306a36Sopenharmony_ci   exhaustive search was 1444 code structures (852 for length/literals
4362306a36Sopenharmony_ci   and 592 for distances, the latter actually the result of an
4462306a36Sopenharmony_ci   exhaustive search).  The true maximum is not known, but the value
4562306a36Sopenharmony_ci   below is more than safe. */
4662306a36Sopenharmony_ci#define ENOUGH 2048
4762306a36Sopenharmony_ci#define MAXD 592
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci/* Type of code to build for inftable() */
5062306a36Sopenharmony_citypedef enum {
5162306a36Sopenharmony_ci    CODES,
5262306a36Sopenharmony_ci    LENS,
5362306a36Sopenharmony_ci    DISTS
5462306a36Sopenharmony_ci} codetype;
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ciextern int zlib_inflate_table (codetype type, unsigned short *lens,
5762306a36Sopenharmony_ci                             unsigned codes, code **table,
5862306a36Sopenharmony_ci                             unsigned *bits, unsigned short *work);
5962306a36Sopenharmony_ci#endif
60