Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* Vis5D version 5.1 */
/*
Vis5D system for visualizing five dimensional gridded data sets
Copyright (C) 1990 - 1997 Bill Hibbard, Brian Paul, Dave Santek,
and Andre Battaiola.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Functions to do binary I/O of floats, ints, etc. with byte swapping
* as needed.
*/
#ifndef BINIO_H
#define BINIO_H
/* Include files which define SEEK_SET, O_RD_ONLY, etc. */
/* and prototype open(), close(), lseek(), etc. */
#include <unistd.h>
#include <fcntl.h>
extern void flip4( const unsigned int *src, unsigned int *dest, int n );
extern void flip2( const unsigned short *src, unsigned short *dest, int n );
/* Modif pour prendre en compte la FUJI avec des entiers 32 bits
et des reels 64 bits. Or on a :
sizeof(int) = 4
sizeof(long) = 4
sizeof(long long) = 8
sizeof(float) = 4
sizeof(double) = 8
*/
#ifdef _CRAY
extern void cray_to_ieee_array( long *dest, const float *source, int n );
extern void ieee_to_cray_array( float *dest, const long *source, int n );
#endif
/**********************************************************************/
/***** Read Functions *****/
/**********************************************************************/
extern int read_bytes( int f, void *b, int n );
extern int read_int2_array( int f, short *iarray, int n );
extern int read_uint2_array( int f, unsigned short *iarray, int n );
extern int read_int4( int f, int *i );
extern int read_int4_array( int f, int *iarray, int n );
extern int read_float4( int f, float *x );
extern int read_float4_array( int f, float *x, int n );
extern int read_block( int f, void *data, int elements, int elsize );
/**********************************************************************/
/***** Write Functions *****/
/**********************************************************************/
extern int write_bytes( int f, const void *b, int n );
extern int write_int2_array( int f, const short *iarray, int n );
extern int write_uint2_array( int f, const unsigned short *iarray, int n );
extern int write_int4( int f, int i );
extern int write_int4_array( int f, const int *iarray, int n );
extern int write_float4( int f, float x );
extern int write_float4_array( int f, const float *x, int n );
extern int write_block( int f, const void *data, int elements, int elsize );
#endif