| 8 | 
  | 
 | 
| 9 | 
  | 
#include "copyright.h" | 
| 10 | 
  | 
 | 
| 11 | 
– | 
#include <ctype.h> | 
| 11 | 
  | 
#include "rcontrib.h" | 
| 12 | 
  | 
#include "otypes.h" | 
| 13 | 
  | 
#include "source.h" | 
| 103 | 
  | 
        } | 
| 104 | 
  | 
        if (nmods >= MAXMODLIST) | 
| 105 | 
  | 
                error(INTERNAL, "too many modifiers"); | 
| 106 | 
+ | 
        if (!strcmp(modn, VOIDID)) { | 
| 107 | 
+ | 
                sprintf(errmsg, "cannot track '%s' modifier", VOIDID); | 
| 108 | 
+ | 
                error(USER, errmsg); | 
| 109 | 
+ | 
        } | 
| 110 | 
  | 
        modname[nmods++] = modn;        /* XXX assumes static string */ | 
| 111 | 
  | 
        lep->key = modn;                /* XXX assumes static string */ | 
| 112 | 
  | 
        if (binv == NULL) | 
| 218 | 
  | 
 | 
| 219 | 
  | 
/************************** MAIN CALCULATION PROCESS ***********************/ | 
| 220 | 
  | 
 | 
| 218 | 
– | 
/* Set parameters for current bin evaluation */ | 
| 219 | 
– | 
void | 
| 220 | 
– | 
set_eparams(char *prms) | 
| 221 | 
– | 
{ | 
| 222 | 
– | 
        static char     *last_params = NULL; | 
| 223 | 
– | 
        char            vname[RMAXWORD]; | 
| 224 | 
– | 
        double          value; | 
| 225 | 
– | 
        char            *cpd; | 
| 226 | 
– | 
                                        /* check if already set */ | 
| 227 | 
– | 
        if ((prms == NULL) | (prms == last_params)) | 
| 228 | 
– | 
                return; | 
| 229 | 
– | 
        if (last_params != NULL && !strcmp(prms, last_params)) | 
| 230 | 
– | 
                return; | 
| 231 | 
– | 
        last_params = prms;             /* assign each variable */ | 
| 232 | 
– | 
        while (*prms) { | 
| 233 | 
– | 
                if (isspace(*prms)) { | 
| 234 | 
– | 
                        ++prms; continue; | 
| 235 | 
– | 
                } | 
| 236 | 
– | 
                if (!isalpha(*prms)) | 
| 237 | 
– | 
                        goto bad_params; | 
| 238 | 
– | 
                cpd = vname; | 
| 239 | 
– | 
                while (*prms && (*prms != '=') & !isspace(*prms)) { | 
| 240 | 
– | 
                        if (!isid(*prms)) | 
| 241 | 
– | 
                                goto bad_params; | 
| 242 | 
– | 
                        *cpd++ = *prms++; | 
| 243 | 
– | 
                } | 
| 244 | 
– | 
                if (cpd == vname) | 
| 245 | 
– | 
                        goto bad_params; | 
| 246 | 
– | 
                *cpd = '\0'; | 
| 247 | 
– | 
                while (isspace(*prms)) prms++; | 
| 248 | 
– | 
                if (*prms++ != '=') | 
| 249 | 
– | 
                        goto bad_params; | 
| 250 | 
– | 
                value = atof(prms); | 
| 251 | 
– | 
                if ((prms = fskip(prms)) == NULL) | 
| 252 | 
– | 
                        goto bad_params; | 
| 253 | 
– | 
                while (isspace(*prms)) prms++; | 
| 254 | 
– | 
                prms += (*prms == ',') | (*prms == ';'); | 
| 255 | 
– | 
                varset(vname, '=', value); | 
| 256 | 
– | 
        } | 
| 257 | 
– | 
        return; | 
| 258 | 
– | 
bad_params: | 
| 259 | 
– | 
        sprintf(errmsg, "bad parameter list '%s'", last_params); | 
| 260 | 
– | 
        error(USER, errmsg); | 
| 261 | 
– | 
} | 
| 262 | 
– | 
 | 
| 263 | 
– | 
 | 
| 221 | 
  | 
/* Our trace call to sum contributions */ | 
| 222 | 
  | 
static void | 
| 223 | 
  | 
trace_contrib(RAY *r) | 
| 243 | 
  | 
        if ((bval = evalue(mp->binv)) <= -.5)   /* and get bin number */ | 
| 244 | 
  | 
                return;                         /* silently ignore negatives */ | 
| 245 | 
  | 
        if ((bn = (int)(bval + .5)) >= mp->nbins) { | 
| 246 | 
< | 
                error(WARNING, "bad bin number (ignored)"); | 
| 246 | 
> | 
                sprintf(errmsg, "bad bin number (%d ignored)", bn); | 
| 247 | 
> | 
                error(WARNING, errmsg); | 
| 248 | 
  | 
                return; | 
| 249 | 
  | 
        } | 
| 250 | 
  | 
        raycontrib(contr, r, PRIMARY);          /* compute coefficient */ |