aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r--scripts/qapi.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py
index f1ca5b6d1c..0de9fe2cc5 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -467,3 +467,13 @@ def guardend(name):
''',
name=guardname(name))
+
+def generate_enum_name(name):
+ if name.isupper():
+ return c_fun(name, False)
+ new_name = ''
+ for c in c_fun(name, False):
+ if c.isupper():
+ new_name += '_'
+ new_name += c
+ return new_name.lstrip('_').upper()