ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/otypes.c
(Generate patch)

Comparing ray/src/common/otypes.c (file contents):
Revision 1.1 by greg, Thu Feb 2 10:34:38 1989 UTC vs.
Revision 1.5 by greg, Thu Dec 13 10:37:17 1990 UTC

# Line 17 | Line 17 | static char SCCSid[] = "$SunId$ LBL";
17   #include  "otypes.h"
18  
19  
20 < FUN  ofun[NUMOTYPE] = INIT_OTYPE;       /* our object function table */
20 > extern int  (*addobjnotify[])();        /* people to notify of new objects */
21  
22   static struct ohtab {
23          int  hsiz;                      /* current table size */
# Line 66 | Line 66 | char  *mname;
66   insertobject(obj)               /* insert new object into our list */
67   register OBJECT  obj;
68   {
69 <        register int  ndx;
69 >        register int  i;
70  
71   #ifdef  GETOBJ
72 <        ndx = otndx(objptr(obj)->oname, &objtab);
73 <        objtab.htab[ndx] = obj;
72 >        i = otndx(objptr(obj)->oname, &objtab);
73 >        objtab.htab[i] = obj;
74   #endif
75          if (ismodifier(objptr(obj)->otype)) {
76 <                ndx = otndx(objptr(obj)->oname, &modtab);
77 <                modtab.htab[ndx] = obj;
76 >                i = otndx(objptr(obj)->oname, &modtab);
77 >                modtab.htab[i] = obj;
78          }
79 +        for (i = 0; addobjnotify[i] != NULL; i++)
80 +                (*addobjnotify[i])(obj);
81   }
82  
83  
# Line 133 | Line 135 | register struct ohtab  *tab;
135                  tab->hsiz = nexthsiz(tab->hsiz);
136                  tab->htab = (OBJECT *)malloc(tab->hsiz*sizeof(OBJECT));
137                  if (tab->htab == NULL)
138 <                        error(SYSTEM, "out of memory in tputo");
138 >                        error(SYSTEM, "out of memory in otndx");
139                  ndx = tab->hsiz;
140                  while (ndx--)                   /* empty it */
141                          tab->htab[ndx] = OVOID;
142          }
143                                          /* look up object */
144          hval = shash(name);
145 + tryagain:
146          for (i = 0; i < tab->hsiz; i++) {
147                  ndx = (hval + i*i) % tab->hsiz;
148                  if (tab->htab[ndx] == OVOID ||
# Line 156 | Line 159 | register struct ohtab  *tab;
159                          tab->htab[i] = oldhtab[ndx];
160                  }
161          free((char *)oldhtab);
162 <        return(otndx(name, tab));
162 >        goto tryagain;                  /* should happen only once! */
163   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines