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