Mercurial > mplayer.hg
annotate cfgparser.h @ 2425:2280c8410f6b
fixed --disable-win32 bug
cleanups
author | pl |
---|---|
date | Tue, 23 Oct 2001 14:56:58 +0000 |
parents | 13aeaa05ac5e |
children | b97a9e3fdb63 |
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 |
e89233dab4da
New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents:
153
diff
changeset
|
16 |
e89233dab4da
New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents:
153
diff
changeset
|
17 |
e89233dab4da
New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents:
153
diff
changeset
|
18 #define ERR_NOT_AN_OPTION -1 |
e89233dab4da
New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents:
153
diff
changeset
|
19 #define ERR_MISSING_PARAM -2 |
e89233dab4da
New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents:
153
diff
changeset
|
20 #define ERR_OUT_OF_RANGE -3 |
e89233dab4da
New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents:
153
diff
changeset
|
21 #define ERR_FUNC_ERR -4 |
e89233dab4da
New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents:
153
diff
changeset
|
22 |
e89233dab4da
New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents:
153
diff
changeset
|
23 |
147 | 24 |
153 | 25 #define CONF_MIN (1<<0) |
26 #define CONF_MAX (1<<1) | |
27 #define CONF_RANGE (CONF_MIN|CONF_MAX) | |
151 | 28 #define CONF_NOCFG (1<<2) |
29 #define CONF_NOCMD (1<<3) | |
147 | 30 |
31 struct config { | |
32 char *name; | |
33 void *p; | |
150 | 34 unsigned int type :3; |
151 | 35 unsigned int flags:4; |
147 | 36 float min,max; |
37 }; | |
38 | |
1536
e89233dab4da
New feature for option processing: CONF_TYPE_FUNC_FULL
folke
parents:
153
diff
changeset
|
39 typedef int (*cfg_func_arg_param_t)(struct config *, char *, char *); |
150 | 40 typedef int (*cfg_func_param_t)(struct config *, char *); |
41 typedef int (*cfg_func_t)(struct config *); | |
42 | |
147 | 43 /* parse_config_file returns: |
44 * -1 on error (can't malloc, invalid option...) | |
45 * 0 if can't open configfile | |
46 * 1 on success | |
47 */ | |
48 int parse_config_file(struct config *conf, char *conffile); | |
49 | |
1629 | 50 /* parse_command_line returns: |
147 | 51 * -1 on error (invalid option...) |
52 * 0 if there was no filename on command line | |
1629 | 53 * >=1 if there were filenames |
147 | 54 */ |
1629 | 55 int parse_command_line(struct config *conf, int argc, char **argv, char **envp, char ***filenames); |
147 | 56 |
57 #endif /* __CONFIG_H */ |