/[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 91477 - (show annotations)
Sun Jan 14 09:47:13 2007 UTC (13 years ago) by ericb
File size: 4800 byte(s)
Synchronized with ISE 6.0.65740
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_thread_capable: BOOLEAN is
14 -- Is current platform capable of multi-threading?
15 external
16 "built_in"
17 end
18
19 is_dotnet: BOOLEAN is
20 -- Are we targetting .NET?
21 external
22 "built_in"
23 end
24
25 is_windows: BOOLEAN is
26 -- Are we running on Windows platform?
27 external
28 "built_in"
29 end
30
31 is_unix: BOOLEAN is
32 -- Are we running on a Unix like platform?
33 external
34 "built_in"
35 end
36
37 is_vms: BOOLEAN is
38 -- Are we running on VMS?
39 external
40 "built_in"
41 end
42
43 is_little_endian: BOOLEAN is
44 -- Is current platform a little endian one?
45 local
46 l_nat16: NATURAL_16
47 l_nat8: NATURAL_8
48 l_first: NATURAL_8
49 once
50 l_nat16 := 0x4321
51 l_nat8 := 0x21
52 ($l_first).memory_copy ($l_nat16, 1)
53 Result := l_first = l_nat8
54 end
55
56 feature -- Access bytes size
57
58 boolean_bytes: INTEGER is
59 -- Number of bytes in a value of type `BOOLEAN'
60 external
61 "built_in"
62 end
63
64 character_bytes: INTEGER is
65 -- Number of bytes in a value of type `CHARACTER'
66 external
67 "built_in"
68 end
69
70 wide_character_bytes: INTEGER is
71 -- Number of bytes in a value of type `WIDE_CHARACTER'
72 external
73 "built_in"
74 end
75
76 natural_8_bytes: INTEGER is 1
77 -- Number of bytes in a value of type `INTEGER_8'
78
79 natural_16_bytes: INTEGER is 2
80 -- Number of bytes in a value of type `INTEGER_16'
81
82 natural_32_bytes: INTEGER is 4
83 -- Number of bytes in a value of type `INTEGER'
84
85 natural_64_bytes: INTEGER is 8
86 -- Number of bytes in a value of type `INTEGER_64'
87
88 integer_bytes: INTEGER is
89 -- Number of bytes in a value of type `INTEGER'
90 external
91 "built_in"
92 end
93
94 integer_8_bytes: INTEGER is 1
95 -- Number of bytes in a value of type `INTEGER_8'
96
97 integer_16_bytes: INTEGER is 2
98 -- Number of bytes in a value of type `INTEGER_16'
99
100 integer_32_bytes: INTEGER is 4
101 -- Number of bytes in a value of type `INTEGER_32'
102
103 integer_64_bytes: INTEGER is 8
104 -- Number of bytes in a value of type `INTEGER_64'
105
106 real_bytes: INTEGER is
107 -- Number of bytes in a value of type `REAL'
108 external
109 "built_in"
110 end
111
112 real_32_bytes: INTEGER is 4
113 -- Number of bytes in a value of type `REAL_32'
114
115 real_64_bytes, double_bytes: INTEGER is 8
116 -- Number of bytes in a value of type `REAL_64'
117
118 pointer_bytes: INTEGER is
119 -- Number of bytes in a value of type `POINTER'
120 external
121 "built_in"
122 end
123
124 feature -- Access bits size
125
126 boolean_bits: INTEGER is
127 -- Number of bits in a value of type `BOOLEAN'
128 once
129 Result := boolean_bytes * 8
130 end
131
132 character_bits: INTEGER is
133 -- Number of bits in a value of type `CHARACTER'
134 once
135 Result := character_bytes * 8
136 end
137
138 natural_8_bits: INTEGER is 8
139 -- Number of bits in a value of type `NATURAL_8'
140
141 natural_16_bits: INTEGER is 16
142 -- Number of bits in a value of type `NATURAL_16'
143
144 natural_32_bits: INTEGER is 32
145 -- Number of bits in a value of type `NATURAL_32'
146
147 natural_64_bits: INTEGER is 64
148 -- Number of bits in a value of type `NATURAL_64'
149
150 integer_bits: INTEGER is
151 -- Number of bits in a value of type `INTEGER'
152 once
153 Result := integer_bytes * 8
154 end
155
156 integer_8_bits: INTEGER is 8
157 -- Number of bits in a value of type `INTEGER_8'
158
159 integer_16_bits: INTEGER is 16
160 -- Number of bits in a value of type `INTEGER_16'
161
162 integer_32_bits: INTEGER is 32
163 -- Number of bits in a value of type `INTEGER_32'
164
165 integer_64_bits: INTEGER is 64
166 -- Number of bits in a value of type `INTEGER_64'
167
168 real_bits: INTEGER is
169 -- Number of bits in a value of type `REAL'
170 once
171 Result := real_bytes * 8
172 end
173
174 real_32_bits: INTEGER is 32
175 -- Number of bits in a value of type `REAL_32'
176
177 real_64_bits, double_bits: INTEGER is 64
178 -- Number of bits in a value of type `REAL_64'
179
180 pointer_bits: INTEGER is
181 -- Number of bits in a value of type `POINTER'
182 once
183 Result := pointer_bytes * 8
184 end
185
186 feature -- Access min max values
187
188 maximum_character_code: INTEGER is
189 -- Largest supported code for CHARACTER values
190 do
191 Result := {CHARACTER}.max_value
192 ensure
193 meaningful: Result >= 127
194 end
195
196 maximum_integer: INTEGER is
197 -- Largest supported value of type INTEGER.
198 do
199 Result := {INTEGER}.max_value
200 ensure
201 meaningful: Result >= 0
202 end
203
204 minimum_character_code: INTEGER is
205 -- Smallest supported code for CHARACTER values
206 do
207 Result := {CHARACTER}.min_value
208 ensure
209 meaningful: Result <= 0
210 end
211
212 minimum_integer: INTEGER is
213 -- Smallest supported value of type INTEGER
214 do
215 Result := {INTEGER}.min_value
216 ensure
217 meaningful: Result <= 0
218 end
219
220 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23