home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.uni-stuttgart.de/pub/systems/acorn/
/
Acorn.tar
/
Acorn
/
acornet
/
dev
/
oberon
/
pot.spk
/
ReadMe1st
Wrap
Text File
|
1995-05-08
|
6KB
|
155 lines
!pOt for the Archimedes
This is a port ot pOt (portable Oberon translator) for the Archimedes.
pOt translates an Oberon (not Oberon2) file to a C file, that should
be compiled with a C compiler.
This archive contains all the files you will need to compile Oberon
programs with pOt. The pOtSrc archive has all the source code
needen to rebuild pOt and its runtime libraries yourself.
pOt is written by David Tolpin, and runs under different flavors of
Unix and MS-Dos. I have changed the filename handling to be compatible
with the Arc way (extension directories), added Throwback support and
embedded the error messages in pOt.
The version of pOt for this port is 1.33, the original pOt can be found
at:
hades.ethz.ch in /pub/Oberon/NonETHSystems/pOt
Note.
I have only tried this with Desktop C v4, your experiences with other
C compilers (GNU CC, Easy C/C++, Desktop C v5 etc) are gratefully
received.
Having Sed makes some things easier. Sed is not included in this
distribution, because it is readily available at different Acorn-
specific FTP sites. My copy comes from the !Virtual distribution.
pOt is not a full blown Oberon system, far from it. The supporting
runtime libraries are just enough to make it to compile itself.
As far as I am concerned, it is capable as a cross-compiler for
bootstrapping a native Oberon-2 compiler (Don't hold your breath
waiting for this).
It should be easy to make the In and Out modules as featured
in the book 'Programming in Oberon, steps beyond Pascal and
Modula' by M. Reiser and N.Wirth' ISBN 0-201-56543-9, ACM Press
and Addison-Wesley Publishing Company.
Package
!pOtLand : Resource directory. Contains the pOt runtime library
and some Oberon modules and their symbol, .h and .hi
files.
bin.mkmain : Creates the entry point for the Oberon program
bin.pOt : The main executable
DDE.!mkmain : DDE frontend for mkmain
DDE.!pOt : DDE frontend for pOt
test : A small example
Installation
Put pOt, mkmain and sed in your Library directory, or at least in a
directory contained in your Run$Path.
Put !pOtLand somewhere easily accessible, for example in your root
directory, or along your !DeskLib application.
If you don't have the DDE, you can go to "How to use pOt"
Put DDE.!pot and DDE.!mkmain in your DDE-directory.
If you like to experiment with !Make-generated makefiles using pOt,
put this in !Make.choices.tools
----------Cut here------------
pOt
mod
-L
pOt $(potflags) $<; cc $(ccflags) -o $@ $*.c
DDE:!pot.desc
DDE:!pot.!setup
----------Cut here------------
How to use pOt
You must create a work directory. This directory structure should
have the following subdirectories.
c : C files generated by pOt
Cym : Symbol files generated by pOt
h : header files generated by pOt
hi : constant-strings files generated by pOt
mod : Oberon files
o : Object files generated by the C compiler
TMP : temporary files for use by pOt
pOt also uses a temporary file in <Wimp$ScrapDir>.
If you don't have the DDE, the wordirectory must be your current
directory. pOt uses DDEUtils to set <Prefix$Dir>, except when the
first character of the Oberon file is '@'.
First, pOt puts its parameters in the temporary file in <Wimp$Scrapdir>.
Then, it translates the Oberon source file. When it encounters the
IMPORT-statement, it first looks for symbol files in workdir.Cym, and
then in pOtLand:Cym. pOtLand is set by the !pOtLand resource application.
When the Oberon module contains no errors, a c.- and a hi.-file is created,
and optionally a Cym.- and h.-file.
Oberon programs are started by calling an exported PROCEDURE with NO
parameters. This clashes with nearly everybody else's way to start
programs. The solution used by pOt is to create a simple C file with
a main() function that calls the specified PROCEDURE. This file is
created by mkmain from a template file called pOtLand:main/tpl (this
file is in pOtland:Core).
If you don' have sed, you can do this by hand. Look at test.c.Say_Hello
how it is done.
Compile the generated C files, including the one generated by mkmain.
Put pOtLand: and C: in the include path (-I)
Turn all warnings off (with -w (one space)) or Suppress -> ' '.
Link the resulting object files, and include the pOt runtime libraries
pOtLand:o.pOtLib and pOtLand:o.pOtCoreLib, *AND* a C runtime library
(I use the Shared C library stubs C:o.Stubs).
Differences
There are a few differences between Archimedes-pOt and the Unix version
(except for the obvious extension directory trick):
- The generated C file includes hi.<name> instead of <name>.hi
The preprocessor of Desktop C v4 wants it this way.
- Looking for Cym. files in the curent directory and in pOtLand:
is explicitely programmed, instead by adding POTLAND to PATH
(Unix) -> adding pOtLand: to File: (Arc).
- Errors are embedded in the scanner. This makes Throwback a lot more
usefull.
- The indirection file is prefixed by ! instead of @. @ clashes with
the current directory indicator in RISC OS pathnames.
Bugs
- The line number in errors is sometimes/often one too high.
- Throwback cannot be turned off.
- The runtime library is a bit tiny. It should be possible to put
MODULE's In and Out (see Programming in Oberon) on top of
MODULE Files.
Contacting me
email : svdwal@xs4all.nl
snail mail: Sander van der wal
Bevrijdingsplein 39
2321 BX Leiden
The Netherlands