11 |
|
|
12 |
|
#include <sys/types.h> |
13 |
|
|
14 |
< |
#ifndef NIX |
14 |
> |
#ifndef NON_POSIX |
15 |
|
#ifdef BSD |
16 |
|
#include <sys/time.h> |
17 |
|
#include <sys/resource.h> |
33 |
|
#define RFTEMPLATE "rfXXXXXX" |
34 |
|
|
35 |
|
#ifndef SIGCONT |
36 |
+ |
#ifdef SIGIO /* XXX can we live without this? */ |
37 |
|
#define SIGCONT SIGIO |
38 |
|
#endif |
39 |
+ |
#endif |
40 |
|
|
41 |
|
CUBE thescene; /* our scene */ |
42 |
|
OBJECT nsceneobjs; /* number of objects in our scene */ |
115 |
|
|
116 |
|
double pixvalue(); |
117 |
|
|
118 |
< |
#ifdef NIX |
117 |
< |
#define file_exists(f) (access(f,F_OK)==0) |
118 |
< |
#else |
118 |
> |
#ifdef RHAS_STAT |
119 |
|
#include <sys/types.h> |
120 |
|
#include <sys/stat.h> |
121 |
|
int |
126 |
|
if (stat(fname, &sbuf) < 0) return(0); |
127 |
|
return((sbuf.st_mode & S_IFREG) != 0); |
128 |
|
} |
129 |
+ |
#else |
130 |
+ |
#define file_exists(f) (access(f,F_OK)==0) |
131 |
|
#endif |
132 |
|
|
133 |
|
|
137 |
|
{ |
138 |
|
if (code) /* report status */ |
139 |
|
report(); |
140 |
< |
#ifndef NIX |
140 |
> |
#ifndef NON_POSIX |
141 |
|
headclean(); /* delete header file */ |
142 |
|
pfclean(); /* clean up persist files */ |
143 |
|
#endif |
145 |
|
} |
146 |
|
|
147 |
|
|
148 |
< |
#ifndef NIX |
148 |
> |
#ifndef NON_POSIX |
149 |
|
void |
150 |
|
report() /* report progress */ |
151 |
|
{ |
182 |
|
nrays, pctdone, u/3600., s/3600., |
183 |
|
(tlastrept-tstart)/3600., myhostname()); |
184 |
|
eputs(errmsg); |
185 |
< |
#ifndef BSD |
185 |
> |
#ifdef SIGCONT |
186 |
|
signal(SIGCONT, report); |
187 |
|
#endif |
188 |
|
} |
322 |
|
putchar('\n'); |
323 |
|
if (pa < .99 || pa > 1.01) |
324 |
|
fputaspect(pa, stdout); |
325 |
+ |
fputnow(); |
326 |
|
fputformat(COLRFMT, stdout); |
327 |
|
putchar('\n'); |
328 |
|
if (zout != NULL) |
416 |
|
pctdone = 100.0*i/vres; |
417 |
|
if (ralrm > 0) /* report init stats */ |
418 |
|
report(); |
419 |
< |
#ifndef BSD |
419 |
> |
#ifdef SIGCONT |
420 |
|
else |
418 |
– |
#endif |
421 |
|
signal(SIGCONT, report); |
422 |
+ |
#endif |
423 |
|
ypos = vres-1 - i; /* initialize sampling */ |
424 |
|
if (directvis) |
425 |
|
init_drawsources(psample); |
445 |
|
if (directvis) /* add bitty sources */ |
446 |
|
drawsources(scanbar, zbar, 0, hres, ypos, ystep); |
447 |
|
/* write it out */ |
448 |
< |
#ifndef BSD |
448 |
> |
#ifdef SIGCONT |
449 |
|
signal(SIGCONT, SIG_IGN); /* don't interrupt writes */ |
450 |
|
#endif |
451 |
|
for (i = ystep; i > 0; i--) { |
462 |
|
pctdone = 100.0*(vres-1-ypos)/vres; |
463 |
|
if (ralrm > 0 && time((time_t *)NULL) >= tlastrept+ralrm) |
464 |
|
report(); |
465 |
< |
#ifndef BSD |
465 |
> |
#ifdef SIGCONT |
466 |
|
else |
467 |
|
signal(SIGCONT, report); |
468 |
|
#endif |
469 |
|
} |
470 |
|
/* clean up */ |
471 |
+ |
#ifdef SIGCONT |
472 |
|
signal(SIGCONT, SIG_IGN); |
473 |
+ |
#endif |
474 |
|
if (zfd != -1 && write(zfd, (char *)zbar[0], hres*sizeof(float)) |
475 |
|
< hres*sizeof(float)) |
476 |
|
goto writerr; |
491 |
|
pctdone = 100.0; |
492 |
|
if (ralrm > 0) |
493 |
|
report(); |
494 |
+ |
#ifdef SIGCONT |
495 |
|
signal(SIGCONT, SIG_DFL); |
496 |
+ |
#endif |
497 |
|
return; |
498 |
|
writerr: |
499 |
|
error(SYSTEM, "write error in render"); |