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