Added OnUseRegProc which is called once when a function added with Add(Delphi)Function is used by the script.

This commit is contained in:
Martijn Laan 2018-12-19 22:54:28 +01:00
parent e4f2e63a47
commit b624250b09

View File

@ -899,6 +899,8 @@ type
TPSOnUseVariable = procedure (Sender: TPSPascalCompiler; VarType: TPSVariableType; VarNo: Longint; ProcNo, Position: Cardinal; const PropData: tbtString);
TPSOnUseRegProc = procedure (Sender: TPSPascalCompiler; Position: Cardinal; const Name: tbtString);
TPSOnUses = function(Sender: TPSPascalCompiler; const Name: tbtString): Boolean;
TPSOnExportCheck = function(Sender: TPSPascalCompiler; Proc: TPSInternalProcedure; const ProcDecl: tbtString): Boolean;
@ -946,6 +948,7 @@ type
FDebugOutput: tbtString;
FOnExternalProc: TPSOnExternalProc;
FOnUseVariable: TPSOnUseVariable;
FOnUseRegProc: TPSOnUseRegProc;
FOnBeforeOutput: TPSOnNotify;
FOnBeforeCleanup: TPSOnNotify;
FOnWriteLine: TPSOnWriteLineEvent;
@ -1180,6 +1183,8 @@ type
property OnUseVariable: TPSOnUseVariable read FOnUseVariable write FOnUseVariable;
property OnUseRegProc: TPSOnUseRegProc read FOnUseRegProc write FOnUseRegProc;
property OnBeforeOutput: TPSOnNotify read FOnBeforeOutput write FOnBeforeOutput;
property OnBeforeCleanup: TPSOnNotify read FOnBeforeCleanup write FOnBeforeCleanup;
@ -2312,6 +2317,8 @@ begin
x := TPSExternalProcedure.Create;
TPSExternalProcedure(x).RegProc := xr;
FProcs.Add(x);
if @FOnUseRegProc <> nil then
FOnUseRegProc(Self, FParser.CurrTokenPos, Name);
Result := FProcs.Count - 1;
exit;
end;