1960
|
1 /* |
|
2 |
|
3 Copyright (C) 1996 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_data_conv_h) |
|
24 #define octave_data_conv_h 1 |
|
25 |
|
26 #include <climits> |
|
27 |
|
28 #include "float-fmt.h" |
|
29 |
|
30 // Not all of the following are currently used. |
|
31 |
|
32 #if CHAR_BIT != 8 |
|
33 #error "CHAR_BIT is not 8!" |
|
34 #endif |
|
35 |
|
36 #if SIZEOF_SHORT == 2 |
|
37 #define TWO_BYTE_INT short |
|
38 #elif SIZEOF_INT == 2 |
|
39 #define TWO_BYTE_INT int |
|
40 #else |
|
41 #error "No 2 byte integer type found!" |
|
42 #endif |
|
43 |
|
44 #if SIZEOF_INT == 4 |
|
45 #define FOUR_BYTE_INT int |
|
46 #elif SIZEOF_LONG == 4 |
|
47 #define FOUR_BYTE_INT long |
|
48 #else |
|
49 #error "No 4 byte integer type found!" |
|
50 #endif |
|
51 |
|
52 enum save_type |
|
53 { |
|
54 LS_U_CHAR, |
|
55 LS_U_SHORT, |
|
56 LS_U_INT, |
|
57 LS_CHAR, |
|
58 LS_SHORT, |
|
59 LS_INT, |
|
60 LS_FLOAT, |
|
61 LS_DOUBLE, |
|
62 }; |
|
63 |
|
64 extern void |
|
65 do_double_format_conversion (double *data, int len, floating_point_format fmt); |
|
66 |
|
67 extern void |
|
68 do_float_format_conversion (float *data, int len, floating_point_format fmt); |
|
69 |
|
70 extern void |
|
71 read_doubles (istream& is, double *data, save_type type, int len, |
|
72 int swap, floating_point_format fmt); |
|
73 extern void |
|
74 write_doubles (ostream& os, const double *data, save_type type, int len); |
|
75 |
|
76 #endif |
|
77 |
|
78 /* |
|
79 ;;; Local Variables: *** |
|
80 ;;; mode: C++ *** |
|
81 ;;; End: *** |
|
82 */ |