
 				     PCC
				PasCal Compiler
				Rev  1.3 1/4/98

The program "pcc" is a front end to Dave Gillespie's "p2c" Pascal to "C"
translator. It is meant to work in a fashion similar to the "f77" front end
for the "f2c" Fortran to "C" translator. In the same way that "f77" creates
the illusion that it is a stand alone Fortran compiler, "pcc" is meant to
create the illusion that it is a stand alone Pascal compiler.

Command line syntax is similar to the "gcc" syntax and it supports the
various Optimization and flag switches supported by gcc. Example:

	pcc +E3 -O2 -m486  exmp1.p exmp2.p -s -lm -o exampl

"pcc" works by parsing the command line passed to it and constructing lines
to pass first to "p2c", then to gcc. Given the above command line example
"pcc" would invisibly execute the following commands:

p2c -E3  exmp1.p
p2c -E3  exmp2.p
gcc -I/usr/include -O2 -m486 -s -lm exmp1.c exmp2.c /usr/lib/libp2c.a -o exampl
rm exmp1.c exmp2.c
rm -f exmp1.h exmp2.h
rm -f exmp1.o exmp2.o
rm -f exmp1.log exmp2.log

"pcc" counts on "p2c" and "gcc" to print the error messages for the user.
The -c flag may be used to create .o files. Using revision 1.3 it is now
possible to use pcc to link the .o files together to create an executable.
Here is an example of a makefile demonstrating this use of pcc:



all : bin

PROG=fax

$(PROG).o : $(PROG).p
	pcc -O3 -m486 -fomit-frame-pointer -c $(PROG).p facts.p

$(PROG) : $(PROG).o
	pcc -s -o $(PROG) $(PROG).o facts.o

bin : $(PROG)


 
Giving "pcc" invalid "gcc" command lines may result in bizarre results;
"pcc" is a real representation of garbage in, garbage out.

pcc passes the following switches to p2c instead of to gcc (note the use of
the '+' sign instead of the '-' sign at the start of the switches) :

+s sfile
+v
+H homedir
+q
+En
+e
+L language
+V
+M0
+R

example:

pcc +V foo.p

will execute the following command lines invisibly:

p2c -V foo.p
gcc -I/usr/include foo.c /usr/lib/libp2c.a
rm foo.c 
rm -f foo.h
rm -f foo.o

The + options are converted to - options and sent to p2c.
 
See the gcc and p2c man pages for explanations of what the various switches
do.

*****NOTE******

The version of p2c shipped with Slackware 96 does not seem to recognize the
various command line options (except for the 'En' exit on error numbers
exceeding 'n'). These switches are included to conform to the published
specifications in the p2c man pages in case further development of p2c
brings it up to the specifications.

******NOTE******

Also included with Rev 1.3 is a simple shell script named "p". This shell
script creates an 'integrated' environment somewhat similar to the Turbo
Pascal environment, but in a much quicker to use Unix menu fashion. "p" is
easily modified to suit the tastes of the individual programmer; for
instance if 'vi' rather than a WordStar style editor is your cup of tea
replace references to 'jstar' with 'vi' in the shell script. Please note
that "p" allows command lines to be entered in place of a menu selection.
The file 'fax.mak' is designed to be used with "p". After "pcc" has been
compiled and installed run "p". It will report that no file is active.
Select the 'n' for new project and give it the project name 'fax'. Have fun.

			A few comments on style.

No two people would write a program having more complexity than "Hello
World" exactly the same way; there are virtually a limitless number of ways
of solving a given problem. The great number of paths available to a
programmer mean that any solution to a technical problem ultimately
dissolves into a series of artistic choices. Some artistic choices work
better than others. While cut and dried technique can be taught, the
bandwidth required to teach artistic choice is far too large for human
communications to handle.

It has been observed that "C" is as close to being a 'write only' language
as has been devised by humanity. My style of programming is to attempt to
make as clear as possible what the code is attempting to do. I leave obscure
"C" constructs like:

*dir += (*foo(*didly) == **bar(&ralph)) ? (*mung(&ralph) += *barf(dog)) : 3;

for use by the sort of people who enjoy using  pretzels as rulers. In my
opinion life is too short to spend it trying to figure out twisted logic. 

It has been my observation that "C" is largely a way for programmers to fool
themselves into thinking they have done something clever and efficient;
while the compiler winds up producing the same code as an 'inefficient'
coding sequence.

I tend to use "C" in a very straight forward, structured, almost 'Pascal' like
way. If this conflicts with the way you view coding, you are free to hack
away at what I have done: that is one of the virtues of Free software.

Code has a way of hanging around far longer than anyone intended. I cringe
at the idea of a 24th century programmer attempting to maintain some 1960's
COBOL code, but it is liable to happen. I tend to code with that future
programmer in mind. I would prefer that he or she not be uttering
something like: 

		"What was this idiot trying to do?" 

while attempting to maintain something I wrote.

"pcc" represents a second part of the way I am attempting to repay the debt
I owe to the rest of the Linux developers and the Free Software Foundation
for creating such a superior operating system and set of tools.
 
"pcc" is copyright 1997-1998 by Robert Canup and is released under the GNU
Public License.

