* c-decl.c (duplicate_decls): Conditionalize DECL_SAVED_TREE copy.
[official-gcc.git] / gcc / ada / types.ads
blob53c47c3fb95f1fd982162c16a104c2954cff8640
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- T Y P E S --
6 -- --
7 -- S p e c --
8 -- --
9 -- $Revision: 1.2 $
10 -- --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
12 -- --
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. --
23 -- --
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. --
30 -- --
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). --
33 -- --
34 ------------------------------------------------------------------------------
36 with Unchecked_Deallocation;
38 package Types is
39 pragma Preelaborate (Types);
41 -- This package contains host independent type definitions which are used
42 -- in more than one unit in the compiler. They are gathered here for easy
43 -- reference, though in some cases the full description is found in the
44 -- relevant module which implements the definition. The main reason that
45 -- they are not in their "natural" specs is that this would cause a lot of
46 -- inter-spec dependencies, and in particular some awkward circular
47 -- dependencies would have to be dealt with.
49 -- WARNING: There is a C version of this package. Any changes to this
50 -- source file must be properly reflected in the C header file a-types.h
52 -- Note: the declarations in this package reflect an expectation that the
53 -- host machine has an efficient integer base type with a range at least
54 -- 32 bits 2s-complement. If there are any machines for which this is not
55 -- a correct assumption, a significant number of changes will be required!
57 -------------------------------
58 -- General Use Integer Types --
59 -------------------------------
61 type Int is range -2 ** 31 .. +2 ** 31 - 1;
62 -- Signed 32-bit integer
64 type Dint is range -2 ** 63 .. +2 ** 63 - 1;
65 -- Double length (64-bit) integer
67 subtype Nat is Int range 0 .. Int'Last;
68 -- Non-negative Int values
70 subtype Pos is Int range 1 .. Int'Last;
71 -- Positive Int values
73 type Word is mod 2 ** 32;
74 -- Unsigned 32-bit integer
76 type Short is range -32768 .. +32767;
77 for Short'Size use 16;
78 -- 16-bit signed integer
80 type Byte is mod 2 ** 8;
81 for Byte'Size use 8;
82 -- 8-bit unsigned integer
84 type size_t is mod 2 ** Standard'Address_Size;
85 -- Memory size value, for use in calls to C routines
87 --------------------------------------
88 -- 8-Bit Character and String Types --
89 --------------------------------------
91 -- We use Standard.Character and Standard.String freely, since we are
92 -- compiling ourselves, and we properly implement the required 8-bit
93 -- character code as required in Ada 95. This section defines a few
94 -- general use constants and subtypes.
96 EOF : constant Character := ASCII.SUB;
97 -- The character SUB (16#1A#) is used in DOS and other systems derived
98 -- from DOS (OS/2, NT etc) to signal the end of a text file. Internally
99 -- all source files are ended by an EOF character, even on Unix systems.
100 -- An EOF character acts as the end of file only as the last character
101 -- of a source buffer, in any other position, it is treated as a blank
102 -- if it appears between tokens, and as an illegal character otherwise.
103 -- This makes life easier dealing with files that originated from DOS,
104 -- including concatenated files with interspersed EOF characters.
106 subtype Graphic_Character is Character range ' ' .. '~';
107 -- Graphic characters, as defined in ARM
109 subtype Line_Terminator is Character range ASCII.LF .. ASCII.CR;
110 -- Line terminator characters (LF, VT, FF, CR)
112 subtype Upper_Half_Character is
113 Character range Character'Val (16#80#) .. Character'Val (16#FF#);
114 -- Characters with the upper bit set
116 type Character_Ptr is access all Character;
117 type String_Ptr is access all String;
118 -- Standard character and string pointers
120 procedure Free is new Unchecked_Deallocation (String, String_Ptr);
121 -- Procedure for freeing dynamically allocated String values
123 subtype Word_Hex_String is String (1 .. 8);
124 -- Type used to represent Word value as 8 hex digits, with lower case
125 -- letters for the alphabetic cases.
127 function Get_Hex_String (W : Word) return Word_Hex_String;
128 -- Convert word value to 8-character hex string
130 -----------------------------------------
131 -- Types Used for Text Buffer Handling --
132 -----------------------------------------
134 -- We can't use type String for text buffers, since we must use the
135 -- standard 32-bit integer as an index value, since we count on all
136 -- index values being the same size.
138 type Text_Ptr is new Int;
139 -- Type used for subscripts in text buffer
141 type Text_Buffer is array (Text_Ptr range <>) of Character;
142 -- Text buffer used to hold source file or library information file
144 type Text_Buffer_Ptr is access all Text_Buffer;
145 -- Text buffers for input files are allocated dynamically and this type
146 -- is used to reference these text buffers.
148 procedure Free is new Unchecked_Deallocation (Text_Buffer, Text_Buffer_Ptr);
149 -- Procedure for freeing dynamically allocated text buffers
151 ------------------------------------------
152 -- Types Used for Source Input Handling --
153 ------------------------------------------
155 type Logical_Line_Number is range 0 .. Int'Last;
156 for Logical_Line_Number'Size use 32;
157 -- Line number type, used for storing logical line numbers (i.e. line
158 -- numbers that include effects of any Source_Reference pragmas in the
159 -- source file). The value zero indicates a line containing a source
160 -- reference pragma.
162 No_Line_Number : constant Logical_Line_Number := 0;
163 -- Special value used to indicate no line number
165 type Physical_Line_Number is range 1 .. Int'Last;
166 for Physical_Line_Number'Size use 32;
167 -- Line number type, used for storing physical line numbers (i.e.
168 -- line numbers in the physical file being compiled, unaffected by
169 -- the presence of source reference pragmas.
171 type Column_Number is range 0 .. 32767;
172 for Column_Number'Size use 16;
173 -- Column number (assume that 2**15 is large enough, see declaration
174 -- of Hostparm.Max_Line_Length)
176 No_Column_Number : constant Column_Number := 0;
177 -- Special value used to indicate no column number
179 subtype Source_Buffer is Text_Buffer;
180 -- Type used to store text of a source file . The buffer for the main
181 -- source (the source specified on the command line) has a lower bound
182 -- starting at zero. Subsequent subsidiary sources have lower bounds
183 -- which are one greater than the previous upper bound.
185 subtype Big_Source_Buffer is Text_Buffer (0 .. Text_Ptr'Last);
186 -- This is a virtual type used as the designated type of the access
187 -- type Source_Buffer_Ptr, see Osint.Read_Source_File for details.
189 type Source_Buffer_Ptr is access all Big_Source_Buffer;
190 -- Pointer to source buffer. We use virtual origin addressing for
191 -- source buffers, with thin pointers. The pointer points to a virtual
192 -- instance of type Big_Source_Buffer, where the actual type is in fact
193 -- of type Source_Buffer. The address is adjusted so that the virtual
194 -- origin addressing works correctly. See Osint.Read_Source_Buffer for
195 -- further details.
197 subtype Source_Ptr is Text_Ptr;
198 -- Type used to represent a source location, which is a subscript of a
199 -- character in the source buffer. As noted above, diffferent source
200 -- buffers have different ranges, so it is possible to tell from a
201 -- Source_Ptr value which source it refers to. Note that negative numbers
202 -- are allowed to accommodate the following special values.
204 No_Location : constant Source_Ptr := -1;
205 -- Value used to indicate no source position set in a node
207 Standard_Location : constant Source_Ptr := -2;
208 -- Used for all nodes in the representation of package Standard other
209 -- than nodes representing the contents of Standard.ASCII. Note that
210 -- testing for <= Standard_Location tests for both Standard_Location
211 -- and for Standard_ASCII_Location.
213 Standard_ASCII_Location : constant Source_Ptr := -3;
214 -- Used for all nodes in the presentation of package Standard.ASCII
216 First_Source_Ptr : constant Source_Ptr := 0;
217 -- Starting source pointer index value for first source program
219 -------------------------------------
220 -- Range Definitions for Tree Data --
221 -------------------------------------
223 -- The tree has fields that can hold any of the following types:
225 -- Pointers to other tree nodes (type Node_Id)
226 -- List pointers (type List_Id)
227 -- Element list pointers (type Elist_Id)
228 -- Names (type Name_Id)
229 -- Strings (type String_Id)
230 -- Universal integers (type Uint)
231 -- Universal reals (type Ureal)
232 -- Character codes (type Char_Code stored with a bias)
234 -- In most contexts, the strongly typed interface determines which of
235 -- these types is present. However, there are some situations (involving
236 -- untyped traversals of the tree), where it is convenient to be easily
237 -- able to distinguish these values. The underlying representation in all
238 -- cases is an integer type Union_Id, and we ensure that the range of
239 -- the various possible values for each of the above types is disjoint
240 -- so that this distinction is possible.
242 type Union_Id is new Int;
243 -- The type in the tree for a union of possible ID values
245 -- Note: it is also helpful for debugging purposes to make these ranges
246 -- distinct. If a bug leads to misidentification of a value, then it will
247 -- typically result in an out of range value and a Constraint_Error.
249 List_Low_Bound : constant := -100_000_000;
250 -- The List_Id values are subscripts into an array of list headers which
251 -- has List_Low_Bound as its lower bound. This value is chosen so that all
252 -- List_Id values are negative, and the value zero is in the range of both
253 -- List_Id and Node_Id values (see further description below).
255 List_High_Bound : constant := 0;
256 -- Maximum List_Id subscript value. This allows up to 100 million list
257 -- Id values, which is in practice infinite, and there is no need to
258 -- check the range. The range overlaps the node range by one element
259 -- (with value zero), which is used both for the Empty node, and for
260 -- indicating no list. The fact that the same value is used is convenient
261 -- because it means that the default value of Empty applies to both nodes
262 -- and lists, and also is more efficient to test for.
264 Node_Low_Bound : constant := 0;
265 -- The tree Id values start at zero, because we use zero for Empty (to
266 -- allow a zero test for Empty). Actual tree node subscripts start at 0
267 -- since Empty is a legitimate node value.
269 Node_High_Bound : constant := 099_999_999;
270 -- Maximum number of nodes that can be allocated is 100 million, which
271 -- is in practice infinite, and there is no need to check the range.
273 Elist_Low_Bound : constant := 100_000_000;
274 -- The Elist_Id values are subscripts into an array of elist headers which
275 -- has Elist_Low_Bound as its lower bound.
277 Elist_High_Bound : constant := 199_999_999;
278 -- Maximum Elist_Id subscript value. This allows up to 100 million Elists,
279 -- which is in practice infinite and there is no need to check the range.
281 Elmt_Low_Bound : constant := 200_000_000;
282 -- Low bound of element Id values. The use of these values is internal to
283 -- the Elists package, but the definition of the range is included here
284 -- since it must be disjoint from other Id values. The Elmt_Id values are
285 -- subscripts into an array of list elements which has this as lower bound.
287 Elmt_High_Bound : constant := 299_999_999;
288 -- Upper bound of Elmt_Id values. This allows up to 100 million element
289 -- list members, which is in practice infinite (no range check needed).
291 Names_Low_Bound : constant := 300_000_000;
292 -- Low bound for name Id values
294 Names_High_Bound : constant := 399_999_999;
295 -- Maximum number of names that can be allocated is 100 million, which is
296 -- in practice infinite and there is no need to check the range.
298 Strings_Low_Bound : constant := 400_000_000;
299 -- Low bound for string Id values
301 Strings_High_Bound : constant := 499_999_999;
302 -- Maximum number of strings that can be allocated is 100 million, which
303 -- is in practice infinite and there is no need to check the range.
305 Ureal_Low_Bound : constant := 500_000_000;
306 -- Low bound for Ureal values.
308 Ureal_High_Bound : constant := 599_999_999;
309 -- Maximum number of Ureal values stored is 100_000_000 which is in
310 -- practice infinite so that no check is required.
312 Uint_Low_Bound : constant := 600_000_000;
313 -- Low bound for Uint values.
315 Uint_Table_Start : constant := 2_000_000_000;
316 -- Location where table entries for universal integers start (see
317 -- Uintp spec for details of the representation of Uint values).
319 Uint_High_Bound : constant := 2_099_999_999;
320 -- The range of Uint values is very large, since a substantial part
321 -- of this range is used to store direct values, see Uintp for details.
323 Char_Code_Bias : constant := 2_100_000_000;
324 -- A bias value added to character code values stored in the tree which
325 -- ensures that they have different values from any of the above types.
327 -- The following subtype definitions are used to provide convenient names
328 -- for membership tests on Int values to see what data type range they
329 -- lie in. Such tests appear only in the lowest level packages.
331 subtype List_Range is Union_Id
332 range List_Low_Bound .. List_High_Bound;
334 subtype Node_Range is Union_Id
335 range Node_Low_Bound .. Node_High_Bound;
337 subtype Elist_Range is Union_Id
338 range Elist_Low_Bound .. Elist_High_Bound;
340 subtype Elmt_Range is Union_Id
341 range Elmt_Low_Bound .. Elmt_High_Bound;
343 subtype Names_Range is Union_Id
344 range Names_Low_Bound .. Names_High_Bound;
346 subtype Strings_Range is Union_Id
347 range Strings_Low_Bound .. Strings_High_Bound;
349 subtype Uint_Range is Union_Id
350 range Uint_Low_Bound .. Uint_High_Bound;
352 subtype Ureal_Range is Union_Id
353 range Ureal_Low_Bound .. Ureal_High_Bound;
355 subtype Char_Code_Range is Union_Id
356 range Char_Code_Bias .. Char_Code_Bias + 2**16 - 1;
358 -----------------------------
359 -- Types for Namet Package --
360 -----------------------------
362 -- Name_Id values are used to identify entries in the names table. Except
363 -- for the special values No_Name, and Error_Name, they are subscript
364 -- values for the Names table defined in package Namet.
366 -- Note that with only a few exceptions, which are clearly documented, the
367 -- type Name_Id should be regarded as a private type. In particular it is
368 -- never appropriate to perform arithmetic operations using this type.
370 type Name_Id is range Names_Low_Bound .. Names_High_Bound;
371 for Name_Id'Size use 32;
372 -- Type used to identify entries in the names table
374 No_Name : constant Name_Id := Names_Low_Bound;
375 -- The special Name_Id value No_Name is used in the parser to indicate
376 -- a situation where no name is present (e.g. on a loop or block).
378 Error_Name : constant Name_Id := Names_Low_Bound + 1;
379 -- The special Name_Id value Error_Name is used in the parser to
380 -- indicate that some kind of error was encountered in scanning out
381 -- the relevant name, so it does not have a representable label.
383 First_Name_Id : constant Name_Id := Names_Low_Bound + 2;
384 -- Subscript of first entry in names table
386 ----------------------------
387 -- Types for Atree Package --
388 ----------------------------
390 -- Node_Id values are used to identify nodes in the tree. They are
391 -- subscripts into the Node table declared in package Tree. Note that
392 -- the special values Empty and Error are subscripts into this table,
393 -- See package Atree for further details.
395 type Node_Id is range Node_Low_Bound .. Node_High_Bound;
396 -- Type used to identify nodes in the tree
398 subtype Entity_Id is Node_Id;
399 -- A synonym for node types, used in the entity package to refer to
400 -- nodes that are entities (i.e. nodes with an Nkind of N_Defining_xxx)
401 -- All such nodes are extended nodes and these are the only extended
402 -- nodes, so that in practice entity and extended nodes are synonymous.
404 subtype Node_Or_Entity_Id is Node_Id;
405 -- A synonym for node types, used in cases where a given value may be used
406 -- to represent either a node or an entity. We like to minimize such uses
407 -- for obvious reasons of logical type consistency, but where such uses
408 -- occur, they should be documented by use of this type.
410 Empty : constant Node_Id := Node_Low_Bound;
411 -- Used to indicate null node. A node is actually allocated with this
412 -- Id value, so that Nkind (Empty) = N_Empty. Note that Node_Low_Bound
413 -- is zero, so Empty = No_List = zero.
415 Empty_List_Or_Node : constant := 0;
416 -- This constant is used in situations (e.g. initializing empty fields)
417 -- where the value set will be used to represent either an empty node
418 -- or a non-existent list, depending on the context.
420 Error : constant Node_Id := Node_Low_Bound + 1;
421 -- Used to indicate that there was an error in the source program. A node
422 -- is actually allocated at this address, so that Nkind (Error) = N_Error.
424 Empty_Or_Error : constant Node_Id := Error;
425 -- Since Empty and Error are the first two Node_Id values, the test for
426 -- N <= Empty_Or_Error tests to see if N is Empty or Error. This definition
427 -- provides convenient self-documentation for such tests.
429 First_Node_Id : constant Node_Id := Node_Low_Bound;
430 -- Subscript of first allocated node. Note that Empty and Error are both
431 -- allocated nodes, whose Nkind fields can be accessed without error.
433 ------------------------------
434 -- Types for Nlists Package --
435 ------------------------------
437 -- List_Id values are used to identify node lists in the tree. They are
438 -- subscripts into the Lists table declared in package Tree. Note that
439 -- the special value Error_List is a subscript in this table, but the
440 -- value No_List is *not* a valid subscript, and any attempt to apply
441 -- list operations to No_List will cause a (detected) error.
443 type List_Id is range List_Low_Bound .. List_High_Bound;
444 -- Type used to identify a node list
446 No_List : constant List_Id := List_High_Bound;
447 -- Used to indicate absence of a list. Note that the value is zero, which
448 -- is the same as Empty, which is helpful in intializing nodes where a
449 -- value of zero can represent either an empty node or an empty list.
451 Error_List : constant List_Id := List_Low_Bound;
452 -- Used to indicate that there was an error in the source program in a
453 -- context which would normally require a list. This node appears to be
454 -- an empty list to the list operations (a null list is actually allocated
455 -- which has this Id value).
457 First_List_Id : constant List_Id := Error_List;
458 -- Subscript of first allocated list header
460 ------------------------------
461 -- Types for Elists Package --
462 ------------------------------
464 -- Element list Id values are used to identify element lists stored in
465 -- the tree (see package Tree for further details). They are formed by
466 -- adding a bias (Element_List_Bias) to subscript values in the same
467 -- array that is used for node list headers.
469 type Elist_Id is range Elist_Low_Bound .. Elist_High_Bound;
470 -- Type used to identify an element list (Elist header table subscript)
472 No_Elist : constant Elist_Id := Elist_Low_Bound;
473 -- Used to indicate absense of an element list. Note that this is not
474 -- an actual Elist header, so element list operations on this value
475 -- are not valid.
477 First_Elist_Id : constant Elist_Id := No_Elist + 1;
478 -- Subscript of first allocated Elist header.
480 -- Element Id values are used to identify individual elements of an
481 -- element list (see package Elists for further details).
483 type Elmt_Id is range Elmt_Low_Bound .. Elmt_High_Bound;
484 -- Type used to identify an element list
486 No_Elmt : constant Elmt_Id := Elmt_Low_Bound;
487 -- Used to represent empty element
489 First_Elmt_Id : constant Elmt_Id := No_Elmt + 1;
490 -- Subscript of first allocated Elmt table entry
492 -------------------------------
493 -- Types for Stringt Package --
494 -------------------------------
496 -- String_Id values are used to identify entries in the strings table.
497 -- They are subscripts into the strings table defined in package Strings.
499 -- Note that with only a few exceptions, which are clearly documented, the
500 -- type String_Id should be regarded as a private type. In particular it is
501 -- never appropriate to perform arithmetic operations using this type.
503 type String_Id is range Strings_Low_Bound .. Strings_High_Bound;
504 -- Type used to identify entries in the strings table
506 No_String : constant String_Id := Strings_Low_Bound;
507 -- Used to indicate missing string Id. Note that the value zero is used
508 -- to indicate a missing data value for all the Int types in this section.
510 First_String_Id : constant String_Id := No_String + 1;
511 -- First subscript allocated in string table
513 -------------------------
514 -- Character Code Type --
515 -------------------------
517 -- The type Char is used for character data internally in the compiler,
518 -- but character codes in the source are represented by the Char_Code
519 -- type. Each character literal in the source is interpreted as being one
520 -- of the 2**16 possible Wide_Character codes, and a unique integer value
521 -- is assigned, corresponding to the POS value in the Wide_Character type.
522 -- String literals are similarly interpreted as a sequence of such codes.
524 -- Note: when character code values are stored in the tree, they are stored
525 -- by adding a bias value (Char_Code_Bias) that results in values that can
526 -- be distinguished from other types of values stored in the tree.
528 type Char_Code is mod 2 ** 16;
529 for Char_Code'Size use 16;
531 function Get_Char_Code (C : Character) return Char_Code;
532 pragma Inline (Get_Char_Code);
533 -- Function to obtain internal character code from source character. For
534 -- the moment, the internal character code is simply the Pos value of the
535 -- input source character, but we provide this interface for possible
536 -- later support of alternative character sets.
538 function In_Character_Range (C : Char_Code) return Boolean;
539 pragma Inline (In_Character_Range);
540 -- Determines if the given character code is in range of type Character,
541 -- and if so, returns True. If not, returns False.
543 function Get_Character (C : Char_Code) return Character;
544 pragma Inline (Get_Character);
545 -- For a character C that is in character range (see above function), this
546 -- function returns the corresponding Character value. It is an error to
547 -- call Get_Character if C is not in character range
549 ---------------------------------------
550 -- Types used for Library Management --
551 ---------------------------------------
553 type Unit_Number_Type is new Int;
554 -- Unit number. The main source is unit 0, and subsidiary sources have
555 -- non-zero numbers starting with 1. Unit numbers are used to index the
556 -- file table in Lib.
558 Main_Unit : constant Unit_Number_Type := 0;
559 -- Unit number value for main unit
561 No_Unit : constant Unit_Number_Type := -1;
562 -- Special value used to signal no unit
564 type Source_File_Index is new Nat;
565 -- Type used to index the source file table (see package Sinput)
567 No_Source_File : constant Source_File_Index := 0;
568 -- Value used to indicate no source file present
570 System_Source_File_Index : constant Source_File_Index := 1;
571 -- Value used for source file table entry for system.ads, which is
572 -- always the first source file read (see unit Targparm for details).
574 subtype File_Name_Type is Name_Id;
575 -- File names are stored in the names table and this synonym is used to
576 -- indicate that a Name_Id value is being used to hold a simple file
577 -- name (which does not include any directory information).
579 No_File : constant File_Name_Type := File_Name_Type (No_Name);
580 -- Constant used to indicate no file found
582 subtype Unit_Name_Type is Name_Id;
583 -- Unit names are stored in the names table and this synonym is used to
584 -- indicate that a Name_Id value is being used to hold a unit name.
586 -----------------------------------
587 -- Representation of Time Stamps --
588 -----------------------------------
590 -- All compiled units are marked with a time stamp which is derived from
591 -- the source file (we assume that the host system has the concept of a
592 -- file time stamp which is modified when a file is modified). These
593 -- time stamps are used to ensure consistency of the set of units that
594 -- constitutes a library. Time stamps are 12 character strings with
595 -- with the following format:
597 -- YYYYMMDDHHMMSS
599 -- YYYY year
600 -- MM month (2 digits 01-12)
601 -- DD day (2 digits 01-31)
602 -- HH hour (2 digits 00-23)
603 -- MM minutes (2 digits 00-59)
604 -- SS seconds (2 digits 00-59)
606 -- In the case of Unix systems (and other systems which keep the time in
607 -- GMT), the time stamp is the GMT time of the file, not the local time.
608 -- This solves problems in using libraries across networks with clients
609 -- spread across multiple time-zones.
611 Time_Stamp_Length : constant := 14;
612 -- Length of time stamp value
614 subtype Time_Stamp_Index is Natural range 1 .. Time_Stamp_Length;
615 type Time_Stamp_Type is new String (Time_Stamp_Index);
616 -- Type used to represent time stamp
618 Empty_Time_Stamp : constant Time_Stamp_Type := (others => ' ');
619 -- Type used to represent an empty or missing time stamp. Looks less
620 -- than any real time stamp if two time stamps are compared. Note that
621 -- although this is not a private type, clients should not rely on the
622 -- exact way in which this string is represented, and instead should
623 -- use the subprograms below.
625 function "=" (Left, Right : Time_Stamp_Type) return Boolean;
626 function "<=" (Left, Right : Time_Stamp_Type) return Boolean;
627 function ">=" (Left, Right : Time_Stamp_Type) return Boolean;
628 function "<" (Left, Right : Time_Stamp_Type) return Boolean;
629 function ">" (Left, Right : Time_Stamp_Type) return Boolean;
630 -- Comparison functions on time stamps. Note that two time stamps
631 -- are defined as being equal if they have the same day/month/year
632 -- and the hour/minutes/seconds values are within 2 seconds of one
633 -- another. This deals with rounding effects in library file time
634 -- stamps caused by copying operations during installation. We have
635 -- particularly noticed that WinNT seems susceptible to such changes.
636 -- Note: the Empty_Time_Stamp value looks equal to itself, and less
637 -- than any non-empty time stamp value.
639 procedure Split_Time_Stamp
640 (TS : Time_Stamp_Type;
641 Year : out Nat;
642 Month : out Nat;
643 Day : out Nat;
644 Hour : out Nat;
645 Minutes : out Nat;
646 Seconds : out Nat);
647 -- Given a time stamp, decompose it into its components
649 procedure Make_Time_Stamp
650 (Year : Nat;
651 Month : Nat;
652 Day : Nat;
653 Hour : Nat;
654 Minutes : Nat;
655 Seconds : Nat;
656 TS : out Time_Stamp_Type);
657 -- Given the components of a time stamp, initialize the value
659 -----------------------------------------------
660 -- Types used for Pragma Suppress Management --
661 -----------------------------------------------
663 -- The following record contains an entry for each recognized check name
664 -- for pragma Suppress. It is used to represent current settings of scope
665 -- based suppress actions from pragma Suppress or command line settings.
667 type Suppress_Record is record
668 Access_Checks : Boolean;
669 Accessibility_Checks : Boolean;
670 Discriminant_Checks : Boolean;
671 Division_Checks : Boolean;
672 Elaboration_Checks : Boolean;
673 Index_Checks : Boolean;
674 Length_Checks : Boolean;
675 Overflow_Checks : Boolean;
676 Range_Checks : Boolean;
677 Storage_Checks : Boolean;
678 Tag_Checks : Boolean;
679 end record;
681 -- To add a new check type to GNAT, the following steps are required:
683 -- 1. Add an appropriate entry to the above record type
684 -- 2. Add an entry to Snames spec and body for the new name
685 -- 3. Add an entry to the definition of Check_Id in the Snames spec
686 -- 4. Add a new entity flag definition in Einfo for the check
687 -- 5. Add a new function to Sem.Util to handle the new check test
688 -- 6. Add appropriate processing for pragma Suppress in Sem.Prag
689 -- 7. Add a branch to the case statement in Sem.Ch8.Pop_Scope
690 -- 8. Add a new Do_xxx_Check flag to Sinfo (if required)
691 -- 9. Add appropriate checks for the new test
693 -----------------------------------
694 -- Global Exception Declarations --
695 -----------------------------------
697 -- This section contains declarations of exceptions that are used
698 -- throughout the compiler.
700 Unrecoverable_Error : exception;
701 -- This exception is raised to immediately terminate the compilation
702 -- of the current source program. Used in situations where things are
703 -- bad enough that it doesn't seem worth continuing (e.g. max errors
704 -- reached, or a required file is not found). Also raised when the
705 -- compiler finds itself in trouble after an error (see Comperr).
707 ---------------------------------
708 -- Parameter Mechanism Control --
709 ---------------------------------
711 -- Function and parameter entities have a field that records the
712 -- passing mechanism. See specification of Sem_Mech for full details.
713 -- The following subtype is used to represent values of this type:
715 subtype Mechanism_Type is Int range -10 .. Int'Last;
716 -- Type used to represent a mechanism value. This is a subtype rather
717 -- than a type to avoid some annoying processing problems with certain
718 -- routines in Einfo (processing them to create the corresponding C).
720 end Types;