date and time created 82/01/18 19:20:47 by linton
[unix-history] / usr / src / usr.bin / pascal / pdx / process / pstatus.c
CommitLineData
7c008f5a
ML
1/* Copyright (c) 1982 Regents of the University of California */
2
3static char sccsid[] = "@(#)pstatus.c 1.1 %G%";
4
5/*
6 * process status routines
7 */
8
9#include "defs.h"
10#include <signal.h>
11#include "process.h"
12#include "machine.h"
13#include "breakpoint.h"
14#include "source.h"
15#include "object.h"
16#include "process.rep"
17
18/*
19 * Print the status of the process.
20 * This routine does not return.
21 */
22
23printstatus()
24{
25 if (process->signo == SIGINT) {
26 isstopped = TRUE;
27 printerror();
28 }
29 if (isbperr() && isstopped) {
30 printf("stopped at ");
31 if (curline > 0) {
32 printf("line %d", curline);
33 if (nlhdr.nfiles > 1) {
34 printf(" in file %s", cursource);
35 }
36 putchar('\n');
37 printlines(curline, curline);
38 } else {
39# if (isvaxpx)
40 printf("location %d\n", pc);
41# else
42 printf("location 0x%x\n", pc);
43# endif
44 printinst(pc, pc);
45 }
46 erecover();
47 } else {
48 isstopped = FALSE;
49 fixbps();
50 fixintr();
51 if (process->status == FINISHED) {
52 exit(0);
53 } else {
54 printerror();
55 }
56 }
57}
58
59/*
60 * Return TRUE if the process is finished.
61 */
62
63BOOLEAN isfinished(p)
64PROCESS *p;
65{
66 return(p->status == FINISHED);
67}