From 0c1dd8a8f54a152755faef3d323ce6fdc7d63f73 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 6 Aug 2012 17:42:53 +0200 Subject: m_config: support flatten and merge flags for suboptions M_OPT_PREFIXED allows adding top-level options with the suboption mechanism. The point of this is that, even though these options are top-level options, they don't need to be added directly to a top- level option array (such as mplayer_opts[]). Instead, the suboption can be defined in a separate source file. Only a suboption declaration is needed to add these options. M_OPT_MERGE is similar to M_OPT_PREFIXED, but doesn't add the name of the suboptions entry as prefix. Given you have a suboption declaration "prefix" and the suboption "subopt", you can pass them as follows on the command line: normal: --prefix=subopt=value M_OPT_PREFIXED: --prefix-subopt=value M_OPT_MERGE: --subopt=value --- m_option.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'm_option.h') diff --git a/m_option.h b/m_option.h index 4ab7e9c1d2..e0321d1de1 100644 --- a/m_option.h +++ b/m_option.h @@ -290,6 +290,14 @@ struct m_option { // For m_option_type_choice, the first listed choice will be used. #define M_OPT_IMPLICIT_DEFAULT (1 << 7) +// For options with children, add all children as top-level arguments +// (e.g. "--parent=child=value" becomes "--parent-child=value") +#define M_OPT_PREFIXED (1 << 8) + +// Similar to M_OPT_PREFIXED, but drop the prefix. +// (e.g. "--parent=child=value" becomes "--child=value") +#define M_OPT_MERGE (1 << 9) + // These are kept for compatibility with older code. #define CONF_MIN M_OPT_MIN #define CONF_MAX M_OPT_MAX -- cgit v1.2.3