PC(1) — USER COMMANDS
NAME
pc − Pascal compiler
SYNOPSIS
pc [ −c ] [ −g ] [ −o output ] [ −O ] [ −b ] [ −C ] [ −Dname[=def] ] [ float_option ] [ −H ]
[ −i name ... ] [ −I dir ] [ −l ] [ −lpfc ] [ −L ] [ −p ] [ −P ] [ −pg ] [ −s ] [ −S ]
[ −U name ] [ −w ] [ −z ] [ −Z ] filename.p ...
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 more than one .p file. Pc will compile a number of .p files into object files (with the extension .o in place of .p). Object files may then be loaded into an executable a.out file. Exactly one object file must supply a program statement to successfully create an executable a.out 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 declared in included header files, whose names must end with .h. Header files may only be included at the outermost level, and thus declare only globally available 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.
Object files created by other language processors may be loaded 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 load-time options.
−c Suppress loading and produce .o file(s) from source file(s).
−g Produce additional symbol table information for the symbolic debugger dbx(1).
−o name
Name the final output file name instead of a.out.
−O Optimize the object code.
−b Buffer the file output in units of disk blocks, rather than lines.
−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.
−Dname[=def]
Define the string name for use by the preprocessor, as if by a #define directive. If no def is given, name is defined as 1.
float_option
Floating-point code generation option. Can be one of:
−fsoft software floating-point calls (This is the default).
−fsky in-line code for Sky floating-point processor (supported only on Sun-2).
−f68881 in-line code for Motorola 68881 floating-point processor supported only on Sun-3).
−fswitch run-time-switched floating-point calls. The compiled object code is linked at run-time 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.
When invoked without float_option, the compiler interrogates the FLOAT_OPTION environment variable to determine the type of floating-point code to generate. Legal values for FLOAT_OPTION are: ‘fsoft’, ‘fsky’, ‘f68881’ and ‘fswitch’.
−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.
−Idir Add dir to the list of directories in which to search for #include files with names not beginning with slash The preprocessor first searches for #include in the directory containing filename.p, then in directories named with −I options (if any), and finally, in /usr/include .
−l Make a program listing during translation.
−lpfc Load common startup code for programs containing mixed Pascal and FORTRAN 77 object files. Such programs should also be loaded with the FORTRAN 77 libraries (see files below).
−L Map upper case letters in keywords and identifiers to lower case.
−p Prepare object files for profiling with gprof(1).
−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.
−pg Produce counting code in the manner of −p, but invoke a run-time recording mechanism that keeps more extensive statistics and produces a gmon.out at normal termination. An execution profile can then be generated using gprof(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.
−Uname
Remove any initial definition of name.
−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.
Other arguments are taken to be loader 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.
−Z Initialize local variables to zero.
FILES
file.pPascal source files
/lib/cppmacro preprocessor
/usr/lib/pc0compiler front end
/lib/f1code generator
/usr/lib/pc2inline expander of library calls
/lib/c2peephole optimizer
/usr/lib/pc3separate compilation consistency checker
/usr/lib/pc3.2stringstext of the error messages
/usr/lib/how_pcbasic usage explanation
/usr/lib/libpc.aintrinsic functions and I/O library
/usr/lib/libpfc.astartup code for combined Pascal and FORTRAN programs
/usr/lib/libF77.aFORTRAN intrinsics library
/usr/lib/libI77.aFORTRAN I/O library
/usr/lib/libU77.aFORTRAN<=>Unix interface library
/usr/lib/libm.amath library
/lib/libc.astandard library, see intro(3)
SEE ALSO
The Pascal User’s Manual in the Sun Pascal Manual.
pi(1), pxp(1), pxref(1)
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.
Because the −s option is usurped by the compiler, it is not possible to pass the strip option to the loader. Thus programs which are to be stripped, must be run through strip(1) after they are compiled.
Sun Release 3.0β — Last change: 21 December 1985