mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 18:19:16 +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;
|
class function thlcgjvm.def2regtyp(def: tdef): tregistertype;
|
||||||
begin
|
begin
|
||||||
case def.typ of
|
case def.typ of
|
||||||
{ records and enums are implemented via classes }
|
{ records (including files) and enums are implemented via classes }
|
||||||
recorddef,
|
recorddef,
|
||||||
|
filedef,
|
||||||
enumdef,
|
enumdef,
|
||||||
setdef:
|
setdef:
|
||||||
result:=R_ADDRESSREGISTER;
|
result:=R_ADDRESSREGISTER;
|
||||||
|
@ -290,7 +290,17 @@ implementation
|
|||||||
encodedstr:=encodedstr+c;
|
encodedstr:=encodedstr+c;
|
||||||
end;
|
end;
|
||||||
filedef :
|
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 :
|
recorddef :
|
||||||
begin
|
begin
|
||||||
encodedstr:=encodedstr+'L'+trecorddef(def).jvm_full_typename(true)+';'
|
encodedstr:=encodedstr+'L'+trecorddef(def).jvm_full_typename(true)+';'
|
||||||
|
@ -1121,6 +1121,24 @@ implementation
|
|||||||
result:=false;
|
result:=false;
|
||||||
end;
|
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
|
var
|
||||||
fromclasscompatible,
|
fromclasscompatible,
|
||||||
toclasscompatible: boolean;
|
toclasscompatible: boolean;
|
||||||
@ -1380,6 +1398,15 @@ implementation
|
|||||||
float(intvalue) will convert rather than re-interpret the value) }
|
float(intvalue) will convert rather than re-interpret the value) }
|
||||||
end;
|
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 }
|
{ anything not explicitly handled is a problem }
|
||||||
result:=true;
|
result:=true;
|
||||||
CGMessage2(type_e_illegal_type_conversion,left.resultdef.typename,resultdef.typename);
|
CGMessage2(type_e_illegal_type_conversion,left.resultdef.typename,resultdef.typename);
|
||||||
|
@ -55,7 +55,7 @@ unit tgcpu;
|
|||||||
uses
|
uses
|
||||||
verbose,
|
verbose,
|
||||||
cgbase,
|
cgbase,
|
||||||
symconst,symdef,symsym,symcpu,defutil,
|
symconst,symtable,symdef,symsym,symcpu,defutil,
|
||||||
cpubase,aasmcpu,
|
cpubase,aasmcpu,
|
||||||
hlcgobj,hlcgcpu;
|
hlcgobj,hlcgcpu;
|
||||||
|
|
||||||
@ -211,6 +211,18 @@ unit tgcpu;
|
|||||||
result:=true;
|
result:=true;
|
||||||
end;
|
end;
|
||||||
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;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user