1 /****************************************************************************
2  *                                                                          *
3  *                         GNAT COMPILER COMPONENTS                         *
4  *                                                                          *
5  *                                T Y P E S                                 *
6  *                                                                          *
7  *                              C Header File                               *
8  *                                                                          *
9  *          Copyright (C) 1992-2012, 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 is the C file that corresponds to the Ada package spec Types. It was
27    created manually from the files types.ads and types.adb.
28 
29    This package contains host independent type definitions which are used
30    throughout the compiler modules. The comments in the C version are brief
31    reminders of the purpose of each declaration.  For complete documentation,
32    see the Ada version of these definitions.  */
33 
34 /* Boolean Types:  */
35 
36 /* Boolean type (cannot use enum, because of bit field restriction on some
37    compilers).  */
38 typedef unsigned char Boolean;
39 #define False 0
40 #define True  1
41 
42 /* General Use Integer Types */
43 
44 /* Signed 32-bit integer */
45 typedef int Int;
46 
47 /* Signed 16-bit integer */
48 typedef short Short;
49 
50 /* Non-negative Int values */
51 typedef Int Nat;
52 
53 /* Positive Int values */
54 typedef Int Pos;
55 
56 /* 8-bit unsigned integer */
57 typedef unsigned char Byte;
58 
59 /* 8-Bit Character and String Types:  */
60 
61 /* 8-bit character type */
62 typedef char Char;
63 
64 /* Graphic characters, as defined in ARM */
65 typedef Char Graphic_Character;
66 
67 /* Line terminator characters (LF, VT, FF, CR) */
68 typedef Char Line_Terminator;
69 
70 /* Characters with the upper bit set */
71 typedef Char Upper_Half_Character;
72 
73 /* String type built on Char (note that zero is an OK index) */
74 typedef Char *Str;
75 
76 /* Pointer to string of Chars */
77 typedef Char *Str_Ptr;
78 
79 /* Types for the fat pointer used for strings and the template it
80    points to.  */
81 typedef struct {int Low_Bound, High_Bound; } String_Template;
82 typedef struct {const char *Array; String_Template *Bounds; }
83 	__attribute ((aligned (sizeof (char *) * 2))) Fat_Pointer;
84 
85 /* Types for Node/Entity Kinds:  */
86 
87 /* The reason that these are defined here in the C version, rather than in the
88    corresponding packages is that the requirement for putting bodies of
89    inlined stuff IN the C header changes the dependencies.  Both sinfo.h
90    and einfo.h now reference routines defined in tree.h.
91 
92    Note: these types would more naturally be defined as unsigned  char, but
93    once again, the annoying restriction on bit fields for some compilers
94    bites us!  */
95 
96 typedef unsigned int Node_Kind;
97 typedef unsigned int Entity_Kind;
98 
99 /* Types used for Text Buffer Handling:  */
100 
101 /* Type used for subscripts in text buffer.  */
102 typedef Int Text_Ptr;
103 
104 /* Text buffer used to hold source file or library information file.  */
105 typedef Char *Text_Buffer;
106 
107 /* Pointer to text buffer.  */
108 typedef Char *Text_Buffer_Ptr;
109 
110 /* Types used for Source Input Handling:  */
111 
112 /* Line number type, used for storing all line numbers.  */
113 typedef Int Line_Number_Type;
114 
115 /* Column number type, used for storing all column numbers.  */
116 typedef Int Column_Number_Type;
117 
118 /* Type used to store text of a source file.  */
119 typedef Text_Buffer Source_Buffer;
120 
121 /* Pointer to source buffer. */
122 typedef Text_Buffer_Ptr Source_Buffer_Ptr;
123 
124 /* Type used for source location.  */
125 typedef Text_Ptr Source_Ptr;
126 
127 /* Value used to indicate no source position set.  */
128 #define No_Location -1
129 
130 /* Used for Sloc in all nodes in the representation of package Standard.  */
131 #define Standard_Location -2
132 
133 /* Instance identifiers */
134 typedef Nat Instance_Id;
135 
136 /* Type used for union of all possible ID values covering all ranges */
137 typedef int Union_Id;
138 
139 /* Range definitions for Tree Data:  */
140 
141 #define List_Low_Bound		-100000000
142 #define List_High_Bound		0
143 
144 #define Node_Low_Bound		0
145 #define Node_High_Bound		99999999
146 
147 #define Elist_Low_Bound		100000000
148 #define Elist_High_Bound	199999999
149 
150 #define Elmt_Low_Bound		200000000
151 #define Elmt_High_Bound		299999999
152 
153 #define Names_Low_Bound		300000000
154 #define Names_High_Bound	399999999
155 
156 #define Strings_Low_Bound	400000000
157 #define Strings_High_Bound	499999999
158 
159 #define Ureal_Low_Bound		500000000
160 #define Ureal_High_Bound        599999999
161 
162 #define Uint_Low_Bound		600000000
163 #define Uint_Table_Start        2000000000
164 #define Uint_High_Bound	        2099999999
165 
166 SUBTYPE (List_Range,      Int, List_Low_Bound,    List_High_Bound)
167 SUBTYPE (Node_Range,      Int, Node_Low_Bound,    Node_High_Bound)
168 SUBTYPE (Elist_Range,     Int, Elist_Low_Bound,   Elist_High_Bound)
169 SUBTYPE (Elmt_Range,      Int, Elmt_Low_Bound,    Elmt_High_Bound)
170 SUBTYPE (Names_Range,     Int, Names_Low_Bound,   Names_High_Bound)
171 SUBTYPE (Strings_Range,   Int, Strings_Low_Bound, Strings_High_Bound)
172 SUBTYPE (Uint_Range,      Int, Uint_Low_Bound,    Uint_High_Bound)
173 SUBTYPE (Ureal_Range,     Int, Ureal_Low_Bound,   Ureal_High_Bound)
174 
175 /* Types for Names_Table Package:  */
176 
177 typedef Int Name_Id;
178 
179 /* Name_Id value for no name present.  */
180 #define No_Name Names_Low_Bound
181 
182 /* Name_Id value for bad name.  */
183 #define Error_Name (Names_Low_Bound + 1)
184 
185 /* First subscript of names table. */
186 #define First_Name_Id (Names_Low_Bound + 2)
187 
188 /* Types for Tree Package:  */
189 
190 /* Subscript of nodes table entry.  */
191 typedef Int Node_Id;
192 
193 /* Used in semantics for Node_Id value referencing an entity.  */
194 typedef Node_Id Entity_Id;
195 
196 /* Null node.  */
197 #define Empty 0
198 
199 /* Error node.  */
200 #define Error 1
201 
202 /* Subscript of first allocated node.  */
203 #define First_Node_Id Empty
204 
205 /* Subscript of entry in lists table.  */
206 typedef Int List_Id;
207 
208 /* Indicates absence of a list.  */
209 #define No_List 0
210 
211 /* Error list. */
212 #define Error_List List_Low_Bound
213 
214 /* Subscript of first allocated list header.  */
215 #define First_List_Id Error_List
216 
217 /* Element list Id, subscript value of entry in lists table.  */
218 typedef Int Elist_Id;
219 
220 /* Used to indicate absence of an element list.  */
221 #define No_Elist Elist_Low_Bound
222 
223 /* Subscript of first allocated elist header */
224 #define First_Elist_Id (No_Elist + 1)
225 
226 /* Element Id, subscript value of entry in elements table.  */
227 typedef Int Elmt_Id;
228 
229 /* Used to indicate absence of a list element.  */
230 #define No_Elmt Elmt_Low_Bound
231 
232 /* Subscript of first allocated element */
233 #define First_Elmt_Id (No_Elmt + 1)
234 
235 /* Types for String_Table Package:  */
236 
237 /* Subscript of strings table entry.  */
238 typedef Int String_Id;
239 
240 /* Used to indicate missing string Id.  */
241 #define No_String Strings_Low_Bound
242 
243 /* Subscript of first entry in strings table.  */
244 #define First_String_Id (No_String + 1)
245 
246 /* Types for Uint_Support Package:  */
247 
248 /* Type used for representation of universal integers.  */
249 typedef Int Uint;
250 
251 /* Used to indicate missing Uint value.  */
252 #define No_Uint Uint_Low_Bound
253 
254 /* Base value used to represent Uint values.  */
255 #define Base 32768
256 
257 /* Minimum and maximum integers directly representable as Uint values */
258 #define Min_Direct (-(Base - 1))
259 #define Max_Direct ((Base - 1) * (Base - 1))
260 
261 #define Uint_Direct_Bias  (Uint_Low_Bound + Base)
262 #define Uint_Direct_First (Uint_Direct_Bias + Min_Direct)
263 #define Uint_Direct_Last  (Uint_Direct_Bias + Max_Direct)
264 
265 /* Define range of direct biased values */
266 SUBTYPE (Uint_Direct, Uint, Uint_Direct_First, Uint_Direct_Last)
267 
268 /* Constants in Uint format.  */
269 #define Uint_0  (Uint_Direct_Bias + 0)
270 #define Uint_1  (Uint_Direct_Bias + 1)
271 #define Uint_2  (Uint_Direct_Bias + 2)
272 #define Uint_10 (Uint_Direct_Bias + 10)
273 #define Uint_16 (Uint_Direct_Bias + 16)
274 
275 /* Types for Ureal_Support Package:  */
276 
277 /* Type used for representation of universal reals.  */
278 typedef Int Ureal;
279 
280 /* Used to indicate missing Uint value.  */
281 #define No_Ureal Ureal_Low_Bound
282 
283 /* Subscript of first entry in Ureal table.  */
284 #define Ureal_First_Entry (No_Ureal + 1)
285 
286 /* Character Code Type:  */
287 
288 /* Character code value, intended to be 32 bits.  */
289 typedef unsigned Char_Code;
290 
291 /* Types Used for Library Management:  */
292 
293 /* Unit number.  */
294 typedef Int Unit_Number_Type;
295 
296 /* Unit number value for main unit.  */
297 #define Main_Unit 0
298 
299 /* Type used for lines table.  */
300 typedef Source_Ptr *Lines_Table_Type;
301 
302 /* Type used for pointer to lines table.  */
303 typedef Source_Ptr *Lines_Table_Ptr;
304 
305 /* Length of time stamp value.  */
306 #define Time_Stamp_Length 22
307 
308 /* Type used to represent time stamp.  */
309 typedef Char *Time_Stamp_Type;
310 
311 /* Name_Id synonym used for file names.  */
312 typedef Name_Id File_Name_Type;
313 
314 /* Constant used to indicate no file found.  */
315 #define No_File No_Name
316 
317 /* Name_Id synonym used for unit names.  */
318 typedef Name_Id Unit_Name_Type;
319 
320 /* Definitions for mechanism type and values */
321 typedef Int Mechanism_Type;
322 #define Default            0
323 #define By_Copy            (-1)
324 #define By_Reference       (-2)
325 #define By_Descriptor      (-3)
326 #define By_Descriptor_UBS  (-4)
327 #define By_Descriptor_UBSB (-5)
328 #define By_Descriptor_UBA  (-6)
329 #define By_Descriptor_S    (-7)
330 #define By_Descriptor_SB   (-8)
331 #define By_Descriptor_A    (-9)
332 #define By_Descriptor_NCA  (-10)
333 #define By_Descriptor_Last (-10)
334 #define By_Short_Descriptor      (-11)
335 #define By_Short_Descriptor_UBS  (-12)
336 #define By_Short_Descriptor_UBSB (-13)
337 #define By_Short_Descriptor_UBA  (-14)
338 #define By_Short_Descriptor_S    (-15)
339 #define By_Short_Descriptor_SB   (-16)
340 #define By_Short_Descriptor_A    (-17)
341 #define By_Short_Descriptor_NCA  (-18)
342 #define By_Short_Descriptor_Last (-18)
343 
344 /* Internal to Gigi.  */
345 #define By_Copy_Return     (-128)
346 
347 /* Definitions of Reason codes for Raise_xxx_Error nodes */
348 #define CE_Access_Check_Failed              0
349 #define CE_Access_Parameter_Is_Null         1
350 #define CE_Discriminant_Check_Failed        2
351 #define CE_Divide_By_Zero                   3
352 #define CE_Explicit_Raise                   4
353 #define CE_Index_Check_Failed               5
354 #define CE_Invalid_Data                     6
355 #define CE_Length_Check_Failed              7
356 #define CE_Null_Exception_Id                8
357 #define CE_Null_Not_Allowed                 9
358 #define CE_Overflow_Check_Failed           10
359 #define CE_Partition_Check_Failed          11
360 #define CE_Range_Check_Failed              12
361 #define CE_Tag_Check_Failed                13
362 
363 #define PE_Access_Before_Elaboration       14
364 #define PE_Accessibility_Check_Failed      15
365 #define PE_Address_Of_Intrinsic            16
366 #define PE_All_Guards_Closed               17
367 #define PE_Bad_Attribute_For_Predicate     18
368 #define PE_Current_Task_In_Entry_Body      19
369 #define PE_Duplicated_Entry_Address        20
370 #define PE_Explicit_Raise                  21
371 #define PE_Finalize_Raised_Exception       22
372 #define PE_Implicit_Return                 23
373 #define PE_Misaligned_Address_Value        24
374 #define PE_Missing_Return                  25
375 #define PE_Overlaid_Controlled_Object      26
376 #define PE_Potentially_Blocking_Operation  27
377 #define PE_Stubbed_Subprogram_Called       28
378 #define PE_Unchecked_Union_Restriction     29
379 #define PE_Non_Transportable_Actual        30
380 
381 #define SE_Empty_Storage_Pool              31
382 #define SE_Explicit_Raise                  32
383 #define SE_Infinite_Recursion              33
384 #define SE_Object_Too_Large                34
385 
386 #define LAST_REASON_CODE                   34
387