2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / ada / stand.ads
blob62d5ee5f925f12296a8bd8fe8f4b9d5a68f4c62e
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S T A N D --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 -- This package contains the declarations of entities in package Standard,
35 -- These values are initialized either by calling CStand.Create_Standard,
36 -- or by calling Stand.Tree_Read.
38 with Types; use Types;
40 -- Do we really need the with of Namet?
42 pragma Warnings (Off);
43 with Namet; use Namet;
44 pragma Elaborate_All (Namet);
45 pragma Warnings (On);
47 package Stand is
49 type Standard_Entity_Type is (
50 -- This enumeration type contains an entry for each name in Standard
52 -- Package names
54 S_Standard,
55 S_ASCII,
57 -- Types and subtypes defined in package Standard (in the order in which
58 -- they appear in the RM, so that the declarations are in the right
59 -- order for the purposes of ASIS traversals
61 S_Boolean,
63 S_Short_Short_Integer,
64 S_Short_Integer,
65 S_Integer,
66 S_Long_Integer,
67 S_Long_Long_Integer,
69 S_Natural,
70 S_Positive,
72 S_Short_Float,
73 S_Float,
74 S_Long_Float,
75 S_Long_Long_Float,
77 S_Character,
78 S_Wide_Character,
79 S_Wide_Wide_Character,
81 S_String,
82 S_Wide_String,
83 S_Wide_Wide_String,
85 S_Duration,
87 -- Enumeration literals for type Boolean
89 S_False,
90 S_True,
92 -- Exceptions declared in package Standard
94 S_Constraint_Error,
95 S_Numeric_Error,
96 S_Program_Error,
97 S_Storage_Error,
98 S_Tasking_Error,
100 -- Binary Operators declared in package Standard
102 S_Op_Add,
103 S_Op_And,
104 S_Op_Concat,
105 S_Op_Concatw,
106 S_Op_Concatww,
107 S_Op_Divide,
108 S_Op_Eq,
109 S_Op_Expon,
110 S_Op_Ge,
111 S_Op_Gt,
112 S_Op_Le,
113 S_Op_Lt,
114 S_Op_Mod,
115 S_Op_Multiply,
116 S_Op_Ne,
117 S_Op_Or,
118 S_Op_Rem,
119 S_Op_Subtract,
120 S_Op_Xor,
122 -- Unary operators declared in package Standard
124 S_Op_Abs,
125 S_Op_Minus,
126 S_Op_Not,
127 S_Op_Plus,
129 -- Constants defined in package ASCII (with value in hex).
130 -- First the thirty-two C0 control characters)
132 S_NUL, -- 16#00#
133 S_SOH, -- 16#01#
134 S_STX, -- 16#02#
135 S_ETX, -- 16#03#
136 S_EOT, -- 16#04#
137 S_ENQ, -- 16#05#
138 S_ACK, -- 16#06#
139 S_BEL, -- 16#07#
140 S_BS, -- 16#08#
141 S_HT, -- 16#09#
142 S_LF, -- 16#0A#
143 S_VT, -- 16#0B#
144 S_FF, -- 16#0C#
145 S_CR, -- 16#0D#
146 S_SO, -- 16#0E#
147 S_SI, -- 16#0F#
148 S_DLE, -- 16#10#
149 S_DC1, -- 16#11#
150 S_DC2, -- 16#12#
151 S_DC3, -- 16#13#
152 S_DC4, -- 16#14#
153 S_NAK, -- 16#15#
154 S_SYN, -- 16#16#
155 S_ETB, -- 16#17#
156 S_CAN, -- 16#18#
157 S_EM, -- 16#19#
158 S_SUB, -- 16#1A#
159 S_ESC, -- 16#1B#
160 S_FS, -- 16#1C#
161 S_GS, -- 16#1D#
162 S_RS, -- 16#1E#
163 S_US, -- 16#1F#
165 -- Here are the ones for Colonel Whitaker's O26 keypunch!
167 S_Exclam, -- 16#21#
168 S_Quotation, -- 16#22#
169 S_Sharp, -- 16#23#
170 S_Dollar, -- 16#24#
171 S_Percent, -- 16#25#
172 S_Ampersand, -- 16#26#
174 S_Colon, -- 16#3A#
175 S_Semicolon, -- 16#3B#
177 S_Query, -- 16#3F#
178 S_At_Sign, -- 16#40#
180 S_L_Bracket, -- 16#5B#
181 S_Back_Slash, -- 16#5C#
182 S_R_Bracket, -- 16#5D#
183 S_Circumflex, -- 16#5E#
184 S_Underline, -- 16#5F#
185 S_Grave, -- 16#60#
187 S_LC_A, -- 16#61#
188 S_LC_B, -- 16#62#
189 S_LC_C, -- 16#63#
190 S_LC_D, -- 16#64#
191 S_LC_E, -- 16#65#
192 S_LC_F, -- 16#66#
193 S_LC_G, -- 16#67#
194 S_LC_H, -- 16#68#
195 S_LC_I, -- 16#69#
196 S_LC_J, -- 16#6A#
197 S_LC_K, -- 16#6B#
198 S_LC_L, -- 16#6C#
199 S_LC_M, -- 16#6D#
200 S_LC_N, -- 16#6E#
201 S_LC_O, -- 16#6F#
202 S_LC_P, -- 16#70#
203 S_LC_Q, -- 16#71#
204 S_LC_R, -- 16#72#
205 S_LC_S, -- 16#73#
206 S_LC_T, -- 16#74#
207 S_LC_U, -- 16#75#
208 S_LC_V, -- 16#76#
209 S_LC_W, -- 16#77#
210 S_LC_X, -- 16#78#
211 S_LC_Y, -- 16#79#
212 S_LC_Z, -- 16#7A#
214 S_L_BRACE, -- 16#7B#
215 S_BAR, -- 16#7C#
216 S_R_BRACE, -- 16#7D#
217 S_TILDE, -- 16#7E#
219 -- And one more control character, all on its own
221 S_DEL); -- 16#7F#
223 subtype S_Types is
224 Standard_Entity_Type range S_Boolean .. S_Duration;
226 subtype S_Exceptions is
227 Standard_Entity_Type range S_Constraint_Error .. S_Tasking_Error;
229 subtype S_ASCII_Names is
230 Standard_Entity_Type range S_NUL .. S_DEL;
232 subtype S_Binary_Ops is
233 Standard_Entity_Type range S_Op_Add .. S_Op_Xor;
235 subtype S_Unary_Ops is
236 Standard_Entity_Type range S_Op_Abs .. S_Op_Plus;
238 type Standard_Entity_Array_Type is array (Standard_Entity_Type) of Node_Id;
240 Standard_Entity : Standard_Entity_Array_Type;
241 -- This array contains pointers to the Defining Identifier nodes
242 -- for each of the entities defined in Standard_Entities_Type. It
243 -- is initialized by the Create_Standard procedure.
245 Standard_Package_Node : Node_Id;
246 -- Points to the N_Package_Declaration node for standard. Also
247 -- initialized by the Create_Standard procedure.
249 -- The following Entities are the pointers to the Defining Identifier
250 -- nodes for some visible entities defined in Standard_Entities_Type.
252 SE : Standard_Entity_Array_Type renames Standard_Entity;
254 Standard_Standard : Entity_Id renames SE (S_Standard);
256 Standard_ASCII : Entity_Id renames SE (S_ASCII);
257 Standard_Character : Entity_Id renames SE (S_Character);
258 Standard_Wide_Character : Entity_Id renames SE (S_Wide_Character);
259 Standard_Wide_Wide_Character : Entity_Id renames SE (S_Wide_Wide_Character);
260 Standard_String : Entity_Id renames SE (S_String);
261 Standard_Wide_String : Entity_Id renames SE (S_Wide_String);
262 Standard_Wide_Wide_String : Entity_Id renames SE (S_Wide_Wide_String);
264 Standard_Boolean : Entity_Id renames SE (S_Boolean);
265 Standard_False : Entity_Id renames SE (S_False);
266 Standard_True : Entity_Id renames SE (S_True);
268 Standard_Duration : Entity_Id renames SE (S_Duration);
270 Standard_Natural : Entity_Id renames SE (S_Natural);
271 Standard_Positive : Entity_Id renames SE (S_Positive);
273 Standard_Constraint_Error : Entity_Id renames SE (S_Constraint_Error);
274 Standard_Numeric_Error : Entity_Id renames SE (S_Numeric_Error);
275 Standard_Program_Error : Entity_Id renames SE (S_Program_Error);
276 Standard_Storage_Error : Entity_Id renames SE (S_Storage_Error);
277 Standard_Tasking_Error : Entity_Id renames SE (S_Tasking_Error);
279 Standard_Short_Float : Entity_Id renames SE (S_Short_Float);
280 Standard_Float : Entity_Id renames SE (S_Float);
281 Standard_Long_Float : Entity_Id renames SE (S_Long_Float);
282 Standard_Long_Long_Float : Entity_Id renames SE (S_Long_Long_Float);
284 Standard_Short_Short_Integer : Entity_Id renames SE (S_Short_Short_Integer);
285 Standard_Short_Integer : Entity_Id renames SE (S_Short_Integer);
286 Standard_Integer : Entity_Id renames SE (S_Integer);
287 Standard_Long_Integer : Entity_Id renames SE (S_Long_Integer);
288 Standard_Long_Long_Integer : Entity_Id renames SE (S_Long_Long_Integer);
290 Standard_Op_Add : Entity_Id renames SE (S_Op_Add);
291 Standard_Op_And : Entity_Id renames SE (S_Op_And);
292 Standard_Op_Concat : Entity_Id renames SE (S_Op_Concat);
293 Standard_Op_Concatw : Entity_Id renames SE (S_Op_Concatw);
294 Standard_Op_Concatww : Entity_Id renames SE (S_Op_Concatww);
295 Standard_Op_Divide : Entity_Id renames SE (S_Op_Divide);
296 Standard_Op_Eq : Entity_Id renames SE (S_Op_Eq);
297 Standard_Op_Expon : Entity_Id renames SE (S_Op_Expon);
298 Standard_Op_Ge : Entity_Id renames SE (S_Op_Ge);
299 Standard_Op_Gt : Entity_Id renames SE (S_Op_Gt);
300 Standard_Op_Le : Entity_Id renames SE (S_Op_Le);
301 Standard_Op_Lt : Entity_Id renames SE (S_Op_Lt);
302 Standard_Op_Mod : Entity_Id renames SE (S_Op_Mod);
303 Standard_Op_Multiply : Entity_Id renames SE (S_Op_Multiply);
304 Standard_Op_Ne : Entity_Id renames SE (S_Op_Ne);
305 Standard_Op_Or : Entity_Id renames SE (S_Op_Or);
306 Standard_Op_Rem : Entity_Id renames SE (S_Op_Rem);
307 Standard_Op_Subtract : Entity_Id renames SE (S_Op_Subtract);
308 Standard_Op_Xor : Entity_Id renames SE (S_Op_Xor);
310 Standard_Op_Abs : Entity_Id renames SE (S_Op_Abs);
311 Standard_Op_Minus : Entity_Id renames SE (S_Op_Minus);
312 Standard_Op_Not : Entity_Id renames SE (S_Op_Not);
313 Standard_Op_Plus : Entity_Id renames SE (S_Op_Plus);
315 Last_Standard_Node_Id : Node_Id;
316 -- Highest Node_Id value used by Standard
318 Last_Standard_List_Id : List_Id;
319 -- Highest List_Id value used by Standard (including those used by
320 -- normal list headers, element list headers, and list elements)
322 Boolean_Literals : array (Boolean) of Entity_Id;
323 -- Entities for the two boolean literals, used by the expander
325 -------------------------------------
326 -- Semantic Phase Special Entities --
327 -------------------------------------
329 -- The semantic phase needs a number of entities for internal processing
330 -- that are logically at the level of Standard, and hence defined in this
331 -- package. However, they are never visible to a program, and are not
332 -- chained on to the Decls list of Standard. The names of all these
333 -- types are relevant only in certain debugging and error message
334 -- situations. They have names that are suitable for use in such
335 -- error messages (see body for actual names used).
337 Standard_Void_Type : Entity_Id;
338 -- This is a type used to represent the return type of procedures
340 Standard_Exception_Type : Entity_Id;
341 -- This is a type used to represent the Etype of exceptions
343 Standard_A_String : Entity_Id;
344 -- An access to String type used for building elements of tables
345 -- carrying the enumeration literal names.
347 Standard_A_Char : Entity_Id;
348 -- Access to character, used as a component of the exception type to
349 -- denote a thin pointer component.
351 Standard_Debug_Renaming_Type : Entity_Id;
352 -- A zero-size subtype of Integer, used as the type of variables used
353 -- to provide the debugger with name encodings for renaming declarations.
355 -- The entities labeled Any_xxx are used in situations where the full
356 -- characteristics of an entity are not yet known, e.g. Any_Character
357 -- is used to label a character literal before resolution is complete.
358 -- These entities are also used to construct appropriate references in
359 -- error messages ("expecting an integer type").
361 Any_Id : Entity_Id;
362 -- Used to represent some unknown identifier. Used to label undefined
363 -- identifier references to prevent cascaded errors.
365 Any_Type : Entity_Id;
366 -- Used to represent some unknown type. Plays an important role in
367 -- avoiding cascaded errors, since any node that remains labeled with
368 -- this type corresponds to an already issued error message. Any_Type
369 -- is propagated to avoid cascaded errors from a single type error.
371 Any_Access : Entity_Id;
372 -- Used to resolve the overloaded literal NULL
374 Any_Array : Entity_Id;
375 -- Used to represent some unknown array type
377 Any_Boolean : Entity_Id;
378 -- The context type of conditions in IF and WHILE statements
380 Any_Character : Entity_Id;
381 -- Any_Character is used to label character literals, which in general
382 -- will not have an explicit declaration (this is true of the predefined
383 -- character types).
385 Any_Composite : Entity_Id;
386 -- The type Any_Composite is used for aggregates before type resolution.
387 -- It is compatible with any array or non-limited record type.
389 Any_Discrete : Entity_Id;
390 -- Used to represent some unknown discrete type
392 Any_Fixed : Entity_Id;
393 -- Used to represent some unknown fixed-point type
395 Any_Integer : Entity_Id;
396 -- Used to represent some unknown integer type
398 Any_Modular : Entity_Id;
399 -- Used to represent the result type of a boolean operation on an
400 -- integer literal. The result is not Universal_Integer, because it is
401 -- only legal in a modular context.
403 Any_Numeric : Entity_Id;
404 -- Used to represent some unknown numeric type
406 Any_Real : Entity_Id;
407 -- Used to represent some unknown real type
409 Any_Scalar : Entity_Id;
410 -- Used to represent some unknown scalar type
412 Any_String : Entity_Id;
413 -- The type Any_String is used for string literals before type
414 -- resolution. It corresponds to array (Positive range <>) of character
415 -- where the component type is compatible with any character type,
416 -- not just Standard_Character.
418 Universal_Integer : Entity_Id;
419 -- Entity for universal integer type. The bounds of this type correspond
420 -- to the largest supported integer type (i.e. Long_Long_Integer). It is
421 -- the type used for runtime calculations in type universal integer.
423 Universal_Real : Entity_Id;
424 -- Entity for universal real type. The bounds of this type correspond to
425 -- to the largest supported real type (i.e. Long_Long_Real). It is the
426 -- type used for runtime calculations in type universal real. Note that
427 -- this type is always IEEE format, even if Long_Long_Real is Vax_Float
428 -- (and in that case the bounds don't correspond exactly).
430 Universal_Fixed : Entity_Id;
431 -- Entity for universal fixed type. This is a type with arbitrary
432 -- precision that can only appear in a context with a specific type.
433 -- Universal_Fixed labels the result of multiplication or division of
434 -- two fixed point numbers, and has no specified bounds (since, unlike
435 -- universal integer and universal real, it is never used for runtime
436 -- calculations).
438 Standard_Integer_8 : Entity_Id;
439 Standard_Integer_16 : Entity_Id;
440 Standard_Integer_32 : Entity_Id;
441 Standard_Integer_64 : Entity_Id;
442 -- These are signed integer types with the indicated sizes, They are
443 -- used for the underlying implementation types for fixed-point and
444 -- enumeration types.
446 Standard_Unsigned : Entity_Id;
447 -- An unsigned type of the same size as Standard_Integer
449 Abort_Signal : Entity_Id;
450 -- Entity for abort signal exception
452 Standard_Op_Rotate_Left : Entity_Id;
453 Standard_Op_Rotate_Right : Entity_Id;
454 Standard_Op_Shift_Left : Entity_Id;
455 Standard_Op_Shift_Right : Entity_Id;
456 Standard_Op_Shift_Right_Arithmetic : Entity_Id;
457 -- These entities are used for shift operators generated by the expander
459 -----------------
460 -- Subprograms --
461 -----------------
463 procedure Tree_Read;
464 -- Initializes entity values in this package from the current tree
465 -- file using Osint.Tree_Read. Note that Tree_Read includes all the
466 -- initialization that is carried out by Create_Standard.
468 procedure Tree_Write;
469 -- Writes out the entity values in this package to the current
470 -- tree file using Osint.Tree_Write.
472 end Stand;