Modula-2 || Compiler & Tools || Library || Search Engine


Ulm's Modula-2 System:
m2c


NAME

m2c - Modula-2 compiler

SYNOPSIS

m2c [ option ] ... file ...

DESCRIPTION

M2c is Ulm's Modula-2 compiler. It accepts several types of arguments:

Arguments whose names end with `.m2' are taken to be Modula-2 source programs; they are compiled, and each object program is left on the file whose name is that of the source with `.o' substituted for `.m2'. Further a reference file with suffix `.r' is left. See mdb for more information. Names ending with `.d' are taken to be Modula-2 definition modules and compiled, producing a `.sy' file. The `.o' file is normally deleted, however, if a single Modula-2 program is compiled and loaded all at one go. Symbol files and reference files may be archived in the files `SYM' and `REF'. If these archives exist, m2c 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 m2c. See ld(1) for load-time options.

-a
Suppress archiving of the reference and symbol files even if `SYM' and `REF' exist.
-Bstring
Use /usr/local/lib/modula/string as an alternative library directory. If string is omitted, `old' is taken as default.
-c
Suppress the loading phase of the compilation, and force an object file to be produced even if only one program is compiled.
-H
Support code generation of procedures with huge stack consumptions. This option should only be given if it is explicitly requested by an error message of the compiler because less efficient code will be generated.
-K
Request the compiler to produce null-valued symbol file keys. This may be useful for regression or steady-state tests of symbol files.
-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 module.
-m
The following argument is taken to be the main module. Necessary only if no main module exists.
-o output
Name the final output file output. If this option is used, the file `a.out' will be left undisturbed.
-rN
This compiler supports three versions of Modula-2: unrevised Modula-2 as defined in 1st and 2nd edition of Wirth's Programming in Modula-2 (N = 0), revised Modula-2 as defined in the Revisions and Amendments to Modula-2 (N = 1), and revised Modula-2 as defined in the 3rd edition (default: N = 2). All compile versions are full compatible.
-R
Suppress clean up of temporary files.
-S
Compile the named Modula-2 programs, and leave the assembler-language output on corresponding files suffixed `.s'.
-Tdir
Allocate the temporary files of the compiler in the directory dir.
-v
Verbose flag. M2c prints all executed commands to standard error.

Other arguments are taken to be either loader option arguments, or Modula-2 compatible object programs, typically produced by an earlier m2c run, or perhaps libraries of Modula-2 compatible routines. 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

M2c looks for two environment parameters: MODLIB and MODPATH. If MODLIB is given, m2c calls the compiler passes in the directory $MODLIB. MODPATH 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.m2 main or implementation module
file.d definition module
SYM archive with symbol files
REF archive with reference files
file.o object file
file.sy symbol file
file.r reference file
a.out loaded output
/tmp/mtm* temporaries for m2c
/usr/local/lib/modula/modula 4-pass compiler
/usr/local/lib/modula/m2e lister
/usr/local/lib/modula/m2_error file with error messages
/usr/local/lib/modula/m2rt0.o runtime startoff
/usr/local/lib/modula/libm2.a standard library
/usr/local/lib/modula/SYM symbol files of the std library
/usr/local/lib/modula/REF reference files of the std library

SEE ALSO

Niklaus Wirth, Programming in Modula-2, Springer-Verlag, 1982 (1st ed.) and 1985 (3rd ed.)
Niklaus Wirth, Revisions and Amendments to Modula-2, ETH Zürich, 1984
ld(1), mdb, mmm, mtags

DIAGNOSTICS

The diagnostics produced by Modula-2 itself are intended to be self-explanatory.

Some symbol file key mismatches lead to error messages of the loader similar to following example:

Undefined                       first referenced
 symbol                             in file
M.XXX_857052922_16922_120           YYY.o
ld: fatal: Symbol referencing errors. No output written to main
A module named XXX was imported by YYY. While XXX was expected to have the symbol file key 857052922_16922_120, the loader happened to find another version of XXX which is incompatible to that version which was seen by m2c on compilation of YYY. In such cases it may be useful to remove all objects, to update all makefiles (using mmm -u), and to call make(1) again.

CAVEAT

The first 11 characters of the module name should be identical to the file name.
Edited by: borchert, last change: 1999/02/10, revision: 1.6, converted to HTML: 1999/02/10

Modula-2 || Compiler & Tools || Library || Search Engine