1960
|
1 /* |
|
2 |
7017
|
3 Copyright (C) 1996, 1997, 2000, 2003, 2004, 2005, 2006, 2007 |
|
4 John W. Eaton |
1960
|
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 |
7016
|
10 Free Software Foundation; either version 3 of the License, or (at your |
|
11 option) any later version. |
1960
|
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 |
7016
|
19 along with Octave; see the file COPYING. If not, see |
|
20 <http://www.gnu.org/licenses/>. |
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 |
6108
|
30 OCTAVE_API |
2317
|
31 oct_mach_info |
|
32 { |
2926
|
33 protected: |
|
34 |
|
35 oct_mach_info (void); |
|
36 |
2317
|
37 public: |
|
38 |
|
39 enum float_format |
|
40 { |
4574
|
41 flt_fmt_unknown, |
|
42 flt_fmt_ieee_little_endian, |
|
43 flt_fmt_ieee_big_endian, |
|
44 flt_fmt_vax_d, |
|
45 flt_fmt_vax_g, |
|
46 flt_fmt_cray |
2317
|
47 }; |
|
48 |
2926
|
49 static bool instance_ok (void); |
2317
|
50 |
|
51 static float_format native_float_format (void); |
|
52 |
|
53 static bool words_big_endian (void); |
1960
|
54 |
2317
|
55 static bool words_little_endian (void); |
|
56 |
3504
|
57 static float_format string_to_float_format (const std::string&); |
2317
|
58 |
3504
|
59 static std::string float_format_as_string (float_format); |
2317
|
60 |
|
61 private: |
|
62 |
|
63 static oct_mach_info *instance; |
|
64 |
2926
|
65 void init_float_format (void) const; |
1960
|
66 |
2926
|
67 void ten_little_endians (void) const; |
2317
|
68 |
|
69 // The floating point format for the current machine. |
2926
|
70 mutable float_format native_float_fmt; |
1960
|
71 |
2317
|
72 // TRUE if the byte order on this system is big endian. |
2926
|
73 mutable bool big_chief; |
2317
|
74 |
|
75 // No copying! |
|
76 |
|
77 oct_mach_info (const oct_mach_info&); |
|
78 |
|
79 oct_mach_info& operator = (const oct_mach_info&); |
|
80 }; |
1960
|
81 |
|
82 #endif |