annotate cfgparser.h @ 420:980bafac238f

write cvs date+version into version.h
author arpi_esp
date Sat, 14 Apr 2001 22:26:27 +0000
parents 8e55121885b2
children e89233dab4da
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
147
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
1 /*
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
2 * command line and config file parser
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
3 */
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
4
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
5 #ifndef __CONFIG_H
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
6 #define __CONFIG_H
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
7
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
8 #define CONF_TYPE_FLAG 0
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
9 #define CONF_TYPE_INT 1
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
10 #define CONF_TYPE_FLOAT 2
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
11 #define CONF_TYPE_STRING 3
150
2f3e01a1fd87 cfgparse fixes
szabii
parents: 147
diff changeset
12 #define CONF_TYPE_FUNC 4
151
9708d4b2765b cfgparser fix
szabii
parents: 150
diff changeset
13 #define CONF_TYPE_FUNC_PARAM 5
152
372a9a836e86 cfgparser fix
szabii
parents: 151
diff changeset
14 #define CONF_TYPE_PRINT 6
147
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
15
153
8e55121885b2 new configfile/cmdline parser
arpi_esp
parents: 152
diff changeset
16 #define CONF_MIN (1<<0)
8e55121885b2 new configfile/cmdline parser
arpi_esp
parents: 152
diff changeset
17 #define CONF_MAX (1<<1)
8e55121885b2 new configfile/cmdline parser
arpi_esp
parents: 152
diff changeset
18 #define CONF_RANGE (CONF_MIN|CONF_MAX)
151
9708d4b2765b cfgparser fix
szabii
parents: 150
diff changeset
19 #define CONF_NOCFG (1<<2)
9708d4b2765b cfgparser fix
szabii
parents: 150
diff changeset
20 #define CONF_NOCMD (1<<3)
147
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
21
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
22 struct config {
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
23 char *name;
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
24 void *p;
150
2f3e01a1fd87 cfgparse fixes
szabii
parents: 147
diff changeset
25 unsigned int type :3;
151
9708d4b2765b cfgparser fix
szabii
parents: 150
diff changeset
26 unsigned int flags:4;
147
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
27 float min,max;
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
28 };
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
29
150
2f3e01a1fd87 cfgparse fixes
szabii
parents: 147
diff changeset
30 typedef int (*cfg_func_param_t)(struct config *, char *);
2f3e01a1fd87 cfgparse fixes
szabii
parents: 147
diff changeset
31 typedef int (*cfg_func_t)(struct config *);
2f3e01a1fd87 cfgparse fixes
szabii
parents: 147
diff changeset
32
147
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
33 /* parse_config_file returns:
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
34 * -1 on error (can't malloc, invalid option...)
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
35 * 0 if can't open configfile
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
36 * 1 on success
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
37 */
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
38 int parse_config_file(struct config *conf, char *conffile);
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
39
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
40 /* parse_command_line reutrns:
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
41 * -1 on error (invalid option...)
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
42 * 0 if there was no filename on command line
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
43 * 1 if it found a filename
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
44 */
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
45 int parse_command_line(struct config *conf, int argc, char **argv, char **envp, char **filename);
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
46
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
47 #endif /* __CONFIG_H */