45 |
|
RMATRIX *mcat = NULL; /* final concatenation */ |
46 |
|
int mcat_last = 0; /* goes after trailing ops? */ |
47 |
|
|
48 |
< |
int in_nrows; /* input row count */ |
49 |
< |
#define in_ncols (mop[0].rmp->ncols) /* input column count */ |
48 |
> |
int in_nrows; /* number of input rows (or 0) */ |
49 |
> |
#define in_ncols (mop[0].rmp->ncols) /* number of input columns */ |
50 |
|
#define in_ncomp (mop[0].rmp->ncomp) /* input #components */ |
51 |
|
|
52 |
|
extern int nowarn; /* turn off warnings? */ |
469 |
|
fprintf(stderr, "%s: warning - data type mismatch\n", |
470 |
|
mop[i].inspec); |
471 |
|
if (!i) { |
472 |
– |
imp->nrows = in_nrows = mop[0].rmp->nrows; |
472 |
|
imp->ncols = mop[0].rmp->ncols; |
473 |
|
imp->ncomp = mop[0].rmp->ncomp; |
474 |
|
memcpy(imp->wlpart, mop[0].rmp->wlpart, sizeof(imp->wlpart)); |
475 |
< |
} else if ((mop[i].rmp->nrows != imp->nrows) | |
476 |
< |
(mop[i].rmp->ncols != imp->ncols) | |
477 |
< |
(mop[i].rmp->ncomp != imp->ncomp)) { |
475 |
> |
} else if ((mop[i].rmp->ncols != imp->ncols) | |
476 |
> |
(mop[i].rmp->ncomp != imp->ncomp) | |
477 |
> |
((in_nrows > 0) & (mop[i].rmp->nrows > 0) & |
478 |
> |
(mop[i].rmp->nrows != in_nrows))) { |
479 |
|
fprintf(stderr, "%s: mismatch in size or #components\n", |
480 |
|
mop[i].inspec); |
481 |
|
return(0); |
482 |
|
} /* XXX should check wlpart? */ |
483 |
+ |
if (in_nrows <= 0) |
484 |
+ |
in_nrows = imp->nrows = mop[i].rmp->nrows; |
485 |
|
} /* set up .cal environment */ |
486 |
|
esupport |= E_VARIABLE|E_FUNCTION|E_RCONST; |
487 |
|
esupport &= ~(E_OUTCHAN|E_INCHAN); |
571 |
|
} else /* save a little time */ |
572 |
|
set_r = set_c = 0; |
573 |
|
/* read/process row-by-row */ |
574 |
< |
for (cur_row = 0; cur_row < in_nrows; cur_row++) { |
574 |
> |
for (cur_row = 0; (in_nrows <= 0) | (cur_row < in_nrows); cur_row++) { |
575 |
|
RMATRIX *mres = NULL; |
576 |
|
for (i = 0; i < nmats; i++) { |
577 |
|
if (!rmx_load_row(mop[i].imx.mtx, &mop[i].imx, mop[i].infp)) { |
578 |
+ |
if (in_nrows <= 0) /* normal end? */ |
579 |
+ |
goto loop_exit; |
580 |
|
fprintf(stderr, "%s: read error at row %d\n", |
581 |
|
mop[i].inspec, cur_row); |
582 |
|
return(0); |
624 |
|
res->rmp->ncols, res->rmp->dtype, fout)) |
625 |
|
return(0); |
626 |
|
} |
627 |
+ |
loop_exit: |
628 |
|
#if 0 /* we're about to exit, so who cares? */ |
629 |
|
rmx_free(tmp); /* clean up */ |
630 |
|
rmx_reset(res->rmp); |