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 |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
1960
|
21 |
|
22 */ |
|
23 |
2317
|
24 #if !defined (octave_mach_info_h) |
|
25 #define octave_mach_info_h 1 |
|
26 |
|
27 #include <string> |
|
28 |
|
29 class |
|
30 oct_mach_info |
|
31 { |
2926
|
32 protected: |
|
33 |
|
34 oct_mach_info (void); |
|
35 |
2317
|
36 public: |
|
37 |
|
38 enum float_format |
|
39 { |
4574
|
40 flt_fmt_unknown, |
|
41 flt_fmt_ieee_little_endian, |
|
42 flt_fmt_ieee_big_endian, |
|
43 flt_fmt_vax_d, |
|
44 flt_fmt_vax_g, |
|
45 flt_fmt_cray |
2317
|
46 }; |
|
47 |
2926
|
48 static bool instance_ok (void); |
2317
|
49 |
|
50 static float_format native_float_format (void); |
|
51 |
|
52 static bool words_big_endian (void); |
1960
|
53 |
2317
|
54 static bool words_little_endian (void); |
|
55 |
3504
|
56 static float_format string_to_float_format (const std::string&); |
2317
|
57 |
3504
|
58 static std::string float_format_as_string (float_format); |
2317
|
59 |
|
60 private: |
|
61 |
|
62 static oct_mach_info *instance; |
|
63 |
2926
|
64 void init_float_format (void) const; |
1960
|
65 |
2926
|
66 void ten_little_endians (void) const; |
2317
|
67 |
|
68 // The floating point format for the current machine. |
2926
|
69 mutable float_format native_float_fmt; |
1960
|
70 |
2317
|
71 // TRUE if the byte order on this system is big endian. |
2926
|
72 mutable bool big_chief; |
2317
|
73 |
|
74 // No copying! |
|
75 |
|
76 oct_mach_info (const oct_mach_info&); |
|
77 |
|
78 oct_mach_info& operator = (const oct_mach_info&); |
|
79 }; |
1960
|
80 |
|
81 #endif |
|
82 |
|
83 /* |
|
84 ;;; Local Variables: *** |
|
85 ;;; mode: C++ *** |
|
86 ;;; End: *** |
|
87 */ |