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

Comparing ray/src/common/caldefn.c (file contents):
Revision 2.28 by greg, Thu Apr 2 18:00:34 2020 UTC vs.
Revision 2.32 by greg, Wed Mar 30 16:00:56 2022 UTC

# Line 196 | Line 196 | dremove(                       /* delete all definitions of name */
196  
197  
198   int
199 < vardefined(     /* return non-zero if variable defined */
199 > vardefined(     /* return '=' or ':' if variable/constant defined */
200          char  *name
201   )
202   {
203 <    EPNODE  *dp;
203 >    EPNODE  *dp = dlookup(name);
204  
205 <    return((dp = dlookup(name)) != NULL && dp->v.kid->type == SYM);
205 >    if (dp == NULL || dp->v.kid->type != SYM)
206 >        return(0);
207 >
208 >    return(dp->type);
209   }
210  
211  
212   char *
213 < setcontext(                     /* set a new context path */
213 > calcontext(                     /* set a new context path */
214          char  *ctx
215   )
216   {
# Line 248 | Line 251 | pushcontext(           /* push on another context */
251      int  n;
252  
253      strcpy(oldcontext, context);        /* save old context */
254 <    setcontext(ctx);                    /* set new context */
254 >    calcontext(ctx);                    /* set new context */
255      n = strlen(context);                /* tack on old */
256      if (n+strlen(oldcontext) > MAXCNTX) {
257          strncpy(context+n, oldcontext, MAXCNTX-n);
# Line 637 | Line 640 | getdefn(void)
640              ep2 = newnode();
641              ep2->type = SYM;
642              ep2->v.name = savestr(getname());
643 +            if (strchr(ep2->v.name, CNTXMARK) != NULL)
644 +                syntax("illegal parameter name");
645              addekid(ep1, ep2);
646          } while (nextc == ',');
647          if (nextc != ')')

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines