ZEDA  1.6.18
Data Structures | Macros | Typedefs | Functions
zeda_binfile.h File Reference

binary data file manipulation. More...

#include <zeda/zeda_bit.h>
Include dependency graph for zeda_binfile.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _zBinFile
 

Macros

#define ZEDA_BINFILE_DEF_FREAD_PROTOTYPE(bit)   size_t fread_int##bit(FILE *fp, int##bit##_t *val)
 
#define ZEDA_BINFILE_DEF_FREAD_REV_PROTOTYPE(bit)   size_t fread_int##bit##_rev(FILE *fp, int##bit##_t *val)
 
#define ZEDA_BINFILE_DEF_FWRITE_PROTOTYPE(bit)   size_t fwrite_int##bit(FILE *fp, int##bit##_t *val)
 
#define ZEDA_BINFILE_DEF_FWRITE_REV_PROTOTYPE(bit)   size_t fwrite_int##bit##_rev(FILE *fp, int##bit##_t *val)
 
#define ZEDA_BINFILE_DEF_FREAD_TYPE_PROTOTYPE(type)   type fread_##type(FILE *fp)
 
#define ZEDA_BINFILE_DEF_FREAD_REV_TYPE_PROTOTYPE(type)   type fread_##type##_rev(FILE *fp)
 
#define ZEDA_BINFILE_DEF_FWRITE_TYPE_PROTOTYPE(type)   size_t fwrite_##type(FILE *fp, type val)
 
#define ZEDA_BINFILE_DEF_FWRITE_REV_TYPE_PROTOTYPE(type)   size_t fwrite_##type##_rev(FILE *fp, type val)
 
#define ZBINFILE_CURRENT_VERSION   0x00000001
 
#define ZBINFILE_ID   "ZBD "
 
#define ZBINFILE_ENDIAN_CHECKER   0xaabbccdd
 
#define Z_ENDIAN_LITTLE   1234
 
#define Z_ENDIAN_BIG   4321
 
#define Z_ENDIAN_UNKNOWN   9999
 
#define zBinFileIntFRead(bf)   ( (bf)->_fread_int( (bf) ) )
 
#define zBinFileIntFWrite(bf, val)   ( (bf)->_fwrite_int( (bf), (val) ) )
 
#define zBinFileLongFRead(bf)   ( (bf)->_fread_long( (bf) ) )
 
#define zBinFileLongFWrite(bf, val)   ( (bf)->_fwrite_long( (bf), (val) ) )
 

Typedefs

typedef struct _zBinFile zBinFile
 

Functions

size_t fread_int8 (FILE *fp, int8_t *val)
 
size_t fwrite_int8 (FILE *fp, int8_t *val)
 
size_t fread_int16 (FILE *fp, int16_t *val)
 
size_t fread_int16_rev (FILE *fp, int16_t *val)
 
size_t fwrite_int16 (FILE *fp, int16_t *val)
 
size_t fwrite_int16_rev (FILE *fp, int16_t *val)
 
size_t fread_int32 (FILE *fp, int32_t *val)
 
size_t fread_int32_rev (FILE *fp, int32_t *val)
 
size_t fwrite_int32 (FILE *fp, int32_t *val)
 
size_t fwrite_int32_rev (FILE *fp, int32_t *val)
 
size_t fread_int64 (FILE *fp, int64_t *val)
 
size_t fread_int64_rev (FILE *fp, int64_t *val)
 
size_t fwrite_int64 (FILE *fp, int64_t *val)
 
size_t fwrite_int64_rev (FILE *fp, int64_t *val)
 
byte fread_byte (FILE *fp)
 
size_t fwrite_byte (FILE *fp, byte val)
 
word fread_word (FILE *fp)
 
word fread_word_rev (FILE *fp)
 
size_t fwrite_word (FILE *fp, word val)
 
size_t fwrite_word_rev (FILE *fp, word val)
 
dword fread_dword (FILE *fp)
 
dword fread_dword_rev (FILE *fp)
 
size_t fwrite_dword (FILE *fp, dword val)
 
size_t fwrite_dword_rev (FILE *fp, dword val)
 
float fread_float (FILE *fp)
 
float fread_float_rev (FILE *fp)
 
size_t fwrite_float (FILE *fp, float val)
 
size_t fwrite_float_rev (FILE *fp, float val)
 
double fread_double (FILE *fp)
 
double fread_double_rev (FILE *fp)
 
size_t fwrite_double (FILE *fp, double val)
 
size_t fwrite_double_rev (FILE *fp, double val)
 
bool zBinFileOpen (zBinFile *bf, char filename[], const char *mode)
 
int zBinFileClose (zBinFile *bf)
 
byte zBinFileByteFRead (zBinFile *bf)
 
size_t zBinFileByteFWrite (zBinFile *bf, byte val)
 
bool zBinFileHeaderFRead (zBinFile *bf)
 
size_t zBinFileHeaderFWrite (zBinFile *bf)
 
void zBinFileInfoSet (zBinFile *bf, int16_t version, int16_t endian_type, int16_t size_int, int16_t size_long)
 
void zBinFileInfoSetThis (zBinFile *bf)
 
float zBinFileFloatFRead (zBinFile *bf)
 
size_t zBinFileFloatFWrite (zBinFile *bf, float val)
 
double zBinFileDoubleFRead (zBinFile *bf)
 
size_t zBinFileDoubleFWrite (zBinFile *bf, double val)
 

Detailed Description

binary data file manipulation.

Author
Zhidao

Macro Definition Documentation

◆ ZEDA_BINFILE_DEF_FREAD_PROTOTYPE

#define ZEDA_BINFILE_DEF_FREAD_PROTOTYPE (   bit)    size_t fread_int##bit(FILE *fp, int##bit##_t *val)

◆ ZEDA_BINFILE_DEF_FREAD_REV_PROTOTYPE

#define ZEDA_BINFILE_DEF_FREAD_REV_PROTOTYPE (   bit)    size_t fread_int##bit##_rev(FILE *fp, int##bit##_t *val)

◆ ZEDA_BINFILE_DEF_FWRITE_PROTOTYPE

#define ZEDA_BINFILE_DEF_FWRITE_PROTOTYPE (   bit)    size_t fwrite_int##bit(FILE *fp, int##bit##_t *val)

◆ ZEDA_BINFILE_DEF_FWRITE_REV_PROTOTYPE

#define ZEDA_BINFILE_DEF_FWRITE_REV_PROTOTYPE (   bit)    size_t fwrite_int##bit##_rev(FILE *fp, int##bit##_t *val)

◆ ZEDA_BINFILE_DEF_FREAD_TYPE_PROTOTYPE

#define ZEDA_BINFILE_DEF_FREAD_TYPE_PROTOTYPE (   type)    type fread_##type(FILE *fp)

◆ ZEDA_BINFILE_DEF_FREAD_REV_TYPE_PROTOTYPE

#define ZEDA_BINFILE_DEF_FREAD_REV_TYPE_PROTOTYPE (   type)    type fread_##type##_rev(FILE *fp)

◆ ZEDA_BINFILE_DEF_FWRITE_TYPE_PROTOTYPE

#define ZEDA_BINFILE_DEF_FWRITE_TYPE_PROTOTYPE (   type)    size_t fwrite_##type(FILE *fp, type val)

◆ ZEDA_BINFILE_DEF_FWRITE_REV_TYPE_PROTOTYPE

#define ZEDA_BINFILE_DEF_FWRITE_REV_TYPE_PROTOTYPE (   type)    size_t fwrite_##type##_rev(FILE *fp, type val)

◆ ZBINFILE_CURRENT_VERSION

#define ZBINFILE_CURRENT_VERSION   0x00000001

◆ ZBINFILE_ID

#define ZBINFILE_ID   "ZBD "

◆ ZBINFILE_ENDIAN_CHECKER

#define ZBINFILE_ENDIAN_CHECKER   0xaabbccdd

◆ Z_ENDIAN_LITTLE

#define Z_ENDIAN_LITTLE   1234

◆ Z_ENDIAN_BIG

#define Z_ENDIAN_BIG   4321

◆ Z_ENDIAN_UNKNOWN

#define Z_ENDIAN_UNKNOWN   9999

◆ zBinFileIntFRead

#define zBinFileIntFRead (   bf)    ( (bf)->_fread_int( (bf) ) )

◆ zBinFileIntFWrite

#define zBinFileIntFWrite (   bf,
  val 
)    ( (bf)->_fwrite_int( (bf), (val) ) )

◆ zBinFileLongFRead

#define zBinFileLongFRead (   bf)    ( (bf)->_fread_long( (bf) ) )

◆ zBinFileLongFWrite

#define zBinFileLongFWrite (   bf,
  val 
)    ( (bf)->_fwrite_long( (bf), (val) ) )

Typedef Documentation

◆ zBinFile

typedef struct _zBinFile zBinFile

Function Documentation

◆ fread_int8()

size_t fread_int8 ( FILE *  fp,
int8_t val 
)

◆ fwrite_int8()

size_t fwrite_int8 ( FILE *  fp,
int8_t val 
)

◆ fread_int16()

size_t fread_int16 ( FILE *  fp,
int16_t val 
)

◆ fread_int16_rev()

size_t fread_int16_rev ( FILE *  fp,
int16_t val 
)

◆ fwrite_int16()

size_t fwrite_int16 ( FILE *  fp,
int16_t val 
)

◆ fwrite_int16_rev()

size_t fwrite_int16_rev ( FILE *  fp,
int16_t val 
)

◆ fread_int32()

size_t fread_int32 ( FILE *  fp,
int32_t val 
)

◆ fread_int32_rev()

size_t fread_int32_rev ( FILE *  fp,
int32_t val 
)

◆ fwrite_int32()

size_t fwrite_int32 ( FILE *  fp,
int32_t val 
)

◆ fwrite_int32_rev()

size_t fwrite_int32_rev ( FILE *  fp,
int32_t val 
)

◆ fread_int64()

size_t fread_int64 ( FILE *  fp,
int64_t val 
)

◆ fread_int64_rev()

size_t fread_int64_rev ( FILE *  fp,
int64_t val 
)

◆ fwrite_int64()

size_t fwrite_int64 ( FILE *  fp,
int64_t val 
)

◆ fwrite_int64_rev()

size_t fwrite_int64_rev ( FILE *  fp,
int64_t val 
)

◆ fread_byte()

byte fread_byte ( FILE *  fp)

◆ fwrite_byte()

size_t fwrite_byte ( FILE *  fp,
byte  val 
)

◆ fread_word()

word fread_word ( FILE *  fp)

◆ fread_word_rev()

word fread_word_rev ( FILE *  fp)

◆ fwrite_word()

size_t fwrite_word ( FILE *  fp,
word  val 
)

◆ fwrite_word_rev()

size_t fwrite_word_rev ( FILE *  fp,
word  val 
)

◆ fread_dword()

dword fread_dword ( FILE *  fp)

◆ fread_dword_rev()

dword fread_dword_rev ( FILE *  fp)

◆ fwrite_dword()

size_t fwrite_dword ( FILE *  fp,
dword  val 
)

◆ fwrite_dword_rev()

size_t fwrite_dword_rev ( FILE *  fp,
dword  val 
)

◆ fread_float()

float fread_float ( FILE *  fp)

◆ fread_float_rev()

float fread_float_rev ( FILE *  fp)

◆ fwrite_float()

size_t fwrite_float ( FILE *  fp,
float  val 
)

◆ fwrite_float_rev()

size_t fwrite_float_rev ( FILE *  fp,
float  val 
)

◆ fread_double()

double fread_double ( FILE *  fp)

◆ fread_double_rev()

double fread_double_rev ( FILE *  fp)

◆ fwrite_double()

size_t fwrite_double ( FILE *  fp,
double  val 
)

◆ fwrite_double_rev()

size_t fwrite_double_rev ( FILE *  fp,
double  val 
)

◆ zBinFileOpen()

bool zBinFileOpen ( zBinFile bf,
char  filename[],
const char *  mode 
)

◆ zBinFileClose()

int zBinFileClose ( zBinFile bf)

◆ zBinFileByteFRead()

byte zBinFileByteFRead ( zBinFile bf)

◆ zBinFileByteFWrite()

size_t zBinFileByteFWrite ( zBinFile bf,
byte  val 
)

◆ zBinFileHeaderFRead()

bool zBinFileHeaderFRead ( zBinFile bf)

◆ zBinFileHeaderFWrite()

size_t zBinFileHeaderFWrite ( zBinFile bf)

◆ zBinFileInfoSet()

void zBinFileInfoSet ( zBinFile bf,
int16_t  version,
int16_t  endian_type,
int16_t  size_int,
int16_t  size_long 
)

◆ zBinFileInfoSetThis()

void zBinFileInfoSetThis ( zBinFile bf)

◆ zBinFileFloatFRead()

float zBinFileFloatFRead ( zBinFile bf)

◆ zBinFileFloatFWrite()

size_t zBinFileFloatFWrite ( zBinFile bf,
float  val 
)

◆ zBinFileDoubleFRead()

double zBinFileDoubleFRead ( zBinFile bf)

◆ zBinFileDoubleFWrite()

size_t zBinFileDoubleFWrite ( zBinFile bf,
double  val 
)