Linux Blog

P2CC

NAME

p2cc - Pascal compiler using p2c

SYNOPSIS

p2cc
[ options and files ]

DESCRIPTION

P2cc
is a Pascal compiler that works by running
p2c,
the Pascal to C translator, followed by
cc,
the C compiler.

All command-line options and arguments are passed directly to
the C compiler, except that files ending with
.p
or
.pas
are passed through
p2c
first, and that the options listed below are interpreted specially by
p2cc.
As usual, programs made up of several source modules can be compiled
all on one
p2cc
command, or separately using
p2cc -c
and then linked afterwards with a final
p2cc
command.

OPTIONS

-p2c

Translate
.p
and
.pas
files to C but do not compile the resulting
.c
files. This is analogous to the
-S
and
-c
options of most C compilers, which stop with assembly language or
unlinked object files, respectively.

-p2coption

Pass
option
to
p2c
rather than to the C compiler.

-O

This switch is passed on to the C compiler to enable optional
optimization of the program. It also instructs
p2c
to do a few optimizations of its own, e.g., disabling certain
run-time range checks.

-Idir

The
-I
switch is passed to both
p2c
and the C compiler, where it will identify places to look for
Pascal interface texts or C
.h
files, respectively.

-v

Enable "verbose" mode. This affects both
p2c
and the C compiler.

ENVIRONMENT

The following environment variables may be used to affect the
operation of
p2cc.

P2CC_PAT

This variable holds a regular expression for recognizing the names
of Pascal files. By default, it recognizes strings which end in
.p
or
.pas.

P2CC_CC

This holds the name of the command to run the C compiler.
Default is
cc.

P2CC_CCOPTS

This holds additional arguments to be passed to the
cc
command, before the names of any source files.

P2CC_CCOPTS2

These arguments are passed to the
cc
command
after
the names of source files.

P2CC_LIBP2C

This is the name of the
libp2c.a
file holding
p2c
runtime routines. Its default is
-lp2c,
which causes the linker to look for
libp2c.a
in the usual places for libraries.

P2CC_P2C

This holds the name of the command to run
p2c.
It is
p2c
by default.

P2CC_P2COPTS

These are arguments to be passed to
p2c
on the command line. The default specifies
-comp,
which set the defaults for various
p2c
configuration options to be more suitable for compilation rather
than translation, and
-local,
which sets other options to work on the assumption that the output
from
p2c
will be compiled and run on the same type of machine that ran
p2c
itself.

P2CC_SUFFIX

This is the suffix to use for the names of temporary C source files.
The default is
..c,
ensuring that
p2c
will not inadvertently erase
.c
files in the same directory as the Pascal source files. Note that
if the
-p2c
option is used, the suffix is forced instead to
.c
since the user has explicitly asked for C source files.