Explorar o código

* fix resourcestring assignment in typedconst

git-svn-id: trunk@7339 -
peter %!s(int64=18) %!d(string=hai) anos
pai
achega
aa72495049

+ 2 - 0
.gitattributes

@@ -8190,6 +8190,7 @@ tests/webtbs/tw8304.pp svneol=native#text/plain
 tests/webtbs/tw8312.pp svneol=native#text/plain
 tests/webtbs/tw8312.pp svneol=native#text/plain
 tests/webtbs/tw8321.pp svneol=native#text/plain
 tests/webtbs/tw8321.pp svneol=native#text/plain
 tests/webtbs/tw8371.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/tw8391.pp svneol=native#text/plain
 tests/webtbs/tw8434.pp svneol=native#text/plain
 tests/webtbs/tw8434.pp svneol=native#text/plain
 tests/webtbs/tw8462.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/uw6767.pp svneol=native#text/plain
 tests/webtbs/uw7381.pp svneol=native#text/plain
 tests/webtbs/uw7381.pp svneol=native#text/plain
 tests/webtbs/uw8180.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 svneol=native#text/plain
 utils/Makefile.fpc svneol=native#text/plain
 utils/Makefile.fpc svneol=native#text/plain
 utils/README -text
 utils/README -text

+ 1 - 1
compiler/ppu.pas

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

+ 2 - 2
compiler/ptconst.pas

@@ -512,7 +512,7 @@ implementation
                         list.concat(Tai_const.Createname(tlabelsym(srsym).mangledname,offset));
                         list.concat(Tai_const.Createname(tlabelsym(srsym).mangledname,offset));
                       constsym :
                       constsym :
                         if tconstsym(srsym).consttyp=constresourcestring then
                         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
                         else
                           Message(type_e_variable_id_expected);
                           Message(type_e_variable_id_expected);
                       else
                       else
@@ -1077,7 +1077,7 @@ implementation
                         begin
                         begin
                           flush_packed_value(list,bp);
                           flush_packed_value(list,bp);
                           curroffset:=align(curroffset,8);
                           curroffset:=align(curroffset,8);
-                        end;          
+                        end;
                       read_typed_const_data(list,tfieldvarsym(srsym).vardef);
                       read_typed_const_data(list,tfieldvarsym(srsym).vardef);
                     end
                     end
                   else
                   else

+ 0 - 8
compiler/symsym.pas

@@ -249,7 +249,6 @@ interface
           constdefderef : tderef;
           constdefderef : tderef;
           consttyp    : tconsttyp;
           consttyp    : tconsttyp;
           value       : tconstvalue;
           value       : tconstvalue;
-          resstrindex  : longint;     { needed for resource strings }
           constructor create_ord(const n : string;t : tconsttyp;v : tconstexprint;def:tdef);
           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_ordptr(const n : string;t : tconsttyp;v : tconstptruint;def:tdef);
           constructor create_ptr(const n : string;t : tconsttyp;v : pointer;def:tdef);
           constructor create_ptr(const n : string;t : tconsttyp;v : pointer;def:tdef);
@@ -1496,7 +1495,6 @@ implementation
          fillchar(value, sizeof(value), #0);
          fillchar(value, sizeof(value), #0);
          consttyp:=t;
          consttyp:=t;
          value.valueord:=v;
          value.valueord:=v;
-         ResStrIndex:=0;
          constdef:=def;
          constdef:=def;
       end;
       end;
 
 
@@ -1507,7 +1505,6 @@ implementation
          fillchar(value, sizeof(value), #0);
          fillchar(value, sizeof(value), #0);
          consttyp:=t;
          consttyp:=t;
          value.valueordptr:=v;
          value.valueordptr:=v;
-         ResStrIndex:=0;
          constdef:=def;
          constdef:=def;
       end;
       end;
 
 
@@ -1518,7 +1515,6 @@ implementation
          fillchar(value, sizeof(value), #0);
          fillchar(value, sizeof(value), #0);
          consttyp:=t;
          consttyp:=t;
          value.valueptr:=v;
          value.valueptr:=v;
-         ResStrIndex:=0;
          constdef:=def;
          constdef:=def;
       end;
       end;
 
 
@@ -1580,8 +1576,6 @@ implementation
                value.len:=ppufile.getlongint;
                value.len:=ppufile.getlongint;
                getmem(pc,value.len+1);
                getmem(pc,value.len+1);
                ppufile.getdata(pc^,value.len);
                ppufile.getdata(pc^,value.len);
-               if consttyp=constresourcestring then
-                 ResStrIndex:=ppufile.getlongint;
                value.valueptr:=pc;
                value.valueptr:=pc;
              end;
              end;
            constreal :
            constreal :
@@ -1668,8 +1662,6 @@ implementation
              begin
              begin
                ppufile.putlongint(value.len);
                ppufile.putlongint(value.len);
                ppufile.putdata(pchar(value.valueptr)^,value.len);
                ppufile.putdata(pchar(value.valueptr)^,value.len);
-               if consttyp=constresourcestring then
-                 ppufile.putlongint(ResStrIndex);
              end;
              end;
            constreal :
            constreal :
              ppufile.putreal(pbestreal(value.valueptr)^);
              ppufile.putreal(pbestreal(value.valueptr)^);

+ 0 - 2
compiler/utils/ppudump.pp

@@ -1471,8 +1471,6 @@ begin
                    writeln(space,'       Length : ',len);
                    writeln(space,'       Length : ',len);
                    writeln(space,'        Value : "',pc,'"');
                    writeln(space,'        Value : "',pc,'"');
                    freemem(pc,len+1);
                    freemem(pc,len+1);
-                   if tconsttyp(b)=constresourcestring then
-                    writeln(space,'        Index : ',getlongint);
                  end;
                  end;
                constreal :
                constreal :
                  writeln(space,'        Value : ',getreal);
                  writeln(space,'        Value : ',getreal);

+ 13 - 0
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.

+ 15 - 0
tests/webtbs/uw8372.pp

@@ -0,0 +1,15 @@
+unit uw8372;
+
+{$mode delphi}
+
+interface
+
+resourcestring
+  sChromatogram='Chromatogram';
+
+var
+  ps:PResStringRec=@sChromatogram;
+
+
+implementation
+end.