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.8 by greg, Wed Apr 17 10:54:58 1991 UTC vs.
Revision 1.11 by greg, Tue Apr 23 16:56:39 1991 UTC

# Line 78 | Line 78 | double  (*eoper[])() = {               /* expression operations */
78          esubtr,
79          0,
80          edivi,
81 <        0,0,0,0,0,0,0,0,0,0,0,0,0,
81 >        0,0,0,0,0,0,0,0,0,0,
82          ebotch,
83 +        0,0,
84 +        ebotch,
85          0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
86          0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
87          epow,
# Line 641 | Line 643 | getE5()                                /* E5 -> (E1) */
643              syntax("'(' expected");
644   #endif
645   #endif
646 + #ifdef  RCONST
647 +        if (isconstvar(ep1))
648 +            ep1 = rconst(ep1);
649 + #endif
650          return(ep1);
651      }
652   #endif
# Line 672 | Line 678 | register EPNODE  *epar;
678  
679      return(ep);
680   }
681 +
682 +
683 + isconstvar(ep)                  /* is ep linked to a constant expression? */
684 + register EPNODE  *ep;
685 + {
686 + #ifdef  VARIABLE
687 +    register EPNODE  *ep1;
688 + #ifdef  FUNCTION
689 +
690 +    if (ep->type == FUNC) {
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 && !isconstfun(ep1))
695 +                return(0);
696 +        return(1);
697 +    }
698 + #endif
699 +    if (ep->type != VAR)
700 +        return(0);
701 +    ep1 = ep->v.ln->def;
702 +    if (ep1 == NULL || ep1->type != ':')
703 +        return(0);
704 + #ifdef  FUNCTION
705 +    if (ep1->v.kid->type != SYM)
706 +        return(0);
707 + #endif
708 +    return(1);
709 + #else
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