Mercurial > mplayer.hg
annotate m_config.h @ 9997:4dd10c6295b1
sync
author | nicolas |
---|---|
date | Sat, 26 Apr 2003 21:56:45 +0000 |
parents | 39444d65c4cb |
children | d46910228a6b |
rev | line source |
---|---|
8164 | 1 |
2 #ifndef NEW_CONFIG | |
3 #warning "Including m_config.h but NEW_CONFIG is disabled" | |
4 #else | |
5 | |
6 typedef struct m_config_option m_config_option_t; | |
7 typedef struct m_config_save_slot m_config_save_slot_t; | |
8 struct m_option; | |
9 struct m_option_type; | |
10 | |
11 struct m_config_save_slot { | |
12 m_config_save_slot_t* prev; | |
13 int lvl; | |
14 unsigned char data[0]; | |
15 }; | |
16 | |
17 struct m_config_option { | |
18 m_config_option_t* next; | |
19 char* name; // Full name (ie option:subopt) | |
20 struct m_option* opt; | |
21 m_config_save_slot_t* slots; | |
22 unsigned int flags; // currently it only tell if the option was set | |
23 }; | |
24 | |
25 typedef struct m_config { | |
26 m_config_option_t* opts; | |
27 int lvl; // Current stack level | |
28 int mode; | |
29 } m_config_t; | |
30 | |
9912
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
8168
diff
changeset
|
31 #define M_CFG_OPT_SET (1<<0) |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
8168
diff
changeset
|
32 #define M_CFG_OPT_ALIAS (1<<1) |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
8168
diff
changeset
|
33 |
8164 | 34 |
35 //////////////////////////// Functions /////////////////////////////////// | |
36 | |
37 m_config_t* | |
38 m_config_new(void); | |
39 | |
40 void | |
41 m_config_free(m_config_t* config); | |
42 | |
43 void | |
44 m_config_push(m_config_t* config); | |
45 | |
46 void | |
47 m_config_pop(m_config_t* config); | |
48 | |
49 int | |
50 m_config_register_options(m_config_t *config, struct m_option *args); | |
51 | |
52 int | |
53 m_config_set_option(m_config_t *config, char* arg, char* param); | |
54 | |
55 int | |
56 m_config_check_option(m_config_t *config, char* arg, char* param); | |
57 | |
58 struct m_option* | |
59 m_config_get_option(m_config_t *config, char* arg); | |
60 | |
8168 | 61 void |
62 m_config_print_option_list(m_config_t *config); | |
63 | |
8164 | 64 ///////////////////////////////////////////////////////////////////////////////////// |
65 /////////////////////////// Backward compat. stuff //////////////////////////////// | |
66 //////////////////////////////////////////////////////////////////////////////////// | |
67 | |
68 typedef struct config config_t; | |
69 struct config { | |
70 char *name; | |
71 void *p; | |
72 struct m_option_type* type; | |
73 unsigned int flags; | |
74 float min,max; | |
75 void* priv; | |
76 }; | |
77 | |
78 | |
79 #define CONF_MIN (1<<0) | |
80 #define CONF_MAX (1<<1) | |
81 #define CONF_RANGE (CONF_MIN|CONF_MAX) | |
82 #define CONF_NOCFG (1<<2) | |
83 #define CONF_NOCMD (1<<3) | |
84 #define CONF_GLOBAL (1<<4) | |
85 #define CONF_NOSAVE (1<<5) | |
86 #define CONF_OLD (1<<6) | |
87 | |
88 #define ERR_NOT_AN_OPTION -1 | |
89 #define ERR_MISSING_PARAM -2 | |
90 #define ERR_OUT_OF_RANGE -3 | |
91 #define ERR_FUNC_ERR -4 | |
92 | |
93 #endif |