Debian Codegraph @

gcc/m2/gm2-compiler/SymbolTable.def

raw
1 (* SymbolTable.def provides access to the symbol table.
2
3 Copyright (C) 2001-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 SymbolTable ;
23
24 (*
25 Author : Gaius Mulley
26 Title : SymbolTable
27 Date : 7/3/87
28 Description: SymbolTable provides the higher level routines to
29 maintain a symbol table for the Modula-2 Compiler.
30 *)
31
32 FROM SYSTEM IMPORT WORD ;
33 FROM SymbolKey IMPORT PerformOperation ;
34 FROM NameKey IMPORT Name ;
35 FROM gcctypes IMPORT tree ;
36 FROM DynamicStrings IMPORT String ;
37 FROM M2Error IMPORT ErrorScope ;
38 FROM Lists IMPORT List ;
39
40
41 (*
42 Throughout this module any SymKey value of 0 is deemed to be a
43 nul symbol.
44 *)
45
46 CONST
47 NulSym = 0 ;
48
49
50 (*
51 Mode describes the modes of the variables and constants
52 *)
53
54 TYPE
55 ModeOfAddr = (NoValue, ImmediateValue, RightValue, LeftValue) ;
56 ProcedureKind = (ProperProcedure, ForwardProcedure, DefProcedure) ;
57 FamilyOperation = PROCEDURE (CARDINAL, CARDINAL, CARDINAL) ;
58
59
60 (*
61 FinalSymbol - returns the highest number symbol used.
62 *)
63
64 PROCEDURE FinalSymbol () : CARDINAL ;
65
66
67 (*
68 MakeComponentRecord - make a temporary which will be used to reference and field
69 (or sub field) of record.
70 *)
71
72 PROCEDURE MakeComponentRecord (tok: CARDINAL;
73 Mode: ModeOfAddr; record: CARDINAL) : CARDINAL ;
74
75
76 (*
77 MakeComponentRef - use, sym, to reference, field, sym is returned.
78 *)
79
80 PROCEDURE MakeComponentRef (sym: CARDINAL; field: CARDINAL) : CARDINAL ;
81
82
83 (*
84 IsComponent - returns TRUE if symbol, sym, is a temporary and a component
85 reference.
86 *)
87
88 PROCEDURE IsComponent (sym: CARDINAL) : BOOLEAN ;
89
90
91 (*
92 MakeTemporary - makes a new temporary variable at the highest real scope.
93 The addressing mode of the temporary is set to Mode.
94 *)
95
96 PROCEDURE MakeTemporary (tok: CARDINAL; Mode: ModeOfAddr) : CARDINAL ;
97
98
99 (*
100 MakeTemporaryFromExpression - makes a new temporary variable at the
101 highest real scope. The addressing
102 mode of the temporary is set and the
103 type is determined by expressions, e.
104 *)
105
106 PROCEDURE MakeTemporaryFromExpression (tok: CARDINAL;
107 e: CARDINAL;
108 mode: ModeOfAddr) : CARDINAL ;
109
110 (*
111 MakeTemporaryFromExpressions - makes a new temporary variable at the
112 highest real scope. The addressing
113 mode of the temporary is set and the
114 type is determined by expressions,
115 e1 and e2.
116 *)
117
118 PROCEDURE MakeTemporaryFromExpressions (tok: CARDINAL;
119 e1, e2: CARDINAL;
120 mode: ModeOfAddr) : CARDINAL ;
121
122
123 (*
124 PutMode - Puts the addressing mode, SymMode, into symbol Sym.
125 The mode may only be altered if the mode is None.
126 *)
127
128 PROCEDURE PutMode (Sym: CARDINAL; SymMode: ModeOfAddr) ;
129
130
131 (*
132 GetMode - Returns the addressing mode of a symbol.
133 *)
134
135 PROCEDURE GetMode (Sym: CARDINAL) : ModeOfAddr ;
136
137
138 (*
139 StartScope - starts a block scope at Sym.
140 *)
141
142 PROCEDURE StartScope (Sym: CARDINAL) ;
143
144
145 (*
146 EndScope - ends a block scope started by StartScope. The current
147 head of the symbol scope reverts back to the symbol
148 which was the Head of the symbol scope before the
149 last StartScope was called.
150 *)
151
152 PROCEDURE EndScope ;
153
154
155 (*
156 PseudoScope - starts a pseudo scope. This is used to implement
157 enumeration types. It is nesessary since the
158 enumeration type does not have an explicit
159 structure, as opposed to RECORD, WITH, MODULE and
160 PROCEDURE. Therefore there is no explicit end and
161 hence the end of an outer scope would cause the
162 end of the enumeration scope. Thus we need to have
163 a pseudo scope which will be treated the same
164 during the search of a symbol, but will be popped
165 automatically when the EndScope calls - for a
166 structured scope end.
167 *)
168
169 PROCEDURE PseudoScope (Sym: CARDINAL) ;
170
171
172 (*
173 GetCurrentScope - returns the symbol who is responsible for the current
174 scope. Note that it ignores pseudo scopes.
175 *)
176
177 PROCEDURE GetCurrentScope () : CARDINAL ;
178
179
180 (*
181 IsDeclaredIn - returns TRUE if a symbol was declared in, scope.
182 *)
183
184 PROCEDURE IsDeclaredIn (scope, sym: CARDINAL) : BOOLEAN ;
185
186
187 (*
188 SetCurrentModule - Used to set the CurrentModule to a symbol, Sym.
189 This Sym may represent an inner module.
190 *)
191
192 PROCEDURE SetCurrentModule (Sym: CARDINAL) ;
193
194
195 (*
196 SetFileModule - Used to set the FileModule to a symbol, Sym.
197 This Sym must represent the current program module
198 file which is being parsed.
199 *)
200
201 PROCEDURE SetFileModule (Sym: CARDINAL) ;
202
203
204 (*
205 SetMainModule - Used to set the MainModule to a symbol, Sym.
206 This Sym must represent the main module which was
207 envoked by the user to be compiled.
208 *)
209
210 PROCEDURE SetMainModule (Sym: CARDINAL) ;
211
212
213 (*
214 CheckAnonymous - checks to see whether the name is NulName and if so
215 it creates a unique anonymous name.
216 *)
217
218 PROCEDURE CheckAnonymous (name: Name) : Name ;
219
220
221 (*
222 IsNameAnonymous - returns TRUE if the symbol, sym, has an anonymous name
223 or no name.
224 *)
225
226 PROCEDURE IsNameAnonymous (sym: CARDINAL) : BOOLEAN ;
227
228
229 (*
230 NoOfVariables - returns the number of variables in scope. The scope maybe
231 a procedure, module or defimp scope.
232 *)
233
234 PROCEDURE NoOfVariables (scope: CARDINAL) : CARDINAL ;
235
236
237 (*
238 MakeModule - creates a module sym with ModuleName. It returns the
239 symbol index.
240 *)
241
242 PROCEDURE MakeModule (tok: CARDINAL; ModuleName: Name) : CARDINAL ;
243
244
245 (*
246 MakeDefImp - creates a definition and implementation module sym
247 with name DefImpName. It returns the symbol index.
248 *)
249
250 PROCEDURE MakeDefImp (tok: CARDINAL; DefImpName: Name) : CARDINAL ;
251
252
253 (*
254 MakeInnerModule - creates an inner module sym with ModuleName. It returns the
255 symbol index.
256 *)
257
258 PROCEDURE MakeInnerModule (tok: CARDINAL; ModuleName: Name) : CARDINAL ;
259
260
261 (*
262 MakeProcedure - creates a procedure sym with name. It returns
263 the symbol index.
264 *)
265
266 PROCEDURE MakeProcedure (tok: CARDINAL; ProcedureName: Name) : CARDINAL ;
267
268
269 (*
270 MakeProcedureCtorExtern - creates an extern ctor procedure
271 *)
272
273 PROCEDURE MakeProcedureCtorExtern (tokenno: CARDINAL; libname, modulename: Name) : CARDINAL ;
274
275
276 (*
277 PutLibName - places libname into defimp or module sym.
278 *)
279
280 PROCEDURE PutLibName (sym: CARDINAL; libname: Name) ;
281
282
283 (*
284 GetLibName - returns libname associated with a defimp or module sym.
285 *)
286
287 PROCEDURE GetLibName (sym: CARDINAL) : Name ;
288
289
290 (*
291 PutMonoName - changes the IsMonoName boolean inside the procedure.
292 *)
293
294 PROCEDURE PutMonoName (sym: CARDINAL; value: BOOLEAN) ;
295
296
297 (*
298 IsMonoName - returns the public boolean associated with a procedure.
299 *)
300
301 PROCEDURE IsMonoName (sym: CARDINAL) : BOOLEAN ;
302
303
304 (*
305 PutExtern - changes the extern boolean inside the procedure.
306 *)
307
308 PROCEDURE PutExtern (sym: CARDINAL; value: BOOLEAN) ;
309
310
311 (*
312 IsExtern - returns the public boolean associated with a procedure.
313 *)
314
315 PROCEDURE IsExtern (sym: CARDINAL) : BOOLEAN ;
316
317
318 (*
319 PutPublic - changes the public boolean inside the procedure.
320 *)
321
322 PROCEDURE PutPublic (sym: CARDINAL; value: BOOLEAN) ;
323
324
325 (*
326 IsPublic - returns the public boolean associated with a procedure.
327 *)
328
329 PROCEDURE IsPublic (sym: CARDINAL) : BOOLEAN ;
330
331
332 (*
333 PutCtor - changes the ctor boolean inside the procedure.
334 *)
335
336 PROCEDURE PutCtor (sym: CARDINAL; value: BOOLEAN) ;
337
338
339 (*
340 IsCtor - returns the ctor boolean associated with a procedure.
341 *)
342
343 PROCEDURE IsCtor (sym: CARDINAL) : BOOLEAN ;
344
345
346 (*
347 GetModuleCtors - mod can be a DefImp or Module symbol. ctor, init and fini
348 are assigned for this module. An inner module ctor value will
349 be NulSym.
350 *)
351
352 PROCEDURE GetModuleCtors (mod: CARDINAL; VAR ctor, init, fini, dep: CARDINAL) ;
353
354
355 (*
356 MakeModuleCtor - for a defimp or module symbol create all the ctor
357 related procedures.
358 *)
359
360 PROCEDURE MakeModuleCtor (moduleTok, beginTok, finallyTok: CARDINAL;
361 moduleSym: CARDINAL) ;
362
363
364 (*
365 PutModuleCtorExtern - for every ctor related procedure in module sym.
366 Make it external. It will create any missing
367 init/fini procedures but not any missing dep/ctor
368 procedures.
369 *)
370
371 PROCEDURE PutModuleCtorExtern (tok: CARDINAL; sym: CARDINAL; external: BOOLEAN) ;
372
373
374 (*
375 PutVarHeap - assigns ArrayRef field with value.
376 *)
377
378 PROCEDURE PutVarHeap (sym: CARDINAL; value: BOOLEAN) ;
379
380
381 (*
382 IsVarHeap - returns ArrayRef field value.
383 *)
384
385 PROCEDURE IsVarHeap (sym: CARDINAL) : BOOLEAN ;
386
387
388 (*
389 MakeVar - creates a variable sym with VarName. It returns the
390 symbol index.
391 *)
392
393 PROCEDURE MakeVar (tok: CARDINAL; VarName: Name) : CARDINAL ;
394
395
396 (*
397 PutVarConditional - assign IsConditional to value.
398 *)
399
400 PROCEDURE PutVarConditional (sym: CARDINAL; value: BOOLEAN) ;
401
402
403 (*
404 IsVarConditional - return TRUE if the symbol is a var symbol
405 containing the result of a boolean conditional.
406 *)
407
408 PROCEDURE IsVarConditional (sym: CARDINAL) : BOOLEAN ;
409
410
411 (*
412 MakeRecord - makes a Record symbol with name RecordName.
413 *)
414
415 PROCEDURE MakeRecord (tok: CARDINAL; RecordName: Name) : CARDINAL ;
416
417
418 (*
419 MakeVarient - creates a new symbol, a varient symbol for record or varient field
420 symbol, RecOrVarFieldSym.
421 *)
422
423 PROCEDURE MakeVarient (tok: CARDINAL; RecOrVarFieldSym: CARDINAL) : CARDINAL ;
424
425
426 (*
427 MakeFieldVarient - returns a FieldVarient symbol which has been
428 assigned to the Varient symbol, Sym.
429 *)
430
431 PROCEDURE MakeFieldVarient (n: Name; Sym: CARDINAL) : CARDINAL ;
432
433
434 (*
435 MakeEnumeration - places a new symbol in the current scope, the symbol
436 is an enumeration symbol. The symbol index is returned.
437 *)
438
439 PROCEDURE MakeEnumeration (tok: CARDINAL; EnumerationName: Name) : CARDINAL ;
440
441
442 (*
443 MakeType - makes a type symbol with name TypeName.
444 *)
445
446 PROCEDURE MakeType (tok: CARDINAL; TypeName: Name) : CARDINAL ;
447
448
449 (*
450 MakeHiddenType - makes a type symbol that is hidden from the
451 definition module.
452 This symbol is placed into the UnImplemented list of
453 the definition/implementation module.
454 The type will be filled in when the implementation module
455 is reached.
456 *)
457
458 PROCEDURE MakeHiddenType (tok: CARDINAL; TypeName: Name) : CARDINAL ;
459
460
461 (*
462 MakeConstant - create a constant cardinal and return the symbol.
463 *)
464
465 PROCEDURE MakeConstant (tok: CARDINAL; value: CARDINAL) : CARDINAL ;
466
467
468 (*
469 MakeConstLit - returns a constant literal of type, constType, with a constName,
470 at location, tok.
471 *)
472
473 PROCEDURE MakeConstLit (tok: CARDINAL; constName: Name; constType: CARDINAL) : CARDINAL ;
474
475
476 (*
477 MakeConstVar - makes a ConstVar type with name ConstVarName.
478 *)
479
480 PROCEDURE MakeConstVar (tok: CARDINAL; ConstVarName: Name) : CARDINAL ;
481
482
483 (*
484 MakeConstString - create a string constant in the symboltable.
485 *)
486
487 PROCEDURE MakeConstString (tok: CARDINAL; ConstName: Name) : CARDINAL ;
488
489
490 (*
491 MakeConstStringCnul - creates a constant string nul terminated string suitable for C.
492 If known is TRUE then name is assigned to the contents
493 and the escape sequences will be converted into characters.
494 *)
495
496 PROCEDURE MakeConstStringCnul (tok: CARDINAL; name: Name; known: BOOLEAN) : CARDINAL ;
497
498
499 (*
500 MakeConstStringM2nul - creates a constant string nul terminated string suitable for M2.
501 If known is TRUE then name is assigned to the contents
502 however the escape sequences are not converted into characters.
503 *)
504
505 PROCEDURE MakeConstStringM2nul (tok: CARDINAL; name: Name; known: BOOLEAN) : CARDINAL ;
506
507
508 (*
509 PutConstStringKnown - if sym is a constvar then convert it into a conststring.
510 If known is FALSE then contents is ignored and NulName is
511 stored. If escape is TRUE then the contents will have
512 any escape sequences converted into single characters.
513 *)
514
515 PROCEDURE PutConstStringKnown (tok: CARDINAL; sym: CARDINAL;
516 contents: Name; escape, known: BOOLEAN) ;
517
518
519 (*
520 CopyConstString - copies string contents from expr to des
521 and retain the kind of string.
522 *)
523
524 PROCEDURE CopyConstString (tok: CARDINAL; des, expr: CARDINAL) ;
525
526
527 (*
528 IsConstStringKnown - returns TRUE if sym is a const string
529 and the contents are known.
530 *)
531
532 PROCEDURE IsConstStringKnown (sym: CARDINAL) : BOOLEAN ;
533
534
535 (*
536 IsConstStringM2 - returns whether this conststring is a
537 Modula-2 string.
538 *)
539
540 PROCEDURE IsConstStringM2 (sym: CARDINAL) : BOOLEAN ;
541
542
543 (*
544 IsConstStringC - returns whether this conststring is a C style string
545 which will have any escape translated.
546 *)
547
548 PROCEDURE IsConstStringC (sym: CARDINAL) : BOOLEAN ;
549
550
551 (*
552 IsConstStringM2nul - returns whether this conststring is a Modula-2 string which
553 contains a nul terminator.
554 *)
555
556 PROCEDURE IsConstStringM2nul (sym: CARDINAL) : BOOLEAN ;
557
558
559 (*
560 IsConstStringCnul - returns whether this conststring is a C style string
561 which will have any escape translated and also contains
562 a nul terminator.
563 *)
564
565 PROCEDURE IsConstStringCnul (sym: CARDINAL) : BOOLEAN ;
566
567
568 (*
569 MakeSubrange - makes a new symbol into a subrange type with
570 name SubrangeName.
571 *)
572
573 PROCEDURE MakeSubrange (tok: CARDINAL; SubrangeName: Name) : CARDINAL ;
574
575
576 (*
577 MakeSet - makes a set Symbol with name, SetName.
578 *)
579
580 PROCEDURE MakeSet (tok: CARDINAL; SetName: Name) : CARDINAL ;
581
582
583 (*
584 MakeArray - makes an Array symbol with name ArrayName.
585 *)
586
587 PROCEDURE MakeArray (tok: CARDINAL; ArrayName: Name) : CARDINAL ;
588
589
590 (*
591 PutArrayLarge - indicates that this is a large array in which case
592 the interface to gcc maps this array from 0..high-low,
593 using an integer indice.
594 *)
595
596 PROCEDURE PutArrayLarge (array: CARDINAL) ;
597
598
599 (*
600 IsArrayLarge - returns TRUE if we need to treat this as a large array.
601 *)
602
603 PROCEDURE IsArrayLarge (array: CARDINAL) : BOOLEAN ;
604
605
606 (*
607 PutPriority - places a interrupt, priority, value into module, module.
608 *)
609
610 PROCEDURE PutPriority (module: CARDINAL; priority: CARDINAL) ;
611
612
613 (*
614 GetPriority - returns the interrupt priority which was assigned to
615 module, module.
616 *)
617
618 PROCEDURE GetPriority (module: CARDINAL) : CARDINAL ;
619
620
621 (*
622 PutNeedSavePriority - set a boolean flag indicating that this procedure
623 needs to save and restore interrupts.
624 *)
625
626 PROCEDURE PutNeedSavePriority (sym: CARDINAL) ;
627
628
629 (*
630 GetNeedSavePriority - returns the boolean flag indicating whether this procedure
631 needs to save and restore interrupts.
632 *)
633
634 PROCEDURE GetNeedSavePriority (sym: CARDINAL) : BOOLEAN ;
635
636
637 (*
638 PutVariableAtAddress - determines that a variable, sym, is declared at
639 a specific address.
640 *)
641
642 PROCEDURE PutVariableAtAddress (sym: CARDINAL; address: CARDINAL) ;
643
644
645 (*
646 GetVariableAtAddress - returns the address at which variable, sym, is declared.
647 *)
648
649 PROCEDURE GetVariableAtAddress (sym: CARDINAL) : CARDINAL ;
650
651
652 (*
653 IsVariableAtAddress - returns TRUE if a variable, sym, was declared at
654 a specific address.
655 *)
656
657 PROCEDURE IsVariableAtAddress (sym: CARDINAL) : BOOLEAN ;
658
659
660 (*
661 PutVariableSSA - assigns value to the SSA field within variable sym.
662 *)
663
664 PROCEDURE PutVariableSSA (sym: CARDINAL; value: BOOLEAN) ;
665
666
667 (*
668 IsVariableSSA - returns TRUE if variable is known to be a SSA.
669 *)
670
671 PROCEDURE IsVariableSSA (sym: CARDINAL) : BOOLEAN ;
672
673
674 (*
675 PutVarConst - sets the IsConst field to value indicating the variable is read only.
676 *)
677
678 PROCEDURE PutVarConst (sym: CARDINAL; value: BOOLEAN) ;
679
680
681 (*
682 MakeGnuAsm - create a GnuAsm symbol.
683 *)
684
685 PROCEDURE MakeGnuAsm () : CARDINAL ;
686
687
688 (*
689 PutGnuAsm - places the instruction textual name into the GnuAsm symbol.
690 *)
691
692 PROCEDURE PutGnuAsm (sym: CARDINAL; string: CARDINAL) ;
693
694
695 (*
696 PutGnuAsmOutput - places the interface object, out, into GnuAsm symbol, sym.
697 *)
698
699 PROCEDURE PutGnuAsmOutput (sym: CARDINAL; out: CARDINAL) ;
700
701
702 (*
703 PutGnuAsmInput - places the interface object, in, into GnuAsm symbol, sym.
704 *)
705
706 PROCEDURE PutGnuAsmInput (sym: CARDINAL; in: CARDINAL) ;
707
708
709 (*
710 PutGnuAsmTrash - places the interface object, trash, into GnuAsm symbol, sym.
711 *)
712
713 PROCEDURE PutGnuAsmTrash (sym: CARDINAL; trash: CARDINAL) ;
714
715
716 (*
717 GetGnuAsm - returns the string symbol, representing the instruction textual
718 of the GnuAsm symbol. It will return a ConstString.
719 *)
720
721 PROCEDURE GetGnuAsm (sym: CARDINAL) : CARDINAL ;
722
723
724 (*
725 GetGnuAsmInput - returns the input list of registers.
726 *)
727
728 PROCEDURE GetGnuAsmInput (sym: CARDINAL) : CARDINAL ;
729
730
731 (*
732 GetGnuAsmOutput - returns the output list of registers.
733 *)
734
735 PROCEDURE GetGnuAsmOutput (sym: CARDINAL) : CARDINAL ;
736
737
738 (*
739 GetGnuAsmTrash - returns the list of trashed registers.
740 *)
741
742 PROCEDURE GetGnuAsmTrash (sym: CARDINAL) : CARDINAL ;
743
744
745 (*
746 PutGnuAsmVolatile - defines a GnuAsm symbol as VOLATILE.
747 *)
748
749 PROCEDURE PutGnuAsmVolatile (Sym: CARDINAL) ;
750
751
752 (*
753 PutGnuAsmSimple - defines a GnuAsm symbol as a simple kind.
754 *)
755
756 PROCEDURE PutGnuAsmSimple (Sym: CARDINAL) ;
757
758
759 (*
760 MakeRegInterface - creates and returns a register interface symbol.
761 *)
762
763 PROCEDURE MakeRegInterface () : CARDINAL ;
764
765
766 (*
767 PutRegInterface - places a, name, string, and, object, into the interface array,
768 sym, at position, i.
769 The string symbol will either be a register name or a constraint.
770 The object is an optional Modula-2 variable or constant symbol.
771 read and write are the quadruple numbers representing any read
772 or write operation.
773 *)
774
775 PROCEDURE PutRegInterface (tok: CARDINAL;
776 sym: CARDINAL; i: CARDINAL;
777 n: Name; string, object: CARDINAL;
778 read, write: CARDINAL) ;
779
780
781 (*
782 GetRegInterface - gets a, name, string, and, object, from the interface array,
783 sym, from position, i.
784 *)
785
786 PROCEDURE GetRegInterface (sym: CARDINAL; i: CARDINAL;
787 VAR tok: CARDINAL; VAR n: Name;
788 VAR string, object: CARDINAL) ;
789
790
791 (*
792 GetModule - Returns the Module symbol for the module with name, n.
793 *)
794
795 PROCEDURE GetModule (name: Name) : CARDINAL ;
796
797
798 (*
799 GetCurrentModule - returns the current module Sym that is being
800 compiled. It may return an inner module.
801 *)
802
803 PROCEDURE GetCurrentModule () : CARDINAL ;
804
805
806 (*
807 GetFileModule - returns the FileModule symbol that was requested by
808 the user to be compiled.
809 *)
810
811 PROCEDURE GetFileModule () : CARDINAL ;
812
813
814 (*
815 GetBaseModule - returns the base module symbol that contains Modula-2
816 base types, procedures and functions.
817 *)
818
819 PROCEDURE GetBaseModule () : CARDINAL ;
820
821
822 (*
823 GetMainModule - returns the main module symbol that was requested by
824 the user to be compiled.
825 *)
826
827 PROCEDURE GetMainModule () : CARDINAL ;
828
829
830 (*
831 GetCurrentModuleScope - returns the module symbol which forms the
832 current (possibly inner most) module.
833 *)
834
835 PROCEDURE GetCurrentModuleScope () : CARDINAL ;
836
837
838 (*
839 GetLastModuleScope - returns the last module scope encountered,
840 the module scope before the Current Module Scope.
841 *)
842
843 PROCEDURE GetLastModuleScope () : CARDINAL ;
844
845
846 (*
847 AddSymToModuleScope - adds a symbol, Sym, to the scope of the module
848 ModSym.
849 *)
850
851 PROCEDURE AddSymToModuleScope (ModSym: CARDINAL; Sym: CARDINAL) ;
852
853
854 (*
855 GetType - Returns the symbol that is the TYPE symbol to Sym.
856 If NulSym is returned then we assume type unknown.
857 *)
858
859 PROCEDURE GetType (Sym: CARDINAL) : CARDINAL ;
860
861
862 (*
863 SkipType - if sym is a TYPE foo = bar
864 then call SkipType(bar)
865 else return sym
866
867 it does not skip over hidden types.
868 *)
869
870 PROCEDURE SkipType (Sym: CARDINAL) : CARDINAL ;
871
872
873 (*
874 SkipTypeAndSubrange - if sym is a TYPE foo = bar OR
875 sym is declared as a subrange of bar
876 then call SkipTypeAndSubrange(bar)
877 else return sym
878
879 it does not skip over hidden types.
880 *)
881
882 PROCEDURE SkipTypeAndSubrange (Sym: CARDINAL) : CARDINAL ;
883
884
885 (*
886 GetLowestType - Returns the lowest type in the type chain of
887 symbol Sym.
888 If NulSym is returned then we assume type unknown.
889 *)
890
891 PROCEDURE GetLowestType (Sym: CARDINAL) : CARDINAL ;
892
893
894 (*
895 GetLType - get lowest type. It returns the lowest type
896 of symbol, sym. It skips over type equivalences.
897 *)
898
899 PROCEDURE GetLType (sym: CARDINAL) : CARDINAL ;
900
901
902 (*
903 GetSType - get source type. It returns the type closest
904 to the object. It does not skip over type
905 equivalences.
906 *)
907
908 PROCEDURE GetSType (sym: CARDINAL) : CARDINAL ;
909
910
911 (*
912 GetDType - get gcc declared type. It returns the type
913 of the object which is declared to GCC.
914 It does skip over type equivalences but only
915 if they do not contain a user alignment.
916 It does not skip over hidden types.
917
918 This is the same as SkipType(GetType(sym))
919 *)
920
921 PROCEDURE GetDType (sym: CARDINAL) : CARDINAL ;
922
923
924 (*
925 GetTypeMode - return the type of sym, it returns Address is the
926 symbol is a LValue.
927 *)
928
929 PROCEDURE GetTypeMode (sym: CARDINAL) : CARDINAL ;
930
931
932 (*
933 GetSym - searches the current scope (and previous scopes if the
934 scope tranparent allows) for a symbol with Name.
935 *)
936
937 PROCEDURE GetSym (name: Name) : CARDINAL ;
938
939
940 (*
941 GetDeclareSym - searches for a symbol with a name SymName in the
942 current and previous scopes.
943 If the symbol is found then it is returned
944 else an unknown symbol is returned.
945 This procedure assumes that SymName is being
946 declared at this point and therefore it does
947 not examine the base scope (for pervasive
948 identifiers).
949 *)
950
951 PROCEDURE GetDeclareSym (tok: CARDINAL; SymName: Name) : CARDINAL ;
952
953
954 (*
955 GetLocalSym - only searches the scope Sym for a symbol with Name
956 and returns the index to the symbol.
957 *)
958
959 PROCEDURE GetLocalSym (Sym: CARDINAL; name: Name) : CARDINAL ;
960
961
962 (*
963 GetRecord - fetches the record symbol from the parent of Sym.
964 Sym maybe a varient symbol in which case its parent is searched
965 etc.
966 *)
967
968 PROCEDURE GetRecord (Sym: CARDINAL) : CARDINAL ;
969
970
971 (*
972 FromModuleGetSym - attempts to find a symbol of name, n, in the
973 module, mod, scope. An unknown symbol is created
974 at token position tok if necessary.
975 *)
976
977 PROCEDURE FromModuleGetSym (tok: CARDINAL;
978 n: Name; mod: CARDINAL) : CARDINAL ;
979
980
981 (*
982 GetNth - returns the n th symbol in the list associated with the scope
983 of Sym. Sym may be a Module, DefImp, Procedure, Record or
984 Enumeration symbol.
985 *)
986
987 PROCEDURE GetNth (Sym: CARDINAL; n: CARDINAL) : CARDINAL ;
988
989
990 (*
991 GetNthParam - returns the n th parameter in procedure Sym.
992 Sym may be an ordinary procedure or a
993 procedure variable.
994 ParamNo of zero yields the return argument
995 if the procedure is a function.
996 NOTE that this is returned as a type NOT
997 a parameter.
998 *)
999
1000 PROCEDURE GetNthParam (Sym: CARDINAL; kind: ProcedureKind; ParamNo: CARDINAL) : CARDINAL ;
1001
1002
1003 (*
1004 GetVarScope - returns the symbol definining the scope where, Sym, was declared.
1005 ie a Module, DefImp or Procedure Symbol.
1006 *)
1007
1008 PROCEDURE GetVarScope (Sym: CARDINAL) : CARDINAL ;
1009
1010
1011 (*
1012 GetSubrange - returns HighSym and LowSym - two constants
1013 which make up the subrange.
1014 *)
1015
1016 PROCEDURE GetSubrange (Sym: CARDINAL; VAR HighSym, LowSym: CARDINAL) ;
1017
1018
1019 (*
1020 GetParam - returns the ParamNo parameter from procedure ProcSym
1021 *)
1022
1023 PROCEDURE GetParam (Sym: CARDINAL; ParamNo: CARDINAL) : CARDINAL ;
1024
1025
1026 (*
1027 GetString - returns the actual string key for ConstString symbol Sym,
1028 which is not necessarily the same as its name.
1029 ie CONST
1030 hello = 'HELLO' ; Name = hello, string = HELLO
1031 GetString returns HELLO
1032
1033 and simply 'Hello World' Name will be same
1034 GetString returns Hello World
1035 *)
1036
1037 PROCEDURE GetString (Sym: CARDINAL) : Name ;
1038
1039
1040 (*
1041 GetStringLength - returns the actual string length for ConstString
1042 symbol sym.
1043 *)
1044
1045 PROCEDURE GetStringLength (tok: CARDINAL; sym: CARDINAL) : CARDINAL ;
1046
1047
1048 (*
1049 GetProcedureBuiltin - returns the builtin name for the equivalent procedure, Sym.
1050 *)
1051
1052 PROCEDURE GetProcedureBuiltin (Sym: CARDINAL) : Name ;
1053
1054
1055 (*
1056 PutProcedureBuiltin - assigns the builtin name for the equivalent procedure, Sym.
1057 *)
1058
1059 PROCEDURE PutProcedureBuiltin (Sym: CARDINAL; name: Name) ;
1060
1061
1062 (*
1063 IsProcedureBuiltin - returns TRUE if this procedure has a builtin equivalent.
1064 *)
1065
1066 PROCEDURE IsProcedureBuiltin (Sym: CARDINAL) : BOOLEAN ;
1067
1068
1069 (*
1070 PutProcedureInline - determines that procedure, Sym, has been requested to be inlined.
1071 *)
1072
1073 PROCEDURE PutProcedureInline (Sym: CARDINAL) ;
1074
1075
1076 (*
1077 IsProcedureInline - returns TRUE if this procedure was declared as inlined.
1078 *)
1079
1080 PROCEDURE IsProcedureInline (Sym: CARDINAL) : BOOLEAN ;
1081
1082
1083 (*
1084 PutExceptionBlock - sets a BOOLEAN in block module/procedure/defimp,
1085 sym, indicating that this block as an EXCEPT
1086 statement sequence.
1087 *)
1088
1089 PROCEDURE PutExceptionBlock (sym: CARDINAL) ;
1090
1091
1092 (*
1093 HasExceptionBlock - returns a BOOLEAN determining whether
1094 module/procedure/defimp, sym, has
1095 an EXCEPT statement sequence.
1096 *)
1097
1098 PROCEDURE HasExceptionBlock (sym: CARDINAL) : BOOLEAN ;
1099
1100
1101 (*
1102 PutExceptionFinally - sets a BOOLEAN in block module/defimp,
1103 sym, indicating that this FINALLY block
1104 as an EXCEPT statement sequence.
1105 *)
1106
1107 PROCEDURE PutExceptionFinally (sym: CARDINAL) ;
1108
1109
1110 (*
1111 HasExceptionFinally - returns a BOOLEAN determining whether
1112 module/defimp, sym, has
1113 an EXCEPT statement sequence.
1114 *)
1115
1116 PROCEDURE HasExceptionFinally (sym: CARDINAL) : BOOLEAN ;
1117
1118
1119 (*
1120 PutVar - gives the variable symbol Sym a type VarType.
1121 *)
1122
1123 PROCEDURE PutVar (Sym: CARDINAL; VarType: CARDINAL) ;
1124
1125
1126 (*
1127 PutVarTok - gives the VarSym symbol Sym a type Type at typetok.
1128 *)
1129
1130 PROCEDURE PutVarTok (Sym: CARDINAL; VarType: CARDINAL; typetok: CARDINAL) ;
1131
1132
1133 (*
1134 PutLeftValueFrontBackType - gives the variable symbol a front and backend type.
1135 The variable must be a LeftValue.
1136 *)
1137
1138 PROCEDURE PutLeftValueFrontBackType (Sym: CARDINAL; FrontType, BackType: CARDINAL) ;
1139
1140
1141 (*
1142 GetVarBackEndType - returns the back end type if specified.
1143 *)
1144
1145 PROCEDURE GetVarBackEndType (Sym: CARDINAL) : CARDINAL ;
1146
1147
1148 (*
1149 PutVarPointerCheck - marks variable, sym, as requiring (or not
1150 depending upon the, value), a NIL pointer check
1151 when this symbol is dereferenced.
1152 *)
1153
1154 PROCEDURE PutVarPointerCheck (sym: CARDINAL; value: BOOLEAN) ;
1155
1156
1157 (*
1158 GetVarPointerCheck - returns TRUE if this symbol is a variable and
1159 has been marked as needing a pointer via NIL check.
1160 *)
1161
1162 PROCEDURE GetVarPointerCheck (sym: CARDINAL) : BOOLEAN ;
1163
1164
1165 (*
1166 PutVarWritten - marks variable, sym, as being written to (or not
1167 depending upon the, value).
1168 *)
1169
1170 PROCEDURE PutVarWritten (sym: CARDINAL; value: BOOLEAN) ;
1171
1172
1173 (*
1174 GetVarWritten - returns TRUE if this symbol is a variable and
1175 has been marked as being written.
1176 *)
1177
1178 PROCEDURE GetVarWritten (sym: CARDINAL) : BOOLEAN ;
1179
1180
1181 (*
1182 PutConst - gives the constant symbol Sym a type ConstType.
1183 *)
1184
1185 PROCEDURE PutConst (Sym: CARDINAL; ConstType: CARDINAL) ;
1186
1187
1188 (*
1189 PutConstSet - informs the constant symbol, sym, that it is or will contain
1190 a set value.
1191 *)
1192
1193 PROCEDURE PutConstSet (Sym: CARDINAL) ;
1194
1195
1196 (*
1197 IsConstSet - returns TRUE if the constant is declared as a set.
1198 *)
1199
1200 PROCEDURE IsConstSet (Sym: CARDINAL) : BOOLEAN ;
1201
1202
1203 (*
1204 PutConstructor - informs the symbol sym that this will be
1205 a constructor constant.
1206 *)
1207
1208 PROCEDURE PutConstructor (Sym: CARDINAL) ;
1209
1210
1211 (*
1212 PutConstructorFrom - sets the from type field in constructor
1213 Sym to from.
1214 *)
1215
1216 PROCEDURE PutConstructorFrom (Sym: CARDINAL; from: CARDINAL) ;
1217
1218
1219 (*
1220 PutFieldRecord - places a field, FieldName and FieldType into a record, Sym.
1221 VarSym is a optional varient symbol which can be returned
1222 by a call to GetVarient(fieldsymbol). The created field
1223 is returned.
1224 *)
1225
1226 PROCEDURE PutFieldRecord (Sym: CARDINAL;
1227 FieldName: Name; FieldType: CARDINAL;
1228 VarSym: CARDINAL) : CARDINAL ;
1229
1230
1231 (*
1232 PutFieldVarient - places the field varient, Field, as a brother to, the
1233 varient symbol, sym.
1234 *)
1235
1236 PROCEDURE PutFieldVarient (Field, Sym: CARDINAL) ;
1237
1238
1239 (*
1240 GetVarient - returns the varient symbol associated with the
1241 record or varient field symbol, Field.
1242 *)
1243
1244 PROCEDURE GetVarient (Field: CARDINAL) : CARDINAL ;
1245
1246
1247 (*
1248 IsRecordFieldAVarientTag - returns TRUE if record field, sym, is
1249 a varient tag.
1250 *)
1251
1252 PROCEDURE IsRecordFieldAVarientTag (sym: CARDINAL) : BOOLEAN ;
1253
1254
1255 (*
1256 IsEmptyFieldVarient - returns TRUE if the field variant has
1257 no fields. This will occur then the
1258 compiler constructs 'else end' variants.
1259 *)
1260
1261 PROCEDURE IsEmptyFieldVarient (sym: CARDINAL) : BOOLEAN ;
1262
1263
1264 (*
1265 GetVarientTag - returns the varient tag from, Sym.
1266 *)
1267
1268 PROCEDURE GetVarientTag (Sym: CARDINAL) : CARDINAL ;
1269
1270
1271 (*
1272 PutVarientTag - places, Tag, into varient, Sym.
1273 *)
1274
1275 PROCEDURE PutVarientTag (Sym, Tag: CARDINAL) ;
1276
1277
1278 (*
1279 PutFieldEnumeration - places a field into the enumeration type
1280 Sym. The field has a name FieldName and a
1281 value FieldVal.
1282 *)
1283
1284 PROCEDURE PutFieldEnumeration (tok: CARDINAL; Sym: CARDINAL; FieldName: Name) ;
1285
1286
1287 (*
1288 PutSubrange - places LowSym and HighSym as two symbols
1289 which provide the limits of the range.
1290 *)
1291
1292 PROCEDURE PutSubrange (Sym: CARDINAL; LowSym, HighSym: CARDINAL;
1293 TypeSymbol: CARDINAL) ;
1294
1295
1296 (*
1297 PutSet - places SimpleType as the type for set, Sym.
1298 *)
1299
1300 PROCEDURE PutSet (Sym: CARDINAL; SimpleType: CARDINAL; packed: BOOLEAN) ;
1301
1302
1303 (*
1304 IsSetPacked - returns TRUE if Sym is packed.
1305 *)
1306
1307 PROCEDURE IsSetPacked (Sym: CARDINAL) : BOOLEAN ;
1308
1309
1310 (*
1311 GetArraySubscript - returns the subrange symbol for array, Sym.
1312 *)
1313
1314 PROCEDURE GetArraySubscript (Sym: CARDINAL) : CARDINAL ;
1315
1316
1317 (*
1318 PutArraySubscript - places an index field into the array Sym. The
1319 index field is a subscript sym.
1320 *)
1321
1322 PROCEDURE PutArraySubscript (Sym: CARDINAL; SubscriptSymbol: CARDINAL) ;
1323
1324
1325 (*
1326 PutType - gives a type symbol Sym type TypeSymbol.
1327 *)
1328
1329 PROCEDURE PutType (Sym: CARDINAL; TypeSymbol: CARDINAL) ;
1330
1331
1332 (*
1333 PutFunction - Places a TypeSym as the return type to a procedure Sym.
1334 *)
1335
1336 PROCEDURE PutFunction (tok: CARDINAL; Sym: CARDINAL; kind: ProcedureKind;
1337 TypeSym: CARDINAL) ;
1338
1339
1340 (*
1341 PutOptFunction - places a TypeSym as the optional return type to a procedure Sym.
1342 *)
1343
1344 PROCEDURE PutOptFunction (tok: CARDINAL; Sym: CARDINAL; kind: ProcedureKind; TypeSym: CARDINAL) ;
1345
1346
1347 (*
1348 IsReturnOptional - returns TRUE if the return value for, sym, is
1349 optional.
1350 *)
1351
1352 PROCEDURE IsReturnOptional (sym: CARDINAL; kind: ProcedureKind) : BOOLEAN ;
1353
1354
1355 (*
1356 IsReturnOptionalAny - returns TRUE if the return value for sym is
1357 optional.
1358 *)
1359
1360 PROCEDURE IsReturnOptionalAny (sym: CARDINAL) : BOOLEAN ;
1361
1362
1363 (*
1364 PutParam - Places a Non VAR parameter ParamName with type ParamType into
1365 procedure Sym:kind. The parameter number is ParamNo.
1366 If the procedure Sym already has this parameter then
1367 the parameter is checked for consistancy and the
1368 consistancy test is returned.
1369 *)
1370
1371 PROCEDURE PutParam (tok: CARDINAL; Sym: CARDINAL;
1372 kind: ProcedureKind; ParamNo: CARDINAL;
1373 ParamName: Name; ParamType: CARDINAL;
1374 isUnbounded: BOOLEAN; typetok: CARDINAL) : BOOLEAN ;
1375
1376
1377 (*
1378 PutVarParam - Places a Non VAR parameter ParamName with type
1379 ParamType into procedure Sym:kind.
1380 The parameter number is ParamNo.
1381 If the procedure Sym already has this parameter then
1382 the parameter is checked for consistancy and the
1383 consistancy test is returned.
1384 *)
1385
1386 PROCEDURE PutVarParam (tok: CARDINAL; Sym: CARDINAL; kind: ProcedureKind;
1387 ParamNo: CARDINAL;
1388 ParamName: Name; ParamType: CARDINAL;
1389 isUnbounded: BOOLEAN; typetok: CARDINAL) : BOOLEAN ;
1390
1391
1392 (*
1393 PutParamName - assigns a name to paramater no of procedure ProcSym:kind.
1394 *)
1395
1396 PROCEDURE PutParamName (tok: CARDINAL; ProcSym: CARDINAL; kind: ProcedureKind;
1397 no: CARDINAL;
1398 name: Name; ParamType: CARDINAL; typetok: CARDINAL) ;
1399
1400
1401 (*
1402 PutProcedureReachable - Sets the procedure, Sym, to be reachable by the
1403 main Module.
1404 *)
1405
1406 PROCEDURE PutProcedureReachable (Sym: CARDINAL) ;
1407
1408
1409 (*
1410 IsProcedureReachable - Returns true if the procedure, Sym, is
1411 reachable from the main Module.
1412 *)
1413
1414 PROCEDURE IsProcedureReachable (Sym: CARDINAL) : BOOLEAN ;
1415
1416
1417 (*
1418 PutProcedureNoReturn - places value into the no return attribute
1419 field of procedure sym.
1420 *)
1421
1422 PROCEDURE PutProcedureNoReturn (Sym: CARDINAL; kind: ProcedureKind;
1423 value: BOOLEAN) ;
1424
1425
1426 (*
1427 IsProcedureNoReturn - returns TRUE if this procedure never returns.
1428 *)
1429
1430 PROCEDURE IsProcedureNoReturn (Sym: CARDINAL; kind: ProcedureKind) : BOOLEAN ;
1431
1432
1433 (*
1434 GetProcedureProcType - returns the proctype matching procedure sym.
1435 *)
1436
1437 PROCEDURE GetProcedureProcType (sym: CARDINAL) : CARDINAL ;
1438
1439
1440 (*
1441 PutModuleStartQuad - Places QuadNumber into the Module symbol, Sym.
1442 QuadNumber is the start quad of Module,
1443 Sym.
1444 *)
1445
1446 PROCEDURE PutModuleStartQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1447
1448
1449 (*
1450 PutModuleEndQuad - Places QuadNumber into the Module symbol, Sym.
1451 QuadNumber is the end quad of Module,
1452 Sym.
1453 *)
1454
1455 PROCEDURE PutModuleEndQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1456
1457
1458 (*
1459 PutModuleFinallyStartQuad - Places QuadNumber into the Module symbol, Sym.
1460 QuadNumber is the finally start quad of
1461 Module, Sym.
1462 *)
1463
1464 PROCEDURE PutModuleFinallyStartQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1465
1466
1467 (*
1468 PutModuleFinallyEndQuad - Places QuadNumber into the Module symbol, Sym.
1469 QuadNumber is the end quad of the finally block
1470 in Module, Sym.
1471 *)
1472
1473 PROCEDURE PutModuleFinallyEndQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1474
1475
1476 (*
1477 GetModuleQuads - Returns, StartInit EndInit StartFinish EndFinish,
1478 Quads of a Module, Sym.
1479 Start and End represent the initialization code
1480 of the Module, Sym.
1481 *)
1482
1483 PROCEDURE GetModuleQuads (Sym: CARDINAL;
1484 VAR StartInit, EndInit,
1485 StartFinish, EndFinish: CARDINAL) ;
1486
1487 (*
1488 PutModuleFinallyFunction - Places Tree, finally, into the Module symbol, Sym.
1489 *)
1490
1491 PROCEDURE PutModuleFinallyFunction (Sym: CARDINAL; finally: tree) ;
1492
1493
1494 (*
1495 GetModuleFinallyFunction - returns the finally tree from the Module symbol, Sym.
1496 *)
1497
1498 PROCEDURE GetModuleFinallyFunction (Sym: CARDINAL) : tree ;
1499
1500
1501 (*
1502 PutProcedureScopeQuad - Places QuadNumber into the Procedure symbol, Sym.
1503 QuadNumber is the start quad of procedure,
1504 Sym.
1505 *)
1506
1507 PROCEDURE PutProcedureScopeQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1508
1509
1510 (*
1511 PutProcedureStartQuad - Places QuadNumber into the Procedure symbol, Sym.
1512 QuadNumber is the start quad of procedure,
1513 Sym.
1514 *)
1515
1516 PROCEDURE PutProcedureStartQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1517
1518
1519 (*
1520 PutProcedureEndQuad - Places QuadNumber into the Procedure symbol, Sym.
1521 QuadNumber is the end quad of procedure,
1522 Sym.
1523 *)
1524
1525 PROCEDURE PutProcedureEndQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1526
1527
1528 (*
1529 GetProcedureQuads - Returns, Start and End, Quads of a procedure, Sym.
1530 *)
1531
1532 PROCEDURE GetProcedureQuads (Sym: CARDINAL; VAR scope, start, end: CARDINAL) ;
1533
1534
1535 (*
1536 GetQuads - assigns Start and End to the beginning and end of
1537 symbol, Sym, usage.
1538 *)
1539
1540 PROCEDURE GetQuads (Sym: CARDINAL; m: ModeOfAddr;
1541 VAR Start, End: CARDINAL) ;
1542
1543
1544 (*
1545 GetReadQuads - assigns Start and End to the beginning and end of
1546 symbol, Sym, usage.
1547 *)
1548
1549 PROCEDURE GetReadQuads (Sym: CARDINAL; m: ModeOfAddr;
1550 VAR Start, End: CARDINAL) ;
1551
1552
1553 (*
1554 GetWriteQuads - assigns Start and End to the beginning and end of
1555 symbol, Sym, usage.
1556 *)
1557
1558 PROCEDURE GetWriteQuads (Sym: CARDINAL; m: ModeOfAddr;
1559 VAR Start, End: CARDINAL) ;
1560
1561
1562 (*
1563 PutReadQuad - places Quad into the list of symbol usage.
1564 *)
1565
1566 PROCEDURE PutReadQuad (Sym: CARDINAL; m: ModeOfAddr; Quad: CARDINAL) ;
1567
1568
1569 (*
1570 RemoveReadQuad - places Quad into the list of symbol usage.
1571 *)
1572
1573 PROCEDURE RemoveReadQuad (Sym: CARDINAL; m: ModeOfAddr; Quad: CARDINAL) ;
1574
1575
1576 (*
1577 PutWriteQuad - places Quad into the list of symbol usage.
1578 *)
1579
1580 PROCEDURE PutWriteQuad (Sym: CARDINAL; m: ModeOfAddr; Quad: CARDINAL) ;
1581
1582
1583 (*
1584 RemoveWriteQuad - places Quad into the list of symbol usage.
1585 *)
1586
1587 PROCEDURE RemoveWriteQuad (Sym: CARDINAL; m: ModeOfAddr; Quad: CARDINAL) ;
1588
1589
1590 (*
1591 GetReadLimitQuads - returns Start and End which have been assigned
1592 the start and end of when the symbol was read
1593 to within: StartLimit..EndLimit.
1594 *)
1595
1596 PROCEDURE GetReadLimitQuads (Sym: CARDINAL; m: ModeOfAddr;
1597 StartLimit, EndLimit: CARDINAL;
1598 VAR Start, End: CARDINAL) ;
1599
1600
1601 (*
1602 GetWriteLimitQuads - returns Start and End which have been assigned
1603 the start and end of when the symbol was written
1604 to within: StartLimit..EndLimit.
1605 *)
1606
1607 PROCEDURE GetWriteLimitQuads (Sym: CARDINAL; m: ModeOfAddr;
1608 StartLimit, EndLimit: CARDINAL;
1609 VAR Start, End: CARDINAL) ;
1610
1611
1612 (*
1613 GetNthProcedure - Returns the Nth procedure in Module, Sym.
1614 *)
1615
1616 PROCEDURE GetNthProcedure (Sym: CARDINAL; n: CARDINAL) : CARDINAL ;
1617
1618
1619 (*
1620 GetDeclaredDef - returns the token where this symbol was declared
1621 with the priority of the definition, implementation,
1622 program.
1623 *)
1624
1625 PROCEDURE GetDeclaredDef (Sym: CARDINAL) : CARDINAL ;
1626
1627
1628 (*
1629 GetDeclaredMod - returns the token where this symbol was declared.
1630 with the priority of the implementation, program
1631 and definition.
1632 *)
1633
1634 PROCEDURE GetDeclaredMod (Sym: CARDINAL) : CARDINAL ;
1635
1636
1637 (*
1638 GetDeclaredFor - returns the token where this symbol was declared.
1639 It chooses the first from the forward declaration,
1640 implementation module, program module
1641 and definition module.
1642 *)
1643
1644 PROCEDURE GetDeclaredFor (Sym: CARDINAL) : CARDINAL ;
1645
1646
1647 (*
1648 GetDeclaredDefinition - returns the token where this symbol
1649 was declared in the definition module.
1650 *)
1651
1652 PROCEDURE GetDeclaredDefinition (Sym: CARDINAL) : CARDINAL ;
1653
1654
1655 (*
1656 GetDeclaredModule - returns the token where this symbol was declared
1657 in an implementation or program module.
1658 *)
1659
1660 PROCEDURE GetDeclaredModule (Sym: CARDINAL) : CARDINAL ;
1661
1662
1663 (*
1664 PutDeclared - adds an entry to symbol, Sym, indicating that it
1665 was declared at, tok. This routine
1666 may be called twice, once for definition module
1667 partial declaration and once when parsing the
1668 implementation module.
1669 *)
1670
1671 PROCEDURE PutDeclared (tok: CARDINAL; Sym: CARDINAL) ;
1672
1673
1674 (*
1675 GetFirstUsed - returns the token where this symbol was first used.
1676 *)
1677
1678 PROCEDURE GetFirstUsed (Sym: CARDINAL) : CARDINAL ;
1679
1680
1681 (*
1682 PutProcedureBegin - assigns begin as the token number matching the
1683 procedure BEGIN.
1684 *)
1685
1686 PROCEDURE PutProcedureBegin (Sym: CARDINAL; begin: CARDINAL) ;
1687
1688
1689 (*
1690 PutProcedureEnd - assigns end as the token number matching the
1691 procedure END.
1692 *)
1693
1694 PROCEDURE PutProcedureEnd (Sym: CARDINAL; end: CARDINAL) ;
1695
1696
1697 (*
1698 GetProcedureBeginEnd - assigns, begin, end, to the stored token values.
1699 *)
1700
1701 PROCEDURE GetProcedureBeginEnd (Sym: CARDINAL; VAR begin, end: CARDINAL) ;
1702
1703
1704 (*
1705 ForeachProcedureDo - for each procedure in module, Sym, do procedure, P.
1706 *)
1707
1708 PROCEDURE ForeachProcedureDo (Sym: CARDINAL; P: PerformOperation) ;
1709
1710
1711 (*
1712 ForeachModuleDo - for each module do procedure, P.
1713 *)
1714
1715 PROCEDURE ForeachModuleDo (P: PerformOperation) ;
1716
1717
1718 (*
1719 ForeachInnerModuleDo - for each inner module in module, Sym,
1720 do procedure, P.
1721 *)
1722
1723 PROCEDURE ForeachInnerModuleDo (Sym: CARDINAL; P: PerformOperation) ;
1724
1725
1726 (*
1727 IsVarParam - Returns a conditional depending whether parameter ParamNo
1728 is a VAR procedure parameter.
1729 *)
1730
1731 PROCEDURE IsVarParam (Sym: CARDINAL; kind: ProcedureKind;
1732 ParamNo: CARDINAL) : BOOLEAN ;
1733
1734
1735 (*
1736 IsVarParamAny - Returns a conditional depending whether parameter ParamNo
1737 is a VAR parameter.
1738 *)
1739
1740 PROCEDURE IsVarParamAny (Sym: CARDINAL; ParamNo: CARDINAL) : BOOLEAN ;
1741
1742
1743 (*
1744 IsUnboundedParam - Returns a conditional depending whether parameter
1745 ParamNo is an unbounded array procedure parameter.
1746 *)
1747
1748 PROCEDURE IsUnboundedParam (Sym: CARDINAL; kind: ProcedureKind;
1749 ParamNo: CARDINAL) : BOOLEAN ;
1750
1751
1752 (*
1753 IsUnboundedParam - Returns a conditional depending whether parameter
1754 ParamNo is an unbounded array procedure parameter.
1755 *)
1756
1757 PROCEDURE IsUnboundedParamAny (Sym: CARDINAL; ParamNo: CARDINAL) : BOOLEAN ;
1758
1759
1760 (*
1761 IsParameterUnbounded - returns TRUE if parameter, Sym, is
1762 unbounded.
1763 *)
1764
1765 PROCEDURE IsParameterUnbounded (Sym: CARDINAL) : BOOLEAN ;
1766
1767
1768 (*
1769 IsParameterVar - returns true if parameter symbol Sym
1770 was declared as a VAR.
1771 *)
1772
1773 PROCEDURE IsParameterVar (Sym: CARDINAL) : BOOLEAN ;
1774
1775
1776 (*
1777 GetParameterShadowVar - returns the local variable associated with the
1778 parameter symbol, sym.
1779 *)
1780
1781 PROCEDURE GetParameterShadowVar (sym: CARDINAL) : CARDINAL ;
1782
1783
1784 (*
1785 NoOfParam - Returns the number of parameters that procedure Sym contains.
1786 *)
1787
1788 PROCEDURE NoOfParam (Sym: CARDINAL; kind: ProcedureKind) : CARDINAL ;
1789
1790
1791 (*
1792 HasVarParameters - returns TRUE if procedure, p, has any VAR parameters.
1793 *)
1794
1795 PROCEDURE HasVarParameters (p: CARDINAL) : BOOLEAN ;
1796
1797
1798 (*
1799 NoOfLocalVar - returns the number of local variables that exist in
1800 procedure Sym. Parameters are NOT included in the
1801 count.
1802 *)
1803
1804 PROCEDURE NoOfLocalVar (Sym: CARDINAL) : CARDINAL ;
1805
1806
1807 (*
1808 IsDefImp - returns true is the Sym is a DefImp symbol.
1809 Definition/Implementation module symbol.
1810 *)
1811
1812 PROCEDURE IsDefImp (Sym: CARDINAL) : BOOLEAN ;
1813
1814
1815 (*
1816 IsModule - returns true if the Sym is a Module symbol.
1817 Program module symbol.
1818 Includes inner modules.
1819 *)
1820
1821 PROCEDURE IsModule (Sym: CARDINAL) : BOOLEAN ;
1822
1823
1824 (*
1825 IsInnerModule - returns true if the symbol, Sym, is an inner module.
1826 *)
1827
1828 PROCEDURE IsInnerModule (Sym: CARDINAL) : BOOLEAN ;
1829
1830
1831 (*
1832 GetSymName - returns the symbol name.
1833 *)
1834
1835 PROCEDURE GetSymName (Sym: CARDINAL) : Name ;
1836
1837
1838 (*
1839 RenameSym - renames a symbol, Sym, with SymName.
1840 It also checks the unknown tree for a symbol
1841 with this new name.
1842 *)
1843
1844 PROCEDURE RenameSym (Sym: CARDINAL; SymName: Name) ;
1845
1846
1847 (*
1848 IsUnknown - returns true is the symbol Sym is unknown.
1849 *)
1850
1851 PROCEDURE IsUnknown (Sym: WORD) : BOOLEAN ;
1852
1853
1854 (*
1855 IsPartialUnbounded - returns TRUE if, sym, is a partially unbounded symbol.
1856 *)
1857
1858 PROCEDURE IsPartialUnbounded (sym: CARDINAL) : BOOLEAN ;
1859
1860
1861 (*
1862 RequestSym - searches for a symbol with a name SymName in the
1863 current and previous scopes.
1864 If the symbol is found then it is returned
1865 else an unknown symbol is returned create at token
1866 position, tok.
1867 This procedure does search the base scope (for
1868 pervasive identifiers).
1869 *)
1870
1871 PROCEDURE RequestSym (tok: CARDINAL; SymName: Name) : CARDINAL ;
1872
1873
1874 (*
1875 PutImported - places a symbol, Sym, into the current main scope.
1876 *)
1877
1878 PROCEDURE PutImported (Sym: CARDINAL) ;
1879
1880
1881 (*
1882 PutIncluded - places a symbol, Sym, into the included list of the
1883 current module.
1884 Symbols that are placed in this list are indirectly declared
1885 by:
1886
1887 import modulename ;
1888
1889 modulename.identifier
1890 *)
1891
1892 PROCEDURE PutIncluded (Sym: CARDINAL) ;
1893
1894
1895 (*
1896 PutExported - places a symbol, Sym into the the next level out module.
1897 Sym is also placed in the ExportTree of the current inner
1898 module.
1899 *)
1900
1901 PROCEDURE PutExported (Sym: CARDINAL) ;
1902
1903
1904 (*
1905 PutExportQualified - places a symbol with the name, SymName,
1906 into the export tree of the
1907 Definition module being compiled.
1908 The symbol with SymName has been export QUALIFIED
1909 by the definition module and therefore any reference
1910 to this symbol in the code generation phase
1911 will be in the form _Module_SymName.
1912 *)
1913
1914 PROCEDURE PutExportQualified (tokenno: CARDINAL; SymName: Name) ;
1915
1916
1917 (*
1918 PutExportUnQualified - places a symbol with the name, SymName,
1919 into the export tree of the
1920 Definition module being compiled.
1921 The symbol with SymName has been export unqualified
1922 by the definition module and therefore any reference
1923 to this symbol in the code generation phase
1924 will be in the form _SymName.
1925 *)
1926
1927 PROCEDURE PutExportUnQualified (tokenno: CARDINAL; SymName: Name) ;
1928
1929
1930 (*
1931 PutExportUnImplemented - places a symbol, Sym, into the currently compiled
1932 DefImp module NeedToBeImplemented list.
1933 *)
1934
1935 PROCEDURE PutExportUnImplemented (tokenno: CARDINAL; Sym: CARDINAL) ;
1936
1937
1938 (*
1939 GetExported - returns the symbol which has a name SymName,
1940 and is exported from module ModSym.
1941
1942 *)
1943
1944 PROCEDURE GetExported (tokenno: CARDINAL;
1945 ModSym: CARDINAL;
1946 SymName: Name) : CARDINAL ;
1947
1948
1949 (*
1950 GetFromOuterModule - returns a symbol with name, SymName, which comes
1951 from outside the current module.
1952 *)
1953
1954 PROCEDURE GetFromOuterModule (tokenno: CARDINAL; SymName: Name) : CARDINAL ;
1955
1956
1957 (*
1958 TryMoveUndeclaredSymToInnerModule - attempts to move a symbol of
1959 name, name, which is
1960 currently undefined in the
1961 outer scope to the inner scope.
1962 If successful then the symbol is
1963 returned otherwise NulSym is
1964 returned.
1965 *)
1966
1967 PROCEDURE TryMoveUndeclaredSymToInnerModule (OuterScope,
1968 InnerScope: CARDINAL;
1969 name: Name) : CARDINAL ;
1970
1971
1972 (*
1973 IsExportQualified - returns true if a symbol, Sym, was defined as
1974 being EXPORT QUALIFIED.
1975 Sym is expected to be either a procedure or a
1976 variable.
1977 *)
1978
1979 PROCEDURE IsExportQualified (Sym: CARDINAL) : BOOLEAN ;
1980
1981
1982 (*
1983 IsExportUnQualified - returns true if a symbol, Sym, was defined as
1984 being EXPORT UNQUALIFIED.
1985 Sym is expected to be either a procedure or a
1986 variable.
1987 *)
1988
1989 PROCEDURE IsExportUnQualified (Sym: CARDINAL) : BOOLEAN ;
1990
1991
1992 (*
1993 IsExported - returns true if a symbol, Sym, is exported
1994 from module, ModSym.
1995 If ModSym is a DefImp symbol then its
1996 ExportQualified and ExportUnQualified lists are examined.
1997 *)
1998
1999 PROCEDURE IsExported (ModSym: CARDINAL; Sym: CARDINAL) : BOOLEAN ;
2000
2001
2002 (*
2003 IsImplicityExported - returns TRUE if, Sym, is implicitly exported from module, ModSym.
2004 ModSym must be a defimp symbol.
2005 *)
2006
2007 PROCEDURE IsImplicityExported (ModSym, Sym: CARDINAL) : BOOLEAN ;
2008
2009
2010 (*
2011 IsImported - returns true if a symbol, Sym, in module, ModSym,
2012 was imported.
2013 *)
2014
2015 PROCEDURE IsImported (ModSym: CARDINAL; Sym: CARDINAL) : BOOLEAN ;
2016
2017
2018 (*
2019 PutIncludedByDefinition - places a module symbol, Sym, into the
2020 included list of the current definition module.
2021 *)
2022
2023 PROCEDURE PutIncludedByDefinition (Sym: CARDINAL) ;
2024
2025
2026 (*
2027 IsIncludedByDefinition - returns TRUE if definition module symbol, Sym, was included
2028 by ModSyms definition module.
2029 *)
2030
2031 PROCEDURE IsIncludedByDefinition (ModSym, Sym: CARDINAL) : BOOLEAN ;
2032
2033
2034 (*
2035 ForeachImportedDo - calls a procedure, P, foreach imported symbol
2036 in module, ModSym.
2037 *)
2038
2039 PROCEDURE ForeachImportedDo (ModSym: CARDINAL; P: PerformOperation) ;
2040
2041
2042 (*
2043 ForeachExportedDo - calls a procedure, P, foreach exported symbol
2044 from module, ModSym.
2045 *)
2046
2047 PROCEDURE ForeachExportedDo (ModSym: CARDINAL; P: PerformOperation) ;
2048
2049
2050 (*
2051 CheckForExportedImplementation - checks to see whether an implementation
2052 module is currently being compiled, if so,
2053 symbol, Sym, is removed from the
2054 NeedToBeImplemented list.
2055 This procedure is called whenever a symbol
2056 is declared, thus attenpting to reduce
2057 the NeedToBeImplemented list.
2058 Only needs to be called when a TYPE or
2059 PROCEDURE is built since the implementation
2060 module can only implement these objects
2061 declared in the definition module.
2062 *)
2063
2064 PROCEDURE CheckForExportedImplementation (Sym: CARDINAL) ;
2065
2066
2067 (*
2068 CheckForUnImplementedExports - displays an error and the offending symbols
2069 which have been EXPORTed but not implemented
2070 from the current compiled module.
2071 *)
2072
2073 PROCEDURE CheckForUnImplementedExports ;
2074
2075
2076 (*
2077 CheckForUndeclaredExports - displays an error and the offending symbols
2078 which have been EXPORTed but not declared
2079 from module, ModSym.
2080 *)
2081
2082 PROCEDURE CheckForUndeclaredExports (ModSym: CARDINAL) ;
2083
2084
2085 (*
2086 CheckForUnknownInModule - checks for any unknown symbols in the
2087 current module.
2088 If any unknown symbols are found then
2089 an error message is displayed.
2090 *)
2091
2092 PROCEDURE CheckForUnknownInModule ;
2093
2094
2095 (*
2096 UnknownReported - if sym is an unknown symbol and has not been reported
2097 then include it into the set of reported unknowns.
2098 *)
2099
2100 PROCEDURE UnknownReported (sym: CARDINAL) ;
2101
2102
2103 (*
2104 IsReallyPointer - returns TRUE is sym is a pointer, address or a
2105 type declared as a pointer or address.
2106 *)
2107
2108 PROCEDURE IsReallyPointer (Sym: CARDINAL) : BOOLEAN ;
2109
2110
2111 (*
2112 CheckHiddenTypeAreAddress - checks to see that any hidden types
2113 which we have declared are actually
2114 of type ADDRESS or map onto a POINTER type.
2115 *)
2116
2117 PROCEDURE CheckHiddenTypeAreAddress ;
2118
2119
2120 (*
2121 PutDefinitionForC - sets a flag in the module, Sym, which
2122 indicates that this module is a wrapper for a C
2123 file. Parameters passes to procedures in this module
2124 will adopt the C calling convention.
2125 *)
2126
2127 PROCEDURE PutDefinitionForC (Sym: CARDINAL) ;
2128
2129
2130 (*
2131 IsDefinitionForC - returns true if this definition module was declared
2132 as a DEFINITION MODULE FOR "C".
2133 *)
2134
2135 PROCEDURE IsDefinitionForC (Sym: CARDINAL) : BOOLEAN ;
2136
2137
2138 (*
2139 PutDoesNeedExportList - sets a flag in module, Sym, which
2140 indicates that this module requires an explicit
2141 EXPORT QUALIFIED or UNQUALIFIED list. PIM-2
2142 *)
2143
2144 PROCEDURE PutDoesNeedExportList (Sym: CARDINAL) ;
2145
2146
2147 (*
2148 PutDoesNotNeedExportList - sets a flag in module, Sym, which
2149 indicates that this module does not require an explicit
2150 EXPORT QUALIFIED or UNQUALIFIED list. PIM-3|4
2151 *)
2152
2153 PROCEDURE PutDoesNotNeedExportList (Sym: CARDINAL) ;
2154
2155
2156 (*
2157 DoesNotNeedExportList - returns TRUE if module, Sym, does not require an explicit
2158 EXPORT QUALIFIED list.
2159 *)
2160
2161 PROCEDURE DoesNotNeedExportList (Sym: CARDINAL) : BOOLEAN ;
2162
2163
2164 (*
2165 CheckForEnumerationInCurrentModule - checks to see whether the enumeration
2166 type symbol, Sym, has been entered into
2167 the current modules scope list.
2168 *)
2169
2170 PROCEDURE CheckForEnumerationInCurrentModule (Sym: CARDINAL) ;
2171
2172
2173 (*
2174 SanityCheckConstants - must only be called once all constants, types, procedures
2175 have been declared. It checks to see that constants are
2176 not used as PROCEDURE parameter types.
2177 *)
2178
2179 PROCEDURE SanityCheckConstants ;
2180
2181
2182 (*
2183 ForeachLocalSymDo - foreach local symbol in module, Sym, or procedure, Sym,
2184 perform the procedure, P.
2185 *)
2186
2187 PROCEDURE ForeachLocalSymDo (Sym: CARDINAL; P: PerformOperation) ;
2188
2189
2190 (*
2191 ForeachParamSymDo - foreach parameter symbol in procedure Sym
2192 perform the procedure P. Each symbol
2193 looked up will be VarParam or Param
2194 (not the shadow variable). Every parameter
2195 from each KindProcedure is iterated over.
2196 *)
2197
2198 PROCEDURE ForeachParamSymDo (Sym: CARDINAL; P: PerformOperation) ;
2199
2200
2201 (*
2202 ForeachFieldEnumerationDo - for each field in enumeration, Sym,
2203 do procedure, P. Each call to P contains
2204 an enumeration field, the order is alphabetical.
2205 Use ForeachLocalSymDo for declaration order.
2206 *)
2207
2208 PROCEDURE ForeachFieldEnumerationDo (Sym: CARDINAL; P: PerformOperation) ;
2209
2210
2211 (*
2212 IsType - returns true if the Sym is a type symbol.
2213 *)
2214
2215 PROCEDURE IsType (Sym: CARDINAL) : BOOLEAN ;
2216
2217
2218 (*
2219 IsProcedure - returns true is Sym is a PROCEDURE symbol.
2220 *)
2221
2222 PROCEDURE IsProcedure (Sym: CARDINAL) : BOOLEAN ;
2223
2224
2225 (*
2226 IsParameter - returns true if Sym is a parameter symbol.
2227 *)
2228
2229 PROCEDURE IsParameter (Sym: CARDINAL) : BOOLEAN ;
2230
2231
2232 (*
2233 GetProcedureKind - returns the procedure kind given the declaration tok.
2234 The declaration tok must match the ident tok in the
2235 procedure name. It is only safe to call this
2236 procedure function during pass 2 onwards.
2237 *)
2238
2239 PROCEDURE GetProcedureKind (sym: CARDINAL; tok: CARDINAL) : ProcedureKind ;
2240
2241
2242 (*
2243 GetProcedureDeclaredTok - return the token where the
2244 declaration of procedure sym:kind
2245 occurred.
2246 *)
2247
2248 PROCEDURE GetProcedureDeclaredTok (sym: CARDINAL; kind: ProcedureKind) : CARDINAL ;
2249
2250
2251 (*
2252 PutProcedureDeclaredTok - places the tok where the
2253 declaration of procedure sym:kind
2254 occurred.
2255 *)
2256
2257 PROCEDURE PutProcedureDeclaredTok (sym: CARDINAL; kind: ProcedureKind;
2258 tok: CARDINAL) ;
2259
2260
2261 (*
2262 GetReturnTypeTok - return the token where the
2263 return type procedure sym:kind was defined.
2264 *)
2265
2266 PROCEDURE GetReturnTypeTok (sym: CARDINAL; kind: ProcedureKind) : CARDINAL ;
2267
2268
2269 (*
2270 PutReturnTypeTok - places the tok where the return type of procedure sym:kind
2271 was defined.
2272 *)
2273
2274 PROCEDURE PutReturnTypeTok (sym: CARDINAL; kind: ProcedureKind; tok: CARDINAL) ;
2275
2276
2277 (*
2278 PutProcedureParametersDefined - the procedure symbol sym:kind
2279 parameters have been defined.
2280 *)
2281
2282 PROCEDURE PutProcedureParametersDefined (sym: CARDINAL; kind: ProcedureKind) ;
2283
2284
2285 (*
2286 GetProcedureParametersDefined - returns true if procedure symbol sym:kind
2287 parameters are defined.
2288 *)
2289
2290 PROCEDURE GetProcedureParametersDefined (sym: CARDINAL; kind: ProcedureKind) : BOOLEAN ;
2291
2292
2293 (*
2294 PutProcedureDefined - the procedure symbol sym:kind is defined.
2295 *)
2296
2297 PROCEDURE PutProcedureDefined (sym: CARDINAL; kind: ProcedureKind) ;
2298
2299
2300 (*
2301 GetProcedureDefined - returns true if procedure symbol sym:kind
2302 is defined.
2303 *)
2304
2305 PROCEDURE GetProcedureDefined (sym: CARDINAL; kind: ProcedureKind) : BOOLEAN ;
2306
2307
2308 (*
2309 PutUseVarArgs - tell the symbol table that this procedure, Sym, uses varargs.
2310 The procedure _must_ be declared inside a
2311 DEFINITION FOR "C"
2312
2313 *)
2314
2315 PROCEDURE PutUseVarArgs (Sym: CARDINAL) ;
2316
2317
2318 (*
2319 UsesVarArgs - returns TRUE if procedure, Sym, uses varargs.
2320 The procedure _must_ be declared inside a
2321 DEFINITION FOR "C"
2322 *)
2323
2324 PROCEDURE UsesVarArgs (Sym: CARDINAL) : BOOLEAN ;
2325
2326
2327 (*
2328 PutUseOptArg - tell the symbol table that this procedure, Sym,
2329 uses an optarg.
2330 *)
2331
2332 PROCEDURE PutUseOptArg (Sym: CARDINAL; kind: ProcedureKind) ;
2333
2334
2335 (*
2336 UsesOptArg - returns TRUE if procedure, Sym, uses varargs.
2337 *)
2338
2339 PROCEDURE UsesOptArg (Sym: CARDINAL; kind: ProcedureKind) : BOOLEAN ;
2340
2341
2342 (*
2343 PutOptArgInit - makes symbol, Sym, the initializer value to
2344 procedure, ProcSym.
2345 *)
2346
2347 PROCEDURE PutOptArgInit (ProcSym: CARDINAL; Sym: CARDINAL) ;
2348
2349
2350 (*
2351 GetOptArgInit - returns the initializer value to the optional parameter in
2352 procedure, ProcSym.
2353 *)
2354
2355 PROCEDURE GetOptArgInit (ProcSym: CARDINAL) : CARDINAL ;
2356
2357
2358 (*
2359 MakePointer - returns a pointer symbol with PointerName.
2360 *)
2361
2362 PROCEDURE MakePointer (tok: CARDINAL; PointerName: Name) : CARDINAL ;
2363
2364
2365 (*
2366 PutPointer - gives a pointer symbol a type, PointerType.
2367 *)
2368
2369 PROCEDURE PutPointer (Sym: CARDINAL; PointerType: CARDINAL) ;
2370
2371
2372 (*
2373 IsPointer - returns true is Sym is a pointer type symbol.
2374 *)
2375
2376 PROCEDURE IsPointer (Sym: CARDINAL) : BOOLEAN ;
2377
2378
2379 (*
2380 IsRecord - returns true is Sym is a record type symbol.
2381 *)
2382
2383 PROCEDURE IsRecord (Sym: CARDINAL) : BOOLEAN ;
2384
2385
2386 (*
2387 IsVarient - returns true if the symbol, Sym, is a
2388 varient symbol.
2389 *)
2390
2391 PROCEDURE IsVarient (Sym: CARDINAL) : BOOLEAN ;
2392
2393
2394 (*
2395 IsFieldVarient - returns true if the symbol, Sym, is a
2396 varient field.
2397 *)
2398
2399 PROCEDURE IsFieldVarient (Sym: CARDINAL) : BOOLEAN ;
2400
2401
2402 (*
2403 IsFieldEnumeration - returns true if the symbol, Sym, is an
2404 enumeration field.
2405 *)
2406
2407 PROCEDURE IsFieldEnumeration (Sym: CARDINAL) : BOOLEAN ;
2408
2409
2410 (*
2411 IsArray - returns true is Sym is an array type symbol.
2412 *)
2413
2414 PROCEDURE IsArray (Sym: CARDINAL) : BOOLEAN ;
2415
2416
2417 (*
2418 IsEnumeration - returns true if Sym is an enumeration symbol.
2419 *)
2420
2421 PROCEDURE IsEnumeration (Sym: CARDINAL) : BOOLEAN ;
2422
2423
2424 (*
2425 IsSet - returns TRUE if Sym is a set symbol.
2426 *)
2427
2428 PROCEDURE IsSet (Sym: CARDINAL) : BOOLEAN ;
2429
2430
2431 (*
2432 IsHiddenType - returns TRUE if, Sym, is a Type and is also declared as a hidden type.
2433 *)
2434
2435 PROCEDURE IsHiddenType (Sym: CARDINAL) : BOOLEAN ;
2436
2437
2438 (*
2439 IsOAFamily - returns TRUE if, Sym, is an OAFamily symbol.
2440 *)
2441
2442 PROCEDURE IsOAFamily (Sym: CARDINAL) : BOOLEAN ;
2443
2444
2445 (*
2446 GetDimension - return the number of dimensions associated with
2447 this unbounded ARRAY parameter.
2448 *)
2449
2450 PROCEDURE GetDimension (sym: CARDINAL) : CARDINAL ;
2451
2452
2453 (*
2454 MakeOAFamily - makes an OAFamily symbol based on SimpleType.
2455 It returns the OAFamily symbol. A new symbol
2456 is created if one does not already exist for
2457 SimpleType.
2458 *)
2459
2460 PROCEDURE MakeOAFamily (SimpleType: CARDINAL) : CARDINAL ;
2461
2462
2463 (*
2464 GetOAFamily - returns the oafamily symbol associated with
2465 SimpleType.
2466 *)
2467
2468 PROCEDURE GetOAFamily (SimpleType: CARDINAL) : CARDINAL ;
2469
2470
2471 (*
2472 ForeachOAFamily - call, p[oaf, ndim, symbol] for every unbounded symbol,
2473 sym, in the oaf.
2474 *)
2475
2476 PROCEDURE ForeachOAFamily (sym: CARDINAL; p: FamilyOperation) ;
2477
2478
2479 (*
2480 IsUnbounded - returns true if Sym is an unbounded symbol.
2481 *)
2482
2483 PROCEDURE IsUnbounded (Sym: CARDINAL) : BOOLEAN ;
2484
2485
2486 (*
2487 GetUnbounded - returns the unbounded symbol associated with
2488 SimpleType.
2489 *)
2490
2491 PROCEDURE GetUnbounded (oaf: CARDINAL; ndim: CARDINAL) : CARDINAL ;
2492
2493
2494 (*
2495 GetUnboundedRecordType - returns the record type used to
2496 implement the unbounded array.
2497 *)
2498
2499 PROCEDURE GetUnboundedRecordType (Sym: CARDINAL) : CARDINAL ;
2500
2501
2502 (*
2503 GetUnboundedAddressOffset - returns the offset of the address field
2504 inside the record used to implement the
2505 unbounded type.
2506 *)
2507
2508 PROCEDURE GetUnboundedAddressOffset (sym: CARDINAL) : CARDINAL ;
2509
2510
2511 (*
2512 GetUnboundedHighOffset - returns the offset of the high field
2513 inside the record used to implement the
2514 unbounded type.
2515 *)
2516
2517 PROCEDURE GetUnboundedHighOffset (sym: CARDINAL; ndim: CARDINAL) : CARDINAL ;
2518
2519
2520 (*
2521 MakeSubscript - makes a subscript Symbol.
2522 No name is required.
2523 *)
2524
2525 PROCEDURE MakeSubscript () : CARDINAL ;
2526
2527
2528 (*
2529 PutSubscript - gives a subscript symbol a type, SimpleType.
2530 *)
2531
2532 PROCEDURE PutSubscript (Sym: CARDINAL; SimpleType: CARDINAL) ;
2533
2534
2535 (*
2536 MakeUnbounded - makes an unbounded array Symbol.
2537 ndim is the number of dimensions required.
2538 No name is required.
2539 *)
2540
2541 PROCEDURE MakeUnbounded (tok: CARDINAL;
2542 SimpleType: CARDINAL; ndim: CARDINAL) : CARDINAL ;
2543
2544
2545 (*
2546 NoOfElements - Returns the number of elements in array Sym,
2547 or the number of elements in an enumeration Sym.
2548 *)
2549
2550 PROCEDURE NoOfElements (Sym: CARDINAL) : CARDINAL ;
2551
2552
2553 (*
2554 PutArray - places a type symbol into an arraysym.
2555 *)
2556
2557 PROCEDURE PutArray (arraysym, typesym: CARDINAL) ;
2558
2559
2560 (*
2561 ResolveImports -
2562 *)
2563
2564 PROCEDURE ResolveImports ;
2565
2566
2567 (*
2568 ResolveConstructorTypes - to be called at the end of pass three. Its
2569 purpose is to fix up all constructors whose
2570 types are unknown.
2571 *)
2572
2573 PROCEDURE ResolveConstructorTypes ;
2574
2575
2576 (*
2577 AddNameToScope - adds a Name, n, to the list of objects declared at the
2578 current scope.
2579 *)
2580
2581 PROCEDURE AddNameToScope (n: Name) ;
2582
2583
2584 (*
2585 AddNameToImportList - adds a Name, n, to the import list of the current
2586 module.
2587 *)
2588
2589 PROCEDURE AddNameToImportList (n: Name) ;
2590
2591
2592 (*
2593 GetScope - returns the declaration scope of the symbol.
2594 *)
2595
2596 PROCEDURE GetScope (Sym: CARDINAL) : CARDINAL ;
2597
2598
2599 (*
2600 GetModuleScope - returns the module scope of symbol, sym.
2601 If sym was declared within a nested procedure
2602 then return the module which defines the
2603 procedure.
2604 *)
2605
2606 PROCEDURE GetModuleScope (sym: CARDINAL) : CARDINAL ;
2607
2608
2609 (*
2610 GetProcedureScope - returns the innermost procedure (if any)
2611 in which the symbol, sym, resides.
2612 A module inside the PROCEDURE is skipped
2613 over.
2614 *)
2615
2616 PROCEDURE GetProcedureScope (sym: CARDINAL) : CARDINAL ;
2617
2618
2619 (*
2620 IsModuleWithinProcedure - returns TRUE if module, sym, is
2621 inside a procedure.
2622 *)
2623
2624 PROCEDURE IsModuleWithinProcedure (sym: CARDINAL) : BOOLEAN ;
2625
2626
2627 (*
2628 GetParent - returns the parent of symbol, Sym.
2629 *)
2630
2631 PROCEDURE GetParent (Sym: CARDINAL) : CARDINAL ;
2632
2633
2634 (*
2635 IsRecordField - returns true if Sym is a record field.
2636 *)
2637
2638 PROCEDURE IsRecordField (Sym: CARDINAL) : BOOLEAN ;
2639
2640
2641 (*
2642 MakeProcType - returns a procedure type symbol with ProcTypeName.
2643 *)
2644
2645 PROCEDURE MakeProcType (tok: CARDINAL; ProcTypeName: Name) : CARDINAL ;
2646
2647
2648 (*
2649 PutProcTypeParam - Places a Non VAR parameter ParamName with type
2650 ParamType into ProcType Sym.
2651 *)
2652
2653 PROCEDURE PutProcTypeParam (tok: CARDINAL;
2654 Sym: CARDINAL;
2655 ParamType: CARDINAL; isUnbounded: BOOLEAN) ;
2656
2657
2658 (*
2659 PutProcTypeVarParam - Places a Non VAR parameter ParamName with type
2660 ParamType into ProcType Sym.
2661 *)
2662
2663 PROCEDURE PutProcTypeVarParam (tok: CARDINAL;
2664 Sym: CARDINAL;
2665 ParamType: CARDINAL; isUnbounded: BOOLEAN) ;
2666
2667
2668 (*
2669 IsProcType - returns true if Sym is a ProcType Symbol.
2670 *)
2671
2672 PROCEDURE IsProcType (Sym: CARDINAL) : BOOLEAN ;
2673
2674
2675 (*
2676 IsVar - returns true if Sym is a Var Symbol.
2677 *)
2678
2679 PROCEDURE IsVar (Sym: CARDINAL) : BOOLEAN ;
2680
2681
2682 (*
2683 IsVarConst - returns the IsConst field indicating the variable is read only.
2684 *)
2685
2686 PROCEDURE IsVarConst (sym: CARDINAL) : BOOLEAN ;
2687
2688
2689 (*
2690 IsConst - returns true is Sym is a Const Symbol.
2691 *)
2692
2693 PROCEDURE IsConst (Sym: CARDINAL) : BOOLEAN ;
2694
2695
2696 (*
2697 IsConstString - returns true if Sym is a string.
2698 *)
2699
2700 PROCEDURE IsConstString (sym: CARDINAL) : BOOLEAN ;
2701
2702
2703 (*
2704 IsConstStringNulTerminated - returns TRUE if the constant string, sym,
2705 should be created with a nul terminator.
2706 *)
2707
2708 PROCEDURE IsConstStringNulTerminated (sym: CARDINAL) : BOOLEAN ;
2709
2710
2711 (*
2712 IsConstLit - returns true if Sym is a literal constant.
2713 *)
2714
2715 PROCEDURE IsConstLit (Sym: CARDINAL) : BOOLEAN ;
2716
2717
2718 (*
2719 IsConstructor - returns TRUE if the constant is declared as a
2720 constant set, array or record.
2721 *)
2722
2723 PROCEDURE IsConstructor (Sym: CARDINAL) : BOOLEAN ;
2724
2725
2726 (*
2727 IsDummy - returns true if Sym is a Dummy symbol.
2728 *)
2729
2730 PROCEDURE IsDummy (Sym: CARDINAL) : BOOLEAN ;
2731
2732
2733 (*
2734 IsTemporary - returns true if Sym is a Temporary symbol.
2735 *)
2736
2737 PROCEDURE IsTemporary (Sym: CARDINAL) : BOOLEAN ;
2738
2739
2740 (*
2741 IsVarAParam - returns true if Sym is a variable declared as a parameter.
2742 *)
2743
2744 PROCEDURE IsVarAParam (Sym: CARDINAL) : BOOLEAN ;
2745
2746
2747 (*
2748 IsSubscript - returns true if Sym is a subscript symbol.
2749 *)
2750
2751 PROCEDURE IsSubscript (Sym: CARDINAL) : BOOLEAN ;
2752
2753
2754 (*
2755 IsSubrange - returns true if Sym is a subrange symbol.
2756 *)
2757
2758 PROCEDURE IsSubrange (Sym: CARDINAL) : BOOLEAN ;
2759
2760
2761 (*
2762 IsProcedureVariable - returns true if a Sym is a variable and
2763 it was declared within a procedure.
2764 *)
2765
2766 PROCEDURE IsProcedureVariable (Sym: CARDINAL) : BOOLEAN ;
2767
2768
2769 (*
2770 IsProcedureNested - returns TRUE if procedure, Sym, was
2771 declared as a nested procedure.
2772 *)
2773
2774 PROCEDURE IsProcedureNested (Sym: CARDINAL) : BOOLEAN ;
2775
2776
2777 (*
2778 IsAModula2Type - returns true if Sym, is a:
2779 IsType, IsPointer, IsRecord, IsEnumeration,
2780 IsSubrange, IsArray, IsUnbounded, IsProcType.
2781 NOTE that it different from IsType.
2782 IsType is used for:
2783 TYPE
2784 a = CARDINAL ; (* IsType(a)=TRUE *)
2785 *)
2786
2787 PROCEDURE IsAModula2Type (Sym: CARDINAL) : BOOLEAN ;
2788
2789
2790 (*
2791 IsGnuAsmVolatile - returns TRUE if a GnuAsm symbol was defined as VOLATILE.
2792 *)
2793
2794 PROCEDURE IsGnuAsmVolatile (Sym: CARDINAL) : BOOLEAN ;
2795
2796
2797 (*
2798 IsGnuAsmSimple - returns TRUE if a GnuAsm symbol is a simple statement of the
2799 form ASM("instruction"), which differs from ASM("instruction" :)
2800 slightly.
2801 *)
2802
2803 PROCEDURE IsGnuAsmSimple (Sym: CARDINAL) : BOOLEAN ;
2804
2805
2806 (*
2807 IsGnuAsm - returns TRUE if Sym is a GnuAsm symbol.
2808 *)
2809
2810 PROCEDURE IsGnuAsm (Sym: CARDINAL) : BOOLEAN ;
2811
2812
2813 (*
2814 IsRegInterface - returns TRUE if Sym is a RegInterface symbol.
2815 *)
2816
2817 PROCEDURE IsRegInterface (Sym: CARDINAL) : BOOLEAN ;
2818
2819
2820 (*
2821 IsSizeSolved - returns true if the size of Sym is solved.
2822 *)
2823
2824 PROCEDURE IsSizeSolved (Sym: CARDINAL) : BOOLEAN ;
2825
2826
2827 (*
2828 IsOffsetSolved - returns true if the Offset of Sym is solved.
2829 *)
2830
2831 PROCEDURE IsOffsetSolved (Sym: CARDINAL) : BOOLEAN ;
2832
2833
2834 (*
2835 IsValueSolved - returns true if the value of Sym is solved.
2836 *)
2837
2838 PROCEDURE IsValueSolved (Sym: CARDINAL) : BOOLEAN ;
2839
2840
2841 (*
2842 IsConstructorConstant - returns TRUE if constructor, Sym, is
2843 defined by only constants.
2844 *)
2845
2846 PROCEDURE IsConstructorConstant (Sym: CARDINAL) : BOOLEAN ;
2847
2848
2849 (*
2850 IsComposite - returns TRUE if symbol, sym, is a composite
2851 type: ie an ARRAY or RECORD.
2852 *)
2853
2854 PROCEDURE IsComposite (sym: CARDINAL) : BOOLEAN ;
2855
2856
2857 (*
2858 IsSumOfParamSizeSolved - has the sum of parameters been solved yet?
2859 *)
2860
2861 PROCEDURE IsSumOfParamSizeSolved (Sym: CARDINAL) : BOOLEAN ;
2862
2863
2864 (*
2865 PutAlignment - assigns the alignment constant associated with,
2866 type, with, align.
2867 *)
2868
2869 PROCEDURE PutAlignment (type: CARDINAL; align: CARDINAL) ;
2870
2871
2872 (*
2873 GetAlignment - returns the alignment constant associated with,
2874 type.
2875 *)
2876
2877 PROCEDURE GetAlignment (type: CARDINAL) : CARDINAL ;
2878
2879
2880 (*
2881 GetDefaultRecordFieldAlignment - assigns, align, as the default alignment
2882 to record, sym.
2883 *)
2884
2885 PROCEDURE GetDefaultRecordFieldAlignment (sym: CARDINAL) : CARDINAL ;
2886
2887
2888 (*
2889 PutDefaultRecordFieldAlignment - assigns, align, as the default alignment
2890 to record, sym.
2891 *)
2892
2893 PROCEDURE PutDefaultRecordFieldAlignment (sym: CARDINAL; align: CARDINAL) ;
2894
2895
2896 (*
2897 PutUnused - sets, sym, as unused. This is a gm2 pragma.
2898 *)
2899
2900 PROCEDURE PutUnused (sym: CARDINAL) ;
2901
2902
2903 (*
2904 IsUnused - returns TRUE if the symbol was declared as unused with a
2905 gm2 pragma.
2906 *)
2907
2908 PROCEDURE IsUnused (sym: CARDINAL) : BOOLEAN ;
2909
2910
2911 (*
2912 PutDeclaredPacked - sets the Packed field of the record or record field symbol.
2913 *)
2914
2915 PROCEDURE PutDeclaredPacked (sym: CARDINAL; b: BOOLEAN) ;
2916
2917
2918 (*
2919 IsDeclaredPacked - was the record symbol or record field, sym,
2920 declared as packed?
2921 *)
2922
2923 PROCEDURE IsDeclaredPacked (sym: CARDINAL) : BOOLEAN ;
2924
2925
2926 (*
2927 IsDeclaredPackedResolved - do we know if the record symbol or record
2928 field, sym, declared as packed or not packed?
2929 *)
2930
2931 PROCEDURE IsDeclaredPackedResolved (sym: CARDINAL) : BOOLEAN ;
2932
2933
2934 (*
2935 GetPackedEquivalent - returns the packed equivalent of type, sym.
2936 sym must be a type, subrange, set or enumerated type.
2937 *)
2938
2939 PROCEDURE GetPackedEquivalent (sym: CARDINAL) : CARDINAL ;
2940
2941
2942 (*
2943 GetNonPackedEquivalent - returns the equivalent non packed symbol
2944 associated with, sym.
2945 *)
2946
2947 PROCEDURE GetNonPackedEquivalent (sym: CARDINAL) : CARDINAL ;
2948
2949
2950 (*
2951 IsEquivalent - returns TRUE if, sym, is an equivalent symbol.
2952 *)
2953
2954 PROCEDURE IsEquivalent (sym: CARDINAL) : BOOLEAN ;
2955
2956
2957 (*
2958 PushSize - pushes the size of Sym.
2959 *)
2960
2961 PROCEDURE PushSize (Sym: CARDINAL) ;
2962
2963
2964 (*
2965 PopSize - pops the ALU stack into Size of Sym.
2966 *)
2967
2968 PROCEDURE PopSize (Sym: CARDINAL) ;
2969
2970
2971 (*
2972 PushValue - pushes the Value of Sym onto the ALU stack.
2973 *)
2974
2975 PROCEDURE PushValue (Sym: CARDINAL) ;
2976
2977
2978 (*
2979 PushVarSize - pushes the size of a variable, Sym.
2980 The runtime size of Sym will depend upon its addressing mode,
2981 RightValue has size PushSize(GetType(Sym)) and
2982 LeftValue has size PushSize(Address) since it points to a
2983 variable.
2984 However this procedure uses the Type of Sym therefore
2985 this Type must be solved before this procedure is called.
2986 *)
2987
2988 PROCEDURE PushVarSize (Sym: CARDINAL) ;
2989
2990
2991 (*
2992 PopValue - pops the ALU stack into Value of Sym.
2993 *)
2994
2995 PROCEDURE PopValue (Sym: CARDINAL) ;
2996
2997
2998 (*
2999 IsObject - returns TRUE if the symbol is an object symbol.
3000 *)
3001
3002 PROCEDURE IsObject (Sym: CARDINAL) : BOOLEAN ;
3003
3004
3005 (*
3006 IsTuple - returns TRUE if the symbol is a tuple symbol.
3007 *)
3008
3009 PROCEDURE IsTuple (Sym: CARDINAL) : BOOLEAN ;
3010
3011
3012 (*
3013 Make2Tuple - creates and returns a 2 tuple from, a, and, b.
3014 *)
3015
3016 PROCEDURE Make2Tuple (a, b: CARDINAL) : CARDINAL ;
3017
3018
3019 (*
3020 MakeError - creates an error node, which can be used in MetaError messages.
3021 It will be removed from ExportUndeclared and Unknown trees.
3022 *)
3023
3024 PROCEDURE MakeError (tok: CARDINAL; name: Name) : CARDINAL ;
3025
3026
3027 (*
3028 MakeErrorS - creates an error node from a string, which can be used
3029 in MetaError messages.
3030 It will be removed from ExportUndeclared and Unknown trees.
3031 *)
3032
3033 PROCEDURE MakeErrorS (tok: CARDINAL; name: String) : CARDINAL ;
3034
3035
3036 (*
3037 IsError - returns TRUE if the symbol is an error symbol.
3038 *)
3039
3040 PROCEDURE IsError (Sym: CARDINAL) : BOOLEAN ;
3041
3042
3043 (*
3044 IsLegal - returns TRUE if, sym, is a legal symbol.
3045 *)
3046
3047 PROCEDURE IsLegal (sym: CARDINAL) : BOOLEAN ;
3048
3049
3050 (*
3051 PutModuleContainsBuiltin - sets a flag in the current compiled module which
3052 indicates that a builtin PROCEDURE is being declared.
3053 This is only expected to be called when we are
3054 parsing the definition module.
3055 *)
3056
3057 PROCEDURE PutModuleContainsBuiltin ;
3058
3059
3060 (*
3061 IsBuiltinInModule - returns true if a module, Sym, has declared a builtin procedure.
3062 *)
3063
3064 PROCEDURE IsBuiltinInModule (Sym: CARDINAL) : BOOLEAN ;
3065
3066
3067 (*
3068 PutHiddenTypeDeclared - sets a flag in the current compiled module which
3069 indicates that a Hidden Type is declared within
3070 the implementation part of the module.
3071 This procedure is expected to be called while
3072 compiling the associated definition module.
3073 *)
3074
3075 PROCEDURE PutHiddenTypeDeclared ;
3076
3077
3078 (*
3079 IsHiddenTypeDeclared - returns true if a Hidden Type was declared in
3080 the module, Sym.
3081 *)
3082
3083 PROCEDURE IsHiddenTypeDeclared (Sym: CARDINAL) : BOOLEAN ;
3084
3085
3086 (*
3087 IsHiddenReallyPointer - returns TRUE is sym is a pointer, address or a
3088 type declared as a pointer or address.
3089 *)
3090
3091 PROCEDURE IsHiddenReallyPointer (Sym: CARDINAL) : BOOLEAN ;
3092
3093
3094 (*
3095 DisplayTrees - displays the SymbolTrees for Module symbol, ModSym.
3096 *)
3097
3098 PROCEDURE DisplayTrees (ModSym: CARDINAL) ;
3099
3100
3101 (*
3102 DebugLineNumbers - internal debugging, emit all procedure names in this module
3103 together with the line numbers for the corresponding begin/end
3104 tokens.
3105 *)
3106
3107 PROCEDURE DebugLineNumbers (sym: CARDINAL) ;
3108
3109
3110 (*
3111 GetErrorScope - returns the error scope for a symbol.
3112 The error scope is the title scope which is used to
3113 announce the symbol in the GCC error message.
3114 *)
3115
3116 PROCEDURE GetErrorScope (sym: CARDINAL) : ErrorScope ;
3117
3118
3119 (*
3120 PutErrorScope - sets the error scope for a symbol.
3121 The error scope is the title scope which is used to
3122 announce the symbol in the GCC error message.
3123
3124 PROCEDURE PutErrorScope (sym: CARDINAL; errorScope: ErrorScope) ;
3125 *)
3126
3127
3128 (*
3129 MakeImport - create and return an import symbol.
3130 moduleSym is the symbol being imported.
3131 isqualified is FALSE if it were IMPORT modulename and
3132 TRUE for the qualified FROM modulename IMPORT etc.
3133 listno is the import list count for this module.
3134 tok should match this modulename position.
3135 *)
3136
3137 PROCEDURE MakeImport (tok: CARDINAL;
3138 moduleSym: CARDINAL;
3139 listno: CARDINAL;
3140 isqualified: BOOLEAN) : CARDINAL ;
3141
3142
3143 (*
3144 MakeImportStatement - return a dependent symbol which represents an import statement
3145 or a qualified import statement. The tok should either match
3146 the FROM token or the IMPORT token. listno is the import list
3147 count for the module.
3148 *)
3149
3150 PROCEDURE MakeImportStatement (tok: CARDINAL; listno: CARDINAL) : CARDINAL ;
3151
3152
3153 (*
3154 IsImport - returns TRUE if sym is an import symbol.
3155 *)
3156
3157 PROCEDURE IsImport (sym: CARDINAL) : BOOLEAN ;
3158
3159
3160 (*
3161 IsImportStatement - returns TRUE if sym is a dependent symbol.
3162 *)
3163
3164 PROCEDURE IsImportStatement (sym: CARDINAL) : BOOLEAN ;
3165
3166
3167 (*
3168 GetImportModule - returns the module associated with the import symbol.
3169 *)
3170
3171 PROCEDURE GetImportModule (sym: CARDINAL) : CARDINAL ;
3172
3173
3174 (*
3175 GetImportDeclared - returns the token associated with the import symbol.
3176 *)
3177
3178 PROCEDURE GetImportDeclared (sym: CARDINAL) : CARDINAL ;
3179
3180
3181 (*
3182 GetImportStatementList - returns the list of imports for this dependent.
3183 Each import symbol corresponds to a module.
3184 *)
3185
3186 PROCEDURE GetImportStatementList (sym: CARDINAL) : List ;
3187
3188
3189 (*
3190 GetModuleDefImportStatementList - returns the list of dependents associated with
3191 the definition module.
3192 *)
3193
3194 PROCEDURE GetModuleDefImportStatementList (sym: CARDINAL) : List ;
3195
3196
3197 (*
3198 GetModuleModImportStatementList - returns the list of dependents associated with
3199 the implementation or program module.
3200 *)
3201
3202 PROCEDURE GetModuleModImportStatementList (sym: CARDINAL) : List ;
3203
3204
3205 (*
3206 AppendModuleImportStatement - appends the ImportStatement symbol onto the
3207 module import list.
3208
3209 For example:
3210
3211 FROM x IMPORT y, z ;
3212 ^^^^
3213
3214 also:
3215
3216 IMPORT p, q, r;
3217 ^^^^^^
3218 will result in a new ImportStatement symbol added
3219 to the current module import list.
3220 The ImportStatement symbol is expected to be created
3221 by MakeImportStatement using the token positions
3222 outlined above.
3223 *)
3224
3225 PROCEDURE AppendModuleImportStatement (module, statement: CARDINAL) ;
3226
3227
3228 (*
3229 AppendModuleOnImportStatement - appends the import symbol onto the
3230 dependent list (chain).
3231
3232 For example each:
3233
3234 FROM x IMPORT y, z ;
3235 ^
3236 x are added to the dependent list.
3237
3238 also:
3239
3240 IMPORT p, q, r;
3241 ^ ^ ^
3242 will result in p, q and r added to
3243 to the dependent list.
3244
3245 The import symbol is created by MakeImport
3246 and the token is expected to match the module
3247 name outlined above.
3248 *)
3249
3250 PROCEDURE AppendModuleOnImportStatement (module, import: CARDINAL) ;
3251
3252
3253 (*
3254 PutModLink - assigns link to module sym.
3255 *)
3256
3257 PROCEDURE PutModLink (sym: CARDINAL; link: BOOLEAN) ;
3258
3259
3260 (*
3261 IsModLink - returns the ModLink value associated with the module symbol.
3262 *)
3263
3264 PROCEDURE IsModLink (sym: CARDINAL) : BOOLEAN ;
3265
3266
3267 (*
3268 PutDefLink - assigns link to the definition module sym.
3269 *)
3270
3271 PROCEDURE PutDefLink (sym: CARDINAL; link: BOOLEAN) ;
3272
3273
3274 (*
3275 IsDefLink - returns the DefLink value associated with the definition module symbol.
3276 *)
3277
3278 PROCEDURE IsDefLink (sym: CARDINAL) : BOOLEAN ;
3279
3280
3281 (*
3282 IsModuleBuiltin - returns TRUE if the module is a builtin module.
3283 (For example _BaseTypes).
3284 *)
3285
3286 PROCEDURE IsModuleBuiltin (sym: CARDINAL) : BOOLEAN ;
3287
3288
3289 (*
3290 PutModuleBuiltin - sets the Builtin flag to value.
3291 *)
3292
3293 PROCEDURE PutModuleBuiltin (sym: CARDINAL; value: BOOLEAN) ;
3294
3295
3296 (*
3297 PutVarArrayRef - assigns ArrayRef field with value.
3298 *)
3299
3300 PROCEDURE PutVarArrayRef (sym: CARDINAL; value: BOOLEAN) ;
3301
3302
3303 (*
3304 IsVarArrayRef - returns ArrayRef field value.
3305 *)
3306
3307 PROCEDURE IsVarArrayRef (sym: CARDINAL) : BOOLEAN ;
3308
3309
3310 (*
3311 VarCheckReadInit - returns TRUE if sym has been initialized.
3312 *)
3313
3314 PROCEDURE VarCheckReadInit (sym: CARDINAL; mode: ModeOfAddr) : BOOLEAN ;
3315
3316
3317 (*
3318 VarInitState - initializes the init state for variable sym.
3319 *)
3320
3321 PROCEDURE VarInitState (sym: CARDINAL) ;
3322
3323
3324 (*
3325 PutVarInitialized - set sym as initialized.
3326 *)
3327
3328 PROCEDURE PutVarInitialized (sym: CARDINAL; mode: ModeOfAddr) ;
3329
3330
3331 (*
3332 PutVarFieldInitialized - records that field has been initialized with
3333 variable sym. TRUE is returned if the field
3334 is detected and changed to initialized.
3335 *)
3336
3337 PROCEDURE PutVarFieldInitialized (sym: CARDINAL; mode: ModeOfAddr;
3338 fieldlist: List) : BOOLEAN ;
3339
3340
3341 (*
3342 GetVarFieldInitialized - return TRUE if fieldlist has been initialized
3343 within variable sym.
3344 *)
3345
3346 PROCEDURE GetVarFieldInitialized (sym: CARDINAL; mode: ModeOfAddr;
3347 fieldlist: List) : BOOLEAN ;
3348
3349
3350 (*
3351 PrintInitialized - display variable sym initialization state.
3352 *)
3353
3354 PROCEDURE PrintInitialized (sym: CARDINAL) ;
3355
3356
3357 (*
3358 GetParameterHeapVar - return the heap variable associated with the
3359 parameter or NulSym.
3360 *)
3361
3362 PROCEDURE GetParameterHeapVar (ParSym: CARDINAL) : CARDINAL ;
3363
3364
3365 (*
3366 PutProcedureParameterHeapVars - creates heap variables for parameter sym.
3367 *)
3368
3369 PROCEDURE PutProcedureParameterHeapVars (sym: CARDINAL) ;
3370
3371
3372 (*
3373 IsProcedureBuiltinAvailable - return TRUE if procedure is available as a builtin
3374 for the target architecture.
3375 *)
3376
3377 PROCEDURE IsProcedureBuiltinAvailable (procedure: CARDINAL) : BOOLEAN ;
3378
3379
3380 (*
3381 PutConstLitInternal - marks the sym as being an internal constant.
3382 Currently this is used when generating a default
3383 BY constant expression during a FOR loop.
3384 A constant marked as internal will always pass
3385 an expression type check.
3386 *)
3387
3388 PROCEDURE PutConstLitInternal (sym: CARDINAL; value: BOOLEAN) ;
3389
3390
3391 (*
3392 IsConstLitInternal - returns the value of the IsInternal field within
3393 a constant expression.
3394 *)
3395
3396 PROCEDURE IsConstLitInternal (sym: CARDINAL) : BOOLEAN ;
3397
3398
3399 (*
3400 GetVarDeclTypeTok - returns the TypeTok field associate with variable sym.
3401 *)
3402
3403 PROCEDURE GetVarDeclTypeTok (sym: CARDINAL) : CARDINAL ;
3404
3405
3406 (*
3407 PutVarDeclTypeTok - assigns the TypeTok field to typetok.
3408 sym can be a variable or parameter.
3409 *)
3410
3411 PROCEDURE PutVarDeclTypeTok (sym: CARDINAL; typetok: CARDINAL) ;
3412
3413
3414 (*
3415 GetVarDeclTok - returns the TypeTok field associate with variable sym.
3416 *)
3417
3418 PROCEDURE GetVarDeclTok (sym: CARDINAL) : CARDINAL ;
3419
3420
3421 (*
3422 PutVarDeclTok - assigns the VarTok field to vartok.
3423 sym can be a variable or parameter.
3424 *)
3425
3426 PROCEDURE PutVarDeclTok (sym: CARDINAL; vartok: CARDINAL) ;
3427
3428
3429 (*
3430 GetVarDeclFullTok - returns the full virtual token containing var: type.
3431 *)
3432
3433 PROCEDURE GetVarDeclFullTok (sym: CARDINAL) : CARDINAL ;
3434
3435
3436 (*
3437 IsProcedureAnyNoReturn - return TRUE if any of the defined kinds
3438 of procedure sym is declared no return.
3439 *)
3440
3441 PROCEDURE IsProcedureAnyNoReturn (sym: CARDINAL) : BOOLEAN ;
3442
3443
3444 (*
3445 GetNthParamAny - returns the nth parameter from the order
3446 proper procedure, forward declaration
3447 or definition module procedure.
3448 *)
3449
3450 PROCEDURE GetNthParamAny (sym: CARDINAL; ParamNo: CARDINAL) : CARDINAL ;
3451
3452
3453 (*
3454 NoOfParamAny - return the number of parameters for sym.
3455 *)
3456
3457 PROCEDURE NoOfParamAny (sym: CARDINAL) : CARDINAL ;
3458
3459
3460 (*
3461 SetReturnOptional - sets the ReturnOptional field in the Procedure:kind or
3462 ProcType symboltable entry.
3463 *)
3464
3465 PROCEDURE SetReturnOptional (sym: CARDINAL; kind: ProcedureKind;
3466 isopt: BOOLEAN) ;
3467
3468
3469 (*
3470 UsesOptArgAny - returns TRUE if procedure, Sym, uses varargs.
3471 *)
3472
3473 PROCEDURE UsesOptArgAny (Sym: CARDINAL) : BOOLEAN ;
3474
3475
3476 (*
3477 GetProcedureKindDesc - return a string describing kind.
3478 *)
3479
3480 PROCEDURE GetProcedureKindDesc (kind: ProcedureKind) : String ;
3481
3482
3483 (*
3484 GetNthParamAnyClosest - returns the nth parameter from the order
3485 proper procedure, forward declaration
3486 or definition module procedure.
3487 It chooses the parameter which is closest
3488 in source terms to currentmodule.
3489 The same module will return using the order
3490 proper procedure, forward procedure, definition module.
3491 Whereas an imported procedure will choose from
3492 DefProcedure, ProperProcedure, ForwardProcedure.
3493 *)
3494
3495 PROCEDURE GetNthParamAnyClosest (sym: CARDINAL; ParamNo: CARDINAL;
3496 currentmodule: CARDINAL) : CARDINAL ;
3497
3498
3499 END SymbolTable.