15 |
|
#include <ctype.h> |
16 |
|
|
17 |
|
#ifndef VIEWHISTLEN |
18 |
< |
#define VIEWHISTLEN 2 /* number of remembered views */ |
18 |
> |
#define VIEWHISTLEN 4 /* number of remembered views */ |
19 |
|
#endif |
20 |
|
|
21 |
|
HOLO *hdlist[HDMAX+1]; /* global holodeck list */ |
56 |
|
/* enter main loop */ |
57 |
|
do { |
58 |
|
rdy = disp_wait(); |
59 |
+ |
if (rdy & RDY_SRV) { /* process server result */ |
60 |
+ |
res = serv_result(); |
61 |
+ |
if (pause && res != DS_SHUTDOWN) { |
62 |
+ |
serv_request(DR_ATTEN, 0, NULL); |
63 |
+ |
while ((res = serv_result()) != DS_ACKNOW && |
64 |
+ |
res != DS_SHUTDOWN) |
65 |
+ |
; |
66 |
+ |
} |
67 |
+ |
} |
68 |
|
if (rdy & RDY_DEV) { /* user input from driver */ |
69 |
|
inp = dev_input(); |
70 |
|
if (inp & DFL(DC_SETVIEW)) |
73 |
|
printview(); |
74 |
|
if (inp & DFL(DC_LASTVIEW)) |
75 |
|
new_view(NULL); |
67 |
– |
if (inp & DFL(DC_PAUSE)) |
68 |
– |
pause = 1; |
76 |
|
if (inp & DFL(DC_RESUME)) { |
77 |
|
serv_request(DR_NOOP, 0, NULL); |
78 |
|
pause = 0; |
79 |
|
} |
80 |
+ |
if (inp & DFL(DC_PAUSE)) |
81 |
+ |
pause = 1; |
82 |
|
if (inp & DFL(DC_REDRAW)) |
83 |
|
imm_mode = beam_sync() > 0; |
84 |
< |
if (inp & DFL(DC_KILL)) |
84 |
> |
if (inp & DFL(DC_KILL)) { |
85 |
|
serv_request(DR_KILL, 0, NULL); |
86 |
+ |
pause = 0; |
87 |
+ |
} |
88 |
|
if (inp & DFL(DC_CLOBBER)) |
89 |
|
serv_request(DR_CLOBBER, 0, NULL); |
90 |
< |
if (inp & DFL(DC_RESTART)) |
90 |
> |
if (inp & DFL(DC_RESTART)) { |
91 |
|
serv_request(DR_RESTART, 0, NULL); |
92 |
+ |
pause = 0; |
93 |
+ |
} |
94 |
|
if (inp & DFL(DC_QUIT)) |
95 |
|
serv_request(DR_SHUTDOWN, 0, NULL); |
96 |
|
} |
101 |
|
break; |
102 |
|
case DC_RESUME: |
103 |
|
serv_request(DR_NOOP, 0, NULL); |
104 |
+ |
/* fall through */ |
105 |
+ |
case DC_KILL: |
106 |
+ |
case DC_RESTART: |
107 |
|
pause = 0; |
108 |
|
break; |
109 |
|
} |
94 |
– |
if (rdy & RDY_SRV) { /* process server result */ |
95 |
– |
res = serv_result(); |
96 |
– |
if (pause && res != DS_SHUTDOWN) { |
97 |
– |
serv_request(DR_ATTEN, 0, NULL); |
98 |
– |
while ((res = serv_result()) != DS_ACKNOW && |
99 |
– |
res != DS_SHUTDOWN) |
100 |
– |
; |
101 |
– |
} |
102 |
– |
} |
110 |
|
} while (res != DS_SHUTDOWN); |
111 |
|
/* all done */ |
112 |
|
quit(0); |
214 |
|
char *err; |
215 |
|
/* restore previous view? */ |
216 |
|
if (v == NULL) { |
217 |
< |
if (nhist < 2) { |
218 |
< |
error(COMMAND, "no previous view"); |
219 |
< |
return; |
220 |
< |
} |
221 |
< |
nhist--; /* get one before last setting */ |
217 |
> |
if (nhist > 1) /* get one before last setting */ |
218 |
> |
nhist--; |
219 |
> |
else /* else go to end of list */ |
220 |
> |
while (nhist < VIEWHISTLEN && viewhist[nhist].type) |
221 |
> |
nhist++; |
222 |
|
v = viewhist + ((nhist-1)%VIEWHISTLEN); |
223 |
< |
} else if ((err = setview(v)) != NULL) { |
223 |
> |
} else |
224 |
> |
again: |
225 |
> |
if ((err = setview(v)) != NULL) { |
226 |
|
error(COMMAND, err); |
227 |
|
return; |
228 |
|
} |
220 |
– |
again: |
229 |
|
if (v->type == VT_PAR) { |
230 |
|
error(COMMAND, "cannot handle parallel views"); |
231 |
|
return; |
355 |
|
case DS_STARTIMM: |
356 |
|
case DS_ENDIMM: |
357 |
|
imm_mode = msg.type==DS_STARTIMM; |
350 |
– |
if (msg.type == DS_ENDIMM) |
351 |
– |
dev_flush(); /* update display NOW */ |
358 |
|
/* fall through */ |
359 |
|
case DS_ACKNOW: |
360 |
|
case DS_SHUTDOWN: |