| 1 |
greg |
1.1 |
/* Copyright (c) 1986 Regents of the University of California */
|
| 2 |
|
|
|
| 3 |
|
|
#ifndef lint
|
| 4 |
|
|
static char SCCSid[] = "$SunId$ LBL";
|
| 5 |
|
|
#endif
|
| 6 |
|
|
|
| 7 |
|
|
/*
|
| 8 |
greg |
1.6 |
* Object type lookup and error reporting
|
| 9 |
greg |
1.1 |
*/
|
| 10 |
|
|
|
| 11 |
|
|
#include "standard.h"
|
| 12 |
|
|
|
| 13 |
|
|
#include "object.h"
|
| 14 |
|
|
|
| 15 |
|
|
#include "otypes.h"
|
| 16 |
|
|
|
| 17 |
|
|
|
| 18 |
|
|
int
|
| 19 |
|
|
otype(ofname) /* get object function number from its name */
|
| 20 |
|
|
register char *ofname;
|
| 21 |
|
|
{
|
| 22 |
|
|
register int i;
|
| 23 |
|
|
|
| 24 |
|
|
for (i = 0; i < NUMOTYPE; i++)
|
| 25 |
|
|
if (!strcmp(ofun[i].funame, ofname))
|
| 26 |
|
|
return(i);
|
| 27 |
|
|
|
| 28 |
|
|
return(-1); /* not found */
|
| 29 |
|
|
}
|
| 30 |
|
|
|
| 31 |
|
|
|
| 32 |
|
|
objerror(o, etyp, msg) /* report error related to object */
|
| 33 |
|
|
OBJREC *o;
|
| 34 |
|
|
int etyp;
|
| 35 |
|
|
char *msg;
|
| 36 |
|
|
{
|
| 37 |
|
|
char msgbuf[128];
|
| 38 |
|
|
|
| 39 |
|
|
sprintf(msgbuf, "%s for %s \"%s\"",
|
| 40 |
|
|
msg, ofun[o->otype].funame, o->oname);
|
| 41 |
|
|
error(etyp, msgbuf);
|
| 42 |
|
|
}
|