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.7 by greg, Thu Feb 16 09:49:27 1995 UTC vs.
Revision 2.32 by greg, Wed Mar 30 16:00:56 2022 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 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 < long  eclock = -1;                      /* value storage timer */
49 > unsigned long  eclock = 0;              /* value storage timer */
50  
51 < static char  context[MAXWORD+1];        /* current context path */
51 > #define  MAXCNTX        1023            /* maximum context length */
52  
53 + static char  context[MAXCNTX+1];        /* current context path */
54 +
55   static VARDEF  *hashtbl[NHASH];         /* definition list */
56   static int  htndx;                      /* index for */        
57   static VARDEF  *htpos;                  /* ...dfirst() and */
52 #ifdef  OUTCHAN
58   static EPNODE  *ochpos;                 /* ...dnext */
59   static EPNODE  *outchan;
55 #endif
60  
61 < #ifdef  FUNCTION
58 < EPNODE  *curfunc;
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)
62 #else
63 #define  dname(ep)      ((ep)->v.kid->v.name)
64 #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 84 | Line 86 | char  *fname;
86   }
87  
88  
89 < scompile(str, fn, ln)           /* get definitions from a string */
90 < char  *str;
91 < char  *fn;
92 < int  ln;
89 > void
90 > scompile(               /* get definitions from a string */
91 >        char  *str,
92 >        char  *fn,
93 >        int  ln
94 > )
95   {
96      initstr(str, fn, ln);
97      while (nextc != EOF)
# Line 96 | Line 100 | int  ln;
100  
101  
102   double
103 < varvalue(vname)                 /* return a variable's value */
104 < char  *vname;
103 > varvalue(                       /* return a variable's value */
104 >        char  *vname
105 > )
106   {
107      return(dvalue(vname, dlookup(vname)));
108   }
109  
110  
111   double
112 < evariable(ep)                   /* evaluate a variable */
113 < EPNODE  *ep;
112 > evariable(                      /* evaluate a variable */
113 >        EPNODE  *ep
114 > )
115   {
116 <    register VARDEF  *dp = ep->v.ln;
116 >    VARDEF  *dp = ep->v.ln;
117  
118      return(dvalue(dp->name, dp->def));
119   }
120  
121  
122 < varset(vname, assign, val)      /* set a variable's value */
123 < char  *vname;
124 < int  assign;
125 < double  val;
122 > void
123 > varset(         /* set a variable's value */
124 >        char  *vname,
125 >        int  assign,
126 >        double  val
127 > )
128   {
129      char  *qname;
130 <    register EPNODE  *ep1, *ep2;
130 >    EPNODE  *ep1, *ep2;
131                                          /* get qualified name */
132      qname = qualname(vname, 0);
133                                          /* check for quick set */
134 <    if ((ep1 = dlookup(qname)) != NULL && ep1->v.kid->type == SYM) {
134 >    if ((ep1 = dlookup(qname)) != NULL && ep1->v.kid->type == SYM &&
135 >                (ep1->type == ':') <= (assign == ':')) {
136          ep2 = ep1->v.kid->sibling;
137          if (ep2->type == NUM) {
138              ep2->v.num = val;
# Line 131 | Line 140 | double val;
140              return;
141          }
142      }
143 +    if (ep1 != NULL && esupport&E_REDEFW) {
144 +        wputs(qname);
145 +        if (ep1->type == ':')
146 +            wputs(": reset constant expression\n");
147 +        else
148 +            wputs(": reset expression\n");
149 +    }
150                                          /* hand build definition */
151      ep1 = newnode();
152      ep1->type = assign;
# Line 142 | Line 158 | double val;
158      ep2->type = NUM;
159      ep2->v.num = val;
160      addekid(ep1, ep2);
161 <    dremove(qname);
161 >    if (assign == ':')
162 >        dremove(qname);
163 >    else
164 >        dclear(qname);
165      dpush(qname, ep1);
166   }
167  
168  
169 < dclear(name)                    /* delete variable definitions of name */
170 < char  *name;
169 > void
170 > dclear(                 /* delete variable definitions of name */
171 >        char  *name
172 > )
173   {
174 <    register EPNODE  *ep;
174 >    EPNODE  *ep;
175  
176      while ((ep = dpop(name)) != NULL) {
177          if (ep->type == ':') {
# Line 162 | Line 183 | char  *name;
183   }
184  
185  
186 < dremove(name)                   /* delete all definitions of name */
187 < char  *name;
186 > void
187 > dremove(                        /* delete all definitions of name */
188 >        char  *name
189 > )
190   {
191 <    register EPNODE  *ep;
191 >    EPNODE  *ep;
192  
193      while ((ep = dpop(name)) != NULL)
194          epfree(ep);
195   }
196  
197  
198 < vardefined(name)        /* return non-zero if variable defined */
199 < char  *name;
198 > int
199 > vardefined(     /* return '=' or ':' if variable/constant defined */
200 >        char  *name
201 > )
202   {
203 <    register EPNODE  *dp;
203 >    EPNODE  *dp = dlookup(name);
204  
205 <    return((dp = dlookup(name)) != NULL && dp->v.kid->type == SYM);
205 >    if (dp == NULL || dp->v.kid->type != SYM)
206 >        return(0);
207 >
208 >    return(dp->type);
209   }
210  
211  
212   char *
213 < setcontext(ctx)                 /* set a new context path */
214 < register char  *ctx;
213 > calcontext(                     /* set a new context path */
214 >        char  *ctx
215 > )
216   {
217 <    register char  *cpp;
217 >    char  *cpp;
218  
219      if (ctx == NULL)
220          return(context);                /* just asking */
# Line 198 | Line 227 | register char  *ctx;
227      cpp = context;                      /* start context with mark */
228      *cpp++ = CNTXMARK;
229      do {                                /* carefully copy new context */
230 <        if (cpp >= context+MAXWORD)
230 >        if (cpp >= context+MAXCNTX)
231              break;                      /* just copy what we can */
232          if (isid(*ctx))
233              *cpp++ = *ctx++;
# Line 214 | Line 243 | register char  *ctx;
243  
244  
245   char *
246 < pushcontext(ctx)                /* push on another context */
247 < char  *ctx;
246 > pushcontext(            /* push on another context */
247 >        char  *ctx
248 > )
249   {
250 <    extern char  *strncpy(), *strcpy();
251 <    char  oldcontext[MAXWORD+1];
222 <    register int  n;
250 >    char  oldcontext[MAXCNTX+1];
251 >    int  n;
252  
253      strcpy(oldcontext, context);        /* save old context */
254 <    setcontext(ctx);                    /* set new context */
254 >    calcontext(ctx);                    /* set new context */
255      n = strlen(context);                /* tack on old */
256 <    if (n+strlen(oldcontext) > MAXWORD) {
257 <        strncpy(context+n, oldcontext, MAXWORD-n);
258 <        context[MAXWORD] = '\0';
256 >    if (n+strlen(oldcontext) > MAXCNTX) {
257 >        strncpy(context+n, oldcontext, MAXCNTX-n);
258 >        context[MAXCNTX] = '\0';
259      } else
260          strcpy(context+n, oldcontext);
261      return(context);
# Line 234 | Line 263 | char  *ctx;
263  
264  
265   char *
266 < popcontext()                    /* pop off top context */
266 > popcontext(void)                        /* pop off top context */
267   {
268 <    register char  *cp1, *cp2;
268 >    char  *cp1, *cp2;
269  
270      if (!context[0])                    /* nothing left to pop */
271          return(context);
# Line 244 | Line 273 | popcontext()                   /* pop off top context */
273      while (*++cp2 && *cp2 != CNTXMARK)
274          ;
275      cp1 = context;                      /* copy tail to front */
276 <    while (*cp1++ = *cp2++)
276 >    while ( (*cp1++ = *cp2++) )
277          ;
278      return(context);
279   }
280  
281  
282   char *
283 < qualname(nam, lvl)              /* get qualified name */
284 < register char  *nam;
285 < int  lvl;
283 > qualname(               /* get qualified name */
284 >        char  *nam,
285 >        int  lvl
286 > )
287   {
288 <    static char  nambuf[MAXWORD+1];
289 <    register char  *cp = nambuf, *cpp;
288 >    static char  nambuf[RMAXWORD+1];
289 >    char  *cp = nambuf, *cpp;
290                                  /* check for explicit local */
291      if (*nam == CNTXMARK)
292          if (lvl > 0)            /* only action is to refuse search */
# Line 267 | Line 297 | int  lvl;
297          return(lvl > 0 ? NULL : nam);
298                                  /* copy name to static buffer */
299      while (*nam) {
300 <        if (cp >= nambuf+MAXWORD)
300 >        if (cp >= nambuf+RMAXWORD)
301                  goto toolong;
302          *cp++ = *nam++;
303      }
# Line 286 | Line 316 | int  lvl;
316              ;
317      }
318      while (*cpp) {              /* copy context to static buffer */
319 <        if (cp >= nambuf+MAXWORD)
319 >        if (cp >= nambuf+RMAXWORD)
320              goto toolong;
321          *cp++ = *cpp++;
322      }
# Line 296 | Line 326 | toolong:
326   }
327  
328  
329 < incontext(qn)                   /* is qualified name in current context? */
330 < register char  *qn;
329 > int
330 > incontext(                      /* is qualified name in current context? */
331 >        char  *qn
332 > )
333   {
334 +    if (!context[0])                    /* global context accepts all */
335 +        return(1);
336      while (*qn && *qn != CNTXMARK)      /* find context mark */
337          qn++;
338      return(!strcmp(qn, context));
339   }
340  
341  
342 < #ifdef  OUTCHAN
343 < chanout(cs)                     /* set output channels */
344 < int  (*cs)();
342 > void
343 > chanout(                        /* set output channels */
344 >        void  (*cs)(int n, double v)
345 > )
346   {
347 <    register EPNODE  *ep;
347 >    EPNODE  *ep;
348  
349      for (ep = outchan; ep != NULL; ep = ep->sibling)
350          (*cs)(ep->v.kid->v.chan, evalue(ep->v.kid->sibling));
351  
352   }
318 #endif
353  
354  
355 < dcleanup(lvl)           /* clear definitions (0->vars,1->output,2->consts) */
356 < int  lvl;
355 > void
356 > dcleanup(               /* clear definitions (0->vars,1->output,2->consts) */
357 >        int  lvl
358 > )
359   {
360 <    register int  i;
361 <    register VARDEF  *vp;
362 <    register EPNODE  *ep;
360 >    int  i;
361 >    VARDEF  *vp;
362 >    EPNODE  *ep;
363                                  /* if context is global, clear all */
364      for (i = 0; i < NHASH; i++)
365          for (vp = hashtbl[i]; vp != NULL; vp = vp->next)
366 <            if (!context[0] || incontext(vp->name))
366 >            if (incontext(vp->name)) {
367                  if (lvl >= 2)
368                      dremove(vp->name);
369                  else
370                      dclear(vp->name);
371 < #ifdef  OUTCHAN
371 >            }
372      if (lvl >= 1) {
373          for (ep = outchan; ep != NULL; ep = ep->sibling)
374              epfree(ep);
375          outchan = NULL;
376      }
341 #endif
377   }
378  
379  
380   EPNODE *
381 < dlookup(name)                   /* look up a definition */
382 < char  *name;
381 > dlookup(                        /* look up a definition */
382 >        char  *name
383 > )
384   {
385 <    register VARDEF  *vp;
385 >    VARDEF  *vp;
386      
387      if ((vp = varlookup(name)) == NULL)
388          return(NULL);
# Line 355 | Line 391 | char  *name;
391  
392  
393   VARDEF *
394 < varlookup(name)                 /* look up a variable */
395 < char  *name;
394 > varlookup(                      /* look up a variable */
395 >        char  *name
396 > )
397   {
398      int  lvl = 0;
399 <    register char  *qname;
400 <    register VARDEF  *vp;
399 >    char  *qname;
400 >    VARDEF  *vp;
401                                  /* find most qualified match */
402      while ((qname = qualname(name, lvl++)) != NULL)
403          for (vp = hashtbl[hash(qname)]; vp != NULL; vp = vp->next)
# Line 371 | Line 408 | char  *name;
408  
409  
410   VARDEF *
411 < varinsert(name)                 /* get a link to a variable */
412 < char  *name;
411 > varinsert(                      /* get a link to a variable */
412 >        char  *name
413 > )
414   {
415 <    register VARDEF  *vp;
415 >    VARDEF  *vp;
416      int  hv;
417      
418      if ((vp = varlookup(name)) != NULL) {
# Line 382 | Line 420 | char  *name;
420          return(vp);
421      }
422      vp = (VARDEF *)emalloc(sizeof(VARDEF));
385 #ifdef  FUNCTION
423      vp->lib = liblookup(name);
387 #else
388    vp->lib = NULL;
389 #endif
424      if (vp->lib == NULL)                /* if name not in library */
425          name = qualname(name, 0);       /* use fully qualified version */
426      hv = hash(name);
# Line 399 | Line 433 | char  *name;
433   }
434  
435  
436 < #ifdef  FUNCTION
437 < libupdate(fn)                   /* update library links */
438 < char  *fn;
436 > void
437 > libupdate(                      /* update library links */
438 >        char  *fn
439 > )
440   {
441 <    register int  i;
442 <    register VARDEF  *vp;
441 >    int  i;
442 >    VARDEF  *vp;
443                                          /* if fn is NULL then relink all */
444      for (i = 0; i < NHASH; i++)
445          for (vp = hashtbl[i]; vp != NULL; vp = vp->next)
446              if (vp->lib != NULL || fn == NULL || !strcmp(fn, vp->name))
447                  vp->lib = liblookup(vp->name);
448   }
414 #endif
449  
450  
451 < varfree(ln)                             /* release link to variable */
452 < register VARDEF  *ln;
451 > void
452 > varfree(                                /* release link to variable */
453 >        VARDEF   *ln
454 > )
455   {
456 <    register VARDEF  *vp;
456 >    VARDEF  *vp;
457      int  hv;
458  
459      if (--ln->nlinks > 0)
# Line 438 | Line 474 | register VARDEF         *ln;
474  
475  
476   EPNODE *
477 < dfirst()                        /* return pointer to first definition */
477 > dfirst(void)                    /* return pointer to first definition */
478   {
479      htndx = 0;
480      htpos = NULL;
445 #ifdef  OUTCHAN
481      ochpos = outchan;
447 #endif
482      return(dnext());
483   }
484  
485  
486   EPNODE *
487 < dnext()                         /* return pointer to next definition */
487 > dnext(void)                             /* return pointer to next definition */
488   {
489 <    register EPNODE  *ep;
490 <    register char  *nm;
489 >    EPNODE  *ep;
490 >    char  *nm;
491  
492      while (htndx < NHASH) {
493          if (htpos == NULL)
# Line 466 | Line 500 | dnext()                                /* return pointer to next definition */
500                  return(ep);
501          }
502      }
469 #ifdef  OUTCHAN
503      if ((ep = ochpos) != NULL)
504          ochpos = ep->sibling;
505      return(ep);
473 #else
474    return(NULL);
475 #endif
506   }
507  
508  
509   EPNODE *
510 < dpop(name)                      /* pop a definition */
511 < char  *name;
510 > dpop(                   /* pop a definition */
511 >        char  *name
512 > )
513   {
514 <    register VARDEF  *vp;
515 <    register EPNODE  *dp;
514 >    VARDEF  *vp;
515 >    EPNODE  *dp;
516      
517      if ((vp = varlookup(name)) == NULL || vp->def == NULL)
518          return(NULL);
# Line 492 | Line 523 | char  *name;
523   }
524  
525  
526 < dpush(nm, ep)                   /* push on a definition */
527 < char  *nm;
528 < register EPNODE  *ep;
526 > void
527 > dpush(                  /* push on a definition */
528 >        char  *nm,
529 >        EPNODE   *ep
530 > )
531   {
532 <    register VARDEF  *vp;
532 >    VARDEF  *vp;
533  
534      vp = varinsert(nm);
535      ep->sibling = vp->def;
# Line 504 | Line 537 | register EPNODE         *ep;
537   }
538  
539  
540 < #ifdef  OUTCHAN
541 < addchan(sp)                     /* add an output channel assignment */
542 < EPNODE  *sp;
540 > void
541 > addchan(                        /* add an output channel assignment */
542 >        EPNODE  *sp
543 > )
544   {
545      int  ch = sp->v.kid->v.chan;
546 <    register EPNODE  *ep, *epl;
546 >    EPNODE  *ep, *epl;
547  
548      for (epl = NULL, ep = outchan; ep != NULL; epl = ep, ep = ep->sibling)
549          if (ep->v.kid->v.chan >= ch) {
# Line 532 | Line 566 | EPNODE *sp;
566      sp->sibling = NULL;
567  
568   }
535 #endif
569  
570  
571 < getstatement()                  /* get next statement */
571 > void
572 > getstatement(void)                      /* get next statement */
573   {
574 <    register EPNODE  *ep;
574 >    EPNODE  *ep;
575      char  *qname;
576 <    register VARDEF  *vdef;
576 >    VARDEF  *vdef;
577  
578      if (nextc == ';') {         /* empty statement */
579          scan();
580          return;
581      }
582 < #ifdef  OUTCHAN
583 <    if (nextc == '$') {         /* channel assignment */
582 >    if (esupport&E_OUTCHAN &&
583 >                nextc == '$') {         /* channel assignment */
584          ep = getchan();
585          addchan(ep);
586 <    } else
553 < #endif
554 <    {                           /* ordinary definition */
586 >    } else {                            /* ordinary definition */
587          ep = getdefn();
588          qname = qualname(dname(ep), 0);
589 < #ifdef  REDEFW
558 <        if ((vdef = varlookup(qname)) != NULL)
589 >        if (esupport&E_REDEFW && (vdef = varlookup(qname)) != NULL) {
590              if (vdef->def != NULL && epcmp(ep, vdef->def)) {
591                  wputs(qname);
592                  if (vdef->def->type == ':')
593                      wputs(": redefined constant expression\n");
594                  else
595                      wputs(": redefined\n");
596 <            }
566 < #ifdef  FUNCTION
567 <            else if (ep->v.kid->type == FUNC && vdef->lib != NULL) {
596 >            } else if (ep->v.kid->type == FUNC && vdef->lib != NULL) {
597                  wputs(qname);
598                  wputs(": definition hides library function\n");
599              }
600 < #endif
572 < #endif
600 >        }
601          if (ep->type == ':')
602              dremove(qname);
603          else
# Line 585 | Line 613 | getstatement()                 /* get next statement */
613  
614  
615   EPNODE *
616 < getdefn()                       /* A -> SYM = E1 */
617 <                                /*      SYM : E1 */
618 <                                /*      FUNC(SYM,..) = E1 */
619 <                                /*      FUNC(SYM,..) : E1 */
616 > getdefn(void)
617 >        /* A -> SYM = E1 */
618 >        /*      SYM : E1 */
619 >        /*      FUNC(SYM,..) = E1 */
620 >        /*      FUNC(SYM,..) : E1 */
621   {
622 <    register EPNODE  *ep1, *ep2;
622 >    EPNODE  *ep1, *ep2;
623  
624      if (!isalpha(nextc) && nextc != CNTXMARK)
625          syntax("illegal variable name");
# Line 599 | Line 628 | getdefn()                      /* A -> SYM = E1 */
628      ep1->type = SYM;
629      ep1->v.name = savestr(getname());
630  
631 < #ifdef  FUNCTION
603 <    if (nextc == '(') {
631 >    if (esupport&E_FUNCTION && nextc == '(') {
632          ep2 = newnode();
633          ep2->type = FUNC;
634          addekid(ep2, ep1);
# Line 608 | Line 636 | getdefn()                      /* A -> SYM = E1 */
636          do {
637              scan();
638              if (!isalpha(nextc))
639 <                syntax("illegal variable name");
639 >                syntax("illegal parameter name");
640              ep2 = newnode();
641              ep2->type = SYM;
642              ep2->v.name = savestr(getname());
643 +            if (strchr(ep2->v.name, CNTXMARK) != NULL)
644 +                syntax("illegal parameter name");
645              addekid(ep1, ep2);
646          } while (nextc == ',');
647          if (nextc != ')')
648              syntax("')' expected");
649          scan();
650          curfunc = ep1;
651 <    } else
622 <        curfunc = NULL;
623 < #endif
651 >    }
652  
653      if (nextc != '=' && nextc != ':')
654          syntax("'=' or ':' expected");
# Line 631 | Line 659 | getdefn()                      /* A -> SYM = E1 */
659      addekid(ep2, ep1);
660      addekid(ep2, getE1());
661  
662 <    if (
635 < #ifdef  FUNCTION
636 <            ep1->type == SYM &&
637 < #endif
638 <            ep1->sibling->type != NUM) {
662 >    if (ep1->type == SYM && ep1->sibling->type != NUM) {
663          ep1 = newnode();
664 <        ep1->type = TICK;
665 <        ep1->v.tick = -1;
664 >        ep1->type = CLKT;
665 >        ep1->v.tick = 0;
666          addekid(ep2, ep1);
667          ep1 = newnode();
668          ep1->type = NUM;
669          addekid(ep2, ep1);
670      }
671 +    curfunc = NULL;
672  
673      return(ep2);
674   }
675  
676  
652 #ifdef  OUTCHAN
677   EPNODE *
678 < getchan()                       /* A -> $N = E1 */
678 > getchan(void)                   /* A -> $N = E1 */
679   {
680 <    register EPNODE  *ep1, *ep2;
680 >    EPNODE  *ep1, *ep2;
681  
682      if (nextc != '$')
683          syntax("missing '$'");
# Line 674 | Line 698 | getchan()                      /* A -> $N = E1 */
698  
699      return(ep2);
700   }
677 #endif
701  
702  
703  
# Line 683 | Line 706 | getchan()                      /* A -> $N = E1 */
706   */
707  
708  
709 < static double
710 < dvalue(name, d)                 /* evaluate a variable */
688 < char  *name;
689 < EPNODE  *d;
709 > static double                   /* evaluate a variable */
710 > dvalue(char *name, EPNODE *d)
711   {
712 <    register EPNODE  *ep1, *ep2;
712 >    EPNODE  *ep1, *ep2;
713      
714      if (d == NULL || d->v.kid->type != SYM) {
715          eputs(name);
# Line 698 | Line 719 | EPNODE *d;
719      ep1 = d->v.kid->sibling;                    /* get expression */
720      if (ep1->type == NUM)
721          return(ep1->v.num);                     /* return if number */
722 +    if (esupport&E_RCONST && d->type == ':') {
723 +        wputs(name);
724 +        wputs(": assigned non-constant value\n");
725 +    }
726      ep2 = ep1->sibling;                         /* check time */
727 <    if (ep2->v.tick < 0 || ep2->v.tick < eclock) {
728 <        ep2->v.tick = d->type == ':' ? 1L<<30 : eclock;
727 >    if (eclock >= MAXCLOCK)
728 >        eclock = 1;                             /* wrap clock counter */
729 >    if (ep2->v.tick < MAXCLOCK &&
730 >                (ep2->v.tick == 0) | (ep2->v.tick != eclock)) {
731 >        ep2->v.tick = d->type == ':' ? MAXCLOCK : eclock;
732          ep2 = ep2->sibling;
733          ep2->v.num = evalue(ep1);               /* needs new value */
734      } else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines