Mercurial > mplayer.hg
annotate cfgparser.h @ 3721:66da035c4ee2
some quick updates for the prerelease
author | gabucino |
---|---|
date | Mon, 24 Dec 2001 23:00:07 +0000 |
parents | f61dcc63be5f |
children | 22fadd4022b5 |
rev | line source |
---|---|
147 | 1 /* |
2 * command line and config file parser | |
3 */ | |
4 | |
5 #ifndef __CONFIG_H | |
6 #define __CONFIG_H | |
7 | |
8 #define CONF_TYPE_FLAG 0 | |
9 #define CONF_TYPE_INT 1 | |
10 #define CONF_TYPE_FLOAT 2 | |
11 #define CONF_TYPE_STRING 3 | |
150 | 12 #define CONF_TYPE_FUNC 4 |
151 | 13 #define CONF_TYPE_FUNC_PARAM 5 |
152 | 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 | 16 #define CONF_TYPE_SUBCONFIG 8 |
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 | 25 |
153 | 26 #define CONF_MIN (1<<0) |
27 #define CONF_MAX (1<<1) | |
28 #define CONF_RANGE (CONF_MIN|CONF_MAX) | |
151 | 29 #define CONF_NOCFG (1<<2) |
30 #define CONF_NOCMD (1<<3) | |
147 | 31 |
32 struct config { | |
33 char *name; | |
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 | 37 float min,max; |
38 }; | |
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 | 41 typedef int (*cfg_func_param_t)(struct config *, char *); |
42 typedef int (*cfg_func_t)(struct config *); | |
43 | |
147 | 44 /* parse_config_file returns: |
45 * -1 on error (can't malloc, invalid option...) | |
46 * 0 if can't open configfile | |
47 * 1 on success | |
48 */ | |
49 int parse_config_file(struct config *conf, char *conffile); | |
50 | |
1629 | 51 /* parse_command_line returns: |
147 | 52 * -1 on error (invalid option...) |
53 * 0 if there was no filename on command line | |
1629 | 54 * >=1 if there were filenames |
147 | 55 */ |
1629 | 56 int parse_command_line(struct config *conf, int argc, char **argv, char **envp, char ***filenames); |
147 | 57 |
58 #endif /* __CONFIG_H */ |