1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-22 15:28:50 -05:00

I think I've fixed PS for the array-result bug.. :)

This commit is contained in:
Raymond 2010-04-08 00:40:28 +02:00
parent 2d58a145fc
commit deef894757
4 changed files with 22 additions and 14 deletions

View File

@ -31,6 +31,7 @@ Sender.Comp.AddTypeS('TReplaceFlags','set of TReplaceFlag');
Sender.Comp.AddTypeS('StrExtr','(Numbers, Letters, Others);'); Sender.Comp.AddTypeS('StrExtr','(Numbers, Letters, Others);');
Sender.Comp.AddTypeS('TDateTime','Double'); Sender.Comp.AddTypeS('TDateTime','Double');
Sender.Comp.AddTypeS('TIntegerArray', 'Array of LongInt'); Sender.Comp.AddTypeS('TIntegerArray', 'Array of LongInt');
Sender.Comp.AddTypeS('TByteArray','Array of byte');
Sender.Comp.AddTypeS('TExtendedArray','Array of extended'); Sender.Comp.AddTypeS('TExtendedArray','Array of extended');
Sender.Comp.AddTypeS('TBoolArray', 'Array of Boolean'); Sender.Comp.AddTypeS('TBoolArray', 'Array of Boolean');
Sender.Comp.AddTypes('TBox', 'record X1,Y1,X2,Y2 : Integer; end;'); Sender.Comp.AddTypes('TBox', 'record X1,Y1,X2,Y2 : Integer; end;');

View File

@ -215,17 +215,18 @@ uses
lclintf // for GetTickCount and others. lclintf // for GetTickCount and others.
; ;
{$ifdef Linux} {$ifdef Linux}
//{$define PS_StdCall} {$define PS_SafeCall}
{$else} {$else}
//{$define PS_StdCall} //{$define PS_SafeCall}
{$endif} {$endif}
{$MACRO ON} {$MACRO ON}
{$ifdef PS_StdCall} {$ifdef PS_SafeCall}
{$define extdecl := stdcall}
{$else}
{$define extdecl := safecall} {$define extdecl := safecall}
{$else}
{$define extdecl := register}
{$endif} {$endif}
{Some General PS Functions here} {Some General PS Functions here}
procedure psWriteln(str : string); extdecl; procedure psWriteln(str : string); extdecl;
begin begin
@ -614,7 +615,7 @@ begin
for i := 0 to high(ExportedMethods) do for i := 0 to high(ExportedMethods) do
if ExportedMethods[i].FuncPtr <> nil then if ExportedMethods[i].FuncPtr <> nil then
Sender.AddFunctionEx(ExportedMethods[i].FuncPtr,ExportedMethods[i].FuncDecl, Sender.AddFunctionEx(ExportedMethods[i].FuncPtr,ExportedMethods[i].FuncDecl,
{$ifdef PS_StdCall}cdStdCall{$else}cdSafeCall{$endif}); {$ifdef PS_SafeCall}cdSafeCall{$else}cdRegister{$endif});
end; end;
function TPSThread.RequireFile(Sender: TObject; function TPSThread.RequireFile(Sender: TObject;

View File

@ -9,7 +9,6 @@
{$UNDEF PS_FPCSTRINGWORKAROUND} {$UNDEF PS_FPCSTRINGWORKAROUND}
{$DEFINE PS_RESBEFOREPARAMETERS} {$DEFINE PS_RESBEFOREPARAMETERS}
{$DEFINE x64_string_result_as_varparameter} {$DEFINE x64_string_result_as_varparameter}
{$DEFINE PS_RESULTFIRST}
{FreePascal 2.3.1 and above has much Delphi compatibility bugs fixed} {FreePascal 2.3.1 and above has much Delphi compatibility bugs fixed}
{$else} {$else}
{$DEFINE FPC_OLD_FIX} {$DEFINE FPC_OLD_FIX}

View File

@ -251,7 +251,9 @@ var
RegUsage: Byte; RegUsage: Byte;
CallData: TPSList; CallData: TPSList;
pp: ^Byte; pp: ^Byte;
{$IFDEF FPC}
IsConstructor: Boolean; IsConstructor: Boolean;
{$ENDIF}
EAX, EDX, ECX: Longint; EAX, EDX, ECX: Longint;
@ -502,10 +504,15 @@ var
end; end;
begin begin
if (Integer(CallingConv) and 64) <> 0 then begin if (Integer(CallingConv) and 64) <> 0 then begin
IsConstructor := true; {$IFDEF FPC}
IsConstructor := true;
{$ENDIF}
CAllingConv := TPSCallingConvention(Integer(CallingConv) and not 64); CAllingConv := TPSCallingConvention(Integer(CallingConv) and not 64);
end else IsConstructor := false; end else begin
{$IFDEF FPC}
IsConstructor := false;
{$ENDIF}
end;
InnerfuseCall := False; InnerfuseCall := False;
if Address = nil then if Address = nil then
exit; // need address exit; // need address
@ -566,7 +573,7 @@ begin
btchar,btU8, btS8: tbtu8(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 1, nil); btchar,btU8, btS8: tbtu8(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 1, nil);
{$IFNDEF PS_NOWIDESTRING}btWideChar, {$ENDIF}btu16, bts16: tbtu16(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 2, nil); {$IFNDEF PS_NOWIDESTRING}btWideChar, {$ENDIF}btu16, bts16: tbtu16(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 2, nil);
btClass : btClass :
{$IFDEF FPC} {$IFDEF FPC_OLD_FIX}
tbtu32(res.dta^) := RealCall_Register(Address, EDX, EAX, ECX, tbtu32(res.dta^) := RealCall_Register(Address, EDX, EAX, ECX,
@Stack[Length(Stack) - 3], Length(Stack) div 4, 4, nil); @Stack[Length(Stack) - 3], Length(Stack) div 4, 4, nil);
{$ELSE} {$ELSE}
@ -574,7 +581,7 @@ begin
@Stack[Length(Stack) - 3], Length(Stack) div 4, 4, nil); @Stack[Length(Stack) - 3], Length(Stack) div 4, 4, nil);
{$ENDIF} {$ENDIF}
btu32,bts32: tbtu32(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 4, nil); btu32,bts32{$IFDEF FPC},btArray{$ENDIF}: tbtu32(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 4, nil);
btPChar: pansichar(res.dta^) := Pansichar(RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 4, nil)); btPChar: pansichar(res.dta^) := Pansichar(RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 4, nil));
{$IFNDEF PS_NOINT64}bts64: {$IFNDEF PS_NOINT64}bts64:
begin begin
@ -586,7 +593,7 @@ begin
btInterface, btInterface,
btVariant, btVariant,
{$IFNDEF PS_NOWIDESTRING}btWidestring,btUnicodestring, {$ENDIF} {$IFNDEF PS_NOWIDESTRING}btWidestring,btUnicodestring, {$ENDIF}
btStaticArray, btArray, btrecord{$IFNDEF PS_FPCSTRINGWORKAROUND}, btstring {$ENDIF}: RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 0, nil); btStaticArray, {$IFNDEF FPC} btArray,{$ENDIF} btrecord{$IFNDEF PS_FPCSTRINGWORKAROUND}, btstring {$ENDIF}: RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 0, nil);
{$IFDEF PS_FPCSTRINGWORKAROUND} {$IFDEF PS_FPCSTRINGWORKAROUND}
btstring: begin btstring: begin
eax := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 4, nil); eax := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 4, nil);