/* Copyright (c) 1979 Regents of the University of California */
static char sccsid
[] = "@(#)int.c 4.1 10/10/80";
* px - interpreter for Berkeley Pascal
* Version 2.0 Winter 1979
* Original version for the PDP 11/70 authored by:
* Bill Joy, Charles Haley, Ken Thompson
* Rewritten for VAX 11/780 by Kirk McKusick
register long bytesread
, block
;
llimit
= 0x7fffffff; /* set to unlimited */
* Determine how PX was invoked, and how to process the program
if (argv
[0][0] == '-' && argv
[0][1] == 'o')
else if (argv
[1][0] != '-')
else if (argv
[1][1] == 0)
fputs("Improper specification of object file to PX\n",stderr
);
* Process program header information
read(pipe
,&pxhd
,sizeof(struct pxhdr
));
fseek(prog
,HEADER_BYTES
-sizeof(struct pxhdr
),0);
fread(&pxhd
,sizeof(struct pxhdr
),1,prog
);
if (pxhd
.maketime
< createtime
)
fprintf(stderr
,"%s is obsolete and must be recompiled\n",file
);
if (pxhd
.magicnum
!= 0403)
fprintf(stderr
,"%s is not a Pascal program\n",file
);
* Load program into memory
objprog
= malloc(pxhd
.objsize
);
block
= read(pipe
,objprog
+bytesread
,pipesize
);
bytesread
= fread(objprog
,1,pxhd
.objsize
,prog
);
if (bytesread
!= pxhd
.objsize
)
fprintf(stderr
,"Read error occurred while loading %s\n",file
);
fputs("Execution begins...\n",stderr
);
* set interpreter to catch expected signals and begin interpretation
if (signal(SIGINT
,SIG_IGN
) != SIG_IGN
)
* reset signals, deallocate memory, and exit normally