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 2.31 by greg, Mon Feb 26 20:55:00 2024 UTC vs.
Revision 2.32 by greg, Mon Sep 16 17:31:14 2024 UTC

# Line 51 | Line 51 | static double  l_asin(char *), l_acos(char *), l_atan(
51   static double  l_exp(char *), l_log(char *), l_log10(char *);
52  
53                          /* functions must be listed alphabetically */
54 < static LIBR  library[MAXLIB] = {
54 > static ELIBR  library[MAXLIB] = {
55      { "acos", 1, ':', l_acos },
56      { "asin", 1, ':', l_asin },
57      { "atan", 1, ':', l_atan },
# Line 74 | Line 74 | static LIBR  library[MAXLIB] = {
74  
75   static int  libsize = 18;
76  
77 < #define  resolve(ep)    ((ep)->type==VAR?(ep)->v.ln:argf((ep)->v.chan))
77 > #define  resolve(ep)    ((ep)->type==VAR?(ep)->v.ln:eargf((ep)->v.chan))
78  
79  
80   int
# Line 82 | Line 82 | fundefined(                    /* return # of req'd arguments for funct
82          char  *fname
83   )
84   {
85 <    LIBR  *lp;
85 >    ELIBR  *lp;
86      VARDEF  *vp;
87  
88      if ((vp = varlookup(fname)) != NULL && vp->def != NULL
89                  && vp->def->v.kid->type == FUNC)
90          return(nekids(vp->def->v.kid) - 1);
91 <    lp = vp != NULL ? vp->lib : liblookup(fname);
91 >    lp = vp != NULL ? vp->lib : eliblookup(fname);
92      if (lp == NULL)
93          return(0);
94      return(lp->nargs);
# Line 140 | Line 140 | funset(                                /* set a library function */
140   {
141      int  oldlibsize = libsize;
142      char *cp;
143 <    LIBR  *lp;
143 >    ELIBR  *lp;
144                                                  /* check for context */
145      for (cp = fname; *cp; cp++)
146          ;
# Line 150 | Line 150 | funset(                                /* set a library function */
150          *--cp = '\0';
151          if (cp == fname) return;
152      }
153 <    if ((lp = liblookup(fname)) == NULL) {      /* insert */
153 >    if ((lp = eliblookup(fname)) == NULL) {     /* insert */
154          if (fptr == NULL)
155                  return;                         /* nothing! */
156          if (libsize >= MAXLIB) {
# Line 177 | Line 177 | funset(                                /* set a library function */
177          lp[0].f = fptr;
178      }
179      if (libsize != oldlibsize)
180 <        libupdate(fname);                       /* relink library */
180 >        elibupdate(fname);                      /* relink library */
181   }
182  
183  
# Line 228 | Line 228 | argument(int n)                        /* return nth argument for active fu
228  
229  
230   VARDEF *
231 < argf(int n)                     /* return function def for nth argument */
231 > eargf(int n)                    /* return function def for nth argument */
232   {
233      ACTIVATION  *actp;
234      EPNODE  *ep;
# Line 254 | Line 254 | argf(int n)                    /* return function def for nth argument
254  
255          n = ep->v.chan;                         /* try previous context */
256      }
257 <    eputs("Bad call to argf!\n");
257 >    eputs("Bad call to eargf!\n");
258      quit(1);
259  
260   badarg:
# Line 266 | Line 266 | badarg:
266  
267  
268   char *
269 < argfun(int n)                   /* return function name for nth argument */
269 > eargfun(int n)                  /* return function name for nth argument */
270   {
271 <    return(argf(n)->name);
271 >    return(eargf(n)->name);
272   }
273  
274  
# Line 310 | Line 310 | eargument(                             /* evaluate an argument */
310   }
311  
312  
313 < LIBR *
314 < liblookup(char *fname)          /* look up a library function */
313 > ELIBR *
314 > eliblookup(char *fname)         /* look up a library function */
315   {
316      int  upper, lower;
317      int  cm, i;
# Line 344 | Line 344 | libfunc(                               /* execute library function */
344          VARDEF  *vp
345   )
346   {
347 <    LIBR  *lp;
347 >    ELIBR  *lp;
348      double  d;
349      int  lasterrno;
350  
351      if (vp != NULL)
352          lp = vp->lib;
353      else
354 <        lp = liblookup(fname);
354 >        lp = eliblookup(fname);
355      if (lp == NULL) {
356          eputs(fname);
357          eputs(": undefined function\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines