annotate cfgparser.h @ 4151:6ad5da34c463

added mp3_printheader for mp3lib init\n
author alex
date Mon, 14 Jan 2002 16:27:55 +0000
parents f61dcc63be5f
children 22fadd4022b5
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
1536
e89233dab4da New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents: 153
diff changeset
15 #define CONF_TYPE_FUNC_FULL 7
2617
b97a9e3fdb63 added subconfig type
alex
parents: 1629
diff changeset
16 #define CONF_TYPE_SUBCONFIG 8
b97a9e3fdb63 added subconfig type
alex
parents: 1629
diff changeset
17
1536
e89233dab4da New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents: 153
diff changeset
18
e89233dab4da New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents: 153
diff changeset
19 #define ERR_NOT_AN_OPTION -1
e89233dab4da New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents: 153
diff changeset
20 #define ERR_MISSING_PARAM -2
e89233dab4da New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents: 153
diff changeset
21 #define ERR_OUT_OF_RANGE -3
e89233dab4da New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents: 153
diff changeset
22 #define ERR_FUNC_ERR -4
e89233dab4da New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents: 153
diff changeset
23
e89233dab4da New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents: 153
diff changeset
24
147
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
25
153
8e55121885b2 new configfile/cmdline parser
arpi_esp
parents: 152
diff changeset
26 #define CONF_MIN (1<<0)
8e55121885b2 new configfile/cmdline parser
arpi_esp
parents: 152
diff changeset
27 #define CONF_MAX (1<<1)
8e55121885b2 new configfile/cmdline parser
arpi_esp
parents: 152
diff changeset
28 #define CONF_RANGE (CONF_MIN|CONF_MAX)
151
9708d4b2765b cfgparser fix
szabii
parents: 150
diff changeset
29 #define CONF_NOCFG (1<<2)
9708d4b2765b cfgparser fix
szabii
parents: 150
diff changeset
30 #define CONF_NOCMD (1<<3)
147
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
31
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
32 struct config {
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
33 char *name;
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
34 void *p;
3559
f61dcc63be5f exchanged return with goto out in subconfig parsing and fixed error messages
alex
parents: 2617
diff changeset
35 unsigned int type;
f61dcc63be5f exchanged return with goto out in subconfig parsing and fixed error messages
alex
parents: 2617
diff changeset
36 unsigned int flags;
147
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
37 float min,max;
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
38 };
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
39
1536
e89233dab4da New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents: 153
diff changeset
40 typedef int (*cfg_func_arg_param_t)(struct config *, char *, char *);
150
2f3e01a1fd87 cfgparse fixes
szabii
parents: 147
diff changeset
41 typedef int (*cfg_func_param_t)(struct config *, char *);
2f3e01a1fd87 cfgparse fixes
szabii
parents: 147
diff changeset
42 typedef int (*cfg_func_t)(struct config *);
2f3e01a1fd87 cfgparse fixes
szabii
parents: 147
diff changeset
43
147
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
44 /* parse_config_file returns:
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
45 * -1 on error (can't malloc, invalid option...)
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
46 * 0 if can't open configfile
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
47 * 1 on success
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
48 */
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
49 int parse_config_file(struct config *conf, char *conffile);
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
50
1629
13aeaa05ac5e multifile support in config parser
arpi
parents: 1536
diff changeset
51 /* parse_command_line returns:
147
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
52 * -1 on error (invalid option...)
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
53 * 0 if there was no filename on command line
1629
13aeaa05ac5e multifile support in config parser
arpi
parents: 1536
diff changeset
54 * >=1 if there were filenames
147
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
55 */
1629
13aeaa05ac5e multifile support in config parser
arpi
parents: 1536
diff changeset
56 int parse_command_line(struct config *conf, int argc, char **argv, char **envp, char ***filenames);
147
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
57
0a0d7dd8fb51 new command line/config file parser
szabii
parents:
diff changeset
58 #endif /* __CONFIG_H */