ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/vars.h
Revision: 2.9
Committed: Fri Jun 9 22:52:47 2023 UTC (16 months, 3 weeks ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.8: +1 -4 lines
Log Message:
fix: Preserve spaces in quoted strings

File Contents

# Content
1 /* RCSid $Id: vars.h,v 2.8 2023/06/05 16:09:55 greg Exp $ */
2 /*
3 * Header for programs that load variable files.
4 */
5 #ifndef _RAD_VARS_H_
6 #define _RAD_VARS_H_
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 typedef struct variable_s {
12 const char *name; /* variable name */
13 short nick; /* # characters required for nickname */
14 short nass; /* # assignments made */
15 char *value; /* assigned value(s) */
16 void (*fixval)(struct variable_s *); /* assignment checking function */
17 } 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 char *progname; /* global argv[0] from main */
26
27 extern int nowarn; /* global boolean to turn warnings off */
28
29 /**** The rest is declared in loadvars.c ****/
30
31 #define UPPER(c) ((c)&~0x20) /* ASCII trick */
32
33 #define vnam(vc) (vv[vc].name)
34 #define vdef(vc) (vv[vc].nass)
35 #define vval(vc) (vv[vc].value)
36 #define vint(vc) atoi(vval(vc))
37 #define vflt(vc) atof(vval(vc))
38 #define vlet(vc) UPPER(vval(vc)[0])
39 #define vscale vlet
40 #define vbool(vc) (vlet(vc)=='T')
41
42 #define HIGH 'H'
43 #define MEDIUM 'M'
44 #define LOW 'L'
45
46
47 extern void loadvars(const char *rfname);
48 extern int setvariable(const char *ass, VARIABLE *(*mv)(const char*));
49 extern VARIABLE *matchvar(const char *nam);
50 extern char *nvalue(int vn, int n);
51 extern void checkvalues(void);
52 extern void onevalue(VARIABLE *vp);
53 extern void catvalues(VARIABLE *vp);
54 extern int badmatch(char *tv, char *cv);
55 extern void boolvalue(VARIABLE *vp);
56 extern void qualvalue(VARIABLE *vp);
57 extern void intvalue(VARIABLE *vp);
58 extern void fltvalue(VARIABLE *vp);
59 extern void printvars(FILE *fp);
60
61 #ifdef __cplusplus
62 }
63 #endif
64 #endif /* _RAD_VARS_H_ */