Merge from trunk:
[official-gcc.git] / main / gcc / ada / stand.ads
blobe93e9b4b89b1d6c710eb7623d05ab7a0d2399971
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S T A N D --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2014, 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 3, 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. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 -- This package contains the declarations of entities in package Standard,
33 -- These values are initialized either by calling CStand.Create_Standard,
34 -- or by calling Stand.Tree_Read.
36 with Types; use Types;
38 package Stand is
40 -- Warning: the entities defined in this package are written out by the
41 -- Tree_Write routine, and read back in by the Tree_Read routine, so be
42 -- sure to modify these two routines if you add entities that are not
43 -- part of Standard_Entity.
45 type Standard_Entity_Type is (
46 -- This enumeration type contains an entry for each name in Standard
48 -- Package names
50 S_Standard,
51 S_ASCII,
53 -- Types and subtypes defined in package Standard (in the order in which
54 -- they appear in the RM, so that the declarations are in the right
55 -- order for the purposes of ASIS traversals
57 S_Boolean,
59 S_Short_Short_Integer,
60 S_Short_Integer,
61 S_Integer,
62 S_Long_Integer,
63 S_Long_Long_Integer,
65 S_Natural,
66 S_Positive,
68 S_Short_Float,
69 S_Float,
70 S_Long_Float,
71 S_Long_Long_Float,
73 S_Character,
74 S_Wide_Character,
75 S_Wide_Wide_Character,
77 S_String,
78 S_Wide_String,
79 S_Wide_Wide_String,
81 S_Duration,
83 -- Enumeration literals for type Boolean
85 S_False,
86 S_True,
88 -- Exceptions declared in package Standard
90 S_Constraint_Error,
91 S_Numeric_Error,
92 S_Program_Error,
93 S_Storage_Error,
94 S_Tasking_Error,
96 -- Binary Operators declared in package Standard
98 S_Op_Add,
99 S_Op_And,
100 S_Op_Concat,
101 S_Op_Concatw,
102 S_Op_Concatww,
103 S_Op_Divide,
104 S_Op_Eq,
105 S_Op_Expon,
106 S_Op_Ge,
107 S_Op_Gt,
108 S_Op_Le,
109 S_Op_Lt,
110 S_Op_Mod,
111 S_Op_Multiply,
112 S_Op_Ne,
113 S_Op_Or,
114 S_Op_Rem,
115 S_Op_Subtract,
116 S_Op_Xor,
118 -- Unary operators declared in package Standard
120 S_Op_Abs,
121 S_Op_Minus,
122 S_Op_Not,
123 S_Op_Plus,
125 -- Constants defined in package ASCII (with value in hex).
126 -- First the thirty-two C0 control characters)
128 S_NUL, -- 16#00#
129 S_SOH, -- 16#01#
130 S_STX, -- 16#02#
131 S_ETX, -- 16#03#
132 S_EOT, -- 16#04#
133 S_ENQ, -- 16#05#
134 S_ACK, -- 16#06#
135 S_BEL, -- 16#07#
136 S_BS, -- 16#08#
137 S_HT, -- 16#09#
138 S_LF, -- 16#0A#
139 S_VT, -- 16#0B#
140 S_FF, -- 16#0C#
141 S_CR, -- 16#0D#
142 S_SO, -- 16#0E#
143 S_SI, -- 16#0F#
144 S_DLE, -- 16#10#
145 S_DC1, -- 16#11#
146 S_DC2, -- 16#12#
147 S_DC3, -- 16#13#
148 S_DC4, -- 16#14#
149 S_NAK, -- 16#15#
150 S_SYN, -- 16#16#
151 S_ETB, -- 16#17#
152 S_CAN, -- 16#18#
153 S_EM, -- 16#19#
154 S_SUB, -- 16#1A#
155 S_ESC, -- 16#1B#
156 S_FS, -- 16#1C#
157 S_GS, -- 16#1D#
158 S_RS, -- 16#1E#
159 S_US, -- 16#1F#
161 -- Here are the ones for Colonel Whitaker's O26 keypunch
163 S_Exclam, -- 16#21#
164 S_Quotation, -- 16#22#
165 S_Sharp, -- 16#23#
166 S_Dollar, -- 16#24#
167 S_Percent, -- 16#25#
168 S_Ampersand, -- 16#26#
170 S_Colon, -- 16#3A#
171 S_Semicolon, -- 16#3B#
173 S_Query, -- 16#3F#
174 S_At_Sign, -- 16#40#
176 S_L_Bracket, -- 16#5B#
177 S_Back_Slash, -- 16#5C#
178 S_R_Bracket, -- 16#5D#
179 S_Circumflex, -- 16#5E#
180 S_Underline, -- 16#5F#
181 S_Grave, -- 16#60#
183 S_LC_A, -- 16#61#
184 S_LC_B, -- 16#62#
185 S_LC_C, -- 16#63#
186 S_LC_D, -- 16#64#
187 S_LC_E, -- 16#65#
188 S_LC_F, -- 16#66#
189 S_LC_G, -- 16#67#
190 S_LC_H, -- 16#68#
191 S_LC_I, -- 16#69#
192 S_LC_J, -- 16#6A#
193 S_LC_K, -- 16#6B#
194 S_LC_L, -- 16#6C#
195 S_LC_M, -- 16#6D#
196 S_LC_N, -- 16#6E#
197 S_LC_O, -- 16#6F#
198 S_LC_P, -- 16#70#
199 S_LC_Q, -- 16#71#
200 S_LC_R, -- 16#72#
201 S_LC_S, -- 16#73#
202 S_LC_T, -- 16#74#
203 S_LC_U, -- 16#75#
204 S_LC_V, -- 16#76#
205 S_LC_W, -- 16#77#
206 S_LC_X, -- 16#78#
207 S_LC_Y, -- 16#79#
208 S_LC_Z, -- 16#7A#
210 S_L_BRACE, -- 16#7B#
211 S_BAR, -- 16#7C#
212 S_R_BRACE, -- 16#7D#
213 S_TILDE, -- 16#7E#
215 -- And one more control character, all on its own
217 S_DEL); -- 16#7F#
219 subtype S_Types is
220 Standard_Entity_Type range S_Boolean .. S_Duration;
222 subtype S_Exceptions is
223 Standard_Entity_Type range S_Constraint_Error .. S_Tasking_Error;
225 subtype S_ASCII_Names is
226 Standard_Entity_Type range S_NUL .. S_DEL;
228 subtype S_Binary_Ops is
229 Standard_Entity_Type range S_Op_Add .. S_Op_Xor;
231 subtype S_Unary_Ops is
232 Standard_Entity_Type range S_Op_Abs .. S_Op_Plus;
234 type Standard_Entity_Array_Type is array (Standard_Entity_Type) of Node_Id;
236 Standard_Entity : Standard_Entity_Array_Type;
237 -- This array contains pointers to the Defining Identifier nodes for each
238 -- of the visible entities defined in Standard_Entities_Type. The array is
239 -- initialized by the Create_Standard procedure.
241 Standard_Package_Node : Node_Id;
242 -- Points to the N_Package_Declaration node for standard. Also
243 -- initialized by the Create_Standard procedure.
245 -- The following Entities are the pointers to the Defining Identifier
246 -- nodes for some visible entities defined in Standard_Entities_Type.
248 SE : Standard_Entity_Array_Type renames Standard_Entity;
250 Standard_Standard : Entity_Id renames SE (S_Standard);
252 Standard_ASCII : Entity_Id renames SE (S_ASCII);
253 Standard_Character : Entity_Id renames SE (S_Character);
254 Standard_Wide_Character : Entity_Id renames SE (S_Wide_Character);
255 Standard_Wide_Wide_Character : Entity_Id renames SE (S_Wide_Wide_Character);
256 Standard_String : Entity_Id renames SE (S_String);
257 Standard_Wide_String : Entity_Id renames SE (S_Wide_String);
258 Standard_Wide_Wide_String : Entity_Id renames SE (S_Wide_Wide_String);
260 Standard_Boolean : Entity_Id renames SE (S_Boolean);
261 Standard_False : Entity_Id renames SE (S_False);
262 Standard_True : Entity_Id renames SE (S_True);
264 Standard_Duration : Entity_Id renames SE (S_Duration);
266 Standard_Natural : Entity_Id renames SE (S_Natural);
267 Standard_Positive : Entity_Id renames SE (S_Positive);
269 Standard_Constraint_Error : Entity_Id renames SE (S_Constraint_Error);
270 Standard_Numeric_Error : Entity_Id renames SE (S_Numeric_Error);
271 Standard_Program_Error : Entity_Id renames SE (S_Program_Error);
272 Standard_Storage_Error : Entity_Id renames SE (S_Storage_Error);
273 Standard_Tasking_Error : Entity_Id renames SE (S_Tasking_Error);
275 Standard_Short_Float : Entity_Id renames SE (S_Short_Float);
276 Standard_Float : Entity_Id renames SE (S_Float);
277 Standard_Long_Float : Entity_Id renames SE (S_Long_Float);
278 Standard_Long_Long_Float : Entity_Id renames SE (S_Long_Long_Float);
280 Standard_Short_Short_Integer : Entity_Id renames SE (S_Short_Short_Integer);
281 Standard_Short_Integer : Entity_Id renames SE (S_Short_Integer);
282 Standard_Integer : Entity_Id renames SE (S_Integer);
283 Standard_Long_Integer : Entity_Id renames SE (S_Long_Integer);
284 Standard_Long_Long_Integer : Entity_Id renames SE (S_Long_Long_Integer);
286 Standard_Op_Add : Entity_Id renames SE (S_Op_Add);
287 Standard_Op_And : Entity_Id renames SE (S_Op_And);
288 Standard_Op_Concat : Entity_Id renames SE (S_Op_Concat);
289 Standard_Op_Concatw : Entity_Id renames SE (S_Op_Concatw);
290 Standard_Op_Concatww : Entity_Id renames SE (S_Op_Concatww);
291 Standard_Op_Divide : Entity_Id renames SE (S_Op_Divide);
292 Standard_Op_Eq : Entity_Id renames SE (S_Op_Eq);
293 Standard_Op_Expon : Entity_Id renames SE (S_Op_Expon);
294 Standard_Op_Ge : Entity_Id renames SE (S_Op_Ge);
295 Standard_Op_Gt : Entity_Id renames SE (S_Op_Gt);
296 Standard_Op_Le : Entity_Id renames SE (S_Op_Le);
297 Standard_Op_Lt : Entity_Id renames SE (S_Op_Lt);
298 Standard_Op_Mod : Entity_Id renames SE (S_Op_Mod);
299 Standard_Op_Multiply : Entity_Id renames SE (S_Op_Multiply);
300 Standard_Op_Ne : Entity_Id renames SE (S_Op_Ne);
301 Standard_Op_Or : Entity_Id renames SE (S_Op_Or);
302 Standard_Op_Rem : Entity_Id renames SE (S_Op_Rem);
303 Standard_Op_Subtract : Entity_Id renames SE (S_Op_Subtract);
304 Standard_Op_Xor : Entity_Id renames SE (S_Op_Xor);
306 Standard_Op_Abs : Entity_Id renames SE (S_Op_Abs);
307 Standard_Op_Minus : Entity_Id renames SE (S_Op_Minus);
308 Standard_Op_Not : Entity_Id renames SE (S_Op_Not);
309 Standard_Op_Plus : Entity_Id renames SE (S_Op_Plus);
311 Last_Standard_Node_Id : Node_Id;
312 -- Highest Node_Id value used by Standard
314 Last_Standard_List_Id : List_Id;
315 -- Highest List_Id value used by Standard (including those used by
316 -- normal list headers, element list headers, and list elements)
318 Boolean_Literals : array (Boolean) of Entity_Id;
319 -- Entities for the two boolean literals, used by the expander
321 -------------------------------------
322 -- Semantic Phase Special Entities --
323 -------------------------------------
325 -- The semantic phase needs a number of entities for internal processing
326 -- that are logically at the level of Standard, and hence defined in this
327 -- package. However, they are never visible to a program, and are not
328 -- chained on to the Decls list of Standard. The names of all these
329 -- types are relevant only in certain debugging and error message
330 -- situations. They have names that are suitable for use in such
331 -- error messages (see body for actual names used).
333 Standard_Void_Type : Entity_Id;
334 -- This is a type used to represent the return type of procedures
336 Standard_Exception_Type : Entity_Id;
337 -- This is a type used to represent the Etype of exceptions
339 Standard_A_String : Entity_Id;
340 -- An access to String type used for building elements of tables
341 -- carrying the enumeration literal names.
343 Standard_A_Char : Entity_Id;
344 -- Access to character, used as a component of the exception type to denote
345 -- a thin pointer component.
347 Standard_Debug_Renaming_Type : Entity_Id;
348 -- A zero-size subtype of Integer, used as the type of variables used to
349 -- provide the debugger with name encodings for renaming declarations.
351 Predefined_Float_Types : Elist_Id;
352 -- Entities for predefined floating point types. These are used by
353 -- the semantic phase to select appropriate types for floating point
354 -- declarations. This list is ordered by preference. All types up to
355 -- Long_Long_Float_Type are considered for plain "digits N" declarations,
356 -- while selection of later types requires a range specification and
357 -- possibly other attributes or pragmas.
359 -- The entities labeled Any_xxx are used in situations where the full
360 -- characteristics of an entity are not yet known, e.g. Any_Character
361 -- is used to label a character literal before resolution is complete.
362 -- These entities are also used to construct appropriate references in
363 -- error messages ("expecting an integer type").
365 Any_Id : Entity_Id;
366 -- Used to represent some unknown identifier. Used to label undefined
367 -- identifier references to prevent cascaded errors.
369 Any_Type : Entity_Id;
370 -- Used to represent some unknown type. Any_Type is the type of an
371 -- unresolved operator, and it is the type of a node where a type error
372 -- has been detected. Any_Type plays an important role in avoiding cascaded
373 -- errors, because it is compatible with all other types, and is propagated
374 -- to any expression that has a subexpression of Any_Type. When resolving
375 -- operators, Any_Type is the initial type of the node before any of its
376 -- candidate interpretations has been examined. If after examining all of
377 -- them the type is still Any_Type, the node has no possible interpretation
378 -- and an error can be emitted (and Any_Type will be propagated upwards).
380 Any_Access : Entity_Id;
381 -- Used to resolve the overloaded literal NULL
383 Any_Array : Entity_Id;
384 -- Used to represent some unknown array type
386 Any_Boolean : Entity_Id;
387 -- The context type of conditions in IF and WHILE statements
389 Any_Character : Entity_Id;
390 -- Any_Character is used to label character literals, which in general
391 -- will not have an explicit declaration (this is true of the predefined
392 -- character types).
394 Any_Composite : Entity_Id;
395 -- The type Any_Composite is used for aggregates before type resolution.
396 -- It is compatible with any array or non-limited record type.
398 Any_Discrete : Entity_Id;
399 -- Used to represent some unknown discrete type
401 Any_Fixed : Entity_Id;
402 -- Used to represent some unknown fixed-point type
404 Any_Integer : Entity_Id;
405 -- Used to represent some unknown integer type
407 Any_Modular : Entity_Id;
408 -- Used to represent the result type of a boolean operation on an integer
409 -- literal. The result is not Universal_Integer, because it is only legal
410 -- in a modular context.
412 Any_Numeric : Entity_Id;
413 -- Used to represent some unknown numeric type
415 Any_Real : Entity_Id;
416 -- Used to represent some unknown real type
418 Any_Scalar : Entity_Id;
419 -- Used to represent some unknown scalar type
421 Any_String : Entity_Id;
422 -- The type Any_String is used for string literals before type resolution.
423 -- It corresponds to array (Positive range <>) of character where the
424 -- component type is compatible with any character type, not just
425 -- Standard_Character.
427 Raise_Type : Entity_Id;
428 -- The type Raise_Type denotes the type of a Raise_Expression. It is
429 -- compatible with all other types, and must eventually resolve to a
430 -- concrete type that is imposed by the context.
432 -- Historical note: we used to use Any_Type for this purpose, but the
433 -- confusion of meanings (Any_Type normally indicates an error) caused
434 -- difficulties. In particular some needed expansions were skipped since
435 -- the nodes in question looked like they had an error.
437 Universal_Integer : Entity_Id;
438 -- Entity for universal integer type. The bounds of this type correspond
439 -- to the largest supported integer type (i.e. Long_Long_Integer). It is
440 -- the type used for runtime calculations in type universal integer.
442 Universal_Real : Entity_Id;
443 -- Entity for universal real type. The bounds of this type correspond to
444 -- to the largest supported real type (i.e. Long_Long_Float). It is the
445 -- type used for runtime calculations in type universal real. Note that
446 -- this type is always IEEE format.
448 Universal_Fixed : Entity_Id;
449 -- Entity for universal fixed type. This is a type with arbitrary
450 -- precision that can only appear in a context with a specific type.
451 -- Universal_Fixed labels the result of multiplication or division of
452 -- two fixed point numbers, and has no specified bounds (since, unlike
453 -- universal integer and universal real, it is never used for runtime
454 -- calculations).
456 Standard_Integer_8 : Entity_Id;
457 Standard_Integer_16 : Entity_Id;
458 Standard_Integer_32 : Entity_Id;
459 Standard_Integer_64 : Entity_Id;
460 -- These are signed integer types with the indicated sizes. Used for the
461 -- underlying implementation types for fixed-point and enumeration types.
463 Standard_Short_Short_Unsigned : Entity_Id;
464 Standard_Short_Unsigned : Entity_Id;
465 Standard_Unsigned : Entity_Id;
466 Standard_Long_Unsigned : Entity_Id;
467 Standard_Long_Long_Unsigned : Entity_Id;
468 -- Unsigned types with same Esize as corresponding signed integer types
470 Standard_Unsigned_64 : Entity_Id;
471 -- An unsigned type, mod 2 ** 64, size of 64 bits.
473 Abort_Signal : Entity_Id;
474 -- Entity for abort signal exception
476 Standard_Op_Rotate_Left : Entity_Id;
477 Standard_Op_Rotate_Right : Entity_Id;
478 Standard_Op_Shift_Left : Entity_Id;
479 Standard_Op_Shift_Right : Entity_Id;
480 Standard_Op_Shift_Right_Arithmetic : Entity_Id;
481 -- These entities are used for shift operators generated by the expander
483 -----------------
484 -- Subprograms --
485 -----------------
487 procedure Tree_Read;
488 -- Initializes entity values in this package from the current tree file
489 -- using Tree_IO. Note that Tree_Read includes all the initialization that
490 -- is carried out by Create_Standard.
492 procedure Tree_Write;
493 -- Writes out the entity values in this package to the current tree file
494 -- using Tree_IO.
496 end Stand;