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