#include <string.h>
#include <limits.h>
#include <fcntl.h>
#include "library_file.h"
#include "ccp4_errno.h"
#include "ccp4_file_err.h"
Functions | |
int | ccp4_file_raw_read (CCP4File *cfile, char *buffer, size_t n_items) |
int | ccp4_file_raw_write (CCP4File *cfile, const char *buffer, size_t n_items) |
int | ccp4_file_raw_seek (CCP4File *cfile, long offset, int whence) |
int | ccp4_file_is_write (const CCP4File *cfile) |
int | ccp4_file_is_read (const CCP4File *cfile) |
int | ccp4_file_is_append (const CCP4File *cfile) |
int | ccp4_file_is_scratch (const CCP4File *cfile) |
int | ccp4_file_is_buffered (const CCP4File *cfile) |
int | ccp4_file_status (const CCP4File *cfile) |
int | ccp4_file_raw_setstamp (CCP4File *cfile, const size_t offset) |
int | ccp4_file_setstamp (CCP4File *cfile, const size_t offset) |
int | ccp4_file_setmode (CCP4File *cfile, const int mode) |
int | ccp4_file_mode (const CCP4File *cfile) |
int | ccp4_file_itemsize (const CCP4File *cfile) |
const char * | ccp4_file_name (CCP4File *cfile) |
int | ccp4_file_setbyte (CCP4File *cfile, const int byte_order) |
int | ccp4_file_byte (CCP4File *cfile) |
CCP4File * | ccp4_file_open_file (const FILE *file, const int flag) |
CCP4File * | ccp4_file_open_fd (const int fd, const int flag) |
CCP4File * | ccp4_file_open (const char *filename, const int flag) |
int | ccp4_file_close (CCP4File *cfile) |
int | ccp4_file_rarch (CCP4File *cfile) |
int | ccp4_file_warch (CCP4File *cfile) |
int | ccp4_file_read (CCP4File *cfile, uint8 *buffer, size_t nitems) |
int | ccp4_file_readcomp (CCP4File *cfile, uint8 *buffer, size_t nitems) |
int | ccp4_file_readshortcomp (CCP4File *cfile, uint8 *buffer, size_t nitems) |
int | ccp4_file_readfloat (CCP4File *cfile, uint8 *buffer, size_t nitems) |
int | ccp4_file_readint (CCP4File *cfile, uint8 *buffer, size_t nitems) |
int | ccp4_file_readshort (CCP4File *cfile, uint8 *buffer, size_t nitems) |
int | ccp4_file_readchar (CCP4File *cfile, uint8 *buffer, size_t nitems) |
int | ccp4_file_write (CCP4File *cfile, const uint8 *buffer, size_t nitems) |
int | ccp4_file_writecomp (CCP4File *cfile, const uint8 *buffer, size_t nitems) |
int | ccp4_file_writeshortcomp (CCP4File *cfile, const uint8 *buffer, size_t nitems) |
int | ccp4_file_writefloat (CCP4File *cfile, const uint8 *buffer, size_t nitems) |
int | ccp4_file_writeint (CCP4File *cfile, const uint8 *buffer, size_t nitems) |
int | ccp4_file_writeshort (CCP4File *cfile, const uint8 *buffer, size_t nitems) |
int | ccp4_file_writechar (CCP4File *cfile, const uint8 *buffer, size_t nitems) |
int | ccp4_file_seek (CCP4File *cfile, long offset, int whence) |
void | ccp4_file_rewind (CCP4File *cfile) |
long | ccp4_file_length (CCP4File *cfile) |
long | ccp4_file_tell (CCP4File *cfile) |
int | ccp4_file_feof (CCP4File *cfile) |
void | ccp4_file_clearerr (CCP4File *cfile) |
void | ccp4_file_fatal (CCP4File *cfile, char *message) |
int | ccp4_file_error (CCP4File *cfile) |
void | ccp4_file_flush (CCP4File *cfile) |
char * | ccp4_file_print (CCP4File *cfile, char *msg_start, char *msg_end) |
int ccp4_file_byte | ( | CCP4File * | cfile | ) |
ccp4_file_byte:
cfile | (CCP4File *) |
void ccp4_file_clearerr | ( | CCP4File * | cfile | ) |
ccp4_file_clearerr:
cfile | (CCP4File *) |
int ccp4_file_close | ( | CCP4File * | cfile | ) |
ccp4_file_close:
cfile | (CCP4File *) |
int ccp4_file_error | ( | CCP4File * | cfile | ) |
ccp4_file_error:
cfile | (CCP4File *) |
void ccp4_file_fatal | ( | CCP4File * | cfile, | |
char * | message | |||
) |
ccp4_file_fatal:
cfile | (CCP4File *) | |
message | message to output. Die with error message based on cfile error status. |
int ccp4_file_feof | ( | CCP4File * | cfile | ) |
ccp4_file_feof:
cfile | (CCP4File *) |
void ccp4_file_flush | ( | CCP4File * | cfile | ) |
ccp4_file_flush:
cfile | (CCP4File *) |
int ccp4_file_is_append | ( | const CCP4File * | cfile | ) |
ccp4_file_is_append:
cfile | (CCP4File *) |
int ccp4_file_is_buffered | ( | const CCP4File * | cfile | ) |
ccp4_file_is_buffered:
cfile | (CCP4File *) |
int ccp4_file_is_read | ( | const CCP4File * | cfile | ) |
ccp4_file_is_read:
cfile | (CCP4File *) |
int ccp4_file_is_scratch | ( | const CCP4File * | cfile | ) |
ccp4_file_is_scratch:
cfile | (CCP4File *) |
int ccp4_file_is_write | ( | const CCP4File * | cfile | ) |
ccp4_file_is_write:
cfile | (CCP4File *) |
int ccp4_file_itemsize | ( | const CCP4File * | cfile | ) |
ccp4_file_itemsize:
cfile | (CCP4File *) |
long ccp4_file_length | ( | CCP4File * | cfile | ) |
ccp4_file_length:
cfile | (CCP4File *) |
int ccp4_file_mode | ( | const CCP4File * | cfile | ) |
ccp4_file_mode:
cfile | (CCP4File *) |
const char* ccp4_file_name | ( | CCP4File * | cfile | ) |
ccp4_file_name:
cfile | (CCP4File *) |
CCP4File* ccp4_file_open | ( | const char * | filename, | |
const int | flag | |||
) |
ccp4_file_open:
filename | (const char *) filename | |
flag | (const int) i/o mode, possible values are O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, O_TMP, O_CREAT, O_TRUNC - see ccp4_sysdep.h |
flag
. If !buffered use open(), otherwise fopen() The struct stat is check to determine if file is a regular file, if it is, and is not stdin, it is assumed to be direct access.
CCP4File* ccp4_file_open_fd | ( | const int | fd, | |
const int | flag | |||
) |
ccp4_file_open_fd:
fd | (const int) file descriptor | |
flag | (const int) io mode (O_RDONLY =0, O_WRONLY =1, O_RDWR =2, O_TMP =, O_APPEND =) |
fd
and mode flag
The struct stat is check to determine if file is a regular file, if it is, and is not stdin, it is assumed to be direct access. CCP4File* ccp4_file_open_file | ( | const FILE * | file, | |
const int | flag | |||
) |
ccp4_file_open_file:
file | (const FILE *) FILE struct | |
flag | (const int) io mode (O_RDONLY =0, O_WRONLY =1, O_RDWR =2, O_TMP =, O_APPEND =) |
flag
. The struct stat is check to determine if file is a regular file, if it is, and is not stdin, it is assumed to be direct access. char* ccp4_file_print | ( | CCP4File * | cfile, | |
char * | msg_start, | |||
char * | msg_end | |||
) |
ccp4_file_print:
cfile | (CCP4File *) | |
msg_start | pointer to start position in string | |
msg_end | pointer to end position in string |
int ccp4_file_rarch | ( | CCP4File * | cfile | ) |
ccp4_file_rarch:
cfile | (CCP4File *) |
int ccp4_file_raw_read | ( | CCP4File * | cfile, | |
char * | buffer, | |||
size_t | n_items | |||
) |
ccp4_file_raw_read:
cfile | * (CCP4File *) | |
buffer | * (char *) input array | |
n_items | (size_t) number of items |
int ccp4_file_raw_seek | ( | CCP4File * | cfile, | |
long | offset, | |||
int | whence | |||
) |
ccp4_file_raw_seek:
cfile | (CCP4File *) | |
offset | (long) offset in bytes | |
whence | (int) SEEK_SET, SEEK_CUR, or SEEK_END |
int ccp4_file_raw_setstamp | ( | CCP4File * | cfile, | |
const size_t | offset | |||
) |
Set file offset
cfile | (CCP4File *) | |
offset | stamp location |
int ccp4_file_raw_write | ( | CCP4File * | cfile, | |
const char * | buffer, | |||
size_t | n_items | |||
) |
ccp4_file_raw_write:
cfile | (CCP4File *) | |
buffer | (char *) output array | |
n_items | (size_t) number of items |
n_items
bytes from buffer to cfile via FILE struct cfile->stream(fwrite) or file desc cfile->fd(write/_write). Increments cfile->loc on success, or resets on failure, which is then used to determine the file length. On failure cfile->iostat is set. int ccp4_file_read | ( | CCP4File * | cfile, | |
uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_read:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
int ccp4_file_readchar | ( | CCP4File * | cfile, | |
uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_readchar:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
int ccp4_file_readcomp | ( | CCP4File * | cfile, | |
uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_readcomp:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
int ccp4_file_readfloat | ( | CCP4File * | cfile, | |
uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_readfloat:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
int ccp4_file_readint | ( | CCP4File * | cfile, | |
uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_readint:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
int ccp4_file_readshort | ( | CCP4File * | cfile, | |
uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_readshort:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
int ccp4_file_readshortcomp | ( | CCP4File * | cfile, | |
uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_readshortcomp:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
void ccp4_file_rewind | ( | CCP4File * | cfile | ) |
ccp4_file_rewind:
cfile | (CCP4File *) |
int ccp4_file_seek | ( | CCP4File * | cfile, | |
long | offset, | |||
int | whence | |||
) |
ccp4_file_seek:
cfile | (CCP4File *) | |
offset | (long) offset in items | |
whence | (int) SEEK_SET, SEEK_CUR, or SEEK_END |
int ccp4_file_setbyte | ( | CCP4File * | cfile, | |
const int | byte_order | |||
) |
ccp4_file_setbyte:
cfile | (CCP4File *) | |
byte_order | (int) |
int ccp4_file_setmode | ( | CCP4File * | cfile, | |
const int | mode | |||
) |
ccp4_file_setmode:
cfile | (CCP4File *) | |
mode | (int) io_mode |
int ccp4_file_setstamp | ( | CCP4File * | cfile, | |
const size_t | offset | |||
) |
ccp4_file_setstamp:
cfile | (CCP4File *) | |
offset | (size_t) offset in items |
int ccp4_file_status | ( | const CCP4File * | cfile | ) |
ccp4_file_status:
cfile | (CCP4File *) |
long ccp4_file_tell | ( | CCP4File * | cfile | ) |
ccp4_file_tell:
cfile | (CCP4File *) |
int ccp4_file_warch | ( | CCP4File * | cfile | ) |
ccp4_file_warch:
cfile | (CCP4File *) |
int ccp4_file_write | ( | CCP4File * | cfile, | |
const uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_write:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
int ccp4_file_writechar | ( | CCP4File * | cfile, | |
const uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_writechar:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
int ccp4_file_writecomp | ( | CCP4File * | cfile, | |
const uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_writecomp:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
int ccp4_file_writefloat | ( | CCP4File * | cfile, | |
const uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_writefloat:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
Returns number of floats written on success, EOF on failure
int ccp4_file_writeint | ( | CCP4File * | cfile, | |
const uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_writeint:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
int ccp4_file_writeshort | ( | CCP4File * | cfile, | |
const uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_writeshort:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |
int ccp4_file_writeshortcomp | ( | CCP4File * | cfile, | |
const uint8 * | buffer, | |||
size_t | nitems | |||
) |
ccp4_file_writeshortcomp:
cfile | (CCP4File *) | |
buffer | (uint8 *) buffer | |
nitems | (size_t) number of items |