Back to index

radiance  4R0+20100331
trans.h
Go to the documentation of this file.
00001 /* RCSid: $Id: trans.h,v 2.4 2003/11/15 17:54:06 schorsch Exp $ */
00002 /*
00003  * Translator definitions
00004  *
00005  *     Greg Ward
00006  */
00007 #ifndef _RAD_TRANS_H_
00008 #define _RAD_TRANS_H_
00009 #ifdef __cplusplus
00010 extern "C" {
00011 #endif
00012 
00013 
00014 #define MAXSTR              128    /* maximum input string length */
00015 
00016 #define VOIDID              "void" /* null modifier */
00017 
00018                             /* qualifier list */
00019 typedef struct {
00020        int    nquals;                     /* number of qualifiers */
00021        char   **qual;                     /* qualifier array */
00022 } QLIST;
00023                             /* identifier */
00024 typedef struct {
00025        char   *name;               /* string, NULL if number */
00026        int    number;
00027 } ID;
00028                             /* identifier list */
00029 typedef struct {
00030        int    nids;                /* number of ids */
00031        ID     *id;                 /* id array */
00032 } IDLIST;
00033                             /* identifier range */
00034 typedef struct {
00035        char   *nam;                /* string, NULL if range */
00036        int    min, max;            /* accepted range */
00037 } IDMATCH;
00038                             /* mapping rule */
00039 typedef struct rule {
00040        char   *mnam;               /* material name */
00041        long   qflg;                /* qualifier condition flags */
00042        struct rule   *next;        /* next rule in mapping */
00043        /* followed by the IDMATCH array */
00044 } RULEHD;
00045                             /* useful macros */
00046 #define doneid(idp)  if ((idp)->name != NULL) freestr((idp)->name)
00047 #define FL(qn)              (1L<<(qn))
00048 #define rulsiz(nq)   (sizeof(RULEHD)+(nq)*sizeof(IDMATCH))
00049 #define idm(rp)             ((IDMATCH *)((rp)+1))
00050 
00051 
00052        /* defined in common/savestr.c - XXX one of several declarations */
00053 char   *savestr(char *str);
00054        /* defined in trans.c */
00055 RULEHD *getmapping(char *file, QLIST *qlp);
00056 
00057 extern int fgetid(ID *idp, char *dls, FILE *fp);
00058 extern int findid(IDLIST *idl, ID *idp, int insert);
00059 extern int matchid(ID *it, IDMATCH *im);
00060 extern void write_quals(QLIST *qlp, IDLIST idl[], FILE *fp);
00061 
00062 
00063 #ifdef __cplusplus
00064 }
00065 #endif
00066 #endif /* _RAD_TRANS_H_ */
00067