/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 2003-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Phong Vo <[email protected]> *17* *18***********************************************************************/19#ifndef _VCHUFF_H20#define _VCHUFF_H 12122/* Types and functions to construct a static Huffman codes.23**24** Written By Kiem-Phong Vo25*/2627/* A Huffman decoding trie is stored in Vchtrie_t.node and Vchtrie_t.size.28** size[p] > 0: a data byte has been decoded. In this case, size[p]29** is the number of bits that should be consumed to finish30** the bits corresponding to this byte. node[p] is the byte.31** size[p] < 0: need to recurse to the next level of the trie. In this32** case, -size[p] is the number of bits needed to index the33** next level. node[p] is the base of the next level.34** size[p] == 0: an undecipherable bit string. Data is likely corrupted.35*/36typedef struct _vchtrie_s37{ short* node; /* data or next trie base to look up */38short* size; /* >0: code sizes, 0: internal nodes */39short ntop; /* # of bits to index top trie level */40short trsz; /* allocated memory for the trie */41short next;42} Vchtrie_t;4344_BEGIN_EXTERNS_4546#if _BLD_vcodex && defined(__EXPORT__)47#define extern extern __EXPORT__48#endif49#if !_BLD_vcodex && defined(__IMPORT__)50#define extern extern __IMPORT__51#endif5253extern Vcmethod_t* Vchuffman; /* Huffman compression */54extern Vcmethod_t* Vchuffgroup; /* Huffman with grouping */55extern Vcmethod_t* Vchuffpart; /* Huffman with partitioning */5657#undef extern5859#if _BLD_vcodex && defined(__EXPORT__)60#define extern __EXPORT__61#endif6263extern ssize_t vchsize _ARG_((ssize_t, ssize_t*, ssize_t*, int*));64extern ssize_t vchbits _ARG_((ssize_t, ssize_t*, Vcbit_t*));65extern Vchtrie_t* vchbldtrie _ARG_((ssize_t, ssize_t*, Vcbit_t*));66extern Void_t vchdeltrie _ARG_((Vchtrie_t*));67extern ssize_t vchgetcode _ARG_((ssize_t, ssize_t*, ssize_t, Vcchar_t*, size_t));68extern ssize_t vchputcode _ARG_((ssize_t, ssize_t*, ssize_t, Vcchar_t*, size_t));69extern int vchcopy _ARG_((Vcodex_t*, ssize_t*, ssize_t*, ssize_t));7071#undef extern7273_END_EXTERNS_7475#endif /*_VCHUFF_H*/767778