1 |
greg |
1.1 |
#ifndef lint |
2 |
greg |
2.5 |
static const char RCSid[] = "$Id: otypes.c,v 2.4 2003/03/10 17:13:29 greg Exp $"; |
3 |
greg |
1.1 |
#endif |
4 |
|
|
/* |
5 |
greg |
1.6 |
* Object type lookup and error reporting |
6 |
greg |
2.2 |
* |
7 |
|
|
* External symbols declared in object.h |
8 |
|
|
*/ |
9 |
|
|
|
10 |
greg |
2.3 |
#include "copyright.h" |
11 |
greg |
1.1 |
|
12 |
|
|
#include "standard.h" |
13 |
|
|
|
14 |
|
|
#include "object.h" |
15 |
|
|
|
16 |
|
|
#include "otypes.h" |
17 |
|
|
|
18 |
|
|
|
19 |
|
|
int |
20 |
|
|
otype(ofname) /* get object function number from its name */ |
21 |
|
|
register char *ofname; |
22 |
|
|
{ |
23 |
|
|
register int i; |
24 |
|
|
|
25 |
|
|
for (i = 0; i < NUMOTYPE; i++) |
26 |
|
|
if (!strcmp(ofun[i].funame, ofname)) |
27 |
|
|
return(i); |
28 |
|
|
|
29 |
|
|
return(-1); /* not found */ |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
|
33 |
greg |
2.2 |
void |
34 |
greg |
1.1 |
objerror(o, etyp, msg) /* report error related to object */ |
35 |
|
|
OBJREC *o; |
36 |
|
|
int etyp; |
37 |
|
|
char *msg; |
38 |
|
|
{ |
39 |
greg |
2.5 |
char msgbuf[512]; |
40 |
greg |
1.1 |
|
41 |
|
|
sprintf(msgbuf, "%s for %s \"%s\"", |
42 |
greg |
2.4 |
msg, ofun[o->otype].funame, |
43 |
|
|
o->oname!=NULL ? o->oname : "(NULL)"); |
44 |
greg |
1.1 |
error(etyp, msgbuf); |
45 |
|
|
} |