57 |
|
FILE *getofile(const char *ospec, const char *mname, int bn); |
58 |
|
int ofname(char *oname, const char *ospec, const char *mname, int bn); |
59 |
|
void printheader(FILE *fout, const char *info); |
60 |
+ |
void printresolu(FILE *fout); |
61 |
|
|
62 |
|
/* |
63 |
|
* The rcont structure is used to manage i/o with a particular |
113 |
|
const char *modname[MAXMODLIST]; /* ordered modifier name list */ |
114 |
|
int nmods = 0; /* number of modifiers */ |
115 |
|
|
116 |
+ |
#define queue_length() (lastray - lastdone) |
117 |
+ |
|
118 |
|
MODCONT *addmodifier(char *modn, char *outf, char *binv); |
119 |
|
void addmodfile(char *fname, char *outf, char *binv); |
120 |
|
|
131 |
|
void add_contrib(const char *modn); |
132 |
|
void done_contrib(void); |
133 |
|
|
134 |
+ |
/* return number of open rtrace processes */ |
135 |
+ |
static int |
136 |
+ |
nrtprocs(void) |
137 |
+ |
{ |
138 |
+ |
int nrtp = 0; |
139 |
+ |
struct rtproc *rtp; |
140 |
+ |
|
141 |
+ |
for (rtp = &rt0; rtp != NULL; rtp = rtp->next) |
142 |
+ |
nrtp += rtp->pd.running; |
143 |
+ |
return(nrtp); |
144 |
+ |
} |
145 |
+ |
|
146 |
|
/* set input/output format */ |
147 |
|
static void |
148 |
|
setformat(const char *fmt) |
599 |
|
break; |
600 |
|
} |
601 |
|
fputc('\n', fout); |
602 |
+ |
} |
603 |
+ |
|
604 |
+ |
/* write resolution string to given output stream */ |
605 |
+ |
void |
606 |
+ |
printresolu(FILE *fout) |
607 |
+ |
{ |
608 |
|
if (xres > 0) { |
609 |
|
if (yres > 0) /* resolution string */ |
610 |
|
fprtresolu(xres, yres, fout); |
626 |
|
SET_FILE_BINARY(stdout); |
627 |
|
if (header) |
628 |
|
printheader(stdout, NULL); |
629 |
+ |
printresolu(stdout); |
630 |
|
} |
631 |
|
using_stdout = 1; |
632 |
|
return stdout; |
655 |
|
if (header) { |
656 |
|
char info[512]; |
657 |
|
char *cp = info; |
658 |
< |
sprintf(cp, "MODIFIER=%s\n", mname); |
659 |
< |
while (*cp) ++cp; |
658 |
> |
if (ofl & OF_MODIFIER) { |
659 |
> |
sprintf(cp, "MODIFIER=%s\n", mname); |
660 |
> |
while (*cp) ++cp; |
661 |
> |
} |
662 |
|
if (ofl & OF_BIN) { |
663 |
|
sprintf(cp, "BIN=%d\n", bn); |
664 |
|
while (*cp) ++cp; |
666 |
|
*cp = '\0'; |
667 |
|
printheader(fp, info); |
668 |
|
} |
669 |
+ |
printresolu(fp); |
670 |
|
/* play catch-up */ |
671 |
|
for (i = 0; i < lastdone; i++) { |
672 |
|
static const DCOLOR nocontrib = BLKCOLOR; |
741 |
|
bn = (int)(evalue(mp->binv) + .5); |
742 |
|
if (bn <= 0) |
743 |
|
bn = 0; |
744 |
< |
else if (bn > mp->nbins) { /* new bin */ |
744 |
> |
else if (bn >= mp->nbins) { /* new bin */ |
745 |
|
mp = (MODCONT *)realloc(mp, sizeof(MODCONT) + |
746 |
|
bn*sizeof(DCOLOR)); |
747 |
|
if (mp == NULL) |
940 |
|
if (rt->bsiz + BUFSIZ <= treebufsiz) |
941 |
|
rt->bsiz = treebufsiz; |
942 |
|
else |
943 |
< |
rt->bsiz = treebufsiz += BUFSIZ; |
943 |
> |
treebufsiz = rt->bsiz += BUFSIZ; |
944 |
|
rt->buf = (char *)realloc(rt->buf, rt->bsiz); |
945 |
|
} |
946 |
|
if (rt->buf == NULL) |
981 |
|
struct rtproc *rtp; |
982 |
|
/* loop over input */ |
983 |
|
while ((iblen = getinp(inpbuf, fin)) > 0) { |
984 |
< |
if (lastray+1 < lastray) { /* counter rollover? */ |
984 |
> |
if (lastray+1 < lastray || /* need reset? */ |
985 |
> |
queue_length() > 5*nrtprocs()) { |
986 |
|
while (wait_rproc() != NULL) |
987 |
|
process_queue(); |
988 |
|
lastdone = lastray = 0; |
1135 |
|
/* seek on all files */ |
1136 |
|
nvals = lastout * outvsiz; |
1137 |
|
lu_doall(&ofiletab, myseeko, &nvals); |
1138 |
< |
/* discard input */ |
1138 |
> |
/* skip repeated input */ |
1139 |
|
for (nvals = 0; nvals < lastout; nvals++) |
1140 |
|
if (getinp(oname, fin) <= 0) |
1141 |
|
error(USER, "unexpected EOF on input"); |