summaryrefslogtreecommitdiffstats
path: root/cfgparser.h
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-01-14 23:38:49 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-01-14 23:38:49 +0000
commitef4a38a54e18b59df94dccfd9f819281b88ce579 (patch)
treeebbea287364120a0965869b0061bd2a51665c4f3 /cfgparser.h
parentef93c933803c01fa778bb1c6397044d9c592f66d (diff)
downloadmpv-ef4a38a54e18b59df94dccfd9f819281b88ce579.tar.bz2
mpv-ef4a38a54e18b59df94dccfd9f819281b88ce579.tar.xz
playtree-based config patch by Alban Bedel <albeu@free.fr>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4157 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'cfgparser.h')
-rw-r--r--cfgparser.h63
1 files changed, 57 insertions, 6 deletions
diff --git a/cfgparser.h b/cfgparser.h
index 54c924da32..bf4ccb6870 100644
--- a/cfgparser.h
+++ b/cfgparser.h
@@ -28,6 +28,17 @@
#define CONF_RANGE (CONF_MIN|CONF_MAX)
#define CONF_NOCFG (1<<2)
#define CONF_NOCMD (1<<3)
+#define CONF_GLOBAL (1<<4)
+#define CONF_NOSAVE (1<<5)
+
+
+typedef struct config config_t;
+typedef struct m_config m_config_t;
+typedef struct config_save config_save_t;
+
+#include "playtree.h"
+
+typedef void (*cfg_default_func_t)(config_t *, char*);
struct config {
char *name;
@@ -35,24 +46,64 @@ struct config {
unsigned int type;
unsigned int flags;
float min,max;
+ cfg_default_func_t default_func;
+};
+
+
+
+struct m_config {
+ config_t** opt_list;
+ config_save_t** config_stack;
+ int cs_level;
+ int parser_mode; /* COMMAND_LINE or CONFIG_FILE */
+ int global; // Are we parsing global option
+ play_tree_t* pt; // play tree we use for playlist option, etc
+ play_tree_t* last_entry; // last added entry
+ play_tree_t* last_parent; // if last_entry is NULL we must create child of this
+ int recursion_depth;
+};
+
+struct config_save {
+ config_t* opt;
+ union {
+ int as_int;
+ float as_float;
+ void* as_pointer;
+ } param;
+ char* opt_name;
};
-typedef int (*cfg_func_arg_param_t)(struct config *, char *, char *);
-typedef int (*cfg_func_param_t)(struct config *, char *);
-typedef int (*cfg_func_t)(struct config *);
+
+typedef int (*cfg_func_arg_param_t)(config_t *, char *, char *);
+typedef int (*cfg_func_param_t)(config_t *, char *);
+typedef int (*cfg_func_t)(config_t *);
/* parse_config_file returns:
* -1 on error (can't malloc, invalid option...)
* 0 if can't open configfile
* 1 on success
*/
-int parse_config_file(struct config *conf, char *conffile);
+int m_config_parse_config_file(m_config_t *config, char *conffile);
/* parse_command_line returns:
* -1 on error (invalid option...)
* 0 if there was no filename on command line
- * >=1 if there were filenames
+ * 1 if there were filenames
*/
-int parse_command_line(struct config *conf, int argc, char **argv, char **envp, char ***filenames);
+int m_config_parse_command_line(m_config_t* config, int argc, char **argv, char **envp);
+
+
+void m_config_register_options(m_config_t *config,config_t *args);
+
+int m_config_set_option(m_config_t *config,char *opt, char *param);
+
+config_t* m_config_get_option(m_config_t *config, char* arg);
+
+m_config_t* m_config_new(play_tree_t* pt);
+
+void m_config_free(m_config_t* config);
+
+void m_config_push(m_config_t* config);
+int m_config_pop(m_config_t* config);
#endif /* __CONFIG_H */