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