| 172 |
|
} |
| 173 |
|
|
| 174 |
|
|
| 175 |
+ |
/* Check if we have any more rays left (and report progress) */ |
| 176 |
+ |
int |
| 177 |
+ |
morays(void) |
| 178 |
+ |
{ |
| 179 |
+ |
static RNUMBER total_rays; |
| 180 |
+ |
static time_t tstart, last_report; |
| 181 |
+ |
time_t tnow; |
| 182 |
+ |
|
| 183 |
+ |
if (!raysleft) |
| 184 |
+ |
return(1); /* unknown total, so nothing to do or say */ |
| 185 |
+ |
|
| 186 |
+ |
if (report_intvl > 0 && (tnow = time(0)) >= last_report+report_intvl) { |
| 187 |
+ |
if (!total_rays) { |
| 188 |
+ |
total_rays = raysleft; |
| 189 |
+ |
tstart = tnow; |
| 190 |
+ |
} else { |
| 191 |
+ |
sprintf(errmsg, "%.2f%% done after %.3f hours\n", |
| 192 |
+ |
100.-100.*raysleft/total_rays, |
| 193 |
+ |
(1./3600.)*(tnow - tstart)); |
| 194 |
+ |
eputs(errmsg); |
| 195 |
+ |
} |
| 196 |
+ |
last_report = tnow; |
| 197 |
+ |
} |
| 198 |
+ |
return(--raysleft); |
| 199 |
+ |
} |
| 200 |
+ |
|
| 201 |
+ |
|
| 202 |
+ |
/* Quit program */ |
| 203 |
|
void |
| 204 |
< |
quit( /* quit program */ |
| 204 |
> |
quit( |
| 205 |
|
int code |
| 206 |
|
) |
| 207 |
|
{ |
| 392 |
|
} |
| 393 |
|
done_contrib(); /* accumulate/output */ |
| 394 |
|
++lastdone; |
| 395 |
< |
if (raysleft && !--raysleft) |
| 395 |
> |
if (!morays()) |
| 396 |
|
break; /* preemptive EOI */ |
| 397 |
|
} |
| 398 |
|
if (nchild != -1 && (accumulate <= 0) | (account < accumulate)) { |