ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/calfunc.c
(Generate patch)

Comparing ray/src/common/calfunc.c (file contents):
Revision 1.4 by greg, Tue Apr 23 15:44:39 1991 UTC vs.
Revision 1.8 by greg, Tue Jul 16 14:26:18 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 22 | Line 22 | static char SCCSid[] = "$SunId$ LBL";
22  
23   #include  "calcomp.h"
24  
25 <
25 >                                /* bits in argument flag (better be right!) */
26 > #define  AFLAGSIZ       (8*sizeof(unsigned long))
27   #define  ALISTSIZ       6       /* maximum saved argument list */
28  
29   typedef struct activation {
# Line 130 | Line 131 | double  *a;
131      act.name = fname;
132      act.prev = curact;
133      act.ap = a;
134 <    act.an = (1L<<n)-1;
134 >    if (n >= AFLAGSIZ)
135 >        act.an = ~0;
136 >    else
137 >        act.an = (1L<<n)-1;
138      act.fun = NULL;
139      curact = &act;
140  
# Line 168 | Line 172 | double  (*fptr)();
172                  break;
173          libsize++;
174      }
175 <    lp[0].fname = savestr(fname);
175 >    lp[0].fname = fname;                /* must be static! */
176      lp[0].nargs = nargs;
177      lp[0].atyp = assign;
178      lp[0].f = fptr;
# Line 196 | Line 200 | argument(n)                    /* return nth argument for active functi
200   register int  n;
201   {
202      register ACTIVATION  *actp = curact;
203 <    EPNODE  *ep;
203 >    register EPNODE  *ep;
204      double  aval;
205  
206      if (actp == NULL || --n < 0) {
# Line 204 | Line 208 | register int  n;
208          quit(1);
209      }
210                                                  /* already computed? */
211 <    if (1L<<n & actp->an)
211 >    if (n < AFLAGSIZ && 1L<<n & actp->an)
212          return(actp->ap[n]);
213  
214      if (actp->fun == NULL || (ep = ekid(actp->fun, n+1)) == NULL) {
# Line 376 | Line 380 | register VARDEF  *vp;
380      }
381      lasterrno = errno;
382      errno = 0;
383 <    d = (*vp->lib->f)();
383 >    d = (*vp->lib->f)(vp->lib->fname);
384   #ifdef  IEEE
385      if (!finite(d))
386          errno = EDOM;
387   #endif
388      if (errno) {
389          wputs(fname);
390 <        wputs(": bad call\n");
390 >        if (errno == EDOM)
391 >                wputs(": domain error\n");
392 >        else if (errno == ERANGE)
393 >                wputs(": range error\n");
394 >        else
395 >                wputs(": error in call\n");
396          return(0.0);
397      }
398      errno = lasterrno;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines