| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT COMPILER COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- T Y P E S -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 1992-2025, 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. 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 COPYING3. If not, go to -- |
| 19 |
-- http://www.gnu.org/licenses for a complete copy of the license. -- |
| 20 |
-- -- |
| 21 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 22 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 23 |
-- -- |
| 24 |
------------------------------------------------------------------------------ |
| 25 |
|
| 26 |
-- This package contains host independent type definitions which are used |
| 27 |
-- in more than one unit in the compiler. They are gathered here for easy |
| 28 |
-- reference, although in some cases the full description is found in the |
| 29 |
-- relevant module which implements the definition. The main reason that they |
| 30 |
-- are not in their "natural" specs is that this would cause a lot of inter- |
| 31 |
-- spec dependencies, and in particular some awkward circular dependencies |
| 32 |
-- would have to be dealt with. |
| 33 |
|
| 34 |
-- WARNING: There is a C version of this package. Any changes to this source |
| 35 |
-- file must be properly reflected in the C header file types.h |
| 36 |
|
| 37 |
-- Note: the declarations in this package reflect an expectation that the host |
| 38 |
-- machine has an efficient integer base type with a range at least 32 bits |
| 39 |
-- 2s-complement. If there are any machines for which this is not a correct |
| 40 |
-- assumption, a significant number of changes will be required. |
| 41 |
|
| 42 |
with Ada.Unchecked_Conversion; |
| 43 |
with Ada.Unchecked_Deallocation; |
| 44 |
with System; |
| 45 |
|
| 46 |
package Types is |
| 47 |
pragma Preelaborate; |
| 48 |
|
| 49 |
------------------------------- |
| 50 |
-- General Use Integer Types -- |
| 51 |
------------------------------- |
| 52 |
|
| 53 |
type Int is range -2 ** 31 .. +2 ** 31 - 1; |
| 54 |
-- Signed 32-bit integer |
| 55 |
|
| 56 |
subtype Nat is Int range 0 .. Int'Last; |
| 57 |
-- Non-negative Int values |
| 58 |
|
| 59 |
subtype Pos is Int range 1 .. Int'Last; |
| 60 |
-- Positive Int values |
| 61 |
|
| 62 |
subtype Nonzero_Int is Int with Predicate => Nonzero_Int /= 0; |
| 63 |
|
| 64 |
type Int_64 is range -2 ** 63 .. +2 ** 63 - 1; |
| 65 |
-- Signed 64-bit integer |
| 66 |
|
| 67 |
subtype Nat_64 is Int_64 range 0 .. Int_64'Last; |
| 68 |
subtype Pos_64 is Int_64 range 1 .. Int_64'Last; |
| 69 |
subtype Nonzero_Int_64 is Int_64 with Predicate => Nonzero_Int_64 /= 0; |
| 70 |
|
| 71 |
type Word is mod 2 ** 32; |
| 72 |
-- Unsigned 32-bit integer |
| 73 |
|
| 74 |
type Short is range -32768 .. +32767; |
| 75 |
for Short'Size use 16; |
| 76 |
-- 16-bit signed integer |
| 77 |
|
| 78 |
type Byte is mod 2 ** 8; |
| 79 |
for Byte'Size use 8; |
| 80 |
-- 8-bit unsigned integer |
| 81 |
|
| 82 |
type size_t is mod 2 ** Standard'Address_Size; |
| 83 |
-- Memory size value, for use in calls to C routines |
| 84 |
|
| 85 |
-------------------------------------- |
| 86 |
-- 8-Bit Character and String Types -- |
| 87 |
-------------------------------------- |
| 88 |
|
| 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. |
| 93 |
|
| 94 |
EOF : constant Character := ASCII.SUB; |
| 95 |
-- The character SUB (16#1A#) is used in DOS and other systems derived |
| 96 |
-- from DOS (XP, 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. |
| 103 |
|
| 104 |
subtype Graphic_Character is Character range ' ' .. '~'; |
| 105 |
-- Graphic characters, as defined in ARM |
| 106 |
|
| 107 |
subtype Line_Terminator is Character range ASCII.LF .. ASCII.CR; |
| 108 |
-- Line terminator characters (LF, VT, FF, CR). For further details, see |
| 109 |
-- the extensive discussion of line termination in the Sinput spec. |
| 110 |
|
| 111 |
subtype Upper_Half_Character is |
| 112 |
Character range Character'Val (16#80#) .. Character'Val (16#FF#); |
| 113 |
-- 8-bit Characters with the upper bit set |
| 114 |
|
| 115 |
type Character_Ptr is access all Character; |
| 116 |
type String_Ptr is access all String; |
| 117 |
type String_Ptr_Const is access constant String; |
| 118 |
-- Standard character and string pointers |
| 119 |
|
| 120 |
procedure Free is new Ada.Unchecked_Deallocation (String, String_Ptr); |
| 121 |
-- Procedure for freeing dynamically allocated String values |
| 122 |
|
| 123 |
subtype Big_String is String (Positive); |
| 124 |
type Big_String_Ptr is access all Big_String; |
| 125 |
-- Virtual type for handling imported big strings. Note that we should |
| 126 |
-- never have any allocators for this type, but we don't give a storage |
| 127 |
-- size of zero, since there are legitimate deallocations going on. |
| 128 |
|
| 129 |
function To_Big_String_Ptr is |
| 130 |
new Ada.Unchecked_Conversion (System.Address, Big_String_Ptr); |
| 131 |
-- Used to obtain Big_String_Ptr values from external addresses |
| 132 |
|
| 133 |
subtype Word_Hex_String is String (1 .. 8); |
| 134 |
-- Type used to represent Word value as 8 hex digits, with lower case |
| 135 |
-- letters for the alphabetic cases. |
| 136 |
|
| 137 |
function Get_Hex_String (W : Word) return Word_Hex_String; |
| 138 |
-- Convert word value to 8-character hex string |
| 139 |
|
| 140 |
----------------------------------------- |
| 141 |
-- Types Used for Text Buffer Handling -- |
| 142 |
----------------------------------------- |
| 143 |
|
| 144 |
-- We cannot use type String for text buffers, since we must use the |
| 145 |
-- standard 32-bit integer as an index value, since we count on all index |
| 146 |
-- values being the same size. |
| 147 |
|
| 148 |
type Text_Ptr is new Int range -4 .. Int'Last; |
| 149 |
-- -4 .. -1 are special; see constants below |
| 150 |
type Text_Buffer is array (Text_Ptr range <>) of aliased Character; |
| 151 |
-- Text buffer used to hold source file or library information file |
| 152 |
|
| 153 |
type Text_Buffer_Ptr is access all Text_Buffer; |
| 154 |
-- Text buffers for input files are allocated dynamically and this type |
| 155 |
-- is used to reference these text buffers. |
| 156 |
|
| 157 |
procedure Free is |
| 158 |
new Ada.Unchecked_Deallocation (Text_Buffer, Text_Buffer_Ptr); |
| 159 |
-- Procedure for freeing dynamically allocated text buffers |
| 160 |
|
| 161 |
------------------------------------------ |
| 162 |
-- Types Used for Source Input Handling -- |
| 163 |
------------------------------------------ |
| 164 |
|
| 165 |
type Logical_Line_Number is range 0 .. Int'Last; |
| 166 |
for Logical_Line_Number'Size use 32; |
| 167 |
-- Line number type, used for storing logical line numbers (i.e. line |
| 168 |
-- numbers that include effects of any Source_Reference pragmas in the |
| 169 |
-- source file). The value zero indicates a line containing a source |
| 170 |
-- reference pragma. |
| 171 |
|
| 172 |
No_Line_Number : constant Logical_Line_Number := 0; |
| 173 |
-- Special value used to indicate no line number |
| 174 |
|
| 175 |
type Physical_Line_Number is range 1 .. Int'Last; |
| 176 |
for Physical_Line_Number'Size use 32; |
| 177 |
-- Line number type, used for storing physical line numbers (i.e. line |
| 178 |
-- numbers in the physical file being compiled, unaffected by the presence |
| 179 |
-- of source reference pragmas). |
| 180 |
|
| 181 |
type Column_Number is range 0 .. 32767; |
| 182 |
for Column_Number'Size use 16; |
| 183 |
-- Column number (assume that 2**15 - 1 is large enough). The range for |
| 184 |
-- this type is used to compute Hostparm.Max_Line_Length. See also the |
| 185 |
-- processing for -gnatyM in Stylesw). |
| 186 |
|
| 187 |
No_Column_Number : constant Column_Number := 0; |
| 188 |
-- Special value used to indicate no column number |
| 189 |
|
| 190 |
Source_Align : constant := 2 ** 12; |
| 191 |
-- Alignment requirement for source buffers (by keeping source buffers |
| 192 |
-- aligned, we can optimize the implementation of Get_Source_File_Index. |
| 193 |
-- See this routine in Sinput for details. |
| 194 |
|
| 195 |
subtype Source_Buffer is Text_Buffer; |
| 196 |
-- Type used to store text of a source file. The buffer for the main |
| 197 |
-- source (the source specified on the command line) has a lower bound |
| 198 |
-- starting at zero. Subsequent subsidiary sources have lower bounds |
| 199 |
-- which are one greater than the previous upper bound, rounded up to |
| 200 |
-- a multiple of Source_Align. |
| 201 |
|
| 202 |
type Source_Buffer_Ptr_Var is access all Source_Buffer; |
| 203 |
type Source_Buffer_Ptr is access constant Source_Buffer; |
| 204 |
-- Pointer to source buffer. Source_Buffer_Ptr_Var is used for allocation |
| 205 |
-- and deallocation; Source_Buffer_Ptr is used for all other uses of source |
| 206 |
-- buffers. |
| 207 |
|
| 208 |
function Null_Source_Buffer_Ptr (X : Source_Buffer_Ptr) return Boolean; |
| 209 |
-- True if X = null |
| 210 |
|
| 211 |
function Source_Buffer_Ptr_Equal (X, Y : Source_Buffer_Ptr) return Boolean |
| 212 |
renames "="; |
| 213 |
-- Squirrel away the predefined "=", for use in Null_Source_Buffer_Ptr. |
| 214 |
-- Do not call this elsewhere. |
| 215 |
|
| 216 |
function "=" (X, Y : Source_Buffer_Ptr) return Boolean is abstract; |
| 217 |
-- Make "=" abstract. Note that this makes "/=" abstract as well. This is a |
| 218 |
-- vestige of the zero-origin array indexing we used to use, where "=" is |
| 219 |
-- always wrong (including the one in Null_Source_Buffer_Ptr). We keep this |
| 220 |
-- just because we never need to compare Source_Buffer_Ptrs other than to |
| 221 |
-- null. |
| 222 |
|
| 223 |
subtype Source_Ptr is Text_Ptr; |
| 224 |
-- Type used to represent a source location, which is a subscript of a |
| 225 |
-- character in the source buffer. As noted above, different source buffers |
| 226 |
-- have different ranges, so it is possible to tell from a Source_Ptr value |
| 227 |
-- which source it refers to. Note that negative numbers are allowed to |
| 228 |
-- accommodate the following special values. |
| 229 |
|
| 230 |
type Source_Span is record |
| 231 |
Ptr, First, Last : Source_Ptr; |
| 232 |
end record; |
| 233 |
-- Type used to represent a source span, consisting in a main location Ptr, |
| 234 |
-- with a First and Last location, such that Ptr in First .. Last |
| 235 |
|
| 236 |
function To_Span (Loc : Source_Ptr) return Source_Span is ((others => Loc)); |
| 237 |
function To_Span (Ptr, First, Last : Source_Ptr) return Source_Span is |
| 238 |
((Ptr, First, Last)); |
| 239 |
|
| 240 |
No_Location : constant Source_Ptr := -1; |
| 241 |
-- Value used to indicate no source position set in a node. A test for a |
| 242 |
-- Source_Ptr value being > No_Location is the approved way to test for a |
| 243 |
-- standard value that does not include No_Location or any of the following |
| 244 |
-- special definitions. One important use of No_Location is to label |
| 245 |
-- generated nodes that we don't want the debugger to see in normal mode |
| 246 |
-- (very often we conditionalize so that we set No_Location in normal mode |
| 247 |
-- and the corresponding source line in -gnatD mode). |
| 248 |
|
| 249 |
function No (Loc : Source_Ptr) return Boolean is (Loc = No_Location); |
| 250 |
function Present (Loc : Source_Ptr) return Boolean is (not No (Loc)); |
| 251 |
-- Tests for No_Location / not No_Location |
| 252 |
|
| 253 |
Standard_Location : constant Source_Ptr := -2; |
| 254 |
-- Used for all nodes in the representation of package Standard other than |
| 255 |
-- nodes representing the contents of Standard.ASCII. Note that testing for |
| 256 |
-- a value being <= Standard_Location tests for both Standard_Location and |
| 257 |
-- for Standard_ASCII_Location. |
| 258 |
|
| 259 |
Standard_ASCII_Location : constant Source_Ptr := -3; |
| 260 |
-- Used for all nodes in the presentation of package Standard.ASCII |
| 261 |
|
| 262 |
System_Location : constant Source_Ptr := -4; |
| 263 |
-- Used to identify locations of pragmas scanned by Targparm, where we know |
| 264 |
-- the location is in System, but we don't know exactly what line. |
| 265 |
|
| 266 |
First_Source_Ptr : constant Source_Ptr := 0; |
| 267 |
-- Starting source pointer index value for first source file |
| 268 |
|
| 269 |
------------------------------------- |
| 270 |
-- Range Definitions for Tree Data -- |
| 271 |
------------------------------------- |
| 272 |
|
| 273 |
-- The tree has fields that can hold any of the following types: |
| 274 |
|
| 275 |
-- Pointers to other tree nodes (type Node_Id) |
| 276 |
-- List pointers (type List_Id) |
| 277 |
-- Element list pointers (type Elist_Id) |
| 278 |
-- Names (type Name_Id) |
| 279 |
-- Strings (type String_Id) |
| 280 |
-- Universal integers (type Uint) |
| 281 |
-- Universal reals (type Ureal) |
| 282 |
|
| 283 |
-- These types are represented as integer indices into various tables. |
| 284 |
-- However, they should be treated as private, except in a few documented |
| 285 |
-- cases. In particular it is usually inappropriate to perform arithmetic |
| 286 |
-- operations using these types. One exception is in computing hash |
| 287 |
-- functions of these types. |
| 288 |
|
| 289 |
-- In most contexts, the strongly typed interface determines which of these |
| 290 |
-- types is present. However, there are some situations (involving untyped |
| 291 |
-- traversals of the tree), where it is convenient to be easily able to |
| 292 |
-- distinguish these values. The underlying representation in all cases is |
| 293 |
-- an integer type Union_Id, and we ensure that the range of the various |
| 294 |
-- possible values for each of the above types is disjoint (except that |
| 295 |
-- List_Id and Node_Id overlap at Empty) so that this distinction is |
| 296 |
-- possible. |
| 297 |
|
| 298 |
-- Note: it is also helpful for debugging purposes to make these ranges |
| 299 |
-- distinct. If a bug leads to misidentification of a value, then it will |
| 300 |
-- typically result in an out of range value and a Constraint_Error. |
| 301 |
|
| 302 |
-- The range of Node_Id is most of the nonnegative integers. The other |
| 303 |
-- ranges are negative. Uint has a very large range, because a substantial |
| 304 |
-- part of this range is used to store direct values; see Uintp for |
| 305 |
-- details. The other types have 100 million values, which should be |
| 306 |
-- plenty. |
| 307 |
|
| 308 |
type Union_Id is new Int; |
| 309 |
-- The type in the tree for a union of possible ID values |
| 310 |
|
| 311 |
-- Following are the Low and High bounds of the various ranges. |
| 312 |
|
| 313 |
List_Low_Bound : constant := -099_999_999; |
| 314 |
-- The List_Id values are subscripts into an array of list headers which |
| 315 |
-- has List_Low_Bound as its lower bound. |
| 316 |
|
| 317 |
List_High_Bound : constant := 0; |
| 318 |
-- Maximum List_Id subscript value. The ranges of List_Id and Node_Id |
| 319 |
-- overlap by one element (with value zero), which is used both for the |
| 320 |
-- Empty node, and for No_List. The fact that the same value is used is |
| 321 |
-- convenient because it means that the default value of Empty applies to |
| 322 |
-- both nodes and lists, and also is more efficient to test for. |
| 323 |
|
| 324 |
Node_Low_Bound : constant := 0; |
| 325 |
-- The tree Id values start at zero, because we use zero for Empty (to |
| 326 |
-- allow a zero test for Empty). |
| 327 |
|
| 328 |
Node_High_Bound : constant := 1_999_999_999; |
| 329 |
|
| 330 |
Elist_Low_Bound : constant := -199_999_999; |
| 331 |
-- The Elist_Id values are subscripts into an array of elist headers which |
| 332 |
-- has Elist_Low_Bound as its lower bound. |
| 333 |
|
| 334 |
Elist_High_Bound : constant := -100_000_000; |
| 335 |
|
| 336 |
Elmt_Low_Bound : constant := -299_999_999; |
| 337 |
-- Low bound of element Id values. The use of these values is internal to |
| 338 |
-- the Elists package, but the definition of the range is included here |
| 339 |
-- since it must be disjoint from other Id values. The Elmt_Id values are |
| 340 |
-- subscripts into an array of list elements which has this as lower bound. |
| 341 |
|
| 342 |
Elmt_High_Bound : constant := -200_000_000; |
| 343 |
|
| 344 |
Names_Low_Bound : constant := -399_999_999; |
| 345 |
|
| 346 |
Names_High_Bound : constant := -300_000_000; |
| 347 |
|
| 348 |
Strings_Low_Bound : constant := -499_999_999; |
| 349 |
|
| 350 |
Strings_High_Bound : constant := -400_000_000; |
| 351 |
|
| 352 |
Ureal_Low_Bound : constant := -599_999_999; |
| 353 |
|
| 354 |
Ureal_High_Bound : constant := -500_000_000; |
| 355 |
|
| 356 |
Uint_Low_Bound : constant := -2_100_000_000; |
| 357 |
-- Low bound for Uint values |
| 358 |
|
| 359 |
Uint_Table_Start : constant := -699_999_999; |
| 360 |
-- Location where table entries for universal integers start (see |
| 361 |
-- Uintp spec for details of the representation of Uint values). |
| 362 |
|
| 363 |
Uint_High_Bound : constant := -600_000_000; |
| 364 |
|
| 365 |
-- The following subtype definitions are used to provide convenient names |
| 366 |
-- for membership tests on Int values to see what data type range they |
| 367 |
-- lie in. Such tests appear only in the lowest level packages. |
| 368 |
|
| 369 |
subtype List_Range is Union_Id |
| 370 |
range List_Low_Bound .. List_High_Bound; |
| 371 |
|
| 372 |
subtype Node_Range is Union_Id |
| 373 |
range Node_Low_Bound .. Node_High_Bound; |
| 374 |
|
| 375 |
subtype Elist_Range is Union_Id |
| 376 |
range Elist_Low_Bound .. Elist_High_Bound; |
| 377 |
|
| 378 |
subtype Elmt_Range is Union_Id |
| 379 |
range Elmt_Low_Bound .. Elmt_High_Bound; |
| 380 |
|
| 381 |
subtype Names_Range is Union_Id |
| 382 |
range Names_Low_Bound .. Names_High_Bound; |
| 383 |
|
| 384 |
subtype Strings_Range is Union_Id |
| 385 |
range Strings_Low_Bound .. Strings_High_Bound; |
| 386 |
|
| 387 |
subtype Uint_Range is Union_Id |
| 388 |
range Uint_Low_Bound .. Uint_High_Bound; |
| 389 |
|
| 390 |
subtype Ureal_Range is Union_Id |
| 391 |
range Ureal_Low_Bound .. Ureal_High_Bound; |
| 392 |
|
| 393 |
----------------------------- |
| 394 |
-- Types for Atree Package -- |
| 395 |
----------------------------- |
| 396 |
|
| 397 |
-- Node_Id values are used to identify nodes in the tree. They are |
| 398 |
-- subscripts into the Nodes table declared in package Atree. Note that |
| 399 |
-- the special values Empty and Error are subscripts into this table. |
| 400 |
-- See package Atree for further details. |
| 401 |
|
| 402 |
type Node_Id is range Node_Low_Bound .. Node_High_Bound with Size => 32; |
| 403 |
-- Type used to identify nodes in the tree |
| 404 |
|
| 405 |
subtype Entity_Id is Node_Id; |
| 406 |
-- A synonym for node types, used in the Einfo package to refer to nodes |
| 407 |
-- that are entities (i.e. nodes with an Nkind of N_Defining_xxx). |
| 408 |
-- |
| 409 |
-- Note that Sinfo.Nodes.N_Entity_Id is the same as Entity_Id, except it |
| 410 |
-- has a predicate requiring the correct Nkind. Opt_N_Entity_Id is the same |
| 411 |
-- as N_Entity_Id, except it allows Empty. (Sinfo.Nodes is generated by the |
| 412 |
-- Gen_IL program.) |
| 413 |
|
| 414 |
subtype Node_Or_Entity_Id is Node_Id; |
| 415 |
-- A synonym for node types, used in cases where a given value may be used |
| 416 |
-- to represent either a node or an entity. We like to minimize such uses |
| 417 |
-- for obvious reasons of logical type consistency, but where such uses |
| 418 |
-- occur, they should be documented by use of this type. |
| 419 |
|
| 420 |
Empty : constant Node_Id := Node_Low_Bound; |
| 421 |
-- Used to indicate null node. A node is actually allocated with this |
| 422 |
-- Id value, so that Nkind (Empty) = N_Empty. Note that Node_Low_Bound |
| 423 |
-- is zero, so Empty = No_List = zero. |
| 424 |
|
| 425 |
Empty_List_Or_Node : constant := 0; |
| 426 |
-- This constant is used in situations (e.g. initializing empty fields) |
| 427 |
-- where the value set will be used to represent either an empty node or |
| 428 |
-- a non-existent list, depending on the context. |
| 429 |
|
| 430 |
Error : constant Node_Id := Node_Low_Bound + 1; |
| 431 |
-- Used to indicate an error in the source program. A node is actually |
| 432 |
-- allocated with this Id value, so that Nkind (Error) = N_Error. |
| 433 |
|
| 434 |
Empty_Or_Error : constant Node_Id := Error; |
| 435 |
-- Since Empty and Error are the first two Node_Id values, the test for |
| 436 |
-- N <= Empty_Or_Error tests to see if N is Empty or Error. This definition |
| 437 |
-- provides convenient self-documentation for such tests. |
| 438 |
|
| 439 |
First_Node_Id : constant Node_Id := Node_Low_Bound; |
| 440 |
-- Subscript of first allocated node. Note that Empty and Error are both |
| 441 |
-- allocated nodes, whose Nkind fields can be accessed without error. |
| 442 |
|
| 443 |
------------------------------ |
| 444 |
-- Types for Nlists Package -- |
| 445 |
------------------------------ |
| 446 |
|
| 447 |
-- List_Id values are used to identify node lists stored in the tree, so |
| 448 |
-- that each node can be on at most one such list (see package Nlists for |
| 449 |
-- further details). Note that the special value Error_List is a subscript |
| 450 |
-- in this table, but the value No_List is *not* a valid subscript, and any |
| 451 |
-- attempt to apply list operations to No_List will cause a (detected) |
| 452 |
-- error. |
| 453 |
|
| 454 |
type List_Id is range List_Low_Bound .. List_High_Bound with Size => 32; |
| 455 |
-- Type used to identify a node list |
| 456 |
|
| 457 |
No_List : constant List_Id := List_High_Bound; |
| 458 |
-- Used to indicate absence of a list. Note that the value is zero, which |
| 459 |
-- is the same as Empty, which is helpful in initializing nodes where a |
| 460 |
-- value of zero can represent either an empty node or an empty list. |
| 461 |
|
| 462 |
Error_List : constant List_Id := List_Low_Bound; |
| 463 |
-- Used to indicate that there was an error in the source program in a |
| 464 |
-- context which would normally require a list. This node appears to be |
| 465 |
-- an empty list to the list operations (a null list is actually allocated |
| 466 |
-- which has this Id value). |
| 467 |
|
| 468 |
First_List_Id : constant List_Id := Error_List; |
| 469 |
-- Subscript of first allocated list header |
| 470 |
|
| 471 |
------------------------------ |
| 472 |
-- Types for Elists Package -- |
| 473 |
------------------------------ |
| 474 |
|
| 475 |
-- Element list Id values are used to identify element lists stored outside |
| 476 |
-- of the tree, allowing nodes to be members of more than one such list |
| 477 |
-- (see package Elists for further details). |
| 478 |
|
| 479 |
type Elist_Id is range Elist_Low_Bound .. Elist_High_Bound with Size => 32; |
| 480 |
-- Type used to identify an element list (Elist header table subscript) |
| 481 |
|
| 482 |
No_Elist : constant Elist_Id := Elist_Low_Bound; |
| 483 |
-- Used to indicate absence of an element list. Note that this is not an |
| 484 |
-- actual Elist header, so element list operations on this value are not |
| 485 |
-- valid. |
| 486 |
|
| 487 |
First_Elist_Id : constant Elist_Id := No_Elist + 1; |
| 488 |
-- Subscript of first allocated Elist header |
| 489 |
|
| 490 |
-- Element Id values are used to identify individual elements of an element |
| 491 |
-- list (see package Elists for further details). |
| 492 |
|
| 493 |
type Elmt_Id is range Elmt_Low_Bound .. Elmt_High_Bound; |
| 494 |
-- Type used to identify an element list |
| 495 |
|
| 496 |
No_Elmt : constant Elmt_Id := Elmt_Low_Bound; |
| 497 |
-- Used to represent empty element |
| 498 |
|
| 499 |
First_Elmt_Id : constant Elmt_Id := No_Elmt + 1; |
| 500 |
-- Subscript of first allocated Elmt table entry |
| 501 |
|
| 502 |
------------------------------- |
| 503 |
-- Types for Stringt Package -- |
| 504 |
------------------------------- |
| 505 |
|
| 506 |
-- String_Id values are used to identify entries in the strings table. They |
| 507 |
-- are subscripts into the Strings table defined in package Stringt. |
| 508 |
|
| 509 |
type String_Id is range Strings_Low_Bound .. Strings_High_Bound |
| 510 |
with Size => 32; |
| 511 |
-- Type used to identify entries in the strings table |
| 512 |
|
| 513 |
No_String : constant String_Id := Strings_Low_Bound; |
| 514 |
-- Used to indicate missing string Id. Note that the value zero is used |
| 515 |
-- to indicate a missing data value for all the Int types in this section. |
| 516 |
|
| 517 |
First_String_Id : constant String_Id := No_String + 1; |
| 518 |
-- First subscript allocated in string table |
| 519 |
|
| 520 |
------------------------- |
| 521 |
-- Character Code Type -- |
| 522 |
------------------------- |
| 523 |
|
| 524 |
-- The type Char is used for character data internally in the compiler, but |
| 525 |
-- character codes in the source are represented by the Char_Code type. |
| 526 |
-- Each character literal in the source is interpreted as being one of the |
| 527 |
-- 16#7FFF_FFFF# possible Wide_Wide_Character codes, and a unique Integer |
| 528 |
-- value is assigned, corresponding to the UTF-32 value, which also |
| 529 |
-- corresponds to the Pos value in the Wide_Wide_Character type, and also |
| 530 |
-- corresponds to the Pos value in the Wide_Character and Character types |
| 531 |
-- for values that are in appropriate range. String literals are similarly |
| 532 |
-- interpreted as a sequence of such codes. |
| 533 |
|
| 534 |
type Char_Code_Base is mod 2 ** 32; |
| 535 |
for Char_Code_Base'Size use 32; |
| 536 |
|
| 537 |
subtype Char_Code is Char_Code_Base range 0 .. 16#7FFF_FFFF#; |
| 538 |
for Char_Code'Value_Size use 32; |
| 539 |
for Char_Code'Object_Size use 32; |
| 540 |
|
| 541 |
function Get_Char_Code (C : Character) return Char_Code; |
| 542 |
pragma Inline (Get_Char_Code); |
| 543 |
-- Function to obtain internal character code from source character. For |
| 544 |
-- the moment, the internal character code is simply the Pos value of the |
| 545 |
-- input source character, but we provide this interface for possible |
| 546 |
-- later support of alternative character sets. |
| 547 |
|
| 548 |
function In_Character_Range (C : Char_Code) return Boolean; |
| 549 |
pragma Inline (In_Character_Range); |
| 550 |
-- Determines if the given character code is in range of type Character, |
| 551 |
-- and if so, returns True. If not, returns False. |
| 552 |
|
| 553 |
function In_Wide_Character_Range (C : Char_Code) return Boolean; |
| 554 |
pragma Inline (In_Wide_Character_Range); |
| 555 |
-- Determines if the given character code is in range of the type |
| 556 |
-- Wide_Character, and if so, returns True. If not, returns False. |
| 557 |
|
| 558 |
function Get_Character (C : Char_Code) return Character; |
| 559 |
pragma Inline (Get_Character); |
| 560 |
-- For a character C that is in Character range (see above function), this |
| 561 |
-- function returns the corresponding Character value. It is an error to |
| 562 |
-- call Get_Character if C is not in Character range. |
| 563 |
|
| 564 |
function Get_Wide_Character (C : Char_Code) return Wide_Character; |
| 565 |
-- For a character C that is in Wide_Character range (see above function), |
| 566 |
-- this function returns the corresponding Wide_Character value. It is an |
| 567 |
-- error to call Get_Wide_Character if C is not in Wide_Character range. |
| 568 |
|
| 569 |
--------------------------------------- |
| 570 |
-- Types used for Library Management -- |
| 571 |
--------------------------------------- |
| 572 |
|
| 573 |
type Unit_Number_Type is new Int range -1 .. Int'Last; |
| 574 |
-- Unit number. The main source is unit 0, and subsidiary sources have |
| 575 |
-- non-zero numbers starting with 1. Unit numbers are used to index the |
| 576 |
-- Units table in package Lib. |
| 577 |
|
| 578 |
Main_Unit : constant Unit_Number_Type := 0; |
| 579 |
-- Unit number value for main unit |
| 580 |
|
| 581 |
No_Unit : constant Unit_Number_Type := -1; |
| 582 |
-- Special value used to signal no unit |
| 583 |
|
| 584 |
type Source_File_Index is new Int range -1 .. Int'Last; |
| 585 |
-- Type used to index the source file table (see package Sinput) |
| 586 |
|
| 587 |
No_Source_File : constant Source_File_Index := 0; |
| 588 |
-- Value used to indicate no source file present |
| 589 |
|
| 590 |
No_Access_To_Source_File : constant Source_File_Index := -1; |
| 591 |
-- Value used to indicate a source file is present but unreadable |
| 592 |
|
| 593 |
----------------------------------- |
| 594 |
-- Representation of Time Stamps -- |
| 595 |
----------------------------------- |
| 596 |
|
| 597 |
-- All compiled units are marked with a time stamp which is derived from |
| 598 |
-- the source file (we assume that the host system has the concept of a |
| 599 |
-- file time stamp which is modified when a file is modified). These |
| 600 |
-- time stamps are used to ensure consistency of the set of units that |
| 601 |
-- constitutes a library. Time stamps are 14-character strings with |
| 602 |
-- with the following format: |
| 603 |
|
| 604 |
-- YYYYMMDDHHMMSS |
| 605 |
|
| 606 |
-- YYYY year |
| 607 |
-- MM month (2 digits 01-12) |
| 608 |
-- DD day (2 digits 01-31) |
| 609 |
-- HH hour (2 digits 00-23) |
| 610 |
-- MM minutes (2 digits 00-59) |
| 611 |
-- SS seconds (2 digits 00-59) |
| 612 |
|
| 613 |
-- In the case of Unix systems (and other systems which keep the time in |
| 614 |
-- GMT), the time stamp is the GMT time of the file, not the local time. |
| 615 |
-- This solves problems in using libraries across networks with clients |
| 616 |
-- spread across multiple time-zones. |
| 617 |
|
| 618 |
Time_Stamp_Length : constant := 14; |
| 619 |
-- Length of time stamp value |
| 620 |
|
| 621 |
subtype Time_Stamp_Index is Natural range 1 .. Time_Stamp_Length; |
| 622 |
type Time_Stamp_Type is new String (Time_Stamp_Index); |
| 623 |
-- Type used to represent time stamp |
| 624 |
|
| 625 |
Empty_Time_Stamp : constant Time_Stamp_Type := (others => ' '); |
| 626 |
-- Value representing an empty or missing time stamp. Looks less than any |
| 627 |
-- real time stamp if two time stamps are compared. Note that although this |
| 628 |
-- is not private, clients should not rely on the exact way in which this |
| 629 |
-- string is represented, and instead should use the subprograms below. |
| 630 |
|
| 631 |
Dummy_Time_Stamp : constant Time_Stamp_Type := (others => '0'); |
| 632 |
-- This is used for dummy time stamp values used in the D lines for |
| 633 |
-- non-existent files, and is intended to be an impossible value. |
| 634 |
|
| 635 |
function "=" (Left, Right : Time_Stamp_Type) return Boolean; |
| 636 |
function "<=" (Left, Right : Time_Stamp_Type) return Boolean; |
| 637 |
function ">=" (Left, Right : Time_Stamp_Type) return Boolean; |
| 638 |
function "<" (Left, Right : Time_Stamp_Type) return Boolean; |
| 639 |
function ">" (Left, Right : Time_Stamp_Type) return Boolean; |
| 640 |
-- Comparison functions on time stamps. Note that two time stamps are |
| 641 |
-- defined as being equal if they have the same day/month/year and the |
| 642 |
-- hour/minutes/seconds values are within 2 seconds of one another. This |
| 643 |
-- deals with rounding effects in library file time stamps caused by |
| 644 |
-- copying operations during installation. We have particularly noticed |
| 645 |
-- that WinNT seems susceptible to such changes. |
| 646 |
-- |
| 647 |
-- Note: the Empty_Time_Stamp value looks equal to itself, and less than |
| 648 |
-- any non-empty time stamp value. |
| 649 |
|
| 650 |
procedure Split_Time_Stamp |
| 651 |
(TS : Time_Stamp_Type; |
| 652 |
Year : out Nat; |
| 653 |
Month : out Nat; |
| 654 |
Day : out Nat; |
| 655 |
Hour : out Nat; |
| 656 |
Minutes : out Nat; |
| 657 |
Seconds : out Nat); |
| 658 |
-- Given a time stamp, decompose it into its components |
| 659 |
|
| 660 |
procedure Make_Time_Stamp |
| 661 |
(Year : Nat; |
| 662 |
Month : Nat; |
| 663 |
Day : Nat; |
| 664 |
Hour : Nat; |
| 665 |
Minutes : Nat; |
| 666 |
Seconds : Nat; |
| 667 |
TS : out Time_Stamp_Type); |
| 668 |
-- Given the components of a time stamp, initialize the value |
| 669 |
|
| 670 |
------------------------------------- |
| 671 |
-- Types used for Check Management -- |
| 672 |
------------------------------------- |
| 673 |
|
| 674 |
type Check_Id is new Nat; |
| 675 |
-- Type used to represent a check id |
| 676 |
|
| 677 |
No_Check_Id : constant := 0; |
| 678 |
-- Check_Id value used to indicate no check |
| 679 |
|
| 680 |
Access_Check : constant := 1; |
| 681 |
Accessibility_Check : constant := 2; |
| 682 |
Alignment_Check : constant := 3; |
| 683 |
Allocation_Check : constant := 4; |
| 684 |
Atomic_Synchronization : constant := 5; |
| 685 |
Characters_Assertion_Check : constant := 6; |
| 686 |
Containers_Assertion_Check : constant := 7; |
| 687 |
Discriminant_Check : constant := 8; |
| 688 |
Division_Check : constant := 9; |
| 689 |
Duplicated_Tag_Check : constant := 10; |
| 690 |
Elaboration_Check : constant := 11; |
| 691 |
Index_Check : constant := 12; |
| 692 |
Interfaces_Assertion_Check : constant := 13; |
| 693 |
IO_Assertion_Check : constant := 14; |
| 694 |
Length_Check : constant := 15; |
| 695 |
Numerics_Assertion_Check : constant := 16; |
| 696 |
Overflow_Check : constant := 17; |
| 697 |
Predicate_Check : constant := 18; |
| 698 |
Program_Error_Check : constant := 19; |
| 699 |
Range_Check : constant := 20; |
| 700 |
Storage_Check : constant := 21; |
| 701 |
Strings_Assertion_Check : constant := 22; |
| 702 |
System_Assertion_Check : constant := 23; |
| 703 |
Tag_Check : constant := 24; |
| 704 |
Validity_Check : constant := 25; |
| 705 |
Container_Checks : constant := 26; |
| 706 |
Tampering_Check : constant := 27; |
| 707 |
Tasking_Check : constant := 28; |
| 708 |
Raise_Check : constant := 29; |
| 709 |
-- Values used to represent individual predefined checks (including the |
| 710 |
-- pseudo-check _Atomic_Synchronization). |
| 711 |
|
| 712 |
All_Checks : constant := 30; |
| 713 |
-- Value used to represent All_Checks value |
| 714 |
|
| 715 |
subtype Predefined_Check_Id is Check_Id range 1 .. All_Checks; |
| 716 |
-- Subtype for predefined checks, including All_Checks |
| 717 |
|
| 718 |
-- The following array contains an entry for each recognized check name |
| 719 |
-- for pragma Suppress. It is used to represent current settings of scope |
| 720 |
-- based suppress actions from pragma Suppress or command line settings. |
| 721 |
|
| 722 |
-- Note: when Suppress_Array (All_Checks) is True, then generally all other |
| 723 |
-- specific check entries are set True, except for the Elaboration_Check |
| 724 |
-- entry which is set only if an explicit Suppress for this check is given. |
| 725 |
-- The reason for this non-uniformity is that we do not want All_Checks to |
| 726 |
-- suppress elaboration checking when using the static elaboration model. |
| 727 |
-- We recognize only an explicit suppress of Elaboration_Check as a signal |
| 728 |
-- that the static elaboration checking should skip a compile time check. |
| 729 |
|
| 730 |
type Suppress_Array is array (Predefined_Check_Id) of Boolean; |
| 731 |
pragma Pack (Suppress_Array); |
| 732 |
|
| 733 |
-- To add a new check type to GNAT, the following steps are required: |
| 734 |
|
| 735 |
-- 1. Add an entry to Snames spec for the new name |
| 736 |
-- 2. Add an entry to the definition of Check_Id above (very important: |
| 737 |
-- these definitions should be in the same order in Snames and here) |
| 738 |
-- 3. Add a new function to Checks to handle the new check test |
| 739 |
-- 4. Add a new Do_xxx_Check flag to Sinfo (if required) |
| 740 |
-- 5. Add appropriate checks for the new test |
| 741 |
|
| 742 |
-- The following provides precise details on the mode used to generate |
| 743 |
-- code for intermediate operations in expressions for signed integer |
| 744 |
-- arithmetic (and how to generate overflow checks if enabled). Note |
| 745 |
-- that this only affects handling of intermediate results. The final |
| 746 |
-- result must always fit within the target range, and if overflow |
| 747 |
-- checking is enabled, the check on the final result is against this |
| 748 |
-- target range. |
| 749 |
|
| 750 |
type Overflow_Mode_Type is ( |
| 751 |
Not_Set, |
| 752 |
-- Dummy value used during initialization process to show that the |
| 753 |
-- corresponding value has not yet been initialized. |
| 754 |
|
| 755 |
Strict, |
| 756 |
-- Operations are done in the base type of the subexpression. If |
| 757 |
-- overflow checks are enabled, then the check is against the range |
| 758 |
-- of this base type. |
| 759 |
|
| 760 |
Minimized, |
| 761 |
-- Where appropriate, intermediate arithmetic operations are performed |
| 762 |
-- with an extended range, using Long_Long_Integer if necessary. If |
| 763 |
-- overflow checking is enabled, then the check is against the range |
| 764 |
-- of Long_Long_Integer. |
| 765 |
|
| 766 |
Eliminated); |
| 767 |
-- In this mode arbitrary precision arithmetic is used as needed to |
| 768 |
-- ensure that it is impossible for intermediate arithmetic to cause an |
| 769 |
-- overflow. In this mode, intermediate expressions are not affected by |
| 770 |
-- the overflow checking mode, since overflows are eliminated. |
| 771 |
|
| 772 |
subtype Minimized_Or_Eliminated is |
| 773 |
Overflow_Mode_Type range Minimized .. Eliminated; |
| 774 |
-- Define subtype so that clients don't need to know ordering. Note that |
| 775 |
-- Overflow_Mode_Type is not marked as an ordered enumeration type. |
| 776 |
|
| 777 |
-- The following structure captures the state of check suppression or |
| 778 |
-- activation at a particular point in the program execution. |
| 779 |
|
| 780 |
type Suppress_Record is record |
| 781 |
Suppress : Suppress_Array; |
| 782 |
-- Indicates suppression status of each possible check |
| 783 |
|
| 784 |
Overflow_Mode_General : Overflow_Mode_Type; |
| 785 |
-- This field indicates the mode for handling code generation and |
| 786 |
-- overflow checking (if enabled) for intermediate expression values. |
| 787 |
-- This applies to general expressions outside assertions. |
| 788 |
|
| 789 |
Overflow_Mode_Assertions : Overflow_Mode_Type; |
| 790 |
-- This field indicates the mode for handling code generation and |
| 791 |
-- overflow checking (if enabled) for intermediate expression values. |
| 792 |
-- This applies to any expression occurring inside assertions. |
| 793 |
end record; |
| 794 |
|
| 795 |
----------------------------------- |
| 796 |
-- Global Exception Declarations -- |
| 797 |
----------------------------------- |
| 798 |
|
| 799 |
-- This section contains declarations of exceptions that are used |
| 800 |
-- throughout the compiler or in other GNAT tools. |
| 801 |
|
| 802 |
Unrecoverable_Error : exception; |
| 803 |
-- This exception is raised to immediately terminate the compilation of the |
| 804 |
-- current source program. Used in situations where things are bad enough |
| 805 |
-- that it doesn't seem worth continuing (e.g. max errors reached, or a |
| 806 |
-- required file is not found). Also raised when the compiler finds itself |
| 807 |
-- in trouble after an error (see Comperr). |
| 808 |
|
| 809 |
Terminate_Program : exception; |
| 810 |
-- This exception is raised to immediately terminate the tool being |
| 811 |
-- executed. Each tool where this exception may be raised must have a |
| 812 |
-- single exception handler that contains only a null statement and that is |
| 813 |
-- the last statement of the program. If needed, procedure Set_Exit_Status |
| 814 |
-- is called with the appropriate exit status before raising |
| 815 |
-- Terminate_Program. |
| 816 |
|
| 817 |
--------------------------------- |
| 818 |
-- Parameter Mechanism Control -- |
| 819 |
--------------------------------- |
| 820 |
|
| 821 |
-- Function and parameter entities have a field that records the passing |
| 822 |
-- mechanism. See specification of Sem_Mech for full details. The following |
| 823 |
-- subtype is used to represent values of this type: |
| 824 |
|
| 825 |
subtype Mechanism_Type is Int range -2 .. Int'Last; |
| 826 |
-- Type used to represent a mechanism value. This is a subtype rather than |
| 827 |
-- a type to avoid some annoying processing problems with certain routines |
| 828 |
-- in Einfo (processing them to create the corresponding C). The values in |
| 829 |
-- the range -2 .. 0 are used to represent mechanism types declared as |
| 830 |
-- named constants in the spec of Sem_Mech. Positive values are used for |
| 831 |
-- the case of a pragma C_Pass_By_Copy that sets a threshold value for the |
| 832 |
-- mechanism to be used. For example if pragma C_Pass_By_Copy (32) is given |
| 833 |
-- then Default_C_Record_Mechanism is set to 32, and the meaning is to use |
| 834 |
-- By_Reference if the size is greater than 32, and By_Copy otherwise. |
| 835 |
|
| 836 |
--------------------------------- |
| 837 |
-- Component_Alignment Control -- |
| 838 |
--------------------------------- |
| 839 |
|
| 840 |
-- There are four types of alignment possible for array and record |
| 841 |
-- types, and a field in the type entities contains a value of the |
| 842 |
-- following type indicating which alignment choice applies. For full |
| 843 |
-- details of the meaning of these alignment types, see description |
| 844 |
-- of the Component_Alignment pragma. |
| 845 |
|
| 846 |
type Component_Alignment_Kind is ( |
| 847 |
Calign_Default, -- default alignment |
| 848 |
Calign_Component_Size, -- natural alignment for component size |
| 849 |
Calign_Component_Size_4, -- natural for size <= 4, 4 for size >= 4 |
| 850 |
Calign_Storage_Unit); -- all components byte aligned |
| 851 |
|
| 852 |
----------------------------------- |
| 853 |
-- Floating Point Representation -- |
| 854 |
----------------------------------- |
| 855 |
|
| 856 |
type Float_Rep_Kind is (IEEE_Binary); |
| 857 |
-- The only one supported now is IEEE 754p conforming binary format, but |
| 858 |
-- other formats were supported in the past, and could conceivably be |
| 859 |
-- supported in the future, so we keep this singleton enumeration type. |
| 860 |
|
| 861 |
---------------------------- |
| 862 |
-- Small_Paren_Count_Type -- |
| 863 |
---------------------------- |
| 864 |
|
| 865 |
-- See Paren_Count in Atree for documentation |
| 866 |
|
| 867 |
subtype Small_Paren_Count_Type is Nat range 0 .. 3; |
| 868 |
|
| 869 |
------------------------------ |
| 870 |
-- Run-Time Exception Codes -- |
| 871 |
------------------------------ |
| 872 |
|
| 873 |
-- When the code generator generates a run-time exception, it provides a |
| 874 |
-- reason code which is one of the following. This reason code is used to |
| 875 |
-- select the appropriate run-time routine to be called, determining both |
| 876 |
-- the exception to be raised, and the message text to be added. |
| 877 |
|
| 878 |
-- The prefix CE/PE/SE indicates the exception to be raised |
| 879 |
-- CE = Constraint_Error |
| 880 |
-- PE = Program_Error |
| 881 |
-- SE = Storage_Error |
| 882 |
|
| 883 |
-- The remaining part of the name indicates the message text to be added, |
| 884 |
-- where all letters are lower case, and underscores are converted to |
| 885 |
-- spaces (for example CE_Invalid_Data adds the text "invalid data"). |
| 886 |
|
| 887 |
-- To add a new code, you need to do the following: |
| 888 |
|
| 889 |
-- 1. Assign a new number to the reason. Do not renumber existing codes, |
| 890 |
-- since this causes compatibility/bootstrap issues, so always add the |
| 891 |
-- new code at the end of the list. |
| 892 |
|
| 893 |
-- 2. Update the contents of the array Kind |
| 894 |
|
| 895 |
-- 3. Modify the corresponding definitions in types.h, including the |
| 896 |
-- definition of last_reason_code. |
| 897 |
|
| 898 |
-- 4. Add the name of the routines in exp_ch11.Get_RT_Exception_Name |
| 899 |
|
| 900 |
-- 5. Add a new routine in Ada.Exceptions with the appropriate call and |
| 901 |
-- static string constant. Note that there is more than one version |
| 902 |
-- of a-except.adb which must be modified. |
| 903 |
|
| 904 |
-- Note on ordering of references. For the tables in Ada.Exceptions units, |
| 905 |
-- usually the ordering does not matter, and we use the same ordering as |
| 906 |
-- is used here. |
| 907 |
|
| 908 |
type RT_Exception_Code is |
| 909 |
(CE_Access_Check_Failed, -- 00 |
| 910 |
CE_Access_Parameter_Is_Null, -- 01 |
| 911 |
CE_Discriminant_Check_Failed, -- 02 |
| 912 |
CE_Divide_By_Zero, -- 03 |
| 913 |
CE_Explicit_Raise, -- 04 |
| 914 |
CE_Index_Check_Failed, -- 05 |
| 915 |
CE_Invalid_Data, -- 06 |
| 916 |
CE_Length_Check_Failed, -- 07 |
| 917 |
CE_Null_Exception_Id, -- 08 |
| 918 |
CE_Null_Not_Allowed, -- 09 |
| 919 |
|
| 920 |
CE_Overflow_Check_Failed, -- 10 |
| 921 |
CE_Partition_Check_Failed, -- 11 |
| 922 |
CE_Range_Check_Failed, -- 12 |
| 923 |
CE_Tag_Check_Failed, -- 13 |
| 924 |
PE_Access_Before_Elaboration, -- 14 |
| 925 |
PE_Accessibility_Check_Failed, -- 15 |
| 926 |
PE_Address_Of_Intrinsic, -- 16 |
| 927 |
PE_Aliased_Parameters, -- 17 |
| 928 |
PE_All_Guards_Closed, -- 18 |
| 929 |
PE_Bad_Predicated_Generic_Type, -- 19 |
| 930 |
|
| 931 |
PE_Current_Task_In_Entry_Body, -- 20 |
| 932 |
PE_Duplicated_Entry_Address, -- 21 |
| 933 |
PE_Explicit_Raise, -- 22 |
| 934 |
PE_Finalize_Raised_Exception, -- 23 |
| 935 |
PE_Implicit_Return, -- 24 |
| 936 |
PE_Misaligned_Address_Value, -- 25 |
| 937 |
PE_Missing_Return, -- 26 |
| 938 |
PE_Overlaid_Controlled_Object, -- 27 |
| 939 |
PE_Potentially_Blocking_Operation, -- 28 |
| 940 |
PE_Stubbed_Subprogram_Called, -- 29 |
| 941 |
|
| 942 |
PE_Unchecked_Union_Restriction, -- 30 |
| 943 |
PE_Non_Transportable_Actual, -- 31 |
| 944 |
SE_Empty_Storage_Pool, -- 32 |
| 945 |
SE_Explicit_Raise, -- 33 |
| 946 |
SE_Infinite_Recursion, -- 34 |
| 947 |
SE_Object_Too_Large, -- 35 |
| 948 |
PE_Stream_Operation_Not_Allowed, -- 36 |
| 949 |
PE_Build_In_Place_Mismatch, -- 37 |
| 950 |
PE_Raise_Check_Failed); -- 38 |
| 951 |
pragma Convention (C, RT_Exception_Code); |
| 952 |
|
| 953 |
Last_Reason_Code : constant := |
| 954 |
RT_Exception_Code'Pos (RT_Exception_Code'Last); |
| 955 |
-- Last reason code |
| 956 |
|
| 957 |
type Reason_Kind is (CE_Reason, PE_Reason, SE_Reason); |
| 958 |
-- Categorization of reason codes by exception raised |
| 959 |
|
| 960 |
Rkind : constant array (RT_Exception_Code) of Reason_Kind := |
| 961 |
(CE_Access_Check_Failed => CE_Reason, |
| 962 |
CE_Access_Parameter_Is_Null => CE_Reason, |
| 963 |
CE_Discriminant_Check_Failed => CE_Reason, |
| 964 |
CE_Divide_By_Zero => CE_Reason, |
| 965 |
CE_Explicit_Raise => CE_Reason, |
| 966 |
CE_Index_Check_Failed => CE_Reason, |
| 967 |
CE_Invalid_Data => CE_Reason, |
| 968 |
CE_Length_Check_Failed => CE_Reason, |
| 969 |
CE_Null_Exception_Id => CE_Reason, |
| 970 |
CE_Null_Not_Allowed => CE_Reason, |
| 971 |
CE_Overflow_Check_Failed => CE_Reason, |
| 972 |
CE_Partition_Check_Failed => CE_Reason, |
| 973 |
CE_Range_Check_Failed => CE_Reason, |
| 974 |
CE_Tag_Check_Failed => CE_Reason, |
| 975 |
|
| 976 |
PE_Access_Before_Elaboration => PE_Reason, |
| 977 |
PE_Accessibility_Check_Failed => PE_Reason, |
| 978 |
PE_Address_Of_Intrinsic => PE_Reason, |
| 979 |
PE_Aliased_Parameters => PE_Reason, |
| 980 |
PE_All_Guards_Closed => PE_Reason, |
| 981 |
PE_Bad_Predicated_Generic_Type => PE_Reason, |
| 982 |
PE_Build_In_Place_Mismatch => PE_Reason, |
| 983 |
PE_Current_Task_In_Entry_Body => PE_Reason, |
| 984 |
PE_Duplicated_Entry_Address => PE_Reason, |
| 985 |
PE_Explicit_Raise => PE_Reason, |
| 986 |
PE_Finalize_Raised_Exception => PE_Reason, |
| 987 |
PE_Implicit_Return => PE_Reason, |
| 988 |
PE_Misaligned_Address_Value => PE_Reason, |
| 989 |
PE_Missing_Return => PE_Reason, |
| 990 |
PE_Non_Transportable_Actual => PE_Reason, |
| 991 |
PE_Overlaid_Controlled_Object => PE_Reason, |
| 992 |
PE_Potentially_Blocking_Operation => PE_Reason, |
| 993 |
PE_Raise_Check_Failed => PE_Reason, |
| 994 |
PE_Stream_Operation_Not_Allowed => PE_Reason, |
| 995 |
PE_Stubbed_Subprogram_Called => PE_Reason, |
| 996 |
PE_Unchecked_Union_Restriction => PE_Reason, |
| 997 |
|
| 998 |
SE_Empty_Storage_Pool => SE_Reason, |
| 999 |
SE_Explicit_Raise => SE_Reason, |
| 1000 |
SE_Infinite_Recursion => SE_Reason, |
| 1001 |
SE_Object_Too_Large => SE_Reason); |
| 1002 |
|
| 1003 |
-- Types for field offsets/sizes used in Seinfo, Sinfo.Nodes and |
| 1004 |
-- Einfo.Entities: |
| 1005 |
|
| 1006 |
type Field_Offset is new Nat; |
| 1007 |
-- Offset of a node field, in units of the size of the field, which is |
| 1008 |
-- always a power of 2. |
| 1009 |
|
| 1010 |
subtype Node_Offset is Field_Offset'Base range 1 .. Field_Offset'Base'Last; |
| 1011 |
|
| 1012 |
subtype Slot_Count is Field_Offset; |
| 1013 |
-- Count of number of slots. Same type as Field_Offset to avoid |
| 1014 |
-- proliferation of type conversions. |
| 1015 |
|
| 1016 |
subtype Field_Size_In_Bits is Field_Offset with Predicate => |
| 1017 |
Field_Size_In_Bits in 1 | 2 | 4 | 8 | 32; |
| 1018 |
|
| 1019 |
subtype Opt_Field_Offset is Field_Offset'Base range -1 .. Field_Offset'Last; |
| 1020 |
No_Field_Offset : constant Opt_Field_Offset := Opt_Field_Offset'First; |
| 1021 |
|
| 1022 |
type Offset_Array_Index is new Nat; |
| 1023 |
type Offset_Array is |
| 1024 |
array (Offset_Array_Index range <>) of Opt_Field_Offset; |
| 1025 |
|
| 1026 |
end Types; |