ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/vars.h
Revision: 2.12
Committed: Sat Jun 7 05:09:45 2025 UTC (8 hours, 50 minutes ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 2.11: +1 -3 lines
Log Message:
refactor: Put some declarations into "paths.h" and included in "platform.h"

File Contents

# User Rev Content
1 greg 2.12 /* RCSid $Id: vars.h,v 2.11 2025/02/06 21:45:00 greg Exp $ */
2 greg 2.1 /*
3     * Header for programs that load variable files.
4     */
5 schorsch 2.5 #ifndef _RAD_VARS_H_
6     #define _RAD_VARS_H_
7     #ifdef __cplusplus
8     extern "C" {
9     #endif
10 greg 2.3
11 schorsch 2.7 typedef struct variable_s {
12 greg 2.8 const char *name; /* variable name */
13 greg 2.1 short nick; /* # characters required for nickname */
14     short nass; /* # assignments made */
15     char *value; /* assigned value(s) */
16 schorsch 2.7 void (*fixval)(struct variable_s *); /* assignment checking function */
17 greg 2.1 } VARIABLE; /* a variable-value pair */
18    
19     /**** The following variables should be declared by calling program ****/
20    
21     extern int NVARS; /* total number of variables */
22    
23     extern VARIABLE vv[]; /* variable-value pairs */
24    
25     extern int nowarn; /* global boolean to turn warnings off */
26    
27     /**** The rest is declared in loadvars.c ****/
28    
29     #define UPPER(c) ((c)&~0x20) /* ASCII trick */
30    
31     #define vnam(vc) (vv[vc].name)
32     #define vdef(vc) (vv[vc].nass)
33     #define vval(vc) (vv[vc].value)
34     #define vint(vc) atoi(vval(vc))
35 greg 2.2 #define vflt(vc) atof(vval(vc))
36 greg 2.1 #define vlet(vc) UPPER(vval(vc)[0])
37     #define vscale vlet
38     #define vbool(vc) (vlet(vc)=='T')
39    
40     #define HIGH 'H'
41     #define MEDIUM 'M'
42     #define LOW 'L'
43 greg 2.3
44    
45 greg 2.8 extern void loadvars(const char *rfname);
46     extern int setvariable(const char *ass, VARIABLE *(*mv)(const char*));
47     extern VARIABLE *matchvar(const char *nam);
48 greg 2.3 extern char *nvalue(int vn, int n);
49     extern void checkvalues(void);
50     extern void onevalue(VARIABLE *vp);
51     extern void catvalues(VARIABLE *vp);
52     extern int badmatch(char *tv, char *cv);
53     extern void boolvalue(VARIABLE *vp);
54     extern void qualvalue(VARIABLE *vp);
55 greg 2.10 extern void strvalue(VARIABLE *vp);
56 greg 2.3 extern void intvalue(VARIABLE *vp);
57     extern void fltvalue(VARIABLE *vp);
58 greg 2.11 extern int singlevar(VARIABLE *vp);
59 greg 2.3 extern void printvars(FILE *fp);
60    
61 schorsch 2.5 #ifdef __cplusplus
62     }
63 greg 2.3 #endif
64 schorsch 2.5 #endif /* _RAD_VARS_H_ */