Browse Source

+ constant unicodestrings

git-svn-id: trunk@9385 -
florian 17 years ago
parent
commit
57acf67659
3 changed files with 10 additions and 8 deletions
  1. 7 7
      compiler/ncon.pas
  2. 1 0
      compiler/nmem.pas
  3. 2 1
      compiler/ptconst.pas

+ 7 - 7
compiler/ncon.pas

@@ -766,7 +766,7 @@ implementation
 
 
     destructor tstringconstnode.destroy;
     destructor tstringconstnode.destroy;
       begin
       begin
-        if cst_type=cst_widestring then
+        if cst_type in [cst_widestring,cst_unicodestring] then
           donewidestring(pcompilerwidestring(value_str))
           donewidestring(pcompilerwidestring(value_str))
         else
         else
           ansistringdispose(value_str,len);
           ansistringdispose(value_str,len);
@@ -781,7 +781,7 @@ implementation
         inherited ppuload(t,ppufile);
         inherited ppuload(t,ppufile);
         cst_type:=tconststringtype(ppufile.getbyte);
         cst_type:=tconststringtype(ppufile.getbyte);
         len:=ppufile.getlongint;
         len:=ppufile.getlongint;
-        if cst_type=cst_widestring then
+        if cst_type in [cst_widestring,cst_unicodestring] then
           begin
           begin
             initwidestring(pw);
             initwidestring(pw);
             setlengthwidestring(pw,len);
             setlengthwidestring(pw,len);
@@ -803,7 +803,7 @@ implementation
         inherited ppuwrite(ppufile);
         inherited ppuwrite(ppufile);
         ppufile.putbyte(byte(cst_type));
         ppufile.putbyte(byte(cst_type));
         ppufile.putlongint(len);
         ppufile.putlongint(len);
-        if cst_type=cst_widestring then
+        if cst_type in [cst_widestring,cst_unicodestring] then
           ppufile.putdata(pcompilerwidestring(value_str)^.data,len*sizeof(tcompilerwidechar))
           ppufile.putdata(pcompilerwidestring(value_str)^.data,len*sizeof(tcompilerwidechar))
         else
         else
           ppufile.putdata(value_str^,len);
           ppufile.putdata(value_str^,len);
@@ -833,7 +833,7 @@ implementation
          n.cst_type:=cst_type;
          n.cst_type:=cst_type;
          n.len:=len;
          n.len:=len;
          n.lab_str:=lab_str;
          n.lab_str:=lab_str;
-         if cst_type=cst_widestring then
+         if cst_type in [cst_widestring,cst_unicodestring] then
            begin
            begin
              initwidestring(pcompilerwidestring(n.value_str));
              initwidestring(pcompilerwidestring(n.value_str));
              copywidestring(pcompilerwidestring(value_str),pcompilerwidestring(n.value_str));
              copywidestring(pcompilerwidestring(value_str),pcompilerwidestring(n.value_str));
@@ -864,6 +864,7 @@ implementation
             resultdef:=cshortstringtype;
             resultdef:=cshortstringtype;
           cst_ansistring :
           cst_ansistring :
             resultdef:=cansistringtype;
             resultdef:=cansistringtype;
+          cst_unicodestring,
           cst_widestring :
           cst_widestring :
             resultdef:=cwidestringtype;
             resultdef:=cwidestringtype;
           cst_longstring :
           cst_longstring :
@@ -874,7 +875,7 @@ implementation
     function tstringconstnode.pass_1 : tnode;
     function tstringconstnode.pass_1 : tnode;
       begin
       begin
         result:=nil;
         result:=nil;
-        if (cst_type in [cst_ansistring,cst_widestring]) and
+        if (cst_type in [cst_ansistring,cst_widestring,cst_unicodestring]) and
            (len=0) then
            (len=0) then
          expectloc:=LOC_CONSTANT
          expectloc:=LOC_CONSTANT
         else
         else
@@ -909,8 +910,7 @@ implementation
     procedure tstringconstnode.changestringtype(def:tdef);
     procedure tstringconstnode.changestringtype(def:tdef);
       const
       const
         st2cst : array[tstringtype] of tconststringtype = (
         st2cst : array[tstringtype] of tconststringtype = (
-          cst_shortstring,cst_longstring,cst_ansistring,cst_widestring,cst_unicodestring
-        );
+          cst_shortstring,cst_longstring,cst_ansistring,cst_widestring,cst_unicodestring);
       var
       var
         pw : pcompilerwidestring;
         pw : pcompilerwidestring;
         pc : pchar;
         pc : pchar;

+ 1 - 0
compiler/nmem.pas

@@ -781,6 +781,7 @@ implementation
            stringdef :
            stringdef :
              begin
              begin
                 case tstringdef(left.resultdef).stringtype of
                 case tstringdef(left.resultdef).stringtype of
+                  st_unicodestring,
                   st_widestring :
                   st_widestring :
                     elementdef:=cwidechartype;
                     elementdef:=cwidechartype;
                   st_ansistring :
                   st_ansistring :

+ 2 - 1
compiler/ptconst.pas

@@ -718,6 +718,7 @@ implementation
                          current_asmdata.asmlists[al_const].concat(Tai_string.Create_pchar(ca,strlength+1));
                          current_asmdata.asmlists[al_const].concat(Tai_string.Create_pchar(ca,strlength+1));
                        end;
                        end;
                   end;
                   end;
+                st_unicodestring,
                 st_widestring:
                 st_widestring:
                   begin
                   begin
                      { an empty ansi string is nil! }
                      { an empty ansi string is nil! }
@@ -730,7 +731,7 @@ implementation
                          current_asmdata.getdatalabel(ll2);
                          current_asmdata.getdatalabel(ll2);
                          current_asmdata.asmlists[al_const].concat(tai_align.create(const_align(sizeof(aint))));
                          current_asmdata.asmlists[al_const].concat(tai_align.create(const_align(sizeof(aint))));
                          current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll2));
                          current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll2));
-                         if tf_winlikewidestring in target_info.flags then
+                         if (def.stringtype=st_widestring) and (tf_winlikewidestring in target_info.flags) then
                            current_asmdata.asmlists[al_const].concat(Tai_const.Create_32bit(strlength*cwidechartype.size))
                            current_asmdata.asmlists[al_const].concat(Tai_const.Create_32bit(strlength*cwidechartype.size))
                          else
                          else
                            begin
                            begin