1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
34 ------------------------------------------------------------------------------
36 -- This package contains the declarations of entities in package Standard,
37 -- These values are initialized either by calling CStand.Create_Standard,
38 -- or by calling Stand.Tree_Read.
40 with Types; use Types;
42 -- Do we really need the with of Namet?
44 pragma Warnings (Off);
45 with Namet; use Namet;
46 pragma Elaborate_All (Namet);
51 type Standard_Entity_Type is (
52 -- This enumeration type contains an entry for each name in Standard
59 -- Types defined in package Standard
68 S_Short_Short_Integer,
79 -- Enumeration literals for type Boolean
84 -- Subtypes declared in package Standard
89 -- Exceptions declared in package Standard
97 -- Binary Operators declared in package Standard.
118 -- Unary operators declared in package Standard
125 -- Constants defined in package ASCII (with value in hex).
126 -- First the thirty-two C0 control characters)
161 -- Here are the ones for Colonel Whitaker's O26 keypunch!
164 S_Quotation, -- 16#22#
168 S_Ampersand, -- 16#26#
171 S_Semicolon, -- 16#3B#
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#
215 -- And one more control character, all on its own
220 Standard_Entity_Type range S_Boolean .. S_Long_Long_Float;
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
238 -- for each of the entities defined in Standard_Entities_Type. It
239 -- is 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_String : Entity_Id renames SE (S_String);
256 Standard_Wide_String : Entity_Id renames SE (S_Wide_String);
258 Standard_Boolean : Entity_Id renames SE (S_Boolean);
259 Standard_False : Entity_Id renames SE (S_False);
260 Standard_True : Entity_Id renames SE (S_True);
262 Standard_Duration : Entity_Id renames SE (S_Duration);
264 Standard_Natural : Entity_Id renames SE (S_Natural);
265 Standard_Positive : Entity_Id renames SE (S_Positive);
267 Standard_Constraint_Error : Entity_Id renames SE (S_Constraint_Error);
268 Standard_Numeric_Error : Entity_Id renames SE (S_Numeric_Error);
269 Standard_Program_Error : Entity_Id renames SE (S_Program_Error);
270 Standard_Storage_Error : Entity_Id renames SE (S_Storage_Error);
271 Standard_Tasking_Error : Entity_Id renames SE (S_Tasking_Error);
273 Standard_Short_Float : Entity_Id renames SE (S_Short_Float);
274 Standard_Float : Entity_Id renames SE (S_Float);
275 Standard_Long_Float : Entity_Id renames SE (S_Long_Float);
276 Standard_Long_Long_Float : Entity_Id renames SE (S_Long_Long_Float);
278 Standard_Short_Short_Integer : Entity_Id renames SE (S_Short_Short_Integer);
279 Standard_Short_Integer : Entity_Id renames SE (S_Short_Integer);
280 Standard_Integer : Entity_Id renames SE (S_Integer);
281 Standard_Long_Integer : Entity_Id renames SE (S_Long_Integer);
282 Standard_Long_Long_Integer : Entity_Id renames SE (S_Long_Long_Integer);
284 Standard_Op_Add : Entity_Id renames SE (S_Op_Add);
285 Standard_Op_And : Entity_Id renames SE (S_Op_And);
286 Standard_Op_Concat : Entity_Id renames SE (S_Op_Concat);
287 Standard_Op_Concatw : Entity_Id renames SE (S_Op_Concatw);
288 Standard_Op_Divide : Entity_Id renames SE (S_Op_Divide);
289 Standard_Op_Eq : Entity_Id renames SE (S_Op_Eq);
290 Standard_Op_Expon : Entity_Id renames SE (S_Op_Expon);
291 Standard_Op_Ge : Entity_Id renames SE (S_Op_Ge);
292 Standard_Op_Gt : Entity_Id renames SE (S_Op_Gt);
293 Standard_Op_Le : Entity_Id renames SE (S_Op_Le);
294 Standard_Op_Lt : Entity_Id renames SE (S_Op_Lt);
295 Standard_Op_Mod : Entity_Id renames SE (S_Op_Mod);
296 Standard_Op_Multiply : Entity_Id renames SE (S_Op_Multiply);
297 Standard_Op_Ne : Entity_Id renames SE (S_Op_Ne);
298 Standard_Op_Or : Entity_Id renames SE (S_Op_Or);
299 Standard_Op_Rem : Entity_Id renames SE (S_Op_Rem);
300 Standard_Op_Subtract : Entity_Id renames SE (S_Op_Subtract);
301 Standard_Op_Xor : Entity_Id renames SE (S_Op_Xor);
303 Standard_Op_Abs : Entity_Id renames SE (S_Op_Abs);
304 Standard_Op_Minus : Entity_Id renames SE (S_Op_Minus);
305 Standard_Op_Not : Entity_Id renames SE (S_Op_Not);
306 Standard_Op_Plus : Entity_Id renames SE (S_Op_Plus);
308 Last_Standard_Node_Id : Node_Id;
309 -- Highest Node_Id value used by Standard
311 Last_Standard_List_Id : List_Id;
312 -- Highest List_Id value used by Standard (including those used by
313 -- normal list headers, element list headers, and list elements)
315 -------------------------------------
316 -- Semantic Phase Special Entities --
317 -------------------------------------
319 -- The semantic phase needs a number of entities for internal processing
320 -- that are logically at the level of Standard, and hence defined in this
321 -- package. However, they are never visible to a program, and are not
322 -- chained on to the Decls list of Standard. The names of all these
323 -- types are relevant only in certain debugging and error message
324 -- situations. They have names that are suitable for use in such
325 -- error messages (see body for actual names used).
327 Standard_Void_Type : Entity_Id;
328 -- This is a type used to represent the return type of procedures
330 Standard_Exception_Type : Entity_Id;
331 -- This is a type used to represent the Etype of exceptions.
333 Standard_A_String : Entity_Id;
334 -- An access to String type used for building elements of tables
335 -- carrying the enumeration literal names.
337 Standard_A_Char : Entity_Id;
338 -- Access to character, used as a component of the exception type to
339 -- denote a thin pointer component.
341 -- The entities labeled Any_xxx are used in situations where the full
342 -- characteristics of an entity are not yet known, e.g. Any_Character
343 -- is used to label a character literal before resolution is complete.
344 -- These entities are also used to construct appropriate references in
345 -- error messages ("expecting an integer type").
348 -- Used to represent some unknown identifier. Used to lable undefined
349 -- identifier references to prevent cascaded errors.
351 Any_Type : Entity_Id;
352 -- Used to represent some unknown type. Plays an important role in
353 -- avoiding cascaded errors, since any node that remains labaled with
354 -- this type corresponds to an already issued error message. Any_Type
355 -- is propagated to avoid cascaded errors from a single type error.
357 Any_Access : Entity_Id;
358 -- Used to resolve the overloaded literal NULL.
360 Any_Array : Entity_Id;
361 -- Used to represent some unknown array type
363 Any_Boolean : Entity_Id;
364 -- The context type of conditions in IF and WHILE statements.
366 Any_Character : Entity_Id;
367 -- Any_Character is used to label character literals, which in general
368 -- will not have an explicit declaration (this is true of the predefined
371 Any_Composite : Entity_Id;
372 -- The type Any_Composite is used for aggregates before type resolution.
373 -- It is compatible with any array or non-limited record type.
375 Any_Discrete : Entity_Id;
376 -- Used to represent some unknown discrete type
378 Any_Fixed : Entity_Id;
379 -- Used to represent some unknown fixed-point type
381 Any_Integer : Entity_Id;
382 -- Used to represent some unknown integer type.
384 Any_Modular : Entity_Id;
385 -- Used to represent the result type of a boolean operation on an
386 -- integer literal. The result is not Universal_Integer, because it is
387 -- only legal in a modular context.
389 Any_Numeric : Entity_Id;
390 -- Used to represent some unknown numeric type.
392 Any_Real : Entity_Id;
393 -- Used to represent some unknown real type.
395 Any_Scalar : Entity_Id;
396 -- Used to represent some unknown scalar type
398 Any_String : Entity_Id;
399 -- The type Any_String is used for string literals before type
400 -- resolution. It corresponds to array (Positive range <>) of character
401 -- where the component type is compatible with any character type,
402 -- not just Standard_Character.
404 Universal_Integer : Entity_Id;
405 -- Entity for universal integer type. The bounds of this type correspond
406 -- to the largest supported integer type (i.e. Long_Long_Integer). It is
407 -- the type used for runtime calculations in type universal integer.
409 Universal_Real : Entity_Id;
410 -- Entity for universal real type. The bounds of this type correspond to
411 -- to the largest supported real type (i.e. Long_Long_Real). It is the
412 -- type used for runtime calculations in type universal real.
414 Universal_Fixed : Entity_Id;
415 -- Entity for universal fixed type. This is a type with arbitrary
416 -- precision that can only appear in a context with a specific type.
417 -- Universal_Fixed labels the result of multiplication or division of
418 -- two fixed point numbers, and has no specified bounds (since, unlike
419 -- universal integer and universal real, it is never used for runtime
422 Standard_Integer_8 : Entity_Id;
423 Standard_Integer_16 : Entity_Id;
424 Standard_Integer_32 : Entity_Id;
425 Standard_Integer_64 : Entity_Id;
426 -- These are signed integer types with the indicated sizes, They are
427 -- used for the underlying implementation types for fixed-point and
428 -- enumeration types.
430 Standard_Unsigned : Entity_Id;
431 -- An unsigned type of the same size as Standard_Integer
433 Abort_Signal : Entity_Id;
434 -- Entity for abort signal exception
436 Standard_Op_Rotate_Left : Entity_Id;
437 Standard_Op_Rotate_Right : Entity_Id;
438 Standard_Op_Shift_Left : Entity_Id;
439 Standard_Op_Shift_Right : Entity_Id;
440 Standard_Op_Shift_Right_Arithmetic : Entity_Id;
441 -- These entities are used for shift operators generated by the expander
448 -- Initializes entity values in this package from the current tree
449 -- file using Osint.Tree_Read. Note that Tree_Read includes all the
450 -- initialization that is carried out by Create_Standard.
452 procedure Tree_Write;
453 -- Writes out the entity values in this package to the current
454 -- tree file using Osint.Tree_Write.