|
@@ -573,6 +573,7 @@ implementation
|
|
constreal,
|
|
constreal,
|
|
constset,
|
|
constset,
|
|
constresourcestring,
|
|
constresourcestring,
|
|
|
|
+ constwresourcestring,
|
|
constwstring,
|
|
constwstring,
|
|
constguid: begin
|
|
constguid: begin
|
|
if value1.len<>value2.len then
|
|
if value1.len<>value2.len then
|
|
@@ -2675,6 +2676,28 @@ implementation
|
|
pc : pchar;
|
|
pc : pchar;
|
|
pw : pcompilerwidestring;
|
|
pw : pcompilerwidestring;
|
|
i : longint;
|
|
i : longint;
|
|
|
|
+
|
|
|
|
+ procedure do_widestring_const;
|
|
|
|
+ var
|
|
|
|
+ i : longint;
|
|
|
|
+ begin
|
|
|
|
+ initwidestring(pw);
|
|
|
|
+ setlengthwidestring(pw,ppufile.getlongint);
|
|
|
|
+ { don't use getdata, because the compilerwidechars may have to
|
|
|
|
+ be byteswapped
|
|
|
|
+ }
|
|
|
|
+{$if sizeof(tcompilerwidechar) = 2}
|
|
|
|
+ for i:=0 to pw^.len-1 do
|
|
|
|
+ pw^.data[i]:=ppufile.getword;
|
|
|
|
+{$elseif sizeof(tcompilerwidechar) = 4}
|
|
|
|
+ for i:=0 to pw^.len-1 do
|
|
|
|
+ pw^.data[i]:=cardinal(ppufile.getlongint);
|
|
|
|
+{$else}
|
|
|
|
+ {$error Unsupported tcompilerwidechar size}
|
|
|
|
+{$endif}
|
|
|
|
+ pcompilerwidestring(value.valueptr):=pw;
|
|
|
|
+ end;
|
|
|
|
+
|
|
begin
|
|
begin
|
|
inherited ppuload(constsym,ppufile);
|
|
inherited ppuload(constsym,ppufile);
|
|
constdef:=nil;
|
|
constdef:=nil;
|
|
@@ -2693,31 +2716,22 @@ implementation
|
|
end;
|
|
end;
|
|
constwstring :
|
|
constwstring :
|
|
begin
|
|
begin
|
|
- initwidestring(pw);
|
|
|
|
- setlengthwidestring(pw,ppufile.getlongint);
|
|
|
|
- { don't use getdata, because the compilerwidechars may have to
|
|
|
|
- be byteswapped
|
|
|
|
- }
|
|
|
|
-{$if sizeof(tcompilerwidechar) = 2}
|
|
|
|
- for i:=0 to pw^.len-1 do
|
|
|
|
- pw^.data[i]:=ppufile.getword;
|
|
|
|
-{$elseif sizeof(tcompilerwidechar) = 4}
|
|
|
|
- for i:=0 to pw^.len-1 do
|
|
|
|
- pw^.data[i]:=cardinal(ppufile.getlongint);
|
|
|
|
-{$else}
|
|
|
|
- {$error Unsupported tcompilerwidechar size}
|
|
|
|
-{$endif}
|
|
|
|
- pcompilerwidestring(value.valueptr):=pw;
|
|
|
|
|
|
+ do_widestring_const;
|
|
end;
|
|
end;
|
|
conststring,
|
|
conststring,
|
|
constresourcestring :
|
|
constresourcestring :
|
|
|
|
+ begin
|
|
|
|
+ ppufile.getderef(constdefderef);
|
|
|
|
+ value.len:=ppufile.getlongint;
|
|
|
|
+ getmem(pc,value.len+1);
|
|
|
|
+ ppufile.getdata(pc^,value.len);
|
|
|
|
+ pc[value.len]:=#0;
|
|
|
|
+ value.valueptr:=pc;
|
|
|
|
+ end;
|
|
|
|
+ constwresourcestring :
|
|
begin
|
|
begin
|
|
ppufile.getderef(constdefderef);
|
|
ppufile.getderef(constdefderef);
|
|
- value.len:=ppufile.getlongint;
|
|
|
|
- getmem(pc,value.len+1);
|
|
|
|
- ppufile.getdata(pc^,value.len);
|
|
|
|
- pc[value.len]:=#0;
|
|
|
|
- value.valueptr:=pc;
|
|
|
|
|
|
+ do_widestring_const;
|
|
end;
|
|
end;
|
|
constreal :
|
|
constreal :
|
|
begin
|
|
begin
|
|
@@ -2759,7 +2773,8 @@ implementation
|
|
conststring,
|
|
conststring,
|
|
constresourcestring :
|
|
constresourcestring :
|
|
freemem(pchar(value.valueptr),value.len+1);
|
|
freemem(pchar(value.valueptr),value.len+1);
|
|
- constwstring :
|
|
|
|
|
|
+ constwstring,
|
|
|
|
+ constwresourcestring:
|
|
donewidestring(pcompilerwidestring(value.valueptr));
|
|
donewidestring(pcompilerwidestring(value.valueptr));
|
|
constreal :
|
|
constreal :
|
|
dispose(pbestreal(value.valueptr));
|
|
dispose(pbestreal(value.valueptr));
|
|
@@ -2776,7 +2791,7 @@ implementation
|
|
begin
|
|
begin
|
|
inherited;
|
|
inherited;
|
|
case consttyp of
|
|
case consttyp of
|
|
- constnil,constord,constreal,constpointer,constset,conststring,constresourcestring,constguid:
|
|
|
|
|
|
+ constnil,constord,constreal,constpointer,constset,conststring,constresourcestring,constwresourcestring,constguid:
|
|
constdefderef.build(constdef);
|
|
constdefderef.build(constdef);
|
|
constwstring:
|
|
constwstring:
|
|
;
|
|
;
|
|
@@ -2789,7 +2804,7 @@ implementation
|
|
procedure tconstsym.deref;
|
|
procedure tconstsym.deref;
|
|
begin
|
|
begin
|
|
case consttyp of
|
|
case consttyp of
|
|
- constnil,constord,constreal,constpointer,constset,conststring,constresourcestring,constguid:
|
|
|
|
|
|
+ constnil,constord,constreal,constpointer,constset,conststring,constresourcestring,constwresourcestring,constguid:
|
|
constdef:=tdef(constdefderef.resolve);
|
|
constdef:=tdef(constdefderef.resolve);
|
|
constwstring:
|
|
constwstring:
|
|
constdef:=carraydef.getreusable(cwidechartype,getlengthwidestring(pcompilerwidestring(value.valueptr)));
|
|
constdef:=carraydef.getreusable(cwidechartype,getlengthwidestring(pcompilerwidestring(value.valueptr)));
|
|
@@ -2800,6 +2815,15 @@ implementation
|
|
|
|
|
|
|
|
|
|
procedure tconstsym.ppuwrite(ppufile:tcompilerppufile);
|
|
procedure tconstsym.ppuwrite(ppufile:tcompilerppufile);
|
|
|
|
+
|
|
|
|
+ procedure do_widestring_const;
|
|
|
|
+
|
|
|
|
+ begin
|
|
|
|
+ ppufile.putlongint(getlengthwidestring(pcompilerwidestring(value.valueptr)));
|
|
|
|
+ ppufile.putdata(pcompilerwidestring(value.valueptr)^.data^,pcompilerwidestring(value.valueptr)^.len*sizeof(tcompilerwidechar));
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
begin
|
|
begin
|
|
inherited ppuwrite(ppufile);
|
|
inherited ppuwrite(ppufile);
|
|
ppufile.putbyte(byte(consttyp));
|
|
ppufile.putbyte(byte(consttyp));
|
|
@@ -2819,15 +2843,18 @@ implementation
|
|
constwstring :
|
|
constwstring :
|
|
begin
|
|
begin
|
|
{ no need to store the def, we can reconstruct it }
|
|
{ no need to store the def, we can reconstruct it }
|
|
- ppufile.putlongint(getlengthwidestring(pcompilerwidestring(value.valueptr)));
|
|
|
|
- ppufile.putdata(pcompilerwidestring(value.valueptr)^.data^,pcompilerwidestring(value.valueptr)^.len*sizeof(tcompilerwidechar));
|
|
|
|
|
|
+ do_widestring_const;
|
|
end;
|
|
end;
|
|
- conststring,
|
|
|
|
- constresourcestring :
|
|
|
|
|
|
+ conststring,constresourcestring:
|
|
|
|
+ begin
|
|
|
|
+ ppufile.putderef(constdefderef);
|
|
|
|
+ ppufile.putlongint(value.len);
|
|
|
|
+ ppufile.putdata(pchar(value.valueptr)^,value.len);
|
|
|
|
+ end;
|
|
|
|
+ constwresourcestring:
|
|
begin
|
|
begin
|
|
ppufile.putderef(constdefderef);
|
|
ppufile.putderef(constdefderef);
|
|
- ppufile.putlongint(value.len);
|
|
|
|
- ppufile.putdata(pchar(value.valueptr)^,value.len);
|
|
|
|
|
|
+ do_widestring_const
|
|
end;
|
|
end;
|
|
constreal :
|
|
constreal :
|
|
begin
|
|
begin
|
|
@@ -2883,7 +2910,7 @@ implementation
|
|
|
|
|
|
WriteLn(T, PrintNodeIndention, '<visibility>', visibility, '</visibility>');
|
|
WriteLn(T, PrintNodeIndention, '<visibility>', visibility, '</visibility>');
|
|
|
|
|
|
- if not (consttyp in [conststring, constresourcestring, constwstring]) then
|
|
|
|
|
|
+ if not (consttyp in [conststring, constresourcestring, constwresourcestring, constwstring]) then
|
|
{ constdef.size will return an internal error for string
|
|
{ constdef.size will return an internal error for string
|
|
constants because constdef is an open array internally }
|
|
constants because constdef is an open array internally }
|
|
WriteLn(T, PrintNodeIndention, '<size>', constdef.size, '</size>');
|
|
WriteLn(T, PrintNodeIndention, '<size>', constdef.size, '</size>');
|