Oberon || Compiler & Tools || Library || Module Index || Search Engine


Ulm's Oberon System:
oc


NAME

oc - Oberon compiler

SYNOPSIS

oc [ option ] ... file ...

DESCRIPTION

oc is Ulm's Oberon compiler. The accepted language is defined by the revised Oberon report from 1989 with following exceptions:
(1)
Definition and implementation parts must be separate. The current version of the Oberon compiler does not accept export marks:
$ identdef = ident .
(2)
The relaxed parameter compatibility rule for the formal type ARRAY OF BYTE applies for variable and value parameters.
(3)
Variable parameters do not require type identity in case of pointer types.
(4)
The syntax of the import list has been changed to:
$ ImportList = IMPORT import { "," import } ";" .
$ import = identdef [":=" ident ] .
(5)
Comments may be nested.

(1), (2), and (3) conform to unrevised Oberon. (4) and (5) conform to newer revisions.

The Oberon compiler accepts two kinds of sources: definitions and modules. The definition is an excerpt of the module and specifies the items visible to all clients importing the module. Definitions and modules are textually separated. The suffix of the filename determines the kind of source: `.od' for definitions and `.om' for modules.

The Oberon compiler accepts several types of arguments: Arguments whose names end with `.om' are taken to be Oberon modules; they are compiled, and each object program is left in the file whose name is the basename of the source with `.o' substituted for `.om'. Further a reference file with suffix `.r' is left. See odb for more information. Names ending with `.od' are taken to be Oberon definitions and compiled, producing a `.sy' file. Symbol files and reference files may be archived in the files `SYM' and `REF'. If these archives exist oc tries to archive the corresponding output files.

In the same way, arguments whose names end with `.s' are taken to be assembly source programs and are assembled, producing a `.o' file.

The following options are interpreted by oc.

-a
Suppress archiving of the reference and symbol files even if `SYM' and `REF' exist.
-c
Suppress the loading phase of the compilation. A single object file can be named explicitly using the -o option.
-C
Requests parameterless exported procedures of the given modules to be accessible as commands. See SysCommands for further reference.
-ddestdir
Requests all output files to be put into the directory destdir.
-i
Causes oc to ignore compilation errors of all sources following this option. The exit code of oc equals the number of failed compilations.
-llibdir
Requests the libdir to be included in front of the search path for libraries. libdir must be either absolute (i.e. pathname beginning with "/") or a subdirectory of one of the directories specified by OBPATH or OBLIB (see below). Note that despite to cc(1) and ld(1) this option must appear before the sources.
-L
Arrange the compiler to produce a listing for each source file in a corresponding `.l' file, or in a `.ld' file if the source is a definition.
-o output
Name the final output file output. The output file may be either an object file (if the loading phase is suppressed and only one argument is given), an archive with suffix `.a' (this causes the loading phase to be suppressed implicitly), or the designated output file of the loading phase. In the last case the file `a.out' will be left undisturbed.
-OL
Set the default value of compiler option L (upper case letter) to FALSE. Options not modified by the command line have an initial value of TRUE. The options can also be set from within a Oberon source using a comment as follows:
(* $R- $I+ $N= *)
sets compiler option R to FALSE, I to TRUE, and restores the previous value of N. Whitespace is permitted and `$' precedes the option letters. Following options are currently supported:
C
requests checks to be generated for conversions from INTEGER to SHORTINT.
I
enables the yet undocumented revisions of Oberon: (4) and (5) as described above.
M
this option causes the two least significant bits of the type tag to be masked out on each access. This may be useful for some garbage collecting algorithms and requires this option to be applied for all modules.
O
requests pointer types to point to tagged data structures. This options is to be switched off for pointer types which are intended to point to areas which have not been created by NEW. These pointer types will not be traced on garbage collections. IS operators or WITH statements are rejected by the compiler for untagged pointers.
P
requests pointer types to be traced on garbage collections. This option must be switched off in cases where pointers refer to untagged locations. Only types which contain pointers are affected by this option. In case of exported types only the setting in the definition is considered by the compiler.
R
enables parameter types to be given as required by revised Oberon.
S
if switched on, not only strings of length 1 are treated as possible strings but also all other character constants, e.g. 4X, MAX(CHAR), CAP("A"), CHR(4). While the report doesn't encourage this interpretation, the Zürich compilers treat all these character constants as possible strings of the length 1.
T
causes range checks for array indices to be generated.
-r
Suppress cleanup of archived files.
-R
Suppress clean up of temporary files.
-s
Causes the symbol table of the output file to be stripped of. This implies that debuggers cannot be used. The symbol table can also be removed by strip(1).
-S
Compile the named Oberon modules, and leave the assembler-language output on corresponding files suffixed `.s'.
-Tdir
Allocate the temporary files of the compiler in the directory dir.
-u
Enables the Oberon compiler to patch symbol files on compilation of the corresponding module. This is required in case of record type extensions (i.e. a record type of the definition is a public projection of the corresponding record type of the module). If -u is not given the compiler compares the the size needed with the size found in the symbol file (determined either by the compilation of the definition or by an earlier update). If the size is not sufficient the compiler gives an error message: "required type extension is prohibited; use -u option".
-U
Forces the Oberon compiler to patch symbol files if sizes are different, i.e. if the implementation of an record is smaller than the (already patched) size in the symbol file then -u wouldn't cause an update but -U.
-v
Verbose flag. oc prints all executed commands to standard output.
-V
Show but do not execute the commands constructed by the compilation driver.

Other arguments are Oberon object programs (suffix `.o'), typically produced by an earlier oc run, or Oberon libraries (suffix `.a'). These programs, together with the results of any compilations specified, are loaded (in the order given) to produce an executable program with name a.out.

ENVIRONMENT

oc looks for two environment parameters: OBLIB and OBPATH. If OBLIB is given oc calls the compiler passes in the directory $OBLIB. OBPATH specifies a list of directories, separated with colons (like PATH). Each of these directories consists of a SYM archive of symbol files, a REF archive of reference files, and archives with suffix `.a'. If the compiler looks for a symbol file or ld(1) for library modules this search path is used.

FILES

file.od
Oberon definition
file.om
Oberon module
SYM
archive with symbol files
REF
archive with reference files
file.o
object file
file.sy
symbol file
file.r
reference file
file.l
listing of an Oberon module
file.ld
listing of an Oberon definition
a.out
loaded output
/tmp/oc.*
temporaries for oc
/usr/local/lib/oberon/oberon
compiler for oc
/usr/local/lib/oberon/ort0.o
runtime start-off
/usr/local/lib/oberon/post.o
executed after initialization of all modules
/usr/local/lib/oberon/libo.a
standard library
/usr/local/lib/oberon/SYM
symbol files of the std library
/usr/local/lib/oberon/REF
reference files of the std library

SEE ALSO

Niklaus Wirth, The Programming Language Oberon, Software--Practice and Experience, 18, 7 (July 1988), 671-690
Niklaus Wirth, The Programming Language Oberon (revised Report), Eidgenössische Technische Hochschule Zürich, Report 111, September 1989
Andreas Borchert, Report of Ulm's Oberon Compiler, University of Ulm, SAI
ld(1), odb, mmo, SysCommands

DIAGNOSTICS

The diagnostics produced by the compiler itself are intended to be self-explanatory. Occasional messages may be produced by the assembler or loader.

Error messages of the loader about undefined symbols of the form O_modulename_digits_digits result from key mismatches. In this case it is recommended to recompile all sources in the appropriate order.

CAVEAT

The first 11 characters of the module name should be identical to the file name. This avoids silent truncation of suffixes when symbol files, reference files, and objects get archived.

BUGS

Not yet implemented:
(1)
detection of erroneous constant floating point expressions
(2)
LONGREAL floating point constants
(3)
good error recovery on syntactic errors

The Oberon compiler does not support shared libraries.

ar(1) allocates its temporary files either in /tmp or in the current directory. Thus -T dir causes ar(1) only to change the temporary files directory if dir equals ".".

AUTHORS

Andreas Borchert and Martin Hasch, University of Ulm
Edited by: borchert, last change: 1996/01/04, revision: 1.13, converted to HTML: 2001/04/05

Oberon || Compiler & Tools || Library || Module Index || Search Engine