1 (* SymbolTable.def provides access to the symbol table.
3 Copyright (C) 2001-2023 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
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)
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.
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/>. *)
22 DEFINITION MODULE SymbolTable ;
28 Description: SymbolTable provides the higher level routines to
29 maintain a symbol table for the Modula-2 Compiler.
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 ;
40 EXPORT QUALIFIED NulSym,
46 AppendModuleOnImportStatement,
47 AppendModuleImportStatement,
49 StartScope, EndScope, PseudoScope,
52 CheckAnonymous, IsNameAnonymous,
57 MakeModule, MakeDefImp,
58 MakeInnerModule, MakeModuleCtor, PutModuleCtorExtern,
60 MakeProcedureCtorExtern,
66 MakeConstStringC, MakeConstStringCnul, MakeConstStringM2nul,
86 MakeImport, MakeImportStatement,
90 MakeError, MakeErrorS,
95 ForeachFieldEnumerationDo,
101 GetCurrentModuleScope,
104 GetType, GetLType, GetSType, GetDType,
105 SkipType, SkipTypeAndSubrange,
107 GetSym, GetLocalSym, GetDeclareSym, GetRecord,
120 GetParameterShadowVar,
122 GetUnboundedRecordType,
123 GetUnboundedAddressOffset,
124 GetUnboundedHighOffset,
126 PutModuleFinallyFunction, GetModuleFinallyFunction,
127 PutExceptionBlock, HasExceptionBlock,
128 PutExceptionFinally, HasExceptionFinally,
131 GetReadQuads, GetWriteQuads,
132 GetReadLimitQuads, GetWriteLimitQuads,
133 GetDeclaredDef, GetDeclaredMod, PutDeclared,
134 GetDeclaredDefinition, GetDeclaredModule,
136 PutProcedureBegin, PutProcedureEnd, GetProcedureBeginEnd,
137 GetGnuAsmInput, GetGnuAsmOutput, GetGnuAsmTrash, GetGnuAsm,
139 GetVariableAtAddress,
140 GetAlignment, GetDefaultRecordFieldAlignment,
141 PutDeclaredPacked, IsDeclaredPacked, IsDeclaredPackedResolved,
142 GetPackedEquivalent, GetNonPackedEquivalent,
143 GetConstStringM2, GetConstStringC, GetConstStringM2nul, GetConstStringCnul,
145 GetImportModule, GetImportDeclared,
146 GetImportStatementList, GetModuleDefImportStatementList, GetModuleModImportStatementList,
150 PutLeftValueFrontBackType,
171 IsRecordFieldAVarientTag,
176 PutArraySubscript, GetArraySubscript,
178 PutArrayLarge, IsArrayLarge,
180 PutFunction, PutOptFunction,
181 PutParam, PutVarParam, PutParamName,
182 PutProcTypeParam, PutProcTypeVarParam,
185 PutProcedureBuiltin, PutProcedureInline,
188 PutModuleFinallyStartQuad,
189 PutModuleFinallyEndQuad,
190 PutProcedureStartQuad,
192 PutProcedureScopeQuad,
193 PutProcedureReachable,
194 PutReadQuad, RemoveReadQuad,
195 PutWriteQuad, RemoveWriteQuad,
196 PutGnuAsm, PutGnuAsmOutput, PutGnuAsmInput, PutGnuAsmTrash,
197 PutGnuAsmVolatile, PutGnuAsmSimple,
199 PutVariableAtAddress,
200 PutAlignment, PutDefaultRecordFieldAlignment,
202 PutVariableSSA, IsVariableSSA,
203 PutPublic, IsPublic, PutCtor, IsCtor, PutExtern, IsExtern,
204 PutMonoName, IsMonoName,
214 IsParameterUnbounded,
234 IsConstStringM2, IsConstStringC, IsConstStringM2nul, IsConstStringCnul,
239 IsTemporary, IsVarAParam,
245 IsGnuAsmVolatile, IsGnuAsmSimple, IsGnuAsm, IsRegInterface,
254 IsProcedureReachable,
257 IsProcedureBuiltin, IsProcedureInline,
258 IsModuleWithinProcedure,
266 ProcedureParametersDefined,
267 AreProcedureParametersDefined,
268 ParametersDefinedInDefinition,
269 AreParametersDefinedInDefinition,
270 ParametersDefinedInImplementation,
271 AreParametersDefinedInImplementation,
288 AddNameToScope, ResolveImports,
289 GetScope, GetModuleScope, GetProcedureScope,
302 PutExportUnQualified,
303 PutExportUnImplemented,
310 PutIncludedByDefinition, IsIncludedByDefinition,
311 TryMoveUndeclaredSymToInnerModule,
316 CheckForExportedImplementation,
317 CheckForUnImplementedExports,
318 CheckForUndeclaredExports,
319 CheckForUnknownInModule, UnknownReported,
320 CheckHiddenTypeAreAddress,
322 CheckForEnumerationInCurrentModule,
323 PutHiddenTypeDeclared,
324 IsHiddenTypeDeclared,
329 PutDoesNeedExportList, PutDoesNotNeedExportList,
330 DoesNotNeedExportList,
331 ResolveConstructorTypes,
332 MakeTemporaryFromExpression, MakeTemporaryFromExpressions,
333 SanityCheckConstants,
335 PutModuleContainsBuiltin, IsBuiltinInModule,
342 IsConstructorConstant,
343 IsSumOfParamSizeSolved,
349 PushSumOfLocalVarSize,
360 Throughout this module any SymKey value of 0 is deemed to be a
369 Mode describes the modes of the variables and constants
373 ModeOfAddr = (NoValue, ImmediateValue, RightValue, LeftValue) ;
374 FamilyOperation = PROCEDURE (CARDINAL, CARDINAL, CARDINAL) ;
378 FinalSymbol - returns the highest number symbol used.
381 PROCEDURE FinalSymbol () : CARDINAL ;
385 MakeComponentRecord - make a temporary which will be used to reference and field
386 (or sub field) of record.
389 PROCEDURE MakeComponentRecord (tok: CARDINAL;
390 Mode: ModeOfAddr; record: CARDINAL) : CARDINAL ;
394 MakeComponentRef - use, sym, to reference, field, sym is returned.
397 PROCEDURE MakeComponentRef (sym: CARDINAL; field: CARDINAL) : CARDINAL ;
401 IsComponent - returns TRUE if symbol, sym, is a temporary and a component
405 PROCEDURE IsComponent (sym: CARDINAL) : BOOLEAN ;
409 MakeTemporary - makes a new temporary variable at the highest real scope.
410 The addressing mode of the temporary is set to Mode.
413 PROCEDURE MakeTemporary (tok: CARDINAL; Mode: ModeOfAddr) : CARDINAL ;
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.
423 PROCEDURE MakeTemporaryFromExpression (tok: CARDINAL;
425 mode: ModeOfAddr) : CARDINAL ;
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,
435 PROCEDURE MakeTemporaryFromExpressions (tok: CARDINAL;
437 mode: ModeOfAddr) : CARDINAL ;
441 PutMode - Puts the addressing mode, SymMode, into symbol Sym.
442 The mode may only be altered if the mode is None.
445 PROCEDURE PutMode (Sym: CARDINAL; SymMode: ModeOfAddr) ;
449 GetMode - Returns the addressing mode of a symbol.
452 PROCEDURE GetMode (Sym: CARDINAL) : ModeOfAddr ;
456 StartScope - starts a block scope at Sym.
459 PROCEDURE StartScope (Sym: CARDINAL) ;
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.
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.
486 PROCEDURE PseudoScope (Sym: CARDINAL) ;
490 GetCurrentScope - returns the symbol who is responsible for the current
491 scope. Note that it ignores pseudo scopes.
494 PROCEDURE GetCurrentScope () : CARDINAL ;
498 IsDeclaredIn - returns TRUE if a symbol was declared in, scope.
501 PROCEDURE IsDeclaredIn (scope, sym: CARDINAL) : BOOLEAN ;
505 SetCurrentModule - Used to set the CurrentModule to a symbol, Sym.
506 This Sym may represent an inner module.
509 PROCEDURE SetCurrentModule (Sym: CARDINAL) ;
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.
518 PROCEDURE SetFileModule (Sym: CARDINAL) ;
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.
527 PROCEDURE SetMainModule (Sym: CARDINAL) ;
531 CheckAnonymous - checks to see whether the name is NulName and if so
532 it creates a unique anonymous name.
535 PROCEDURE CheckAnonymous (name: Name) : Name ;
539 IsNameAnonymous - returns TRUE if the symbol, sym, has an anonymous name
543 PROCEDURE IsNameAnonymous (sym: CARDINAL) : BOOLEAN ;
547 NoOfVariables - returns the number of variables in scope. The scope maybe
548 a procedure, module or defimp scope.
551 PROCEDURE NoOfVariables (scope: CARDINAL) : CARDINAL ;
555 MakeModule - creates a module sym with ModuleName. It returns the
559 PROCEDURE MakeModule (tok: CARDINAL; ModuleName: Name) : CARDINAL ;
563 MakeDefImp - creates a definition and implementation module sym
564 with name DefImpName. It returns the symbol index.
567 PROCEDURE MakeDefImp (tok: CARDINAL; DefImpName: Name) : CARDINAL ;
571 MakeInnerModule - creates an inner module sym with ModuleName. It returns the
575 PROCEDURE MakeInnerModule (tok: CARDINAL; ModuleName: Name) : CARDINAL ;
579 MakeProcedure - creates a procedure sym with name. It returns
583 PROCEDURE MakeProcedure (tok: CARDINAL; ProcedureName: Name) : CARDINAL ;
587 MakeProcedureCtorExtern - creates an extern ctor procedure
590 PROCEDURE MakeProcedureCtorExtern (tokenno: CARDINAL; modulename: Name) : CARDINAL ;
594 PutMonoName - changes the IsMonoName boolean inside the procedure.
597 PROCEDURE PutMonoName (sym: CARDINAL; value: BOOLEAN) ;
601 IsMonoName - returns the public boolean associated with a procedure.
604 PROCEDURE IsMonoName (sym: CARDINAL) : BOOLEAN ;
608 PutExtern - changes the extern boolean inside the procedure.
611 PROCEDURE PutExtern (sym: CARDINAL; value: BOOLEAN) ;
615 IsExtern - returns the public boolean associated with a procedure.
618 PROCEDURE IsExtern (sym: CARDINAL) : BOOLEAN ;
622 PutPublic - changes the public boolean inside the procedure.
625 PROCEDURE PutPublic (sym: CARDINAL; value: BOOLEAN) ;
629 IsPublic - returns the public boolean associated with a procedure.
632 PROCEDURE IsPublic (sym: CARDINAL) : BOOLEAN ;
636 PutCtor - changes the ctor boolean inside the procedure.
639 PROCEDURE PutCtor (sym: CARDINAL; value: BOOLEAN) ;
643 IsCtor - returns the ctor boolean associated with a procedure.
646 PROCEDURE IsCtor (sym: CARDINAL) : BOOLEAN ;
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
655 PROCEDURE GetModuleCtors (mod: CARDINAL; VAR ctor, init, fini, dep: CARDINAL) ;
659 MakeModuleCtor - for a defimp or module symbol create all the ctor
663 PROCEDURE MakeModuleCtor (moduleTok, beginTok, finallyTok: CARDINAL;
664 moduleSym: CARDINAL) ;
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
674 PROCEDURE PutModuleCtorExtern (tok: CARDINAL; sym: CARDINAL; external: BOOLEAN) ;
678 MakeVar - creates a variable sym with VarName. It returns the
682 PROCEDURE MakeVar (tok: CARDINAL; VarName: Name) : CARDINAL ;
686 MakeRecord - makes a Record symbol with name RecordName.
689 PROCEDURE MakeRecord (tok: CARDINAL; RecordName: Name) : CARDINAL ;
693 MakeVarient - creates a new symbol, a varient symbol for record or varient field
694 symbol, RecOrVarFieldSym.
697 PROCEDURE MakeVarient (tok: CARDINAL; RecOrVarFieldSym: CARDINAL) : CARDINAL ;
701 MakeFieldVarient - returns a FieldVarient symbol which has been
702 assigned to the Varient symbol, Sym.
705 PROCEDURE MakeFieldVarient (n: Name; Sym: CARDINAL) : CARDINAL ;
709 MakeEnumeration - places a new symbol in the current scope, the symbol
710 is an enumeration symbol. The symbol index is returned.
713 PROCEDURE MakeEnumeration (tok: CARDINAL; EnumerationName: Name) : CARDINAL ;
717 MakeType - makes a type symbol with name TypeName.
720 PROCEDURE MakeType (tok: CARDINAL; TypeName: Name) : CARDINAL ;
724 MakeHiddenType - makes a type symbol that is hidden from the
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
732 PROCEDURE MakeHiddenType (tok: CARDINAL; TypeName: Name) : CARDINAL ;
736 MakeConstant - create a constant cardinal and return the symbol.
739 PROCEDURE MakeConstant (tok: CARDINAL; value: CARDINAL) : CARDINAL ;
743 MakeConstLit - returns a constant literal of type, constType, with a constName,
747 PROCEDURE MakeConstLit (tok: CARDINAL; constName: Name; constType: CARDINAL) : CARDINAL ;
751 MakeConstVar - makes a ConstVar type with
755 PROCEDURE MakeConstVar (tok: CARDINAL; ConstVarName: Name) : CARDINAL ;
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.
770 PROCEDURE MakeConstLitString (tok: CARDINAL; ConstName: Name) : CARDINAL ;
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.
779 PROCEDURE MakeConstString (tok: CARDINAL; ConstName: Name) : CARDINAL ;
783 MakeSubrange - makes a new symbol into a subrange type with
787 PROCEDURE MakeSubrange (tok: CARDINAL; SubrangeName: Name) : CARDINAL ;
791 MakeSet - makes a set Symbol with name, SetName.
794 PROCEDURE MakeSet (tok: CARDINAL; SetName: Name) : CARDINAL ;
798 MakeArray - makes an Array symbol with name ArrayName.
801 PROCEDURE MakeArray (tok: CARDINAL; ArrayName: Name) : CARDINAL ;
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.
810 PROCEDURE PutArrayLarge (array: CARDINAL) ;
814 IsArrayLarge - returns TRUE if we need to treat this as a large array.
817 PROCEDURE IsArrayLarge (array: CARDINAL) : BOOLEAN ;
821 PutPriority - places a interrupt, priority, value into module, module.
824 PROCEDURE PutPriority (module: CARDINAL; priority: CARDINAL) ;
828 GetPriority - returns the interrupt priority which was assigned to
832 PROCEDURE GetPriority (module: CARDINAL) : CARDINAL ;
836 PutNeedSavePriority - set a boolean flag indicating that this procedure
837 needs to save and restore interrupts.
840 PROCEDURE PutNeedSavePriority (sym: CARDINAL) ;
844 GetNeedSavePriority - returns the boolean flag indicating whether this procedure
845 needs to save and restore interrupts.
848 PROCEDURE GetNeedSavePriority (sym: CARDINAL) : BOOLEAN ;
852 PutVariableAtAddress - determines that a variable, sym, is declared at
856 PROCEDURE PutVariableAtAddress (sym: CARDINAL; address: CARDINAL) ;
860 GetVariableAtAddress - returns the address at which variable, sym, is declared.
863 PROCEDURE GetVariableAtAddress (sym: CARDINAL) : CARDINAL ;
867 IsVariableAtAddress - returns TRUE if a variable, sym, was declared at
871 PROCEDURE IsVariableAtAddress (sym: CARDINAL) : BOOLEAN ;
875 PutVariableSSA - assigns value to the SSA field within variable sym.
878 PROCEDURE PutVariableSSA (sym: CARDINAL; value: BOOLEAN) ;
882 IsVariableSSA - returns TRUE if variable is known to be a SSA.
885 PROCEDURE IsVariableSSA (sym: CARDINAL) : BOOLEAN ;
889 PutVarConst - sets the IsConst field to value indicating the variable is read only.
892 PROCEDURE PutVarConst (sym: CARDINAL; value: BOOLEAN) ;
896 MakeGnuAsm - create a GnuAsm symbol.
899 PROCEDURE MakeGnuAsm () : CARDINAL ;
903 PutGnuAsm - places the instruction textual name into the GnuAsm symbol.
906 PROCEDURE PutGnuAsm (sym: CARDINAL; string: CARDINAL) ;
910 PutGnuAsmOutput - places the interface object, out, into GnuAsm symbol, sym.
913 PROCEDURE PutGnuAsmOutput (sym: CARDINAL; out: CARDINAL) ;
917 PutGnuAsmInput - places the interface object, in, into GnuAsm symbol, sym.
920 PROCEDURE PutGnuAsmInput (sym: CARDINAL; in: CARDINAL) ;
924 PutGnuAsmTrash - places the interface object, trash, into GnuAsm symbol, sym.
927 PROCEDURE PutGnuAsmTrash (sym: CARDINAL; trash: CARDINAL) ;
931 GetGnuAsm - returns the string symbol, representing the instruction textual
932 of the GnuAsm symbol. It will return a ConstString.
935 PROCEDURE GetGnuAsm (sym: CARDINAL) : CARDINAL ;
939 GetGnuAsmInput - returns the input list of registers.
942 PROCEDURE GetGnuAsmInput (sym: CARDINAL) : CARDINAL ;
946 GetGnuAsmOutput - returns the output list of registers.
949 PROCEDURE GetGnuAsmOutput (sym: CARDINAL) : CARDINAL ;
953 GetGnuAsmTrash - returns the list of trashed registers.
956 PROCEDURE GetGnuAsmTrash (sym: CARDINAL) : CARDINAL ;
960 PutGnuAsmVolatile - defines a GnuAsm symbol as VOLATILE.
963 PROCEDURE PutGnuAsmVolatile (Sym: CARDINAL) ;
967 PutGnuAsmSimple - defines a GnuAsm symbol as a simple kind.
970 PROCEDURE PutGnuAsmSimple (Sym: CARDINAL) ;
974 MakeRegInterface - creates and returns a register interface symbol.
977 PROCEDURE MakeRegInterface () : CARDINAL ;
981 PutRegInterface - places a, name, string, and, object, into the interface array,
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.
987 PROCEDURE PutRegInterface (sym: CARDINAL; i: CARDINAL;
988 n: Name; string, object: CARDINAL) ;
992 GetRegInterface - gets a, name, string, and, object, from the interface array,
993 sym, from position, i.
996 PROCEDURE GetRegInterface (sym: CARDINAL; i: CARDINAL;
997 VAR n: Name; VAR string, object: CARDINAL) ;
1001 GetModule - Returns the Module symbol for the module with name, n.
1004 PROCEDURE GetModule (name: Name) : CARDINAL ;
1008 GetCurrentModule - returns the current module Sym that is being
1009 compiled. It may return an inner module.
1012 PROCEDURE GetCurrentModule () : CARDINAL ;
1016 GetFileModule - returns the FileModule symbol that was requested by
1017 the user to be compiled.
1020 PROCEDURE GetFileModule () : CARDINAL ;
1024 GetBaseModule - returns the base module symbol that contains Modula-2
1025 base types, procedures and functions.
1028 PROCEDURE GetBaseModule () : CARDINAL ;
1032 GetMainModule - returns the main module symbol that was requested by
1033 the user to be compiled.
1036 PROCEDURE GetMainModule () : CARDINAL ;
1040 GetCurrentModuleScope - returns the module symbol which forms the
1041 current (possibly inner most) module.
1044 PROCEDURE GetCurrentModuleScope () : CARDINAL ;
1048 GetLastModuleScope - returns the last module scope encountered,
1049 the module scope before the Current Module Scope.
1052 PROCEDURE GetLastModuleScope () : CARDINAL ;
1056 AddSymToModuleScope - adds a symbol, Sym, to the scope of the module
1060 PROCEDURE AddSymToModuleScope (ModSym: CARDINAL; Sym: CARDINAL) ;
1064 GetType - Returns the symbol that is the TYPE symbol to Sym.
1065 If NulSym is returned then we assume type unknown.
1068 PROCEDURE GetType (Sym: CARDINAL) : CARDINAL ;
1072 SkipType - if sym is a TYPE foo = bar
1073 then call SkipType(bar)
1076 it does not skip over hidden types.
1079 PROCEDURE SkipType (Sym: CARDINAL) : CARDINAL ;
1083 SkipTypeAndSubrange - if sym is a TYPE foo = bar OR
1084 sym is declared as a subrange of bar
1085 then call SkipTypeAndSubrange(bar)
1088 it does not skip over hidden types.
1091 PROCEDURE SkipTypeAndSubrange (Sym: CARDINAL) : CARDINAL ;
1095 GetLowestType - Returns the lowest type in the type chain of
1097 If NulSym is returned then we assume type unknown.
1100 PROCEDURE GetLowestType (Sym: CARDINAL) : CARDINAL ;
1104 GetLType - get lowest type. It returns the lowest type
1105 of symbol, sym. It skips over type equivalences.
1108 PROCEDURE GetLType (sym: CARDINAL) : CARDINAL ;
1112 GetSType - get source type. It returns the type closest
1113 to the object. It does not skip over type
1117 PROCEDURE GetSType (sym: CARDINAL) : CARDINAL ;
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.
1127 This is the same as SkipType(GetType(sym))
1130 PROCEDURE GetDType (sym: CARDINAL) : CARDINAL ;
1134 GetSym - searches the current scope (and previous scopes if the
1135 scope tranparent allows) for a symbol with Name.
1138 PROCEDURE GetSym (name: Name) : CARDINAL ;
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
1152 PROCEDURE GetDeclareSym (tok: CARDINAL; SymName: Name) : CARDINAL ;
1156 GetLocalSym - only searches the scope Sym for a symbol with Name
1157 and returns the index to the symbol.
1160 PROCEDURE GetLocalSym (Sym: CARDINAL; name: Name) : CARDINAL ;
1164 GetRecord - fetches the record symbol from the parent of Sym.
1165 Sym maybe a varient symbol in which case its parent is searched
1169 PROCEDURE GetRecord (Sym: CARDINAL) : CARDINAL ;
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.
1178 PROCEDURE FromModuleGetSym (tok: CARDINAL;
1179 n: Name; mod: CARDINAL) : CARDINAL ;
1183 GetNth - returns the n th symbol in the list of father Sym.
1184 Sym may be a Module, DefImp, Procedure or Record symbol.
1187 PROCEDURE GetNth (Sym: CARDINAL; n: CARDINAL) : CARDINAL ;
1191 GetNthParam - returns the n th parameter in procedure Sym.
1192 Sym may be an ordinary procedure or a
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
1200 PROCEDURE GetNthParam (Sym: CARDINAL; ParamNo: CARDINAL) : CARDINAL ;
1204 GetVarScope - returns the symbol definining the scope where, Sym, was declared.
1205 ie a Module, DefImp or Procedure Symbol.
1208 PROCEDURE GetVarScope (Sym: CARDINAL) : CARDINAL ;
1212 GetSubrange - returns HighSym and LowSym - two constants
1213 which make up the subrange.
1216 PROCEDURE GetSubrange (Sym: CARDINAL; VAR HighSym, LowSym: CARDINAL) ;
1220 GetParam - returns the ParamNo parameter from procedure ProcSym
1223 PROCEDURE GetParam (Sym: CARDINAL; ParamNo: CARDINAL) : CARDINAL ;
1227 GetString - returns the actual string key for ConstString symbol Sym,
1228 which is not necessarily the same as its name.
1230 hello = 'HELLO' ; Name = hello, string = HELLO
1231 GetString returns HELLO
1233 and simply 'Hello World' Name will be same
1234 GetString returns Hello World
1237 PROCEDURE GetString (Sym: CARDINAL) : Name ;
1241 GetStringLength - returns the actual string length for ConstString
1245 PROCEDURE GetStringLength (Sym: CARDINAL) : CARDINAL ;
1249 GetProcedureBuiltin - returns the builtin name for the equivalent procedure, Sym.
1252 PROCEDURE GetProcedureBuiltin (Sym: CARDINAL) : Name ;
1256 PutProcedureBuiltin - assigns the builtin name for the equivalent procedure, Sym.
1259 PROCEDURE PutProcedureBuiltin (Sym: CARDINAL; name: Name) ;
1263 IsProcedureBuiltin - returns TRUE if this procedure has a builtin equivalent.
1266 PROCEDURE IsProcedureBuiltin (Sym: CARDINAL) : BOOLEAN ;
1270 PutProcedureInline - determines that procedure, Sym, has been requested to be inlined.
1273 PROCEDURE PutProcedureInline (Sym: CARDINAL) ;
1277 IsProcedureBuiltin - returns TRUE if this procedure was declared as inlined.
1280 PROCEDURE IsProcedureInline (Sym: CARDINAL) : BOOLEAN ;
1284 PutExceptionBlock - sets a BOOLEAN in block module/procedure/defimp,
1285 sym, indicating that this block as an EXCEPT
1289 PROCEDURE PutExceptionBlock (sym: CARDINAL) ;
1293 HasExceptionBlock - returns a BOOLEAN determining whether
1294 module/procedure/defimp, sym, has
1295 an EXCEPT statement sequence.
1298 PROCEDURE HasExceptionBlock (sym: CARDINAL) : BOOLEAN ;
1302 PutExceptionFinally - sets a BOOLEAN in block module/defimp,
1303 sym, indicating that this FINALLY block
1304 as an EXCEPT statement sequence.
1307 PROCEDURE PutExceptionFinally (sym: CARDINAL) ;
1311 HasExceptionFinally - returns a BOOLEAN determining whether
1312 module/defimp, sym, has
1313 an EXCEPT statement sequence.
1316 PROCEDURE HasExceptionFinally (sym: CARDINAL) : BOOLEAN ;
1320 PutVar - gives the variable symbol Sym a type VarType.
1323 PROCEDURE PutVar (Sym: CARDINAL; VarType: CARDINAL) ;
1327 PutLeftValueFrontBackType - gives the variable symbol a front and backend type.
1328 The variable must be a LeftValue.
1331 PROCEDURE PutLeftValueFrontBackType (Sym: CARDINAL; FrontType, BackType: CARDINAL) ;
1335 GetVarBackEndType - returns the back end type if specified.
1338 PROCEDURE GetVarBackEndType (Sym: CARDINAL) : CARDINAL ;
1342 PutVarPointerCheck - marks variable, sym, as requiring (or not
1343 depending upon the, value), a NIL pointer check
1344 when this symbol is dereferenced.
1347 PROCEDURE PutVarPointerCheck (sym: CARDINAL; value: BOOLEAN) ;
1351 GetVarPointerCheck - returns TRUE if this symbol is a variable and
1352 has been marked as needing a pointer via NIL check.
1355 PROCEDURE GetVarPointerCheck (sym: CARDINAL) : BOOLEAN ;
1359 PutVarWritten - marks variable, sym, as being written to (or not
1360 depending upon the, value).
1363 PROCEDURE PutVarWritten (sym: CARDINAL; value: BOOLEAN) ;
1367 GetVarWritten - returns TRUE if this symbol is a variable and
1368 has been marked as being written.
1371 PROCEDURE GetVarWritten (sym: CARDINAL) : BOOLEAN ;
1375 PutConst - gives the constant symbol Sym a type ConstType.
1378 PROCEDURE PutConst (Sym: CARDINAL; ConstType: CARDINAL) ;
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.
1387 PROCEDURE PutConstString (tok: CARDINAL; sym: CARDINAL; contents: Name) ;
1391 GetConstStringM2 - returns the Modula-2 variant of a string
1392 (with no added nul terminator).
1395 PROCEDURE GetConstStringM2 (sym: CARDINAL) : CARDINAL ;
1399 GetConstStringC - returns the C variant of a string
1400 (with no added nul terminator).
1403 PROCEDURE GetConstStringC (sym: CARDINAL) : CARDINAL ;
1407 GetConstStringM2nul - returns the Modula-2 variant of a string
1408 (with added nul terminator).
1411 PROCEDURE GetConstStringM2nul (sym: CARDINAL) : CARDINAL ;
1415 GetConstStringCnul - returns the C variant of a string
1416 (with no added nul terminator).
1419 PROCEDURE GetConstStringCnul (sym: CARDINAL) : CARDINAL ;
1423 PutConstSet - informs the constant symbol, sym, that it is or will contain
1427 PROCEDURE PutConstSet (Sym: CARDINAL) ;
1431 IsConstSet - returns TRUE if the constant is declared as a set.
1434 PROCEDURE IsConstSet (Sym: CARDINAL) : BOOLEAN ;
1438 PutConstructor - informs the symbol sym that this will be
1439 a constructor constant.
1442 PROCEDURE PutConstructor (Sym: CARDINAL) ;
1446 PutConstructorFrom - sets the from type field in constructor
1450 PROCEDURE PutConstructorFrom (Sym: CARDINAL; from: CARDINAL) ;
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
1460 PROCEDURE PutFieldRecord (Sym: CARDINAL;
1461 FieldName: Name; FieldType: CARDINAL;
1462 VarSym: CARDINAL) : CARDINAL ;
1466 PutFieldVarient - places the field varient, Field, as a brother to, the
1467 varient symbol, sym.
1470 PROCEDURE PutFieldVarient (Field, Sym: CARDINAL) ;
1474 GetVarient - returns the varient symbol associated with the
1475 record or varient field symbol, Field.
1478 PROCEDURE GetVarient (Field: CARDINAL) : CARDINAL ;
1482 IsRecordFieldAVarientTag - returns TRUE if record field, sym, is
1486 PROCEDURE IsRecordFieldAVarientTag (sym: CARDINAL) : BOOLEAN ;
1490 IsEmptyFieldVarient - returns TRUE if the field variant has
1491 no fields. This will occur then the
1492 compiler constructs 'else end' variants.
1495 PROCEDURE IsEmptyFieldVarient (sym: CARDINAL) : BOOLEAN ;
1499 GetVarientTag - returns the varient tag from, Sym.
1502 PROCEDURE GetVarientTag (Sym: CARDINAL) : CARDINAL ;
1506 PutVarientTag - places, Tag, into varient, Sym.
1509 PROCEDURE PutVarientTag (Sym, Tag: CARDINAL) ;
1513 PutFieldEnumeration - places a field into the enumeration type
1514 Sym. The field has a name FieldName and a
1518 PROCEDURE PutFieldEnumeration (tok: CARDINAL; Sym: CARDINAL; FieldName: Name) ;
1522 PutSubrange - places LowSym and HighSym as two symbols
1523 which provide the limits of the range.
1526 PROCEDURE PutSubrange (Sym: CARDINAL; LowSym, HighSym: CARDINAL;
1527 TypeSymbol: CARDINAL) ;
1531 PutSet - places SimpleType as the type for set, Sym.
1534 PROCEDURE PutSet (Sym: CARDINAL; SimpleType: CARDINAL; packed: BOOLEAN) ;
1538 IsSetPacked - returns TRUE if Sym is packed.
1541 PROCEDURE IsSetPacked (Sym: CARDINAL) : BOOLEAN ;
1545 GetArraySubscript - returns the subrange symbol for array, Sym.
1548 PROCEDURE GetArraySubscript (Sym: CARDINAL) : CARDINAL ;
1552 PutArraySubscript - places an index field into the array Sym. The
1553 index field is a subscript sym.
1556 PROCEDURE PutArraySubscript (Sym: CARDINAL; SubscriptSymbol: CARDINAL) ;
1560 PutType - gives a type symbol Sym type TypeSymbol.
1563 PROCEDURE PutType (Sym: CARDINAL; TypeSymbol: CARDINAL) ;
1567 PutFunction - Places a TypeSym as the return type to a procedure Sym.
1570 PROCEDURE PutFunction (Sym: CARDINAL; TypeSym: CARDINAL) ;
1574 PutOptFunction - places a TypeSym as the optional return type to a procedure Sym.
1577 PROCEDURE PutOptFunction (Sym: CARDINAL; TypeSym: CARDINAL) ;
1581 IsReturnOptional - returns TRUE if the return value for, sym, is
1585 PROCEDURE IsReturnOptional (sym: CARDINAL) : BOOLEAN ;
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.
1596 PROCEDURE PutParam (tok: CARDINAL; Sym: CARDINAL; ParamNo: CARDINAL;
1597 ParamName: Name; ParamType: CARDINAL;
1598 isUnbounded: BOOLEAN) : BOOLEAN ;
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.
1610 PROCEDURE PutVarParam (tok: CARDINAL; Sym: CARDINAL; ParamNo: CARDINAL;
1611 ParamName: Name; ParamType: CARDINAL;
1612 isUnbounded: BOOLEAN) : BOOLEAN ;
1616 PutParamName - assigns a name, name, to paramater, no, of procedure,
1620 PROCEDURE PutParamName (tok: CARDINAL; ProcSym: CARDINAL; no: CARDINAL; name: Name) ;
1624 PutProcedureReachable - Sets the procedure, Sym, to be reachable by the
1628 PROCEDURE PutProcedureReachable (Sym: CARDINAL) ;
1632 IsProcedureReachable - Returns true if the procedure, Sym, is
1633 reachable from the main Module.
1636 PROCEDURE IsProcedureReachable (Sym: CARDINAL) : BOOLEAN ;
1640 PutModuleStartQuad - Places QuadNumber into the Module symbol, Sym.
1641 QuadNumber is the start quad of Module,
1645 PROCEDURE PutModuleStartQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1649 PutModuleEndQuad - Places QuadNumber into the Module symbol, Sym.
1650 QuadNumber is the end quad of Module,
1654 PROCEDURE PutModuleEndQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1658 PutModuleFinallyStartQuad - Places QuadNumber into the Module symbol, Sym.
1659 QuadNumber is the finally start quad of
1663 PROCEDURE PutModuleFinallyStartQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1667 PutModuleFinallyEndQuad - Places QuadNumber into the Module symbol, Sym.
1668 QuadNumber is the end quad of the finally block
1672 PROCEDURE PutModuleFinallyEndQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1676 GetModuleQuads - Returns, StartInit EndInit StartFinish EndFinish,
1677 Quads of a Module, Sym.
1678 Start and End represent the initialization code
1682 PROCEDURE GetModuleQuads (Sym: CARDINAL;
1683 VAR StartInit, EndInit,
1684 StartFinish, EndFinish: CARDINAL) ;
1687 PutModuleFinallyFunction - Places Tree, finally, into the Module symbol, Sym.
1690 PROCEDURE PutModuleFinallyFunction (Sym: CARDINAL; finally: Tree) ;
1694 GetModuleFinallyFunction - returns the finally tree from the Module symbol, Sym.
1697 PROCEDURE GetModuleFinallyFunction (Sym: CARDINAL) : Tree ;
1701 PutProcedureScopeQuad - Places QuadNumber into the Procedure symbol, Sym.
1702 QuadNumber is the start quad of procedure,
1706 PROCEDURE PutProcedureScopeQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1710 PutProcedureStartQuad - Places QuadNumber into the Procedure symbol, Sym.
1711 QuadNumber is the start quad of procedure,
1715 PROCEDURE PutProcedureStartQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1719 PutProcedureEndQuad - Places QuadNumber into the Procedure symbol, Sym.
1720 QuadNumber is the end quad of procedure,
1724 PROCEDURE PutProcedureEndQuad (Sym: CARDINAL; QuadNumber: CARDINAL) ;
1728 GetProcedureQuads - Returns, Start and End, Quads of a procedure, Sym.
1731 PROCEDURE GetProcedureQuads (Sym: CARDINAL; VAR scope, start, end: CARDINAL) ;
1735 GetQuads - assigns Start and End to the beginning and end of
1739 PROCEDURE GetQuads (Sym: CARDINAL; m: ModeOfAddr;
1740 VAR Start, End: CARDINAL) ;
1744 GetReadQuads - assigns Start and End to the beginning and end of
1748 PROCEDURE GetReadQuads (Sym: CARDINAL; m: ModeOfAddr;
1749 VAR Start, End: CARDINAL) ;
1753 GetWriteQuads - assigns Start and End to the beginning and end of
1757 PROCEDURE GetWriteQuads (Sym: CARDINAL; m: ModeOfAddr;
1758 VAR Start, End: CARDINAL) ;
1762 PutReadQuad - places Quad into the list of symbol usage.
1765 PROCEDURE PutReadQuad (Sym: CARDINAL; m: ModeOfAddr; Quad: CARDINAL) ;
1769 RemoveReadQuad - places Quad into the list of symbol usage.
1772 PROCEDURE RemoveReadQuad (Sym: CARDINAL; m: ModeOfAddr; Quad: CARDINAL) ;
1776 PutWriteQuad - places Quad into the list of symbol usage.
1779 PROCEDURE PutWriteQuad (Sym: CARDINAL; m: ModeOfAddr; Quad: CARDINAL) ;
1783 RemoveWriteQuad - places Quad into the list of symbol usage.
1786 PROCEDURE RemoveWriteQuad (Sym: CARDINAL; m: ModeOfAddr; Quad: CARDINAL) ;
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.
1795 PROCEDURE GetReadLimitQuads (Sym: CARDINAL; m: ModeOfAddr;
1796 StartLimit, EndLimit: CARDINAL;
1797 VAR Start, End: CARDINAL) ;
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.
1806 PROCEDURE GetWriteLimitQuads (Sym: CARDINAL; m: ModeOfAddr;
1807 StartLimit, EndLimit: CARDINAL;
1808 VAR Start, End: CARDINAL) ;
1812 GetNthProcedure - Returns the Nth procedure in Module, Sym.
1815 PROCEDURE GetNthProcedure (Sym: CARDINAL; n: CARDINAL) : CARDINAL ;
1819 GetDeclaredDef - returns the token where this symbol was declared
1820 with the priority of the definition, implementation,
1824 PROCEDURE GetDeclaredDef (Sym: CARDINAL) : CARDINAL ;
1828 GetDeclaredMod - returns the token where this symbol was declared.
1829 with the priority of the implementation, program
1833 PROCEDURE GetDeclaredMod (Sym: CARDINAL) : CARDINAL ;
1837 GetDeclaredDefinition - returns the token where this symbol
1838 was declared in the definition module.
1841 PROCEDURE GetDeclaredDefinition (Sym: CARDINAL) : CARDINAL ;
1845 GetDeclaredModule - returns the token where this symbol was declared
1846 in an implementation or program module.
1849 PROCEDURE GetDeclaredModule (Sym: CARDINAL) : CARDINAL ;
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.
1860 PROCEDURE PutDeclared (tok: CARDINAL; Sym: CARDINAL) ;
1864 GetFirstUsed - returns the token where this symbol was first used.
1867 PROCEDURE GetFirstUsed (Sym: CARDINAL) : CARDINAL ;
1871 PutProcedureBegin - assigns begin as the token number matching the
1875 PROCEDURE PutProcedureBegin (Sym: CARDINAL; begin: CARDINAL) ;
1879 PutProcedureEnd - assigns end as the token number matching the
1883 PROCEDURE PutProcedureEnd (Sym: CARDINAL; end: CARDINAL) ;
1887 GetProcedureBeginEnd - assigns, begin, end, to the stored token values.
1890 PROCEDURE GetProcedureBeginEnd (Sym: CARDINAL; VAR begin, end: CARDINAL) ;
1894 ForeachProcedureDo - for each procedure in module, Sym, do procedure, P.
1897 PROCEDURE ForeachProcedureDo (Sym: CARDINAL; P: PerformOperation) ;
1901 ForeachModuleDo - for each module do procedure, P.
1904 PROCEDURE ForeachModuleDo (P: PerformOperation) ;
1908 ForeachInnerModuleDo - for each inner module in module, Sym,
1912 PROCEDURE ForeachInnerModuleDo (Sym: CARDINAL; P: PerformOperation) ;
1916 IsVarParam - Returns a conditional depending whether parameter ParamNo
1917 is a VAR procedure parameter.
1920 PROCEDURE IsVarParam (Sym: CARDINAL; ParamNo: CARDINAL) : BOOLEAN ;
1924 IsUnboundedParam - Returns a conditional depending whether parameter
1925 ParamNo is an unbounded array procedure parameter.
1928 PROCEDURE IsUnboundedParam (Sym: CARDINAL; ParamNo: CARDINAL) : BOOLEAN ;
1932 IsParameterUnbounded - returns TRUE if parameter, Sym, is
1936 PROCEDURE IsParameterUnbounded (Sym: CARDINAL) : BOOLEAN ;
1940 IsParameterVar - returns true if parameter symbol Sym
1941 was declared as a VAR.
1944 PROCEDURE IsParameterVar (Sym: CARDINAL) : BOOLEAN ;
1948 GetParameterShadowVar - returns the local variable associated with the
1949 parameter symbol, sym.
1952 PROCEDURE GetParameterShadowVar (sym: CARDINAL) : CARDINAL ;
1956 NoOfParam - Returns the number of parameters that procedure Sym contains.
1959 PROCEDURE NoOfParam (Sym: CARDINAL) : CARDINAL ;
1963 HasVarParameters - returns TRUE if procedure, p, has any VAR parameters.
1966 PROCEDURE HasVarParameters (p: CARDINAL) : BOOLEAN ;
1970 NoOfLocalVar - returns the number of local variables that exist in
1971 procedure Sym. Parameters are NOT included in the
1975 PROCEDURE NoOfLocalVar (Sym: CARDINAL) : CARDINAL ;
1979 IsDefImp - returns true is the Sym is a DefImp symbol.
1980 Definition/Implementation module symbol.
1983 PROCEDURE IsDefImp (Sym: CARDINAL) : BOOLEAN ;
1987 IsModule - returns true if the Sym is a Module symbol.
1988 Program module symbol.
1989 Includes inner modules.
1992 PROCEDURE IsModule (Sym: CARDINAL) : BOOLEAN ;
1996 IsInnerModule - returns true if the symbol, Sym, is an inner module.
1999 PROCEDURE IsInnerModule (Sym: CARDINAL) : BOOLEAN ;
2003 GetSymName - returns the symbol name.
2006 PROCEDURE GetSymName (Sym: CARDINAL) : Name ;
2010 RenameSym - renames a symbol, Sym, with SymName.
2011 It also checks the unknown tree for a symbol
2015 PROCEDURE RenameSym (Sym: CARDINAL; SymName: Name) ;
2019 IsUnknown - returns true is the symbol Sym is unknown.
2022 PROCEDURE IsUnknown (Sym: WORD) : BOOLEAN ;
2026 IsPartialUnbounded - returns TRUE if, sym, is a partially unbounded symbol.
2029 PROCEDURE IsPartialUnbounded (sym: CARDINAL) : BOOLEAN ;
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
2038 This procedure does search the base scope (for
2039 pervasive identifiers).
2042 PROCEDURE RequestSym (tok: CARDINAL; SymName: Name) : CARDINAL ;
2046 PutImported - places a symbol, Sym, into the current main scope.
2049 PROCEDURE PutImported (Sym: CARDINAL) ;
2053 PutIncluded - places a symbol, Sym, into the included list of the
2055 Symbols that are placed in this list are indirectly declared
2060 modulename.identifier
2063 PROCEDURE PutIncluded (Sym: CARDINAL) ;
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
2072 PROCEDURE PutExported (Sym: CARDINAL) ;
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.
2085 PROCEDURE PutExportQualified (tokenno: CARDINAL; SymName: Name) ;
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.
2098 PROCEDURE PutExportUnQualified (tokenno: CARDINAL; SymName: Name) ;
2102 PutExportUnImplemented - places a symbol, Sym, into the currently compiled
2103 DefImp module NeedToBeImplemented list.
2106 PROCEDURE PutExportUnImplemented (tokenno: CARDINAL; Sym: CARDINAL) ;
2110 GetExported - returns the symbol which has a name SymName,
2111 and is exported from module ModSym.
2115 PROCEDURE GetExported (tokenno: CARDINAL;
2117 SymName: Name) : CARDINAL ;
2121 GetFromOuterModule - returns a symbol with name, SymName, which comes
2122 from outside the current module.
2125 PROCEDURE GetFromOuterModule (tokenno: CARDINAL; SymName: Name) : CARDINAL ;
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
2138 PROCEDURE TryMoveUndeclaredSymToInnerModule (OuterScope,
2139 InnerScope: CARDINAL;
2140 name: Name) : CARDINAL ;
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
2150 PROCEDURE IsExportQualified (Sym: CARDINAL) : BOOLEAN ;
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
2160 PROCEDURE IsExportUnQualified (Sym: CARDINAL) : BOOLEAN ;
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.
2170 PROCEDURE IsExported (ModSym: CARDINAL; Sym: CARDINAL) : BOOLEAN ;
2174 IsImplicityExported - returns TRUE if, Sym, is implicitly exported from module, ModSym.
2175 ModSym must be a defimp symbol.
2178 PROCEDURE IsImplicityExported (ModSym, Sym: CARDINAL) : BOOLEAN ;
2182 IsImported - returns true if a symbol, Sym, in module, ModSym,
2186 PROCEDURE IsImported (ModSym: CARDINAL; Sym: CARDINAL) : BOOLEAN ;
2190 PutIncludedByDefinition - places a module symbol, Sym, into the
2191 included list of the current definition module.
2194 PROCEDURE PutIncludedByDefinition (Sym: CARDINAL) ;
2198 IsIncludedByDefinition - returns TRUE if definition module symbol, Sym, was included
2199 by ModSym's definition module.
2202 PROCEDURE IsIncludedByDefinition (ModSym, Sym: CARDINAL) : BOOLEAN ;
2206 ForeachImportedDo - calls a procedure, P, foreach imported symbol
2210 PROCEDURE ForeachImportedDo (ModSym: CARDINAL; P: PerformOperation) ;
2214 ForeachExportedDo - calls a procedure, P, foreach exported symbol
2215 from module, ModSym.
2218 PROCEDURE ForeachExportedDo (ModSym: CARDINAL; P: PerformOperation) ;
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.
2235 PROCEDURE CheckForExportedImplementation (Sym: CARDINAL) ;
2239 CheckForUnImplementedExports - displays an error and the offending symbols
2240 which have been EXPORTed but not implemented
2241 from the current compiled module.
2244 PROCEDURE CheckForUnImplementedExports ;
2248 CheckForUndeclaredExports - displays an error and the offending symbols
2249 which have been EXPORTed but not declared
2250 from module, ModSym.
2253 PROCEDURE CheckForUndeclaredExports (ModSym: CARDINAL) ;
2257 CheckForUnknownInModule - checks for any unknown symbols in the
2259 If any unknown symbols are found then
2260 an error message is displayed.
2263 PROCEDURE CheckForUnknownInModule ;
2267 UnknownReported - if sym is an unknown symbol and has not been reported
2268 then include it into the set of reported unknowns.
2271 PROCEDURE UnknownReported (sym: CARDINAL) ;
2275 IsReallyPointer - returns TRUE is sym is a pointer, address or a
2276 type declared as a pointer or address.
2279 PROCEDURE IsReallyPointer (Sym: CARDINAL) : BOOLEAN ;
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.
2288 PROCEDURE CheckHiddenTypeAreAddress ;
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.
2298 PROCEDURE PutDefinitionForC (Sym: CARDINAL) ;
2302 IsDefinitionForC - returns true if this definition module was declared
2303 as a DEFINITION MODULE FOR "C".
2306 PROCEDURE IsDefinitionForC (Sym: CARDINAL) : BOOLEAN ;
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
2315 PROCEDURE PutDoesNeedExportList (Sym: CARDINAL) ;
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
2324 PROCEDURE PutDoesNotNeedExportList (Sym: CARDINAL) ;
2328 DoesNotNeedExportList - returns TRUE if module, Sym, does not require an explicit
2329 EXPORT QUALIFIED list.
2332 PROCEDURE DoesNotNeedExportList (Sym: CARDINAL) : BOOLEAN ;
2336 CheckForEnumerationInCurrentModule - checks to see whether the enumeration
2337 type symbol, Sym, has been entered into
2338 the current modules scope list.
2341 PROCEDURE CheckForEnumerationInCurrentModule (Sym: CARDINAL) ;
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.
2350 PROCEDURE SanityCheckConstants ;
2354 ForeachLocalSymDo - foreach local symbol in module, Sym, or procedure, Sym,
2355 perform the procedure, P.
2358 PROCEDURE ForeachLocalSymDo (Sym: CARDINAL; P: PerformOperation) ;
2362 ForeachFieldEnumerationDo - for each field in enumeration, Sym,
2366 PROCEDURE ForeachFieldEnumerationDo (Sym: CARDINAL; P: PerformOperation) ;
2370 IsType - returns true if the Sym is a type symbol.
2373 PROCEDURE IsType (Sym: CARDINAL) : BOOLEAN ;
2377 IsProcedure - returns true is Sym is a PROCEDURE symbol.
2380 PROCEDURE IsProcedure (Sym: CARDINAL) : BOOLEAN ;
2384 IsParameter - returns true if Sym is a parameter symbol.
2387 PROCEDURE IsParameter (Sym: CARDINAL) : BOOLEAN ;
2391 ProcedureParametersDefined - dictates to procedure symbol, Sym,
2392 that its parameters have been defined.
2395 PROCEDURE ProcedureParametersDefined (Sym: CARDINAL) ;
2399 AreProcedureParametersDefined - returns true if the parameters to procedure
2400 symbol, Sym, have been defined.
2403 PROCEDURE AreProcedureParametersDefined (Sym: CARDINAL) : BOOLEAN ;
2407 ParametersDefinedInDefinition - dictates to procedure symbol, Sym,
2408 that its parameters have been defined in
2409 a definition module.
2412 PROCEDURE ParametersDefinedInDefinition (Sym: CARDINAL) ;
2416 AreParametersDefinedInDefinition - returns true if procedure symbol, Sym,
2417 has had its parameters been defined in
2418 a definition module.
2421 PROCEDURE AreParametersDefinedInDefinition (Sym: CARDINAL) : BOOLEAN ;
2425 ParametersDefinedInImplementation - dictates to procedure symbol, Sym,
2426 that its parameters have been defined in
2427 a implementation module.
2430 PROCEDURE ParametersDefinedInImplementation (Sym: CARDINAL) ;
2434 AreParametersDefinedInImplementation - returns true if procedure symbol, Sym,
2435 has had its parameters been defined in
2436 an implementation module.
2439 PROCEDURE AreParametersDefinedInImplementation (Sym: CARDINAL) : BOOLEAN ;
2443 PutUseVarArgs - tell the symbol table that this procedure, Sym, uses varargs.
2444 The procedure _must_ be declared inside a
2449 PROCEDURE PutUseVarArgs (Sym: CARDINAL) ;
2453 UsesVarArgs - returns TRUE if procedure, Sym, uses varargs.
2454 The procedure _must_ be declared inside a
2458 PROCEDURE UsesVarArgs (Sym: CARDINAL) : BOOLEAN ;
2462 PutUseOptArg - tell the symbol table that this procedure, Sym,
2466 PROCEDURE PutUseOptArg (Sym: CARDINAL) ;
2470 UsesOptArg - returns TRUE if procedure, Sym, uses varargs.
2473 PROCEDURE UsesOptArg (Sym: CARDINAL) : BOOLEAN ;
2477 PutOptArgInit - makes symbol, Sym, the initializer value to
2481 PROCEDURE PutOptArgInit (ProcSym, Sym: CARDINAL) ;
2485 GetOptArgInit - returns the initializer value to the optional parameter in
2489 PROCEDURE GetOptArgInit (ProcSym: CARDINAL) : CARDINAL ;
2493 MakePointer - returns a pointer symbol with PointerName.
2496 PROCEDURE MakePointer (tok: CARDINAL; PointerName: Name) : CARDINAL ;
2500 PutPointer - gives a pointer symbol a type, PointerType.
2503 PROCEDURE PutPointer (Sym: CARDINAL; PointerType: CARDINAL) ;
2507 IsPointer - returns true is Sym is a pointer type symbol.
2510 PROCEDURE IsPointer (Sym: CARDINAL) : BOOLEAN ;
2514 IsRecord - returns true is Sym is a record type symbol.
2517 PROCEDURE IsRecord (Sym: CARDINAL) : BOOLEAN ;
2521 IsVarient - returns true if the symbol, Sym, is a
2525 PROCEDURE IsVarient (Sym: CARDINAL) : BOOLEAN ;
2529 IsFieldVarient - returns true if the symbol, Sym, is a
2533 PROCEDURE IsFieldVarient (Sym: CARDINAL) : BOOLEAN ;
2537 IsFieldEnumeration - returns true if the symbol, Sym, is an
2541 PROCEDURE IsFieldEnumeration (Sym: CARDINAL) : BOOLEAN ;
2545 IsArray - returns true is Sym is an array type symbol.
2548 PROCEDURE IsArray (Sym: CARDINAL) : BOOLEAN ;
2552 IsEnumeration - returns true if Sym is an enumeration symbol.
2555 PROCEDURE IsEnumeration (Sym: CARDINAL) : BOOLEAN ;
2559 IsSet - returns TRUE if Sym is a set symbol.
2562 PROCEDURE IsSet (Sym: CARDINAL) : BOOLEAN ;
2566 IsHiddenType - returns TRUE if, Sym, is a Type and is also declared as a hidden type.
2569 PROCEDURE IsHiddenType (Sym: CARDINAL) : BOOLEAN ;
2573 IsOAFamily - returns TRUE if, Sym, is an OAFamily symbol.
2576 PROCEDURE IsOAFamily (Sym: CARDINAL) : BOOLEAN ;
2580 GetDimension - return the number of dimensions associated with
2581 this unbounded ARRAY parameter.
2584 PROCEDURE GetDimension (sym: CARDINAL) : CARDINAL ;
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
2594 PROCEDURE MakeOAFamily (SimpleType: CARDINAL) : CARDINAL ;
2598 GetOAFamily - returns the oafamily symbol associated with
2602 PROCEDURE GetOAFamily (SimpleType: CARDINAL) : CARDINAL ;
2606 ForeachOAFamily - call, p[oaf, ndim, symbol] for every unbounded symbol,
2610 PROCEDURE ForeachOAFamily (sym: CARDINAL; p: FamilyOperation) ;
2614 IsUnbounded - returns true if Sym is an unbounded symbol.
2617 PROCEDURE IsUnbounded (Sym: CARDINAL) : BOOLEAN ;
2621 GetUnbounded - returns the unbounded symbol associated with
2625 PROCEDURE GetUnbounded (oaf: CARDINAL; ndim: CARDINAL) : CARDINAL ;
2629 GetUnboundedRecordType - returns the record type used to
2630 implement the unbounded array.
2633 PROCEDURE GetUnboundedRecordType (Sym: CARDINAL) : CARDINAL ;
2637 GetUnboundedAddressOffset - returns the offset of the address field
2638 inside the record used to implement the
2642 PROCEDURE GetUnboundedAddressOffset (sym: CARDINAL) : CARDINAL ;
2646 GetUnboundedHighOffset - returns the offset of the high field
2647 inside the record used to implement the
2651 PROCEDURE GetUnboundedHighOffset (sym: CARDINAL; ndim: CARDINAL) : CARDINAL ;
2655 MakeSubscript - makes a subscript Symbol.
2656 No name is required.
2659 PROCEDURE MakeSubscript () : CARDINAL ;
2663 PutSubscript - gives a subscript symbol a type, SimpleType.
2666 PROCEDURE PutSubscript (Sym: CARDINAL; SimpleType: CARDINAL) ;
2670 MakeUnbounded - makes an unbounded array Symbol.
2671 ndim is the number of dimensions required.
2672 No name is required.
2675 PROCEDURE MakeUnbounded (tok: CARDINAL;
2676 SimpleType: CARDINAL; ndim: CARDINAL) : CARDINAL ;
2680 NoOfElements - Returns the number of elements in array Sym,
2681 or the number of elements in an enumeration Sym.
2684 PROCEDURE NoOfElements (Sym: CARDINAL) : CARDINAL ;
2688 PutArray - places a type symbol into an Array.
2691 PROCEDURE PutArray (Sym, TypeSymbol: CARDINAL) ;
2698 PROCEDURE ResolveImports ;
2702 ResolveConstructorTypes - to be called at the end of pass three. Its
2703 purpose is to fix up all constructors whose
2707 PROCEDURE ResolveConstructorTypes ;
2711 AddNameToScope - adds a Name, n, to the list of objects declared at the
2715 PROCEDURE AddNameToScope (n: Name) ;
2719 AddNameToImportList - adds a Name, n, to the import list of the current
2723 PROCEDURE AddNameToImportList (n: Name) ;
2727 GetScope - returns the declaration scope of the symbol.
2730 PROCEDURE GetScope (Sym: CARDINAL) : CARDINAL ;
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
2740 PROCEDURE GetModuleScope (sym: CARDINAL) : CARDINAL ;
2744 GetProcedureScope - returns the innermost procedure (if any)
2745 in which the symbol, sym, resides.
2746 A module inside the PROCEDURE is skipped
2750 PROCEDURE GetProcedureScope (sym: CARDINAL) : CARDINAL ;
2754 IsModuleWithinProcedure - returns TRUE if module, sym, is
2758 PROCEDURE IsModuleWithinProcedure (sym: CARDINAL) : BOOLEAN ;
2762 GetParent - returns the parent of symbol, Sym.
2765 PROCEDURE GetParent (Sym: CARDINAL) : CARDINAL ;
2769 IsRecordField - returns true if Sym is a record field.
2772 PROCEDURE IsRecordField (Sym: CARDINAL) : BOOLEAN ;
2776 MakeProcType - returns a procedure type symbol with ProcTypeName.
2779 PROCEDURE MakeProcType (tok: CARDINAL; ProcTypeName: Name) : CARDINAL ;
2783 PutProcTypeParam - Places a Non VAR parameter ParamName with type
2784 ParamType into ProcType Sym.
2787 PROCEDURE PutProcTypeParam (Sym: CARDINAL;
2788 ParamType: CARDINAL; isUnbounded: BOOLEAN) ;
2792 PutProcTypeVarParam - Places a Non VAR parameter ParamName with type
2793 ParamType into ProcType Sym.
2796 PROCEDURE PutProcTypeVarParam (Sym: CARDINAL;
2797 ParamType: CARDINAL; isUnbounded: BOOLEAN) ;
2801 IsProcType - returns true if Sym is a ProcType Symbol.
2804 PROCEDURE IsProcType (Sym: CARDINAL) : BOOLEAN ;
2808 IsVar - returns true if Sym is a Var Symbol.
2811 PROCEDURE IsVar (Sym: CARDINAL) : BOOLEAN ;
2815 IsVarConst - returns the IsConst field indicating the variable is read only.
2818 PROCEDURE IsVarConst (sym: CARDINAL) : BOOLEAN ;
2822 IsConst - returns true is Sym is a Const Symbol.
2825 PROCEDURE IsConst (Sym: CARDINAL) : BOOLEAN ;
2829 IsConstString - returns true if Sym is a string.
2832 PROCEDURE IsConstString (sym: CARDINAL) : BOOLEAN ;
2836 IsConstStringM2 - returns whether this conststring is an unaltered Modula-2 string.
2839 PROCEDURE IsConstStringM2 (sym: CARDINAL) : BOOLEAN ;
2843 IsConstStringC - returns whether this conststring is a C style string
2844 which will have any escape translated.
2847 PROCEDURE IsConstStringC (sym: CARDINAL) : BOOLEAN ;
2851 IsConstStringM2nul - returns whether this conststring is a Modula-2 string which
2852 contains a nul terminator.
2855 PROCEDURE IsConstStringM2nul (sym: CARDINAL) : BOOLEAN ;
2859 IsConstStringCnul - returns whether this conststring is a C style string
2860 which will have any escape translated and also contains
2864 PROCEDURE IsConstStringCnul (sym: CARDINAL) : BOOLEAN ;
2868 IsConstStringNulTerminated - returns TRUE if the constant string, sym,
2869 should be created with a nul terminator.
2872 PROCEDURE IsConstStringNulTerminated (sym: CARDINAL) : BOOLEAN ;
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.
2881 PROCEDURE MakeConstStringCnul (tok: CARDINAL; sym: CARDINAL) : CARDINAL ;
2885 MakeConstStringM2nul - creates a constant string nul terminated string.
2886 sym is a ConstString and a new symbol is returned.
2889 PROCEDURE MakeConstStringM2nul (tok: CARDINAL; sym: CARDINAL) : CARDINAL ;
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.
2899 PROCEDURE MakeConstStringC (tok: CARDINAL; sym: CARDINAL) : CARDINAL ;
2903 IsConstLit - returns true if Sym is a literal constant.
2906 PROCEDURE IsConstLit (Sym: CARDINAL) : BOOLEAN ;
2910 IsConstructor - returns TRUE if the constant is declared as a
2911 constant set, array or record.
2914 PROCEDURE IsConstructor (Sym: CARDINAL) : BOOLEAN ;
2918 IsDummy - returns true if Sym is a Dummy symbol.
2921 PROCEDURE IsDummy (Sym: CARDINAL) : BOOLEAN ;
2925 IsTemporary - returns true if Sym is a Temporary symbol.
2928 PROCEDURE IsTemporary (Sym: CARDINAL) : BOOLEAN ;
2932 IsVarAParam - returns true if Sym is a variable declared as a parameter.
2935 PROCEDURE IsVarAParam (Sym: CARDINAL) : BOOLEAN ;
2939 IsSubscript - returns true if Sym is a subscript symbol.
2942 PROCEDURE IsSubscript (Sym: CARDINAL) : BOOLEAN ;
2946 IsSubrange - returns true if Sym is a subrange symbol.
2949 PROCEDURE IsSubrange (Sym: CARDINAL) : BOOLEAN ;
2953 IsProcedureVariable - returns true if a Sym is a variable and
2954 it was declared within a procedure.
2957 PROCEDURE IsProcedureVariable (Sym: CARDINAL) : BOOLEAN ;
2961 IsProcedureNested - returns TRUE if procedure, Sym, was
2962 declared as a nested procedure.
2965 PROCEDURE IsProcedureNested (Sym: CARDINAL) : BOOLEAN ;
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.
2975 a = CARDINAL ; (* IsType(a)=TRUE *)
2978 PROCEDURE IsAModula2Type (Sym: CARDINAL) : BOOLEAN ;
2982 IsGnuAsmVolatile - returns TRUE if a GnuAsm symbol was defined as VOLATILE.
2985 PROCEDURE IsGnuAsmVolatile (Sym: CARDINAL) : BOOLEAN ;
2989 IsGnuAsmSimple - returns TRUE if a GnuAsm symbol is a simple statement of the
2990 form ASM("instruction"), which differs from ASM("instruction" :)
2994 PROCEDURE IsGnuAsmSimple (Sym: CARDINAL) : BOOLEAN ;
2998 IsGnuAsm - returns TRUE if Sym is a GnuAsm symbol.
3001 PROCEDURE IsGnuAsm (Sym: CARDINAL) : BOOLEAN ;
3005 IsRegInterface - returns TRUE if Sym is a RegInterface symbol.
3008 PROCEDURE IsRegInterface (Sym: CARDINAL) : BOOLEAN ;
3012 IsSizeSolved - returns true if the size of Sym is solved.
3015 PROCEDURE IsSizeSolved (Sym: CARDINAL) : BOOLEAN ;
3019 IsOffsetSolved - returns true if the Offset of Sym is solved.
3022 PROCEDURE IsOffsetSolved (Sym: CARDINAL) : BOOLEAN ;
3026 IsValueSolved - returns true if the value of Sym is solved.
3029 PROCEDURE IsValueSolved (Sym: CARDINAL) : BOOLEAN ;
3033 IsConstructorConstant - returns TRUE if constructor, Sym, is
3034 defined by only constants.
3037 PROCEDURE IsConstructorConstant (Sym: CARDINAL) : BOOLEAN ;
3041 IsComposite - returns TRUE if symbol, sym, is a composite
3042 type: ie an ARRAY or RECORD.
3045 PROCEDURE IsComposite (sym: CARDINAL) : BOOLEAN ;
3049 IsSumOfParamSizeSolved - has the sum of parameters been solved yet?
3052 PROCEDURE IsSumOfParamSizeSolved (Sym: CARDINAL) : BOOLEAN ;
3056 PutAlignment - assigns the alignment constant associated with,
3060 PROCEDURE PutAlignment (type: CARDINAL; align: CARDINAL) ;
3064 GetAlignment - returns the alignment constant associated with,
3068 PROCEDURE GetAlignment (type: CARDINAL) : CARDINAL ;
3072 GetDefaultRecordFieldAlignment - assigns, align, as the default alignment
3076 PROCEDURE GetDefaultRecordFieldAlignment (sym: CARDINAL) : CARDINAL ;
3080 PutDefaultRecordFieldAlignment - assigns, align, as the default alignment
3084 PROCEDURE PutDefaultRecordFieldAlignment (sym: CARDINAL; align: CARDINAL) ;
3088 PutUnused - sets, sym, as unused. This is a gm2 pragma.
3091 PROCEDURE PutUnused (sym: CARDINAL) ;
3095 IsUnused - returns TRUE if the symbol was declared as unused with a
3099 PROCEDURE IsUnused (sym: CARDINAL) : BOOLEAN ;
3103 PutDeclaredPacked - sets the Packed field of the record or record field symbol.
3106 PROCEDURE PutDeclaredPacked (sym: CARDINAL; b: BOOLEAN) ;
3110 IsDeclaredPacked - was the record symbol or record field, sym,
3114 PROCEDURE IsDeclaredPacked (sym: CARDINAL) : BOOLEAN ;
3118 IsDeclaredPackedResolved - do we know if the record symbol or record
3119 field, sym, declared as packed or not packed?
3122 PROCEDURE IsDeclaredPackedResolved (sym: CARDINAL) : BOOLEAN ;
3126 GetPackedEquivalent - returns the packed equivalent of type, sym.
3127 sym must be a type, subrange, set or enumerated type.
3130 PROCEDURE GetPackedEquivalent (sym: CARDINAL) : CARDINAL ;
3134 GetNonPackedEquivalent - returns the equivalent non packed symbol
3135 associated with, sym.
3138 PROCEDURE GetNonPackedEquivalent (sym: CARDINAL) : CARDINAL ;
3142 IsEquivalent - returns TRUE if, sym, is an equivalent symbol.
3145 PROCEDURE IsEquivalent (sym: CARDINAL) : BOOLEAN ;
3149 PushSize - pushes the size of Sym.
3152 PROCEDURE PushSize (Sym: CARDINAL) ;
3156 PushOffset - pushes the Offset of Sym.
3159 PROCEDURE PushOffset (Sym: CARDINAL) ;
3163 PushValue - pushes the Value of Sym onto the ALU stack.
3166 PROCEDURE PushValue (Sym: CARDINAL) ;
3170 PushParamSize - push the size of parameter, ParamNo,
3171 of procedure Sym onto the ALU stack.
3174 PROCEDURE PushParamSize (Sym: CARDINAL; ParamNo: CARDINAL) ;
3178 PushSumOfLocalVarSize - push the total size of all local variables
3182 PROCEDURE PushSumOfLocalVarSize (Sym: CARDINAL) ;
3186 PushSumOfParamSize - push the total size of all parameters onto
3190 PROCEDURE PushSumOfParamSize (Sym: CARDINAL) ;
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
3199 However this procedure uses the Type of Sym therefore
3200 this Type must be solved before this procedure is called.
3203 PROCEDURE PushVarSize (Sym: CARDINAL) ;
3207 PopValue - pops the ALU stack into Value of Sym.
3210 PROCEDURE PopValue (Sym: CARDINAL) ;
3214 PopSize - pops the ALU stack into Size of Sym.
3217 PROCEDURE PopSize (Sym: CARDINAL) ;
3221 PopOffset - pops the ALU stack into Offset of Sym.
3224 PROCEDURE PopOffset (Sym: CARDINAL) ;
3228 PopSumOfParamSize - pop the total value on the ALU stack as the
3229 sum of all parameters.
3232 PROCEDURE PopSumOfParamSize (Sym: CARDINAL) ;
3236 IsObject - returns TRUE if the symbol is an object symbol.
3239 PROCEDURE IsObject (Sym: CARDINAL) : BOOLEAN ;
3243 IsTuple - returns TRUE if the symbol is a tuple symbol.
3246 PROCEDURE IsTuple (Sym: CARDINAL) : BOOLEAN ;
3250 Make2Tuple - creates and returns a 2 tuple from, a, and, b.
3253 PROCEDURE Make2Tuple (a, b: CARDINAL) : CARDINAL ;
3257 MakeError - creates an error node, which can be used in MetaError messages.
3258 It will be removed from ExportUndeclared and Unknown trees.
3261 PROCEDURE MakeError (tok: CARDINAL; name: Name) : CARDINAL ;
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.
3270 PROCEDURE MakeErrorS (tok: CARDINAL; name: String) : CARDINAL ;
3274 IsError - returns TRUE if the symbol is an error symbol.
3277 PROCEDURE IsError (Sym: CARDINAL) : BOOLEAN ;
3281 IsLegal - returns TRUE if, sym, is a legal symbol.
3284 PROCEDURE IsLegal (sym: CARDINAL) : BOOLEAN ;
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.
3294 PROCEDURE PutModuleContainsBuiltin ;
3298 IsBuiltinInModule - returns true if a module, Sym, has declared a builtin procedure.
3301 PROCEDURE IsBuiltinInModule (Sym: CARDINAL) : BOOLEAN ;
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.
3312 PROCEDURE PutHiddenTypeDeclared ;
3316 IsHiddenTypeDeclared - returns true if a Hidden Type was declared in
3320 PROCEDURE IsHiddenTypeDeclared (Sym: CARDINAL) : BOOLEAN ;
3324 DisplayTrees - displays the SymbolTrees for Module symbol, ModSym.
3327 PROCEDURE DisplayTrees (ModSym: CARDINAL) ;
3331 DebugLineNumbers - internal debugging, emit all procedure names in this module
3332 together with the line numbers for the corresponding begin/end
3336 PROCEDURE DebugLineNumbers (sym: CARDINAL) ;
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.
3345 PROCEDURE GetErrorScope (sym: CARDINAL) : ErrorScope ;
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.
3353 PROCEDURE PutErrorScope (sym: CARDINAL; errorScope: ErrorScope) ;
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.
3366 PROCEDURE MakeImport (tok: CARDINAL;
3367 moduleSym: CARDINAL;
3369 isqualified: BOOLEAN) : CARDINAL ;
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.
3379 PROCEDURE MakeImportStatement (tok: CARDINAL; listno: CARDINAL) : CARDINAL ;
3383 IsImport - returns TRUE if sym is an import symbol.
3386 PROCEDURE IsImport (sym: CARDINAL) : BOOLEAN ;
3390 IsImportStatement - returns TRUE if sym is a dependent symbol.
3393 PROCEDURE IsImportStatement (sym: CARDINAL) : BOOLEAN ;
3397 GetImportModule - returns the module associated with the import symbol.
3400 PROCEDURE GetImportModule (sym: CARDINAL) : CARDINAL ;
3404 GetImportDeclared - returns the token associated with the import symbol.
3407 PROCEDURE GetImportDeclared (sym: CARDINAL) : CARDINAL ;
3411 GetImportStatementList - returns the list of imports for this dependent.
3412 Each import symbol corresponds to a module.
3415 PROCEDURE GetImportStatementList (sym: CARDINAL) : List ;
3419 GetModuleDefImportStatementList - returns the list of dependents associated with
3420 the definition module.
3423 PROCEDURE GetModuleDefImportStatementList (sym: CARDINAL) : List ;
3427 GetModuleModImportStatementList - returns the list of dependents associated with
3428 the implementation or program module.
3431 PROCEDURE GetModuleModImportStatementList (sym: CARDINAL) : List ;
3435 AppendModuleImportStatement - appends the ImportStatement symbol onto the
3440 FROM x IMPORT y, z ;
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
3454 PROCEDURE AppendModuleImportStatement (module, statement: CARDINAL) ;
3458 AppendModuleOnImportStatement - appends the import symbol onto the
3459 dependent list (chain).
3463 FROM x IMPORT y, z ;
3465 x are added to the dependent list.
3471 will result in p, q and r added to
3472 to the dependent list.
3474 The import symbol is created by MakeImport
3475 and the token is expected to match the module
3476 name outlined above.
3479 PROCEDURE AppendModuleOnImportStatement (module, import: CARDINAL) ;
3483 PutModLink - assigns link to module sym.
3486 PROCEDURE PutModLink (sym: CARDINAL; link: BOOLEAN) ;
3490 IsModLink - returns the ModLink value associated with the module symbol.
3493 PROCEDURE IsModLink (sym: CARDINAL) : BOOLEAN ;
3497 PutDefLink - assigns link to the definition module sym.
3500 PROCEDURE PutDefLink (sym: CARDINAL; link: BOOLEAN) ;
3504 IsDefLink - returns the DefLink value associated with the definition module symbol.
3507 PROCEDURE IsDefLink (sym: CARDINAL) : BOOLEAN ;
3511 IsModuleBuiltin - returns TRUE if the module is a builtin module.
3512 (For example _BaseTypes).
3515 PROCEDURE IsModuleBuiltin (sym: CARDINAL) : BOOLEAN ;
3519 PutModuleBuiltin - sets the Builtin flag to value.
3522 PROCEDURE PutModuleBuiltin (sym: CARDINAL; value: BOOLEAN) ;