InnerfuseCall(Caller, FSelf, VirtualClassMethodPtrToPtr(p^.Ext1, FSelf), cc, MyList, n, @ResourcePtrSupport);
result := true;
except
result := false;
end;
MyList.Free;
end;
function CastProc(Caller: TIFPSExec; p: PIFProcRec; Global, Stack: TIfList): Boolean;
var
TypeNo, InVar, ResVar: PIFVariant;
FSelf: TClass;
FType: PIFTypeRec;
H, I: Longint;
x: TIFPSRuntimeClass;
begin
TypeNo := Stack.GetItem(Stack.Count-3);
InVar := Stack.GetItem(Stack.Count-2);
ResVar := Stack.GetItem(Stack.Count-1);
if (TypeNo = nil) or (InVar = nil) or (ResVar = nil) or (InVar^.FType^.BaseType <> btResourcePointer) or (ResVar^.FType^.BaseType <> btResourcePointer) or (TypeNo^.FType^.BaseType <> btu32) then
begin
Result := False;
Exit;
end;
if InVar^.tResourceP1 = nil then
begin
ResVar^.tResourceP1 := nil;
ResVar^.tResourceFreeProc:= nil;
result := True;
exit;
end;
FType := Caller.GetTypeNo(TypeNo^.tu32);
if (FType = nil) then
begin
Result := False;
exit;
end;
h := MakeHash(FType^.ExportName);
FSelf := nil;
for i := 0 to TIFPSRuntimeClassImporter(p^.Ext2).FClasses.Count -1 do
if (x.FClassNameHash = h) and (x.FClassName = FType^.ExportName) then
begin
FSelf := x.FClass;
end;
end;
if FSelf = nil then begin
Result := False;
exit;
end;
ResVar^.tResourceFreeProc := DummyResourceFree;
try
resVar^.tResourceP1 := TObject(InVar^.tResourceP1) as FSelf;
except
Result := False;
exit;
end;
result := True;
end;
function CompareProc(Caller: TIFPSExec; p: PIFProcRec; Global, Stack: TIfList): Boolean;
var
p1, p2, pres: PIFVariant;
begin
p1 := Stack.GetItem(Stack.Count -3);
p2 := Stack.GetItem(Stack.Count -2);
pres := Stack.GetItem(Stack.Count -1);
if (p1=nil) or (p2=nil) or (pres = nil) or (p1^.FType^.BaseType <> btResourcePointer) or (p2^.FType^.BaseType <> btResourcePointer) or (pres^.FType^.BaseType <> btu8) then
begin
Result := False;
exit;
end;
if (p1^.tResourceP1 = p2^.tResourceP1) and (@p1^.tResourceFreeProc = @p2^.tResourceFreeProc) then
pres^.tu32 := 1
else
pres^.tu32 := 0;
Result := True;
end;
function NilProc(Caller: TIFPSExec; p: PIFProcRec; Global, Stack: TIfList): Boolean;
var
n: PIFVariant;
begin
n := Stack.GetItem(Stack.Count-1);
if (n = nil) or (n^.FType^.BaseType <> btResourcePointer) then
begin
Result := False;
Exit;
end;
n^.tResourceP1 := nil;
n^.tResourceFreeProc := nil;
result := True;
end;
function MkMethod(FSE: TIFPSExec; No: Cardinal): TMethod;
begin
if no = 0 then
begin
Result.Code := nil;
Result.Data := nil;
end else begin
Result.Code := @MyAllMethodsHandler;
Result.Data := GetMethodInfoRec(FSE, No);
end;
end;
function getMethodNo(P: TMethod): Cardinal;
begin
if (p.Code <> @MyAllMethodsHandler) or (p.Data = nil) then
Result := 0
else
begin
Result := PScriptMethodInfo(p.Data)^.ProcNo;
end;
end;
function ClassCallProc2(Caller: TIFPSExec; p: PIFProcRec; Global, Stack: TIfList): Boolean;
var
n: PIFVariant;
FSelf: Pointer;
begin
if p^.Ext2 = Pointer(0) then
begin
n := Stack.GetItem(Stack.Count -1);
if (n = nil) or (n^.Ftype^.BaseType <> btResourcePointer) or (@n^.tResourceFreeProc <> @DummyResourceFree) then
begin
result := false;
exit;
end;
FSelf := n^.tResourceP1;
n := Stack.GetItem(Stack.Count -2);
if (PPropInfo(p^.Ext1)^.PropType^.Kind = tkMethod) and (n^.FType^.BaseType = btu32) then