ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/otypes.c
Revision: 2.6
Committed: Sat Mar 9 19:20:31 2013 UTC (11 years, 1 month ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad4R2P2, rad5R0, rad5R1, rad4R2, rad4R2P1, rad5R3, HEAD
Changes since 2.5: +12 -9 lines
Log Message:
Minor efficiency improvement and ANSIfication

File Contents

# User Rev Content
1 greg 1.1 #ifndef lint
2 greg 2.6 static const char RCSid[] = "$Id: otypes.c,v 2.5 2011/02/18 18:47:56 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 greg 2.6 otype( /* get object function number from its name */
21     char *ofname
22     )
23 greg 1.1 {
24 greg 2.6 int i;
25 greg 1.1
26     for (i = 0; i < NUMOTYPE; i++)
27 greg 2.6 if (ofun[i].funame[0] == ofname[0] &&
28     !strcmp(ofun[i].funame, ofname))
29 greg 1.1 return(i);
30    
31     return(-1); /* not found */
32     }
33    
34    
35 greg 2.2 void
36 greg 2.6 objerror( /* report error related to object */
37     OBJREC *o,
38     int etyp,
39     char *msg
40     )
41 greg 1.1 {
42 greg 2.5 char msgbuf[512];
43 greg 1.1
44     sprintf(msgbuf, "%s for %s \"%s\"",
45 greg 2.4 msg, ofun[o->otype].funame,
46     o->oname!=NULL ? o->oname : "(NULL)");
47 greg 1.1 error(etyp, msgbuf);
48     }