annotate m_config.h @ 9068:8f1659a47aa4

16cif,sif,uyvy
author michael
date Thu, 23 Jan 2003 01:16:49 +0000
parents ff6a98628e6c
children 39444d65c4cb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
2 #ifndef NEW_CONFIG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
3 #warning "Including m_config.h but NEW_CONFIG is disabled"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
4 #else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
5
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
6 typedef struct m_config_option m_config_option_t;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
7 typedef struct m_config_save_slot m_config_save_slot_t;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
8 struct m_option;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
9 struct m_option_type;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
10
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
11 struct m_config_save_slot {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
12 m_config_save_slot_t* prev;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
13 int lvl;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
14 unsigned char data[0];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
15 };
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 struct m_config_option {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
18 m_config_option_t* next;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
19 char* name; // Full name (ie option:subopt)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
20 struct m_option* opt;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
21 m_config_save_slot_t* slots;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
22 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
23 };
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 typedef struct m_config {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
26 m_config_option_t* opts;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
27 int lvl; // Current stack level
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
28 int mode;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
29 } m_config_t;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
30
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
31
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
32 //////////////////////////// Functions ///////////////////////////////////
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
33
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
34 m_config_t*
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
35 m_config_new(void);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
36
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
37 void
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
38 m_config_free(m_config_t* config);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
39
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
40 void
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
41 m_config_push(m_config_t* config);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
42
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
43 void
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
44 m_config_pop(m_config_t* config);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
45
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
46 int
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
47 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
48
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
49 int
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
50 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
51
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
52 int
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
53 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
54
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
55 struct m_option*
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
56 m_config_get_option(m_config_t *config, char* arg);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
57
8168
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
58 void
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
59 m_config_print_option_list(m_config_t *config);
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
60
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
61 /////////////////////////////////////////////////////////////////////////////////////
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
62 /////////////////////////// Backward compat. stuff ////////////////////////////////
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
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
65 typedef struct config config_t;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
66 struct config {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
67 char *name;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
68 void *p;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
69 struct m_option_type* type;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
70 unsigned int flags;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
71 float min,max;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
72 void* priv;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
73 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
74
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
75
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
76 #define CONF_MIN (1<<0)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
77 #define CONF_MAX (1<<1)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
78 #define CONF_RANGE (CONF_MIN|CONF_MAX)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
79 #define CONF_NOCFG (1<<2)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
80 #define CONF_NOCMD (1<<3)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
81 #define CONF_GLOBAL (1<<4)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
82 #define CONF_NOSAVE (1<<5)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
83 #define CONF_OLD (1<<6)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
84
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
85 #define ERR_NOT_AN_OPTION -1
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
86 #define ERR_MISSING_PARAM -2
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
87 #define ERR_OUT_OF_RANGE -3
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
88 #define ERR_FUNC_ERR -4
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
89
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
90 #endif