mirror of
https://github.com/moparisthebest/Simba
synced 2024-12-23 15:58:51 -05:00
Safecall to Register in PSTest. What doesn't work yet from this test in Linux?
This commit is contained in:
parent
f370f865d4
commit
168b8a3c03
@ -13,15 +13,15 @@ type
|
||||
x, y:integer;
|
||||
end;
|
||||
|
||||
function MakeArr : TStringArray; safecall;
|
||||
procedure TestParameters(Int1,Int2,Int3,Int4,Int5,Int6 : integer); safecall;
|
||||
function TestResult(Int1,Int2,Int3,Int4,Int5,Int6 : integer): Integer; safecall;
|
||||
function TestString(Str1,Str2,Str3 : string) : string; safecall;
|
||||
function TestStringEdit(var Str : string) : String; safecall;
|
||||
procedure TestArrayPassing( Arr : TStringArray); safecall;
|
||||
Procedure TestArrayEdit(var Arr : TStringArray); safecall;
|
||||
function TestArrayFull(var Arr1: TStringArray; Arr2 : TStringArray): TStringArray; safecall;
|
||||
function makePoint(x, y: integer): w_Tpoint; safecall;
|
||||
function MakeArr : TStringArray;
|
||||
procedure TestParameters(Int1,Int2,Int3,Int4,Int5,Int6 : integer);
|
||||
function TestResult(Int1,Int2,Int3,Int4,Int5,Int6 : integer): Integer;
|
||||
function TestString(Str1,Str2,Str3 : string) : string;
|
||||
function TestStringEdit(var Str : string) : String;
|
||||
procedure TestArrayPassing( Arr : TStringArray);
|
||||
Procedure TestArrayEdit(var Arr : TStringArray);
|
||||
function TestArrayFull(var Arr1: TStringArray; Arr2 : TStringArray): TStringArray;
|
||||
function makePoint(x, y: integer): w_Tpoint;
|
||||
|
||||
implementation
|
||||
|
||||
@ -33,7 +33,7 @@ begin;
|
||||
Form1.Memo2.Lines.add(s);
|
||||
end;
|
||||
|
||||
procedure TestParameters(Int1,Int2,Int3,Int4,Int5,Int6 : integer); safecall;
|
||||
procedure TestParameters(Int1,Int2,Int3,Int4,Int5,Int6 : integer);
|
||||
begin;
|
||||
Writeln('Parameters are: ' + format('%d %d %d %d %d %d',[int1,int2,int3,int4,int5,int6]));
|
||||
if (int1 <> 1) or (int2 <> 2) or (int3 <> 3) or (int4 <> 4) or (int5 <> 5) or (int6 <> 6) then
|
||||
@ -42,13 +42,13 @@ begin;
|
||||
Writeln('Passed this test');
|
||||
end;
|
||||
|
||||
function TestResult(Int1,Int2,Int3,Int4,Int5,Int6 : integer): Integer; safecall;
|
||||
function TestResult(Int1,Int2,Int3,Int4,Int5,Int6 : integer): Integer;
|
||||
begin;
|
||||
Result := int1 + int2 + int3 + int4 + int5 + int6;
|
||||
Writeln('Result should be:' + inttostr(int1+int2+int3+int4+int5+int6));
|
||||
end;
|
||||
|
||||
function TestString(Str1,Str2,Str3 : string) : string; safecall;
|
||||
function TestString(Str1,Str2,Str3 : string) : string;
|
||||
begin;
|
||||
if Str1+Str2+str3 = 'lol' then
|
||||
Writeln('Strings got passed over correctly.');
|
||||
@ -59,7 +59,7 @@ begin;
|
||||
Writeln('Result should be a');
|
||||
end;
|
||||
|
||||
function TestStringEdit(var Str : string) : String; safecall;
|
||||
function TestStringEdit(var Str : string) : String;
|
||||
begin;
|
||||
Result := 'False';
|
||||
if Str <> 'Test' then
|
||||
@ -70,7 +70,7 @@ begin;
|
||||
Writeln('Result should be: hopla; Input str should be tseT');
|
||||
end;
|
||||
|
||||
procedure TestArrayPassing(Arr : TStringArray); safecall;
|
||||
procedure TestArrayPassing(Arr : TStringArray);
|
||||
var
|
||||
i : integer;
|
||||
begin;
|
||||
@ -80,7 +80,7 @@ begin;
|
||||
end;
|
||||
|
||||
|
||||
Procedure TestArrayEdit(var Arr : TStringArray); safecall;
|
||||
Procedure TestArrayEdit(var Arr : TStringArray);
|
||||
begin;
|
||||
Writeln('Arr size is ' + inttostr(length(arr)));
|
||||
SetLength(arr,0);
|
||||
@ -92,7 +92,7 @@ begin;
|
||||
arr[4] := '!';
|
||||
end;
|
||||
|
||||
function ConvStrArr( Arr : Array of String): TStringArray; safecall;
|
||||
function ConvStrArr( Arr : Array of String): TStringArray;
|
||||
var
|
||||
Len : Integer;
|
||||
begin;
|
||||
@ -101,7 +101,7 @@ begin;
|
||||
Move(Arr[Low(Arr)], Result[0], Len*SizeOf(String));
|
||||
end;
|
||||
|
||||
function TestArrayFull(var Arr1: TStringArray; Arr2 : TStringArray): TStringArray; safecall;
|
||||
function TestArrayFull(var Arr1: TStringArray; Arr2 : TStringArray): TStringArray;
|
||||
begin
|
||||
Writeln(Format('Len(Arr1) = %d - Len(Arr2) = %d',[Length(Arr1),length(arr2)]));
|
||||
SetLength(Result,0);
|
||||
@ -115,14 +115,14 @@ begin
|
||||
Result := ConvStrArr(['Waza?','Gaat','Alles','Goed']);
|
||||
end;
|
||||
|
||||
function MakeArr : TStringArray; safecall;
|
||||
function MakeArr : TStringArray;
|
||||
begin;
|
||||
setlength(result,2);
|
||||
result[0] := 'Test0';
|
||||
Result[1] := 'Wow!';
|
||||
end;
|
||||
|
||||
function makePoint(x, y: integer): w_Tpoint; safecall;
|
||||
function makePoint(x, y: integer): w_Tpoint;
|
||||
begin
|
||||
result.x := x;
|
||||
result.y := y;
|
||||
|
@ -101,7 +101,7 @@ end;
|
||||
|
||||
|
||||
|
||||
function teststdcall(num1,num2,num3,num4,num5,num6 : LongInt) : boolean; stdcall;
|
||||
function teststdcall(num1,num2,num3,num4,num5,num6 : LongInt) : boolean; stdcall;
|
||||
begin;
|
||||
Result := false;
|
||||
Form1.Memo2.Lines.add(Format('stdcall AddFunctionEx: %d %d %d %d %d %d',[num1,num2,num3,num4,num5,num6]));
|
||||
@ -161,16 +161,16 @@ begin
|
||||
Sender.AddFunction(@testnormal,'function testnormal(num1,num2,num3,num4,num5,num6 : LongInt) : boolean;');
|
||||
Sender.AddFunctionEx(@teststdcall, 'function teststdcall(num1,num2,num3,num4,num5,num6 : LongInt) : boolean;stdcall;',cdStdCall);
|
||||
Sender.AddFunctionEx(@testcdecl, 'function testcdecl(num1,num2,num3,num4,num5,num6 : LongInt) : boolean; cdecl;',cdCdecl);
|
||||
Sender.AddFunctionEx(@DiffTest,'function DiffTest(num : integer; str : string; byt : byte; wor : longword; bool : boolean) : boolean;', cdSafeCall);
|
||||
Sender.AddFunctionEx(@TestParameters,'procedure TestParameters(Int1,Int2,Int3,Int4,Int5,Int6 : integer);', cdSafeCall);
|
||||
Sender.AddFunctionEx(@TestResult,'function TestResult(Int1,Int2,Int3,Int4,Int5,Int6 : integer): Integer;', cdSafeCall);
|
||||
Sender.AddFunctionEx(@TestString,'function TestString(Str1,Str2,Str3 : string) : string;', cdSafeCall);
|
||||
Sender.AddFunctionEx(@TestStringEdit,'function TestStringEdit(var Str : string) : String;', cdSafeCall);
|
||||
Sender.AddFunctionEx(@TestArrayPassing,'procedure TestArrayPassing(const Arr : TStringArray);', cdSafeCall);
|
||||
Sender.AddFunctionEx(@TestArrayEdit,'Procedure TestArrayEdit(var Arr : TStringArray);', cdSafeCall);
|
||||
Sender.AddFunctionEx(@TestArrayFull,'function TestArrayFull(var Arr1: TStringArray; Arr2 : TStringArray): TStringArray;', cdSafeCall);
|
||||
Sender.AddFunctionEx(@MakeArr,'function MakeArr : TStringArray;', cdSafeCall);
|
||||
Sender.AddFunctionEx(@makePoint, 'function makePoint(x, y: integer): w_Tpoint;', cdSafeCall);
|
||||
Sender.AddFunctionEx(@DiffTest,'function DiffTest(num : integer; str : string; byt : byte; wor : longword; bool : boolean) : boolean;', cdRegister);
|
||||
Sender.AddFunctionEx(@TestParameters,'procedure TestParameters(Int1,Int2,Int3,Int4,Int5,Int6 : integer);', cdRegister);
|
||||
Sender.AddFunctionEx(@TestResult,'function TestResult(Int1,Int2,Int3,Int4,Int5,Int6 : integer): Integer;', cdRegister);
|
||||
Sender.AddFunctionEx(@TestString,'function TestString(Str1,Str2,Str3 : string) : string;', cdRegister);
|
||||
Sender.AddFunctionEx(@TestStringEdit,'function TestStringEdit(var Str : string) : String;', cdRegister);
|
||||
Sender.AddFunctionEx(@TestArrayPassing,'procedure TestArrayPassing(const Arr : TStringArray);', cdRegister);
|
||||
Sender.AddFunctionEx(@TestArrayEdit,'Procedure TestArrayEdit(var Arr : TStringArray);', cdRegister);
|
||||
Sender.AddFunctionEx(@TestArrayFull,'function TestArrayFull(var Arr1: TStringArray; Arr2 : TStringArray): TStringArray;', cdRegister);
|
||||
Sender.AddFunctionEx(@MakeArr,'function MakeArr : TStringArray;', cdRegister);
|
||||
Sender.AddFunctionEx(@makePoint, 'function makePoint(x, y: integer): w_Tpoint;', cdRegister);
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user