Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

See if I can add support for OfrontPlus #2

Open
rsdoiel opened this issue Jul 25, 2021 · 10 comments
Open

See if I can add support for OfrontPlus #2

rsdoiel opened this issue Jul 25, 2021 · 10 comments
Assignees

Comments

@rsdoiel
Copy link
Owner

rsdoiel commented Jul 25, 2021

Oleg-N-Cher would like Artemis to work with OfrontPlus. OfrontPlus is built in Component Pascal. I need to figure out to setup and run an environment that supports Component Pascal compilation so I can install OfrontPlus and include that in the compatibility modules and testing.

@rsdoiel rsdoiel self-assigned this Jul 25, 2021
@rsdoiel
Copy link
Owner Author

rsdoiel commented Jul 25, 2021

It looks like I need an i386 virtual machine so I can build BlackBox then build OfrontPlus. Both are expecting a 32 bit environment.

@Oleg-N-Cher
Copy link

Oleg-N-Cher commented Jul 25, 2021

You don't need a virtual machine and a 32-bit environment. Ofront+ natively works on any version of Linux or *BSD.

Quick build instructions:

  • go to Target/Your_platform/Lib/Bin and run ./build (rebuild libOfront.a)
  • go to Target/Your_platform/Bin and run ./build (rebuild Ofront+ and tools).

If your platform is not in the list, you can still try to build it, but you'll need to generate intermediate C files under another host system (Lib/Bin/o2c; Bin/o2c), move them (Lib/Obj/*; Obj/) to your system, and then compile them (Lib/Bin/cc; Bin/cc).

@rsdoiel
Copy link
Owner Author

rsdoiel commented Jul 26, 2021 via email

@Oleg-N-Cher
Copy link

Dear Robert,
there are typos in Obn2.Mod:

PROCEDURE MAX*(x, y : INGTEGER) : INTEGER;  (* must be: INTEGER *) 
PROCEDURE MAX*(x, y : INTEGER) : INTEGER;
  VAR res : INTEGER;
BEGIN
  IF x > n THEN (* must be: IF x > y THEN *)
PROCEDURE MIN(x, y : INTEGER); (* must be: PROCEDURE MIN(x, y : INTEGER): INTEGER; *)
PROCEDURE ROT(VAR x, n : INTEGER);
BEGIN
  ROR(x, n);
END ROT;

Must be:

PROCEDURE ROT(x, n : INTEGER) : INTEGER;
BEGIN
  RETURN ROR(x, n)
END ROT;

Since SYSTEM.ROT is defined as:

Name	Argument types	Result type	Description
ROT(x, n)	x, n: integer type*	type of x	rotation (n > 0: left, n < 0: right)

SYSTEM.ROT does not get x as VAR parameter, but has returned result. See BlackBox: Dev/Docu/P-S-I.odc
Or see Ofront/Docu/OfrontUser.doc

PROCEDURE ROT (i: Int; n: LONGINT): Int;

After these fixes, Ofront+ builds Obn2.Mod:

ofront+ -s7 -48 Obn2.Mod

image

Artemis-Ofront+.zip

It is a little more complicated with other modules, since there are dependencies on Math, Out. Of course, we can develop these modules or layers for the libOfront.a library. What is your vision of this?

@rsdoiel
Copy link
Owner Author

rsdoiel commented Jul 31, 2021

Good afternoon Oleg,

Thanks for spotting this. I will correct it. My goal with Obn2.Mod is to easy the path of bringing historic
Oberon/Oberon-2 to Oberon-07. The less changes we need to make to the historic code the more likely we can keep
the code sustainable into the future.

I've started looking at Math and Out. Out in particular has allot of variance between dialects would benefit
from a common approach. In a POSIX environment I think Out will need C level integration so I'm stuck implementing
versions per compiler given the variance in how C code is integrated.

Math I think is in the same boat as Out but I am reluctant to attempt it yet. I've been out of University a very
long time and my mathematics is rusty. To get a good Math I need to develop a comprehensive set of tests to
verify the code. I have zero background writing Math libraries. It'll be a steep learning curve for me. Happy for
contributions, help or suggestions there.

My current thinking based on looking at Ofront+ and using OBNC and Obn-3 is any module(s) requiring C
need to have compiler specific versions. They should all have identical interfaces so the applications
importing them think of them as unified. Modules that can be implemented in pure Oberon-07 should be implemented
in pure Oberon-07. I think modules like String fall into that category.

A secondary goal (which Ofront/Ofront+ offer a path towards) is making the standard Oberon System libraries like Text
accessible as a standard library module in the POSIX environment. Most computing systems are graphical instead of the
old serial terminals I remember when I was young. While I happen to like the command line I don't want to be limited to
it. I haven't sorted out how a Text module should work to have compatibility with the many historic implementations
of Text. I think Ofront, for a POSIX environment, is probably a strong path forward.

Like with compiler specific Out, Math, etc, may Artemis should simply have multiple implementations of Text. You'd
include the version you want (e.g. S3, V4). Seems like allot of code to write and maintain but that might be best.

I know that Display will need to be compiler specific (assuming something like SDL2 or OpenGL is used for implementation)
at the C level). So there's that.

I want to thank you for both your contributions and patience. I'm new to Oberon and Oberon Systems and as I mentioned on the
list I'm can only be considered an Oberon hobbyist at this point. I'm looking forward to adding support for Ofront+ in Artemis.

All the best,

Robert

@rsdoiel
Copy link
Owner Author

rsdoiel commented Jul 31, 2021

Using Ofront+ after fixing typos I get the correct output per Oleg.

rsdoiel@notebook-rd2:~/src/github.com/rsdoiel/Artemis$ ~/OfrontPlus/Target/Linux_amd64/ofront+ -s7 -48 Obn2.Mod 
Obn2.Mod  translating Obn2  new symbol file    1616    

I've added a sub directory called ofrontplus to Artemis for any Ofront+ specific modules.

@Oleg-N-Cher
Copy link

Good afternoon Robert,
I want to inform you with joy that Ofront+ was able to translate all Artemis modules.

image

I even compiled it into a static library Artemis.a, which can be linked to our projects in the future.

I attach all the scripts for the build. I hope this will be interesting for you.

Artemis.zip

But I still don't have any implementations of the modules Math, Out, Strings and extConvert. Ofront+ has a sufficient set of libraries to make a layer for redirecting these interfaces to existing libraries located in Ofront.a

As for the other Oberon-07 compilers - I have no influence on their development or support.
If you'll have any questions specifically about Ofront+, I will be happy to answer, as I offer free support for my users.

Thank you for your activity!

@rsdoiel
Copy link
Owner Author

rsdoiel commented Aug 2, 2021 via email

@Oleg-N-Cher
Copy link

Hello, Robert. I am also glad of our productive communication.

Ofront+ has very good support for linking to the C language, partly inherited from Ofront, partly from CPfront, I did a lot myself.

I am attaching a new Artemis build to show you these features. I think I've done everything except Out.Real. I didn't have any ideas for it, although it's supposed to be easy to do with UNPK.

Artemis-Ofront+.zip

But I didn't test this code!

.Def differs from .Mod in that it does not generate .c, but only .oh (Oberon Header). Using extension ".oh" is the suggestion of Stewart Greenhill to avoid a name conflict with C (for example, math.h is a C library, and Math.oh is a header generated from Oberon). I didn't agree at first, but then I realized the wisdom of this decision. I am sure that there are many more such things, thanks to which Ofront+ will seem to you a well-thought-out translator, made very carefully.

Perhaps we can profit from the implementation of Out.Real from libraries for other Oberon-07 translators/compilers. But I'll leave that up to you. I would have made Out.Real long ago, but I am confused by the second parameter (margins).

@Oleg-N-Cher
Copy link

Oleg-N-Cher commented Aug 10, 2021

Slightly optimized/fixed module extConvert.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants