Closed GoogleCodeExporter closed 9 years ago
Works for me (Windows 7 64bit, delphi 7)
Try attached dlls.
Original comment by Dusan.Ha...@gmail.com
on 4 Jul 2012 at 5:50
Attachments:
[deleted comment]
Thanks a lot for your feedback. I found the problem:
I made some comments in the function JSValToInt
function JSValToInt(val: jsval): Integer;
begin
Result := val shr 1;
//shr doesn't handle signed types in the same way as C. If the source was
//negative then merge in the missing 1 in position 31.
//{$IFDEF FPC} ****COMMENT
if val < 0 then
Result := Result-maxint-1;
//{$ELSE} ****COMMENT
//if val < 0 then
//Result := -Result;
//{$ENDIF} ****COMMENT
end;
Original comment by engma...@gmail.com
on 4 Jul 2012 at 12:40
[deleted comment]
Checkout new version, I added 4 functions to TFpcJsScript for direct typecast,
that double version works for your case.
function GetValueAsInteger(APropertyName : string) : integer;
function GetValueAsDouble(APropertyName : string) : double;
function GetValueAsString(APropertyName : string) : string;
function GetValueAsBoolean(APropertyName : string) : boolean;
I was able to reproduce it althought I'm not sure what is causing this
behaviour on delphi, I use it mostly in fpc. The results of test6 on windows
are:
USING FPC on windows:
a in script = 10
b in script = -10
a in pascal = 10
b in pascal = -10
a in pascal = 10 (AsInteger)
b in pascal = -10 (AsInteger)
integer(a) in pascal = 10 (AsInteger)
integer(b) in pascal = -10 (AsInteger)
a in pascal = 10.0000000000 (AsDouble)
b in pascal = -10.0000000000 (AsDouble)
USING DELPHI 7 on windows 7 64 bit:
a in script = 10
b in script = -2147483638
a in pascal = 10
b in pascal = -2147483638
a in pascal = 10 (AsInteger)
b in pascal = -2147483638 (AsInteger)
integer(a) in pascal = 10 (AsInteger)
integer(b) in pascal = -2147483638 (AsInteger)
a in pascal = 10.0000000000 (AsDouble)
b in pascal = -10.0000000000 (AsDouble)
Original comment by Dusan.Ha...@gmail.com
on 4 Jul 2012 at 12:50
Perfect, I commited fixed js15decl.pas, thank you very much.
Original comment by Dusan.Ha...@gmail.com
on 6 Jul 2012 at 5:45
Marking as fixed
Original comment by Dusan.Ha...@gmail.com
on 6 Jul 2012 at 5:45
Original issue reported on code.google.com by
engma...@gmail.com
on 3 Jul 2012 at 8:10