Back to index

radiance  4R0+20100331
object.h
Go to the documentation of this file.
00001 /* RCSid $Id: object.h,v 2.18 2005/09/23 19:04:52 greg Exp $ */
00002 /*
00003  *  object.h - header file for routines using objects and object sets.
00004  *
00005  *  Include after "standard.h"
00006  */
00007 #ifndef _RAD_OBJECT_H_
00008 #define _RAD_OBJECT_H_
00009 #ifdef __cplusplus
00010 extern "C" {
00011 #endif
00012 
00013 #ifndef  OCTREE
00014 #define  OCTREE             int
00015 #endif
00016 
00017 /*
00018  *     Object definitions require general specifications
00019  *     which may include a number of different argument types.
00020  *     The following structure aids in the storage of such
00021  *     argument lists.
00022  */
00023 
00024 typedef struct {
00025        char  **sarg;               /* string arguments */
00026        RREAL  *farg;               /* real arguments */
00027        short  nsargs;                     /* # of string arguments */
00028        short  nfargs;                     /* # of real arguments */
00029 #ifdef  IARGS
00030        short  niargs;                     /* # of integer arguments */
00031        long  *iarg;                /* integer arguments */
00032 #endif
00033 }  FUNARGS;
00034 
00035 #define  MAXSTR             128           /* maximum string length */
00036 
00037 /*
00038  *     An object is defined as an index into an array of
00039  *     structures containing the object type and specification
00040  *     and the modifier index.
00041  */
00042 
00043 #ifndef  OBJECT
00044 #ifdef  SMLMEM
00045 #define  OBJECT             int16         /* index to object array */
00046 #else
00047 #define  OBJECT             int32         /* index to object array */
00048 #endif
00049 #endif
00050 
00051 typedef struct {
00052        OBJECT  omod;               /* modifier number */
00053        short  otype;               /* object type number */
00054        char  *oname;               /* object name */
00055        FUNARGS  oargs;                    /* object specification */
00056        char  *os;                  /* object structure */
00057 }  OBJREC;
00058 
00059 #ifndef  MAXOBJBLK
00060 #ifdef  SMLMEM
00061 #define  MAXOBJBLK   63            /* maximum number of object blocks */
00062 #else
00063 #define  MAXOBJBLK   65535         /* maximum number of object blocks */
00064 #endif
00065 #endif
00066 
00067 extern OBJREC  *objblock[MAXOBJBLK];      /* the object blocks */
00068 extern OBJECT  nobjects;           /* # of objects */
00069 
00070 #define  OBJBLKSHFT  9
00071 #define  OBJBLKSIZ   (1<<OBJBLKSHFT)      /* object block size */
00072 #define  objptr(obj) (objblock[(obj)>>OBJBLKSHFT]+((obj)&(OBJBLKSIZ-1)))
00073 
00074 #define  OVOID              (-1)          /* void object */
00075 #define  VOIDID             "void"        /* void identifier */
00076 
00077 /*
00078  *     Object sets begin with the number of objects and proceed with
00079  *  the objects in ascending order.
00080  */
00081 
00082 #define  MAXSET             511           /* maximum object set size */
00083 
00084 #define setfree(os)  free((void *)(os))
00085 
00086 extern void  (*addobjnotify[])();        /* people to notify of new objects */
00087 
00088                                    /* defined in modobject.c */
00089 extern OBJECT objndx(OBJREC *op);
00090 extern OBJECT lastmod(OBJECT obj, char *mname);
00091 extern OBJECT modifier(char *name);
00092 extern OBJECT object(char *oname);
00093 extern void   insertobject(OBJECT obj);
00094 extern void   clearobjndx(void);
00095                                    /* defined in objset.c */
00096 extern void   insertelem(OBJECT *os, OBJECT obj);
00097 extern void   deletelem(OBJECT *os, OBJECT obj);
00098 extern int    inset(OBJECT *os, OBJECT obj);
00099 extern int    setequal(OBJECT *os1, OBJECT *os2);
00100 extern void   setcopy(OBJECT *os1, OBJECT *os2);
00101 extern OBJECT *      setsave(OBJECT *os);
00102 extern void   setunion(OBJECT *osr, OBJECT *os1, OBJECT *os2);
00103 extern void   setintersect(OBJECT *osr, OBJECT *os1, OBJECT *os2);
00104 extern OCTREE fullnode(OBJECT *oset);
00105 extern void   objset(OBJECT *oset, OCTREE ot);
00106 extern int    dosets(int (*f)());
00107 extern void   donesets(void);
00108 
00109                                    /* defined in otypes.c */
00110 extern int    otype(char *ofname);
00111 extern void   objerror(OBJREC *o, int etyp, char *msg);
00112                                    /* defined in readfargs.c */
00113 extern int    readfargs(FUNARGS *fa, FILE *fp);
00114 extern void   freefargs(FUNARGS *fa);
00115                                    /* defined in readobj.c */
00116 extern void   readobj(char *inpspec);
00117 extern void   getobject(char *name, FILE *fp);
00118 extern OBJECT newobject(void);
00119 extern void   freeobjects(int firstobj, int nobjs);
00120                                    /* defined in free_os.c */
00121 extern int    free_os(OBJREC *op);
00122 
00123 
00124 #ifdef __cplusplus
00125 }
00126 #endif
00127 #endif /* _RAD_OBJECT_H_ */
00128