Forum > Other OS
PPCJVM - How to include FILEIO
(1/1)
peter.dell:
I solved my original issues (compiler exiting with an internal error on different occasions and language elements) reported with https://forum.lazarus.freepascal.org/index.php/topic,61944.0.html. Now I have a local build of the latest PPC386 and PPCJVM. I learned I can activate the features required in the "fpc\rtl\java\rtl.cfg".
With this, I've created minimal Pascal programs that compile successfully now.
In https://github.com/wudsn/fpc-ppcjvm there are folders with these example
- hello/hello.pas - Without output
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program hello(output); var i: Integer;begin(* writeLn('Hello, World!'); *) for i:=1 to 100 do begin ExitCode:=i; end;end.
- minimal/minimal.pp - With writeln mapped via marcos
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$ifdef cpujvm} uses jdk15; {$macro on} {$define writeln:=jlsystem.fout.println} {$define write:=jlsystem.fout.print}{$else} uses SysUtils;{$endif}
As the next step, I'd like to use file IO, but when I activate FILEIO in the rtl.cfg, I get this when building the RTL:
--- Code: Bash [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---ppcjvm.exe -Tjava -Pjvm -Fi../inc -Fi../jvm -FE. -FU../../rtl/units/jvm-java -djvm @rtl.cfg -Us -Sg system.ppjsystemh.inc(590,1) Fatal: Cannot find system type "FILEREC". Check if you use the correct run time library.
Does somebody have a tip, how I can continue from here?
Jonas Maebe:
The features enabled in the rtl.cfg for the JVM platform are the only ones supported there at this time. The standard file IO routines implementations rely on a lot of explicit typecasting of data in arrays of byte to pointers and things like that, which is impossible in the JVM. All of that code would need to be rewritten for a JVM platform.
peter.dell:
Hello Jonas,
I want to contribute to the JVM backend parts. To understand how FPC works, I've forked it to https://gitlab.com/peterdell/source and realigned the copied "jsystem.inc/jsystemh.inc" includes with the latest "system.inc, systemh.inc". Building the RTL and my example works fine. It would be great if you could have a look and let me know if I'm on the right path.
I don't understand the current content of the rtl.cfg file.
The "# -Sf-" is commented out, which probably implies some default feature set, but it is unclear which.
If remove the comment for "-SF-" and try to enable the required features selectively, I cannot find a valid combination.
Is there a definition of the defaults? Is there a way to disable features via "-Sf" somehow?
Kind regards, Peter.
Navigation
[0] Message Index