FSF GCC merge 02/23/03
[official-gcc.git] / gcc / ada / types.h
blob3d8dbd50695354bc40fe86089522a70040663102
1 /****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * T Y P E S *
6 * *
7 * C Header File *
8 * *
9 * *
10 * Copyright (C) 1992-2002, Free Software Foundation, Inc. *
11 * *
12 * GNAT is free software; you can redistribute it and/or modify it under *
13 * terms of the GNU General Public License as published by the Free Soft- *
14 * ware Foundation; either version 2, or (at your option) any later ver- *
15 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
16 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
18 * for more details. You should have received a copy of the GNU General *
19 * Public License distributed with GNAT; see file COPYING. If not, write *
20 * to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, *
21 * MA 02111-1307, USA. *
22 * *
23 * GNAT was originally developed by the GNAT team at New York University. *
24 * Extensive contributions were provided by Ada Core Technologies Inc. *
25 * *
26 ****************************************************************************/
28 /* This is the C file that corresponds to the Ada package spec Types. It was
29 created manually from the files types.ads and types.adb.
31 This package contains host independent type definitions which are used
32 throughout the compiler modules. The comments in the C version are brief
33 reminders of the purpose of each declaration. For complete documentation,
34 see the Ada version of these definitions. */
36 /* Boolean Types: */
38 /* Boolean type (cannot use enum, because of bit field restriction on some
39 compilers). */
40 typedef unsigned char Boolean;
41 #define False 0
42 #define True 1
44 /* General Use Integer Types */
46 /* Signed 32/bit integer */
47 typedef int Int;
49 /* Signed 16 bit integer */
50 typedef short Short;
52 /* Non/negative Int values */
53 typedef Int Nat;
55 /* Positive Int values */
56 typedef Int Pos;
58 /* 8/bit unsigned integer */
59 typedef char Byte;
61 /* 8/Bit Character and String Types: */
63 /* 8/bit character type */
64 typedef char Char;
66 /* Graphic characters, as defined in ARM */
67 typedef Char Graphic_Character;
69 /* Line terminator characters (LF, VT, FF, CR) */
70 typedef Char Line_Terminator;
72 /* Characters with the upper bit set */
73 typedef Char Upper_Half_Character;
75 /* String type built on Char (note that zero is an OK index) */
76 typedef Char *Str;
78 /* Pointer to string of Chars */
79 typedef Char *Str_Ptr;
81 /* Types for the fat pointer used for strings and the template it
82 points to. */
83 typedef struct {int Low_Bound, High_Bound; } String_Template;
84 typedef struct {const char *Array; String_Template *Bounds; }
85 __attribute ((aligned (sizeof (char *) * 2))) Fat_Pointer;
87 /* Types for Node/Entity Kinds: */
89 /* The reason that these are defined here in the C version, rather than in the
90 corresponding packages is that the requirement for putting bodies of
91 inlined stuff IN the C header changes the dependencies. Both a-sinfo.h
92 and a-einfo.h now reference routines defined in tree.h.
94 Note: these types would more naturally be defined as unsigned char, but
95 once again, the annoying restriction on bit fields for some compilers
96 bites us! */
98 typedef unsigned int Node_Kind;
99 typedef unsigned int Entity_Kind;
101 /* Types used for Text Buffer Handling: */
103 /* Type used for subscripts in text buffer. */
104 typedef Int Text_Ptr;
106 /* Text buffer used to hold source file or library information file. */
107 typedef Char *Text_Buffer;
109 /* Pointer to text buffer. */
110 typedef Char *Text_Buffer_Ptr;
112 /* Types used for Source Input Handling: */
114 /* Line number type, used for storing all line numbers. */
115 typedef Int Line_Number_Type;
117 /* Column number type, used for storing all column numbers. */
118 typedef Int Column_Number_Type;
120 /* Type used to store text of a source file. */
121 typedef Text_Buffer Source_Buffer;
123 /* Pointer to source buffer. */
124 typedef Text_Buffer_Ptr Source_Buffer_Ptr;
126 /* Type used for source location. */
127 typedef Text_Ptr Source_Ptr;
129 /* Value used to indicate no source position set. */
130 #define No_Location -1
132 /* Used for Sloc in all nodes in the representation of package Standard. */
133 #define Standard_Location -2
135 /* Type used for union of all possible ID values covering all ranges */
136 typedef int Union_Id;
138 /* Range definitions for Tree Data: */
140 #define List_Low_Bound -100000000
141 #define List_High_Bound 0
143 #define Node_Low_Bound 0
144 #define Node_High_Bound 99999999
146 #define Elist_Low_Bound 100000000
147 #define Elist_High_Bound 199999999
149 #define Elmt_Low_Bound 200000000
150 #define Elmt_High_Bound 299999999
152 #define Names_Low_Bound 300000000
153 #define Names_High_Bound 399999999
155 #define Strings_Low_Bound 400000000
156 #define Strings_High_Bound 499999999
158 #define Ureal_Low_Bound 500000000
159 #define Ureal_High_Bound 599999999
161 #define Uint_Low_Bound 600000000
162 #define Uint_Table_Start 2000000000
163 #define Uint_High_Bound 2099999999
165 #define Char_Code_Bias 2100000000
167 SUBTYPE (List_Range, Int, List_Low_Bound, List_High_Bound)
168 SUBTYPE (Node_Range, Int, Node_Low_Bound, Node_High_Bound)
169 SUBTYPE (Elist_Range, Int, Elist_Low_Bound, Elist_High_Bound)
170 SUBTYPE (Elmt_Range, Int, Elmt_Low_Bound, Elmt_High_Bound)
171 SUBTYPE (Names_Range, Int, Names_Low_Bound, Names_High_Bound)
172 SUBTYPE (Strings_Range, Int, Strings_Low_Bound, Strings_High_Bound)
173 SUBTYPE (Uint_Range, Int, Uint_Low_Bound, Uint_High_Bound)
174 SUBTYPE (Ureal_Range, Int, Ureal_Low_Bound, Ureal_High_Bound)
175 SUBTYPE (Char_Code_Range, Int, Char_Code_Bias, (Char_Code_Bias + 65535))
177 /* Types for Names_Table Package: */
179 typedef Int Name_Id;
181 /* Name_Id value for no name present. */
182 #define No_Name Names_Low_Bound
184 /* Name_Id value for bad name. */
185 #define Error_Name (Names_Low_Bound + 1)
187 /* First subscript of names table. */
188 #define First_Name_Id (Names_Low_Bound + 2)
190 /* Types for Tree Package: */
192 /* Subscript of nodes table entry. */
193 typedef Int Node_Id;
195 /* Used in semantics for Node_Id value referencing an entity. */
196 typedef Node_Id Entity_Id;
198 /* Null node. */
199 #define Empty 0
201 /* Error node. */
202 #define Error 1
204 /* Subscript of first allocated node. */
205 #define First_Node_Id Empty
207 /* Subscript of entry in lists table. */
208 typedef Int List_Id;
210 /* Indicates absence of a list. */
211 #define No_List 0
213 /* Error list. */
214 #define Error_List List_Low_Bound
216 /* Subscript of first allocated list header. */
217 #define First_List_Id Error_List
219 /* Element list Id, subscript value of entry in lists table. */
220 typedef Int Elist_Id;
222 /* Used to indicate absence of an element list. */
223 #define No_Elist Elist_Low_Bound
225 /* Subscript of first allocated elist header */
226 #define First_Elist_Id (No_Elist + 1)
228 /* Element Id, subscript value of entry in elements table. */
229 typedef Int Elmt_Id;
231 /* Used to indicate absence of a list element. */
232 #define No_Elmt Elmt_Low_Bound
234 /* Subscript of first allocated element */
235 #define First_Elmt_Id (No_Elmt + 1)
237 /* Types for String_Table Package: */
239 /* Subscript of strings table entry. */
240 typedef Int String_Id;
242 /* Used to indicate missing string Id. */
243 #define No_String Strings_Low_Bound
245 /* Subscript of first entry in strings table. */
246 #define First_String_Id (No_String + 1)
248 /* Types for Uint_Support Package: */
250 /* Type used for representation of universal integers. */
251 typedef Int Uint;
253 /* Used to indicate missing Uint value. */
254 #define No_Uint Uint_Low_Bound
256 /* Base value used to represent Uint values. */
257 #define Base 32768
259 /* Minimum and maximum integers directly representable as Uint values */
260 #define Min_Direct (-(Base - 1))
261 #define Max_Direct ((Base - 1) * (Base - 1))
263 #define Uint_Direct_Bias (Uint_Low_Bound + Base)
264 #define Uint_Direct_First (Uint_Direct_Bias + Min_Direct)
265 #define Uint_Direct_Last (Uint_Direct_Bias + Max_Direct)
267 /* Define range of direct biased values */
268 SUBTYPE (Uint_Direct, Uint, Uint_Direct_First, Uint_Direct_Last)
270 /* Constants in Uint format. */
271 #define Uint_0 (Uint_Direct_Bias + 0)
272 #define Uint_1 (Uint_Direct_Bias + 1)
273 #define Uint_2 (Uint_Direct_Bias + 2)
274 #define Uint_10 (Uint_Direct_Bias + 10)
275 #define Uint_16 (Uint_Direct_Bias + 16)
277 /* Types for Ureal_Support Package: */
279 /* Type used for representation of universal reals. */
280 typedef Int Ureal;
282 /* Used to indicate missing Uint value. */
283 #define No_Ureal Ureal_Low_Bound
285 /* Subscript of first entry in Ureal table. */
286 #define Ureal_First_Entry (No_Ureal + 1)
288 /* Character Code Type: */
290 /* Character code value, intended to be 16 bits. */
291 typedef short Char_Code;
293 /* Types Used for Library Management: */
295 /* Unit number. */
296 typedef Int Unit_Number_Type;
298 /* Unit number value for main unit. */
299 #define Main_Unit 0
301 /* Type used for lines table. */
302 typedef Source_Ptr *Lines_Table_Type;
304 /* Type used for pointer to lines table. */
305 typedef Source_Ptr *Lines_Table_Ptr;
307 /* Length of time stamp value. */
308 #define Time_Stamp_Length 22
310 /* Type used to represent time stamp. */
311 typedef Char *Time_Stamp_Type;
313 /* Name_Id synonym used for file names. */
314 typedef Name_Id File_Name_Type;
316 /* Constant used to indicate no file found. */
317 #define No_File No_Name
319 /* Name_Id synonym used for unit names. */
320 typedef Name_Id Unit_Name_Type;
322 /* Definitions for mechanism type and values */
323 typedef Int Mechanism_Type;
324 #define Default 0
325 #define By_Copy (-1)
326 #define By_Reference (-2)
327 #define By_Descriptor (-3)
328 #define By_Descriptor_UBS (-4)
329 #define By_Descriptor_UBSB (-5)
330 #define By_Descriptor_UBA (-6)
331 #define By_Descriptor_S (-7)
332 #define By_Descriptor_SB (-8)
333 #define By_Descriptor_A (-9)
334 #define By_Descriptor_NCA (-10)
336 /* Definitions of Reason codes for Raise_xxx_Error nodes */
337 #define CE_Access_Check_Failed 0
338 #define CE_Access_Parameter_Is_Null 1
339 #define CE_Discriminant_Check_Failed 2
340 #define CE_Divide_By_Zero 3
341 #define CE_Explicit_Raise 4
342 #define CE_Index_Check_Failed 5
343 #define CE_Invalid_Data 6
344 #define CE_Length_Check_Failed 7
345 #define CE_Overflow_Check_Failed 8
346 #define CE_Partition_Check_Failed 9
347 #define CE_Range_Check_Failed 10
348 #define CE_Tag_Check_Failed 11
349 #define PE_Access_Before_Elaboration 12
350 #define PE_Accessibility_Check_Failed 13
351 #define PE_All_Guards_Closed 14
352 #define PE_Duplicated_Entry_Address 15
353 #define PE_Explicit_Raise 16
354 #define PE_Finalize_Raised_Exception 17
355 #define PE_Invalid_Data 18
356 #define PE_Misaligned_Address_Value 19
357 #define PE_Missing_Return 20
358 #define PE_Potentially_Blocking_Operation 21
359 #define PE_Stubbed_Subprogram_Called 22
360 #define PE_Unchecked_Union_Restriction 23
361 #define SE_Empty_Storage_Pool 24
362 #define SE_Explicit_Raise 25
363 #define SE_Infinite_Recursion 26
364 #define SE_Object_Too_Large 27
365 #define SE_Restriction_Violation 28
367 #define LAST_REASON_CODE 28