mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-03 03:50:21 +02:00
* fixed setlength for shortstrings
This commit is contained in:
parent
a70a9f9684
commit
bdd82f8c9f
@ -904,6 +904,7 @@ implementation
|
|||||||
r : preference;
|
r : preference;
|
||||||
//hp : tcallparanode;
|
//hp : tcallparanode;
|
||||||
hp2 : tstringconstnode;
|
hp2 : tstringconstnode;
|
||||||
|
dummycoll : tparaitem;
|
||||||
l : longint;
|
l : longint;
|
||||||
ispushed : boolean;
|
ispushed : boolean;
|
||||||
hregister : tregister;
|
hregister : tregister;
|
||||||
@ -1379,7 +1380,19 @@ implementation
|
|||||||
emit_push_loc(tcallparanode(hp).left.location);
|
emit_push_loc(tcallparanode(hp).left.location);
|
||||||
hp:=tcallparanode(hp).right;
|
hp:=tcallparanode(hp).right;
|
||||||
end;
|
end;
|
||||||
secondpass(tcallparanode(hp).left);
|
{ handle shortstrings separately since the hightree must be }
|
||||||
|
{ pushed too (JM) }
|
||||||
|
if not(is_dynamic_array(def)) and
|
||||||
|
(pstringdef(def)^.string_typ = st_shortstring) then
|
||||||
|
begin
|
||||||
|
dummycoll.init;
|
||||||
|
dummycoll.paratyp:=vs_var;
|
||||||
|
dummycoll.paratype.setdef(openshortstringdef);
|
||||||
|
tcallparanode(hp).secondcallparan(@dummycoll,false,false,false,0,0);
|
||||||
|
if codegenerror then
|
||||||
|
exit;
|
||||||
|
end
|
||||||
|
else secondpass(tcallparanode(hp).left);
|
||||||
if is_dynamic_array(def) then
|
if is_dynamic_array(def) then
|
||||||
begin
|
begin
|
||||||
emitpushreferenceaddr(hr);
|
emitpushreferenceaddr(hr);
|
||||||
@ -1394,12 +1407,17 @@ implementation
|
|||||||
else
|
else
|
||||||
{ must be string }
|
{ must be string }
|
||||||
begin
|
begin
|
||||||
emitpushreferenceaddr(tcallparanode(hp).left.location.reference);
|
|
||||||
case pstringdef(def)^.string_typ of
|
case pstringdef(def)^.string_typ of
|
||||||
st_widestring:
|
st_widestring:
|
||||||
|
begin
|
||||||
|
emitpushreferenceaddr(tcallparanode(hp).left.location.reference);
|
||||||
emitcall('FPC_WIDESTR_SETLENGTH');
|
emitcall('FPC_WIDESTR_SETLENGTH');
|
||||||
|
end;
|
||||||
st_ansistring:
|
st_ansistring:
|
||||||
|
begin
|
||||||
|
emitpushreferenceaddr(tcallparanode(hp).left.location.reference);
|
||||||
emitcall('FPC_ANSISTR_SETLENGTH');
|
emitcall('FPC_ANSISTR_SETLENGTH');
|
||||||
|
end;
|
||||||
st_shortstring:
|
st_shortstring:
|
||||||
emitcall('FPC_SHORTSTR_SETLENGTH');
|
emitcall('FPC_SHORTSTR_SETLENGTH');
|
||||||
end;
|
end;
|
||||||
@ -1612,7 +1630,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.2 2000-10-21 18:16:13 florian
|
Revision 1.3 2000-10-26 14:15:07 jonas
|
||||||
|
* fixed setlength for shortstrings
|
||||||
|
|
||||||
|
Revision 1.2 2000/10/21 18:16:13 florian
|
||||||
* a lot of changes:
|
* a lot of changes:
|
||||||
- basic dyn. array support
|
- basic dyn. array support
|
||||||
- basic C++ support
|
- basic C++ support
|
||||||
|
@ -104,6 +104,7 @@ implementation
|
|||||||
vr : bestreal;
|
vr : bestreal;
|
||||||
p1,hp,hpp : tnode;
|
p1,hp,hpp : tnode;
|
||||||
ppn : tcallparanode;
|
ppn : tcallparanode;
|
||||||
|
dummycoll: tparaitem;
|
||||||
{$ifndef NOCOLONCHECK}
|
{$ifndef NOCOLONCHECK}
|
||||||
frac_para,length_para : tnode;
|
frac_para,length_para : tnode;
|
||||||
{$endif ndef NOCOLONCHECK}
|
{$endif ndef NOCOLONCHECK}
|
||||||
@ -691,6 +692,20 @@ implementation
|
|||||||
if (counter>1) and
|
if (counter>1) and
|
||||||
(not(is_dynamic_array(left.resulttype))) then
|
(not(is_dynamic_array(left.resulttype))) then
|
||||||
CGMessage(type_e_mismatch);
|
CGMessage(type_e_mismatch);
|
||||||
|
|
||||||
|
{ convert shortstrings to openstring parameters }
|
||||||
|
{ (generate the hightree) (JM) }
|
||||||
|
if (ppn.left.resulttype^.deftype = stringdef) and
|
||||||
|
(pstringdef(ppn.left.resulttype)^.string_typ =
|
||||||
|
st_shortstring) then
|
||||||
|
begin
|
||||||
|
dummycoll.init;
|
||||||
|
dummycoll.paratyp:=vs_var;
|
||||||
|
dummycoll.paratype.setdef(openshortstringdef);
|
||||||
|
tcallparanode(ppn).firstcallparan(@dummycoll,false);
|
||||||
|
if codegenerror then
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
CGMessage(type_e_mismatch);
|
CGMessage(type_e_mismatch);
|
||||||
@ -1449,7 +1464,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.10 2000-10-21 18:16:11 florian
|
Revision 1.11 2000-10-26 14:15:06 jonas
|
||||||
|
* fixed setlength for shortstrings
|
||||||
|
|
||||||
|
Revision 1.10 2000/10/21 18:16:11 florian
|
||||||
* a lot of changes:
|
* a lot of changes:
|
||||||
- basic dyn. array support
|
- basic dyn. array support
|
||||||
- basic C++ support
|
- basic C++ support
|
||||||
|
Loading…
Reference in New Issue
Block a user