comparison m_option.h @ 18316:b3be7df634b0

spelling/grammar/wording fixes in doxygen and non-doxygen comments
author diego
date Thu, 27 Apr 2006 13:22:23 +0000
parents 67d35fe89c8d
children 75327b24e06f
comparison
equal deleted inserted replaced
18315:5646b8d9654c 18316:b3be7df634b0
34 extern m_option_type_t m_option_type_print_func; 34 extern m_option_type_t m_option_type_print_func;
35 extern m_option_type_t m_option_type_subconfig; 35 extern m_option_type_t m_option_type_subconfig;
36 extern m_option_type_t m_option_type_imgfmt; 36 extern m_option_type_t m_option_type_imgfmt;
37 extern m_option_type_t m_option_type_afmt; 37 extern m_option_type_t m_option_type_afmt;
38 38
39 // Func based types 39 // Func-based types
40 extern m_option_type_t m_option_type_func_full; 40 extern m_option_type_t m_option_type_func_full;
41 extern m_option_type_t m_option_type_func_param; 41 extern m_option_type_t m_option_type_func_param;
42 extern m_option_type_t m_option_type_func; 42 extern m_option_type_t m_option_type_func;
43 43
44 /// Callback used to reset func options. 44 /// Callback used to reset func options.
51 typedef int (*m_opt_func_param_t)(m_option_t *, char *); 51 typedef int (*m_opt_func_param_t)(m_option_t *, char *);
52 52
53 /// Callback used by m_option_type_func options. 53 /// Callback used by m_option_type_func options.
54 typedef int (*m_opt_func_t)(m_option_t *); 54 typedef int (*m_opt_func_t)(m_option_t *);
55 55
56 // Backward compat 56 // Backwards compatibility
57 typedef m_opt_default_func_t cfg_default_func_t; 57 typedef m_opt_default_func_t cfg_default_func_t;
58 typedef m_opt_func_full_t cfg_func_arg_param_t; 58 typedef m_opt_func_full_t cfg_func_arg_param_t;
59 typedef m_opt_func_param_t cfg_func_param_t; 59 typedef m_opt_func_param_t cfg_func_param_t;
60 typedef m_opt_func_t cfg_func_t; 60 typedef m_opt_func_t cfg_func_t;
61 61
78 char* name; 78 char* name;
79 /// NULL terminated array of parameter/value pairs. 79 /// NULL terminated array of parameter/value pairs.
80 char** attribs; 80 char** attribs;
81 } m_obj_settings_t; 81 } m_obj_settings_t;
82 82
83 /// A parser to setup a list of objects. 83 /// A parser to set up a list of objects.
84 /** It creates a NULL terminated array \ref m_obj_settings. The option priv 84 /** It creates a NULL terminated array \ref m_obj_settings. The option priv
85 * field (\ref m_option::priv) must point to a \ref m_obj_list_t describing 85 * field (\ref m_option::priv) must point to a \ref m_obj_list_t describing
86 * the available object types. 86 * the available object types.
87 */ 87 */
88 extern m_option_type_t m_option_type_obj_settings_list; 88 extern m_option_type_t m_option_type_obj_settings_list;
91 typedef struct { 91 typedef struct {
92 /// Description of the struct holding the presets. 92 /// Description of the struct holding the presets.
93 struct m_struct_st* in_desc; 93 struct m_struct_st* in_desc;
94 /// Description of the struct that should be set by the presets. 94 /// Description of the struct that should be set by the presets.
95 struct m_struct_st* out_desc; 95 struct m_struct_st* out_desc;
96 /// Pointer to an array of struct defining the various presets. 96 /// Pointer to an array of structs defining the various presets.
97 void* presets; 97 void* presets;
98 /// Offset of the preset's name inside the in_struct. 98 /// Offset of the preset's name inside the in_struct.
99 void* name_off; 99 void* name_off;
100 } m_obj_presets_t; 100 } m_obj_presets_t;
101 101
102 /// Set several fields in a struct at once. 102 /// Set several fields in a struct at once.
103 /** For this two struct descriptions are used. One for the struct holding the 103 /** For this two struct descriptions are used. One for the struct holding the
104 * preset and one for the struct beeing set. Every field present in both 104 * preset and one for the struct beeing set. Every field present in both
105 * struct will be copied from the preset struct to the destination one. 105 * structs will be copied from the preset struct to the destination one.
106 * The option priv field (\ref m_option::priv) must point to a correctly 106 * The option priv field (\ref m_option::priv) must point to a correctly
107 * filled \ref m_obj_presets_t. 107 * filled \ref m_obj_presets_t.
108 */ 108 */
109 extern m_option_type_t m_option_type_obj_presets; 109 extern m_option_type_t m_option_type_obj_presets;
110 110
163 ///////////////////////////////////////////////////////////////////////////////////////////// 163 /////////////////////////////////////////////////////////////////////////////////////////////
164 164
165 /// Option type description 165 /// Option type description
166 struct m_option_type { 166 struct m_option_type {
167 char* name; 167 char* name;
168 /// Syntax desc, etc 168 /// Syntax description, etc
169 char* comments; 169 char* comments;
170 /// Size needed for the data. 170 /// Size needed for the data.
171 unsigned int size; 171 unsigned int size;
172 /// See \ref OptionTypeFlags. 172 /// See \ref OptionTypeFlags.
173 unsigned int flags; 173 unsigned int flags;
195 char* (*print)(m_option_t* opt, void* val); 195 char* (*print)(m_option_t* opt, void* val);
196 196
197 /** \name 197 /** \name
198 * These functions are called to save/set/restore the status of the 198 * These functions are called to save/set/restore the status of the
199 * variables. The difference between the 3 only matters for types like 199 * variables. The difference between the 3 only matters for types like
200 * \ref m_option_type_func where 'setting' need to do more than just 200 * \ref m_option_type_func where 'setting' needs to do more than just
201 * copying some data. 201 * copying some data.
202 */ 202 */
203 //@{ 203 //@{
204 204
205 /// Update a save slot (dst) from the current value in the prog (src). 205 /// Update a save slot (dst) from the current value in the program (src).
206 /** \param opt The option to copy. 206 /** \param opt The option to copy.
207 * \param dst Pointer to the destination memory. 207 * \param dst Pointer to the destination memory.
208 * \param src Pointer to the source memory. 208 * \param src Pointer to the source memory.
209 */ 209 */
210 void (*save)(m_option_t* opt,void* dst, void* src); 210 void (*save)(m_option_t* opt,void* dst, void* src);
211 211
212 /// Set the value in the prog (dst) from a save slot. 212 /// Set the value in the program (dst) from a save slot.
213 /** \param opt The option to copy. 213 /** \param opt The option to copy.
214 * \param dst Pointer to the destination memory. 214 * \param dst Pointer to the destination memory.
215 * \param src Pointer to the source memory. 215 * \param src Pointer to the source memory.
216 */ 216 */
217 void (*set)(m_option_t* opt,void* dst, void* src); 217 void (*set)(m_option_t* opt,void* dst, void* src);
260 260
261 /// \brief Mostly useful for numeric types, the \ref M_OPT_MAX flags must 261 /// \brief Mostly useful for numeric types, the \ref M_OPT_MAX flags must
262 /// also be set. 262 /// also be set.
263 double max; 263 double max;
264 264
265 /// Type dependent data (for all kind of extended settings). 265 /// Type dependent data (for all kinds of extended settings).
266 /** This used to be function pointer to hold a 'reverse to defaults' func. 266 /** This used to be a function pointer to hold a 'reverse to defaults' func.
267 * Now it can be used to pass any type of extra args needed by the parser. 267 * Now it can be used to pass any type of extra args needed by the parser.
268 * Passing a 'default func' is still valid for all func based option types 268 * Passing a 'default func' is still valid for all func based option types.
269 */ 269 */
270 void* priv; 270 void* priv;
271 }; 271 };
272 272
273 273
289 /// The option is forbidden on the command line. 289 /// The option is forbidden on the command line.
290 #define M_OPT_NOCMD (1<<3) 290 #define M_OPT_NOCMD (1<<3)
291 291
292 /// The option is global in the \ref Config. 292 /// The option is global in the \ref Config.
293 /** It won't be saved on push and the command line parser will set it when 293 /** It won't be saved on push and the command line parser will set it when
294 * it's parsed (ie. it won't be set later) 294 * it's parsed (i.e. it won't be set later)
295 * e.g options : -v, -quiet 295 * e.g options : -v, -quiet
296 */ 296 */
297 #define M_OPT_GLOBAL (1<<4) 297 #define M_OPT_GLOBAL (1<<4)
298 298
299 /// The \ref Config won't save this option on push. 299 /// The \ref Config won't save this option on push.
300 /** It won't be saved on push but the command line parser will add it with 300 /** It won't be saved on push but the command line parser will add it with
301 * its entry (ie : it may be set later) 301 * its entry (i.e. it may be set later)
302 * e.g options : -include 302 * e.g options : -include
303 */ 303 */
304 #define M_OPT_NOSAVE (1<<5) 304 #define M_OPT_NOSAVE (1<<5)
305 305
306 /// \brief The \ref Config will emulate the old behaviour by pushing the 306 /// \brief The \ref Config will emulate the old behavior by pushing the
307 /// option only if it was set by the user. 307 /// option only if it was set by the user.
308 #define M_OPT_OLD (1<<6) 308 #define M_OPT_OLD (1<<6)
309 309
310 /// \defgroup OldOptionFlags Backward compatibility 310 /// \defgroup OldOptionFlags Backward compatibility
311 /// 311 ///
312 /// Those are kept for compatibility with older code. 312 /// These are kept for compatibility with older code.
313 /// @{ 313 /// @{
314 #define CONF_MIN M_OPT_MIN 314 #define CONF_MIN M_OPT_MIN
315 #define CONF_MAX M_OPT_MAX 315 #define CONF_MAX M_OPT_MAX
316 #define CONF_RANGE M_OPT_RANGE 316 #define CONF_RANGE M_OPT_RANGE
317 #define CONF_NOCFG M_OPT_NOCFG 317 #define CONF_NOCFG M_OPT_NOCFG
324 ///@} 324 ///@}
325 325
326 /// \defgroup OptionTypeFlags Option type flags 326 /// \defgroup OptionTypeFlags Option type flags
327 /// \ingroup OptionTypes 327 /// \ingroup OptionTypes
328 /// 328 ///
329 /// These flags are used to describe special parser capabilities or behaviour. 329 /// These flags are used to describe special parser capabilities or behavior.
330 /// 330 ///
331 ///@{ 331 ///@{
332 332
333 /// Suboption parser flag. 333 /// Suboption parser flag.
334 /** When this flag is set, m_option::p should point to another m_option 334 /** When this flag is set, m_option::p should point to another m_option
339 * -option:subopt blah. 339 * -option:subopt blah.
340 */ 340 */
341 #define M_OPT_TYPE_HAS_CHILD (1<<0) 341 #define M_OPT_TYPE_HAS_CHILD (1<<0)
342 342
343 /// Wildcard matching flag. 343 /// Wildcard matching flag.
344 /** If set the option type has a use for option name ending with a * 344 /** If set the option type has a use for option names ending with a *
345 * (used for -aa*), this only affects the option name matching. 345 * (used for -aa*), this only affects the option name matching.
346 */ 346 */
347 #define M_OPT_TYPE_ALLOW_WILDCARD (1<<1) 347 #define M_OPT_TYPE_ALLOW_WILDCARD (1<<1)
348 348
349 /// Dynamic data type. 349 /// Dynamic data type.
350 /** This flag indicate that the data is dynamically allocated (m_option::p point 350 /** This flag indicates that the data is dynamically allocated (m_option::p
351 * to a pointer). It enables a little hack in the \ref Config wich replace 351 * points to a pointer). It enables a little hack in the \ref Config wich
352 * the initial value of such variables with a dynamic copy in case the 352 * replaces the initial value of such variables with a dynamic copy in case
353 * initial value is statically allocated (pretty common with strings). 353 * the initial value is statically allocated (pretty common with strings).
354 */ 354 */
355 #define M_OPT_TYPE_DYNAMIC (1<<2) 355 #define M_OPT_TYPE_DYNAMIC (1<<2)
356 356
357 /// Indirect option type. 357 /// Indirect option type.
358 /** If this is set the parse function doesn't directly return 358 /** If this is set the parse function doesn't directly return
359 * the wanted thing. Options use this if for some reasons they have to wait 359 * the wanted thing. Options use this if for some reasons they have to wait
360 * until the set call to be able to correctly set the target var. 360 * until the set call to be able to correctly set the target var.
361 * So for those types new values must first be parsed, then set to the target 361 * So for those types new values must first be parsed, then set to the target
362 * var. If this flag isn't set then new values can be parsed directly to the 362 * var. If this flag isn't set then new values can be parsed directly to the
363 * target var. It's used by the callback based option as the callback call 363 * target var. It's used by the callback-based options as the callback call
364 * may append later on. 364 * may append later on.
365 */ 365 */
366 #define M_OPT_TYPE_INDIRECT (1<<3) 366 #define M_OPT_TYPE_INDIRECT (1<<3)
367 367
368 ///@} 368 ///@}
370 ///////////////////////////// Parser flags //////////////////////////////////////// 370 ///////////////////////////// Parser flags ////////////////////////////////////////
371 371
372 /// \defgroup OptionParserModes Option parser modes 372 /// \defgroup OptionParserModes Option parser modes
373 /// \ingroup Options 373 /// \ingroup Options
374 /// 374 ///
375 /// Some parsers behaves differently depending on the mode passed in the src 375 /// Some parsers behave differently depending on the mode passed in the src
376 /// parameter of m_option_type::parse. For example the flag type doesn't take 376 /// parameter of m_option_type::parse. For example the flag type doesn't take
377 /// an argument when parsing from the command line. 377 /// an argument when parsing from the command line.
378 ///@{ 378 ///@{
379 379
380 /// Set when parsing from a config file. 380 /// Set when parsing from a config file.