mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 00:28:23 +02:00
+ support for the text/file types on the JVM platform
git-svn-id: trunk@31683 -
This commit is contained in:
parent
30b8137994
commit
06feac07a5
@ -291,8 +291,9 @@ implementation
|
||||
class function thlcgjvm.def2regtyp(def: tdef): tregistertype;
|
||||
begin
|
||||
case def.typ of
|
||||
{ records and enums are implemented via classes }
|
||||
{ records (including files) and enums are implemented via classes }
|
||||
recorddef,
|
||||
filedef,
|
||||
enumdef,
|
||||
setdef:
|
||||
result:=R_ADDRESSREGISTER;
|
||||
|
@ -290,7 +290,17 @@ implementation
|
||||
encodedstr:=encodedstr+c;
|
||||
end;
|
||||
filedef :
|
||||
result:=false;
|
||||
begin
|
||||
case tfiledef(def).filetyp of
|
||||
ft_text:
|
||||
result:=jvmaddencodedtype(search_system_type('TEXTREC').typedef,false,encodedstr,forcesignature,founderror);
|
||||
ft_typed,
|
||||
ft_untyped:
|
||||
result:=jvmaddencodedtype(search_system_type('FILEREC').typedef,false,encodedstr,forcesignature,founderror);
|
||||
else
|
||||
internalerror(2015091406);
|
||||
end;
|
||||
end;
|
||||
recorddef :
|
||||
begin
|
||||
encodedstr:=encodedstr+'L'+trecorddef(def).jvm_full_typename(true)+';'
|
||||
|
@ -1121,6 +1121,24 @@ implementation
|
||||
result:=false;
|
||||
end;
|
||||
|
||||
|
||||
function compatible_file_conversion(def1, def2: tdef): boolean;
|
||||
begin
|
||||
if def1.typ=filedef then
|
||||
case tfiledef(def1).filetyp of
|
||||
ft_text:
|
||||
result:=def2=search_system_type('TEXTREC').typedef;
|
||||
ft_typed,
|
||||
ft_untyped:
|
||||
result:=def2=search_system_type('FILEREC').typedef;
|
||||
else
|
||||
internalerror(2015091401);
|
||||
end
|
||||
else
|
||||
result:=false;
|
||||
end;
|
||||
|
||||
|
||||
var
|
||||
fromclasscompatible,
|
||||
toclasscompatible: boolean;
|
||||
@ -1380,6 +1398,15 @@ implementation
|
||||
float(intvalue) will convert rather than re-interpret the value) }
|
||||
end;
|
||||
|
||||
{ files }
|
||||
if compatible_file_conversion(left.resultdef,resultdef) or
|
||||
compatible_file_conversion(resultdef,left.resultdef) then
|
||||
begin
|
||||
result:=true;
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
||||
{ anything not explicitly handled is a problem }
|
||||
result:=true;
|
||||
CGMessage2(type_e_illegal_type_conversion,left.resultdef.typename,resultdef.typename);
|
||||
|
@ -55,7 +55,7 @@ unit tgcpu;
|
||||
uses
|
||||
verbose,
|
||||
cgbase,
|
||||
symconst,symdef,symsym,symcpu,defutil,
|
||||
symconst,symtable,symdef,symsym,symcpu,defutil,
|
||||
cpubase,aasmcpu,
|
||||
hlcgobj,hlcgcpu;
|
||||
|
||||
@ -211,6 +211,18 @@ unit tgcpu;
|
||||
result:=true;
|
||||
end;
|
||||
end;
|
||||
filedef:
|
||||
begin
|
||||
case tfiledef(def).filetyp of
|
||||
ft_text:
|
||||
result:=getifspecialtemp(list,search_system_type('TEXTREC').typedef,forcesize,temptype,ref);
|
||||
ft_typed,
|
||||
ft_untyped:
|
||||
result:=getifspecialtemp(list,search_system_type('FILEREC').typedef,forcesize,temptype,ref);
|
||||
else
|
||||
internalerror(2015091405);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user