* some things regarding ansistrings fixed

This commit is contained in:
florian 1998-09-20 17:46:47 +00:00
parent 150f565d58
commit 84e20b561c
3 changed files with 45 additions and 16 deletions

View File

@ -400,10 +400,10 @@ implementation
{$ifdef UseAnsiString}
{ does anybody know a better solution than this big case statement ? }
{ ok, a proc table would do the job }
case pstringdef(p)^.string_typ of
case pstringdef(p^.resulttype)^.string_typ of
st_shortstring:
case pstringdef(p^.left)^.string_typ of
case pstringdef(p^.left^.resulttype)^.string_typ of
st_shortstring:
begin
stringdispose(p^.location.reference.symbol);
@ -419,8 +419,8 @@ implementation
end;
st_ansistring:
begin
{!!!!!!!}
internalerror(8888);
gettempofsizereference(p^.resulttype^.size,p^.location.reference);
loadansi2short(p^.left,p);
end;
st_widestring:
begin
@ -1253,7 +1253,10 @@ implementation
end.
{
$Log$
Revision 1.20 1998-09-17 09:42:12 peter
Revision 1.21 1998-09-20 17:46:47 florian
* some things regarding ansistrings fixed
Revision 1.20 1998/09/17 09:42:12 peter
+ pass_2 for cg386
* Message() -> CGMessage() for pass_1/pass_2

View File

@ -253,6 +253,7 @@ implementation
hregister : tregister;
loc : tloc;
r : preference;
pushed : tpushed;
begin
otlabel:=truelabel;
@ -350,13 +351,19 @@ implementation
end
else
{$endif UseAnsiString}
if not (p^.concat_string) then
if is_shortstring(p^.left^.resulttype) and
not (p^.concat_string) then
begin
{ we do not need destination anymore }
del_reference(p^.left^.location.reference);
del_reference(p^.right^.location.reference);
loadstring(p);
ungetiftemp(p^.right^.location.reference);
if is_ansistring(p^.right^.resulttype) then
loadansi2short(p^.right,p^.left)
else
begin
{ we do not need destination anymore }
del_reference(p^.left^.location.reference);
del_reference(p^.right^.location.reference);
loadstring(p);
ungetiftemp(p^.right^.location.reference);
end;
end
else
begin
@ -552,7 +559,10 @@ implementation
end.
{
$Log$
Revision 1.15 1998-09-17 09:42:16 peter
Revision 1.16 1998-09-20 17:46:48 florian
* some things regarding ansistrings fixed
Revision 1.15 1998/09/17 09:42:16 peter
+ pass_2 for cg386
* Message() -> CGMessage() for pass_1/pass_2

View File

@ -493,14 +493,17 @@ unit pass_1;
else
{ nil is compatible with ansi- and wide strings }
{ no, that isn't true, (FK)
if (fromtreetype=niln) and (def_to^.deftype=stringdef)
and (pstringdef(def_to)^.string_typ in [st_ansistring,st_widestring]) then
begin
doconv:=tc_equal;
b:=true;
end
else
{ ansi- and wide strings can be assigned to void pointers }
{ no, (FK)
if (def_from^.deftype=stringdef) and
(pstringdef(def_from)^.string_typ in [st_ansistring,st_widestring]) and
(def_to^.deftype=pointerdef) and
@ -510,8 +513,11 @@ unit pass_1;
doconv:=tc_equal;
b:=true;
end
else
{ ansistrings can be assigned to pchar }
}
{ ansistrings can be assigned to pchar
this needs an explicit type cast (FK)
if is_ansistring(def_from) and
(def_to^.deftype=pointerdef) and
(ppointerdef(def_to)^.definition^.deftype=orddef) and
@ -521,6 +527,7 @@ unit pass_1;
b:=true;
end
else
}
{ pchar can be assigned to ansistrings }
if ((def_from^.deftype=pointerdef) and
(ppointerdef(def_from)^.definition^.deftype=orddef) and
@ -1957,7 +1964,8 @@ unit pass_1;
if is_shortstring(p^.left^.resulttype) and (assigned(p^.right^.resulttype)) then
begin
if not ((p^.right^.resulttype^.deftype=stringdef) or
if not (is_shortstring(p^.right^.resulttype) or
is_ansistring(p^.right^.resulttype) or
((p^.right^.resulttype^.deftype=orddef) and (porddef(p^.right^.resulttype)^.typ=uchar))) then
begin
p^.right:=gentypeconvnode(p^.right,p^.left^.resulttype);
@ -2238,7 +2246,12 @@ unit pass_1;
pstringdef(p^.left^.resulttype)^.string_typ then
begin
if p^.left^.treetype=stringconstn then
p^.left^.stringtype:=pstringdef(p^.resulttype)^.string_typ
begin
p^.left^.stringtype:=pstringdef(p^.resulttype)^.string_typ;
{ we don't have to do anything, the const }
{ node generates an ansistring }
p^.convtyp:=tc_equal;
end
else
procinfo.flags:=procinfo.flags or pi_do_call;
end;
@ -5502,7 +5515,10 @@ unit pass_1;
end.
{
$Log$
Revision 1.85 1998-09-17 09:42:38 peter
Revision 1.86 1998-09-20 17:46:50 florian
* some things regarding ansistrings fixed
Revision 1.85 1998/09/17 09:42:38 peter
+ pass_2 for cg386
* Message() -> CGMessage() for pass_1/pass_2