/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1993-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* David Korn <[email protected]> *17* *18***********************************************************************/19#pragma prototyped20/*21* Header file for Huffman coding22* The coding is the same as that used with the System V pack program23*24* David Korn25* AT&T Laboratories26*/2728#ifndef _HUFFMAN_H_29#define _HUFFMAN_H_ 13031#include <ast.h>3233#define HUFFLEV 32 /* maximum number of bits per code */34#define HUFFMAG1 037 /* ascii <US> */35#define HUFFMAG2 036 /* ascii <RS> */3637typedef struct38{39char length[(1<<CHAR_BIT)+1];40unsigned char levcount[HUFFLEV+1];41Sfoff_t insize;42Sfoff_t outsize;43long buffer;44long id;45int left;46int maxlev;47int nchars;48int excess;49} Huff_t;5051Huff_t* huffinit(Sfio_t*,Sfoff_t);52Huff_t* huffgethdr(Sfio_t*);53int huffputhdr(Huff_t*,Sfio_t*);54Sfoff_t huffencode(Huff_t*,Sfio_t*,Sfio_t*,int);55Sfoff_t huffdecode(Huff_t*,Sfio_t*,Sfio_t*,int);56Sfio_t* huffdisc(Sfio_t*);5758#define huffend(hp) free((void*)(hp))59#define huffisize(hp) ((hp)->insize)60#define huffosize(hp) ((hp)->outsize)61#define huffhsize(hp) ((hp)->maxlev+(hp)->nchars+7)6263#endif /* !_HUFFMAN_H_ */646566