/[eiffelstudio]/FreeELKS/trunk/library/kernel/platform.e
ViewVC logotype

Contents of /FreeELKS/trunk/library/kernel/platform.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91464 - (show annotations)
Sat Feb 18 15:02:35 2006 UTC (13 years, 11 months ago) by ericb
File size: 4675 byte(s)
Synchronized with ISE 5.7.0414.
Made built-in features explicit.
Implemented `is_little_endian' in pure Eiffel.

1 indexing
2 description: "Platform-dependent properties."
3 library: "Free implementation of ELKS library"
4 copyright: "Copyright (c) 1986-2006, Eiffel Software and others"
5 license: "Eiffel Forum License v2 (see forum.txt)"
6 date: "$Date$"
7 revision: "$Revision$"
8
9 class PLATFORM
10
11 feature -- Platform
12
13 is_dotnet: BOOLEAN is
14 -- Are we targetting .NET?
15 external
16 "built_in"
17 end
18
19 is_windows: BOOLEAN is
20 -- Are we running on Windows platform?
21 external
22 "built_in"
23 end
24
25 is_unix: BOOLEAN is
26 -- Are we running on a Unix like platform?
27 external
28 "built_in"
29 end
30
31 is_vms: BOOLEAN is
32 -- Are we running on VMS?
33 external
34 "built_in"
35 end
36
37 is_little_endian: BOOLEAN is
38 -- Is current platform a little endian one?
39 local
40 l_pointer: MANAGED_POINTER
41 l_int16: INTEGER_16
42 once
43 l_int16 := 1
44 create l_pointer.make (2)
45 l_pointer.put_integer_16 (l_int16, 0)
46 Result := l_pointer.read_integer_16_le (0) = l_int16
47 end
48
49 feature -- Access bytes size
50
51 boolean_bytes: INTEGER is
52 -- Number of bytes in a value of type `BOOLEAN'
53 external
54 "built_in"
55 end
56
57 character_bytes: INTEGER is
58 -- Number of bytes in a value of type `CHARACTER'
59 external
60 "built_in"
61 end
62
63 wide_character_bytes: INTEGER is 4
64 -- Number of bytes in a value of type `WIDE_CHARACTER'
65
66 natural_8_bytes: INTEGER is 1
67 -- Number of bytes in a value of type `INTEGER_8'
68
69 natural_16_bytes: INTEGER is 2
70 -- Number of bytes in a value of type `INTEGER_16'
71
72 natural_32_bytes: INTEGER is 4
73 -- Number of bytes in a value of type `INTEGER'
74
75 natural_64_bytes: INTEGER is 8
76 -- Number of bytes in a value of type `INTEGER_64'
77
78 integer_bytes: INTEGER is
79 -- Number of bytes in a value of type `INTEGER'
80 external
81 "built_in"
82 end
83
84 integer_8_bytes: INTEGER is 1
85 -- Number of bytes in a value of type `INTEGER_8'
86
87 integer_16_bytes: INTEGER is 2
88 -- Number of bytes in a value of type `INTEGER_16'
89
90 integer_32_bytes: INTEGER is 4
91 -- Number of bytes in a value of type `INTEGER_32'
92
93 integer_64_bytes: INTEGER is 8
94 -- Number of bytes in a value of type `INTEGER_64'
95
96 real_bytes: INTEGER is
97 -- Number of bytes in a value of type `REAL'
98 external
99 "built_in"
100 end
101
102 real_32_bytes: INTEGER is 4
103 -- Number of bytes in a value of type `REAL_32'
104
105 real_64_bytes, double_bytes: INTEGER is 8
106 -- Number of bytes in a value of type `REAL_64'
107
108 pointer_bytes: INTEGER is
109 -- Number of bytes in a value of type `POINTER'
110 external
111 "built_in"
112 end
113
114 feature -- Access bits size
115
116 boolean_bits: INTEGER is
117 -- Number of bits in a value of type `BOOLEAN'
118 once
119 Result := boolean_bytes * 8
120 end
121
122 character_bits: INTEGER is
123 -- Number of bits in a value of type `CHARACTER'
124 once
125 Result := character_bytes * 8
126 end
127
128 natural_8_bits: INTEGER is 8
129 -- Number of bits in a value of type `NATURAL_8'
130
131 natural_16_bits: INTEGER is 16
132 -- Number of bits in a value of type `NATURAL_16'
133
134 natural_32_bits: INTEGER is 32
135 -- Number of bits in a value of type `NATURAL_32'
136
137 natural_64_bits: INTEGER is 64
138 -- Number of bits in a value of type `NATURAL_64'
139
140 integer_bits: INTEGER is
141 -- Number of bits in a value of type `INTEGER'
142 once
143 Result := integer_bytes * 8
144 end
145
146 integer_8_bits: INTEGER is 8
147 -- Number of bits in a value of type `INTEGER_8'
148
149 integer_16_bits: INTEGER is 16
150 -- Number of bits in a value of type `INTEGER_16'
151
152 integer_32_bits: INTEGER is 32
153 -- Number of bits in a value of type `INTEGER_32'
154
155 integer_64_bits: INTEGER is 64
156 -- Number of bits in a value of type `INTEGER_64'
157
158 real_bits: INTEGER is
159 -- Number of bits in a value of type `REAL'
160 once
161 Result := real_bytes * 8
162 end
163
164 real_32_bits: INTEGER is 32
165 -- Number of bits in a value of type `REAL_32'
166
167 real_64_bits, double_bits: INTEGER is 64
168 -- Number of bits in a value of type `REAL_64'
169
170 pointer_bits: INTEGER is
171 -- Number of bits in a value of type `POINTER'
172 once
173 Result := pointer_bytes * 8
174 end
175
176 feature -- Access min max values
177
178 maximum_character_code: INTEGER is
179 -- Largest supported code for CHARACTER values
180 do
181 Result := {CHARACTER}.max_value
182 ensure
183 meaningful: Result >= 127
184 end
185
186 maximum_integer: INTEGER is
187 -- Largest supported value of type INTEGER.
188 do
189 Result := {INTEGER}.max_value
190 ensure
191 meaningful: Result >= 0
192 end
193
194 minimum_character_code: INTEGER is
195 -- Smallest supported code for CHARACTER values
196 do
197 Result := {CHARACTER}.min_value
198 ensure
199 meaningful: Result <= 0
200 end
201
202 minimum_integer: INTEGER is
203 -- Smallest supported value of type INTEGER
204 do
205 Result := {INTEGER}.min_value
206 ensure
207 meaningful: Result <= 0
208 end
209
210 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23