static char *sccsid
= "@(#)main.c 1.3 (Berkeley) %G%";
/* Copyright (c) 1979 Regents of the University of California */
* pxp - Pascal execution profiler
* Version 1.2 January 1979
* This program is described in detail in the "PXP 1.0 Implementation Notes"
* The structure of pxp is very similar to that of the translator pi.
* 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 pi have been rewritten to do a simple
* reformatting tree walk, the parsing and scanning remains
* This version 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";
char *stdoutn
= "Standard output";
* 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");
firstname
= filename
= argv
[0];
if (dotted(filename
, 'i')) {
} else if (!dotted(filename
, 'p')) {
Perror(filename
, "Name must end in '.p'");
if ((ibuf
= fopen(filename
, "r")) == NULL
)
perror(filename
), pexit(NOSTART
);
cp
= (stdoutn
= "/tmp/pxp00000") + 13;
for (c
= getpid(); c
; c
=/ 10)
if (freopen(stdoutn
, "w", stdout
) == NULL
)
perror(stdoutn
), exit(1);
extern char _sobuf
[BUFSIZ
];
if (profile
|| opt('l')) {
* Put a header on a top of a page
printf("Berkeley Pascal PXP -- Version %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
);