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.12 by greg, Thu Aug 8 11:22:04 1991 UTC vs.
Revision 2.1 by greg, Tue Nov 12 16:55:21 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 323 | Line 323 | int  ln;
323   }
324  
325  
326 + getscanpos(fnp, lnp, spp, fpp)  /* return current scan position */
327 + char  **fnp;
328 + int  *lnp;
329 + char  **spp;
330 + FILE  **fpp;
331 + {
332 +    if (fnp != NULL) *fnp = infile;
333 +    if (lnp != NULL) *lnp = lineno;
334 +    if (spp != NULL) *spp = linbuf+linepos;
335 +    if (fpp != NULL) *fpp = infp;
336 + }
337 +
338 +
339   int
340   scan()                          /* scan next character, return literal next */
341   {
# Line 431 | Line 444 | getname()                      /* scan an identifier */
444      for (i = 0; i < MAXWORD && isid(lnext); i++, lnext = scan())
445          str[i] = lnext;
446      str[i] = '\0';
447 +    while (isid(lnext))         /* skip rest of name */
448 +        lnext = scan();
449  
450      return(str);
451   }
# Line 571 | Line 586 | getE4()                                /* E4 -> ADDOP E5 */
586                  ep2->v.num = -ep2->v.num;
587                  return(ep2);
588          }
589 +        if (ep2->type == UMINUS) {      /* don't generate -(-E5) */
590 +            efree((char *)ep2);
591 +            return(ep2->v.kid);
592 +        }
593          ep1 = newnode();
594          ep1->type = UMINUS;
595          addekid(ep1, ep2);
# Line 591 | Line 610 | getE5()                                /* E5 -> (E1) */
610                                  /*       ARG */
611   {
612      int  i;
613 +    char  *nam;
614      register EPNODE  *ep1, *ep2;
615  
616      if (nextc == '(') {
# Line 613 | Line 633 | getE5()                                /* E5 -> (E1) */
633   #endif
634  
635   #if  defined(VARIABLE) || defined(FUNCTION)
636 <    if (isalpha(nextc)) {
637 <        ep1 = newnode();
618 <        ep1->type = VAR;
619 <        ep1->v.ln = varinsert(getname());
620 <
636 >    if (isalpha(nextc) || nextc == CNTXMARK) {
637 >        nam = getname();
638   #if  defined(VARIABLE) && defined(FUNCTION)
639 +        ep1 = NULL;
640          if (curfunc != NULL)
641              for (i = 1, ep2 = curfunc->v.kid->sibling;
642                                  ep2 != NULL; i++, ep2 = ep2->sibling)
643 <                if (!strcmp(ep2->v.name, ep1->v.ln->name)) {
626 <                    epfree(ep1);
643 >                if (!strcmp(ep2->v.name, nam)) {
644                      ep1 = newnode();
645                      ep1->type = ARG;
646                      ep1->v.chan = i;
647                      break;
648                  }
649 +        if (ep1 == NULL)
650   #endif
651 +        {
652 +            ep1 = newnode();
653 +            ep1->type = VAR;
654 +            ep1->v.ln = varinsert(nam);
655 +        }
656   #ifdef  FUNCTION
657          if (nextc == '(') {
658              ep2 = newnode();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines