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