| 88 |
|
printview(); |
| 89 |
|
if (inp & DFL(DC_LASTVIEW)) |
| 90 |
|
new_view(NULL); |
| 91 |
– |
if (inp & DFL(DC_RESUME)) { |
| 92 |
– |
serv_request(DR_NOOP, 0, NULL); |
| 93 |
– |
pause = 0; |
| 94 |
– |
} |
| 95 |
– |
if (inp & DFL(DC_PAUSE)) |
| 96 |
– |
pause = 1; |
| 97 |
– |
if (inp & DFL(DC_REDRAW)) |
| 98 |
– |
imm_mode = beam_sync(1) > 0; |
| 91 |
|
if (inp & DFL(DC_KILL)) { |
| 92 |
|
serv_request(DR_KILL, 0, NULL); |
| 93 |
|
pause = 0; |
| 98 |
|
serv_request(DR_RESTART, 0, NULL); |
| 99 |
|
pause = 0; |
| 100 |
|
} |
| 101 |
+ |
if (inp & DFL(DC_RESUME)) { |
| 102 |
+ |
serv_request(DR_NOOP, 0, NULL); |
| 103 |
+ |
pause = 0; |
| 104 |
+ |
} |
| 105 |
+ |
if (inp & DFL(DC_PAUSE)) |
| 106 |
+ |
pause = 1; |
| 107 |
+ |
if (inp & DFL(DC_REDRAW)) |
| 108 |
+ |
imm_mode = beam_sync(1) > 0; |
| 109 |
|
if (inp & DFL(DC_QUIT)) |
| 110 |
|
serv_request(DR_SHUTDOWN, 0, NULL); |
| 111 |
|
} |
| 146 |
|
int n; |
| 147 |
|
register int i; |
| 148 |
|
/* see if we can avoid select call */ |
| 149 |
+ |
flgs = 0; /* flag what's ready already */ |
| 150 |
|
if (imm_mode || stdin->_cnt > 0) |
| 151 |
< |
return(RDY_SRV); |
| 151 |
> |
flgs |= RDY_SRV; |
| 152 |
|
if (sstdin != NULL && sstdin->_cnt > 0) |
| 153 |
< |
return(RDY_SIN); |
| 154 |
< |
if (dev_flush()) |
| 153 |
> |
flgs |= RDY_SIN; |
| 154 |
> |
if (odev.inpready) |
| 155 |
> |
flgs |= RDY_DEV; |
| 156 |
> |
if (flgs) /* got something? */ |
| 157 |
> |
return(flgs); |
| 158 |
> |
if (dev_flush()) /* else flush output & check keyboard+mouse */ |
| 159 |
|
return(RDY_DEV); |
| 160 |
< |
/* make the call */ |
| 160 |
> |
/* if nothing, we need to call select */ |
| 161 |
|
FD_ZERO(&readset); FD_ZERO(&errset); |
| 162 |
|
FD_SET(0, &readset); |
| 163 |
|
FD_SET(0, &errset); |
| 176 |
|
return(0); |
| 177 |
|
error(SYSTEM, "select call failure in disp_wait"); |
| 178 |
|
} |
| 174 |
– |
flgs = 0; /* flag what's ready */ |
| 179 |
|
if (FD_ISSET(0, &readset) || FD_ISSET(0, &errset)) |
| 180 |
|
flgs |= RDY_SRV; |
| 181 |
|
if (FD_ISSET(odev.ifd, &readset) || FD_ISSET(odev.ifd, &errset)) |
| 238 |
|
for (i = p->nr; i--; ) { |
| 239 |
|
hdray(ro, rd, hdlist[p->hd], gc, packra(p)[i].r); |
| 240 |
|
d = hddepth(hdlist[p->hd], packra(p)[i].d); |
| 241 |
< |
VSUM(wp, ro, rd, d); /* might be behind viewpoint */ |
| 242 |
< |
dev_value(packra(p)[i].v, wp, rd); |
| 241 |
> |
if (d < .99*FHUGE) { |
| 242 |
> |
VSUM(wp, ro, rd, d); /* might be behind viewpoint */ |
| 243 |
> |
dev_value(packra(p)[i].v, rd, wp); |
| 244 |
> |
} else |
| 245 |
> |
dev_value(packra(p)[i].v, rd, NULL); |
| 246 |
|
} |
| 247 |
|
#ifdef DEBUG |
| 248 |
|
if (imm_mode) nimmrays += p->nr; |
| 280 |
|
if (!dev_view(v)) /* notify display driver */ |
| 281 |
|
goto again; |
| 282 |
|
dev_flush(); /* update screen */ |
| 283 |
< |
beam_init(); /* compute new beam set */ |
| 283 |
> |
beam_init(0); /* compute new beam set */ |
| 284 |
|
for (i = 0; (dv = dev_auxview(i, res)) != NULL; i++) |
| 285 |
|
if (!beam_view(dv, res[0], res[1])) { |
| 286 |
|
if (!nhist) { |
| 310 |
|
if (fgets(cmd, sizeof(cmd), sstdin) == NULL) { |
| 311 |
|
fclose(sstdin); |
| 312 |
|
sstdin = NULL; |
| 313 |
< |
return(0); |
| 313 |
> |
return(-1); |
| 314 |
|
} |
| 315 |
+ |
if (*cmd == '\n') |
| 316 |
+ |
return(DC_RESUME); |
| 317 |
|
for (args = cmd; *args && !isspace(*args); args++) |
| 318 |
|
; |
| 319 |
|
while (isspace(*args)) |
| 320 |
|
*args++ = '\0'; |
| 312 |
– |
if (!*cmd) |
| 313 |
– |
return(DC_RESUME); |
| 321 |
|
if (*args && args[i=strlen(args)-1] == '\n') |
| 322 |
|
args[i] = '\0'; |
| 323 |
|
for (i = 0; i < DC_NCMDS; i++) |
| 324 |
|
if (!strcmp(cmd, cmdlist[i])) |
| 325 |
|
break; |
| 326 |
|
if (i >= DC_NCMDS) { |
| 327 |
< |
sprintf(errmsg, "unknown command: %s", cmd); |
| 321 |
< |
error(COMMAND, errmsg); |
| 327 |
> |
dev_auxcom(cmd, args); |
| 328 |
|
return(-1); |
| 329 |
|
} |
| 330 |
|
switch (i) { |
| 413 |
|
break; |
| 414 |
|
case DS_OUTSECT: |
| 415 |
|
do_outside = 1; |
| 416 |
< |
break; |
| 416 |
> |
goto noargs; |
| 417 |
|
case DS_EYESEP: |
| 418 |
|
if (msg.nbytes <= 1 || (eyesepdist = atof(buf)) <= FTINY) |
| 419 |
|
error(INTERNAL, "bad eye separation from server"); |
| 429 |
|
} |
| 430 |
|
#endif |
| 431 |
|
imm_mode = msg.type==DS_STARTIMM; |
| 432 |
< |
/* fall through */ |
| 432 |
> |
goto noargs; |
| 433 |
|
case DS_ACKNOW: |
| 434 |
|
case DS_SHUTDOWN: |
| 435 |
< |
if (msg.nbytes) { |
| 430 |
< |
sprintf(errmsg, |
| 431 |
< |
"unexpected body with server message %d", |
| 432 |
< |
msg.type); |
| 433 |
< |
error(INTERNAL, errmsg); |
| 434 |
< |
} |
| 435 |
< |
break; |
| 435 |
> |
goto noargs; |
| 436 |
|
default: |
| 437 |
|
error(INTERNAL, "unrecognized result from server process"); |
| 438 |
|
} |
| 439 |
|
return(msg.type); /* return message type */ |
| 440 |
+ |
noargs: |
| 441 |
+ |
if (msg.nbytes) { |
| 442 |
+ |
sprintf(errmsg, "unexpected body with server message %d", |
| 443 |
+ |
msg.type); |
| 444 |
+ |
error(INTERNAL, errmsg); |
| 445 |
+ |
} |
| 446 |
+ |
return(msg.type); |
| 447 |
|
readerr: |
| 448 |
|
if (feof(stdin)) |
| 449 |
|
error(SYSTEM, "server process died"); |