annotate m_config.h @ 17521:6090c379d49c

sync up to 1.221
author ptt
date Tue, 31 Jan 2006 10:28:20 +0000
parents 63909962d3fc
children 96568be4bfdc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10594
57bdcdb061d7 Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents: 10582
diff changeset
1 #ifndef _M_CONFIG_H
57bdcdb061d7 Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents: 10582
diff changeset
2 #define _M_CONFIG_H
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
3
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
4 typedef struct m_config_option m_config_option_t;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
5 typedef struct m_config_save_slot m_config_save_slot_t;
17471
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
6 typedef struct m_profile m_profile_t;
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
7 struct m_option;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
8 struct m_option_type;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
9
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
10 struct m_config_save_slot {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
11 m_config_save_slot_t* prev;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
12 int lvl;
13246
5dea9e3618ba alignment for SPARC64, second try
reimar
parents: 10594
diff changeset
13 // we have to store other datatypes in this as well,
5dea9e3618ba alignment for SPARC64, second try
reimar
parents: 10594
diff changeset
14 // so make sure we get properly aligned addresses
5dea9e3618ba alignment for SPARC64, second try
reimar
parents: 10594
diff changeset
15 unsigned char data[0] __attribute__ ((aligned (8)));
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
16 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
17
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
18 struct m_config_option {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
19 m_config_option_t* next;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
20 char* name; // Full name (ie option:subopt)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
21 struct m_option* opt;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
22 m_config_save_slot_t* slots;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
23 unsigned int flags; // currently it only tell if the option was set
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
24 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
25
17471
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
26 struct m_profile {
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
27 m_profile_t* next;
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
28 char* name;
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
29 char* desc;
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
30 int num_opts;
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
31 char** opts;
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
32 };
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
33
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
34 typedef struct m_config {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
35 m_config_option_t* opts;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
36 int lvl; // Current stack level
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
37 int mode;
17471
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
38 m_profile_t* profiles;
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
39 int profile_depth;
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
40 struct m_option* self_opts;
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
41 } m_config_t;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
42
9912
39444d65c4cb Don't save restore all options wich point to the same variable.
albeu
parents: 8168
diff changeset
43 #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
44 #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
45
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
46
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
47 //////////////////////////// Functions ///////////////////////////////////
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
48
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
49 m_config_t*
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
50 m_config_new(void);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
51
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
52 void
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
53 m_config_free(m_config_t* config);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
54
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
55 void
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
56 m_config_push(m_config_t* config);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
57
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
58 void
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
59 m_config_pop(m_config_t* config);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
60
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
61 int
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
62 m_config_register_options(m_config_t *config, struct m_option *args);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
63
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
64 int
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
65 m_config_set_option(m_config_t *config, char* arg, char* param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
66
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
67 int
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
68 m_config_check_option(m_config_t *config, char* arg, char* param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
69
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
70 struct m_option*
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
71 m_config_get_option(m_config_t *config, char* arg);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
72
8168
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
73 void
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
74 m_config_print_option_list(m_config_t *config);
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
75
17471
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
76 m_profile_t*
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
77 m_config_get_profile(m_config_t* config, char* name);
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
78
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
79 m_profile_t*
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
80 m_config_add_profile(m_config_t* config, char* name);
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
81
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
82 void
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
83 m_profile_set_desc(m_profile_t* p, char* desc);
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
84
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
85 int
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
86 m_config_set_profile_option(m_config_t* config, m_profile_t* p,
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
87 char* name, char* val);
63909962d3fc Profiles support.
albeu
parents: 13246
diff changeset
88
10594
57bdcdb061d7 Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents: 10582
diff changeset
89 #endif /* _M_CONFIG_H */