fix copyright
[unix-history] / usr / src / usr.bin / pascal / pdx / process / pstatus.c
CommitLineData
f644bb55
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
7c008f5a 6
f644bb55
DF
7#ifndef lint
8static char sccsid[] = "@(#)pstatus.c 5.1 (Berkeley) %G%";
9#endif not lint
7c008f5a
ML
10/*
11 * process status routines
12 */
13
14#include "defs.h"
15#include <signal.h>
16#include "process.h"
17#include "machine.h"
18#include "breakpoint.h"
19#include "source.h"
20#include "object.h"
21#include "process.rep"
22
23/*
24 * Print the status of the process.
25 * This routine does not return.
26 */
27
28printstatus()
29{
cc7a61ee
ML
30 if (process->signo == SIGINT) {
31 isstopped = TRUE;
32 printerror();
33 }
34 if (isbperr() && isstopped) {
35 skimsource(srcfilename(pc));
36 printf("stopped at ");
37 printwhere(curline, cursource);
38 putchar('\n');
39 if (curline > 0) {
40 printlines(curline, curline);
41 } else {
42 printinst(pc, pc);
7c008f5a 43 }
cc7a61ee
ML
44 erecover();
45 } else {
46 isstopped = FALSE;
47 fixbps();
48 fixintr();
49 if (process->status == FINISHED) {
50 quit(0);
7c008f5a 51 } else {
cc7a61ee
ML
52 printerror();
53 }
54 }
55}
56
57
58/*
59 * Print out the "line N [in file F]" information that accompanies
60 * messages in various places.
61 */
62
63printwhere(lineno, filename)
64LINENO lineno;
65char *filename;
66{
67 if (lineno > 0) {
68 printf("line %d", lineno);
69 if (nlhdr.nfiles > 1) {
70 printf(" in file %s", filename);
7c008f5a 71 }
cc7a61ee
ML
72 } else {
73# if (isvaxpx)
74 printf("location %d\n", pc);
75# else
76 printf("location 0x%x\n", pc);
77# endif
78 }
7c008f5a
ML
79}
80
81/*
82 * Return TRUE if the process is finished.
83 */
84
85BOOLEAN isfinished(p)
86PROCESS *p;
87{
cc7a61ee 88 return(p->status == FINISHED);
7c008f5a 89}