| 1 |
schorsch |
2.7 |
/* RCSid $Id: vars.h,v 2.6 2003/06/27 06:53:22 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.1 |
char *name; /* variable name */ |
| 13 |
|
|
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 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 |
|
|
extern VARIABLE *matchvar(); |
| 32 |
|
|
extern char *nvalue(); |
| 33 |
|
|
|
| 34 |
|
|
#define UPPER(c) ((c)&~0x20) /* ASCII trick */ |
| 35 |
|
|
|
| 36 |
|
|
#define vnam(vc) (vv[vc].name) |
| 37 |
|
|
#define vdef(vc) (vv[vc].nass) |
| 38 |
|
|
#define vval(vc) (vv[vc].value) |
| 39 |
|
|
#define vint(vc) atoi(vval(vc)) |
| 40 |
greg |
2.2 |
#define vflt(vc) atof(vval(vc)) |
| 41 |
greg |
2.1 |
#define vlet(vc) UPPER(vval(vc)[0]) |
| 42 |
|
|
#define vscale vlet |
| 43 |
|
|
#define vbool(vc) (vlet(vc)=='T') |
| 44 |
|
|
|
| 45 |
|
|
#define HIGH 'H' |
| 46 |
|
|
#define MEDIUM 'M' |
| 47 |
|
|
#define LOW 'L' |
| 48 |
greg |
2.3 |
|
| 49 |
|
|
|
| 50 |
|
|
extern void loadvars(char *rfname); |
| 51 |
schorsch |
2.7 |
extern int setvariable(char *ass, VARIABLE *(*mv)(char*)); |
| 52 |
greg |
2.3 |
extern VARIABLE *matchvar(char *nam); |
| 53 |
|
|
extern char *nvalue(int vn, int n); |
| 54 |
|
|
extern void checkvalues(void); |
| 55 |
|
|
extern void onevalue(VARIABLE *vp); |
| 56 |
|
|
extern void catvalues(VARIABLE *vp); |
| 57 |
|
|
extern int badmatch(char *tv, char *cv); |
| 58 |
|
|
extern void boolvalue(VARIABLE *vp); |
| 59 |
|
|
extern void qualvalue(VARIABLE *vp); |
| 60 |
|
|
extern void intvalue(VARIABLE *vp); |
| 61 |
|
|
extern void fltvalue(VARIABLE *vp); |
| 62 |
|
|
extern void printvars(FILE *fp); |
| 63 |
|
|
|
| 64 |
schorsch |
2.5 |
|
| 65 |
|
|
#ifdef __cplusplus |
| 66 |
|
|
} |
| 67 |
greg |
2.3 |
#endif |
| 68 |
schorsch |
2.5 |
#endif /* _RAD_VARS_H_ */ |
| 69 |
|
|
|