binary.h 1.29 KB
Newer Older
Thomas Jahns's avatar
Thomas Jahns committed
1 2
#ifndef BINARY_H
#define BINARY_H
Uwe Schulzweida's avatar
Uwe Schulzweida committed
3

4
#ifdef HAVE_CONFIG_H
5
#include "config.h"
6 7 8
#endif

#include <inttypes.h>
Uwe Schulzweida's avatar
Uwe Schulzweida committed
9 10 11

#include "dtypes.h"

12 13 14 15 16 17 18 19 20
#ifndef HOST_ENDIANNESS
#ifdef __cplusplus
static const uint32_t HOST_ENDIANNESS_temp[1] = { UINT32_C(0x00030201) };
#define HOST_ENDIANNESS (((const unsigned char *)HOST_ENDIANNESS_temp)[0])
#else
#define HOST_ENDIANNESS (((const unsigned char *)&(const uint32_t[1]){UINT32_C(0x00030201)})[0])
#endif
#endif

Uwe Schulzweida's avatar
Uwe Schulzweida committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

UINT32 get_UINT32(unsigned char *x);
UINT32 get_SUINT32(unsigned char *x);
UINT64 get_UINT64(unsigned char *x);
UINT64 get_SUINT64(unsigned char *x);


size_t binReadF77Block(int fileID, int byteswap);
void   binWriteF77Block(int fileID, int byteswap, size_t blocksize);

int binReadInt32(int fileID, int byteswap, size_t size, INT32 *ptr);
int binReadInt64(int fileID, int byteswap, size_t size, INT64 *ptr);

int binWriteInt32(int fileID, int byteswap, size_t size, INT32 *ptr);
int binWriteInt64(int fileID, int byteswap, size_t size, INT64 *ptr);

Uwe Schulzweida's avatar
Uwe Schulzweida committed
37 38
int binWriteFlt32(int fileID, int byteswap, size_t size, FLT32 *ptr);
int binWriteFlt64(int fileID, int byteswap, size_t size, FLT64 *ptr);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
39

Thomas Jahns's avatar
Thomas Jahns committed
40
#endif  /* BINARY_H */
41 42 43 44 45 46 47 48 49
/*
 * Local Variables:
 * c-file-style: "Java"
 * c-basic-offset: 2
 * indent-tabs-mode: nil
 * show-trailing-whitespace: t
 * require-trailing-newline: t
 * End:
 */