Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

pi(1)

pxp(1)

pxref(1)

PC(1)  —  USER COMMANDS

NAME

pc − Pascal compiler

SYNOPSIS

pc [ −align _block ] [ −b ] [ −c ] [ −C ] [ −dryrun ] [ −Dname[=def ] ] [ float_option ]

[ −g ] [ −help ] [ −H ] [ −iname ... ] [ −Ipathname ] [ −J ] [ −l ] [ −llib ]

[ −lpfc ] [ −L ] [ −o outfile ] [ −O ] [ −p ] [ −pg ] [ −pipe ] [ −P ]

[ −Qoption prog opt ] [ −Qpath pathname ] [ −Qproduce sourcetype ] [ −R ] [ −s ]

[ −S ] [ −tdir ] [ −temp=dir ] [ −time ] [ −Uname ] [ −v ] [ −V ] [ −w ] [ −z ] [ −Z ] sourcefile ...

DESCRIPTION

pc is the Sun Pascal compiler.  If given an argument file ending with .p, pc compiles the file and leaves the result in an executable file, called a.out by default. 

A program may be separated into multiple .p files.  pc compiles a number of .p files into object files (with the extension .o in place of .p).  Object files may then be linked into an executable file.  Exactly one object file must supply a program statement to successfully create an executable file.  The rest of the files must consist only of declarations which logically nest within the program.  References to objects shared between separately compiled files are allowed if the objects are header files declared with include statements.  Names of header files must end with .h.  Header files may only be included at the outermost level, and thus declare only global objects.  To allow external functions and procedures to be declared, an external directive has been added, whose use is similar to the forward directive but restricted to appear only in .h files.  function and procedure bodies may not appear in .h files.  A binding phase of the compiler checks that declarations are used consistently, to enforce the type checking rules of Pascal. 

Filenames ending in .il are taken to be in-line expansion code template files; these are used to expand calls to selected routines in-line when the −O option is in effect. 

Object files created by other language processors may be linked together with object files created by pc. The functions and procedures they define must have been declared in .h files included by all the .p files which call those routines. 

Pascal’s calling conventions are compatible with those of C, with var parameters passed by address and other parameters passed by value. 

pc(1) supports ISO Level 1 Standard Pascal, including conformant array parameters.  Deviations from the ISO Standard are noted under BUGS below. 

See the Pascal User’s Manual for details. 

OPTIONS

See ld(1) for link-time options.

−align  _block
Cause the global symbol whose Pascal name is block to be page-aligned: its size is increased to a whole number of pages, and its first byte is placed at the beginning of a page. 

−b Buffer the file output in units of disk blocks, rather than lines. 

−c Suppress linking with ld(1) and produce a .o file for each source file. 

−C Compile code to perform subscript and subrange checks, and verify assert statements.  Note that pointers are not checked.  This option differs significantly from the -C option of the cc compiler. 

−dryrun Show but do not execute the commands constructed by the compilation driver. 

−Dname[=def ]
Define a symbol name to the C preprocessor (cpp(1)). Equivalent to a #define directive in the source.  If no def is given, name is defined as ‘1’. 

float_option Floating-point code generation option.  Can be one of:

−f68881
in-line code for the Motorola 68881 floating-point coprocessor (supported only on Sun-3).

−ffpa in-line code for the Sun Floating-Point Accelerator (supported only on Sun-3). 

−fsky in-line code for the Sky floating-point processor (supported only on Sun-2). 

−fsoft
software floating-point calls (This is the default).

−fswitch
run-time-switched floating-point calls. The compiled object code is linked at runtime to routines that support one of the above types of floating point code.  This was the default in previous releases. Only for use with programs that are floating-point intensive, and which must be portable to machines with various floating-point options.

−g Produce additional symbol table information for dbx(1) and pass the −lg flag to ld(1).

−help Display helpful information about pc. 

−H Compile code to perform range checking on pointers into the heap. 

−i name ... Produce a listing for the specified procedures, functions and include files. 

−Ipathname Add pathname to the list of directories in which to search for #include files with relative filenames (not beginning with slash /).  The preprocessor first searches for #include files in the directory containing sourcefile, then in directories named with −I options (if any), and finally, in /usr/include . 

−J Generate 32-bit offsets in switch statement labels. 

−l Make a program listing during translation. 

−llib Link with object library lib (for ld(1)).

−lpfc Link with common startup code for programs containing mixed Pascal and FORTRAN 77 object files.  Such programs should also be linked with the FORTRAN 77 libraries (see FILES below). 

−L Map upper case letters in keywords and identifiers to lower case. 

−o outfile Name the output file outfile.  outfile must have the appropriate suffix for the type of file to be produced by the compilation (see FILES, below).  outfile cannot be the same as sourcefile (the compiler will not overwrite the source file). 

−O Optimize the object code. 

−p Prepare the object code to collect data for profiling with prof(1). Invokes a run-time recording mechanism that produces a mon.out file (at normal termination). 

−pg Prepare the object code to collect data for profiling with gprof(1). Invokes a run-time recording mechanism that produces a gmon.out file (at normal termination). 

−pipe Use pipes, rather than intermediate files, between compilation stages.  (Very cpu-intensive.) 

−P Use partial evaluation semantics for the boolean operators and and or.  For these operators only, left-to-right evaluation is guaranteed, and the second operand is evaluated only if necessary to determine the result. 

−Qoption prog opt
Pass the option opt to the program prog.  The option must be appropriate to that program and may begin with a minus sign.  prog can be one of: as, cpp, or ld. 

−Qpath pathname
Insert directory pathname into the compilation search path (to use alternate versions of programs invoked during compilation). 

−Qproduce sourcetype
Produce source code of the type sourcetype.  sourcetype can be one of:

.pi Preprocessed Pascal source from cpp(1).

.o Object file from as(1).

.s Assembler source (from c2, f1 or inline).

−R Merge data segment with text segment for as(1).

−s Accept standard Pascal only; nonstandard constructs and extensions cause warning diagnostics. 

−S Compile the named program, and leave the assembly language output on the corresponding file suffixed .s.  No .o is created. 

−temp=dir Set directory for temporary files to be dir. 

−time Report execution times for the various compilation passes. 

−Uname Remove any initial definition of the cpp(1) symbol name.  (Inverse of the −D option.) 

−v Verbose.  Print the version number of the compiler and the name of each program it executes. 

−V Report hard errors for nonstandard Pascal constructs. 

−w Suppress warning messages. 

−z Allow execution profiling with pxp(1) by generating statement counters, and arranging for the creation of the profile data file pmon.out when the resulting object is executed. 

−Z Initialize local variables to zero. 

Other arguments are taken to be linker option arguments or libraries of pc-compatible routines. Certain flags can also be controlled by comments within the program, as described in the Pascal User’s Manual in the Sun Pascal Manual. 

ENVIRONMENT

FLOAT_OPTION
When no floating-point option is specified, the compiler uses the value of this environment variable (if set).  Recognized values are: f68881, ffpa, fsky, fswitch and fsoft. 

FILES

a.out executable output file

file.a library of object files

file.c C source file

file.d tcov(1) test coverage input file

file.f F77 source file

file.F F77 source file for cpp(1)

file.il inline expansion file

file.o object file

file.p Pascal source file

file.pi Pascal source after preprocessing with cpp(1)

file.r Ratfor source file

file.s assembler source file

file.S assembler source for cpp(1)

file.tcov output from tcov(1)

/lib/c2 object code optimizer

/lib/compile compiler command-line processing driver

/lib/cpp macro preprocessor

/lib/crt0.o runtime startoff

/lib/f1 code generator

/lib/Fcrt1.o startup code for −fsoft option

/lib/gcrt0.o startoff for profiling with gprof(1)

/lib/libc.a standard library, see intro(3)

/lib/mcrt0.o startoff for profiling with prof(1)

/lib/Mcrt1.o startup code for −f68881 option

/lib/Scrt1.o startup code for −fsky option

/lib/Wcrt1.o startup code for −ffpa option

/usr/include standard directory for #include files

/usr/lib/how_pc basic usage explanation

/usr/lib/libc_p.a profiling library, see intro(3)

/usr/lib/libF77.a FORTRAN 77 library

/usr/lib/inline inline expander of library calls

/usr/lib/libI77.a FORTRAN 77 library

/usr/lib/libm.a math library

/usr/lib/libpc.a intrinsic functions and Pascal I/O library

/usr/lib/libpfc.a startup code for combined Pascal and FORTRAN 77 programs

/usr/lib/pc0 compiler front end

/usr/lib/pc2.il inline expansion templates for Pascal library

/usr/lib/pc3 separate compilation consistency checker

/usr/lib/libU77.a
FORTRAN 77 library

/tmp/∗ compiler temporary files

mon.out file produced for analysis by prof(1)

gmon.out file produced for analysis by gprof(1) intro(3)

SEE ALSO

pi(1), pxp(1), pxref(1)

Pascal Programmer’s Guide

Floating-Point Programmer’s Guide for the Sun Workstation

DIAGNOSTICS

For a basic explanation do

tutorial% pc

In the diagnostic output of the translator, lines containing syntax errors are listed with a flag indicating the point of error.  Diagnostic messages indicate the action which the recovery mechanism took in order to be able to continue parsing.  Some diagnostics indicate only that the input is ‘malformed.’ This occurs if the recovery can find no simple correction to make the input syntactically valid. 

Semantic error diagnostics indicate a line in the source text near the point of error.  Some errors evoke more than one diagnostic to help pinpoint the error; the follow-up messages begin with an ellipsis ‘...’. 

The first character of each error message indicates its class:

EFatal error; no code will be generated. 

eNonfatal error. 

wWarning − a potential problem. 

sNonstandard Pascal construct warning. 

If a severe error occurs which inhibits further processing, the translator will give a diagnostic and then ‘QUIT’. 

Names whose definitions conflict with library definitions draw a warning.  The library definition will be replaced by the one supplied in the Pascal program.  Note that this can have unpleasant side effects. 

BUGS

The keyword packed is recognized but has no effect.  The ISO standard requires packed and unpacked structures to be distinguished for portability reasons. 

Binary set operators are required to have operands with identical types; the ISO standard allows different types, as long as the underlying base types are compatible. 

The −z flag doesn’t work for separately compiled files. 

Sun Release 3.2  —  Last change: 29 May 1986

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026