From 57acf676590c1ecc8bec0e721213fb4ee3ff988c Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 2 Dec 2007 20:43:08 +0000 Subject: [PATCH] + constant unicodestrings git-svn-id: trunk@9385 - --- compiler/ncon.pas | 14 +++++++------- compiler/nmem.pas | 1 + compiler/ptconst.pas | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/compiler/ncon.pas b/compiler/ncon.pas index 3053c8fb5b..964ae45259 100644 --- a/compiler/ncon.pas +++ b/compiler/ncon.pas @@ -766,7 +766,7 @@ implementation destructor tstringconstnode.destroy; begin - if cst_type=cst_widestring then + if cst_type in [cst_widestring,cst_unicodestring] then donewidestring(pcompilerwidestring(value_str)) else ansistringdispose(value_str,len); @@ -781,7 +781,7 @@ implementation inherited ppuload(t,ppufile); cst_type:=tconststringtype(ppufile.getbyte); len:=ppufile.getlongint; - if cst_type=cst_widestring then + if cst_type in [cst_widestring,cst_unicodestring] then begin initwidestring(pw); setlengthwidestring(pw,len); @@ -803,7 +803,7 @@ implementation inherited ppuwrite(ppufile); ppufile.putbyte(byte(cst_type)); 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)) else ppufile.putdata(value_str^,len); @@ -833,7 +833,7 @@ implementation n.cst_type:=cst_type; n.len:=len; n.lab_str:=lab_str; - if cst_type=cst_widestring then + if cst_type in [cst_widestring,cst_unicodestring] then begin initwidestring(pcompilerwidestring(n.value_str)); copywidestring(pcompilerwidestring(value_str),pcompilerwidestring(n.value_str)); @@ -864,6 +864,7 @@ implementation resultdef:=cshortstringtype; cst_ansistring : resultdef:=cansistringtype; + cst_unicodestring, cst_widestring : resultdef:=cwidestringtype; cst_longstring : @@ -874,7 +875,7 @@ implementation function tstringconstnode.pass_1 : tnode; begin 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 expectloc:=LOC_CONSTANT else @@ -909,8 +910,7 @@ implementation procedure tstringconstnode.changestringtype(def:tdef); const 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 pw : pcompilerwidestring; pc : pchar; diff --git a/compiler/nmem.pas b/compiler/nmem.pas index b86146398c..6918b66bd5 100644 --- a/compiler/nmem.pas +++ b/compiler/nmem.pas @@ -781,6 +781,7 @@ implementation stringdef : begin case tstringdef(left.resultdef).stringtype of + st_unicodestring, st_widestring : elementdef:=cwidechartype; st_ansistring : diff --git a/compiler/ptconst.pas b/compiler/ptconst.pas index bc9e208258..5abfdbf414 100644 --- a/compiler/ptconst.pas +++ b/compiler/ptconst.pas @@ -718,6 +718,7 @@ implementation current_asmdata.asmlists[al_const].concat(Tai_string.Create_pchar(ca,strlength+1)); end; end; + st_unicodestring, st_widestring: begin { an empty ansi string is nil! } @@ -730,7 +731,7 @@ implementation current_asmdata.getdatalabel(ll2); current_asmdata.asmlists[al_const].concat(tai_align.create(const_align(sizeof(aint)))); 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)) else begin