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

Comparing ray/src/common/calexpr.c (file contents):
Revision 1.9 by greg, Tue Apr 23 15:26:26 1991 UTC vs.
Revision 1.11 by greg, Tue Apr 23 16:56:39 1991 UTC

# Line 680 | Line 680 | register EPNODE  *epar;
680   }
681  
682  
683 < isconstvar(ep)                  /* is ep linked to a constant? */
683 > isconstvar(ep)                  /* is ep linked to a constant expression? */
684   register EPNODE  *ep;
685   {
686   #ifdef  VARIABLE
687      register EPNODE  *ep1;
688    
688   #ifdef  FUNCTION
689 +
690      if (ep->type == FUNC) {
691 <        if (ep->v.kid->type != VAR)
692 <            return(0);
693 <        ep1 = ep->v.kid->v.ln->def;
694 <        if (ep1 != NULL && ep1->type != ':')
695 <            return(0);
696 <        if ((ep1 == NULL || ep1->v.kid->type != FUNC)
697 <                && liblookup(ep->v.kid->v.ln->name) == NULL)
698 <            return(0);
691 >        if (!isconstfun(ep->v.kid))
692 >                return(0);
693          for (ep1 = ep->v.kid->sibling; ep1 != NULL; ep1 = ep1->sibling)
694 <            if (ep1->type != NUM)
694 >            if (ep1->type != NUM && !isconstfun(ep1))
695                  return(0);
696          return(1);
697      }
# Line 716 | Line 710 | register EPNODE  *ep;
710      return(ep->type == FUNC);
711   #endif
712   }
713 +
714 +
715 + #if  defined(FUNCTION) && defined(VARIABLE)
716 + isconstfun(ep)                  /* is ep linked to a constant function? */
717 + register EPNODE  *ep;
718 + {
719 +    register EPNODE  *dp;
720 +    register LIBR  *lp;
721 +
722 +    if (ep->type != VAR)
723 +        return(0);
724 +    dp = ep->v.ln->def;
725 +    if (dp != NULL && dp->type != ':')
726 +        return(0);
727 +    if ((dp == NULL || dp->v.kid->type != FUNC)
728 +            && ((lp = liblookup(ep->v.ln->name)) == NULL
729 +                    || lp->atyp != ':'))
730 +        return(0);
731 +    return(1);
732 + }
733 + #endif
734   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines