infutil.h revision c9431fa1e59a88c2f0abf611f25b97af964449e5
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* infutil.h -- types and macros common to blocks and codes
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#ifndef _INFUTIL_H
#define _INFUTIL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
TYPE, /* get type bits (3, including end bit) */
LENS, /* get lengths for stored */
STORED, /* processing stored block */
TABLE, /* get table lengths */
BTREE, /* get bit lengths tree for a dynamic block */
DTREE, /* get length, distance trees for a dynamic block */
CODES, /* processing fixed or dynamic block */
DRY, /* output remaining window bytes */
DONE, /* finished last block, done */
BAD} /* got a data error--stuck here */
/* inflate blocks semi-private state */
struct inflate_blocks_state {
/* mode */
/* mode dependent information */
union {
struct {
} trees; /* if DTREE, decoding info for trees */
struct {
*codes;
} decode; /* if CODES, current state */
} sub; /* submode */
/* mode independent information */
};
/* update pointers and return */
/* get bytes and bits */
#define NEXTBYTE (n--,*p++)
#define DUMPBITS(j) {b>>=(j);k-=(j);}
/* output bytes */
/* load local pointers */
/* masks for lower bits (size given to avoid silly warnings with Visual C++) */
/* copy as much as possible from the sliding window to the output area */
#ifdef __cplusplus
}
#endif
#endif /* _INFUTIL_H */