| 112 |
|
const char *modname[MAXMODLIST]; /* ordered modifier name list */ |
| 113 |
|
int nmods = 0; /* number of modifiers */ |
| 114 |
|
|
| 115 |
+ |
#define queue_length() (lastray - lastdone) |
| 116 |
+ |
|
| 117 |
|
MODCONT *addmodifier(char *modn, char *outf, char *binv); |
| 118 |
|
void addmodfile(char *fname, char *outf, char *binv); |
| 119 |
|
|
| 130 |
|
void add_contrib(const char *modn); |
| 131 |
|
void done_contrib(void); |
| 132 |
|
|
| 133 |
+ |
/* return number of open rtrace processes */ |
| 134 |
+ |
static int |
| 135 |
+ |
nrtprocs(void) |
| 136 |
+ |
{ |
| 137 |
+ |
int nrtp = 0; |
| 138 |
+ |
struct rtproc *rtp; |
| 139 |
+ |
|
| 140 |
+ |
for (rtp = &rt0; rtp != NULL; rtp = rtp->next) |
| 141 |
+ |
nrtp += rtp->pd.running; |
| 142 |
+ |
return(nrtp); |
| 143 |
+ |
} |
| 144 |
+ |
|
| 145 |
|
/* set input/output format */ |
| 146 |
|
static void |
| 147 |
|
setformat(const char *fmt) |
| 187 |
|
char *binval = NULL; |
| 188 |
|
char fmt[8]; |
| 189 |
|
int i, j; |
| 190 |
+ |
/* need at least one argument */ |
| 191 |
+ |
if (argc < 2) { |
| 192 |
+ |
fprintf(stderr, |
| 193 |
+ |
"Usage: %s [-n nprocs][-r][-e expr][-f source][-o ospec][-b binv] {-m mod | -M file} [rtrace options] octree\n", |
| 194 |
+ |
argv[0]); |
| 195 |
+ |
exit(1); |
| 196 |
+ |
} |
| 197 |
|
/* global program name */ |
| 198 |
|
gargv = argv; |
| 199 |
|
/* initialize calcomp routines */ |
| 344 |
|
quit(0); |
| 345 |
|
} |
| 346 |
|
|
| 347 |
+ |
#ifndef SIGALRM |
| 348 |
+ |
#define SIGALRM SIGTERM |
| 349 |
+ |
#endif |
| 350 |
|
/* kill persistent rtrace process */ |
| 351 |
|
static void |
| 352 |
|
killpersist(void) |
| 353 |
|
{ |
| 354 |
|
FILE *fp = fopen(persistfn, "r"); |
| 355 |
< |
int pid; |
| 355 |
> |
RT_PID pid; |
| 356 |
|
|
| 357 |
|
if (fp == NULL) |
| 358 |
|
return; |
| 730 |
|
bn = (int)(evalue(mp->binv) + .5); |
| 731 |
|
if (bn <= 0) |
| 732 |
|
bn = 0; |
| 733 |
< |
else if (bn > mp->nbins) { /* new bin */ |
| 733 |
> |
else if (bn >= mp->nbins) { /* new bin */ |
| 734 |
|
mp = (MODCONT *)realloc(mp, sizeof(MODCONT) + |
| 735 |
|
bn*sizeof(DCOLOR)); |
| 736 |
|
if (mp == NULL) |
| 929 |
|
if (rt->bsiz + BUFSIZ <= treebufsiz) |
| 930 |
|
rt->bsiz = treebufsiz; |
| 931 |
|
else |
| 932 |
< |
rt->bsiz = treebufsiz += BUFSIZ; |
| 932 |
> |
treebufsiz = rt->bsiz += BUFSIZ; |
| 933 |
|
rt->buf = (char *)realloc(rt->buf, rt->bsiz); |
| 934 |
|
} |
| 935 |
|
if (rt->buf == NULL) |
| 970 |
|
struct rtproc *rtp; |
| 971 |
|
/* loop over input */ |
| 972 |
|
while ((iblen = getinp(inpbuf, fin)) > 0) { |
| 973 |
< |
if (lastray+1 < lastray) { /* counter rollover? */ |
| 973 |
> |
if (lastray+1 < lastray || /* need reset? */ |
| 974 |
> |
queue_length() > 5*nrtprocs()) { |
| 975 |
|
while (wait_rproc() != NULL) |
| 976 |
|
process_queue(); |
| 977 |
|
lastdone = lastray = 0; |
| 1124 |
|
/* seek on all files */ |
| 1125 |
|
nvals = lastout * outvsiz; |
| 1126 |
|
lu_doall(&ofiletab, myseeko, &nvals); |
| 1127 |
< |
/* discard input */ |
| 1127 |
> |
/* skip repeated input */ |
| 1128 |
|
for (nvals = 0; nvals < lastout; nvals++) |
| 1129 |
|
if (getinp(oname, fin) <= 0) |
| 1130 |
|
error(USER, "unexpected EOF on input"); |