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.

-c
Suppress the loading phase of the compilation, and force an object file to be produced even if only one program is compiled.
-S
Compile the named Modula-2 programs, and leave the assembler-language output on corresponding files suffixed `.s'.
-o output
Name the final output file output. If this option is used the file `a.out' will be left undisturbed.
-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.
-LP
Print a complete listing for all source files on stdout.
-Tdir
Allocate the temporary files of the compiler in the directory dir.
-a
Suppress archiving of the reference and symbol files even if `SYM' and `REF' exist.
-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.
-m
The following argument is taken to be the main module. Necessary only if no main module exists.
-M
Generate stack overflow checks. This is useful for coroutines only and may only specified together with -0c.
-C
Suppress range checks.
-N
Do not put line number information in the object file.
-p
Arrange for the compiler to produce code that counts the number of times each routine is called; also, if link editing takes place, replace the standard startoff routine by one that automatically calls Monitor(3MOD) at the start and arranges to write out a mon.out file at normal termination of execution of the object program. An execution profile can then be generated by use of mprof(1).
-0c
This option must be present at link time if coroutines or priorities are used and causes another startoff routine to be taken.
-R
Suppress clean up of temporary files.
-v
Verbose flag. M2c prints all executed commands to standard error.
-7
This option implies -S and causes the compiler to produce assembly code for UNIX Edition VII.
-Bstring
Find substitute compiler passes in the directory named /usr/lib/modula/string with the files m0, m1, m2, m3, msym.

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'. Archives with leading `p' are intended to be profiled and are taken if and only if the -p option is present. In this case other archives are to be ignored. 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
/u/lib/modula/m[0-3s]*
compiler for m2c
/u/lib/modula/m2e
lister
/u/lib/modula/m2_error
file with error messages
/u/lib/modula/m2rt0.o
runtime startoff
/u/lib/modula/cm2rt0.o
runtime startoff (-0c flag)
/u/lib/modula/mm2rt0.o
runtime startoff (-p flag)
/u/lib/modula/libm2.a
standard library
/u/lib/modula/plibm2.a
profiled standard library
/u/lib/modula/SYM
symbol files of the std library
/u/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 Zuerich, 1984
ld(1), mdb, mmm, mprof

DIAGNOSTICS

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

CAVEAT

The first 11 characters of the module name should be identical to the file name.
Edited by: borchert, last change: 1997/01/22, revision: 1.2, converted to HTML: 1997/01/22

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