1960
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1960
|
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 |
2317
|
28 #include "mach-info.h" |
1960
|
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 |
2317
|
52 class |
|
53 oct_data_conv |
|
54 { |
|
55 public: |
|
56 |
|
57 enum data_type |
|
58 { |
|
59 dt_unknown, |
|
60 dt_char, |
|
61 dt_schar, |
|
62 dt_uchar, |
|
63 dt_short, |
|
64 dt_ushort, |
|
65 dt_int, |
|
66 dt_uint, |
|
67 dt_long, |
|
68 dt_ulong, |
|
69 dt_float, |
|
70 dt_double, |
|
71 dt_float_complex, |
|
72 dt_double_complex |
|
73 }; |
|
74 |
|
75 static data_type string_to_data_type (const string& s); |
|
76 }; |
|
77 |
1960
|
78 enum save_type |
|
79 { |
|
80 LS_U_CHAR, |
|
81 LS_U_SHORT, |
|
82 LS_U_INT, |
|
83 LS_CHAR, |
|
84 LS_SHORT, |
|
85 LS_INT, |
|
86 LS_FLOAT, |
2802
|
87 LS_DOUBLE |
1960
|
88 }; |
|
89 |
|
90 extern void |
2317
|
91 do_double_format_conversion (double *data, int len, |
|
92 oct_mach_info::float_format fmt); |
1960
|
93 |
|
94 extern void |
2317
|
95 do_float_format_conversion (float *data, int len, |
|
96 oct_mach_info::float_format fmt); |
1960
|
97 |
|
98 extern void |
|
99 read_doubles (istream& is, double *data, save_type type, int len, |
2317
|
100 int swap, oct_mach_info::float_format fmt); |
1960
|
101 extern void |
|
102 write_doubles (ostream& os, const double *data, save_type type, int len); |
|
103 |
|
104 #endif |
|
105 |
|
106 /* |
|
107 ;;; Local Variables: *** |
|
108 ;;; mode: C++ *** |
|
109 ;;; End: *** |
|
110 */ |