4.3BSD beta release manual page
[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
cc7a61ee 3static char sccsid[] = "@(#)pstatus.c 1.3 %G%";
7c008f5a
ML
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{
cc7a61ee
ML
25 if (process->signo == SIGINT) {
26 isstopped = TRUE;
27 printerror();
28 }
29 if (isbperr() && isstopped) {
30 skimsource(srcfilename(pc));
31 printf("stopped at ");
32 printwhere(curline, cursource);
33 putchar('\n');
34 if (curline > 0) {
35 printlines(curline, curline);
36 } else {
37 printinst(pc, pc);
7c008f5a 38 }
cc7a61ee
ML
39 erecover();
40 } else {
41 isstopped = FALSE;
42 fixbps();
43 fixintr();
44 if (process->status == FINISHED) {
45 quit(0);
7c008f5a 46 } else {
cc7a61ee
ML
47 printerror();
48 }
49 }
50}
51
52
53/*
54 * Print out the "line N [in file F]" information that accompanies
55 * messages in various places.
56 */
57
58printwhere(lineno, filename)
59LINENO lineno;
60char *filename;
61{
62 if (lineno > 0) {
63 printf("line %d", lineno);
64 if (nlhdr.nfiles > 1) {
65 printf(" in file %s", filename);
7c008f5a 66 }
cc7a61ee
ML
67 } else {
68# if (isvaxpx)
69 printf("location %d\n", pc);
70# else
71 printf("location 0x%x\n", pc);
72# endif
73 }
7c008f5a
ML
74}
75
76/*
77 * Return TRUE if the process is finished.
78 */
79
80BOOLEAN isfinished(p)
81PROCESS *p;
82{
cc7a61ee 83 return(p->status == FINISHED);
7c008f5a 84}