Bitfile
0.9.2
Bit stream file I/O library
|
Bit file stream library implementation. More...
Data Structures | |
struct | bit_file_t |
This is an complete definition for the type containing data needed to correctly manipulate a bit file. More... | |
struct | endian_test_t |
This is a union used when testing for endianess. More... | |
Typedefs | |
typedef int(* | num_func_t) (bit_file_t *, void *, const unsigned int, const size_t) |
This type to points to the kind of functions that put/get bits from/to numerical data types (short, int, long, ...) More... | |
Enumerations | |
enum | endian_t { BF_UNKNOWN_ENDIAN, BF_LITTLE_ENDIAN, BF_BIG_ENDIAN } |
This is an enumeration of the types of endianess handled by this library (big endian and little endian). More... | |
Functions | |
bit_file_t * | BitFileOpen (const char *fileName, const BF_MODES mode) |
This function opens a bit file for reading, writing, or appending. More... | |
bit_file_t * | MakeBitFile (FILE *stream, const BF_MODES mode) |
This function naively wraps a standard file in a bit_file_t structure. More... | |
int | BitFileClose (bit_file_t *stream) |
This function closes a bit file and frees all associated data. More... | |
FILE * | BitFileToFILE (bit_file_t *stream) |
This function flushes and frees the bitfile structure, returning a pointer to a stdio file corresponding to the bitfile. More... | |
int | BitFileByteAlign (bit_file_t *stream) |
This function aligns the bitfile to the nearest byte. More... | |
int | BitFileFlushOutput (bit_file_t *stream, const unsigned char onesFill) |
This function flushes an output bit buffer. More... | |
int | BitFileGetChar (bit_file_t *stream) |
This function returns the next byte from the file passed as a parameter. More... | |
int | BitFilePutChar (const int c, bit_file_t *stream) |
This function writes the byte passed as a parameter to the file passed a parameter. More... | |
int | BitFileGetBit (bit_file_t *stream) |
This function returns the next bit from the file passed as a parameter. More... | |
int | BitFilePutBit (const int c, bit_file_t *stream) |
This function writes the bit passed as a parameter to the file passed a parameter. More... | |
int | BitFileGetBits (bit_file_t *stream, void *bits, const unsigned int count) |
This function reads the specified number of bits from the file passed as a parameter. More... | |
int | BitFilePutBits (bit_file_t *stream, void *bits, const unsigned int count) |
This function writes the specified number of bits from the memory location passed as a parameter to the file passed as a parameter. More... | |
int | BitFileGetBitsNum (bit_file_t *stream, void *bits, const unsigned int count, const size_t size) |
This function provides a machine independent layer that allows a single function call to stuff an arbitrary number of bits into an integer type variable. More... | |
int | BitFilePutBitsNum (bit_file_t *stream, void *bits, const unsigned int count, const size_t size) |
This function provides a machine independent layer that allows a single function call to write an arbitrary number of bits from an integer type variable into a file. More... | |
Bit file stream library implementation.
This file implements a simple library of I/O functions for files that contain data in sizes that aren't integral bytes. An attempt was made to make the functions in this library analogous to functions provided to manipulate byte streams. The functions contained in this library were created with compression algorithms in mind, but may be suited to other applications.