* better read/write array

This commit is contained in:
peter 1999-04-26 18:28:12 +00:00
parent 6da9dfae21
commit c36956fffe
3 changed files with 30 additions and 13 deletions

View File

@ -292,9 +292,12 @@ implementation
never_copy_const_param:=true;
{ reset data type }
dummycoll.data:=nil;
{ support openstring calling for readln(shortstring) }
{ create temporary defs for high tree generation }
if doread and (is_shortstring(hp^.resulttype)) then
dummycoll.data:=openshortstringdef;
dummycoll.data:=openshortstringdef
else
if (is_chararray(hp^.resulttype)) then
dummycoll.data:=openchararraydef;
secondcallparan(hp,@dummycoll,false,false,false,0);
if ft=ft_typed then
never_copy_const_param:=false;
@ -1287,7 +1290,10 @@ implementation
end.
{
$Log$
Revision 1.43 1999-04-19 09:45:48 pierre
Revision 1.44 1999-04-26 18:28:13 peter
* better read/write array
Revision 1.43 1999/04/19 09:45:48 pierre
+ cdecl or stdcall push all args with longint size
* tempansi stuff cleaned up

View File

@ -107,6 +107,7 @@ begin
p^.insert(new(ptypesym,init('void_pointer',voidpointerdef)));
p^.insert(new(ptypesym,init('char_pointer',charpointerdef)));
p^.insert(new(ptypesym,init('void_farpointer',voidfarpointerdef)));
p^.insert(new(ptypesym,init('openchararray',openchararraydef)));
p^.insert(new(ptypesym,init('file',cfiledef)));
{$ifdef i386}
p^.insert(new(ptypesym,init('REAL',c64floatdef)));
@ -182,12 +183,13 @@ begin
cu64bitdef:=porddef(globaldef('qword'));
cs64bitintdef:=porddef(globaldef('int64'));
{$endif INT64}
cchardef:=porddef(globaldef('char'));
cshortstringdef:=pstringdef(globaldef('shortstring'));
clongstringdef:=pstringdef(globaldef('longstring'));
cansistringdef:=pstringdef(globaldef('ansistring'));
cwidestringdef:=pstringdef(globaldef('widestring'));
openshortstringdef:=pstringdef(globaldef('openshortstring'));
cchardef:=porddef(globaldef('char'));
openchararraydef:=parraydef(globaldef('openchararray'));
{$ifdef i386}
c64floatdef:=pfloatdef(globaldef('s64real'));
{$endif}
@ -202,7 +204,7 @@ begin
booldef:=porddef(globaldef('boolean'));
voidpointerdef:=ppointerdef(globaldef('void_pointer'));
charpointerdef:=ppointerdef(globaldef('char_pointer'));
voidfarpointerdef:=pfarpointerdef(globaldef('void_farpointer'));
voidfarpointerdef:=ppointerdef(globaldef('void_farpointer'));
cfiledef:=pfiledef(globaldef('file'));
end;
@ -236,6 +238,8 @@ begin
cwidestringdef:=new(pstringdef,wideinit(-1));
{ length=0 for shortstring is open string (needed for readln(string) }
openshortstringdef:=new(pstringdef,shortinit(0));
openchararraydef:=new(parraydef,init(0,-1,s32bitdef));
parraydef(openchararraydef)^.definition:=cchardef;
{$ifdef i386}
c64floatdef:=new(pfloatdef,init(s64real));
s80floatdef:=new(pfloatdef,init(s80real));
@ -251,7 +255,7 @@ begin
{ some other definitions }
voidpointerdef:=new(ppointerdef,init(voiddef));
charpointerdef:=new(ppointerdef,init(cchardef));
voidfarpointerdef:=new(pfarpointerdef,init(voiddef));
voidfarpointerdef:=new(ppointerdef,initfar(voiddef));
cfiledef:=new(pfiledef,init(ft_untyped,nil));
registerdef:=oldregisterdef;
end;
@ -260,7 +264,10 @@ end;
end.
{
$Log$
Revision 1.20 1999-04-17 13:12:20 peter
Revision 1.21 1999-04-26 18:28:15 peter
* better read/write array
Revision 1.20 1999/04/17 13:12:20 peter
* addr() internal
Revision 1.19 1999/04/07 15:31:12 pierre

View File

@ -580,11 +580,10 @@ implementation
CGMessage(type_e_cant_read_write_type);
if not is_equal(hpp^.resulttype,pfiledef(hp^.resulttype)^.typed_as) then
CGMessage(type_e_mismatch);
if hpp^.resulttype^.deftype=stringdef then
{ generate the high() value for the shortstring }
if (not dowrite) and
is_shortstring(hpp^.left^.resulttype) then
gen_high_tree(hpp,true);
if ((not dowrite) and is_shortstring(hpp^.left^.resulttype)) or
(is_chararray(hpp^.left^.resulttype)) then
gen_high_tree(hpp,true);
hpp:=hpp^.right;
end;
end;
@ -657,7 +656,9 @@ implementation
end;
arraydef :
begin
if not is_chararray(hp^.left^.resulttype) then
if is_chararray(hp^.left^.resulttype) then
gen_high_tree(hp,true)
else
CGMessage(type_e_cant_read_write_type);
end;
else
@ -1083,7 +1084,10 @@ implementation
end.
{
$Log$
Revision 1.27 1999-04-26 09:32:22 peter
Revision 1.28 1999-04-26 18:28:12 peter
* better read/write array
Revision 1.27 1999/04/26 09:32:22 peter
* try to convert to string for val()
Revision 1.26 1999/04/15 14:10:51 pierre