Back to index

radiance  4R0+20100331
vars.h
Go to the documentation of this file.
00001 /* RCSid $Id: vars.h,v 2.7 2003/07/30 10:11:06 schorsch Exp $ */
00002 /*
00003  *  Header for programs that load variable files.
00004  */
00005 #ifndef _RAD_VARS_H_
00006 #define _RAD_VARS_H_
00007 #ifdef __cplusplus
00008 extern "C" {
00009 #endif
00010 
00011 typedef struct variable_s {
00012        char   *name;        /* variable name */
00013        short  nick;         /* # characters required for nickname */
00014        short  nass;         /* # assignments made */
00015        char   *value;              /* assigned value(s) */
00016        void   (*fixval)(struct variable_s *);    /* assignment checking function */
00017 } VARIABLE;          /* a variable-value pair */
00018 
00019 /**** The following variables should be declared by calling program ****/
00020 
00021 extern int    NVARS;        /* total number of variables */
00022 
00023 extern VARIABLE      vv[];         /* variable-value pairs */
00024 
00025 extern char   *progname;    /* global argv[0] from main */
00026 
00027 extern int    nowarn;              /* global boolean to turn warnings off */
00028 
00029 /**** The rest is declared in loadvars.c ****/
00030 
00031 extern VARIABLE      *matchvar();
00032 extern char   *nvalue();
00033 
00034 #define UPPER(c)     ((c)&~0x20)   /* ASCII trick */
00035 
00036 #define vnam(vc)     (vv[vc].name)
00037 #define vdef(vc)     (vv[vc].nass)
00038 #define vval(vc)     (vv[vc].value)
00039 #define vint(vc)     atoi(vval(vc))
00040 #define vflt(vc)     atof(vval(vc))
00041 #define vlet(vc)     UPPER(vval(vc)[0])
00042 #define vscale              vlet
00043 #define vbool(vc)    (vlet(vc)=='T')
00044 
00045 #define HIGH         'H'
00046 #define MEDIUM              'M'
00047 #define LOW          'L'
00048 
00049 
00050 extern void   loadvars(char *rfname);
00051 extern int    setvariable(char *ass, VARIABLE *(*mv)(char*));
00052 extern VARIABLE      *matchvar(char *nam);
00053 extern char   *nvalue(int vn, int n);
00054 extern void   checkvalues(void);
00055 extern void   onevalue(VARIABLE *vp);
00056 extern void   catvalues(VARIABLE *vp);
00057 extern int    badmatch(char *tv, char *cv);
00058 extern void   boolvalue(VARIABLE *vp);
00059 extern void   qualvalue(VARIABLE *vp);
00060 extern void   intvalue(VARIABLE *vp);
00061 extern void   fltvalue(VARIABLE *vp);
00062 extern void   printvars(FILE *fp);
00063 
00064 
00065 #ifdef __cplusplus
00066 }
00067 #endif
00068 #endif /* _RAD_VARS_H_ */
00069