SavePriority : BOOLEAN ; (* Does procedure need to save *)
(* and restore interrupts? *)
ReturnType : CARDINAL ; (* Return type for function. *)
+ ProcedureType : CARDINAL ; (* Proc type for this procedure. *)
Offset : CARDINAL ; (* Location of procedure used *)
(* in Pass 2 and if procedure *)
(* is a syscall. *)
SavePriority := FALSE ; (* Does procedure need to save *)
(* and restore interrupts? *)
ReturnType := NulSym ; (* Not a function yet! *)
+ (* The ProcType equivalent. *)
+ ProcedureType := MakeProcType (tok, NulName) ;
Offset := 0 ; (* Location of procedure. *)
InitTree(LocalSymbols) ;
InitList(EnumerationScopeList) ;
:= InitValue() ; (* size of all parameters. *)
Begin := 0 ; (* token number for BEGIN *)
End := 0 ; (* token number for END *)
- InitWhereDeclaredTok(tok, At) ; (* Where symbol declared. *)
+ InitWhereDeclaredTok(tok, At) ; (* Where the symbol was declared. *)
errorScope := GetCurrentErrorScope () ; (* Title error scope. *)
END
END ;
CASE SymbolType OF
ErrorSym: |
- ProcedureSym: CheckOptFunction(Sym, FALSE) ; Procedure.ReturnType := TypeSym |
- ProcTypeSym : CheckOptFunction(Sym, FALSE) ; ProcType.ReturnType := TypeSym
+ ProcedureSym: CheckOptFunction(Sym, FALSE) ;
+ Procedure.ReturnType := TypeSym ;
+ PutFunction (Procedure.ProcedureType, TypeSym) |
+ ProcTypeSym : CheckOptFunction(Sym, FALSE) ;
+ ProcType.ReturnType := TypeSym
ELSE
InternalError ('expecting a Procedure or ProcType symbol')
VAR
pSym: PtrToSymbol ;
BEGIN
- pSym := GetPsym(Sym) ;
+ pSym := GetPsym (Sym) ;
WITH pSym^ DO
CASE SymbolType OF
ErrorSym: |
- ProcedureSym: CheckOptFunction(Sym, TRUE) ; Procedure.ReturnType := TypeSym |
- ProcTypeSym : CheckOptFunction(Sym, TRUE) ; ProcType.ReturnType := TypeSym
+ ProcedureSym: CheckOptFunction (Sym, TRUE) ;
+ Procedure.ReturnType := TypeSym ;
+ PutOptFunction (Procedure.ProcedureType, TypeSym) |
+ ProcTypeSym : CheckOptFunction (Sym, TRUE) ;
+ ProcType.ReturnType := TypeSym
ELSE
InternalError ('expecting a Procedure or ProcType symbol')
pSym := GetPsym(ParSym) ;
pSym^.Param.ShadowVar := VariableSym
END
- END
+ END ;
+ AddProcedureProcTypeParam (Sym, ParamType, isUnbounded, FALSE)
END ;
RETURN( TRUE )
END PutParam ;
pSym^.VarParam.ShadowVar := VariableSym
END
END ;
+ AddProcedureProcTypeParam (Sym, ParamType, isUnbounded, TRUE) ;
RETURN( TRUE )
END
END PutVarParam ;
END AddParameter ;
+(*
+ AddProcedureProcTypeParam - adds ParamType to the parameter ProcType
+ associated with procedure Sym.
+*)
+
+PROCEDURE AddProcedureProcTypeParam (Sym, ParamType: CARDINAL;
+ isUnbounded, isVarParam: BOOLEAN) ;
+VAR
+ pSym: PtrToSymbol ;
+BEGIN
+ pSym := GetPsym (Sym) ;
+ WITH pSym^ DO
+ CASE SymbolType OF
+
+ ProcedureSym: IF isVarParam
+ THEN
+ PutProcTypeVarParam (Procedure.ProcedureType,
+ ParamType, isUnbounded)
+ ELSE
+ PutProcTypeParam (Procedure.ProcedureType,
+ ParamType, isUnbounded)
+ END
+
+ ELSE
+ InternalError ('expecting Sym to be a procedure')
+ END
+ END
+END AddProcedureProcTypeParam ;
+
+
(*
IsVarParam - Returns a conditional depending whether parameter ParamNo
is a VAR parameter.
END PutProcTypeVarParam ;
+(*
+ GetProcedureProcType - returns the proctype matching procedure sym.
+*)
+
+PROCEDURE GetProcedureProcType (sym: CARDINAL) : CARDINAL ;
+VAR
+ pSym: PtrToSymbol ;
+BEGIN
+ pSym := GetPsym(sym) ;
+ WITH pSym^ DO
+ CASE SymbolType OF
+
+ ProcedureSym: RETURN Procedure.ProcedureType
+
+ ELSE
+ InternalError ('expecting Procedure symbol')
+ END
+ END
+END GetProcedureProcType ;
+
+
(*
PutProcedureReachable - Sets the procedure, Sym, to be reachable by the
main Module.