summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2023-04-27 09:37:12 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2023-04-27 10:01:22 +0000
commita1ce19926cc60438ea2b9fd815c178b75f9436bf (patch)
tree10d55ecedb2bcf3c293bb889e76ea924d756c063
parent4db9ad53e752ee9281e0386aeec7ccfbacafb81b (diff)
downloadlibmbim-a1ce19926cc60438ea2b9fd815c178b75f9436bf.tar.gz
build-aux,mkenums: allow having separate files for flags and enums
-rwxr-xr-xbuild-aux/mbim-mkenums14
1 files changed, 13 insertions, 1 deletions
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: