Mercurial > mplayer.hg
annotate m_option.h @ 18060:cbc29633fbee
AMR codecs support info, patch by Rathann, with slight alteration by me.
author | gpoirier |
---|---|
date | Sun, 09 Apr 2006 12:13:59 +0000 |
parents | 21123e349463 |
children | 96568be4bfdc |
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:
10590
diff
changeset
|
1 #ifndef _M_OPTION_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:
10590
diff
changeset
|
2 #define _M_OPTION_H |
8164 | 3 |
4 typedef struct m_option_type m_option_type_t; | |
5 typedef struct m_option m_option_t; | |
9793 | 6 struct m_struct_st; |
8164 | 7 |
8 ///////////////////////////// Options types declarations //////////////////////////// | |
9 | |
10 // Simple types | |
11 extern m_option_type_t m_option_type_flag; | |
12 extern m_option_type_t m_option_type_int; | |
13 extern m_option_type_t m_option_type_float; | |
11947 | 14 extern m_option_type_t m_option_type_double; |
8164 | 15 extern m_option_type_t m_option_type_string; |
16 extern m_option_type_t m_option_type_string_list; | |
17 extern m_option_type_t m_option_type_position; | |
18 | |
19 extern m_option_type_t m_option_type_print; | |
8736 | 20 extern m_option_type_t m_option_type_print_indirect; |
17470
21123e349463
New option type to print help text with a function.
albeu
parents:
17456
diff
changeset
|
21 extern m_option_type_t m_option_type_print_func; |
8164 | 22 extern m_option_type_t m_option_type_subconfig; |
23 extern m_option_type_t m_option_type_imgfmt; | |
14246 | 24 extern m_option_type_t m_option_type_afmt; |
8164 | 25 |
26 // Func based types | |
27 extern m_option_type_t m_option_type_func_full; | |
28 extern m_option_type_t m_option_type_func_param; | |
29 extern m_option_type_t m_option_type_func; | |
30 | |
31 typedef void (*m_opt_default_func_t)(m_option_t *, char*); | |
32 typedef int (*m_opt_func_full_t)(m_option_t *, char *, char *); | |
33 typedef int (*m_opt_func_param_t)(m_option_t *, char *); | |
34 typedef int (*m_opt_func_t)(m_option_t *); | |
35 ///////////// Backward compat | |
36 typedef m_opt_default_func_t cfg_default_func_t; | |
37 typedef m_opt_func_full_t cfg_func_arg_param_t; | |
38 typedef m_opt_func_param_t cfg_func_param_t; | |
39 typedef m_opt_func_t cfg_func_t; | |
40 | |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
41 typedef struct { |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
42 void** list; |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
43 void* name_off; |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
44 void* info_off; |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
45 void* desc_off; |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
46 } m_obj_list_t; |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
47 |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
48 typedef struct { |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
49 char* name; |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
50 char** attribs; |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
51 } m_obj_settings_t; |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
52 extern m_option_type_t m_option_type_obj_settings_list; |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
53 |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
54 // Presets are mean to be used with options struct |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
55 |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
56 |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
57 typedef struct { |
9791
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
58 struct m_struct_st* in_desc; |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
59 struct m_struct_st* out_desc; |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
60 void* presets; // Pointer to an arry of struct defined by in_desc |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
61 void* name_off; // Offset of the preset name inside the in_struct |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
62 } m_obj_presets_t; |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
63 extern m_option_type_t m_option_type_obj_presets; |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
64 |
9791
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
65 extern m_option_type_t m_option_type_custom_url; |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
66 |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
67 typedef struct { |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
68 struct m_struct_st* desc; // Fields description |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
69 char separator; // Field separator to use |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
70 } m_obj_params_t; |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
71 extern m_option_type_t m_option_type_obj_params; |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
72 |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
73 typedef struct { |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
74 int start; |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
75 int end; |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
76 } m_span_t; |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
77 extern m_obj_params_t m_span_params_def; |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
78 |
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
79 |
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:
10590
diff
changeset
|
80 // FIXME: backward compatibility |
8164 | 81 #define CONF_TYPE_FLAG (&m_option_type_flag) |
82 #define CONF_TYPE_INT (&m_option_type_int) | |
83 #define CONF_TYPE_FLOAT (&m_option_type_float) | |
11947 | 84 #define CONF_TYPE_DOUBLE (&m_option_type_double) |
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:
10590
diff
changeset
|
85 #define CONF_TYPE_STRING (&m_option_type_string) |
8164 | 86 #define CONF_TYPE_FUNC (&m_option_type_func) |
87 #define CONF_TYPE_FUNC_PARAM (&m_option_type_func_param) | |
88 #define CONF_TYPE_PRINT (&m_option_type_print) | |
8736 | 89 #define CONF_TYPE_PRINT_INDIRECT (&m_option_type_print_indirect) |
17470
21123e349463
New option type to print help text with a function.
albeu
parents:
17456
diff
changeset
|
90 #define CONF_TYPE_PRINT_FUNC (&m_option_type_print_func) |
8164 | 91 #define CONF_TYPE_FUNC_FULL (&m_option_type_func_full) |
92 #define CONF_TYPE_SUBCONFIG (&m_option_type_subconfig) | |
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:
10590
diff
changeset
|
93 #define CONF_TYPE_STRING_LIST (&m_option_type_string_list) |
8164 | 94 #define CONF_TYPE_POSITION (&m_option_type_position) |
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:
10590
diff
changeset
|
95 #define CONF_TYPE_IMGFMT (&m_option_type_imgfmt) |
14246 | 96 #define CONF_TYPE_AFMT (&m_option_type_afmt) |
8164 | 97 #define CONF_TYPE_SPAN (&m_option_type_span) |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
98 #define CONF_TYPE_OBJ_SETTINGS_LIST (&m_option_type_obj_settings_list) |
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:
10590
diff
changeset
|
99 #define CONF_TYPE_OBJ_PRESETS (&m_option_type_obj_presets) |
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:
10590
diff
changeset
|
100 #define CONF_TYPE_CUSTOM_URL (&m_option_type_custom_url) |
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:
10590
diff
changeset
|
101 #define CONF_TYPE_OBJ_PARAMS (&m_option_type_obj_params) |
8164 | 102 |
103 ///////////////////////////////////////////////////////////////////////////////////////////// | |
104 | |
105 struct m_option_type { | |
106 char* name; | |
107 char* comments; // syntax desc, etc | |
108 unsigned int size; // size needed for a save slot | |
109 unsigned int flags; | |
110 | |
111 // parse is the only requiered function all others can be NULL | |
112 // If dst if non-NULL it should create/update the save slot | |
113 // If dst is NULL it should just test the validity of the arg if possible | |
114 // Src tell from where come this setting (ie cfg file, command line, playlist, .... | |
115 // It should return 1 if param was used, 0 if not. | |
116 // On error it must return 1 of the error code below | |
117 int (*parse)(m_option_t* opt,char *name, char *param, void* dst, int src); | |
118 // Print back a value in human form | |
119 char* (*print)(m_option_t* opt, void* val); | |
120 | |
121 // These 3 will be a memcpy in 50% of the case, it's called to save/restore the status of | |
122 // the var it's there for complex type like CONF_TYPE_FUNC* | |
123 // update a save slot (dst) from the current value in the prog (src) | |
124 void (*save)(m_option_t* opt,void* dst, void* src); | |
125 // set the current value (dst) from a save slot | |
126 void (*set)(m_option_t* opt,void* dst, void* src); | |
127 // Copy betewen 2 slot (if NULL and size > 0 a memcpy will be used | |
128 void (*copy)(m_option_t* opt,void* dst, void* src); | |
129 // Free the data allocated for a save slot if needed | |
130 void (*free)(void* dst); | |
131 }; | |
132 | |
133 struct m_option { | |
134 char *name; | |
135 void *p; | |
136 m_option_type_t* type; | |
137 unsigned int flags; | |
10590 | 138 double min,max; |
8164 | 139 // This used to be function pointer to hold a 'reverse to defaults' func. |
140 // Nom it can be used to pass any type of extra args. | |
141 // Passing a 'default func' is still valid for all func based option types | |
142 void* priv; // Type dependent data (for all kind of extended setting) | |
143 }; | |
144 | |
145 | |
146 //////////////////////////////// Option flags ///////////////////////////////// | |
147 | |
148 // Option flags | |
149 #define M_OPT_MIN (1<<0) | |
150 #define M_OPT_MAX (1<<1) | |
151 #define M_OPT_RANGE (M_OPT_MIN|M_OPT_MAX) | |
152 #define M_OPT_NOCFG (1<<2) | |
153 #define M_OPT_NOCMD (1<<3) | |
154 // This option is global : it won't be saved on push and the command | |
155 // line parser will set it when it's parsed (ie. it won't be set later) | |
156 // e.g options : -v, -quiet | |
157 #define M_OPT_GLOBAL (1<<4) | |
158 // Do not save this option : it won't be saved on push but the command | |
159 // line parser will put it with it's entry (ie : it may be set later) | |
160 // e.g options : -include | |
161 #define M_OPT_NOSAVE (1<<5) | |
162 // Emulate old behaviour by pushing the option only if it was set by the user | |
163 #define M_OPT_OLD (1<<6) | |
164 | |
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:
10590
diff
changeset
|
165 // FIXME: backward compatibility |
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:
10590
diff
changeset
|
166 #define CONF_MIN M_OPT_MIN |
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:
10590
diff
changeset
|
167 #define CONF_MAX M_OPT_MAX |
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:
10590
diff
changeset
|
168 #define CONF_RANGE M_OPT_RANGE |
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:
10590
diff
changeset
|
169 #define CONF_NOCFG M_OPT_NOCFG |
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:
10590
diff
changeset
|
170 #define CONF_NOCMD M_OPT_NOCMD |
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:
10590
diff
changeset
|
171 #define CONF_GLOBAL M_OPT_GLOBAL |
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:
10590
diff
changeset
|
172 #define CONF_NOSAVE M_OPT_NOSAVE |
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:
10590
diff
changeset
|
173 #define CONF_OLD M_OPT_OLD |
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:
10590
diff
changeset
|
174 |
8164 | 175 |
176 ///////////////////////////// Option type flags /////////////////////////////////// | |
177 | |
178 // These flags are for the parsers. The description here apply to the m_config_t | |
179 // based parsers (ie. cmd line and config file parsers) | |
180 // Some parser will refuse option types that have some of these flags | |
181 | |
182 // This flag is used for the subconfig | |
183 // When this flag is set, opt->p should point to another m_option_t array | |
184 // Only the parse function will be called. If dst is set, it should create/update | |
185 // an array of char* containg opt/val pairs. | |
186 // Then the options in the child array will then be set automaticly. | |
187 // You can only affect the way suboption are parsed. | |
188 // Also note that suboptions may be directly accessed by using -option:subopt blah :-) | |
189 #define M_OPT_TYPE_HAS_CHILD (1<<0) | |
190 // If this flag is set the option type support option name with * at the end (used for -aa*) | |
191 // This only affect the option name matching, the option type have to implement | |
192 // the needed stuff. | |
193 #define M_OPT_TYPE_ALLOW_WILDCARD (1<<1) | |
194 // This flag indicate that the data is dynamicly allocated (opt->p point to a pointer) | |
195 // It enable a little hack wich replace the initial value by a dynamic copy | |
196 // in case the initial value is staticly allocated (pretty common with strings) | |
197 #define M_OPT_TYPE_DYNAMIC (1<<2) | |
198 /// If this is set the parse function doesn't directly return | |
199 // the wanted thing. Options use this if for some reasons they have to wait | |
200 // until the set call to be able to correctly set the target var. | |
201 // So for those types you have to first parse and then set the target var | |
202 // If this flag isn't set you can parse directly to the target var | |
203 // It's used for the callback based option as the callback call may append | |
204 // later on. | |
205 #define M_OPT_TYPE_INDIRECT (1<<3) | |
206 | |
207 | |
208 ///////////////////////////// Parser flags //////////////////////////////////////// | |
209 | |
210 // Config mode : some parser type behave differently depending | |
211 // on config->mode value wich is passed in the src param of parse() | |
212 #define M_CONFIG_FILE 0 | |
213 #define M_COMMAND_LINE 1 | |
214 | |
215 // Option parser error code | |
10595
522afd56703c
100l to albeu for his english grammar, and 10l to me becouse I noticed that lately (my backward compatibilty macro uses M_OPT_UNKNOWN)
alex
parents:
10594
diff
changeset
|
216 #define M_OPT_UNKNOWN -1 |
8164 | 217 #define M_OPT_MISSING_PARAM -2 |
218 #define M_OPT_INVALID -3 | |
219 #define M_OPT_OUT_OF_RANGE -4 | |
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:
10590
diff
changeset
|
220 #define M_OPT_PARSER_ERR -5 |
9791
c5b63e88253d
Fix some 10L typo in header (m_struct_s instead of m_struct_st).
albeu
parents:
9593
diff
changeset
|
221 #define M_OPT_EXIT -6 |
16345
feb16d0117c8
allow multiple help clauses on the command line, Patch by kiriuja " mplayer-patches AH en-directo POUM net "
gpoirier
parents:
14246
diff
changeset
|
222 // M_OPT_EXIT must be the lowest number on this list. |
feb16d0117c8
allow multiple help clauses on the command line, Patch by kiriuja " mplayer-patches AH en-directo POUM net "
gpoirier
parents:
14246
diff
changeset
|
223 // To indicate that mplayer should exit without playing anything, |
feb16d0117c8
allow multiple help clauses on the command line, Patch by kiriuja " mplayer-patches AH en-directo POUM net "
gpoirier
parents:
14246
diff
changeset
|
224 // a parsing function needs to return M_OPT_EXIT less the number |
feb16d0117c8
allow multiple help clauses on the command line, Patch by kiriuja " mplayer-patches AH en-directo POUM net "
gpoirier
parents:
14246
diff
changeset
|
225 // of additional command line parameters it consumed. |
feb16d0117c8
allow multiple help clauses on the command line, Patch by kiriuja " mplayer-patches AH en-directo POUM net "
gpoirier
parents:
14246
diff
changeset
|
226 // Generally it will return either M_OPT_EXIT or M_OPT_EXIT - 1. |
8164 | 227 |
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:
10590
diff
changeset
|
228 // FIXME: backward compatibility |
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:
10590
diff
changeset
|
229 #define ERR_NOT_AN_OPTION M_OPT_UNKNOWN |
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:
10590
diff
changeset
|
230 #define ERR_MISSING_PARAM M_OPT_MISSING_PARAM |
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:
10590
diff
changeset
|
231 #define ERR_OUT_OF_RANGE M_OPT_OUT_OF_RANGE |
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:
10590
diff
changeset
|
232 #define ERR_FUNC_ERR M_OPT_PARSER_ERR |
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:
10590
diff
changeset
|
233 |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8736
diff
changeset
|
234 m_option_t* m_option_list_find(m_option_t* list,char* name); |
8164 | 235 |
236 inline static int | |
237 m_option_parse(m_option_t* opt,char *name, char *param, void* dst, int src) { | |
238 return opt->type->parse(opt,name,param,dst,src); | |
239 } | |
240 | |
241 inline static char* | |
242 m_option_print(m_option_t* opt, void* val_ptr) { | |
243 if(opt->type->print) | |
244 return opt->type->print(opt,val_ptr); | |
245 else | |
8168 | 246 return (char*)-1; |
8164 | 247 } |
248 | |
249 inline static void | |
250 m_option_save(m_option_t* opt,void* dst, void* src) { | |
251 if(opt->type->save) | |
252 opt->type->save(opt,dst,src); | |
253 } | |
254 | |
255 inline static void | |
256 m_option_set(m_option_t* opt,void* dst, void* src) { | |
257 if(opt->type->set) | |
258 opt->type->set(opt,dst,src); | |
259 } | |
260 | |
261 inline static void | |
262 m_option_copy(m_option_t* opt,void* dst, void* src) { | |
263 if(opt->type->copy) | |
17456
b8ce59172e6a
100L m_option_copy should use the copy callback and not the set one.
albeu
parents:
16345
diff
changeset
|
264 opt->type->copy(opt,dst,src); |
8164 | 265 else if(opt->type->size > 0) |
266 memcpy(dst,src,opt->type->size); | |
267 } | |
268 | |
269 inline static void | |
270 m_option_free(m_option_t* opt,void* dst) { | |
271 if(opt->type->free) | |
272 opt->type->free(dst); | |
273 } | |
274 | |
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:
10590
diff
changeset
|
275 #endif /* _M_OPTION_H */ |