| 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 |
|
* Routines for tracking object modifiers |
| 6 |
+ |
* |
| 7 |
+ |
* External symbols declared in object.h |
| 8 |
|
*/ |
| 9 |
|
|
| 10 |
+ |
#include "copyright.h" |
| 11 |
+ |
|
| 12 |
|
#include "standard.h" |
| 13 |
|
|
| 14 |
|
#include "object.h" |
| 16 |
|
#include "otypes.h" |
| 17 |
|
|
| 18 |
|
|
| 18 |
– |
extern int (*addobjnotify[])(); /* people to notify of new objects */ |
| 19 |
– |
|
| 19 |
|
static struct ohtab { |
| 20 |
|
int hsiz; /* current table size */ |
| 21 |
|
OBJECT *htab; /* table, if allocated */ |
| 30 |
|
{ |
| 31 |
|
register int i, j; |
| 32 |
|
|
| 33 |
< |
for (i = nobjects>>6; i >= 0; i--) { |
| 33 |
> |
for (i = nobjects>>OBJBLKSHFT; i >= 0; i--) { |
| 34 |
|
j = op - objblock[i]; |
| 35 |
< |
if (j >= 0 && j < 077) |
| 36 |
< |
return((i<<6) + j); |
| 35 |
> |
if (j >= 0 && j < OBJBLKSIZ) |
| 36 |
> |
return((i<<OBJBLKSHFT) + j); |
| 37 |
|
} |
| 38 |
|
return(OVOID); |
| 39 |
|
} |
| 47 |
|
register OBJREC *op; |
| 48 |
|
register int i; |
| 49 |
|
|
| 50 |
< |
for (i = obj; i-- > 0; ) { |
| 50 |
> |
i = modifier(mname); /* try hash table first */ |
| 51 |
> |
if (i < obj) |
| 52 |
> |
return(i); |
| 53 |
> |
for (i = obj; i-- > 0; ) { /* need to search */ |
| 54 |
|
op = objptr(i); |
| 55 |
|
if (ismodifier(op->otype) && !strcmp(op->oname, mname)) |
| 56 |
|
return(i); |
| 83 |
|
#endif |
| 84 |
|
|
| 85 |
|
|
| 86 |
+ |
void |
| 87 |
|
insertobject(obj) /* insert new object into our list */ |
| 88 |
|
register OBJECT obj; |
| 89 |
|
{ |
| 104 |
|
} |
| 105 |
|
|
| 106 |
|
|
| 107 |
+ |
void |
| 108 |
+ |
clearobjndx() /* clear object hash tables */ |
| 109 |
+ |
{ |
| 110 |
+ |
if (modtab.htab != NULL) { |
| 111 |
+ |
free((void *)modtab.htab); |
| 112 |
+ |
modtab.htab = NULL; |
| 113 |
+ |
modtab.hsiz = 100; |
| 114 |
+ |
} |
| 115 |
+ |
if (objtab.htab != NULL) { |
| 116 |
+ |
free((void *)objtab.htab); |
| 117 |
+ |
objtab.htab = NULL; |
| 118 |
+ |
objtab.hsiz = 100; |
| 119 |
+ |
} |
| 120 |
+ |
} |
| 121 |
+ |
|
| 122 |
+ |
|
| 123 |
|
static int |
| 124 |
|
nexthsiz(oldsiz) /* return next hash table size */ |
| 125 |
|
int oldsiz; |
| 172 |
|
i = otndx(objptr(oldhtab[ndx])->oname, tab); |
| 173 |
|
tab->htab[i] = oldhtab[ndx]; |
| 174 |
|
} |
| 175 |
< |
free((char *)oldhtab); |
| 175 |
> |
free((void *)oldhtab); |
| 176 |
|
goto tryagain; /* should happen only once! */ |
| 177 |
|
} |