From a1ce19926cc60438ea2b9fd815c178b75f9436bf Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 27 Apr 2023 09:37:12 +0000 Subject: build-aux,mkenums: allow having separate files for flags and enums --- build-aux/mbim-mkenums | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build-aux/mbim-mkenums b/build-aux/mbim-mkenums index 7077e34..37b7f41 100755 --- a/build-aux/mbim-mkenums +++ b/build-aux/mbim-mkenums @@ -262,7 +262,7 @@ help_epilog = '''Production text substitutions: \u0040ENUMNAME\u0040 PREFIX_THE_XENUM \u0040ENUMSHORT\u0040 THE_XENUM \u0040ENUMPREFIX\u0040 PREFIX - \u0040enumsince\u0040 the user-provided since value given (qmi-mkenums only) + \u0040enumsince\u0040 the user-provided since value given (mbim-mkenums only) \u0040VALUENAME\u0040 PREFIX_THE_XVALUE \u0040valuenick\u0040 the-xvalue \u0040valuenum\u0040 the integer value (limited support, Since: 2.26) @@ -350,6 +350,10 @@ parser.add_argument('--vtail', default=[], dest='vtail', action='append', help='Value tail, produced after iterating over enum values') parser.add_argument('--comments', default='', dest='comment_tmpl', help='Comment structure') +parser.add_argument('--enums-only', default=False, action='store_true', dest='enumsonly', + help='Only process enums, not flags') +parser.add_argument('--flags-only', default=False, action='store_true', dest='flagsonly', + help='Only process flags, not enums') parser.add_argument('--template', default='', dest='template', help='Template file') parser.add_argument('--output', default=None, dest='output') @@ -383,6 +387,9 @@ if options.template != '': idprefix += options.idprefix symprefix += options.symprefix +enumsonly = options.enumsonly +flagsonly = options.flagsonly + # This is a hack to maintain some semblance of backward compatibility with # the old, Perl-based glib-mkenums. The old tool had an implicit ordering # on the arguments and templates; each argument was parsed in order, and @@ -556,6 +563,11 @@ def process_file(curfilename): if flags is None: flags = seenbitshift + if flags and enumsonly: + continue + elif not flags and flagsonly: + continue + # Autogenerate a prefix if enum_prefix is None: for entry in entries: -- cgit v1.2.1