OSDN Git Service

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