1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 02:32:19 -05:00

Changed the rev-verison in TestUnit and new PS!

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@407 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2010-01-13 18:13:42 +00:00
parent bedc0fa2a5
commit d92139acc9
4 changed files with 61 additions and 17 deletions

View File

@ -42,7 +42,7 @@ uses
ocr, updateform, simbasettings, reportbug; ocr, updateform, simbasettings, reportbug;
const const
SimbaVersion = 404; SimbaVersion = 405;
type type

View File

@ -2,10 +2,13 @@
{$DEFINE PS_HAVEVARIANT} {$DEFINE PS_HAVEVARIANT}
{$DEFINE PS_DYNARRAY} {$DEFINE PS_DYNARRAY}
{$DEFINE PS_NOIDISPATCH} {$DEFINE PS_NOIDISPATCH}
{$if (fpc_version=2) and (fpc_release>=3) and (fpc_patch>=1)} {.$if (fpc_version=2) and (fpc_release>=3) and (fpc_patch>=1)}
{.$if (fpc_version=2) and (fpc_release>=2) and (fpc_patch>=4)} {$if (fpc_version=2) and ((fpc_release=2) and (fpc_patch>=4)) or (fpc_release>2)}
{$UNDEF FPC_OLD_FIX} {$UNDEF FPC_OLD_FIX}
{$DEFINE PS_STACKALIGN}
{$UNDEF PS_FPCSTRINGWORKAROUND} {$UNDEF PS_FPCSTRINGWORKAROUND}
{$DEFINE PS_RESBEFOREPARAMETERS}
{$DEFINE x64_string_result_as_varparameter}
{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

@ -1,4 +1,5 @@
unit uPSRuntime; unit uPSRuntime;
{$I PascalScript.inc} {$I PascalScript.inc}
{ {
@ -1702,8 +1703,9 @@ begin
{$IFNDEF PS_NOWIDESTRING}btWideChar, {$ENDIF}bts16, btU16: FrealSize := 2; {$IFNDEF PS_NOWIDESTRING}btWideChar, {$ENDIF}bts16, btU16: FrealSize := 2;
{$IFNDEF PS_NOWIDESTRING}btWideString, {$IFNDEF PS_NOWIDESTRING}btWideString,
btUnicodeString, btUnicodeString,
{$ENDIF}{$IFNDEF PS_NOINTERFACES}btInterface, {$ENDIF}btSingle, bts32, btU32, {$ENDIF}{$IFNDEF PS_NOINTERFACES}btInterface, {$ENDIF}
btclass, btPChar, btString: FrealSize := PointerSize; btclass, btPChar, btString: FrealSize := PointerSize;
btSingle, bts32, btU32: FRealSize := 4;
btProcPtr: FRealSize := 2 * sizeof(Pointer) + sizeof(Cardinal); btProcPtr: FRealSize := 2 * sizeof(Pointer) + sizeof(Cardinal);
btCurrency: FrealSize := Sizeof(Currency); btCurrency: FrealSize := Sizeof(Currency);
btPointer: FRealSize := 2 * sizeof(Pointer) + sizeof(LongBool); // ptr, type, freewhendone btPointer: FRealSize := 2 * sizeof(Pointer) + sizeof(LongBool); // ptr, type, freewhendone
@ -6545,6 +6547,7 @@ begin
Inc(FCurrentPosition, 4); Inc(FCurrentPosition, 4);
Pointer(Dest.P^) := nil; Pointer(Dest.P^) := nil;
SetLength(tbtstring(Dest.P^), Param); SetLength(tbtstring(Dest.P^), Param);
if Param <> 0 then begin
if not ReadData(tbtstring(Dest.P^)[1], Param) then if not ReadData(tbtstring(Dest.P^)[1], Param) then
begin begin
CMD_Err(erOutOfRange); CMD_Err(erOutOfRange);
@ -6552,6 +6555,8 @@ begin
Result := False; Result := False;
exit; exit;
end; end;
pansichar(dest.p^)[Param] := #0;
end;
end; end;
{$IFNDEF PS_NOWIDESTRING} {$IFNDEF PS_NOWIDESTRING}
btWidestring: btWidestring:

View File

@ -113,6 +113,12 @@ asm
push rdi // address push rdi // address
push rsi // _rax push rsi // _rax
push r9 // xmm0 push r9 // xmm0
{$IFDEF PS_STACKALIGN}
bt r8, 0
jc @skipjump
sub rsp, 8
@skipjump:
{$ENDIF}
mov rax, rdx mov rax, rdx
jmp @compareitems jmp @compareitems
@work: @work:
@ -145,6 +151,8 @@ asm
mov rax, [rbp-8] mov rax, [rbp-8]
call RAX call RAX
// add rsp, 8
// add RSP, 32 // undo the damage done earlier // add RSP, 32 // undo the damage done earlier
// copy result back // copy result back
@ -350,11 +358,22 @@ _XMM0: Double;
Result := True; Result := True;
exit; exit;
end else begin end else begin
{$IFDEF FPC}
StoreReg(IPointer(FVar.Dta));
{$ELSE}
StoreReg(IPointer(FVar.Dta^)); StoreReg(IPointer(FVar.Dta^));
{$ENDIF}
end; end;
end; end;
btRecord:
begin
if fvar^.aType.RealSize <= sizeof(IPointer) then
StoreReg(IPointer(fvar.dta^))
else
StoreReg(IPointer(fVar.Dta));
end;
btVariant btVariant
, btStaticArray, btRecord: , btStaticArray:
begin begin
StoreReg(IPointer(fVar.Dta)); StoreReg(IPointer(fVar.Dta));
end; end;
@ -449,22 +468,39 @@ begin
if assigned(_Self) then begin if assigned(_Self) then begin
StoreReg(IPointer(_Self)); StoreReg(IPointer(_Self));
end; end;
for I := 0 to Params.Count - 1 do {$IFDEF PS_RESBEFOREPARAMETERS}
begin
if not GetPtr(rp(Params[I])) then Exit;
end;
if assigned(res) then begin if assigned(res) then begin
case res^.aType.BaseType of case res^.aType.BaseType of
{$IFDEF x64_string_result_as_varparameter} {$IFDEF x64_string_result_as_varparameter}
btstring, btWideString, btUnicodeString, btstring, btWideString, btUnicodeString,
{$ENDIF} {$ENDIF}
btInterface, btArray, btrecord, btVariant, btStaticArray: GetPtr(res); btInterface, btArray, btVariant, btStaticArray:
GetPtr(res);
btSet: btSet:
begin begin
if TPSTypeRec_Set(res.aType).aByteSize > PointerSize then GetPtr(res); if res.aType.RealSize > PointerSize then GetPtr(res);
end; end;
end; end;
end;
{$ENDIF}
for I := 0 to Params.Count - 1 do
begin
if not GetPtr(rp(Params[I])) then Exit;
end;
if assigned(res) then begin
{$IFNDEF PS_RESBEFOREPARAMETERS}
case res^.aType.BaseType of
{$IFDEF x64_string_result_as_varparameter}
btstring, btWideString, btUnicodeString,
{$ENDIF}
btInterface, btArray, btVariant, btStaticArray:
GetPtr(res);
btSet:
begin
if res.aType.RealSize > PointerSize then GetPtr(res);
end;
end;
{$ENDIF}
if Stack = nil then pp := nil else pp := @Stack[Length(Stack) -8]; if Stack = nil then pp := nil else pp := @Stack[Length(Stack) -8];
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
x64call(Address, _RAX, _RCX, _RDX, _R8, _R9, _XMM0, _XMM1, _XMM2, _XMM3, pp, Length(Stack) div 8); x64call(Address, _RAX, _RCX, _RDX, _R8, _R9, _XMM0, _XMM1, _XMM2, _XMM3, pp, Length(Stack) div 8);
@ -472,9 +508,9 @@ begin
x64call(Address, _RAX, Registers, pp, Length(Stack) div 8, _XMM0); x64call(Address, _RAX, Registers, pp, Length(Stack) div 8, _XMM0);
{$ENDIF} {$ENDIF}
case res^.aType.BaseType of case res^.aType.BaseType of
btSet: btRecord, btSet:
begin begin
case TPSTypeRec_Set(res.aType).aByteSize of case res.aType.RealSize of
1: byte(res.Dta^) := _RAX; 1: byte(res.Dta^) := _RAX;
2: word(res.Dta^) := _RAX; 2: word(res.Dta^) := _RAX;
3, 3,
@ -497,7 +533,7 @@ begin
{$IFDEF x64_string_result_as_varparameter} {$IFDEF x64_string_result_as_varparameter}
btWidestring,btUnicodestring, btstring , btWidestring,btUnicodestring, btstring ,
{$ENDIF} {$ENDIF}
btStaticArray, btArray, btrecord:; btStaticArray, btArray:;
{$IFNDEF x64_string_result_as_varparameter} {$IFNDEF x64_string_result_as_varparameter}
btUnicodeString, btWideString, btstring: Int64(res.dta^) := _RAX; btUnicodeString, btWideString, btstring: Int64(res.dta^) := _RAX;
{$ENDIF} {$ENDIF}