PC(1) — USER COMMANDS
NAME
pc − Pascal compiler
SYNOPSIS
pc [ −a ] [ −align _block ] [ −b ] [ −B binding ] [ −c ] [ −cond ] [ −config variable ] [ −C ] [ −cg87 ]
[ −cg89 ] [ −dalign ] [ −dryrun ] [ −Dname[=def ] ] [ −fast ] [ −ffloat_option ] [ [ −fnonstd ]
[ −fswitch ] [ −g ] [ −G ] [ −help ] [ −H ] [ −i name ] [ −I pathname ] [ −J ] [ −l ]
[ −l lib ] [ −lpfc ] [ −libmil ] [ −L ] [ −misalign ] [ −native ] [ −nolibmil ] [ −o filename ]
[ −O[level] ] [ −p ] [ −pg ] [ −pic ] [ −PIC ] [ −pipe ] [ −P ] [ −Qoption program option ]
[ −Qpath pathname ] [ −Qproduce sourcetype ] [ −R ] [ −s[level] ] [ −S ] [ −sb ]
[ −t ] [ −temp=dir ] [ −time ] [ −U name ] [ −v ] [ −V[level] ] [ −w ] [ −xl ] [ −Z ] sourcefile...
DESCRIPTION
pc is the Sun Pascal compiler. If given an argument file ending with .p (or .pas), 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 (or .pas) files. pc compiles a number of .p (or .pas) files into object files (with the extension .o in place of .p or .pas). 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.
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 by all the .p (or .pas) files which call those routines using the extern, external, or nonpascal routine options.
You must use the −lpfc and −lpc options when you compile a Pascal/FORTRAN program.
pc supports ISO Level 0 and Level 1 standard Pascal, including conformant array parameters.
ENVIRONMENT
PATH The pc command requires that you insert /usr/lang/SC1.0 (or the name of the directory in which you have chosen to install the pc compiler) at the beginning of your search path. This is usually done in the .cshrc file, in a line with set PATH = at the start.
MANPATH To use the man command for pc man pages, insert /usr/lang/SC1.0 (or the name of the directory in which you have chosen to install the pc compiler) at the beginning of your man path. This is usually done in the .cshrc file, in a line with setenv MANPATH = at the start.
NOTE If you must use LD_LIBRARY_PATH , be sure to put the path /usr/lang/SC1.0 (or the name of the directory in which you have chosen to install the pc compiler) at the start of that path list. It is safer to avoid this environment variable if you can.
OPTIONS
−a Insert code to count how many times each basic block is executed. See tcov(1).
−align _block
Cause the uninitialized 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 Turn on block-buffering with a block size of 1024.
−B binding Specify whether bindings of libraries for linking are static or dynamic, indicating whether libraries are non-shared or shared, respectively. Dynamic binding is the default.
−c Suppress linking with ld(1) and produce a .o file for each source file.
−cond Compile the lines in your program that begin with the %debug directive.
−config variable
Define the conditional variable whose name is variable for the preprocessor cppas. When you use −config, you must declare variable in your program with the %var directive.
−C Compile code to perform subscript, subrange, and other checks, and verify assert statements. Note that pointers are not checked. This option has no relation to the -C option of the cc compiler.
−cg87 Sun-4 only. Generate code for any Sun-4. It does not exploit features such as the fsqrts and fsqrtd instructions that are not implemented in hardware on all Sun-4 workstations.
−cg89 Sun-4 only. Generate code for any newer Sun-4 that has features like hardware fsqrts and fsqrtd instructions. Code compiled with −cg89 should not be executed on Sun-4/1xx and 4/2xx systems with Weitek 1164/5 floating-point hardware.
The −cg87 and −cg89 options are mutually exclusive. If you compile one procedure with one of these two options, then you should compile all procedures of the program with the same option.
−dalign Sun-4 only. Generate double load/store instructions whenever possible for improved performance. Assumes that all double typed data are double aligned, and should not be used when correct alignment is not assured.
−dryrun Show, but do not execute, the commands constructed by the compilation driver.
−Dname[=def ]
Define a symbol name to the preprocessor cpp(1). Equivalent to a #define statement in the source. If no def is given, name is defined as ‘1’.
−fast Select the optimum combination of compilation options for speed. This should provide close to the maximum performance for most realistic applications. It is a convenience option, and it chooses the fastest code generation option available on the compile-time hardware ( −cg8x on a Sun-4), the optimization level −02, a set of inline expansion templates, the −fnonstd floating-point option, and on a Sun-4, the −dalign option. If you combine −fast with other options, the last specification applies. The code generation option, the optimization level and using inline template files can be overridden by subsequent switches. For example, although the optimization part of −fast is −02 , the optimization part of −fast-03 is −03 . Do not use this option for programs that depend on IEEE standard exception handling; you can get different numerical results, premature program termination, or unexpected SIGFPE signals.
−fnonstd Cause non-standard initialization of floating-point arithmetic hardware. By default, IEEE 754 floating-point arithmetic is nonstop and underflows are gradual The −fnonstd option causes hardware traps to be enabled for floating-point overflow, division by zero, and invalid operation exceptions. These are converted into SIGFPE signals, and if the program has no SIGFPE handler, it will terminate with a memory dump. See ieee_handler(3m).
−ffloat_option
Floating-point code generation option. This option cannot be used on a Sun-4. On a Sun-3, it can be one of:
−f68881In-line code for the Motorola 68881 floating-point processor.
−ffpaIn−line code for the Sun Floating Point Accelerator.
−ffpaplusThis is the same as but it is for the FPA+ board. (Sun-3 only).
−fsoftSoftware floating-point calls. This is the default.
−fswitch Sun-3 only. 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. Only for use with programs that are floating-point intensive, and must be portable to machines with various floating-point hardware options. Using −fswitch is discouraged. Instead use fpversion –foption . See fpversion (1).
−g Produce additional symbol table information for dbx(1) and dbxtool(1) and pass the −lg flag to ld(1).
−G Generate pc3 stab information. This option enforces the rules of separate compilation used in the Sun Pascal 1.1 compiler.
−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 procedure, function, #include, or %include file.
−I pathname Add pathname to the list of directories in which to search for #include and %include files with relative filenames (not beginning with /). The preprocessor first searches for #include and %include files in the directory containing the source file, then in directories named with −I options (if any), /usr/lang/SC1.0/include, and finally, in /usr/include .
−J Generate 32-bit offsets in switch/case statement labels. This option applies to the Sun-3 only.
−l Make a program listing during translation.
−l lib Link with object library lib (for ld(1)).
−lpfc Link with common startup code for programs containing mixed Pascal and FORTRAN object files. Such programs should also be linked with the FORTRAN libraries.
−libmil Select the best inline templates for the floating-point option and SunOS release available on this system.
−L Map all identifiers and keywords to lower case.
−misalign Allow for misaligned data in memory (Sun-4 only).
−native Generate code for best floating-point hardware available on the machine you are compiling on.
−nolibmil Reset −fast so that it does not include inline templates. Use this after the −fast option:
pc –fast –nolibmil ...
−o filename Name the object file filename1. filename2 must have the appropriate suffix for the type of file to be produced by the compilation. filename cannot be the same as the source file; the compiler will not overwrite the source file.
−O[level] Optimize the object code. Ignored when −g is used. level is one of:
1 Do postpass assembly-level optimization only.
2 Do global optimization prior to code generation, including loop optimizations, common subexpression elimination, copy propagation, and automatic register allocation. −O2 does not optimize references to or definitions of external or indirect variables. This is the default.
3 Same as −O2, but optimize uses and definitions of external variables. −O3 does not trace the effects of pointer assignments. Neither −O3 nor −O4 should be used when compiling either device drivers or programs that modify external variables from within signal handlers.
4 Same as −O3, but trace the effects of pointer assignments.
−O without a level number is the same as −O2. Levels 3 and 4 may cause considerable increase in compilation time and relatively minor improvement over -O2 in runtime performance (for most programs).
If the optimizer runs out of memory, it tries to recover by retrying the current procedure at a lower level of optimization and resumes subsequent procedures at the original level specified in the command-line option.
If you optimize at −O3 or −O4 with very large procedures (thousands of lines of code in a single procedure), the optimizer may require an unreasonable amount of memory. In such cases, performance of the machine may degraded. You can prevent this in the C-shell by limiting the amount of virtual memory available to a single process. To do this, use the limit command (see csh(1)).
−p Prepare the object code to collect data for profiling with prof(1). Calls a runtime recording mechanism that produces a mon.out file (at normal termination).
−pg Prepare the object code to collect data for profiling with gprof(1). Calls a runtime recording mechanism that produces a gmon.out file (at normal termination).
−pic Produce position-independent code. Each reference to a global datum is generated as a dereference of a pointer in the global offset table. Each function call is generated in pc-relative addressing mode through a procedure linkage table. The size of the global offset table is limited to 64K on MC68000-family processors, or to 8K on SPARC processors.
−PIC Like −pic, but allows the global offset table to span the range of 32-bit addresses in those rare cases where there are too many global data objects for −pic.
−pipe Use pipes, rather than intermediate files, between some compilation stages. This option is 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 or −qoption prog opt
Pass option to program . The option must be appropriate to that program and may begin with a plus or minus sign. program can be as(1), c2, cpp(1), cppas, inline(1), iropt, ld(1), pc0, cg, cat, or pc3.
−Qpath or −qpath pathname
Insert directory pathname into the compilation search path (to use alternative versions of programs invoked during compilation). This path will also be searched first for certain relocatable object files that are implicitly referenced by the compilation driver.
−Qproduce or −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 or inline(1)).
−R Assemble with the −R flag, which merges the data segment with the text segment. See as(1) for more information. Incompatible with the −g option.
−s[level] Accept standard Pascal only; nonstandard constructs and extensions cause warning diagnostics. Sun Pascal has two levels of compliance with standard Pascal: Level 0 and Level 1. The option can be one of:
−s Accept Level 1 compliance with standard Pascal.
−s0 Accept Level 0 compliance with standard Pascal.
−s1 Same as −s.
This option also performs the action of −L; that is, it maps all upper case letters in keywords and identifiers to lower case.
−S Compile the named program, and leave the assembly language output on the corresponding file suffixed .s. No .o file is created.
−sb Produce additional table information for the SourceBrowser.
−t This flag is passed to the linker for verbose messages (see ld(1) ).
−temp=dir Set directory for temporary files to dir.
−time Report execution times for the various compilation passes.
−U name Remove any initial definition of the cpp(1) symbol name. (Inverse of the −D option.)
−v Verbose. Print the name of each program compiled. This prints commands constructed by the compilation driver.
−V Report versions of programs invoked by driver.
−V[level] Invoke a series of options, depending on the level:
−V0 Equivalent to −C, −H, −L, and −s0.
−V1 Equivalent to −C, −H, −L, and −s1.
−w Suppress warning messages.
−xl Implement the extended language features of Sun Pascal:
•Set default integer size to 16 bits.
•Set default real size to 32 bits.
•Set default enumerated type size to 16 bits.
•Run source file through the preprocesser /usr/ucb/cppas before processing it by the Pascal compiler.
•Support nonpascal as a routine option.
•Turn on the −L option.
•Set the default writing of enumerated and boolean variables to uppercase and 15-character width format.
•Do not generate an error if the value of the expression in a case statement does not match any of the case values.
•Do not generate an error when integer or real constant literals overflow implementation limits.
•Do not generate a warning when the argument to the addr function is a local or private variable.
•Set the default visibility for top-level variables, procedures, and functions in programs to private.
•Set the default visibility for top-level variables in modules to private and for top-level procedures and functions in modules to public.
−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 Sun Pascal User Guide.
FILES
a.out executable output file
file.a library of object files
file.d tcov(1) test coverage input file
file.il inline(1) expansion file
file.o object file
file.p Pascal source file
file.pas Pascal source file
file.pi Pascal source after preprocessing with cpp(1)
file.s assembler source file
file.S assembler source for cpp(1)
file.tcov output from tcov(1)
/usr/lang/SC1.0/cpp Sun pc preprocessor
/usr/lang/SC1.0/crt0.o runtime startup
/usr/lang/SC1.0/gcrt0.o
startup for profiling with gprof(1)
/usr/lang/SC1.0/libc.a standard library, see intro(3)
/usr/lang/SC1.0/mcrt0.o
startup for profiling with prof(1)
/usr/lang/SC1.0/as assembler
/usr/lang/SC1.0/include/pascal/unixio.h
standard #include file
/usr/lang/SC1.0/include/pascal/unixio.i
standard #include file
/usr/lang/SC1.0/include/pascal/ioerr.h
standard #include file
/usr/lang/SC1.0/libc_p.a
profiling library, see intro(3)
/usr/lang/SC1.0/libm.a math library
/usr/lang/SC1.0/libpc.a
intrinsic functions and Pascal I/O library
/usr/lang/SC1.0/libpc.so.2.2
shared library
/usr/lang/SC1.0/libpfc.a
startup code for combined Pascal and FORTRAN 77 programs
/usr/lang/SC1.0/libpfc_p.a
profiling library for combined Pascal and FORTRAN 77 programs
/usr/lang/SC1.0/libpxview.a
XView libraries for access from Pascal
/usr/lang/SC1.0/c2 object code optimizer for Sun-3
/usr/lang/SC1.0/cg code generator
/usr/lang/SC1.0/inline inline expander of library calls
/usr/lang/SC1.0/iropt object code optimizer
/usr/lang/SC1.0/pc0 compiler front end
/usr/lang/SC1.0/pc3 separate compilation consistency checker
/usr/lang/SC1.0/pcexterns.o
external definitions
/usr/lang/SC1.0/man/man1/pc.1
manual page
/usr/lang/SC1.0/man/man1/pindent.1
manual page
/usr/lang/SC1.0/cppas Sun Pascal preprocessor
/usr/lang/SC1.0/dbx debugger
/usr/lang/SC1.0/pc compiler command-line processing driver for Pascal
/usr/lang/SC1.0/pindent
Sun Pascal prettyprinter
/tmp/∗ compiler temporary files
mon.out file produced for analysis by prof(1)
gmon.out file produced for analysis by gprof(1)
SEE ALSO
Sun Pascal User Guide
Sun Pascal Reference Manual
Numerical Computation Guide
DIAGNOSTICS
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 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.
Sun Microsystems — Last change: 19 December 1990