|
Slim numerical data compression 1.0
|
The C-linkable sliblib library that wraps the underlying C++ classes. More...
#include <string.h>#include <unistd.h>#include "slimlib.h"#include "slim.h"Classes | |
| struct | slimlib_file_t |
| All important elements of the SLIMFILE. More... | |
Typedefs | |
| typedef struct slimlib_file_t | SLIMFILE |
| The external name is SLIMFILE. | |
Enumerations | |
| enum | slimlib_mode_t { SLIMLIB_READ , SLIMLIB_WRITE } |
| Select the read/write mode. More... | |
Functions | |
| SLIMFILE * | slimopen (const char *filename, const char *modes) |
| The following symbols need to be linkable from C. | |
| SLIMFILE * | slimdopen (int fd, const char *modes) |
| Associate SLIMFILE for reading or writing with an existing file descriptor But as of October 2009, writing is NOT YET IMPLEMENTED! | |
| int | slimclose (SLIMFILE *sf) |
| Close an open SLIMFILE. | |
| long | slimtell (SLIMFILE *sf) |
| Return the current position in the file (bytes from the start). | |
| size_t | slimread (void *ptr, size_t size, size_t nmemb, SLIMFILE *sf) |
| Read bytes from open SLIMFILE into a buffer. | |
| void | slimrewind (SLIMFILE *sf) |
| Rewind the current position pointer in the file to the beginning. | |
| int | slimseek (SLIMFILE *sf, long offset, int whence) |
| Seek to a point in the file (analogue of fseek, which see for meaning of offset and whence). | |
| long | slimrawsize (const char *filename) |
| Return the raw size of a compressed slim file. | |
| long | slimdrawsize (int fd) |
The C-linkable sliblib library that wraps the underlying C++ classes.
| enum slimlib_mode_t |
| int slimclose | ( | SLIMFILE * | sf | ) |
Close an open SLIMFILE.
| sf | The open SLIMFILE. |
References slimlib_file_t::compressor, slimlib_file_t::expander, and slimlib_file_t::fd.
Referenced by slimdopen(), and slimopen().
| SLIMFILE * slimdopen | ( | int | fd, |
| const char * | modes ) |
Associate SLIMFILE for reading or writing with an existing file descriptor But as of October 2009, writing is NOT YET IMPLEMENTED!
| fd | The descriptor of the open file. |
| modes | Modes codes as in fopen. Only "r" or "w" are used. At present, only "r" is allowed. Must be compatible with the mode of the file descriptor. |
This must be a duplicate because slim_expander_t will steal the fd.
References slimlib_file_t::bytes_used, slimlib_file_t::compressor, slimlib_file_t::expander, slimlib_file_t::fd, slimlib_file_t::mode, slimlib_file_t::nchan, slimlib_file_t::nframes, slimclose(), SLIMLIB_READ, SLIMLIB_WRITE, and slimlib_file_t::writing_is_underway.
| SLIMFILE * slimopen | ( | const char * | filename, |
| const char * | modes ) |
The following symbols need to be linkable from C.
Open a SLIMFILE for reading or writing. But as of October 2009, writing is NOT YET IMPLEMENTED!
| filename | The file to open. |
| modes | Modes codes as in fopen. Only "r" or "w" are used. At present, only "r" is allowed. |
References slimlib_file_t::bytes_used, slimlib_file_t::compressor, slimlib_file_t::expander, slimlib_file_t::fd, slimlib_file_t::mode, slimlib_file_t::nchan, slimlib_file_t::nframes, slimclose(), SLIMLIB_READ, SLIMLIB_WRITE, and slimlib_file_t::writing_is_underway.
| long slimrawsize | ( | const char * | filename | ) |
Return the raw size of a compressed slim file.
Must open the file and read its header.
| filename | The file to test by reading its header. |
Referenced by slimseek().
| size_t slimread | ( | void * | ptr, |
| size_t | size, | ||
| size_t | nmemb, | ||
| SLIMFILE * | sf ) |
Read bytes from open SLIMFILE into a buffer.
| ptr | Buffer to be filled by data from file. |
| size | Size of each data word (in bytes). |
| nmemb | Number of data words to read. |
| sf | Open SLIMFILE to read from. |
References slimlib_file_t::bytes_used, and slimlib_file_t::expander.
| void slimrewind | ( | SLIMFILE * | sf | ) |
Rewind the current position pointer in the file to the beginning.
Implemented by closing the file and starting again.
| sf | The open SLIMFILE. |
References slimlib_file_t::bytes_used, slimlib_file_t::expander, slimlib_file_t::fd, slimlib_file_t::mode, and SLIMLIB_READ.
Referenced by slimseek().
| int slimseek | ( | SLIMFILE * | sf, |
| long | offset, | ||
| int | whence ) |
Seek to a point in the file (analogue of fseek, which see for meaning of offset and whence).
| sf | The open SLIMFILE. |
| offset | Byte requested, relative to beginning, current point, or end. |
| whence | May be SEEK_SET, SEEK_CUR, or SEEK_END. |
References slimlib_file_t::bytes_used, slimlib_file_t::expander, slimlib_file_t::fd, slimrawsize(), slimrewind(), and slimseek().
Referenced by slimseek().
| long slimtell | ( | SLIMFILE * | sf | ) |
Return the current position in the file (bytes from the start).
| sf | The open SLIMFILE. |
References slimlib_file_t::bytes_used.