* dwarf2out.c (loc_descriptor_from_tree, case CONSTRUCTOR): New case.
[official-gcc.git] / gcc / ada / types.ads
blob65731227c65124f7a59fe33e895fb2f82c35597f
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- T Y P E S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2002 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, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, 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 with Unchecked_Deallocation;
36 package Types is
37 pragma Preelaborate (Types);
39 -- This package contains host independent type definitions which are used
40 -- in more than one unit in the compiler. They are gathered here for easy
41 -- reference, though in some cases the full description is found in the
42 -- relevant module which implements the definition. The main reason that
43 -- they are not in their "natural" specs is that this would cause a lot of
44 -- inter-spec dependencies, and in particular some awkward circular
45 -- dependencies would have to be dealt with.
47 -- WARNING: There is a C version of this package. Any changes to this
48 -- source file must be properly reflected in the C header file a-types.h
50 -- Note: the declarations in this package reflect an expectation that the
51 -- host machine has an efficient integer base type with a range at least
52 -- 32 bits 2s-complement. If there are any machines for which this is not
53 -- a correct assumption, a significant number of changes will be required!
55 -------------------------------
56 -- General Use Integer Types --
57 -------------------------------
59 type Int is range -2 ** 31 .. +2 ** 31 - 1;
60 -- Signed 32-bit integer
62 type Dint is range -2 ** 63 .. +2 ** 63 - 1;
63 -- Double length (64-bit) integer
65 subtype Nat is Int range 0 .. Int'Last;
66 -- Non-negative Int values
68 subtype Pos is Int range 1 .. Int'Last;
69 -- Positive Int values
71 type Word is mod 2 ** 32;
72 -- Unsigned 32-bit integer
74 type Short is range -32768 .. +32767;
75 for Short'Size use 16;
76 -- 16-bit signed integer
78 type Byte is mod 2 ** 8;
79 for Byte'Size use 8;
80 -- 8-bit unsigned integer
82 type size_t is mod 2 ** Standard'Address_Size;
83 -- Memory size value, for use in calls to C routines
85 --------------------------------------
86 -- 8-Bit Character and String Types --
87 --------------------------------------
89 -- We use Standard.Character and Standard.String freely, since we are
90 -- compiling ourselves, and we properly implement the required 8-bit
91 -- character code as required in Ada 95. This section defines a few
92 -- general use constants and subtypes.
94 EOF : constant Character := ASCII.SUB;
95 -- The character SUB (16#1A#) is used in DOS and other systems derived
96 -- from DOS (OS/2, NT etc) to signal the end of a text file. Internally
97 -- all source files are ended by an EOF character, even on Unix systems.
98 -- An EOF character acts as the end of file only as the last character
99 -- of a source buffer, in any other position, it is treated as a blank
100 -- if it appears between tokens, and as an illegal character otherwise.
101 -- This makes life easier dealing with files that originated from DOS,
102 -- including concatenated files with interspersed EOF characters.
104 subtype Graphic_Character is Character range ' ' .. '~';
105 -- Graphic characters, as defined in ARM
107 subtype Line_Terminator is Character range ASCII.LF .. ASCII.CR;
108 -- Line terminator characters (LF, VT, FF, CR)
110 subtype Upper_Half_Character is
111 Character range Character'Val (16#80#) .. Character'Val (16#FF#);
112 -- Characters with the upper bit set
114 type Character_Ptr is access all Character;
115 type String_Ptr is access all String;
116 -- Standard character and string pointers
118 procedure Free is new Unchecked_Deallocation (String, String_Ptr);
119 -- Procedure for freeing dynamically allocated String values
121 subtype Word_Hex_String is String (1 .. 8);
122 -- Type used to represent Word value as 8 hex digits, with lower case
123 -- letters for the alphabetic cases.
125 function Get_Hex_String (W : Word) return Word_Hex_String;
126 -- Convert word value to 8-character hex string
128 -----------------------------------------
129 -- Types Used for Text Buffer Handling --
130 -----------------------------------------
132 -- We can't use type String for text buffers, since we must use the
133 -- standard 32-bit integer as an index value, since we count on all
134 -- index values being the same size.
136 type Text_Ptr is new Int;
137 -- Type used for subscripts in text buffer
139 type Text_Buffer is array (Text_Ptr range <>) of Character;
140 -- Text buffer used to hold source file or library information file
142 type Text_Buffer_Ptr is access all Text_Buffer;
143 -- Text buffers for input files are allocated dynamically and this type
144 -- is used to reference these text buffers.
146 procedure Free is new Unchecked_Deallocation (Text_Buffer, Text_Buffer_Ptr);
147 -- Procedure for freeing dynamically allocated text buffers
149 ------------------------------------------
150 -- Types Used for Source Input Handling --
151 ------------------------------------------
153 type Logical_Line_Number is range 0 .. Int'Last;
154 for Logical_Line_Number'Size use 32;
155 -- Line number type, used for storing logical line numbers (i.e. line
156 -- numbers that include effects of any Source_Reference pragmas in the
157 -- source file). The value zero indicates a line containing a source
158 -- reference pragma.
160 No_Line_Number : constant Logical_Line_Number := 0;
161 -- Special value used to indicate no line number
163 type Physical_Line_Number is range 1 .. Int'Last;
164 for Physical_Line_Number'Size use 32;
165 -- Line number type, used for storing physical line numbers (i.e.
166 -- line numbers in the physical file being compiled, unaffected by
167 -- the presence of source reference pragmas.
169 type Column_Number is range 0 .. 32767;
170 for Column_Number'Size use 16;
171 -- Column number (assume that 2**15 is large enough, see declaration
172 -- of Hostparm.Max_Line_Length)
174 No_Column_Number : constant Column_Number := 0;
175 -- Special value used to indicate no column number
177 subtype Source_Buffer is Text_Buffer;
178 -- Type used to store text of a source file . The buffer for the main
179 -- source (the source specified on the command line) has a lower bound
180 -- starting at zero. Subsequent subsidiary sources have lower bounds
181 -- which are one greater than the previous upper bound.
183 subtype Big_Source_Buffer is Text_Buffer (0 .. Text_Ptr'Last);
184 -- This is a virtual type used as the designated type of the access
185 -- type Source_Buffer_Ptr, see Osint.Read_Source_File for details.
187 type Source_Buffer_Ptr is access all Big_Source_Buffer;
188 -- Pointer to source buffer. We use virtual origin addressing for
189 -- source buffers, with thin pointers. The pointer points to a virtual
190 -- instance of type Big_Source_Buffer, where the actual type is in fact
191 -- of type Source_Buffer. The address is adjusted so that the virtual
192 -- origin addressing works correctly. See Osint.Read_Source_Buffer for
193 -- further details.
195 subtype Source_Ptr is Text_Ptr;
196 -- Type used to represent a source location, which is a subscript of a
197 -- character in the source buffer. As noted above, diffferent source
198 -- buffers have different ranges, so it is possible to tell from a
199 -- Source_Ptr value which source it refers to. Note that negative numbers
200 -- are allowed to accommodate the following special values.
202 No_Location : constant Source_Ptr := -1;
203 -- Value used to indicate no source position set in a node
205 Standard_Location : constant Source_Ptr := -2;
206 -- Used for all nodes in the representation of package Standard other
207 -- than nodes representing the contents of Standard.ASCII. Note that
208 -- testing for <= Standard_Location tests for both Standard_Location
209 -- and for Standard_ASCII_Location.
211 Standard_ASCII_Location : constant Source_Ptr := -3;
212 -- Used for all nodes in the presentation of package Standard.ASCII
214 First_Source_Ptr : constant Source_Ptr := 0;
215 -- Starting source pointer index value for first source program
217 -------------------------------------
218 -- Range Definitions for Tree Data --
219 -------------------------------------
221 -- The tree has fields that can hold any of the following types:
223 -- Pointers to other tree nodes (type Node_Id)
224 -- List pointers (type List_Id)
225 -- Element list pointers (type Elist_Id)
226 -- Names (type Name_Id)
227 -- Strings (type String_Id)
228 -- Universal integers (type Uint)
229 -- Universal reals (type Ureal)
230 -- Character codes (type Char_Code stored with a bias)
232 -- In most contexts, the strongly typed interface determines which of
233 -- these types is present. However, there are some situations (involving
234 -- untyped traversals of the tree), where it is convenient to be easily
235 -- able to distinguish these values. The underlying representation in all
236 -- cases is an integer type Union_Id, and we ensure that the range of
237 -- the various possible values for each of the above types is disjoint
238 -- so that this distinction is possible.
240 type Union_Id is new Int;
241 -- The type in the tree for a union of possible ID values
243 -- Note: it is also helpful for debugging purposes to make these ranges
244 -- distinct. If a bug leads to misidentification of a value, then it will
245 -- typically result in an out of range value and a Constraint_Error.
247 List_Low_Bound : constant := -100_000_000;
248 -- The List_Id values are subscripts into an array of list headers which
249 -- has List_Low_Bound as its lower bound. This value is chosen so that all
250 -- List_Id values are negative, and the value zero is in the range of both
251 -- List_Id and Node_Id values (see further description below).
253 List_High_Bound : constant := 0;
254 -- Maximum List_Id subscript value. This allows up to 100 million list
255 -- Id values, which is in practice infinite, and there is no need to
256 -- check the range. The range overlaps the node range by one element
257 -- (with value zero), which is used both for the Empty node, and for
258 -- indicating no list. The fact that the same value is used is convenient
259 -- because it means that the default value of Empty applies to both nodes
260 -- and lists, and also is more efficient to test for.
262 Node_Low_Bound : constant := 0;
263 -- The tree Id values start at zero, because we use zero for Empty (to
264 -- allow a zero test for Empty). Actual tree node subscripts start at 0
265 -- since Empty is a legitimate node value.
267 Node_High_Bound : constant := 099_999_999;
268 -- Maximum number of nodes that can be allocated is 100 million, which
269 -- is in practice infinite, and there is no need to check the range.
271 Elist_Low_Bound : constant := 100_000_000;
272 -- The Elist_Id values are subscripts into an array of elist headers which
273 -- has Elist_Low_Bound as its lower bound.
275 Elist_High_Bound : constant := 199_999_999;
276 -- Maximum Elist_Id subscript value. This allows up to 100 million Elists,
277 -- which is in practice infinite and there is no need to check the range.
279 Elmt_Low_Bound : constant := 200_000_000;
280 -- Low bound of element Id values. The use of these values is internal to
281 -- the Elists package, but the definition of the range is included here
282 -- since it must be disjoint from other Id values. The Elmt_Id values are
283 -- subscripts into an array of list elements which has this as lower bound.
285 Elmt_High_Bound : constant := 299_999_999;
286 -- Upper bound of Elmt_Id values. This allows up to 100 million element
287 -- list members, which is in practice infinite (no range check needed).
289 Names_Low_Bound : constant := 300_000_000;
290 -- Low bound for name Id values
292 Names_High_Bound : constant := 399_999_999;
293 -- Maximum number of names that can be allocated is 100 million, which is
294 -- in practice infinite and there is no need to check the range.
296 Strings_Low_Bound : constant := 400_000_000;
297 -- Low bound for string Id values
299 Strings_High_Bound : constant := 499_999_999;
300 -- Maximum number of strings that can be allocated is 100 million, which
301 -- is in practice infinite and there is no need to check the range.
303 Ureal_Low_Bound : constant := 500_000_000;
304 -- Low bound for Ureal values.
306 Ureal_High_Bound : constant := 599_999_999;
307 -- Maximum number of Ureal values stored is 100_000_000 which is in
308 -- practice infinite so that no check is required.
310 Uint_Low_Bound : constant := 600_000_000;
311 -- Low bound for Uint values.
313 Uint_Table_Start : constant := 2_000_000_000;
314 -- Location where table entries for universal integers start (see
315 -- Uintp spec for details of the representation of Uint values).
317 Uint_High_Bound : constant := 2_099_999_999;
318 -- The range of Uint values is very large, since a substantial part
319 -- of this range is used to store direct values, see Uintp for details.
321 Char_Code_Bias : constant := 2_100_000_000;
322 -- A bias value added to character code values stored in the tree which
323 -- ensures that they have different values from any of the above types.
325 -- The following subtype definitions are used to provide convenient names
326 -- for membership tests on Int values to see what data type range they
327 -- lie in. Such tests appear only in the lowest level packages.
329 subtype List_Range is Union_Id
330 range List_Low_Bound .. List_High_Bound;
332 subtype Node_Range is Union_Id
333 range Node_Low_Bound .. Node_High_Bound;
335 subtype Elist_Range is Union_Id
336 range Elist_Low_Bound .. Elist_High_Bound;
338 subtype Elmt_Range is Union_Id
339 range Elmt_Low_Bound .. Elmt_High_Bound;
341 subtype Names_Range is Union_Id
342 range Names_Low_Bound .. Names_High_Bound;
344 subtype Strings_Range is Union_Id
345 range Strings_Low_Bound .. Strings_High_Bound;
347 subtype Uint_Range is Union_Id
348 range Uint_Low_Bound .. Uint_High_Bound;
350 subtype Ureal_Range is Union_Id
351 range Ureal_Low_Bound .. Ureal_High_Bound;
353 subtype Char_Code_Range is Union_Id
354 range Char_Code_Bias .. Char_Code_Bias + 2**16 - 1;
356 -----------------------------
357 -- Types for Namet Package --
358 -----------------------------
360 -- Name_Id values are used to identify entries in the names table. Except
361 -- for the special values No_Name, and Error_Name, they are subscript
362 -- values for the Names table defined in package Namet.
364 -- Note that with only a few exceptions, which are clearly documented, the
365 -- type Name_Id should be regarded as a private type. In particular it is
366 -- never appropriate to perform arithmetic operations using this type.
368 type Name_Id is range Names_Low_Bound .. Names_High_Bound;
369 for Name_Id'Size use 32;
370 -- Type used to identify entries in the names table
372 No_Name : constant Name_Id := Names_Low_Bound;
373 -- The special Name_Id value No_Name is used in the parser to indicate
374 -- a situation where no name is present (e.g. on a loop or block).
376 Error_Name : constant Name_Id := Names_Low_Bound + 1;
377 -- The special Name_Id value Error_Name is used in the parser to
378 -- indicate that some kind of error was encountered in scanning out
379 -- the relevant name, so it does not have a representable label.
381 subtype Error_Name_Or_No_Name is Name_Id range No_Name .. Error_Name;
382 -- Used to test for either error name or no name
384 First_Name_Id : constant Name_Id := Names_Low_Bound + 2;
385 -- Subscript of first entry in names table
387 ----------------------------
388 -- Types for Atree Package --
389 ----------------------------
391 -- Node_Id values are used to identify nodes in the tree. They are
392 -- subscripts into the Node table declared in package Tree. Note that
393 -- the special values Empty and Error are subscripts into this table,
394 -- See package Atree for further details.
396 type Node_Id is range Node_Low_Bound .. Node_High_Bound;
397 -- Type used to identify nodes in the tree
399 subtype Entity_Id is Node_Id;
400 -- A synonym for node types, used in the entity package to refer to
401 -- nodes that are entities (i.e. nodes with an Nkind of N_Defining_xxx)
402 -- All such nodes are extended nodes and these are the only extended
403 -- nodes, so that in practice entity and extended nodes are synonymous.
405 subtype Node_Or_Entity_Id is Node_Id;
406 -- A synonym for node types, used in cases where a given value may be used
407 -- to represent either a node or an entity. We like to minimize such uses
408 -- for obvious reasons of logical type consistency, but where such uses
409 -- occur, they should be documented by use of this type.
411 Empty : constant Node_Id := Node_Low_Bound;
412 -- Used to indicate null node. A node is actually allocated with this
413 -- Id value, so that Nkind (Empty) = N_Empty. Note that Node_Low_Bound
414 -- is zero, so Empty = No_List = zero.
416 Empty_List_Or_Node : constant := 0;
417 -- This constant is used in situations (e.g. initializing empty fields)
418 -- where the value set will be used to represent either an empty node
419 -- or a non-existent list, depending on the context.
421 Error : constant Node_Id := Node_Low_Bound + 1;
422 -- Used to indicate that there was an error in the source program. A node
423 -- is actually allocated at this address, so that Nkind (Error) = N_Error.
425 Empty_Or_Error : constant Node_Id := Error;
426 -- Since Empty and Error are the first two Node_Id values, the test for
427 -- N <= Empty_Or_Error tests to see if N is Empty or Error. This definition
428 -- provides convenient self-documentation for such tests.
430 First_Node_Id : constant Node_Id := Node_Low_Bound;
431 -- Subscript of first allocated node. Note that Empty and Error are both
432 -- allocated nodes, whose Nkind fields can be accessed without error.
434 ------------------------------
435 -- Types for Nlists Package --
436 ------------------------------
438 -- List_Id values are used to identify node lists in the tree. They are
439 -- subscripts into the Lists table declared in package Tree. Note that
440 -- the special value Error_List is a subscript in this table, but the
441 -- value No_List is *not* a valid subscript, and any attempt to apply
442 -- list operations to No_List will cause a (detected) error.
444 type List_Id is range List_Low_Bound .. List_High_Bound;
445 -- Type used to identify a node list
447 No_List : constant List_Id := List_High_Bound;
448 -- Used to indicate absence of a list. Note that the value is zero, which
449 -- is the same as Empty, which is helpful in initializing nodes where a
450 -- value of zero can represent either an empty node or an empty list.
452 Error_List : constant List_Id := List_Low_Bound;
453 -- Used to indicate that there was an error in the source program in a
454 -- context which would normally require a list. This node appears to be
455 -- an empty list to the list operations (a null list is actually allocated
456 -- which has this Id value).
458 First_List_Id : constant List_Id := Error_List;
459 -- Subscript of first allocated list header
461 ------------------------------
462 -- Types for Elists Package --
463 ------------------------------
465 -- Element list Id values are used to identify element lists stored in
466 -- the tree (see package Tree for further details). They are formed by
467 -- adding a bias (Element_List_Bias) to subscript values in the same
468 -- array that is used for node list headers.
470 type Elist_Id is range Elist_Low_Bound .. Elist_High_Bound;
471 -- Type used to identify an element list (Elist header table subscript)
473 No_Elist : constant Elist_Id := Elist_Low_Bound;
474 -- Used to indicate absense of an element list. Note that this is not
475 -- an actual Elist header, so element list operations on this value
476 -- are not valid.
478 First_Elist_Id : constant Elist_Id := No_Elist + 1;
479 -- Subscript of first allocated Elist header.
481 -- Element Id values are used to identify individual elements of an
482 -- element list (see package Elists for further details).
484 type Elmt_Id is range Elmt_Low_Bound .. Elmt_High_Bound;
485 -- Type used to identify an element list
487 No_Elmt : constant Elmt_Id := Elmt_Low_Bound;
488 -- Used to represent empty element
490 First_Elmt_Id : constant Elmt_Id := No_Elmt + 1;
491 -- Subscript of first allocated Elmt table entry
493 -------------------------------
494 -- Types for Stringt Package --
495 -------------------------------
497 -- String_Id values are used to identify entries in the strings table.
498 -- They are subscripts into the strings table defined in package Strings.
500 -- Note that with only a few exceptions, which are clearly documented, the
501 -- type String_Id should be regarded as a private type. In particular it is
502 -- never appropriate to perform arithmetic operations using this type.
504 type String_Id is range Strings_Low_Bound .. Strings_High_Bound;
505 -- Type used to identify entries in the strings table
507 No_String : constant String_Id := Strings_Low_Bound;
508 -- Used to indicate missing string Id. Note that the value zero is used
509 -- to indicate a missing data value for all the Int types in this section.
511 First_String_Id : constant String_Id := No_String + 1;
512 -- First subscript allocated in string table
514 -------------------------
515 -- Character Code Type --
516 -------------------------
518 -- The type Char is used for character data internally in the compiler,
519 -- but character codes in the source are represented by the Char_Code
520 -- type. Each character literal in the source is interpreted as being one
521 -- of the 2**16 possible Wide_Character codes, and a unique integer value
522 -- is assigned, corresponding to the POS value in the Wide_Character type.
523 -- String literals are similarly interpreted as a sequence of such codes.
525 -- Note: when character code values are stored in the tree, they are stored
526 -- by adding a bias value (Char_Code_Bias) that results in values that can
527 -- be distinguished from other types of values stored in the tree.
529 type Char_Code is mod 2 ** 16;
530 for Char_Code'Size use 16;
532 function Get_Char_Code (C : Character) return Char_Code;
533 pragma Inline (Get_Char_Code);
534 -- Function to obtain internal character code from source character. For
535 -- the moment, the internal character code is simply the Pos value of the
536 -- input source character, but we provide this interface for possible
537 -- later support of alternative character sets.
539 function In_Character_Range (C : Char_Code) return Boolean;
540 pragma Inline (In_Character_Range);
541 -- Determines if the given character code is in range of type Character,
542 -- and if so, returns True. If not, returns False.
544 function Get_Character (C : Char_Code) return Character;
545 pragma Inline (Get_Character);
546 -- For a character C that is in character range (see above function), this
547 -- function returns the corresponding Character value. It is an error to
548 -- call Get_Character if C is not in character range
550 ---------------------------------------
551 -- Types used for Library Management --
552 ---------------------------------------
554 type Unit_Number_Type is new Int;
555 -- Unit number. The main source is unit 0, and subsidiary sources have
556 -- non-zero numbers starting with 1. Unit numbers are used to index the
557 -- file table in Lib.
559 Main_Unit : constant Unit_Number_Type := 0;
560 -- Unit number value for main unit
562 No_Unit : constant Unit_Number_Type := -1;
563 -- Special value used to signal no unit
565 type Source_File_Index is new Nat;
566 -- Type used to index the source file table (see package Sinput)
568 No_Source_File : constant Source_File_Index := 0;
569 -- Value used to indicate no source file present
571 System_Source_File_Index : constant Source_File_Index := 1;
572 -- Value used for source file table entry for system.ads, which is
573 -- always the first source file read (see unit Targparm for details).
575 subtype File_Name_Type is Name_Id;
576 -- File names are stored in the names table and this synonym is used to
577 -- indicate that a Name_Id value is being used to hold a simple file
578 -- name (which does not include any directory information).
580 No_File : constant File_Name_Type := File_Name_Type (No_Name);
581 -- Constant used to indicate no file found
583 subtype Unit_Name_Type is Name_Id;
584 -- Unit names are stored in the names table and this synonym is used to
585 -- indicate that a Name_Id value is being used to hold a unit name.
587 -----------------------------------
588 -- Representation of Time Stamps --
589 -----------------------------------
591 -- All compiled units are marked with a time stamp which is derived from
592 -- the source file (we assume that the host system has the concept of a
593 -- file time stamp which is modified when a file is modified). These
594 -- time stamps are used to ensure consistency of the set of units that
595 -- constitutes a library. Time stamps are 12 character strings with
596 -- with the following format:
598 -- YYYYMMDDHHMMSS
600 -- YYYY year
601 -- MM month (2 digits 01-12)
602 -- DD day (2 digits 01-31)
603 -- HH hour (2 digits 00-23)
604 -- MM minutes (2 digits 00-59)
605 -- SS seconds (2 digits 00-59)
607 -- In the case of Unix systems (and other systems which keep the time in
608 -- GMT), the time stamp is the GMT time of the file, not the local time.
609 -- This solves problems in using libraries across networks with clients
610 -- spread across multiple time-zones.
612 Time_Stamp_Length : constant := 14;
613 -- Length of time stamp value
615 subtype Time_Stamp_Index is Natural range 1 .. Time_Stamp_Length;
616 type Time_Stamp_Type is new String (Time_Stamp_Index);
617 -- Type used to represent time stamp
619 Empty_Time_Stamp : constant Time_Stamp_Type := (others => ' ');
620 -- Type used to represent an empty or missing time stamp. Looks less
621 -- than any real time stamp if two time stamps are compared. Note that
622 -- although this is not a private type, clients should not rely on the
623 -- exact way in which this string is represented, and instead should
624 -- use the subprograms below.
626 Dummy_Time_Stamp : constant Time_Stamp_Type := (others => '0');
627 -- This is used for dummy time stamp values used in the D lines for
628 -- non-existant files, and is intended to be an impossible value.
630 function "=" (Left, Right : Time_Stamp_Type) return Boolean;
631 function "<=" (Left, Right : Time_Stamp_Type) return Boolean;
632 function ">=" (Left, Right : Time_Stamp_Type) return Boolean;
633 function "<" (Left, Right : Time_Stamp_Type) return Boolean;
634 function ">" (Left, Right : Time_Stamp_Type) return Boolean;
635 -- Comparison functions on time stamps. Note that two time stamps
636 -- are defined as being equal if they have the same day/month/year
637 -- and the hour/minutes/seconds values are within 2 seconds of one
638 -- another. This deals with rounding effects in library file time
639 -- stamps caused by copying operations during installation. We have
640 -- particularly noticed that WinNT seems susceptible to such changes.
641 -- Note: the Empty_Time_Stamp value looks equal to itself, and less
642 -- than any non-empty time stamp value.
644 procedure Split_Time_Stamp
645 (TS : Time_Stamp_Type;
646 Year : out Nat;
647 Month : out Nat;
648 Day : out Nat;
649 Hour : out Nat;
650 Minutes : out Nat;
651 Seconds : out Nat);
652 -- Given a time stamp, decompose it into its components
654 procedure Make_Time_Stamp
655 (Year : Nat;
656 Month : Nat;
657 Day : Nat;
658 Hour : Nat;
659 Minutes : Nat;
660 Seconds : Nat;
661 TS : out Time_Stamp_Type);
662 -- Given the components of a time stamp, initialize the value
664 -----------------------------------------------
665 -- Types used for Pragma Suppress Management --
666 -----------------------------------------------
668 -- The following record contains an entry for each recognized check name
669 -- for pragma Suppress. It is used to represent current settings of scope
670 -- based suppress actions from pragma Suppress or command line settings.
672 type Suppress_Record is record
673 Access_Checks : Boolean;
674 Accessibility_Checks : Boolean;
675 Discriminant_Checks : Boolean;
676 Division_Checks : Boolean;
677 Elaboration_Checks : Boolean;
678 Index_Checks : Boolean;
679 Length_Checks : Boolean;
680 Overflow_Checks : Boolean;
681 Range_Checks : Boolean;
682 Storage_Checks : Boolean;
683 Tag_Checks : Boolean;
684 end record;
686 -- To add a new check type to GNAT, the following steps are required:
688 -- 1. Add an appropriate entry to the above record type
689 -- 2. Add an entry to Snames spec and body for the new name
690 -- 3. Add an entry to the definition of Check_Id in the Snames spec
691 -- 4. Add a new entity flag definition in Einfo for the check
692 -- 5. Add a new function to Sem.Util to handle the new check test
693 -- 6. Add appropriate processing for pragma Suppress in Sem.Prag
694 -- 7. Add a branch to the case statement in Sem.Ch8.Pop_Scope
695 -- 8. Add a new Do_xxx_Check flag to Sinfo (if required)
696 -- 9. Add appropriate checks for the new test
698 -----------------------------------
699 -- Global Exception Declarations --
700 -----------------------------------
702 -- This section contains declarations of exceptions that are used
703 -- throughout the compiler.
705 Unrecoverable_Error : exception;
706 -- This exception is raised to immediately terminate the compilation
707 -- of the current source program. Used in situations where things are
708 -- bad enough that it doesn't seem worth continuing (e.g. max errors
709 -- reached, or a required file is not found). Also raised when the
710 -- compiler finds itself in trouble after an error (see Comperr).
712 ---------------------------------
713 -- Parameter Mechanism Control --
714 ---------------------------------
716 -- Function and parameter entities have a field that records the
717 -- passing mechanism. See specification of Sem_Mech for full details.
718 -- The following subtype is used to represent values of this type:
720 subtype Mechanism_Type is Int range -10 .. Int'Last;
721 -- Type used to represent a mechanism value. This is a subtype rather
722 -- than a type to avoid some annoying processing problems with certain
723 -- routines in Einfo (processing them to create the corresponding C).
725 ------------------------------
726 -- Run-Time Exception Codes --
727 ------------------------------
729 -- When the code generator generates a run-time exception, it provides
730 -- a reason code which is one of the following. This reason code is used
731 -- to select the appropriate run-time routine to be called, determining
732 -- both the exception to be raised, and the message text to be added.
734 -- The prefix CE/PE/SE indicates the exception to be raised
735 -- CE = Constraint_Error
736 -- PE = Program_Error
737 -- SE = Storage_Error
739 -- The remaining part of the name indicates the message text to be added,
740 -- where all letters are lower case, and underscores are converted to
741 -- spaces (for example CE_Invalid_Data adds the text "invalid data").
743 -- To add a new code, you need to do the following:
745 -- 1. Modify the type and subtype declarations below appropriately,
746 -- keeping things in alphabetical order.
748 -- 2. Modify the corresponding definitions in a-types.h, including
749 -- the definition of last_reason_code.
751 -- 3. Add a new routine in Ada.Exceptions with the appropriate call
752 -- and static string constant
754 -- 4. Initialize the new entry in raise_decls
756 type RT_Exception_Code is (
757 CE_Access_Check_Failed,
758 CE_Access_Parameter_Is_Null,
759 CE_Discriminant_Check_Failed,
760 CE_Divide_By_Zero,
761 CE_Explicit_Raise,
762 CE_Index_Check_Failed,
763 CE_Invalid_Data,
764 CE_Length_Check_Failed,
765 CE_Overflow_Check_Failed,
766 CE_Partition_Check_Failed,
767 CE_Range_Check_Failed,
768 CE_Tag_Check_Failed,
770 PE_Access_Before_Elaboration,
771 PE_Accessibility_Check_Failed,
772 PE_All_Guards_Closed,
773 PE_Duplicated_Entry_Address,
774 PE_Explicit_Raise,
775 PE_Finalize_Raised_Exception,
776 PE_Invalid_Data,
777 PE_Misaligned_Address_Value,
778 PE_Missing_Return,
779 PE_Potentially_Blocking_Operation,
780 PE_Stubbed_Subprogram_Called,
781 PE_Unchecked_Union_Restriction,
783 SE_Empty_Storage_Pool,
784 SE_Explicit_Raise,
785 SE_Infinite_Recursion,
786 SE_Object_Too_Large,
787 SE_Restriction_Violation);
789 subtype RT_CE_Exceptions is RT_Exception_Code range
790 CE_Access_Check_Failed ..
791 CE_Tag_Check_Failed;
793 subtype RT_PE_Exceptions is RT_Exception_Code range
794 PE_Access_Before_Elaboration ..
795 PE_Unchecked_Union_Restriction;
797 subtype RT_SE_Exceptions is RT_Exception_Code range
798 SE_Empty_Storage_Pool ..
799 SE_Restriction_Violation;
801 end Types;