mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-07 23:06:11 +02:00
* make more use of is_typeparam
git-svn-id: trunk@45458 -
This commit is contained in:
parent
51da470757
commit
d2d2904d78
@ -732,7 +732,7 @@ implementation
|
|||||||
readfunctype:=nil;
|
readfunctype:=nil;
|
||||||
|
|
||||||
{ can't read/write types }
|
{ can't read/write types }
|
||||||
if (para.left.nodetype=typen) and not(ttypenode(para.left).typedef.typ=undefineddef) then
|
if (para.left.nodetype=typen) and not(is_typeparam(ttypenode(para.left).typedef)) then
|
||||||
begin
|
begin
|
||||||
CGMessagePos(para.fileinfo,type_e_cant_read_write_type);
|
CGMessagePos(para.fileinfo,type_e_cant_read_write_type);
|
||||||
error_para := true;
|
error_para := true;
|
||||||
@ -749,126 +749,124 @@ implementation
|
|||||||
if inlinenumber in [in_write_x,in_writeln_x] then
|
if inlinenumber in [in_write_x,in_writeln_x] then
|
||||||
{ prefer strings to chararrays }
|
{ prefer strings to chararrays }
|
||||||
maybe_convert_to_string(para.left);
|
maybe_convert_to_string(para.left);
|
||||||
|
if is_typeparam(para.left.resultdef) then
|
||||||
case para.left.resultdef.typ of
|
error_para:=true
|
||||||
stringdef :
|
else
|
||||||
name:=procprefixes[do_read]+tstringdef(para.left.resultdef).stringtypname;
|
case para.left.resultdef.typ of
|
||||||
pointerdef :
|
stringdef :
|
||||||
begin
|
name:=procprefixes[do_read]+tstringdef(para.left.resultdef).stringtypname;
|
||||||
if (not is_pchar(para.left.resultdef)) or do_read then
|
pointerdef :
|
||||||
begin
|
begin
|
||||||
CGMessagePos(para.fileinfo,type_e_cant_read_write_type);
|
if (not is_pchar(para.left.resultdef)) or do_read then
|
||||||
error_para := true;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
name:=procprefixes[do_read]+'pchar_as_pointer';
|
|
||||||
end;
|
|
||||||
floatdef :
|
|
||||||
begin
|
|
||||||
is_real:=true;
|
|
||||||
if Tfloatdef(para.left.resultdef).floattype=s64currency then
|
|
||||||
name := procprefixes[do_read]+'currency'
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
name := procprefixes[do_read]+'float';
|
|
||||||
readfunctype:=pbestrealtype^;
|
|
||||||
end;
|
|
||||||
{ iso pascal needs a different handler }
|
|
||||||
if (m_isolike_io in current_settings.modeswitches) and do_read then
|
|
||||||
name:=name+'_iso';
|
|
||||||
end;
|
|
||||||
enumdef:
|
|
||||||
begin
|
|
||||||
name:=procprefixes[do_read]+'enum';
|
|
||||||
readfunctype:=s32inttype;
|
|
||||||
end;
|
|
||||||
orddef :
|
|
||||||
begin
|
|
||||||
case Torddef(para.left.resultdef).ordtype of
|
|
||||||
s8bit,
|
|
||||||
s16bit,
|
|
||||||
s32bit,
|
|
||||||
s64bit,
|
|
||||||
u8bit,
|
|
||||||
u16bit,
|
|
||||||
u32bit,
|
|
||||||
u64bit:
|
|
||||||
begin
|
begin
|
||||||
get_read_write_int_func(para.left.resultdef,func_suffix,readfunctype);
|
CGMessagePos(para.fileinfo,type_e_cant_read_write_type);
|
||||||
name := procprefixes[do_read]+func_suffix;
|
error_para := true;
|
||||||
if (m_isolike_io in current_settings.modeswitches) and do_read then
|
end
|
||||||
name:=name+'_iso';
|
else
|
||||||
end;
|
name:=procprefixes[do_read]+'pchar_as_pointer';
|
||||||
uchar :
|
end;
|
||||||
|
floatdef :
|
||||||
|
begin
|
||||||
|
is_real:=true;
|
||||||
|
if Tfloatdef(para.left.resultdef).floattype=s64currency then
|
||||||
|
name := procprefixes[do_read]+'currency'
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
name := procprefixes[do_read]+'char';
|
name := procprefixes[do_read]+'float';
|
||||||
{ iso pascal needs a different handler }
|
readfunctype:=pbestrealtype^;
|
||||||
if (m_isolike_io in current_settings.modeswitches) and do_read then
|
|
||||||
name:=name+'_iso';
|
|
||||||
readfunctype:=cansichartype;
|
|
||||||
end;
|
end;
|
||||||
uwidechar :
|
{ iso pascal needs a different handler }
|
||||||
begin
|
if (m_isolike_io in current_settings.modeswitches) and do_read then
|
||||||
name := procprefixes[do_read]+'widechar';
|
name:=name+'_iso';
|
||||||
readfunctype:=cwidechartype;
|
end;
|
||||||
end;
|
enumdef:
|
||||||
scurrency:
|
begin
|
||||||
begin
|
name:=procprefixes[do_read]+'enum';
|
||||||
name := procprefixes[do_read]+'currency';
|
readfunctype:=s32inttype;
|
||||||
{ iso pascal needs a different handler }
|
end;
|
||||||
if (m_isolike_io in current_settings.modeswitches) and do_read then
|
orddef :
|
||||||
name:=name+'_iso';
|
begin
|
||||||
readfunctype:=s64currencytype;
|
case Torddef(para.left.resultdef).ordtype of
|
||||||
is_real:=true;
|
s8bit,
|
||||||
end;
|
s16bit,
|
||||||
pasbool1,
|
s32bit,
|
||||||
pasbool8,
|
s64bit,
|
||||||
pasbool16,
|
u8bit,
|
||||||
pasbool32,
|
u16bit,
|
||||||
pasbool64,
|
u32bit,
|
||||||
bool8bit,
|
u64bit:
|
||||||
bool16bit,
|
begin
|
||||||
bool32bit,
|
get_read_write_int_func(para.left.resultdef,func_suffix,readfunctype);
|
||||||
bool64bit:
|
name := procprefixes[do_read]+func_suffix;
|
||||||
if do_read then
|
if (m_isolike_io in current_settings.modeswitches) and do_read then
|
||||||
|
name:=name+'_iso';
|
||||||
|
end;
|
||||||
|
uchar :
|
||||||
|
begin
|
||||||
|
name := procprefixes[do_read]+'char';
|
||||||
|
{ iso pascal needs a different handler }
|
||||||
|
if (m_isolike_io in current_settings.modeswitches) and do_read then
|
||||||
|
name:=name+'_iso';
|
||||||
|
readfunctype:=cansichartype;
|
||||||
|
end;
|
||||||
|
uwidechar :
|
||||||
|
begin
|
||||||
|
name := procprefixes[do_read]+'widechar';
|
||||||
|
readfunctype:=cwidechartype;
|
||||||
|
end;
|
||||||
|
scurrency:
|
||||||
|
begin
|
||||||
|
name := procprefixes[do_read]+'currency';
|
||||||
|
{ iso pascal needs a different handler }
|
||||||
|
if (m_isolike_io in current_settings.modeswitches) and do_read then
|
||||||
|
name:=name+'_iso';
|
||||||
|
readfunctype:=s64currencytype;
|
||||||
|
is_real:=true;
|
||||||
|
end;
|
||||||
|
pasbool1,
|
||||||
|
pasbool8,
|
||||||
|
pasbool16,
|
||||||
|
pasbool32,
|
||||||
|
pasbool64,
|
||||||
|
bool8bit,
|
||||||
|
bool16bit,
|
||||||
|
bool32bit,
|
||||||
|
bool64bit:
|
||||||
|
if do_read then
|
||||||
|
begin
|
||||||
|
CGMessagePos(para.fileinfo,type_e_cant_read_write_type);
|
||||||
|
error_para := true;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
name := procprefixes[do_read]+'boolean';
|
||||||
|
readfunctype:=pasbool1type;
|
||||||
|
end
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
CGMessagePos(para.fileinfo,type_e_cant_read_write_type);
|
CGMessagePos(para.fileinfo,type_e_cant_read_write_type);
|
||||||
error_para := true;
|
error_para := true;
|
||||||
end
|
end;
|
||||||
else
|
end;
|
||||||
begin
|
end;
|
||||||
name := procprefixes[do_read]+'boolean';
|
variantdef :
|
||||||
readfunctype:=pasbool1type;
|
name:=procprefixes[do_read]+'variant';
|
||||||
end
|
arraydef :
|
||||||
|
begin
|
||||||
|
if is_chararray(para.left.resultdef) then
|
||||||
|
name := procprefixes[do_read]+'pchar_as_array'
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
CGMessagePos(para.fileinfo,type_e_cant_read_write_type);
|
CGMessagePos(para.fileinfo,type_e_cant_read_write_type);
|
||||||
error_para := true;
|
error_para := true;
|
||||||
end;
|
end
|
||||||
end;
|
end;
|
||||||
end;
|
else
|
||||||
variantdef :
|
begin
|
||||||
name:=procprefixes[do_read]+'variant';
|
CGMessagePos(para.fileinfo,type_e_cant_read_write_type);
|
||||||
arraydef :
|
error_para := true;
|
||||||
begin
|
end;
|
||||||
if is_chararray(para.left.resultdef) then
|
end;
|
||||||
name := procprefixes[do_read]+'pchar_as_array'
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
CGMessagePos(para.fileinfo,type_e_cant_read_write_type);
|
|
||||||
error_para := true;
|
|
||||||
end
|
|
||||||
end;
|
|
||||||
{ generic parameter }
|
|
||||||
undefineddef:
|
|
||||||
{ don't try to generate any code for a writeln on a generic parameter }
|
|
||||||
error_para:=true;
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
CGMessagePos(para.fileinfo,type_e_cant_read_write_type);
|
|
||||||
error_para := true;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ iso pascal needs a different handler }
|
{ iso pascal needs a different handler }
|
||||||
if (m_isolike_io in current_settings.modeswitches) and not(do_read) then
|
if (m_isolike_io in current_settings.modeswitches) and not(do_read) then
|
||||||
|
Loading…
Reference in New Issue
Block a user