--- ray/src/common/modobject.c 1996/02/12 17:14:59 2.3 +++ ray/src/common/modobject.c 2003/02/25 02:47:21 2.8 @@ -1,13 +1,14 @@ -/* Copyright (c) 1992 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: modobject.c,v 2.8 2003/02/25 02:47:21 greg Exp $"; #endif - /* * Routines for tracking object modifiers + * + * External symbols declared in object.h */ +#include "copyright.h" + #include "standard.h" #include "object.h" @@ -15,8 +16,6 @@ static char SCCSid[] = "$SunId$ LBL"; #include "otypes.h" -extern int (*addobjnotify[])(); /* people to notify of new objects */ - static struct ohtab { int hsiz; /* current table size */ OBJECT *htab; /* table, if allocated */ @@ -31,10 +30,10 @@ register OBJREC *op; { register int i, j; - for (i = nobjects>>6; i >= 0; i--) { + for (i = nobjects>>OBJBLKSHFT; i >= 0; i--) { j = op - objblock[i]; - if (j >= 0 && j < 077) - return((i<<6) + j); + if (j >= 0 && j < OBJBLKSIZ) + return((i< 0; ) { + i = modifier(mname); /* try hash table first */ + if (i < obj) + return(i); + for (i = obj; i-- > 0; ) { /* need to search */ op = objptr(i); if (ismodifier(op->otype) && !strcmp(op->oname, mname)) return(i); @@ -81,6 +83,7 @@ char *oname; #endif +void insertobject(obj) /* insert new object into our list */ register OBJECT obj; { @@ -101,6 +104,22 @@ register OBJECT obj; } +void +clearobjndx() /* clear object hash tables */ +{ + if (modtab.htab != NULL) { + free((void *)modtab.htab); + modtab.htab = NULL; + modtab.hsiz = 100; + } + if (objtab.htab != NULL) { + free((void *)objtab.htab); + objtab.htab = NULL; + objtab.hsiz = 100; + } +} + + static int nexthsiz(oldsiz) /* return next hash table size */ int oldsiz; @@ -153,6 +172,6 @@ tryagain: i = otndx(objptr(oldhtab[ndx])->oname, tab); tab->htab[i] = oldhtab[ndx]; } - free((char *)oldhtab); + free((void *)oldhtab); goto tryagain; /* should happen only once! */ }