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 1.15 by greg, Thu Aug 8 12:28:30 1991 UTC vs.
Revision 1.16 by greg, Thu Aug 8 14:38:00 1991 UTC

# Line 340 | Line 340 | varinsert(name)                        /* get a link to a variable */
340   char  *name;
341   {
342      register VARDEF  *vp;
343 +    LIBR  *libp;
344      int  hv;
345      
346      if ((vp = varlookup(name)) != NULL) {
347          vp->nlinks++;
348          return(vp);
349      }
350 <    name = qualname(name, 0);           /* use fully qualified name */
350 > #ifdef  FUNCTION
351 >    libp = liblookup(name);
352 > #else
353 >    libp = NULL;
354 > #endif
355 >    if (libp == NULL)                   /* if name not in library */
356 >        name = qualname(name, 0);       /* use fully qualified version */
357      hv = hash(name);
358      vp = (VARDEF *)emalloc(sizeof(VARDEF));
359      vp->name = savestr(name);
360      vp->nlinks = 1;
361      vp->def = NULL;
362 <    vp->lib = NULL;
362 >    vp->lib = libp;
363      vp->next = hashtbl[hv];
364      hashtbl[hv] = vp;
365      return(vp);
# Line 482 | Line 489 | getstatement()                 /* get next statement */
489   {
490      register EPNODE  *ep;
491      char  *qname;
492 <    EPNODE  *lastdef;
492 >    register VARDEF  *vdef;
493  
494      if (nextc == ';') {         /* empty statement */
495          scan();
# Line 498 | Line 505 | getstatement()                 /* get next statement */
505          ep = getdefn();
506          qname = qualname(dname(ep), 0);
507   #ifdef  REDEFW
508 <        if ((lastdef = dlookup(qname)) != NULL) {
509 <            wputs(qname);
510 <            if (lastdef->type == ':')
511 <                wputs(": redefined constant expression\n");
512 <            else
513 <                wputs(": redefined\n");
514 <        }
508 >        if ((vdef = varlookup(qname)) != NULL)
509 >            if (vdef->def != NULL) {
510 >                wputs(qname);
511 >                if (vdef->def->type == ':')
512 >                    wputs(": redefined constant expression\n");
513 >                else
514 >                    wputs(": redefined\n");
515 >            }
516   #ifdef  FUNCTION
517 <        else if (ep->v.kid->type == FUNC && liblookup(qname) != NULL) {
518 <            wputs(qname);
519 <            wputs(": definition hides library function\n");
520 <        }
517 >            else if (ep->v.kid->type == FUNC && vdef->lib != NULL) {
518 >                wputs(qname);
519 >                wputs(": definition hides library function\n");
520 >            }
521   #endif
522   #endif
523          if (ep->type == ':')

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines