Mercurial > mplayer.hg
comparison m_config.h @ 8164:487cfc28525d
New config system + cleanup of header inter dependency
author | albeu |
---|---|
date | Tue, 12 Nov 2002 01:56:42 +0000 |
parents | |
children | ff6a98628e6c |
comparison
equal
deleted
inserted
replaced
8163:51e5033ee687 | 8164:487cfc28525d |
---|---|
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 | |
31 | |
32 //////////////////////////// Functions /////////////////////////////////// | |
33 | |
34 m_config_t* | |
35 m_config_new(void); | |
36 | |
37 void | |
38 m_config_free(m_config_t* config); | |
39 | |
40 void | |
41 m_config_push(m_config_t* config); | |
42 | |
43 void | |
44 m_config_pop(m_config_t* config); | |
45 | |
46 int | |
47 m_config_register_options(m_config_t *config, struct m_option *args); | |
48 | |
49 int | |
50 m_config_set_option(m_config_t *config, char* arg, char* param); | |
51 | |
52 int | |
53 m_config_check_option(m_config_t *config, char* arg, char* param); | |
54 | |
55 struct m_option* | |
56 m_config_get_option(m_config_t *config, char* arg); | |
57 | |
58 ///////////////////////////////////////////////////////////////////////////////////// | |
59 /////////////////////////// Backward compat. stuff //////////////////////////////// | |
60 //////////////////////////////////////////////////////////////////////////////////// | |
61 | |
62 typedef struct config config_t; | |
63 struct config { | |
64 char *name; | |
65 void *p; | |
66 struct m_option_type* type; | |
67 unsigned int flags; | |
68 float min,max; | |
69 void* priv; | |
70 }; | |
71 | |
72 | |
73 #define CONF_MIN (1<<0) | |
74 #define CONF_MAX (1<<1) | |
75 #define CONF_RANGE (CONF_MIN|CONF_MAX) | |
76 #define CONF_NOCFG (1<<2) | |
77 #define CONF_NOCMD (1<<3) | |
78 #define CONF_GLOBAL (1<<4) | |
79 #define CONF_NOSAVE (1<<5) | |
80 #define CONF_OLD (1<<6) | |
81 | |
82 #define ERR_NOT_AN_OPTION -1 | |
83 #define ERR_MISSING_PARAM -2 | |
84 #define ERR_OUT_OF_RANGE -3 | |
85 #define ERR_FUNC_ERR -4 | |
86 | |
87 #endif |