| 1 |
|
#ifndef lint |
| 2 |
< |
static const char RCSid[] = "$Id$"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 4 |
|
/* |
| 5 |
|
* Routines for tracking object modifiers |
| 21 |
|
OBJECT *htab; /* table, if allocated */ |
| 22 |
|
} modtab = {100, NULL}, objtab = {1000, NULL}; /* modifiers and objects */ |
| 23 |
|
|
| 24 |
< |
static int otndx(); |
| 24 |
> |
static int otndx(char *, struct ohtab *); |
| 25 |
|
|
| 26 |
|
|
| 27 |
< |
int |
| 27 |
> |
OBJECT |
| 28 |
|
objndx(op) /* get object number from pointer */ |
| 29 |
|
register OBJREC *op; |
| 30 |
|
{ |
| 32 |
|
|
| 33 |
|
for (i = nobjects>>OBJBLKSHFT; i >= 0; i--) { |
| 34 |
|
j = op - objblock[i]; |
| 35 |
< |
if (j >= 0 && j < OBJBLKSIZ) |
| 35 |
> |
if ((j >= 0) & (j < OBJBLKSIZ)) |
| 36 |
|
return((i<<OBJBLKSHFT) + j); |
| 37 |
|
} |
| 38 |
|
return(OVOID); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
|
| 42 |
< |
int |
| 42 |
> |
OBJECT |
| 43 |
|
lastmod(obj, mname) /* find modifier definition before obj */ |
| 44 |
|
OBJECT obj; |
| 45 |
|
char *mname; |
| 48 |
|
register int i; |
| 49 |
|
|
| 50 |
|
i = modifier(mname); /* try hash table first */ |
| 51 |
< |
if (i < obj) |
| 51 |
> |
if ((obj == OVOID) | (i < obj)) |
| 52 |
|
return(i); |
| 53 |
|
for (i = obj; i-- > 0; ) { /* need to search */ |
| 54 |
|
op = objptr(i); |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
|
| 62 |
< |
int |
| 62 |
> |
OBJECT |
| 63 |
|
modifier(mname) /* get a modifier number from its name */ |
| 64 |
|
char *mname; |
| 65 |
|
{ |
| 71 |
|
|
| 72 |
|
|
| 73 |
|
#ifdef GETOBJ |
| 74 |
< |
int |
| 74 |
> |
OBJECT |
| 75 |
|
object(oname) /* get an object number from its name */ |
| 76 |
|
char *oname; |
| 77 |
|
{ |
| 158 |
|
hval = shash(name); |
| 159 |
|
tryagain: |
| 160 |
|
for (i = 0; i < tab->hsiz; i++) { |
| 161 |
< |
ndx = (hval + i*i) % tab->hsiz; |
| 161 |
> |
ndx = (hval + (unsigned long)i*i) % tab->hsiz; |
| 162 |
|
if (tab->htab[ndx] == OVOID || |
| 163 |
|
!strcmp(objptr(tab->htab[ndx])->oname, name)) |
| 164 |
|
return(ndx); |