151 |
|
return NULL; /* propogate error up call stack */ |
152 |
|
match &= (st->u.t[n]->log2GR == st->u.t[0]->log2GR); |
153 |
|
} |
154 |
< |
if (match && st->u.t[0]->log2GR >= 0) { |
155 |
< |
SDNode *stn = SDnewNode(st->ndim, st->u.t[0]->log2GR + 1); |
154 |
> |
if (match && (match = st->u.t[0]->log2GR) >= 0) { |
155 |
> |
SDNode *stn = SDnewNode(st->ndim, match + 1); |
156 |
|
if (stn == NULL) /* out of memory? */ |
157 |
|
return st; |
158 |
|
/* transfer values to new grid */ |
159 |
|
for (n = 1 << st->ndim; n--; ) |
160 |
|
fill_grid_branch(grid_branch_start(stn, n), |
161 |
< |
st->u.t[n]->u.v, st->ndim, st->log2GR); |
161 |
> |
st->u.t[n]->u.v, stn->ndim, stn->log2GR); |
162 |
|
SDfreeTre(st); /* free old tree */ |
163 |
|
st = stn; /* return new one */ |
164 |
|
} |
712 |
|
return **spp; |
713 |
|
} |
714 |
|
|
715 |
+ |
#define eat_token(spp,c) (next_token(spp)==(c) ? *(*(spp))++ : 0) |
716 |
+ |
|
717 |
|
/* Count words from this point in string to '}' */ |
718 |
|
static int |
719 |
|
count_values(char *cp) |
720 |
|
{ |
721 |
|
int n = 0; |
722 |
|
|
723 |
< |
while (next_token(&cp) != '}') { |
723 |
> |
while (next_token(&cp) != '}' && *cp) { |
724 |
|
if (*cp == '{') |
725 |
|
return -1; |
726 |
< |
while (*cp && !isspace(*cp)) |
726 |
> |
while (*cp && (*cp != ',') & (*cp != '}') & !isspace(*cp)) |
727 |
|
++cp; |
728 |
|
++n; |
729 |
< |
cp += (next_token(&cp) == ','); |
729 |
> |
eat_token(&cp, ','); |
730 |
|
} |
731 |
|
return n; |
732 |
|
} |
741 |
|
while (n-- > 0 && (svnext = fskip(*spp)) != NULL) { |
742 |
|
*v++ = atof(*spp); |
743 |
|
*spp = svnext; |
744 |
< |
*spp += (next_token(spp) == ','); |
744 |
> |
eat_token(spp, ','); |
745 |
|
} |
746 |
|
return v - va; |
747 |
|
} |
753 |
|
SDNode *st; |
754 |
|
int n; |
755 |
|
|
756 |
< |
if (next_token(spp) != '{') { |
756 |
> |
if (!eat_token(spp, '{')) { |
757 |
|
strcpy(SDerrorDetail, "Missing '{' in tensor tree"); |
758 |
|
return NULL; |
759 |
|
} |
758 |
– |
++*spp; /* in tree, now */ |
760 |
|
if (next_token(spp) == '{') { /* tree branches */ |
761 |
|
st = SDnewNode(nd, -1); |
762 |
|
if (st == NULL) |
789 |
|
return NULL; |
790 |
|
} |
791 |
|
} |
792 |
< |
if (next_token(spp) != '}') { |
792 |
> |
if (!eat_token(spp, '}')) { |
793 |
|
strcpy(SDerrorDetail, "Missing '}' in tensor tree"); |
794 |
|
SDfreeTre(st); |
795 |
|
return NULL; |
796 |
|
} |
797 |
< |
++*spp; /* walk past close and return */ |
797 |
< |
*spp += (next_token(spp) == ','); |
797 |
> |
eat_token(spp, ','); |
798 |
|
return st; |
799 |
|
} |
800 |
|
|
975 |
|
if (vmin <= FTINY) |
976 |
|
return .0; |
977 |
|
|
978 |
< |
SDsubtractTreMin(st, vmin); |
978 |
> |
SDsubtractTreVal(st, vmin); |
979 |
|
|
980 |
|
return M_PI * vmin; /* return hemispherical value */ |
981 |
|
} |
992 |
|
return; |
993 |
|
} |
994 |
|
dv->spec = df->comp[0].cspec[0]; |
995 |
< |
dv->cieY = subtract_min((*(SDTre *)df->comp[n].dist).st); |
995 |
> |
dv->cieY = subtract_min((*(SDTre *)df->comp[0].dist).st); |
996 |
|
/* in case of multiple components */ |
997 |
|
for (n = df->ncomp; --n; ) { |
998 |
|
double ymin = subtract_min((*(SDTre *)df->comp[n].dist).st); |