PC(1) USER COMMANDS PC(1) NAME pc - Pascal compiler SYNOPSIS pc [ -align _block ] [ -b ] [ -c ] [ -C ] [ -dryrun ] [ -Dname[=def ] ] [ float_option ] [ -g ] [ -help ] [ -H ] [ -i name ] [ -Ipathname ] [ -J ] [ -l ] [ -llib ] [ -lpfc ] [ -L ] [ -misalign ] [ -o outfile ] [ -O[level]] [ -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 com- piles 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 in header files declared with include statements. Names of header files should 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, there is an external directive, 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 linked together with object files created by pc. The func- tions and procedures they define must have been declared in .h files included by all the .p files which call those rou- tines. pc(1) supports ISO Level 1 Standard Pascal, including con- formant array parameters. See the Sun Pascal Programmer's Guide for details. Sun Release 4.1 Last change: 23 May 1988 1 PC(1) USER COMMANDS PC(1) 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, subrange checks, some other 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 compiler 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. This option cannot be used on Sun-4 systems. On other systems, it can be one of: -f68881 in-line code for Motorola 68881 floating- point processor (Sun-3 only). -ffpa in-line code for the Sun Floating Point Accelerator (Sun-3 only). -fsoft software floating-point calls. (This is the default.) -fsky in-line code for Sky floating-point processor (Sun-2 only). -fswitch run-time switched floating-point calls. The compiled object code is linked at runtime to Sun Release 4.1 Last change: 23 May 1988 2 PC(1) USER COMMANDS PC(1) routines that support one of the above types of floating-point code. This was the default in some previous releases. Only for use with programs that are floating-point intensive and that 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. -iname Produce a listing for the specified procedure, function, or include files. -Ipathname Add pathname to the list of directories in which to search for #include files with relative filenames (not beginning with /). The preproces- sor first searches for #include files in the directory containing sourcefile, then in direc- tories 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 con- taining mixed Pascal and FORTRAN object files. Such programs should also be linked with the FOR- TRAN libraries (see FILES below). -L Map upper-case letters in keywords and identifiers to lower-case. -misalign Allow for misaligned data in memory (Sun-4 only). -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 com- piler will not overwrite the source file). -O[level] Optimize the object code. Ignored when -g is Sun Release 4.1 Last change: 23 May 1988 3 PC(1) USER COMMANDS PC(1) used. level is one of: 1 Do postpass assembly-level optimization only. 2 Do global optimization prior to code genera- tion, 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. 3 Same as -O2, but optimize uses and defini- tions of external variables. -O3 does not trace the effects of pointer assignments. Neither -O3 nor -O4 should be used when com- piling 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. -p Prepare the object code to collect data for pro- filing 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 pro- filing with gprof(1). Invokes a run-time record- ing mechanism that produces a gmon.out file (at normal termination). -pipe Use pipes, rather than intermediate files, between compilation stages. (This option is 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. Sun Release 4.1 Last change: 23 May 1988 PC(1) USER COMMANDS PC(1) -Qpath pathname Insert directory pathname into the compilation search path (to use alternative versions of pro- grams invoked during compilation). This path will also be searched first for certain relocatable object files that are implicitly referenced by the compiler driver (such files as *crt*.o and bb_link.o ). -Qproduce sourcetype Produce source code of the type sourcetype. sour- cetype can be one of: .pi Preprocessed Pascal source from cpp(1). .o Object file from as(1). .s Assembler source (from c2 or inline). -R Assemble with the -R flag, which merges the data segment with the text segment. See as(1) for more information. -s Accept standard Pascal only; nonstandard con- structs and extensions cause warning diagnostics. 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 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 name of each program it exe- cutes. -V Turns on all possible checks. This option is the same as turning on the -C , -H , -L , and -s options. -w Suppress warning messages. -z Allow execution profiling with pxp(1) by generat- ing statement counters. When you compile with this option, the resulting object file creates the profile data file pmon.out when you execute it. Sun Release 4.1 Last change: 23 May 1988 5 PC(1) USER COMMANDS PC(1) -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 Programmer's Guide. FILES a.out executable output file file.a library of object files file.d tcov(1) test coverage input file file.il inline expansion file file.o object file file.p 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) /lib/cpp macro preprocessor /lib/crt0.o runtime startup /lib/gcrt0.ostartup for profiling with gprof(1) /lib/libc.a standard library, see intro(3) /lib/mcrt0.ostartup for profiling with prof(1) /usr/lib/c2 object code optimizer /lib/optim object code optimizer for Sun386i /usr/ucb/pc compiler command-line processing driver for Pas- cal /usr/includestandard directory for #include files /usr/include/pascal/unixio.h /usr/include/pascal/unixio.i /usr/lib/how_pc basic usage explanation /usr/lib/how_pxp basic usage explanation for /usr/lib/pascal/iropt object code optimizer /usr/lib/iropt object code optimizer for Sun386i /usr/lib/libc_p.a profiling library, see intro(3) /usr/lib/inline inline expander of library calls /usr/lib/libm.a math library /usr/lib/libpc.a intrinsic functions and Pascal I/O library /usr/lib/pc_p.a profiling library /usr/lib/libpfc.a startup code for combined Pascal and FORTRAN 77 programs /usr/lib/libpfc_p.a Sun Release 4.1 Last change: 23 May 1988 6 PC(1) USER COMMANDS PC(1) profiling library for combined Pascal and FOR- TRAN 77 programs /usr/lib/pascal/cg code generator /usr/lib/cg code generator for Sun386i /usr/lib/pcexterns.o external definitions /usr/lib/pc0compiler front end /usr/lib/pc2.il inline expansion templates for Pascal library /usr/lib/pc3separate compilation consistency checker /usr/lib/pc4.0strings error message strings /usr/man/man1/pc.1 /usr/man/man1/pxp.1 man pages /usr/ucb/dbxdebugger /usr/ucb/pxpprofiler and formatter /usr/old/pmerge file merger /usr/old/pxref cross reference program /tmp/* compiler temporary files mon.out file produced for analysis by prof(1) gmon.out file produced for analysis by gprof(1) SEE ALSO pxp(1), pxref(1) Sun 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: E Fatal error; no code will be generated. e Nonfatal error. w Warning - a potential problem. s Nonstandard Pascal construct warning. If a severe error occurs which inhibits further processing, the translator will give a diagnostic and then `QUIT'. Sun Release 4.1 Last change: 23 May 1988 7 PC(1) USER COMMANDS PC(1) 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. 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 4.1 Last change: 23 May 1988 8