[fpc-devel] Re: On a port of Free Pascal to the IBM 370

Sven Barth pascaldragon at googlemail.com
Fri Jan 20 14:24:22 CET 2012


Am 20.01.2012 01:21, schrieb Mr Paul Robinson:
>> 1.  Also there were quite a few changes from 2.6.0 to 2.7.1 and thus it's better to work with the most recent source.
>
> I didn't know the sources were up to 2.7 already.  I installed Tortoise SVN - I was using Mercurial because that's what a different project is using, and I'm an agnostic, so I'll use anyone's source code repository.  I'm writing a (fiction) book about life after death and I was using CVS for its releases I think.   So anyway, I used Tortoise SVN and retrieved the Compiler directory, and (I just looked) PP doesn't mention what version it is, VERSION does, and it says 2.6.0.   I do want to keep a 2.6.0 branch to keep sources for the existing compiler, I will find where the bleeding edge branch is and create a 2.7.1 version there.

Before 2.6.0 was branched from SVN trunk the version was called 2.5.1. 
An odd minor number (here the "5") always indicates that it's a 
development version. After 2.6.0 was branched (which was still named 
2.5.1 at that time) trunk immediately became 2.7.1 and is available 
either through SVN or from the FTP server containing the daily snapshots.

The SVN URL for the 2.7.1 sources (also called development version) is 
here: http://svn.freepascal.org/svn/fpc/trunk

Please checkout the complete trunk directory and not only the compiler 
one. It might be that you need some of the additional tools and also you 
can then test whether your platform can be compiled using the Makefile 
as well (though the Makefile needs to be adjusted first for this).

The version information of FPC is located in 
$fpcdir/compiler/version.pas and there indeed "2.7.1" is encoded.

>
>> 2.  I suggest you to use the Lazarus IDE to do compiler development
>
> Once I found you can build console-mode apps using it I switched back to it.  Interesting with all the crapola to implement windows support, even console, e.g. DOS WINDOW - applications are looking more and more like full Windows ones.  I've discovered that Lazarus has raised my standards in IDEs from the dead (pun intentional!)    It is an order of magnitude much easier to work with than the Turbo Vision clone version.  Since I found interest in including cross-reference in the compiler to be less than lukewarm I decided to write an external cross-reference program.  One quick question which the manual doesn't seem to answer, is whitespace allowed between { and $ in the case of {$INCLUDE 'X'}?  I sometimes see it in some of the compiler sources and I'm not sure if that's allowed or it is effectively 'diking out' the $ command.  The manual does not say one way or the other.

A compiler directive "{$...}" (or "(*$...*)" ) is only detected as one 
if the "$" follows immediatly the opening comment sign. Thus a space 
character (or anything else) is often used to disable a directive (it's 
just a normal comment then).

>> 4. stumpled upon "sysutils"  don't need to care ... yet. These are only needed if you compile programs for the target platform ...
>> might want to stub "System" ... most important part .. real entry point "begin...end." in "program" NOT the real entry point,
>> this part is called "PASCALMAIN" and is called from within the real entry point
>
> This makes sense, when you run a compiled program usually you do not want to start the program first, you want to start the run-time-library and have it, after it's been initialized, to start the program.
>
> That (PASCALMAIN) will have to change, the object file format for 370 machines limits a CSECT to 8 characters, with the optional characters @ # and $.  So I might call it MAIN or possibly #MAIN.  (On the PDP/11, most operating systems (RT-11, RSTS/E, RSX) defined the main program in any language as ".MAIN." )
>

If I understand you correctly, then you might confuse label names with 
section names.

PASCALMAIN is a placeholder (a label) for the final address where the 
code of PASCALMAIN is put to by the linker. You can think of PASCALMAIN 
as a procedure. In fact e.g. the Windows RTLs contain the following code:

=== code begin ===

procedure PascalMain; external 'PASCALMAIN';

//in the entrypoint procedure:
...
PascalMain;
...

=== code end ===

Regards,
Sven



More information about the fpc-devel mailing list