Back to index

radiance  4R0+20100331
otypes.c
Go to the documentation of this file.
00001 #ifndef lint
00002 static const char RCSid[] = "$Id: otypes.c,v 2.4 2003/03/10 17:13:29 greg Exp $";
00003 #endif
00004 /*
00005  * Object type lookup and error reporting
00006  *
00007  *  External symbols declared in object.h
00008  */
00009 
00010 #include "copyright.h"
00011 
00012 #include  "standard.h"
00013 
00014 #include  "object.h"
00015 
00016 #include  "otypes.h"
00017 
00018 
00019 int
00020 otype(ofname)               /* get object function number from its name */
00021 register char  *ofname;
00022 {
00023        register int  i;
00024 
00025        for (i = 0; i < NUMOTYPE; i++)
00026               if (!strcmp(ofun[i].funame, ofname))
00027                      return(i);
00028 
00029        return(-1);          /* not found */
00030 }
00031 
00032 
00033 void
00034 objerror(o, etyp, msg)             /* report error related to object */
00035 OBJREC  *o;
00036 int  etyp;
00037 char  *msg;
00038 {
00039        char  msgbuf[128];
00040 
00041        sprintf(msgbuf, "%s for %s \"%s\"",
00042                      msg, ofun[o->otype].funame,
00043                      o->oname!=NULL ? o->oname : "(NULL)");
00044        error(etyp, msgbuf);
00045 }