| 1 |
(* m2type.def definition module for m2type.cc. |
| 2 |
|
| 3 |
Copyright (C) 2011-2025 Free Software Foundation, Inc. |
| 4 |
Contributed by Gaius Mulley <[email protected]>. |
| 5 |
|
| 6 |
This file is part of GNU Modula-2. |
| 7 |
|
| 8 |
GNU Modula-2 is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; either version 3, or (at your option) |
| 11 |
any later version. |
| 12 |
|
| 13 |
GNU Modula-2 is distributed in the hope that it will be useful, but |
| 14 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License |
| 19 |
along with GNU Modula-2; see the file COPYING3. If not see |
| 20 |
<http://www.gnu.org/licenses/>. *) |
| 21 |
|
| 22 |
DEFINITION MODULE FOR "C" m2type ; |
| 23 |
|
| 24 |
FROM SYSTEM IMPORT ADDRESS ; |
| 25 |
FROM gcctypes IMPORT location_t, tree ; |
| 26 |
FROM CDataTypes IMPORT CharStar, ConstCharStar ; |
| 27 |
|
| 28 |
TYPE |
| 29 |
Constructor = ADDRESS ; |
| 30 |
|
| 31 |
|
| 32 |
(* |
| 33 |
ValueInTypeRange - returns TRUE if the constant, value, lies in the range |
| 34 |
of, type. |
| 35 |
*) |
| 36 |
|
| 37 |
PROCEDURE ValueInTypeRange (type: tree; value: tree) : BOOLEAN ; |
| 38 |
|
| 39 |
|
| 40 |
(* |
| 41 |
ValueOutOfTypeRange - returns TRUE if the constant, value, exceed the range |
| 42 |
of, type. |
| 43 |
*) |
| 44 |
|
| 45 |
PROCEDURE ValueOutOfTypeRange (type: tree; value: tree) : BOOLEAN ; |
| 46 |
|
| 47 |
|
| 48 |
(* |
| 49 |
ExceedsTypeRange - return TRUE if low or high exceed the range of, type. |
| 50 |
*) |
| 51 |
|
| 52 |
PROCEDURE ExceedsTypeRange (type: tree; low, high: tree) : BOOLEAN ; |
| 53 |
|
| 54 |
|
| 55 |
(* |
| 56 |
WithinTypeRange - return TRUE if low and high are within the range of, type. |
| 57 |
*) |
| 58 |
|
| 59 |
PROCEDURE WithinTypeRange (type: tree; low, high: tree) : BOOLEAN ; |
| 60 |
|
| 61 |
|
| 62 |
(* |
| 63 |
BuildSubrangeType - creates a subrange of, type, with, lowval, highval. |
| 64 |
*) |
| 65 |
|
| 66 |
PROCEDURE BuildSubrangeType (location: location_t; name: CharStar; type: tree; lowval: tree; highval: tree) : tree ; |
| 67 |
|
| 68 |
|
| 69 |
(* |
| 70 |
BuildCharConstant - creates a character constant given a, string. |
| 71 |
*) |
| 72 |
|
| 73 |
PROCEDURE BuildCharConstant (location: location_t; string: ConstCharStar) : tree ; |
| 74 |
|
| 75 |
|
| 76 |
(* |
| 77 |
BuildCharConstantChar - creates a character constant given a character, ch. |
| 78 |
*) |
| 79 |
|
| 80 |
PROCEDURE BuildCharConstantChar (location: location_t; ch: CHAR) : tree ; |
| 81 |
|
| 82 |
|
| 83 |
(* |
| 84 |
BuildArrayConstructorElement - adds, value, to the constructor_element_list. |
| 85 |
*) |
| 86 |
|
| 87 |
PROCEDURE BuildArrayConstructorElement (p: ADDRESS; value: tree; indice: tree) ; |
| 88 |
|
| 89 |
|
| 90 |
(* |
| 91 |
BuildEndArrayConstructor - returns a tree containing the array |
| 92 |
compound literal. |
| 93 |
*) |
| 94 |
|
| 95 |
PROCEDURE BuildEndArrayConstructor (p: Constructor) : tree ; |
| 96 |
|
| 97 |
|
| 98 |
(* |
| 99 |
BuildEndArrayConstructor - returns a tree containing the array |
| 100 |
compound literal. |
| 101 |
*) |
| 102 |
|
| 103 |
PROCEDURE BuildStartArrayConstructor (type: tree) : Constructor ; |
| 104 |
|
| 105 |
|
| 106 |
(* |
| 107 |
BuildRecordConstructorElement - adds, value, to the constructor_element_list. |
| 108 |
*) |
| 109 |
|
| 110 |
PROCEDURE BuildRecordConstructorElement (p: Constructor; value: tree) ; |
| 111 |
|
| 112 |
|
| 113 |
(* |
| 114 |
BuildEndRecordConstructor - returns a tree containing the record compound literal. |
| 115 |
*) |
| 116 |
|
| 117 |
PROCEDURE BuildEndRecordConstructor (p: Constructor) : tree ; |
| 118 |
|
| 119 |
|
| 120 |
(* |
| 121 |
BuildStartRecordConstructor - initializes a record compound |
| 122 |
constructor frame. |
| 123 |
*) |
| 124 |
|
| 125 |
PROCEDURE BuildStartRecordConstructor (type: tree) : Constructor ; |
| 126 |
|
| 127 |
|
| 128 |
(* |
| 129 |
BuildEndSetConstructor - finishes building a set constant. |
| 130 |
*) |
| 131 |
|
| 132 |
PROCEDURE BuildEndSetConstructor (p: Constructor) : tree ; |
| 133 |
|
| 134 |
|
| 135 |
(* |
| 136 |
BuildSetConstructorElement - adds, value, to the constructor_element_list. |
| 137 |
*) |
| 138 |
|
| 139 |
PROCEDURE BuildSetConstructorElement (p: Constructor; value: tree) ; |
| 140 |
|
| 141 |
|
| 142 |
(* |
| 143 |
BuildStartSetConstructor - starts to create a set constant. |
| 144 |
Remember that type is really a record type. |
| 145 |
*) |
| 146 |
|
| 147 |
PROCEDURE BuildStartSetConstructor (type: tree) : Constructor ; |
| 148 |
|
| 149 |
|
| 150 |
(* |
| 151 |
BuildSetType - creates a SET OF [lowval..highval] |
| 152 |
*) |
| 153 |
|
| 154 |
PROCEDURE BuildSetType (location: location_t; name: CharStar; type: tree; lowval: tree; highval: tree; ispacked: BOOLEAN) : tree ; |
| 155 |
|
| 156 |
|
| 157 |
(* |
| 158 |
BuildConstPointerType - returns a type which is a const pointer to, totype. |
| 159 |
*) |
| 160 |
|
| 161 |
PROCEDURE BuildConstPointerType (totype: tree) : tree ; |
| 162 |
|
| 163 |
|
| 164 |
(* |
| 165 |
BuildPointerType - returns a type which is a pointer to, totype. |
| 166 |
*) |
| 167 |
|
| 168 |
PROCEDURE BuildPointerType (totype: tree) : tree ; |
| 169 |
|
| 170 |
|
| 171 |
(* |
| 172 |
BuildEnumerator - build an enumerator and add it to the, enumvalues, list. |
| 173 |
It returns a copy of the value. --fixme-- why do this? |
| 174 |
*) |
| 175 |
|
| 176 |
PROCEDURE BuildEnumerator (location: location_t; name: CharStar; value: tree; |
| 177 |
VAR enumvalues: tree) : tree ; |
| 178 |
|
| 179 |
|
| 180 |
(* |
| 181 |
BuildEndEnumeration - finish building the enumeration, it uses the enum |
| 182 |
list, enumvalues, and returns a enumeration type tree. |
| 183 |
*) |
| 184 |
|
| 185 |
PROCEDURE BuildEndEnumeration (location: location_t; type: tree; enumvalues: tree) : tree ; |
| 186 |
|
| 187 |
|
| 188 |
(* |
| 189 |
BuildStartEnumeration - create an enumerated type in gcc. |
| 190 |
*) |
| 191 |
|
| 192 |
PROCEDURE BuildStartEnumeration (location: location_t; name: CharStar; ispacked: BOOLEAN) : tree ; |
| 193 |
|
| 194 |
|
| 195 |
(* |
| 196 |
BuildTypeDeclaration - adds the, type, to the current statement list. |
| 197 |
*) |
| 198 |
|
| 199 |
PROCEDURE BuildTypeDeclaration (location: location_t; type: tree) ; |
| 200 |
|
| 201 |
|
| 202 |
(* |
| 203 |
GetMaxFrom - given a, type, return a constant representing the maximum |
| 204 |
legal value. |
| 205 |
*) |
| 206 |
|
| 207 |
PROCEDURE GetMaxFrom (location: location_t; type: tree) : tree ; |
| 208 |
|
| 209 |
|
| 210 |
(* |
| 211 |
GetMinFrom - given a, type, return a constant representing the minimum |
| 212 |
legal value. |
| 213 |
*) |
| 214 |
|
| 215 |
PROCEDURE GetMinFrom (location: location_t; type: tree) : tree ; |
| 216 |
|
| 217 |
|
| 218 |
(* |
| 219 |
GetDefaultType - given a, type, with a, name, return a GCC declaration of this type. |
| 220 |
Checks to see whether the type name has already been declared as a |
| 221 |
default type and if so it returns this declaration. Otherwise it |
| 222 |
declares the type. In Modula-2 this is equivalent to: |
| 223 |
|
| 224 |
TYPE |
| 225 |
name = type ; |
| 226 |
|
| 227 |
We need this function as the initialization to gccgm2.c will |
| 228 |
declare C default types and _some_ M2 default types. |
| 229 |
*) |
| 230 |
|
| 231 |
PROCEDURE GetDefaultType (location: location_t; name: CharStar; type: tree) : tree ; |
| 232 |
|
| 233 |
|
| 234 |
(* |
| 235 |
BuildEndType - finish declaring, type, and return, type. |
| 236 |
*) |
| 237 |
|
| 238 |
PROCEDURE BuildEndType (location: location_t; type: tree) : tree ; |
| 239 |
|
| 240 |
|
| 241 |
(* |
| 242 |
BuildStartType - given a, type, with a, name, return a GCC declaration of this type. |
| 243 |
TYPE |
| 244 |
name = foo ; |
| 245 |
|
| 246 |
the type, foo, maybe a partially created type (which has |
| 247 |
yet to be 'gm2_finish_decl'ed. |
| 248 |
*) |
| 249 |
|
| 250 |
PROCEDURE BuildStartType (location: location_t; name: CharStar; type: tree) : tree ; |
| 251 |
|
| 252 |
|
| 253 |
(* |
| 254 |
InitSystemTypes - |
| 255 |
*) |
| 256 |
|
| 257 |
PROCEDURE InitSystemTypes (location: location_t; loc: INTEGER) ; |
| 258 |
|
| 259 |
|
| 260 |
(* |
| 261 |
InitBaseTypes - |
| 262 |
*) |
| 263 |
|
| 264 |
PROCEDURE InitBaseTypes (location: location_t) ; |
| 265 |
|
| 266 |
|
| 267 |
(* |
| 268 |
BuildVariableArrayAndDeclare - creates a variable length array. |
| 269 |
high is the maximum legal elements (which is a runtime variable). |
| 270 |
This creates and array index, array type and local variable. |
| 271 |
*) |
| 272 |
|
| 273 |
PROCEDURE BuildVariableArrayAndDeclare (location: location_t; elementtype: tree; high: tree; name: CharStar; scope: tree) : tree ; |
| 274 |
|
| 275 |
|
| 276 |
(* |
| 277 |
InitFunctionTypeParameters - resets the current function type parameter list. |
| 278 |
*) |
| 279 |
|
| 280 |
PROCEDURE InitFunctionTypeParameters ; |
| 281 |
|
| 282 |
|
| 283 |
(* |
| 284 |
BuildProcTypeParameterDeclaration - creates and returns one parameter from, name, and, type. |
| 285 |
It appends this parameter to the internal param_type_list. |
| 286 |
*) |
| 287 |
|
| 288 |
PROCEDURE BuildProcTypeParameterDeclaration (location: location_t; type: tree; isreference: BOOLEAN) : tree ; |
| 289 |
|
| 290 |
|
| 291 |
(* |
| 292 |
BuildStartFunctionType - creates a pointer type, necessary to |
| 293 |
create a function type. |
| 294 |
*) |
| 295 |
|
| 296 |
PROCEDURE BuildStartFunctionType (location: location_t; name: CharStar) : tree ; |
| 297 |
|
| 298 |
|
| 299 |
(* |
| 300 |
BuildEndFunctionType - build a function type which would return a, value. |
| 301 |
The arguments have been created by BuildParameterDeclaration. |
| 302 |
*) |
| 303 |
|
| 304 |
PROCEDURE BuildEndFunctionType (func: tree; type: tree; usesvarags: BOOLEAN) : tree ; |
| 305 |
|
| 306 |
|
| 307 |
(* |
| 308 |
GetTreeType - returns TREE_TYPE (t). |
| 309 |
*) |
| 310 |
|
| 311 |
PROCEDURE GetTreeType (type: tree) : tree ; |
| 312 |
|
| 313 |
|
| 314 |
(* |
| 315 |
DeclareKnownType - given a, type, with a, name, return a GCC declaration of this type. |
| 316 |
TYPE |
| 317 |
name = foo ; |
| 318 |
*) |
| 319 |
|
| 320 |
PROCEDURE DeclareKnownType (location: location_t; name: CharStar; type: tree) : tree ; |
| 321 |
|
| 322 |
|
| 323 |
(* |
| 324 |
GetM2ZType - return the ISO Z data type, the longest int datatype. |
| 325 |
*) |
| 326 |
|
| 327 |
PROCEDURE GetM2ZType () : tree ; |
| 328 |
|
| 329 |
|
| 330 |
(* |
| 331 |
GetM2RType - return the ISO R data type, the longest real datatype. |
| 332 |
*) |
| 333 |
|
| 334 |
PROCEDURE GetM2RType () : tree ; |
| 335 |
|
| 336 |
|
| 337 |
(* |
| 338 |
BuildSetTypeFromSubrange - constructs a set type from a subrangeType. |
| 339 |
*) |
| 340 |
|
| 341 |
PROCEDURE BuildSetTypeFromSubrange (location: location_t; name: CharStar; |
| 342 |
subrangeType: tree; |
| 343 |
lowval: tree; highval: tree; |
| 344 |
ispacked: BOOLEAN) : tree ; |
| 345 |
|
| 346 |
|
| 347 |
(* |
| 348 |
BuildSmallestTypeRange - returns the smallest INTEGER_TYPE which is |
| 349 |
sufficient to contain values: low..high. |
| 350 |
*) |
| 351 |
|
| 352 |
PROCEDURE BuildSmallestTypeRange (location: location_t; low: tree; high: tree) : tree ; |
| 353 |
|
| 354 |
|
| 355 |
(* |
| 356 |
GetBooleanType - |
| 357 |
*) |
| 358 |
|
| 359 |
PROCEDURE GetBooleanType () : tree ; |
| 360 |
|
| 361 |
|
| 362 |
(* |
| 363 |
GetBooleanFalse - |
| 364 |
*) |
| 365 |
|
| 366 |
PROCEDURE GetBooleanFalse () : tree ; |
| 367 |
|
| 368 |
|
| 369 |
(* |
| 370 |
GetBooleanTrue - |
| 371 |
*) |
| 372 |
|
| 373 |
PROCEDURE GetBooleanTrue () : tree ; |
| 374 |
|
| 375 |
|
| 376 |
(* |
| 377 |
GetPackedBooleanType - return the packed boolean data type node. |
| 378 |
*) |
| 379 |
|
| 380 |
PROCEDURE GetPackedBooleanType () : tree ; |
| 381 |
|
| 382 |
|
| 383 |
(* |
| 384 |
GetCharType - return the char type node. |
| 385 |
*) |
| 386 |
|
| 387 |
PROCEDURE GetCharType () : tree ; |
| 388 |
|
| 389 |
|
| 390 |
(* |
| 391 |
GetByteType - return the byte type node. |
| 392 |
*) |
| 393 |
|
| 394 |
PROCEDURE GetByteType () : tree ; |
| 395 |
|
| 396 |
|
| 397 |
(* |
| 398 |
GetVoidType - return the C void type. |
| 399 |
*) |
| 400 |
|
| 401 |
PROCEDURE GetVoidType () : tree ; |
| 402 |
|
| 403 |
|
| 404 |
(* |
| 405 |
GetBitnumType - return the ISO bitnum type. |
| 406 |
*) |
| 407 |
|
| 408 |
PROCEDURE GetBitnumType () : tree ; |
| 409 |
|
| 410 |
|
| 411 |
(* |
| 412 |
GetRealType - |
| 413 |
*) |
| 414 |
|
| 415 |
PROCEDURE GetRealType () : tree ; |
| 416 |
|
| 417 |
|
| 418 |
(* |
| 419 |
GetLongRealType - return the C long double data type. |
| 420 |
*) |
| 421 |
|
| 422 |
PROCEDURE GetLongRealType () : tree ; |
| 423 |
|
| 424 |
|
| 425 |
(* |
| 426 |
GetShortRealType - return the C float data type. |
| 427 |
*) |
| 428 |
|
| 429 |
PROCEDURE GetShortRealType () : tree ; |
| 430 |
|
| 431 |
|
| 432 |
(* |
| 433 |
GetLongIntType - return the C long int data type. |
| 434 |
*) |
| 435 |
|
| 436 |
PROCEDURE GetLongIntType () : tree ; |
| 437 |
|
| 438 |
|
| 439 |
(* |
| 440 |
GetPointerType - return the GCC ptr type node. Equivalent to (void * ). |
| 441 |
*) |
| 442 |
|
| 443 |
PROCEDURE GetPointerType () : tree ; |
| 444 |
|
| 445 |
|
| 446 |
(* |
| 447 |
GetCardinalType - return the cardinal type. |
| 448 |
*) |
| 449 |
|
| 450 |
PROCEDURE GetCardinalType () : tree ; |
| 451 |
|
| 452 |
|
| 453 |
(* |
| 454 |
GetIntegerType - return the integer type node. |
| 455 |
*) |
| 456 |
|
| 457 |
PROCEDURE GetIntegerType () : tree ; |
| 458 |
|
| 459 |
|
| 460 |
(* |
| 461 |
GetWordType - return the C unsigned data type. |
| 462 |
*) |
| 463 |
|
| 464 |
PROCEDURE GetWordType () : tree ; |
| 465 |
|
| 466 |
|
| 467 |
(* |
| 468 |
GetM2CardinalType - return the m2 cardinal data type. |
| 469 |
*) |
| 470 |
|
| 471 |
PROCEDURE GetM2CardinalType () : tree ; |
| 472 |
|
| 473 |
|
| 474 |
(* |
| 475 |
GetBitsetType - return the bitset type. |
| 476 |
*) |
| 477 |
|
| 478 |
PROCEDURE GetBitsetType () : tree ; |
| 479 |
|
| 480 |
|
| 481 |
(* |
| 482 |
GetM2CType - a test function. |
| 483 |
*) |
| 484 |
|
| 485 |
PROCEDURE GetM2CType () : tree ; |
| 486 |
|
| 487 |
|
| 488 |
(* |
| 489 |
GetProcType - return the m2 proc data type. |
| 490 |
*) |
| 491 |
|
| 492 |
PROCEDURE GetProcType () : tree ; |
| 493 |
|
| 494 |
|
| 495 |
(* |
| 496 |
GetM2ComplexType - return the complex type. |
| 497 |
*) |
| 498 |
|
| 499 |
PROCEDURE GetM2ComplexType () : tree ; |
| 500 |
|
| 501 |
|
| 502 |
(* |
| 503 |
GetM2LongComplexType - return the long complex type. |
| 504 |
*) |
| 505 |
|
| 506 |
PROCEDURE GetM2LongComplexType () : tree ; |
| 507 |
|
| 508 |
|
| 509 |
(* |
| 510 |
GetM2ShortComplexType - return the short complex type. |
| 511 |
*) |
| 512 |
|
| 513 |
PROCEDURE GetM2ShortComplexType () : tree ; |
| 514 |
|
| 515 |
|
| 516 |
(* |
| 517 |
GetM2Complex128Type - return the fixed size complex type. |
| 518 |
*) |
| 519 |
|
| 520 |
PROCEDURE GetM2Complex128 () : tree ; |
| 521 |
|
| 522 |
|
| 523 |
(* |
| 524 |
GetM2Complex96 - return the fixed size complex type. |
| 525 |
*) |
| 526 |
|
| 527 |
PROCEDURE GetM2Complex96 () : tree ; |
| 528 |
|
| 529 |
|
| 530 |
(* |
| 531 |
GetM2Complex64 - return the fixed size complex type. |
| 532 |
*) |
| 533 |
|
| 534 |
PROCEDURE GetM2Complex64 () : tree ; |
| 535 |
|
| 536 |
|
| 537 |
(* |
| 538 |
GetM2Complex32 - return the fixed size complex type. |
| 539 |
*) |
| 540 |
|
| 541 |
PROCEDURE GetM2Complex32 () : tree ; |
| 542 |
|
| 543 |
|
| 544 |
(* |
| 545 |
GetM2Real128 - return the real 128 bit type. |
| 546 |
*) |
| 547 |
|
| 548 |
PROCEDURE GetM2Real128 () : tree ; |
| 549 |
|
| 550 |
|
| 551 |
(* |
| 552 |
GetM2Real96 - return the real 96 bit type. |
| 553 |
*) |
| 554 |
|
| 555 |
PROCEDURE GetM2Real96 () : tree ; |
| 556 |
|
| 557 |
|
| 558 |
(* |
| 559 |
GetM2Real64 - return the real 64 bit type. |
| 560 |
*) |
| 561 |
|
| 562 |
PROCEDURE GetM2Real64 () : tree ; |
| 563 |
|
| 564 |
|
| 565 |
(* |
| 566 |
GetM2Real32 - return the real 32 bit type. |
| 567 |
*) |
| 568 |
|
| 569 |
PROCEDURE GetM2Real32 () : tree ; |
| 570 |
|
| 571 |
|
| 572 |
(* |
| 573 |
GetM2Bitset32 - return the bitset 32 bit type. |
| 574 |
*) |
| 575 |
|
| 576 |
PROCEDURE GetM2Bitset32 () : tree ; |
| 577 |
|
| 578 |
|
| 579 |
(* |
| 580 |
GetM2Bitset16 - return the bitset 16 bit type. |
| 581 |
*) |
| 582 |
|
| 583 |
PROCEDURE GetM2Bitset16 () : tree ; |
| 584 |
|
| 585 |
|
| 586 |
(* |
| 587 |
GetM2Bitset8 - return the bitset 8 bit type. |
| 588 |
*) |
| 589 |
|
| 590 |
PROCEDURE GetM2Bitset8 () : tree ; |
| 591 |
|
| 592 |
|
| 593 |
(* |
| 594 |
GetM2Word64 - return the word 64 bit type. |
| 595 |
*) |
| 596 |
|
| 597 |
PROCEDURE GetM2Word64 () : tree ; |
| 598 |
|
| 599 |
|
| 600 |
(* |
| 601 |
GetM2Word32 - return the word 32 bit type. |
| 602 |
*) |
| 603 |
|
| 604 |
PROCEDURE GetM2Word32 () : tree ; |
| 605 |
|
| 606 |
|
| 607 |
(* |
| 608 |
GetM2Word16 - return the word 16 bit type. |
| 609 |
*) |
| 610 |
|
| 611 |
PROCEDURE GetM2Word16 () : tree ; |
| 612 |
|
| 613 |
|
| 614 |
(* |
| 615 |
GetM2Cardinal64 - return the cardinal 64 bit type. |
| 616 |
*) |
| 617 |
|
| 618 |
PROCEDURE GetM2Cardinal64 () : tree ; |
| 619 |
|
| 620 |
|
| 621 |
(* |
| 622 |
GetM2Cardinal32 - return the cardinal 32 bit type. |
| 623 |
*) |
| 624 |
|
| 625 |
PROCEDURE GetM2Cardinal32 () : tree ; |
| 626 |
|
| 627 |
|
| 628 |
(* |
| 629 |
GetM2Cardinal16 - return the cardinal 16 bit type. |
| 630 |
*) |
| 631 |
|
| 632 |
PROCEDURE GetM2Cardinal16 () : tree ; |
| 633 |
|
| 634 |
|
| 635 |
(* |
| 636 |
GetM2Cardinal8 - return the cardinal 8 bit type. |
| 637 |
*) |
| 638 |
|
| 639 |
PROCEDURE GetM2Cardinal8 () : tree ; |
| 640 |
|
| 641 |
|
| 642 |
(* |
| 643 |
GetM2Integer64 - return the integer 64 bit type. |
| 644 |
*) |
| 645 |
|
| 646 |
PROCEDURE GetM2Integer64 () : tree ; |
| 647 |
|
| 648 |
|
| 649 |
(* |
| 650 |
GetM2Integer32 - return the integer 32 bit type. |
| 651 |
*) |
| 652 |
|
| 653 |
PROCEDURE GetM2Integer32 () : tree ; |
| 654 |
|
| 655 |
|
| 656 |
(* |
| 657 |
GetM2Integer16 - return the integer 16 bit type. |
| 658 |
*) |
| 659 |
|
| 660 |
PROCEDURE GetM2Integer16 () : tree ; |
| 661 |
|
| 662 |
|
| 663 |
(* |
| 664 |
GetM2Integer8 - return the integer 8 bit type. |
| 665 |
*) |
| 666 |
|
| 667 |
PROCEDURE GetM2Integer8 () : tree ; |
| 668 |
|
| 669 |
|
| 670 |
(* |
| 671 |
GetISOLocType - return the m2 loc word data type. |
| 672 |
*) |
| 673 |
|
| 674 |
PROCEDURE GetISOLocType () : tree ; |
| 675 |
|
| 676 |
|
| 677 |
(* |
| 678 |
GetISOByteType - return the m2 iso byte data type. |
| 679 |
*) |
| 680 |
|
| 681 |
PROCEDURE GetISOByteType () : tree ; |
| 682 |
|
| 683 |
|
| 684 |
(* |
| 685 |
GetISOWordType - return the m2 iso word data type. |
| 686 |
*) |
| 687 |
|
| 688 |
PROCEDURE GetISOWordType () : tree ; |
| 689 |
|
| 690 |
|
| 691 |
(* |
| 692 |
GetShortCardType - return the C short unsigned data type. |
| 693 |
*) |
| 694 |
|
| 695 |
PROCEDURE GetShortCardType () : tree ; |
| 696 |
|
| 697 |
|
| 698 |
(* |
| 699 |
GetM2ShortCardType - return the m2 short cardinal data type. |
| 700 |
*) |
| 701 |
|
| 702 |
PROCEDURE GetM2ShortCardType () : tree ; |
| 703 |
|
| 704 |
|
| 705 |
(* |
| 706 |
GetShortIntType - return the C short int data type. |
| 707 |
*) |
| 708 |
|
| 709 |
PROCEDURE GetShortIntType () : tree ; |
| 710 |
|
| 711 |
|
| 712 |
(* |
| 713 |
GetM2ShortIntType - return the m2 short integer data type. |
| 714 |
*) |
| 715 |
|
| 716 |
PROCEDURE GetM2ShortIntType () : tree ; |
| 717 |
|
| 718 |
|
| 719 |
(* |
| 720 |
GetM2LongCardType - return the m2 long cardinal data type. |
| 721 |
*) |
| 722 |
|
| 723 |
PROCEDURE GetM2LongCardType () : tree ; |
| 724 |
|
| 725 |
|
| 726 |
(* |
| 727 |
GetM2LongIntType - return the m2 long integer data type. |
| 728 |
*) |
| 729 |
|
| 730 |
PROCEDURE GetM2LongIntType () : tree ; |
| 731 |
|
| 732 |
|
| 733 |
(* |
| 734 |
GetM2LongRealType - return the m2 long real data type. |
| 735 |
*) |
| 736 |
|
| 737 |
PROCEDURE GetM2LongRealType () : tree ; |
| 738 |
|
| 739 |
|
| 740 |
(* |
| 741 |
GetM2RealType - return the m2 real data type. |
| 742 |
*) |
| 743 |
|
| 744 |
PROCEDURE GetM2RealType () : tree ; |
| 745 |
|
| 746 |
|
| 747 |
(* |
| 748 |
GetM2ShortRealType - return the m2 short real data type. |
| 749 |
*) |
| 750 |
|
| 751 |
PROCEDURE GetM2ShortRealType () : tree ; |
| 752 |
|
| 753 |
|
| 754 |
(* |
| 755 |
GetM2IntegerType - return the m2 integer data type. |
| 756 |
*) |
| 757 |
|
| 758 |
PROCEDURE GetM2IntegerType () : tree ; |
| 759 |
|
| 760 |
|
| 761 |
(* |
| 762 |
GetM2CharType - return the m2 char data type. |
| 763 |
*) |
| 764 |
|
| 765 |
PROCEDURE GetM2CharType () : tree ; |
| 766 |
|
| 767 |
|
| 768 |
(* |
| 769 |
GetCSizeTType - return a type representing size_t. |
| 770 |
*) |
| 771 |
|
| 772 |
PROCEDURE GetCSizeTType () : tree ; |
| 773 |
|
| 774 |
|
| 775 |
(* |
| 776 |
GetCSSizeTType - return a type representing ssize_t. |
| 777 |
*) |
| 778 |
|
| 779 |
PROCEDURE GetCSSizeTType () : tree ; |
| 780 |
|
| 781 |
|
| 782 |
(* |
| 783 |
GetCOffTType - return a type representing OFF_T. |
| 784 |
*) |
| 785 |
|
| 786 |
PROCEDURE GetCOffTType () : tree ; |
| 787 |
|
| 788 |
|
| 789 |
(* |
| 790 |
BuildArrayStringConstructor - creates an array constructor for, arrayType, |
| 791 |
consisting of the character elements |
| 792 |
defined by, str, of, length, characters. |
| 793 |
*) |
| 794 |
|
| 795 |
PROCEDURE BuildArrayStringConstructor (location: location_t; arrayType: tree; str: tree; length: tree) : tree ; |
| 796 |
|
| 797 |
|
| 798 |
(* |
| 799 |
RealToTree - convert a real number into a Tree. |
| 800 |
*) |
| 801 |
|
| 802 |
PROCEDURE RealToTree (name: CharStar) : tree ; |
| 803 |
|
| 804 |
|
| 805 |
(* |
| 806 |
BuildStartRecord - return a RECORD tree. |
| 807 |
*) |
| 808 |
|
| 809 |
PROCEDURE BuildStartRecord (location: location_t; name: CharStar) : tree ; |
| 810 |
|
| 811 |
|
| 812 |
(* |
| 813 |
BuildStartUnion - return a union tree. |
| 814 |
*) |
| 815 |
|
| 816 |
PROCEDURE BuildStartUnion (location: location_t; name: CharStar) : tree ; |
| 817 |
|
| 818 |
|
| 819 |
|
| 820 |
PROCEDURE BuildStartVarient (location: location_t; name: CharStar) : tree ; |
| 821 |
|
| 822 |
|
| 823 |
|
| 824 |
PROCEDURE BuildEndVarient (location: location_t; varientField: tree; varientList: tree; isPacked: BOOLEAN) : tree ; |
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
PROCEDURE BuildStartFieldVarient (location: location_t; name: CharStar) : tree ; |
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
PROCEDURE BuildEndFieldVarient (location: location_t; varientField: tree; varientList: tree; isPacked: BOOLEAN) : tree ; |
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
PROCEDURE BuildStartFieldRecord (location: location_t; name: CharStar; type: tree) : tree ; |
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
PROCEDURE BuildFieldRecord (location: location_t; name: CharStar; type: tree) : tree ; |
| 841 |
|
| 842 |
|
| 843 |
(* |
| 844 |
ChainOn - interface so that Modula-2 can also create chains of |
| 845 |
declarations. |
| 846 |
*) |
| 847 |
|
| 848 |
PROCEDURE ChainOn (t1: tree; t2: tree) : tree ; |
| 849 |
|
| 850 |
|
| 851 |
(* |
| 852 |
ChainOnParamValue - adds a list node {{name, str}, value} into the tree list. |
| 853 |
*) |
| 854 |
|
| 855 |
PROCEDURE ChainOnParamValue (list: tree; name: tree; str: tree; value: tree) : tree ; |
| 856 |
|
| 857 |
|
| 858 |
(* |
| 859 |
AddStringToTreeList - adds, string, to list. |
| 860 |
*) |
| 861 |
|
| 862 |
PROCEDURE AddStringToTreeList (list: tree; string: tree) : tree ; |
| 863 |
|
| 864 |
|
| 865 |
(* |
| 866 |
BuildEndRecord - a heavily pruned finish_struct from c-decl.c. |
| 867 |
It sets the context for each field to, t, |
| 868 |
propagates isPacked throughout the fields in |
| 869 |
the structure. |
| 870 |
*) |
| 871 |
|
| 872 |
PROCEDURE BuildEndRecord (location: location_t; record: tree; fieldlist: tree; isPacked: BOOLEAN) : tree ; |
| 873 |
|
| 874 |
|
| 875 |
(* |
| 876 |
SetAlignment - sets the alignment of a, node, to, align. |
| 877 |
It duplicates the, node, and sets the alignment |
| 878 |
to prevent alignment effecting behaviour elsewhere. |
| 879 |
*) |
| 880 |
|
| 881 |
PROCEDURE SetAlignment (node: tree; align: tree) : tree ; |
| 882 |
|
| 883 |
|
| 884 |
(* |
| 885 |
SetDeclPacked - sets the packed bit in decl TREE, node. |
| 886 |
It returns the node. |
| 887 |
*) |
| 888 |
|
| 889 |
PROCEDURE SetDeclPacked (node: tree) : tree ; |
| 890 |
|
| 891 |
|
| 892 |
(* |
| 893 |
SetTypePacked - sets the packed bit in type TREE, node. |
| 894 |
It returns the node. |
| 895 |
*) |
| 896 |
|
| 897 |
PROCEDURE SetTypePacked (node: tree) : tree ; |
| 898 |
|
| 899 |
|
| 900 |
(* |
| 901 |
SetRecordFieldOffset - returns field after the byteOffset and bitOffset |
| 902 |
has been applied to it. |
| 903 |
*) |
| 904 |
|
| 905 |
PROCEDURE SetRecordFieldOffset (field: tree; byteOffset: tree; bitOffset: tree; fieldtype: tree; nbits: tree) : tree ; |
| 906 |
|
| 907 |
|
| 908 |
(* |
| 909 |
BuildPackedFieldRecord - builds a packed field record of, |
| 910 |
name, and, fieldtype. |
| 911 |
*) |
| 912 |
|
| 913 |
PROCEDURE BuildPackedFieldRecord (location: location_t; name: CharStar; fieldtype: tree) : tree ; |
| 914 |
|
| 915 |
|
| 916 |
(* |
| 917 |
BuildNumberOfArrayElements - returns the number of elements in an |
| 918 |
arrayType. |
| 919 |
*) |
| 920 |
|
| 921 |
PROCEDURE BuildNumberOfArrayElements (location: location_t; arrayType: tree) : tree ; |
| 922 |
|
| 923 |
|
| 924 |
(* |
| 925 |
AddStatement - maps onto add_stmt. |
| 926 |
*) |
| 927 |
|
| 928 |
PROCEDURE AddStatement (location: location_t; t: tree) ; |
| 929 |
|
| 930 |
|
| 931 |
(* |
| 932 |
MarkFunctionReferenced - marks a function as referenced. |
| 933 |
*) |
| 934 |
|
| 935 |
PROCEDURE MarkFunctionReferenced (f: tree) ; |
| 936 |
|
| 937 |
|
| 938 |
(* |
| 939 |
GarbageCollect - force gcc to garbage collect. |
| 940 |
*) |
| 941 |
|
| 942 |
PROCEDURE GarbageCollect ; |
| 943 |
|
| 944 |
|
| 945 |
(* |
| 946 |
BuildArrayIndexType - creates an integer index which accesses an array. |
| 947 |
low and high are the min, max elements of the array. |
| 948 |
*) |
| 949 |
|
| 950 |
PROCEDURE BuildArrayIndexType (low: tree; high: tree) : tree ; |
| 951 |
|
| 952 |
|
| 953 |
(* |
| 954 |
GetArrayNoOfElements - returns the number of elements in, arraytype. |
| 955 |
*) |
| 956 |
|
| 957 |
PROCEDURE GetArrayNoOfElements (location: location_t; arraytype: tree) : tree ; |
| 958 |
|
| 959 |
|
| 960 |
(* |
| 961 |
BuildEndArrayType - returns a type which is an array indexed by IndexType |
| 962 |
and which has ElementType elements. |
| 963 |
*) |
| 964 |
|
| 965 |
PROCEDURE BuildEndArrayType (arraytype: tree; elementtype: tree; indextype: tree; type: INTEGER) : tree ; |
| 966 |
|
| 967 |
|
| 968 |
(* |
| 969 |
PutArrayType - |
| 970 |
*) |
| 971 |
|
| 972 |
PROCEDURE PutArrayType (array: tree; type: tree) ; |
| 973 |
|
| 974 |
|
| 975 |
(* |
| 976 |
BuildStartArrayType - creates an array with an indextype and elttype. The front end |
| 977 |
symbol, type, is also passed to allow the gccgm2 to return the |
| 978 |
canonical edition of the array type even if the GCC elttype is |
| 979 |
NULL_TREE. |
| 980 |
*) |
| 981 |
|
| 982 |
PROCEDURE BuildStartArrayType (index_type: tree; elt_type: tree; type: INTEGER) : tree ; |
| 983 |
|
| 984 |
|
| 985 |
(* |
| 986 |
IsAddress - return TRUE if the type is an ADDRESS. |
| 987 |
*) |
| 988 |
|
| 989 |
PROCEDURE IsAddress (type: tree) : BOOLEAN ; |
| 990 |
|
| 991 |
|
| 992 |
(* |
| 993 |
SameRealType - return true if real types a and b are the same. |
| 994 |
*) |
| 995 |
|
| 996 |
PROCEDURE SameRealType (a, b: tree) : BOOLEAN ; |
| 997 |
|
| 998 |
|
| 999 |
(* |
| 1000 |
IsGccStrictTypeEquivalent - return true if left and right and |
| 1001 |
all their contents have the same type. |
| 1002 |
*) |
| 1003 |
|
| 1004 |
PROCEDURE IsGccStrictTypeEquivalent (left, right: tree) : BOOLEAN ; |
| 1005 |
|
| 1006 |
|
| 1007 |
END m2type. |