* fixed setlength for shortstrings

This commit is contained in:
Jonas Maebe 2000-10-26 14:15:06 +00:00
parent a70a9f9684
commit bdd82f8c9f
2 changed files with 45 additions and 6 deletions

View File

@ -904,6 +904,7 @@ implementation
r : preference;
//hp : tcallparanode;
hp2 : tstringconstnode;
dummycoll : tparaitem;
l : longint;
ispushed : boolean;
hregister : tregister;
@ -1379,7 +1380,19 @@ implementation
emit_push_loc(tcallparanode(hp).left.location);
hp:=tcallparanode(hp).right;
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
begin
emitpushreferenceaddr(hr);
@ -1394,12 +1407,17 @@ implementation
else
{ must be string }
begin
emitpushreferenceaddr(tcallparanode(hp).left.location.reference);
case pstringdef(def)^.string_typ of
st_widestring:
emitcall('FPC_WIDESTR_SETLENGTH');
begin
emitpushreferenceaddr(tcallparanode(hp).left.location.reference);
emitcall('FPC_WIDESTR_SETLENGTH');
end;
st_ansistring:
emitcall('FPC_ANSISTR_SETLENGTH');
begin
emitpushreferenceaddr(tcallparanode(hp).left.location.reference);
emitcall('FPC_ANSISTR_SETLENGTH');
end;
st_shortstring:
emitcall('FPC_SHORTSTR_SETLENGTH');
end;
@ -1612,7 +1630,10 @@ begin
end.
{
$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:
- basic dyn. array support
- basic C++ support

View File

@ -104,6 +104,7 @@ implementation
vr : bestreal;
p1,hp,hpp : tnode;
ppn : tcallparanode;
dummycoll: tparaitem;
{$ifndef NOCOLONCHECK}
frac_para,length_para : tnode;
{$endif ndef NOCOLONCHECK}
@ -691,6 +692,20 @@ implementation
if (counter>1) and
(not(is_dynamic_array(left.resulttype))) then
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
else
CGMessage(type_e_mismatch);
@ -1449,7 +1464,10 @@ begin
end.
{
$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:
- basic dyn. array support
- basic C++ support