Recent

Author Topic: PPCJVM - How to include FILEIO  (Read 2144 times)

peter.dell

  • New Member
  • *
  • Posts: 16
PPCJVM - How to include FILEIO
« on: May 10, 2024, 06:16:22 pm »
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  [Select][+][-]
  1. program hello(output);
  2.  
  3. var i: Integer;
  4. begin
  5. (*      writeLn('Hello, World!'); *)
  6.     for i:=1 to 100 do
  7.     begin
  8.                 ExitCode:=i;
  9.         end;
  10. end.
  11.  

- minimal/minimal.pp - With writeln mapped via marcos

Code: Pascal  [Select][+][-]
  1. {$ifdef cpujvm}
  2.     uses jdk15;
  3.         {$macro on}
  4.         {$define writeln:=jlsystem.fout.println}
  5.         {$define write:=jlsystem.fout.print}
  6. {$else}
  7.         uses SysUtils;
  8. {$endif}
  9.  
  10.  

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  [Select][+][-]
  1. ppcjvm.exe -Tjava -Pjvm -Fi../inc -Fi../jvm -FE. -FU../../rtl/units/jvm-java -djvm @rtl.cfg -Us -Sg system.pp
  2. jsystemh.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

  • Hero Member
  • *****
  • Posts: 1060
Re: PPCJVM - How to include FILEIO
« Reply #1 on: May 10, 2024, 11:26:08 pm »
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

  • New Member
  • *
  • Posts: 16
Re: PPCJVM - How to include FILEIO
« Reply #2 on: May 11, 2024, 03:39:05 pm »
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.

 

TinyPortal © 2005-2018