340 |
|
case 'b': /* bin expression/count */ |
341 |
|
if (i >= argc-2) break; |
342 |
|
if (argv[i][2] == 'n') { |
343 |
< |
bincnt = atoi(argv[++i]); |
343 |
> |
bincnt = (int)(eval(argv[++i]) + .5); |
344 |
|
continue; |
345 |
|
} |
346 |
|
if (argv[i][2]) break; |
580 |
|
error(USER, errmsg); |
581 |
|
} |
582 |
|
if (nmods >= MAXMODLIST) |
583 |
< |
error(USER, "too many modifiers"); |
583 |
> |
error(INTERNAL, "too many modifiers"); |
584 |
|
modname[nmods++] = modn; /* XXX assumes static string */ |
585 |
|
lep->key = modn; /* XXX assumes static string */ |
586 |
|
mp = (MODCONT *)malloc(sizeof(MODCONT)); |
588 |
|
error(SYSTEM, "out of memory in addmodifier"); |
589 |
|
mp->outspec = outf; /* XXX assumes static string */ |
590 |
|
mp->modname = modn; /* XXX assumes static string */ |
591 |
< |
if (binv != NULL) |
592 |
< |
mp->binv = eparse(binv); |
593 |
< |
else |
594 |
< |
mp->binv = eparse("0"); |
595 |
< |
mp->nbins = 1; |
591 |
> |
if (binv == NULL) |
592 |
> |
binv = "0"; /* use single bin if unspecified */ |
593 |
> |
mp->binv = eparse(binv); |
594 |
> |
if (mp->binv->type == NUM) { /* check value if constant */ |
595 |
> |
bincnt = (int)(evalue(mp->binv) + 1.5); |
596 |
> |
if (bincnt != 1) { |
597 |
> |
sprintf(errmsg, "illegal non-zero constant for bin (%s)", |
598 |
> |
binv); |
599 |
> |
error(USER, errmsg); |
600 |
> |
} |
601 |
> |
} |
602 |
> |
mp->nbins = 1; /* initialize results holder */ |
603 |
|
setcolor(mp->cbin[0], 0., 0., 0.); |
604 |
< |
if (mp->binv->type == NUM) /* assume one bin if constant */ |
598 |
< |
bincnt = 1; |
599 |
< |
else if (bincnt > 1) |
604 |
> |
if (bincnt > 1) |
605 |
|
mp = growmodifier(mp, bincnt); |
606 |
|
lep->data = (char *)mp; |
607 |
|
/* allocate output streams */ |