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