* pxp - Pascal execution profiler
* Version 1.0 August 1977
* This program is described in detail in the "PXP 1.0 Implementation Notes"
* The structure of pxp is very similar to that of the compiler pc.
* The major new pieces here are a set of profile data maintenance
* routines in the file pmon.c and a set of pretty printing utility
* routines in the file pp.c.
* The semantic routines of pc have been rewritten to do a simple
* reformatting tree walk, the parsing and scanning remains
* This version does not reformat comments, rather discards them.
* It also does not place more than one statement per line and
* is not very intelligent about folding long lines, with only
* an ad hoc way of folding case label list and enumerated type
* declarations being implemented.
"pxp [ -acdefjntuw_ ] [ -23456789 ] [ -z [ name ... ] ] name.p";
char *howfile
"/usr/lib/how_pxp";
* Process options, then call yymain
* to do all the real work.
execl("/bin/cat", "cat", howfile
, 0);
while (c
= *cp
++) switch (c
) {
if (dotted(argv
[1], 'p'))
pflstc
++, argc
--, argv
++;
if (c
>= '2' && c
<= '9') {
Perror("Usage", usagestr
);
if (core
&& !profile
&& !table
)
if (argc
== 0 || argc
> 2)
getit(core
? "core" : "pmon.out");
if (dotted(filename
, 'i')) {
} else if (!dotted(filename
, 'p')) {
Perror(filename
, "Name must end in '.p'");
if (fopen(filename
, ibuf
) < 0)
perror(filename
), pexit(NOSTART
);
if (profile
|| opt('l')) {
* Put a header on a top of a page
printf("UNIX Pascal PXP -- Version 1.0 (%s)\n\n%s %s\n\n", version
, myctime(tvec
), filename
);
printf("Profiled %s\n\n", myctime(ptvec
));
char ugh
[] "Fatal error in pxp\n";
* Exit from the Pascal system.
* We throw in an ungraceful termination
* message if c > 1 indicating a severe
* error such as running out of memory
* or an internal inconsistency.
write(2, ugh
, sizeof ugh
);
* Pxp uses a modified putchar
* which calls xflush to flush its buffer
* rather than the normal fflush.
* This allows us to check for write errors
* on standard output which we really care
* about, because we may be creating a new
perror("Standard output");