|
@@ -121,9 +121,11 @@ interface
|
|
value_str : pchar;
|
|
value_str : pchar;
|
|
len : longint;
|
|
len : longint;
|
|
lab_str : tasmlabel;
|
|
lab_str : tasmlabel;
|
|
|
|
+ astringdef : tdef;
|
|
|
|
+ astringdefderef : tderef;
|
|
cst_type : tconststringtype;
|
|
cst_type : tconststringtype;
|
|
constructor createstr(const s : string);virtual;
|
|
constructor createstr(const s : string);virtual;
|
|
- constructor createpchar(s : pchar;l : longint);virtual;
|
|
|
|
|
|
+ constructor createpchar(s: pchar; l: longint; def: tdef);virtual;
|
|
constructor createunistr(w : pcompilerwidestring);virtual;
|
|
constructor createunistr(w : pcompilerwidestring);virtual;
|
|
constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
|
|
constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
|
|
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
|
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
|
@@ -309,7 +311,7 @@ implementation
|
|
getmem(pc,len+1);
|
|
getmem(pc,len+1);
|
|
move(pchar(p.value.valueptr)^,pc^,len);
|
|
move(pchar(p.value.valueptr)^,pc^,len);
|
|
pc[len]:=#0;
|
|
pc[len]:=#0;
|
|
- p1:=cstringconstnode.createpchar(pc,len);
|
|
|
|
|
|
+ p1:=cstringconstnode.createpchar(pc,len,p.constdef);
|
|
end;
|
|
end;
|
|
constwstring :
|
|
constwstring :
|
|
p1:=cstringconstnode.createunistr(pcompilerwidestring(p.value.valueptr));
|
|
p1:=cstringconstnode.createunistr(pcompilerwidestring(p.value.valueptr));
|
|
@@ -827,12 +829,19 @@ implementation
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
- constructor tstringconstnode.createpchar(s : pchar;l : longint);
|
|
|
|
|
|
+ constructor tstringconstnode.createpchar(s: pchar; l: longint; def: tdef);
|
|
begin
|
|
begin
|
|
inherited create(stringconstn);
|
|
inherited create(stringconstn);
|
|
len:=l;
|
|
len:=l;
|
|
value_str:=s;
|
|
value_str:=s;
|
|
- cst_type:=cst_conststring;
|
|
|
|
|
|
+ if assigned(def) and
|
|
|
|
+ is_ansistring(def) then
|
|
|
|
+ begin
|
|
|
|
+ cst_type:=cst_ansistring;
|
|
|
|
+ astringdef:=def;
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ cst_type:=cst_conststring;
|
|
lab_str:=nil;
|
|
lab_str:=nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -880,6 +889,8 @@ implementation
|
|
value_str[len]:=#0;
|
|
value_str[len]:=#0;
|
|
end;
|
|
end;
|
|
lab_str:=tasmlabel(ppufile.getasmsymbol);
|
|
lab_str:=tasmlabel(ppufile.getasmsymbol);
|
|
|
|
+ if cst_type=cst_ansistring then
|
|
|
|
+ ppufile.getderef(astringdefderef);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -893,18 +904,22 @@ implementation
|
|
else
|
|
else
|
|
ppufile.putdata(value_str^,len);
|
|
ppufile.putdata(value_str^,len);
|
|
ppufile.putasmsymbol(lab_str);
|
|
ppufile.putasmsymbol(lab_str);
|
|
|
|
+ if cst_type=cst_ansistring then
|
|
|
|
+ ppufile.putderef(astringdefderef);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure tstringconstnode.buildderefimpl;
|
|
procedure tstringconstnode.buildderefimpl;
|
|
begin
|
|
begin
|
|
inherited buildderefimpl;
|
|
inherited buildderefimpl;
|
|
|
|
+ astringdefderef.build(astringdef);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure tstringconstnode.derefimpl;
|
|
procedure tstringconstnode.derefimpl;
|
|
begin
|
|
begin
|
|
inherited derefimpl;
|
|
inherited derefimpl;
|
|
|
|
+ astringdef:=tdef(astringdefderef.resolve);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -925,6 +940,7 @@ implementation
|
|
end
|
|
end
|
|
else
|
|
else
|
|
n.value_str:=getpcharcopy;
|
|
n.value_str:=getpcharcopy;
|
|
|
|
+ n.astringdef:=astringdef;
|
|
dogetcopy:=n;
|
|
dogetcopy:=n;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -948,7 +964,10 @@ implementation
|
|
cst_shortstring :
|
|
cst_shortstring :
|
|
resultdef:=cshortstringtype;
|
|
resultdef:=cshortstringtype;
|
|
cst_ansistring :
|
|
cst_ansistring :
|
|
- resultdef:=getansistringdef;
|
|
|
|
|
|
+ if not assigned(astringdef) then
|
|
|
|
+ resultdef:=getansistringdef
|
|
|
|
+ else
|
|
|
|
+ resultdef:=astringdef;
|
|
cst_unicodestring :
|
|
cst_unicodestring :
|
|
resultdef:=cunicodestringtype;
|
|
resultdef:=cunicodestringtype;
|
|
cst_widestring :
|
|
cst_widestring :
|