* added support for very big/small currency constants for non x86 CPUs.

git-svn-id: trunk@5937 -
This commit is contained in:
yury 2007-01-13 12:12:20 +00:00
parent e5dd51c95b
commit bcd86ef782
5 changed files with 18 additions and 2 deletions

View File

@ -54,6 +54,7 @@ interface
typedef : tdef;
typedefderef : tderef;
value_real : bestreal;
value_currency : currency;
lab_real : tasmlabel;
constructor create(v : bestreal;def:tdef);virtual;
constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
@ -472,14 +473,19 @@ implementation
inherited create(realconstn);
typedef:=def;
value_real:=v;
value_currency:=v;
lab_real:=nil;
end;
constructor trealconstnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
var
i : int64;
begin
inherited ppuload(t,ppufile);
ppufile.getderef(typedefderef);
value_real:=ppufile.getreal;
i:=ppufile.getint64;
value_currency:=PCurrency(@i)^;
lab_real:=tasmlabel(ppufile.getasmsymbol);
end;
@ -489,6 +495,7 @@ implementation
inherited ppuwrite(ppufile);
ppufile.putderef(typedefderef);
ppufile.putreal(value_real);
ppufile.putint64(PInt64(@value_currency)^);
ppufile.putasmsymbol(lab_real);
end;
@ -513,6 +520,7 @@ implementation
begin
n:=trealconstnode(inherited dogetcopy);
n.value_real:=value_real;
n.value_currency:=value_currency;
n.lab_real:=lab_real;
dogetcopy:=n;
end;

View File

@ -605,6 +605,7 @@ implementation
if is_constrealnode(left) then
begin
trealconstnode(left).value_real:=-trealconstnode(left).value_real;
trealconstnode(left).value_currency:=-trealconstnode(left).value_currency;
result:=left;
left:=nil;
exit;

View File

@ -2198,6 +2198,7 @@ implementation
pd : tprocdef;
hclassdef : tobjectdef;
d : bestreal;
cur : currency;
hs,hsorg : string;
hdef : tdef;
filepos : tfileposinfo;
@ -2446,6 +2447,11 @@ implementation
else
{$endif FPC_REAL2REAL_FIXED}
p1:=crealconstnode.create(d,pbestrealtype^);
{$ifdef FPC_HAS_STR_CURRENCY}
val(pattern,cur,code);
if code=0 then
trealconstnode(p1).value_currency:=cur;
{$endif FPC_HAS_STR_CURRENCY}
end;
_STRING :
@ -2595,6 +2601,7 @@ implementation
else if tbinarynode(p1).left.nodetype=realconstn then
begin
trealconstnode(tbinarynode(p1).left).value_real:=-trealconstnode(tbinarynode(p1).left).value_real;
trealconstnode(tbinarynode(p1).left).value_currency:=-trealconstnode(tbinarynode(p1).left).value_currency;
p1:=cunaryminusnode.create(p1);
end
else

View File

@ -43,7 +43,7 @@ type
{$endif Test_Double_checksum}
const
CurrentPPUVersion=72;
CurrentPPUVersion=73;
{ buffer sizes }
maxentrysize = 1024;

View File

@ -131,7 +131,7 @@ implementation
intvalue := tordconstnode(n).value
{ allow bootstrapping }
else if is_constrealnode(n) then
intvalue:=round(trealconstnode(n).value_real*10000)
intvalue:=PInt64(@trealconstnode(n).value_currency)^
else
begin
intvalue:=0;