Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/pnmimage/pnmbitio.h

Go to the documentation of this file.
00001 /*\
00002  * bitio.h - bitstream I/O
00003  *
00004  * Works for (sizeof(unsigned long)-1)*8 bits.
00005  *
00006  * Copyright (C) 1992 by David W. Sanderson.
00007  *
00008  * Permission to use, copy, modify, and distribute this software and its
00009  * documentation for any purpose and without fee is hereby granted,
00010  * provided that the above copyright notice appear in all copies and
00011  * that both that copyright notice and this permission notice appear
00012  * in supporting documentation.  This software is provided "as is"
00013  * without express or implied warranty.
00014 \*/
00015 
00016 #ifndef _BITIO_H_
00017 #define _BITIO_H_
00018 
00019 #include "pandabase.h"
00020 #include "pnmimage_base.h"
00021 
00022 typedef struct bitstream *BITSTREAM;
00023 
00024 /*
00025  * pm_bitinit() - allocate and return a BITSTREAM for the given FILE*.
00026  *
00027  * mode must be one of "r" or "w", according to whether you will be
00028  * reading from or writing to the BITSTREAM.
00029  *
00030  * Returns 0 on error.
00031  */
00032 
00033 extern EXPCL_PANDA BITSTREAM pm_bitinit(istream *f, char *mode);
00034 extern EXPCL_PANDA BITSTREAM pm_bitinit(ostream *f, char *mode);
00035 
00036 /*
00037  * pm_bitfini() - deallocate the given BITSTREAM.
00038  *
00039  * You must call this after you are done with the BITSTREAM.
00040  *
00041  * It may flush some bits left in the buffer.
00042  *
00043  * Returns the number of bytes written, -1 on error.
00044  */
00045 
00046 extern EXPCL_PANDA int pm_bitfini(BITSTREAM b);
00047 
00048 /*
00049  * pm_bitread() - read the next nbits into *val from the given file.
00050  *
00051  * Returns the number of bytes read, -1 on error.
00052  */
00053 
00054 extern EXPCL_PANDA int pm_bitread(BITSTREAM b, unsigned long nbits, unsigned long *val);
00055 
00056 /*
00057  * pm_bitwrite() - write the low nbits of val to the given file.
00058  *
00059  * The last pm_bitwrite() must be followed by a call to pm_bitflush().
00060  *
00061  * Returns the number of bytes written, -1 on error.
00062  */
00063 
00064 extern EXPCL_PANDA int pm_bitwrite(BITSTREAM b, unsigned long nbits, unsigned long val);
00065 
00066 #endif /* _BITIO_H_ */

Generated on Fri May 2 00:43:05 2003 for Panda by doxygen1.3