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.9 by greg, Wed Apr 24 08:17:22 1991 UTC vs.
Revision 1.10 by greg, Mon Apr 29 08:33:13 1991 UTC

# Line 19 | Line 19 | static char SCCSid[] = "$SunId$ LBL";
19   *
20   *  5/31/90  Added conditional compile (REDEFW) for redefinition warning.
21   *
22 < *  4/23/91  Added ':' defines for constant expressions (RCONST)
22 > *  4/23/91  Added ':' assignment for constant expressions
23   */
24  
25   #include  <stdio.h>
# Line 185 | Line 185 | int  (*cs)();
185   #endif
186  
187  
188 < dcleanup(cons, ochans)          /* clear definitions */
189 < int  cons, ochans;
188 > dcleanup(lvl)                   /* clear definitions (0->vars,1->consts,2->output) */
189 > int  lvl;
190   {
191      register int  i;
192      register VARDEF  *vp;
# Line 194 | Line 194 | int  cons, ochans;
194  
195      for (i = 0; i < NHASH; i++)
196          for (vp = hashtbl[i]; vp != NULL; vp = vp->next)
197 <            if (cons)
197 >            if (lvl >= 1)
198                  dremove(vp->name);
199              else
200                  dclear(vp->name);
201   #ifdef  OUTCHAN
202 <    if (ochans) {
202 >    if (lvl >= 2) {
203          for (ep = outchan; ep != NULL; ep = ep->sibling)
204              epfree(ep);
205          outchan = NULL;
# Line 378 | Line 378 | EPNODE  *sp;
378   loaddefn()                      /* load next definition */
379   {
380      register EPNODE  *ep;
381 +    EPNODE  *lastdef;
382  
383      if (nextc == ';') {         /* empty statement */
384          scan();
# Line 392 | Line 393 | loaddefn()                     /* load next definition */
393      {                           /* ordinary definition */
394          ep = getdefn();
395   #ifdef  REDEFW
396 <        if (dlookup(dname(ep)) != NULL) {
396 <            dclear(dname(ep));
396 >        if ((lastdef = dlookup(dname(ep))) != NULL) {
397              wputs(dname(ep));
398 <            if (dlookup(dname(ep)) == NULL)
399 <                wputs(": redefined\n");
400 <            else
398 >            if (lastdef->type == ':')
399                  wputs(": redefined constant expression\n");
400 +            else
401 +                wputs(": redefined\n");
402          }
403   #ifdef  FUNCTION
404          else if (ep->v.kid->type == FUNC &&
# Line 407 | Line 407 | loaddefn()                     /* load next definition */
407              wputs(": redefined library function\n");
408          }
409   #endif
410 #else
411        dclear(dname(ep));
410   #endif
411 +        if (ep->type == ':')
412 +            dremove(dname(ep));
413 +        else
414 +            dclear(dname(ep));
415          dpush(ep);
416      }
417      if (nextc != EOF) {
# Line 465 | Line 467 | getdefn()                      /* A -> SYM = E1 */
467      ep2->type = nextc;
468      scan();
469      addekid(ep2, ep1);
468 #ifdef  RCONST
469    if (
470 #ifdef  FUNCTION
471            ep1->type == SYM &&
472 #endif
473            ep2->type == ':')
474        addekid(ep2, rconst(getE1()));
475    else
476 #endif
470      addekid(ep2, getE1());
471  
472      if (

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines