PC(1) — USER COMMANDS
NAME
pc − Pascal compiler
SYNOPSIS
pc [ −a ] [ −align _block ] [ −b ] [ −B binding ] [ −c ] [ −C ] [ −calign ] [ −cond ]
[ −config variable ] [ −cg87 ] [ −cg89 ] [ −cg92 ] [ −dalign ] [ −Dname[=def ] ] [ −dn ]
[ −dryrun ] [ −dy ] [ −fast ] [ −g ] [ −G ] [ −H ] [ −help ] [ −i name ] [ −Ipathname ]
[ −l ] [ −llib ] [ −lpfc ] [ −L ] [ −misalign ] [ −native ] [ −nolib ] [ −nolibmil ] [ −notb ]
[ −o filename ] [ −O[level] ] [ −p ] [ −P ] [ −pg ] [ −pic ] [ −PIC ] [ −pipe ]
[ −Qoption program option ] [ −qp ] [ −Qpath pathname ] [ −Qproduce sourcetype ]
[ −R] [ −R path] [ −s[level] ] [ −S ] [ −sb ] [ −sbfast ] [ −t ] [ −tc ] [ −temp=dir ] [ −time ]
[ −U name ] [ −v ] [ −V ] [ −V[level] ] [ −w ] [ −xF ] [ −xl ] [ −xs ] [ −Z ] sourcefile ...
DESCRIPTION
This man page describes the Pascal 3.0 release for SunOS 5.0 and an equivalent release of Pascal for SunOS 4.1.x, where x stands for SunOS 4.1.1, 4.1.2, or 4.1.3. pc is the SPARCompiler 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.
OPTIONS
−a Insert code to count how many times each basic block is executed. See tcov(1).
−align _block_
(SunOS 5.0): This option is provided for compatibility with older releases. It is recognized, so it does not break any make files. It does not do anything; however a warning is generated and the option argument is ignored. (SunOS 4.1.x): Cause the common block whose Pascal symbol 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. For example, the following command causes BUFFO to be page-aligned: pc −align _BUFFO_ growth.p This option applies to uninitialized data only: if any variable of the common block is initialized in a DATA statement, then the block will not be aligned. This option is passed to the linker, and is not used at all by the compiler.
−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.
−c Suppress linking with ld(1) and produce a .o file for each source file.
−C Compile code to perform subscript, subrange, and other checks, and verify assert statements. Note that pointers are not checked. This option differs significantly from the -C option of the cc compiler.
−calign Use C-style data formats.
−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 and use the −xl option.
−cg87 (SunOS 4.1.x only): For both the older and newer Sun-4 systems. This directs the code generator to produce instruction scheduling and special instructions to exploit features available on Sun-4 systems released in 1987 or later. It also uses the appropriate in-line templates. It does not exploit features such as the fsqrts and fsqrtd instructions that are implemented in hardware on only the newer Sun-4 systems. The −cg87 option is the default.
−cg89 (SunOS 5.0 and SunOS 4.1.x): Generate code for any newer Sun-4 system 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. Use the fpversion(1) command to tell you which floating-point hardware you have, and which floating-point option to use. It may take about a minute to display its report.
−cg92 (SunOS 5.0 and SunOS 4.1.x only): For the newest SPARC computers. This directs the code generator to produce instruction scheduling and special instructions to exploit features available on SPARC systems released in 1992 or later. It also uses the appropriate in-line templates. Examples of such code are the integer multiply and divide instructions. Use the fpversion(1) command to tell you which floating-point hardware you have, and which floating-point option to use. It may take about a minute to display its report. Consistency: The −cg87, −cg89, and −cg92 options are mutually exclusive; you must use them consistently. This means that if you compile any procedure with one of these options, then you should compile all procedures of the program with same option. Similarly, for a library, compile all procedures in a library with the same −cg87, −cg89, or −cg92 option.
−dalign Assume that all double-precision floating point values are doubleword aligned. Orders the compiler to generate double load/store instructions whenever possible for faster execution.
−dn Same as −Bstatic.
−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’.
−dryrun Show, but do not execute, the commands constructed by the compilation driver.
−dy Same as −Bdynamic.
−fast Select the combination of compilation options that optimizes for speed of execution without excessive compilation time. This should provide close to the maximum performance for most realistic applications. It chooses the options −O2, −fnonstd, and −dalign and chooses a set of inline expansion templates. Do not use this option for programs that depend on IEE standard exception handling.
−g Produce additional symbol table information for dbx(1) and debugger(1) and pass the −lg flag to ld(1).
−G (SunOS 5.0 ONLY): Direct the link editor to produce a shared object rather than a dynamically linked executable. This option is passed to ld.
−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.
−Ipathname 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), and, finally, in /usr/include .
−l Make a program listing during translation.
−llib Link with object library lib (for ld(1)).
−L Map all identifiers and keywords to lower case.
−Ldirectory Add directory to ld library path.
−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.
−misalign Allow for misaligned data in memory.
−native Generate code for best floating-point hardware available on the machine you are compiling on.
−nolib Do not automatically link with any system or language library; that is do not pass any −lx options on to ld. The default is to link such libraries into the executables automatically, without the user specifying them on the command line. The system and language libraries are required for final execution. It is the users responsibility to link them in manually. This provides complete control (and with control comes responsibility) for the user. The −nolib option makes it easier to link one of these libraries statically. For example, an application linked dynamically with libpc fails on a machine that has no libpc. You can avoid such failure by shipping libpc to your customer, or by linking it statically.
Example: Link libpc statically and link libc dynamically.
pc −nolib any.P −Bstatic −lpc −Bdynamic −lm −lc
There is no dynamic libm; it is always linked statically.
Order for −lx options is important. Use the order shown in the example.
−nolibmil
Reset the −fast option so it does not include inline templates.
−notrace
Disable traceback. This option will turn off the runtime traceback. It is only effective when compiling the main program.
−o filename
Name the object file filename. This file must have the appropriate suffix for the type of file to be produced by the compilation (see FILES, below). filename cannot be the same as the source file; the compiler will not overwrite the source file.
−O[level]
Optimize the object code. 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 are not recommended because of the extreme increase in compilation time and relatively minor improvement over -O2 in runtime performance (for most programs).
−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 Generate position independent (PIC) code.
−pipe
Use pipes, rather than intermediate files, between 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.
−PIC Generate position independent (PIC) code.
−Qoption program option
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, or pc3.
−qp Same as −p option.
−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 sourcetype
Produce source code of the type sourcetype. This can be one of the following type:
.pi Preprocessed Pascal source from cpp(1).
.o Object file from as(1).
.s Assembler source (from c2 or inline(1)).
−R Available with SunOS 4.x compiler only. Assemble with the −R flag, which merges the data segment with the text segment. See as(1) for more information.
−s[level]
Accept standard Pascal only; nonstandard constructs and extensions cause warning diagnostics. SPARCompiler Pascal has two levels of compliance with standard Pascal: Level 0 and Level 1. The option can be one of:
−R path
SunOS 5.0 only: Library paths. Store path in the output object file and pass path to the run-time linker, ld(1). path is a colon-separated list of directories used to specify library search directories to the run-time linker. If both LD_RUN_PATH and the −R option are specified, the libraries in the −R list are scanned first. Use this if you want to ship an executable that your users can run without any special option for paths to your dynamic libraries.
−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.
−sbfast
Produce only additional table information for the SourceBrowser and stop. Do not assemble, link, etc. Do not make object files. This is similar to −sb, but -sbfast produces code browser data base only.
−t Available with SunOS 4.x compiler only. Pass the program to the linker for verbose messages.
−tc Generate pc3 stab information to allow cross-module type checking.
−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.
−V Report versions of the programs invoked by the compiler 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.
−xF (SunOS 5.0 only): Function-level reordering. Enable performance analysis of the executable using the SPARCworks Analyzer and Debugger (see analyzer(1) and debugger(1) man pages). This option also causes the assembler to generate some debugging information in the object file, necessary for data collection. Generate code that can be reordered at the function level. This takes each function in the file and places it into a separate section. For example, functions fcn1() and fcn2() are placed in the sections .text%fcn1 and .text%fcn2. You can control the order of functions in the final executable by using this -xF option and the loader -Mmapfile option. Within the mapfile, if you include the flag O (that’s an oh, for order, not a zero) in the string of segment flags, then the static linker ld will attempt to place sections in the order they appear in the mapfile. See Linker and Libraries Manual for SunOS 5.0 for more about this option, the segment flags, and the mapfile.
−xl Implement the extended language features of 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.
−xs When passed to the drivers will be translated to the option −s which will be passed to the assembler. This option causes the assembler to place all stabs in the .stab section. By default all stabs will be placed in the .stab.excl section. The static linker ’ld’ always strips out the .stab.excl section. Hence this option is to be used only in cases where the stabs have to remain in the final executable in the ".stab" section.
−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 Guide.
ENVIRONMENT
PATH Installation Path:
•On SunOS 5.0, the installation path should be: /opt/SUNWspro .
•On SunOS 4.1.x, the installation path should be: /usr/lang . or your_dir . Before you use the pc command do one of the following:
•If you installed into the standard, default directory in SunOS 5.0, then insert /opt/SUNWspro/bin at the beginning of your search path and /usr/lang on SunOS 4.1.xfP.
•If you installed into a non-default directory such as /your_dir , then insert /your_dir/bin at the beginning of your search path. This is usually done in the .cshrc file, with set PATH = at the beginning of a line.
MANPATH Before you use the man command for pc man pages, do one of the following:
•If you installed into the standard, default directory, then insert /opt/SUNWspro/man on SunOS 5.0 or /usr/lang on SunOS 4.1.x at the beginning of your man path.
•If you installed into a non-default directory such as /your_dir, then insert /your_dir/man at the beginning of your man path. This is usually done in the .cshrc file, in a line with set MANPATH = at the start.
NOTE It is safer to avoid the environment variable LD_LIBRARY_PATH if you can, but if you must use it, do one of the following:
•If you installed into the standard /opt/SUNWspro, put the path /opt/SUNWspro/SCx.0 at the start of the LD_LIBRARY_PATH path list. (Here, x = 0 for SPARCompiler 0.0, x = 1 for SPARCompiler 1.0, and so on.)
•If you installed into a non-default directory, such as /your_dir , then put the path /your_dir/SCx.0 at the start of that path list.
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) The remaining files are normally in the following directories: For SunOS 5.0:
/opt/SUNWspro/SCx.0 For SunOS 4.x:
/usr/lang/SCx.0 And if you created /your_dir, instead of into the normal /opt/SUNWspro:
/your_dir/SCx.0 where x = 0 for SPARCompiler 0.0, x = 1 for SPARCompiler 1.0, and so on.
cpp C preprocessor
crt0.o runtime startup
gcrt0.o startup for profiling with gprof(1)
libc.a standard library, see intro(3)
mcrt0.o startup for profiling with prof(1)
as assembler
include/pascal/unixio.h standard #include file
include/pascal/unixio.i standard #include file
/include/pascal/ioerr.h standard #include file
libc_p.a profiling library, see intro(3)
libm.a math library
libpc.a intrinsic functions and Pascal I/O library
libpc.so.2.0 shared library
libpfc.a startup code for combined Pascal and FORTRAN 77 programs
libpfc_p.a profiling library for combined Pascal and FORTRAN 77 programs
cg code generator
inline inline expander of library calls
iropt object code optimizer
pc0 compiler front end
pc3 separate compilation consistency checker
pcexterns.o external definitions
man/man1/pc.1 manual page
cppas Pascal preprocessor
dbx debugger
pc compiler command-line processing driver for Pascal
/tmp/∗ compiler temporary files
mon.out file produced for analysis by prof(1)
gmon.out file produced for analysis by gprof(1)
SEE ALSO
Pascal User Guide
Pascal Reference Manual
Floating-Point Programmer’s Guide
DIAGNOSTICS
For a basic explanation, execute the following command:
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 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.
Pascal 3.0.1 — Last change: August 14 1992