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