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.19 by greg, Wed Aug 14 15:50:38 1991 UTC vs.
Revision 2.3 by greg, Mon Aug 10 16:20:43 1992 UTC

# Line 38 | Line 38 | static char SCCSid[] = "$SunId$ LBL";
38  
39   extern char  *ecalloc(), *savestr(), *strcpy();
40  
41 + static int  hash();
42 +
43   static double  dvalue();
44  
45   long  eclock = -1;                      /* value storage timer */
# Line 333 | Line 335 | varinsert(name)                        /* get a link to a variable */
335   char  *name;
336   {
337      register VARDEF  *vp;
336    LIBR  *libp;
338      int  hv;
339      
340      if ((vp = varlookup(name)) != NULL) {
341          vp->nlinks++;
342          return(vp);
343      }
344 +    vp = (VARDEF *)emalloc(sizeof(VARDEF));
345   #ifdef  FUNCTION
346 <    libp = liblookup(name);
346 >    vp->lib = liblookup(name);
347   #else
348 <    libp = NULL;
348 >    vp->lib = NULL;
349   #endif
350 <    if (libp == NULL)                   /* if name not in library */
350 >    if (vp->lib == NULL)                /* if name not in library */
351          name = qualname(name, 0);       /* use fully qualified version */
352      hv = hash(name);
351    vp = (VARDEF *)emalloc(sizeof(VARDEF));
353      vp->name = savestr(name);
354      vp->nlinks = 1;
355      vp->def = NULL;
355    vp->lib = libp;
356      vp->next = hashtbl[hv];
357      hashtbl[hv] = vp;
358      return(vp);
359   }
360 +
361 +
362 + #ifdef  FUNCTION
363 + libupdate(fn)                   /* update library links */
364 + char  *fn;
365 + {
366 +    register int  i;
367 +    register VARDEF  *vp;
368 +                                        /* if fn is NULL then relink all */
369 +    for (i = 0; i < NHASH; i++)
370 +        for (vp = hashtbl[i]; vp != NULL; vp = vp->next)
371 +            if (vp->lib != NULL || fn == NULL || !strcmp(fn, vp->name))
372 +                vp->lib = liblookup(vp->name);
373 + }
374 + #endif
375  
376  
377   varfree(ln)                             /* release link to variable */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines