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 2.11 by greg, Wed Feb 12 17:38:03 1997 UTC vs.
Revision 2.35 by greg, Tue Sep 26 00:14:02 2023 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1997 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  Store variable definitions.
6   *
# Line 22 | Line 19 | static char SCCSid[] = "$SunId$ LBL";
19   *  4/23/91  Added ':' assignment for constant expressions
20   *
21   *  8/7/91  Added optional context path to append to variable names
22 + *
23 + *  5/17/2001  Fixed clock counter wrapping behavior
24 + *
25 + *  2/19/03     Eliminated conditional compiles in favor of esupport extern.
26   */
27  
28 < #include  <stdio.h>
28 > #include "copyright.h"
29  
30   #include  <ctype.h>
31  
32 + #include  "rterror.h"
33 + #include  "rtio.h"
34 + #include  "rtmisc.h"
35   #include  "calcomp.h"
36  
37   #ifndef  NHASH
# Line 38 | Line 42 | static char SCCSid[] = "$SunId$ LBL";
42  
43   #define  newnode()      (EPNODE *)ecalloc(1, sizeof(EPNODE))
44  
45 < extern char  *ecalloc(), *emalloc(), *savestr(), *strcpy();
45 > static double  dvalue(char  *name, EPNODE *d);
46  
47 < static double  dvalue();
47 > #define  MAXCLOCK       (1L<<31)        /* clock wrap value */
48  
49   unsigned long  eclock = 0;              /* value storage timer */
50  
# Line 51 | Line 55 | static char  context[MAXCNTX+1];       /* current context pa
55   static VARDEF  *hashtbl[NHASH];         /* definition list */
56   static int  htndx;                      /* index for */        
57   static VARDEF  *htpos;                  /* ...dfirst() and */
54 #ifdef  OUTCHAN
58   static EPNODE  *ochpos;                 /* ...dnext */
59   static EPNODE  *outchan;
57 #endif
60  
59 #ifdef  FUNCTION
61   EPNODE  *curfunc = NULL;
62   #define  dname(ep)      ((ep)->v.kid->type == SYM ? \
63                          (ep)->v.kid->v.name : \
64                          (ep)->v.kid->v.kid->v.name)
64 #else
65 #define  dname(ep)      ((ep)->v.kid->v.name)
66 #endif
65  
66  
67 < fcompile(fname)                 /* get definitions from a file */
68 < char  *fname;
67 > void
68 > fcompile(                       /* get definitions from a file */
69 >        char  *fname
70 > )
71   {
72      FILE  *fp;
73  
# Line 78 | Line 78 | char  *fname;
78          eputs(": cannot open\n");
79          quit(1);
80      }
81 <    initfile(fp, fname, 0);
81 > #ifdef getc_unlocked                    /* avoid stupid semaphores */
82 >    flockfile(fp);
83 > #endif
84 >   initfile(fp, fname, 0);
85      while (nextc != EOF)
86          getstatement();
87      if (fname != NULL)
88          fclose(fp);
89 + #ifdef getc_unlocked
90 +    else
91 +        funlockfile(fp);
92 + #endif
93   }
94  
95  
96 < scompile(str, fn, ln)           /* get definitions from a string */
97 < char  *str;
98 < char  *fn;
99 < int  ln;
96 > void
97 > scompile(               /* get definitions from a string */
98 >        char  *str,
99 >        char  *fn,
100 >        int  ln
101 > )
102   {
103      initstr(str, fn, ln);
104      while (nextc != EOF)
# Line 98 | Line 107 | int  ln;
107  
108  
109   double
110 < varvalue(vname)                 /* return a variable's value */
111 < char  *vname;
110 > varvalue(                       /* return a variable's value */
111 >        char  *vname
112 > )
113   {
114      return(dvalue(vname, dlookup(vname)));
115   }
116  
117  
118   double
119 < evariable(ep)                   /* evaluate a variable */
120 < EPNODE  *ep;
119 > evariable(                      /* evaluate a variable */
120 >        EPNODE  *ep
121 > )
122   {
123 <    register VARDEF  *dp = ep->v.ln;
123 >    VARDEF  *dp = ep->v.ln;
124  
125      return(dvalue(dp->name, dp->def));
126   }
127  
128  
129 < varset(vname, assign, val)      /* set a variable's value */
130 < char  *vname;
131 < int  assign;
132 < double  val;
129 > void
130 > varset(         /* set a variable's value */
131 >        char  *vname,
132 >        int  assign,
133 >        double  val
134 > )
135   {
136      char  *qname;
137 <    register EPNODE  *ep1, *ep2;
137 >    EPNODE  *ep1, *ep2;
138                                          /* get qualified name */
139      qname = qualname(vname, 0);
140                                          /* check for quick set */
141 <    if ((ep1 = dlookup(qname)) != NULL && ep1->v.kid->type == SYM) {
141 >    if ((ep1 = dlookup(qname)) != NULL && ep1->v.kid->type == SYM &&
142 >                (ep1->type == ':') <= (assign == ':')) {
143          ep2 = ep1->v.kid->sibling;
144          if (ep2->type == NUM) {
145              ep2->v.num = val;
# Line 133 | Line 147 | double val;
147              return;
148          }
149      }
150 +    if (ep1 != NULL && esupport&E_REDEFW) {
151 +        wputs(qname);
152 +        if (ep1->type == ':')
153 +            wputs(": reset constant expression\n");
154 +        else
155 +            wputs(": reset expression\n");
156 +    }
157                                          /* hand build definition */
158      ep1 = newnode();
159      ep1->type = assign;
# Line 144 | Line 165 | double val;
165      ep2->type = NUM;
166      ep2->v.num = val;
167      addekid(ep1, ep2);
168 <    dremove(qname);
168 >    if (assign == ':')
169 >        dremove(qname);
170 >    else
171 >        dclear(qname);
172      dpush(qname, ep1);
173   }
174  
175  
176 < dclear(name)                    /* delete variable definitions of name */
177 < char  *name;
176 > void
177 > dclear(                 /* delete variable definitions of name */
178 >        char  *name
179 > )
180   {
181 <    register EPNODE  *ep;
181 >    EPNODE  *ep;
182  
183      while ((ep = dpop(name)) != NULL) {
184          if (ep->type == ':') {
# Line 164 | Line 190 | char  *name;
190   }
191  
192  
193 < dremove(name)                   /* delete all definitions of name */
194 < char  *name;
193 > void
194 > dremove(                        /* delete all definitions of name */
195 >        char  *name
196 > )
197   {
198 <    register EPNODE  *ep;
198 >    EPNODE  *ep;
199  
200      while ((ep = dpop(name)) != NULL)
201          epfree(ep);
202   }
203  
204  
205 < vardefined(name)        /* return non-zero if variable defined */
206 < char  *name;
205 > int
206 > vardefined(     /* return '=' or ':' if variable/constant defined */
207 >        char  *name
208 > )
209   {
210 <    register EPNODE  *dp;
210 >    EPNODE  *dp = dlookup(name);
211  
212 <    return((dp = dlookup(name)) != NULL && dp->v.kid->type == SYM);
212 >    if (dp == NULL || dp->v.kid->type != SYM)
213 >        return(0);
214 >
215 >    return(dp->type);
216   }
217  
218  
219   char *
220 < setcontext(ctx)                 /* set a new context path */
221 < register char  *ctx;
220 > calcontext(                     /* set a new context path */
221 >        char  *ctx
222 > )
223   {
224 <    register char  *cpp;
224 >    char  *cpp;
225  
226      if (ctx == NULL)
227          return(context);                /* just asking */
# Line 216 | Line 250 | register char  *ctx;
250  
251  
252   char *
253 < pushcontext(ctx)                /* push on another context */
254 < char  *ctx;
253 > pushcontext(            /* push on another context */
254 >        char  *ctx
255 > )
256   {
222    extern char  *strncpy(), *strcpy();
257      char  oldcontext[MAXCNTX+1];
258 <    register int  n;
258 >    int  n;
259  
260      strcpy(oldcontext, context);        /* save old context */
261 <    setcontext(ctx);                    /* set new context */
261 >    calcontext(ctx);                    /* set new context */
262      n = strlen(context);                /* tack on old */
263      if (n+strlen(oldcontext) > MAXCNTX) {
264          strncpy(context+n, oldcontext, MAXCNTX-n);
# Line 236 | Line 270 | char  *ctx;
270  
271  
272   char *
273 < popcontext()                    /* pop off top context */
273 > popcontext(void)                        /* pop off top context */
274   {
275 <    register char  *cp1, *cp2;
275 >    char  *cp1, *cp2;
276  
277      if (!context[0])                    /* nothing left to pop */
278          return(context);
# Line 246 | Line 280 | popcontext()                   /* pop off top context */
280      while (*++cp2 && *cp2 != CNTXMARK)
281          ;
282      cp1 = context;                      /* copy tail to front */
283 <    while (*cp1++ = *cp2++)
283 >    while ( (*cp1++ = *cp2++) )
284          ;
285      return(context);
286   }
287  
288  
289   char *
290 < qualname(nam, lvl)              /* get qualified name */
291 < register char  *nam;
292 < int  lvl;
290 > qualname(               /* get qualified name */
291 >        char  *nam,
292 >        int  lvl
293 > )
294   {
295 <    static char  nambuf[MAXWORD+1];
296 <    register char  *cp = nambuf, *cpp;
295 >    static char  nambuf[RMAXWORD+1];
296 >    char  *cp = nambuf, *cpp;
297                                  /* check for explicit local */
298      if (*nam == CNTXMARK)
299          if (lvl > 0)            /* only action is to refuse search */
# Line 269 | Line 304 | int  lvl;
304          return(lvl > 0 ? NULL : nam);
305                                  /* copy name to static buffer */
306      while (*nam) {
307 <        if (cp >= nambuf+MAXWORD)
307 >        if (cp >= nambuf+RMAXWORD)
308                  goto toolong;
309          *cp++ = *nam++;
310      }
# Line 288 | Line 323 | int  lvl;
323              ;
324      }
325      while (*cpp) {              /* copy context to static buffer */
326 <        if (cp >= nambuf+MAXWORD)
326 >        if (cp >= nambuf+RMAXWORD)
327              goto toolong;
328          *cp++ = *cpp++;
329      }
# Line 298 | Line 333 | toolong:
333   }
334  
335  
336 < incontext(qn)                   /* is qualified name in current context? */
337 < register char  *qn;
336 > int
337 > incontext(                      /* is qualified name in current context? */
338 >        char  *qn
339 > )
340   {
341      if (!context[0])                    /* global context accepts all */
342          return(1);
# Line 309 | Line 346 | register char  *qn;
346   }
347  
348  
349 < #ifdef  OUTCHAN
350 < chanout(cs)                     /* set output channels */
351 < int  (*cs)();
349 > void
350 > chanout(                        /* set output channels */
351 >        void  (*cs)(int n, double v)
352 > )
353   {
354 <    register EPNODE  *ep;
354 >    EPNODE  *ep;
355  
356      for (ep = outchan; ep != NULL; ep = ep->sibling)
357          (*cs)(ep->v.kid->v.chan, evalue(ep->v.kid->sibling));
358  
359   }
322 #endif
360  
361  
362 < dcleanup(lvl)           /* clear definitions (0->vars,1->output,2->consts) */
363 < int  lvl;
362 > void
363 > dcleanup(               /* clear definitions (0->vars,1->output,2->consts) */
364 >        int  lvl
365 > )
366   {
367 <    register int  i;
368 <    register VARDEF  *vp;
369 <    register EPNODE  *ep;
367 >    int  i;
368 >    VARDEF  *vp;
369 >    EPNODE  *ep;
370                                  /* if context is global, clear all */
371      for (i = 0; i < NHASH; i++)
372          for (vp = hashtbl[i]; vp != NULL; vp = vp->next)
373 <            if (incontext(vp->name))
373 >            if (incontext(vp->name)) {
374                  if (lvl >= 2)
375                      dremove(vp->name);
376                  else
377                      dclear(vp->name);
378 < #ifdef  OUTCHAN
379 <    if (lvl >= 1) {
380 <        for (ep = outchan; ep != NULL; ep = ep->sibling)
378 >            }
379 >    if (lvl >= 1)
380 >        while (outchan != NULL) {
381 >            ep = outchan;
382 >            outchan = ep->sibling;
383 >            ep->sibling = NULL;
384              epfree(ep);
385 <        outchan = NULL;
344 <    }
345 < #endif
385 >        }
386   }
387  
388  
389   EPNODE *
390 < dlookup(name)                   /* look up a definition */
391 < char  *name;
390 > dlookup(                        /* look up a definition */
391 >        char  *name
392 > )
393   {
394 <    register VARDEF  *vp;
394 >    VARDEF  *vp;
395      
396      if ((vp = varlookup(name)) == NULL)
397          return(NULL);
# Line 359 | Line 400 | char  *name;
400  
401  
402   VARDEF *
403 < varlookup(name)                 /* look up a variable */
404 < char  *name;
403 > varlookup(                      /* look up a variable */
404 >        char  *name
405 > )
406   {
407      int  lvl = 0;
408 <    register char  *qname;
409 <    register VARDEF  *vp;
408 >    char  *qname;
409 >    VARDEF  *vp;
410                                  /* find most qualified match */
411      while ((qname = qualname(name, lvl++)) != NULL)
412          for (vp = hashtbl[hash(qname)]; vp != NULL; vp = vp->next)
# Line 375 | Line 417 | char  *name;
417  
418  
419   VARDEF *
420 < varinsert(name)                 /* get a link to a variable */
421 < char  *name;
420 > varinsert(                      /* get a link to a variable */
421 >        char  *name
422 > )
423   {
424 <    register VARDEF  *vp;
424 >    VARDEF  *vp;
425      int  hv;
426      
427      if ((vp = varlookup(name)) != NULL) {
# Line 386 | Line 429 | char  *name;
429          return(vp);
430      }
431      vp = (VARDEF *)emalloc(sizeof(VARDEF));
389 #ifdef  FUNCTION
432      vp->lib = liblookup(name);
391 #else
392    vp->lib = NULL;
393 #endif
433      if (vp->lib == NULL)                /* if name not in library */
434          name = qualname(name, 0);       /* use fully qualified version */
435      hv = hash(name);
# Line 403 | Line 442 | char  *name;
442   }
443  
444  
445 < #ifdef  FUNCTION
446 < libupdate(fn)                   /* update library links */
447 < char  *fn;
445 > void
446 > libupdate(                      /* update library links */
447 >        char  *fn
448 > )
449   {
450 <    register int  i;
451 <    register VARDEF  *vp;
450 >    int  i;
451 >    VARDEF  *vp;
452                                          /* if fn is NULL then relink all */
453      for (i = 0; i < NHASH; i++)
454          for (vp = hashtbl[i]; vp != NULL; vp = vp->next)
455 <            if (vp->lib != NULL || fn == NULL || !strcmp(fn, vp->name))
455 >            if ((vp->lib != NULL) | (fn == NULL) || !strcmp(fn, vp->name))
456                  vp->lib = liblookup(vp->name);
457   }
418 #endif
458  
459  
460 < varfree(ln)                             /* release link to variable */
461 < register VARDEF  *ln;
460 > void
461 > varfree(                                /* release link to variable */
462 >        VARDEF   *ln
463 > )
464   {
465 <    register VARDEF  *vp;
465 >    VARDEF  *vp;
466      int  hv;
467  
468      if (--ln->nlinks > 0)
# Line 437 | Line 478 | register VARDEF         *ln;
478          vp->next = ln->next;
479      }
480      freestr(ln->name);
481 <    efree((char *)ln);
481 >    efree(ln);
482   }
483  
484  
485   EPNODE *
486 < dfirst()                        /* return pointer to first definition */
486 > dfirst(void)                    /* return pointer to first definition */
487   {
488      htndx = 0;
489      htpos = NULL;
449 #ifdef  OUTCHAN
490      ochpos = outchan;
451 #endif
491      return(dnext());
492   }
493  
494  
495   EPNODE *
496 < dnext()                         /* return pointer to next definition */
496 > dnext(void)                             /* return pointer to next definition */
497   {
498 <    register EPNODE  *ep;
499 <    register char  *nm;
498 >    EPNODE  *ep;
499 >    char  *nm;
500  
501      while (htndx < NHASH) {
502          if (htpos == NULL)
# Line 470 | Line 509 | dnext()                                /* return pointer to next definition */
509                  return(ep);
510          }
511      }
473 #ifdef  OUTCHAN
512      if ((ep = ochpos) != NULL)
513          ochpos = ep->sibling;
514      return(ep);
477 #else
478    return(NULL);
479 #endif
515   }
516  
517  
518   EPNODE *
519 < dpop(name)                      /* pop a definition */
520 < char  *name;
519 > dpop(                   /* pop a definition */
520 >        char  *name
521 > )
522   {
523 <    register VARDEF  *vp;
524 <    register EPNODE  *dp;
523 >    VARDEF  *vp;
524 >    EPNODE  *dp;
525      
526      if ((vp = varlookup(name)) == NULL || vp->def == NULL)
527          return(NULL);
# Line 496 | Line 532 | char  *name;
532   }
533  
534  
535 < dpush(nm, ep)                   /* push on a definition */
536 < char  *nm;
537 < register EPNODE  *ep;
535 > void
536 > dpush(                  /* push on a definition */
537 >        char  *nm,
538 >        EPNODE   *ep
539 > )
540   {
541 <    register VARDEF  *vp;
541 >    VARDEF  *vp;
542  
543      vp = varinsert(nm);
544      ep->sibling = vp->def;
# Line 508 | Line 546 | register EPNODE         *ep;
546   }
547  
548  
549 < #ifdef  OUTCHAN
550 < addchan(sp)                     /* add an output channel assignment */
551 < EPNODE  *sp;
549 > void
550 > addchan(                        /* add an output channel assignment */
551 >        EPNODE  *sp
552 > )
553   {
554      int  ch = sp->v.kid->v.chan;
555 <    register EPNODE  *ep, *epl;
555 >    EPNODE  *ep, *epl;
556  
557      for (epl = NULL, ep = outchan; ep != NULL; epl = ep, ep = ep->sibling)
558          if (ep->v.kid->v.chan >= ch) {
# Line 536 | Line 575 | EPNODE *sp;
575      sp->sibling = NULL;
576  
577   }
539 #endif
578  
579  
580 < getstatement()                  /* get next statement */
580 > void
581 > getstatement(void)                      /* get next statement */
582   {
583 <    register EPNODE  *ep;
583 >    EPNODE  *ep;
584      char  *qname;
585 <    register VARDEF  *vdef;
585 >    VARDEF  *vdef;
586  
587      if (nextc == ';') {         /* empty statement */
588          scan();
589          return;
590      }
591 < #ifdef  OUTCHAN
592 <    if (nextc == '$') {         /* channel assignment */
591 >    if (esupport&E_OUTCHAN &&
592 >                nextc == '$') {         /* channel assignment */
593          ep = getchan();
594          addchan(ep);
595 <    } else
557 < #endif
558 <    {                           /* ordinary definition */
595 >    } else {                            /* ordinary definition */
596          ep = getdefn();
597          qname = qualname(dname(ep), 0);
598 < #ifdef  REDEFW
562 <        if ((vdef = varlookup(qname)) != NULL)
598 >        if (esupport&E_REDEFW && (vdef = varlookup(qname)) != NULL) {
599              if (vdef->def != NULL && epcmp(ep, vdef->def)) {
600                  wputs(qname);
601                  if (vdef->def->type == ':')
602                      wputs(": redefined constant expression\n");
603                  else
604                      wputs(": redefined\n");
605 <            }
570 < #ifdef  FUNCTION
571 <            else if (ep->v.kid->type == FUNC && vdef->lib != NULL) {
605 >            } else if (ep->v.kid->type == FUNC && vdef->lib != NULL) {
606                  wputs(qname);
607                  wputs(": definition hides library function\n");
608              }
609 < #endif
576 < #endif
609 >        }
610          if (ep->type == ':')
611              dremove(qname);
612          else
# Line 589 | Line 622 | getstatement()                 /* get next statement */
622  
623  
624   EPNODE *
625 < getdefn()                       /* A -> SYM = E1 */
626 <                                /*      SYM : E1 */
627 <                                /*      FUNC(SYM,..) = E1 */
628 <                                /*      FUNC(SYM,..) : E1 */
625 > getdefn(void)
626 >        /* A -> SYM = E1 */
627 >        /*      SYM : E1 */
628 >        /*      FUNC(SYM,..) = E1 */
629 >        /*      FUNC(SYM,..) : E1 */
630   {
631 <    register EPNODE  *ep1, *ep2;
631 >    EPNODE  *ep1, *ep2;
632  
633 <    if (!isalpha(nextc) && nextc != CNTXMARK)
633 >    if (!isalpha(nextc) & (nextc != CNTXMARK))
634          syntax("illegal variable name");
635  
636      ep1 = newnode();
637      ep1->type = SYM;
638      ep1->v.name = savestr(getname());
639  
640 < #ifdef  FUNCTION
607 <    if (nextc == '(') {
640 >    if (esupport&E_FUNCTION && nextc == '(') {
641          ep2 = newnode();
642          ep2->type = FUNC;
643          addekid(ep2, ep1);
# Line 612 | Line 645 | getdefn()                      /* A -> SYM = E1 */
645          do {
646              scan();
647              if (!isalpha(nextc))
648 <                syntax("illegal variable name");
648 >                syntax("illegal parameter name");
649              ep2 = newnode();
650              ep2->type = SYM;
651              ep2->v.name = savestr(getname());
652 +            if (strchr(ep2->v.name, CNTXMARK) != NULL)
653 +                syntax("illegal parameter name");
654              addekid(ep1, ep2);
655          } while (nextc == ',');
656          if (nextc != ')')
# Line 623 | Line 658 | getdefn()                      /* A -> SYM = E1 */
658          scan();
659          curfunc = ep1;
660      }
626 #endif
661  
662 <    if (nextc != '=' && nextc != ':')
662 >    if ((nextc != '=') & (nextc != ':'))
663          syntax("'=' or ':' expected");
664  
665      ep2 = newnode();
# Line 634 | Line 668 | getdefn()                      /* A -> SYM = E1 */
668      addekid(ep2, ep1);
669      addekid(ep2, getE1());
670  
671 <    if (
638 < #ifdef  FUNCTION
639 <            ep1->type == SYM &&
640 < #endif
641 <            ep1->sibling->type != NUM) {
671 >    if (ep1->type == SYM && ep1->sibling->type != NUM) {
672          ep1 = newnode();
673 <        ep1->type = TICK;
673 >        ep1->type = CLKT;
674          ep1->v.tick = 0;
675          addekid(ep2, ep1);
676          ep1 = newnode();
677          ep1->type = NUM;
678          addekid(ep2, ep1);
679      }
650
651 #ifdef  FUNCTION
680      curfunc = NULL;
653 #endif
681  
682      return(ep2);
683   }
684  
685  
659 #ifdef  OUTCHAN
686   EPNODE *
687 < getchan()                       /* A -> $N = E1 */
687 > getchan(void)                   /* A -> $N = E1 */
688   {
689 <    register EPNODE  *ep1, *ep2;
689 >    EPNODE  *ep1, *ep2;
690  
691      if (nextc != '$')
692          syntax("missing '$'");
# Line 681 | Line 707 | getchan()                      /* A -> $N = E1 */
707  
708      return(ep2);
709   }
684 #endif
710  
711  
712  
# Line 690 | Line 715 | getchan()                      /* A -> $N = E1 */
715   */
716  
717  
718 < static double
719 < dvalue(name, d)                 /* evaluate a variable */
695 < char  *name;
696 < EPNODE  *d;
718 > static double                   /* evaluate a variable */
719 > dvalue(char *name, EPNODE *d)
720   {
721 <    register EPNODE  *ep1, *ep2;
721 >    EPNODE  *ep1, *ep2;
722      
723      if (d == NULL || d->v.kid->type != SYM) {
724          eputs(name);
# Line 705 | Line 728 | EPNODE *d;
728      ep1 = d->v.kid->sibling;                    /* get expression */
729      if (ep1->type == NUM)
730          return(ep1->v.num);                     /* return if number */
731 +    if (esupport&E_RCONST && d->type == ':') {
732 +        wputs(name);
733 +        wputs(": assigned non-constant value\n");
734 +    }
735      ep2 = ep1->sibling;                         /* check time */
736 <    if (ep2->v.tick == 0 || ep2->v.tick < eclock) {
737 <        ep2->v.tick = d->type == ':' ? ~0L : eclock;
736 >    if (eclock >= MAXCLOCK)
737 >        eclock = 1;                             /* wrap clock counter */
738 >    if (ep2->v.tick < MAXCLOCK &&
739 >                (ep2->v.tick == 0) | (ep2->v.tick != eclock)) {
740 >        ep2->v.tick = d->type == ':' ? MAXCLOCK : eclock;
741          ep2 = ep2->sibling;
742          ep2->v.num = evalue(ep1);               /* needs new value */
743      } else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines