From aa72495049d4db866631578c9ced9621d8271c5f Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 15 May 2007 06:52:36 +0000 Subject: [PATCH] * fix resourcestring assignment in typedconst git-svn-id: trunk@7339 - --- .gitattributes | 2 ++ compiler/ppu.pas | 2 +- compiler/ptconst.pas | 4 ++-- compiler/symsym.pas | 8 -------- compiler/utils/ppudump.pp | 2 -- tests/webtbs/tw8372.pp | 13 +++++++++++++ tests/webtbs/uw8372.pp | 15 +++++++++++++++ 7 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 tests/webtbs/tw8372.pp create mode 100644 tests/webtbs/uw8372.pp diff --git a/.gitattributes b/.gitattributes index 03fc400540..2720e59925 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8190,6 +8190,7 @@ tests/webtbs/tw8304.pp svneol=native#text/plain tests/webtbs/tw8312.pp svneol=native#text/plain tests/webtbs/tw8321.pp svneol=native#text/plain tests/webtbs/tw8371.pp svneol=native#text/plain +tests/webtbs/tw8372.pp svneol=native#text/plain tests/webtbs/tw8391.pp svneol=native#text/plain tests/webtbs/tw8434.pp svneol=native#text/plain tests/webtbs/tw8462.pp svneol=native#text/plain @@ -8260,6 +8261,7 @@ tests/webtbs/uw6203.pp svneol=native#text/plain tests/webtbs/uw6767.pp svneol=native#text/plain tests/webtbs/uw7381.pp svneol=native#text/plain tests/webtbs/uw8180.pp svneol=native#text/plain +tests/webtbs/uw8372.pp svneol=native#text/plain utils/Makefile svneol=native#text/plain utils/Makefile.fpc svneol=native#text/plain utils/README -text diff --git a/compiler/ppu.pas b/compiler/ppu.pas index 9d83aff0db..b8a5b987ee 100644 --- a/compiler/ppu.pas +++ b/compiler/ppu.pas @@ -43,7 +43,7 @@ type {$endif Test_Double_checksum} const - CurrentPPUVersion=78; + CurrentPPUVersion=79; { buffer sizes } maxentrysize = 1024; diff --git a/compiler/ptconst.pas b/compiler/ptconst.pas index 6c47234a0b..1de1cac1ee 100644 --- a/compiler/ptconst.pas +++ b/compiler/ptconst.pas @@ -512,7 +512,7 @@ implementation list.concat(Tai_const.Createname(tlabelsym(srsym).mangledname,offset)); constsym : if tconstsym(srsym).consttyp=constresourcestring then - list.concat(Tai_const.Createname(make_mangledname('RESOURCESTRINGLIST',tconstsym(srsym).owner,''),tconstsym(srsym).resstrindex*(4+sizeof(aint)*3)+4+sizeof(aint))) + list.concat(Tai_const.Createname(make_mangledname('RESSTR',tconstsym(srsym).owner,tconstsym(srsym).name),sizeof(aint))) else Message(type_e_variable_id_expected); else @@ -1077,7 +1077,7 @@ implementation begin flush_packed_value(list,bp); curroffset:=align(curroffset,8); - end; + end; read_typed_const_data(list,tfieldvarsym(srsym).vardef); end else diff --git a/compiler/symsym.pas b/compiler/symsym.pas index 2c9859fc84..0fcc854c08 100644 --- a/compiler/symsym.pas +++ b/compiler/symsym.pas @@ -249,7 +249,6 @@ interface constdefderef : tderef; consttyp : tconsttyp; value : tconstvalue; - resstrindex : longint; { needed for resource strings } constructor create_ord(const n : string;t : tconsttyp;v : tconstexprint;def:tdef); constructor create_ordptr(const n : string;t : tconsttyp;v : tconstptruint;def:tdef); constructor create_ptr(const n : string;t : tconsttyp;v : pointer;def:tdef); @@ -1496,7 +1495,6 @@ implementation fillchar(value, sizeof(value), #0); consttyp:=t; value.valueord:=v; - ResStrIndex:=0; constdef:=def; end; @@ -1507,7 +1505,6 @@ implementation fillchar(value, sizeof(value), #0); consttyp:=t; value.valueordptr:=v; - ResStrIndex:=0; constdef:=def; end; @@ -1518,7 +1515,6 @@ implementation fillchar(value, sizeof(value), #0); consttyp:=t; value.valueptr:=v; - ResStrIndex:=0; constdef:=def; end; @@ -1580,8 +1576,6 @@ implementation value.len:=ppufile.getlongint; getmem(pc,value.len+1); ppufile.getdata(pc^,value.len); - if consttyp=constresourcestring then - ResStrIndex:=ppufile.getlongint; value.valueptr:=pc; end; constreal : @@ -1668,8 +1662,6 @@ implementation begin ppufile.putlongint(value.len); ppufile.putdata(pchar(value.valueptr)^,value.len); - if consttyp=constresourcestring then - ppufile.putlongint(ResStrIndex); end; constreal : ppufile.putreal(pbestreal(value.valueptr)^); diff --git a/compiler/utils/ppudump.pp b/compiler/utils/ppudump.pp index 33508abbfc..0a33e98f79 100644 --- a/compiler/utils/ppudump.pp +++ b/compiler/utils/ppudump.pp @@ -1471,8 +1471,6 @@ begin writeln(space,' Length : ',len); writeln(space,' Value : "',pc,'"'); freemem(pc,len+1); - if tconsttyp(b)=constresourcestring then - writeln(space,' Index : ',getlongint); end; constreal : writeln(space,' Value : ',getreal); diff --git a/tests/webtbs/tw8372.pp b/tests/webtbs/tw8372.pp new file mode 100644 index 0000000000..3d08059171 --- /dev/null +++ b/tests/webtbs/tw8372.pp @@ -0,0 +1,13 @@ +program a; + +{$APPTYPE CONSOLE} +{$IFDEF fpc} + {$mode delphi} +{$ENDIF} +{$H+} + +uses SysUtils,uw8372; + +begin + writeln(sChromatogram); +end. \ No newline at end of file diff --git a/tests/webtbs/uw8372.pp b/tests/webtbs/uw8372.pp new file mode 100644 index 0000000000..b4326ba83c --- /dev/null +++ b/tests/webtbs/uw8372.pp @@ -0,0 +1,15 @@ +unit uw8372; + +{$mode delphi} + +interface + +resourcestring + sChromatogram='Chromatogram'; + +var + ps:PResStringRec=@sChromatogram; + + +implementation +end.