66 #define BDIO_BIN_GENERIC 0x00 70 #define BDIO_ASC_EXEC 0x01 74 #define BDIO_BIN_INT32BE 0x02 78 #define BDIO_BIN_INT32LE 0x03 82 #define BDIO_BIN_INT64BE 0x04 86 #define BDIO_BIN_INT64LE 0x05 90 #define BDIO_BIN_F32BE 0x06 94 #define BDIO_BIN_F32LE 0x07 98 #define BDIO_BIN_F64BE 0x08 102 #define BDIO_BIN_F64LE 0x09 106 #define BDIO_ASC_GENERIC 0x0A 110 #define BDIO_ASC_XML 0x0B 115 #define BDIO_BIN_INT32 0xF0 119 #define BDIO_BIN_INT64 0xF1 123 #define BDIO_BIN_F32 0xF2 127 #define BDIO_BIN_F64 0xF3 133 #define BDIO_R_MODE 0 137 #define BDIO_W_MODE 1 141 #define BDIO_A_MODE 2 147 #define BDIO_H_STATE 1 151 #define BDIO_R_STATE 2 155 #define BDIO_N_STATE 3 159 #define BDIO_E_STATE 4 311 BDIO *
bdio_open(
const char* file,
const char* mode,
char* protocol_info);
char * hpinfo
protocol-info | schema | generator | spec of the last header
Definition: bdio.h:221
char * bdio_get_hmuser(BDIO *fh)
Get the user name who modified the last header most recently.
Definition: bdio.c:1148
size_t bdio_write_int64(int64_t *ptr, size_t nb, BDIO *fh)
Write nb bytes from ptr to fh.
Definition: bdio.c:2000
int bdio_get_hcdate(BDIO *fh)
Get the time of creation of the last header.
Definition: bdio.c:1184
uint64_t bufstart
offset in record where the buffer starts
Definition: bdio.h:239
int bdio_get_ruinfo(BDIO *fh)
Get the user info of the current record.
Definition: bdio.c:1202
char * hchost
host of first creation of the last header
Definition: bdio.h:219
uint64_t bdio_get_rlen(BDIO *fh)
Get length of data content of current record (written or read).
Definition: bdio.c:1226
void bdio_set_dflt_verbose(int v)
Change the behavior for reporting of errors.
Definition: bdio.c:1075
int hcnt
number of headers encountered (including current)
Definition: bdio.h:204
int bdio_start_record(int fmt, int uinfo, BDIO *fh)
Position bdio stream after the current record and start writing a new record with specified format an...
Definition: bdio.c:1596
int bdio_get_hmdate(BDIO *fh)
Get the time of the most recent modification of the last header.
Definition: bdio.c:1193
int bdio_is_in_record(BDIO *fh)
Returns 1 if fh is in a record and 0 otherwise.
Definition: bdio.c:1251
int ruinfo
user info of current record
Definition: bdio.h:234
size_t bdio_read_f32(float *buf, size_t nb, BDIO *fh)
brief Read nb bytes from fh into buf. nb must be a multiple of 4.
Definition: bdio.c:1536
int bdio_seek_record(BDIO *fh)
Position bdio stream to start of next record and read its header.
Definition: bdio.c:1339
size_t bdio_write_int32(int32_t *ptr, size_t nb, BDIO *fh)
Write nb bytes from ptr to fh.
Definition: bdio.c:1981
char rswap
1/0 = records data has/has not to be byte-swapped
Definition: bdio.h:236
uint64_t ridx
offset within current record or header
Definition: bdio.h:232
int bdio_set_verbose(int v, BDIO *fh)
Set bdio file fh to verbose (v>0) or silent (v==0)
Definition: bdio.c:1085
void bdio_pferror(const char *s, BDIO *fh)
Print an error string to BDIO.msg.
Definition: bdio.c:661
char * hmuser
user of last modification of the last header
Definition: bdio.h:218
int rdsize
size of a data-item in the current record e.g int32 -> 4
Definition: bdio.h:235
int hdirinfo1
Definition: bdio.h:209
size_t bdio_write_f64(double *ptr, size_t nb, BDIO *fh)
Write nb bytes from ptr to fh.
Definition: bdio.c:1963
char * bdio_get_hmhost(BDIO *fh)
Get the host on which the last header was most recently modified.
Definition: bdio.c:1139
int bdio_get_hcnt(BDIO *fh)
Get number of headers read or written so far (including current)
Definition: bdio.c:1175
size_t bdio_read_int64(int64_t *buf, size_t nb, BDIO *fh)
brief Read nb bytes from fh into buf. nb must be a multiple of 8.
Definition: bdio.c:1581
size_t bdio_read_f64(double *buf, size_t nb, BDIO *fh)
brief Read nb bytes from fh into buf. nb must be a multiple of 8.
Definition: bdio.c:1551
void bdio_set_dflt_msg(FILE *stream)
Set the default stream for error messages.
Definition: bdio.c:1069
int nerror
number of errors that occured so far
Definition: bdio.h:199
char * hmhost
host of last modification of the last header
Definition: bdio.h:220
unsigned char * buf
Definition: bdio.h:201
char * bdio_get_hchost(BDIO *fh)
Get the host on which the last header was created.
Definition: bdio.c:1121
int state
Definition: bdio.h:183
int hmdate
date of last modification of the last header
Definition: bdio.h:216
int verbose
0: silent mode, 1: print all errors, default: 0
Definition: bdio.h:196
size_t bdio_write(void *ptr, size_t nb, BDIO *fh)
Write nb bytes from ptr to fh.
Definition: bdio.c:1754
int bdio_is_in_header(BDIO *fh)
Returns 1 if fh is in a header and 0 otherwise.
Definition: bdio.c:1263
int rcnt
number of records encountered (including current)
Definition: bdio.h:227
int bufidx
Definition: bdio.h:240
bdio file descriptor
Definition: bdio.h:181
char * hcuser
user of first creation of the last header
Definition: bdio.h:217
int bdio_get_rfmt(BDIO *fh)
Get format of current record (written or read).
Definition: bdio.c:1214
uint64_t rstart
start position of current record or header
Definition: bdio.h:226
int bdio_flush_record(BDIO *fh)
Finalize the current record and set fh to BDIO_N_STATE.
Definition: bdio.c:2020
int bdio_get_hversion(BDIO *fh)
Get version number in last header.
Definition: bdio.c:1166
size_t bdio_read_int32(int32_t *buf, size_t nb, BDIO *fh)
brief Read nb bytes from fh into buf. nb must be a multiple of 4.
Definition: bdio.c:1566
size_t bdio_read(void *buf, size_t nb, BDIO *fh)
Read nb bytes from fh into buf.
Definition: bdio.c:1489
int bdio_get_rcnt(BDIO *fh)
Get number of records read or written so far (including current)
Definition: bdio.c:1242
uint64_t rlen
Definition: bdio.h:228
int bdio_close(BDIO *fh)
Close a bdio file.
Definition: bdio.c:1014
int hmagic
magic number of the last header
Definition: bdio.h:207
FILE * msg
file pointer to file for error messages (e.g. stderr)
Definition: bdio.h:195
int rfmt
format of current record
Definition: bdio.h:233
int hssize
combined length of user/host/pinfo strings of the last header
Definition: bdio.h:222
size_t bdio_write_f32(float *ptr, size_t nb, BDIO *fh)
Write nb bytes from ptr to fh.
Definition: bdio.c:1945
void bdio_perror(const char *s, BDIO *fh)
Print an error string to BDIO.msg.
Definition: bdio.c:650
BDIO * bdio_open(const char *file, const char *mode, char *protocol_info)
Open a bdio file in mode 'r' (read), 'w' (write) or 'a' (append).
Definition: bdio.c:672
char * bdio_get_hpinfo(BDIO *fh)
Get the protocol info of the last header.
Definition: bdio.c:1157
int hversion
bdio version of the last header
Definition: bdio.h:208
char * bdio_get_hcuser(BDIO *fh)
Get the user name who created the last header.
Definition: bdio.c:1130
int bdio_set_msg(FILE *stream, BDIO *fh)
Set the stream for error messages in fh to stream.
Definition: bdio.c:1105
uint64_t hstart
starting position of last header record
Definition: bdio.h:223
int bdio_append_record(int fmt, int uinfo, BDIO *fh)
If the last item in the file was a record: position the stream at the end of it. Otherwise EOF is ret...
Definition: bdio.c:1278