www.pudn.com > EZW_.rar > BITIO.H


#ifndef __BITIO_H_ 
#define __BITIO_H_ 
 
/*---------------------------------------------------------------------------*/ 
/*---------------------------------------------------------------------------*/ 
/* The codes are from the book "The Data Compression Book" by Mark Nelson  
 * and Jean-Loup Gailly, M&T Books 1996. 
 * 
 * I did some changes to the end of file issue, but not really successful. 
 * 
 * Mow-Song, Ng 2/9/2002 
 * msng@mmu.edu.my 
 * http://www.pesona.mmu.edu.my/~msng 
 * 
 * I do not claim copyright to the code, but if you use them or modify them, 
 * please drop me a mail. 
 *  
 */ 
/*---------------------------------------------------------------------------*/ 
/*---------------------------------------------------------------------------*/ 
 
/*----------------------------------------------------------------------------*/ 
/*----------------------------------------------------------------------------*/	 
/*  
 * $LOG 
 * ---- 
 * Last modified 28/10/2001 
 * 
 */ 
/*----------------------------------------------------------------------------*/ 
/*----------------------------------------------------------------------------*/	 
 
 
/*---------------------------------------------------------------------------*/ 
/*---------------------------------------------------------------------------*/ 
#include  
#include  
#include  
#include "memchk.h" 
 
typedef struct bit_file { 
   FILE *file; 
   unsigned char mask; 
   int rack;    
} BIT_FILE; 
 
BIT_FILE *OpenInputBitFile( char *name ); 
BIT_FILE *OpenOutputBitFile( char *name ); 
void OutputBit( BIT_FILE *bit_file, int bit ); 
void OutputBits( BIT_FILE *bit_file, 
                unsigned long code, int count ); 
int InputBit( BIT_FILE *bit_file, int *EOFflag ); 
unsigned long InputBits( BIT_FILE *bit_file, int bit_count, int *EOFflag); 
void CloseInputBitFile( BIT_FILE *bit_file ); 
void CloseOutputBitFile( BIT_FILE *bit_file ); 
void FilePrintBinary( FILE *file, unsigned int code, int bits ); 
void BitioError(char *fmt, ...); 
 
#endif