From: <ah...@us...> - 2010-08-19 12:12:00
|
Revision: 12826 http://jvcl.svn.sourceforge.net/jvcl/?rev=12826&view=rev Author: ahuser Date: 2010-08-19 12:11:54 +0000 (Thu, 19 Aug 2010) Log Message: ----------- Instead of switching the global DecimalSeparator JvInterpreter now uses the TFormatSettings record. Modified Paths: -------------- trunk/jvcl/run/JvInterpreter.pas Modified: trunk/jvcl/run/JvInterpreter.pas =================================================================== --- trunk/jvcl/run/JvInterpreter.pas 2010-08-17 13:22:07 UTC (rev 12825) +++ trunk/jvcl/run/JvInterpreter.pas 2010-08-19 12:11:54 UTC (rev 12826) @@ -5045,7 +5045,7 @@ procedure TJvInterpreterExpression.ParseToken; var - OldDecimalSeparator: Char; + FS: TFormatSettings; Dob: Extended; Int: Integer; Stub: Integer; @@ -5060,15 +5060,10 @@ end; ttDouble: begin - OldDecimalSeparator := DecimalSeparator; - DecimalSeparator := '.'; - if not TextToFloat(PChar(FTokenStr), Dob, fvExtended) then - begin - DecimalSeparator := OldDecimalSeparator; + FS.ThousandSeparator := ','; + FS.DecimalSeparator := '.'; + if not TextToFloat(PChar(FTokenStr), Dob, fvExtended, FS) then JvInterpreterError(ieInternal, -1); - end - else - DecimalSeparator := OldDecimalSeparator; FToken := Dob; end; ttString: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2010-08-20 14:45:03
|
Revision: 12827 http://jvcl.svn.sourceforge.net/jvcl/?rev=12827&view=rev Author: ahuser Date: 2010-08-20 14:44:57 +0000 (Fri, 20 Aug 2010) Log Message: ----------- Restored Delphi 6 compatibility Modified Paths: -------------- trunk/jvcl/run/JvInterpreter.pas Modified: trunk/jvcl/run/JvInterpreter.pas =================================================================== --- trunk/jvcl/run/JvInterpreter.pas 2010-08-19 12:11:54 UTC (rev 12826) +++ trunk/jvcl/run/JvInterpreter.pas 2010-08-20 14:44:57 UTC (rev 12827) @@ -5045,7 +5045,11 @@ procedure TJvInterpreterExpression.ParseToken; var + {$IFDEF DELPHI7_UP} FS: TFormatSettings; + {$ELSE} + OldDecimalSeparator: Char; + {$ENDIF DELPHI7_UP} Dob: Extended; Int: Integer; Stub: Integer; @@ -5060,10 +5064,22 @@ end; ttDouble: begin + {$IFDEF DELPHI7_UP} FS.ThousandSeparator := ','; FS.DecimalSeparator := '.'; if not TextToFloat(PChar(FTokenStr), Dob, fvExtended, FS) then JvInterpreterError(ieInternal, -1); + {$ELSE} + OldDecimalSeparator := DecimalSeparator; + DecimalSeparator := '.'; + if not TextToFloat(PChar(FTokenStr), Dob, fvExtended) then + begin + DecimalSeparator := OldDecimalSeparator; + JvInterpreterError(ieInternal, -1); + end + else + DecimalSeparator := OldDecimalSeparator; + {$ENDIF DELPHI7_UP} FToken := Dob; end; ttString: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2010-11-28 09:54:07
|
Revision: 12925 http://jvcl.svn.sourceforge.net/jvcl/?rev=12925&view=rev Author: ahuser Date: 2010-11-28 09:54:00 +0000 (Sun, 28 Nov 2010) Log Message: ----------- Mantis #5278: JvInterpreter and #XX character codes Modified Paths: -------------- trunk/jvcl/run/JvInterpreter.pas Modified: trunk/jvcl/run/JvInterpreter.pas =================================================================== --- trunk/jvcl/run/JvInterpreter.pas 2010-11-28 09:52:23 UTC (rev 12924) +++ trunk/jvcl/run/JvInterpreter.pas 2010-11-28 09:54:00 UTC (rev 12925) @@ -5151,7 +5151,7 @@ while True do begin case TTyp of - ttInteger, ttDouble, ttString, ttFalse, ttTrue, ttIdentifier: + ttInteger, ttDouble, ttFalse, ttTrue, ttIdentifier: begin Result := Token; if TTyp = ttIdentifier then @@ -5166,6 +5166,18 @@ if Prior(TTyp) < Prior(OpTyp) then Exit; end; + ttString: + begin + Result := ''; + repeat + Result := Result + Token; + NextToken; + if TTyp in [ttInteger, ttDouble, ttFalse, ttTrue, ttIdentifier] then + JvInterpreterError(ieMissingOperator, PosEnd {!!}); + until TTyp <> ttString; + if Prior(TTyp) < Prior(OpTyp) then + Exit; + end; // [peter schraut: added ttShl case on 2005/08/14] ttShl: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-11-08 23:15:30
|
Revision: 13167 http://jvcl.svn.sourceforge.net/jvcl/?rev=13167&view=rev Author: ahuser Date: 2011-11-08 23:15:24 +0000 (Tue, 08 Nov 2011) Log Message: ----------- Implemented x64 "script to native function calls" Modified Paths: -------------- trunk/jvcl/run/JvInterpreter.pas Modified: trunk/jvcl/run/JvInterpreter.pas =================================================================== --- trunk/jvcl/run/JvInterpreter.pas 2011-11-08 22:26:18 UTC (rev 13166) +++ trunk/jvcl/run/JvInterpreter.pas 2011-11-08 23:15:24 UTC (rev 13167) @@ -1263,6 +1263,9 @@ uses TypInfo, + {$IFDEF CPUX64} + System.Rtti, + {$ENDIF CPUX64} {$IFDEF JvInterpreter_OLEAUTO} OleConst, ActiveX, ComObj, {$ENDIF JvInterpreter_OLEAUTO} @@ -1804,17 +1807,23 @@ type TFunc = procedure; + {$IFNDEF CPU64} TiFunc = function: Integer; TfFunc = function: Boolean; TwFunc = function: Word; + {$ENDIF ~CPU64} function CallDllIns(Ins: HINST; const FuncName: string; Args: TJvInterpreterArgs; ParamDesc: TTypeArray; ResTyp: Word): Variant; var Func: TFunc; + {$IFNDEF CPU64} iFunc: TiFunc; fFunc: TfFunc; wFunc: TwFunc; + {$ELSE} + Params: TArray<System.Rtti.TValue>; + {$ENDIF ~CPU64} I: Integer; AInt: Integer; // Abyte : Byte; @@ -1824,13 +1833,20 @@ begin Result := Null; Func := GetProcAddress(Ins, PChar(FuncName)); + {$IFNDEF CPU64} iFunc := @Func; fFunc := @Func; wFunc := @Func; + {$ENDIF ~CPU64} if Assigned(Func) then begin try + {$IFNDEF CPU64} for I := Args.Count - 1 downto 0 do { 'stdcall' call conversion } + {$ELSE} + SetLength(Params, Args.Count); + for I := 0 to Args.Count - 1 do + {$ENDIF ~CPU64} begin if (ParamDesc[I] and varByRef) = 0 then case ParamDesc[I] of @@ -1842,7 +1858,7 @@ push AInt end; {$ELSE} - {$MESSAGE WARN 'Needs review for x64'} + Params[I] := TValue.From(AInt); {$ENDIF ~CPU64} end; varSmallint: @@ -1853,7 +1869,7 @@ push AWord end; {$ELSE} - {$MESSAGE WARN 'Needs review for x64'} + Params[I] := TValue.From(AWord); {$ENDIF ~CPU64} end; varString: @@ -1864,7 +1880,7 @@ push APointer end; {$ELSE} - {$MESSAGE WARN 'Needs review for x64'} + Params[I] := TValue.From(APointer); {$ENDIF ~CPU64} end; else @@ -1880,7 +1896,7 @@ push APointer end; {$ELSE} - {$MESSAGE WARN 'Needs review for x64'} + Params[I] := TValue.From(APointer); {$ENDIF ~CPU64} end; varSmallint: @@ -1891,7 +1907,7 @@ push APointer end; {$ELSE} - {$MESSAGE WARN 'Needs review for x64'} + Params[I] := TValue.From(APointer); {$ENDIF ~CPU64} end; else @@ -1901,13 +1917,29 @@ case ResTyp of varSmallint: - Result := wFunc; + {$IFNDEF CPU64} + Result := wFunc(); + {$ELSE} + Result := System.Rtti.Invoke(@Func, Params, System.TypInfo.TCallConv.ccStdCall, TypeInfo(SmallInt), True).AsType<SmallInt>(); + {$ENDIF ~CPU64} varInteger: - Result := iFunc; + {$IFNDEF CPU64} + Result := iFunc(); + {$ELSE} + Result := System.Rtti.Invoke(@Func, Params, System.TypInfo.TCallConv.ccStdCall, TypeInfo(Integer), True).AsType<Integer>(); + {$ENDIF ~CPU64} varBoolean: - Result := Boolean(Ord(fFunc)); + {$IFNDEF CPU64} + Result := Boolean(Ord(fFunc())); + {$ELSE} + Result := Boolean(Ord(System.Rtti.Invoke(@Func, Params, System.TypInfo.TCallConv.ccStdCall, TypeInfo(Boolean), True).AsType<Boolean>())); + {$ENDIF ~CPU64} varEmpty: - Func; + {$IFNDEF CPU64} + Func(); + {$ELSE} + System.Rtti.Invoke(@Func, Params, System.TypInfo.TCallConv.ccStdCall, nil, True); + {$ENDIF ~CPU64} else JvInterpreterErrorN(ieDllInvalidResult, -1, FuncName); end; @@ -3799,10 +3831,16 @@ AWord: Word; iRes: Integer; Func: Pointer; + {$IFNDEF CPU64} RegEAX, RegEDX, RegECX: Integer; + {$ELSE} + Params: TArray<System.Rtti.TValue>; + {$ENDIF ~CPU64} begin Result := False; + {$IFNDEF CPU64} iRes := 0; + {$ENDIF ~CPU64} for I := 0 to FDirectGetList.Count - 1 do begin JvInterpreterMethod := TJvInterpreterDMethod(FDirectGetList[I]); @@ -3817,6 +3855,7 @@ Args.Identifier := Identifier; CheckAction(Expression, Args, JvInterpreterMethod.Data); CheckArgs(Args, JvInterpreterMethod.ParamCount, JvInterpreterMethod.ParamTypes); + {$IFNDEF CPU64} if ccFastCall in JvInterpreterMethod.CallConvention then begin { !!! Delphi fast-call !!! } @@ -3828,25 +3867,17 @@ (JvInterpreterMethod.ParamTypes[J] = varBoolean) {?} then begin AInt := Args.Values[J]; - {$IFNDEF CPU64} asm push AInt end; - {$ELSE} - {$MESSAGE WARN 'Needs review for x64'} - {$ENDIF ~CPU64} end else if JvInterpreterMethod.ParamTypes[J] = varSmallint then begin AWord := Word(Args.Values[J]); - {$IFNDEF CPU64} asm push AWord end; - {$ELSE} - {$MESSAGE WARN 'Needs review for x64'} - {$ENDIF ~CPU64} end else JvInterpreterErrorN(ieDirectInvalidArgument, -1, Identifier); @@ -3880,7 +3911,6 @@ (JvInterpreterMethod.ResTyp = varEmpty) or (JvInterpreterMethod.ResTyp = varObject) or (JvInterpreterMethod.ResTyp = varPointer) then - {$IFNDEF CPU64} asm mov EAX, RegEAX mov EDX, RegEDX @@ -3888,13 +3918,35 @@ call Func mov iRes, EAX end - {$ELSE} - begin - end - {$MESSAGE WARN 'Needs review for x64'} - {$ENDIF ~CPU64} else JvInterpreterErrorN(ieDirectInvalidResult, -1, Identifier); + {$ELSE} + SetLength(Params, 1 + JvInterpreterMethod.ParamCount); + Params[0] := TValue.From(Args.Obj); + for J := 0 to JvInterpreterMethod.ParamCount - 1 do + begin + if (JvInterpreterMethod.ParamTypes[J] = varInteger) or + (JvInterpreterMethod.ParamTypes[J] = varBoolean) {?} then + begin + AInt := Args.Values[J]; + Params[1 + J] := TValue.From(AInt); + end + else if JvInterpreterMethod.ParamTypes[J] = varSmallint then + begin + AWord := Word(Args.Values[J]); + Params[1 + J] := TValue.From(AWord); + end + else if (JvInterpreterMethod.ParamTypes[J] = varObject) or + (JvInterpreterMethod.ParamTypes[J] = varString) or + (JvInterpreterMethod.ParamTypes[J] = varPointer) then + begin + Params[1 + J] := TValue.From(TVarData(Args.Values[J]).VPointer); + end + else + JvInterpreterErrorN(ieDirectInvalidArgument, -1, Identifier); + end; + iRes := System.Rtti.Invoke(Func, Params, System.TypInfo.TCallConv.ccReg, TypeInfo(Integer), False).AsType<Integer>(); + {$ENDIF ~CPU64} { clear result } if (JvInterpreterMethod.ResTyp = varInteger) or @@ -3912,9 +3964,11 @@ else if JvInterpreterMethod.ResTyp = varEmpty then Value := Null; + {$IFNDEF CPU64} end else JvInterpreterErrorN(ieDirectInvalidConvention, -1, Identifier); + {$ENDIF ~CPU64} Result := True; Exit; end; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2012-09-25 08:05:44
|
Revision: 13448 http://jvcl.svn.sourceforge.net/jvcl/?rev=13448&view=rev Author: ahuser Date: 2012-09-25 08:05:34 +0000 (Tue, 25 Sep 2012) Log Message: ----------- Mantis #5984: TJvInterpreterExpression not support Int64 Modified Paths: -------------- trunk/jvcl/run/JvInterpreter.pas Modified: trunk/jvcl/run/JvInterpreter.pas =================================================================== --- trunk/jvcl/run/JvInterpreter.pas 2012-09-24 20:16:12 UTC (rev 13447) +++ trunk/jvcl/run/JvInterpreter.pas 2012-09-25 08:05:34 UTC (rev 13448) @@ -5149,6 +5149,7 @@ {$ENDIF DELPHI7_UP} Dob: Extended; Int: Integer; + ValueInt64: Int64; Stub: Integer; begin FTokenStr := FParser.Token; @@ -5157,7 +5158,15 @@ ttInteger: begin Val(FTokenStr, Int, Stub); - FToken := Int; + if Stub <> 0 then + begin + Val(FTokenStr, ValueInt64, Stub); + FToken := ValueInt64; + if Stub <> 0 then + JvInterpreterError(ieIntegerRequired, FParser.Pos); + end + else + FToken := Int; end; ttDouble: begin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2013-05-23 16:54:36
|
Revision: 13515 http://jvcl.svn.sourceforge.net/jvcl/?rev=13515&view=rev Author: ahuser Date: 2013-05-23 16:54:27 +0000 (Thu, 23 May 2013) Log Message: ----------- Mantis #6142: TJvInterpreterIdentifierList.Sort not work in delphi x64 Modified Paths: -------------- trunk/jvcl/run/JvInterpreter.pas Modified: trunk/jvcl/run/JvInterpreter.pas =================================================================== --- trunk/jvcl/run/JvInterpreter.pas 2013-05-21 15:59:14 UTC (rev 13514) +++ trunk/jvcl/run/JvInterpreter.pas 2013-05-23 16:54:27 UTC (rev 13515) @@ -2870,22 +2870,21 @@ Index := L; end; -procedure TJvInterpreterIdentifierList.Sort(Compare: TListSortCompare = nil); +function SortIdentifier(Item1, Item2: Pointer): Integer; +begin + { function AnsiStrIComp about 30% faster than AnsiCompareText } + { Result := AnsiCompareText(TJvInterpreterIdentifier(Item1).Identifier, + TJvInterpreterIdentifier(Item2).Identifier); } + Result := AnsiStrIComp(PChar(TJvInterpreterIdentifier(Item1).Identifier), + PChar(TJvInterpreterIdentifier(Item2).Identifier)); +end; - function SortIdentifier(Item1, Item2: Pointer): Integer; - begin - { function AnsiStrIComp about 30% faster than AnsiCompareText } - { Result := AnsiCompareText(TJvInterpreterIdentifier(Item1).Identifier, - TJvInterpreterIdentifier(Item2).Identifier); } - Result := AnsiStrIComp(PChar(TJvInterpreterIdentifier(Item1).Identifier), - PChar(TJvInterpreterIdentifier(Item2).Identifier)); - end; - +procedure TJvInterpreterIdentifierList.Sort(Compare: TListSortCompare = nil); begin if Assigned(Compare) then inherited Sort(Compare) else - inherited Sort(TListSortCompare(@SortIdentifier)); + inherited Sort(SortIdentifier); end; function TJvInterpreterIdentifierList.IndexOf(const UnitName, Identifier: string): TJvInterpreterIdentifier; @@ -8205,7 +8204,7 @@ //=== { TJvInterpreterMethodList } =========================================== -function SortIdentifier(Item1, Item2: Pointer): Integer; +function SortMethodIdentifier(Item1, Item2: Pointer): Integer; begin { function AnsiStrIComp about 30% faster than AnsiCompareText } { Result := AnsiCompareText(TJvInterpreterIdentifier(Item1).Identifier, @@ -8225,7 +8224,7 @@ procedure TJvInterpreterMethodList.Sort(Compare: TListSortCompare); begin - inherited Sort(SortIdentifier); + inherited Sort(SortMethodIdentifier); end; //=== { TJvInterpreterRecord } =============================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |