qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: eblake@redhat.com, armbru@redhat.com,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PATCH v3 16/49] qapi: rename QAPISchemaEnumType.values to .members
Date: Wed, 21 Mar 2018 12:51:38 +0100	[thread overview]
Message-ID: <20180321115211.17937-17-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20180321115211.17937-1-marcandre.lureau@redhat.com>

Rename QAPISchemaEnumType.values and related variables to members.
Makes sense ever since commit 93bda4dd4 changed .values from list of
string to list of QAPISchemaMember. Obvious no-op.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 scripts/qapi/common.py         | 36 +++++++++++++++++-----------------
 scripts/qapi/doc.py            |  2 +-
 scripts/qapi/introspect.py     |  4 ++--
 scripts/qapi/types.py          |  6 +++---
 scripts/qapi/visit.py          |  2 +-
 tests/qapi-schema/test-qapi.py |  4 ++--
 6 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index 68a567f53f..ea5cdfe3be 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -1068,7 +1068,7 @@ class QAPISchemaVisitor(object):
     def visit_builtin_type(self, name, info, json_type):
         pass
 
-    def visit_enum_type(self, name, info, ifcond, values, prefix):
+    def visit_enum_type(self, name, info, ifcond, members, prefix):
         pass
 
     def visit_array_type(self, name, info, ifcond, element_type):
@@ -1166,22 +1166,22 @@ class QAPISchemaBuiltinType(QAPISchemaType):
 
 
 class QAPISchemaEnumType(QAPISchemaType):
-    def __init__(self, name, info, doc, ifcond, values, prefix):
+    def __init__(self, name, info, doc, ifcond, members, prefix):
         QAPISchemaType.__init__(self, name, info, doc, ifcond)
-        for v in values:
-            assert isinstance(v, QAPISchemaMember)
-            v.set_owner(name)
+        for m in members:
+            assert isinstance(m, QAPISchemaMember)
+            m.set_owner(name)
         assert prefix is None or isinstance(prefix, str)
-        self.values = values
+        self.members = members
         self.prefix = prefix
 
     def check(self, schema):
         QAPISchemaType.check(self, schema)
         seen = {}
-        for v in self.values:
-            v.check_clash(self.info, seen)
+        for m in self.members:
+            m.check_clash(self.info, seen)
             if self.doc:
-                self.doc.connect_member(v)
+                self.doc.connect_member(m)
 
     def is_implicit(self):
         # See QAPISchema._make_implicit_enum_type() and ._def_predefineds()
@@ -1191,7 +1191,7 @@ class QAPISchemaEnumType(QAPISchemaType):
         return c_name(self.name)
 
     def member_names(self):
-        return [v.name for v in self.values]
+        return [m.name for m in self.members]
 
     def json_type(self):
         return 'string'
@@ -1999,19 +1999,19 @@ def wrap_ifcond(ifcond, before, after):
     return out
 
 
-def gen_enum_lookup(name, values, prefix=None):
+def gen_enum_lookup(name, members, prefix=None):
     ret = mcgen('''
 
 const QEnumLookup %(c_name)s_lookup = {
     .array = (const char *const[]) {
 ''',
                 c_name=c_name(name))
-    for value in values:
-        index = c_enum_const(name, value, prefix)
+    for m in members:
+        index = c_enum_const(name, m, prefix)
         ret += mcgen('''
         [%(index)s] = "%(value)s",
 ''',
-                     index=index, value=value)
+                     index=index, value=m)
 
     ret += mcgen('''
     },
@@ -2022,9 +2022,9 @@ const QEnumLookup %(c_name)s_lookup = {
     return ret
 
 
-def gen_enum(name, values, prefix=None):
+def gen_enum(name, members, prefix=None):
     # append automatically generated _MAX value
-    enum_values = values + ['_MAX']
+    enum_members = members + ['_MAX']
 
     ret = mcgen('''
 
@@ -2032,11 +2032,11 @@ typedef enum %(c_name)s {
 ''',
                 c_name=c_name(name))
 
-    for value in enum_values:
+    for m in enum_members:
         ret += mcgen('''
     %(c_enum)s,
 ''',
-                     c_enum=c_enum_const(name, value, prefix))
+                     c_enum=c_enum_const(name, m, prefix))
 
     ret += mcgen('''
 } %(c_name)s;
diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py
index d5cfd2336b..6c2bf98e1d 100755
--- a/scripts/qapi/doc.py
+++ b/scripts/qapi/doc.py
@@ -204,7 +204,7 @@ class QAPISchemaGenDocVisitor(qapi.common.QAPISchemaVisitor):
     def write(self, output_dir):
         self._gen.write(output_dir, self._prefix + 'qapi-doc.texi')
 
-    def visit_enum_type(self, name, info, ifcond, values, prefix):
+    def visit_enum_type(self, name, info, ifcond, members, prefix):
         doc = self.cur_doc
         self._gen.add(TYPE_FMT(type='Enum',
                                name=doc.symbol,
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index cb4825f134..66f7fd00a9 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -163,8 +163,8 @@ const QLitObject %(c_name)s = %(c_string)s;
     def visit_builtin_type(self, name, info, json_type):
         self._gen_qlit(name, 'builtin', {'json-type': json_type}, [])
 
-    def visit_enum_type(self, name, info, ifcond, values, prefix):
-        self._gen_qlit(name, 'enum', {'values': values}, ifcond)
+    def visit_enum_type(self, name, info, ifcond, members, prefix):
+        self._gen_qlit(name, 'enum', {'values': members}, ifcond)
 
     def visit_array_type(self, name, info, ifcond, element_type):
         element = self._use_type(element_type)
diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py
index ce4c91206c..5b790cb41d 100644
--- a/scripts/qapi/types.py
+++ b/scripts/qapi/types.py
@@ -213,10 +213,10 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor):
             self._genh.add(gen_type_cleanup_decl(name))
             self._genc.add(gen_type_cleanup(name))
 
-    def visit_enum_type(self, name, info, ifcond, values, prefix):
+    def visit_enum_type(self, name, info, ifcond, members, prefix):
         with ifcontext(ifcond, self._genh, self._genc):
-            self._genh.preamble_add(gen_enum(name, values, prefix))
-            self._genc.add(gen_enum_lookup(name, values, prefix))
+            self._genh.preamble_add(gen_enum(name, members, prefix))
+            self._genc.add(gen_enum_lookup(name, members, prefix))
 
     def visit_array_type(self, name, info, ifcond, element_type):
         with ifcontext(ifcond, self._genh):
diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py
index e4a62ce030..ee776386ae 100644
--- a/scripts/qapi/visit.py
+++ b/scripts/qapi/visit.py
@@ -301,7 +301,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
 ''',
                                       types=types))
 
-    def visit_enum_type(self, name, info, ifcond, values, prefix):
+    def visit_enum_type(self, name, info, ifcond, members, prefix):
         with ifcontext(ifcond, self._genh, self._genc):
             self._genh.add(gen_visit_decl(name, scalar=True))
             self._genc.add(gen_visit_enum(name))
diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py
index 6d25a37dda..f4b8feb9bc 100644
--- a/tests/qapi-schema/test-qapi.py
+++ b/tests/qapi-schema/test-qapi.py
@@ -23,8 +23,8 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor):
     def visit_include(self, name, info):
         print('include %s' % name)
 
-    def visit_enum_type(self, name, info, ifcond, values, prefix):
-        print('enum %s %s' % (name, values))
+    def visit_enum_type(self, name, info, ifcond, members, prefix):
+        print('enum %s %s' % (name, members))
         if prefix:
             print('    prefix %s' % prefix)
         self._print_if(ifcond)
-- 
2.16.2.521.g9aa15f885a

  parent reply	other threads:[~2018-03-21 11:53 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-21 11:51 [Qemu-devel] [PATCH v3 00/49] qapi: add #if pre-processor conditions to generated code Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 01/49] qapi/visit: remove useless prefix argument Marc-André Lureau
2018-06-18 14:29   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 02/49] qapi/events: generate event enum in main module Marc-André Lureau
2018-06-18 14:33   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 03/49] qapi: add 'if' to top-level expressions Marc-André Lureau
2018-06-19  7:57   ` Markus Armbruster
2018-06-19  8:41     ` Marc-André Lureau
2018-06-19 11:35       ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 04/49] qapi: pass 'if' condition into QAPISchemaEntity objects Marc-André Lureau
2018-06-19  8:09   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 05/49] qapi: leave the ifcond attribute undefined until check() Marc-André Lureau
2018-06-19  9:06   ` Markus Armbruster
2018-06-26 13:39     ` Marc-André Lureau
2018-06-27  5:26       ` Markus Armbruster
2018-06-29 10:30         ` Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 06/49] qapi: add 'ifcond' to visitor methods Marc-André Lureau
2018-06-21  8:18   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 07/49] qapi: mcgen() shouldn't indent # lines Marc-André Lureau
2018-06-20 15:14   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 08/49] qapi: add #if/#endif helpers Marc-André Lureau
2018-06-20 16:01   ` Markus Armbruster
2018-06-21  7:06   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 09/49] qapi-introspect: modify to_qlit() to append ', ' on level > 0 Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 10/49] qapi-introspect: add preprocessor conditions to generated QLit Marc-André Lureau
2018-06-21 13:05   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 11/49] qapi/commands: add #if conditions to commands Marc-André Lureau
2018-06-21 14:35   ` Markus Armbruster
2018-06-22  8:34   ` Markus Armbruster
2018-06-25 13:15     ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 12/49] qapi/events: add #if conditions to events Marc-André Lureau
2018-06-21 14:40   ` Markus Armbruster
2018-06-22  9:02   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 13/49] qapi-types: refactor variants handling Marc-André Lureau
2018-06-21 15:54   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 14/49] qapi-types: add #if conditions to types & visitors Marc-André Lureau
2018-06-21 16:12   ` Markus Armbruster
2018-06-27 11:59     ` Marc-André Lureau
2018-06-28  6:27       ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 15/49] qapi: do not define enumeration value explicitely Marc-André Lureau
2018-06-22  8:08   ` Markus Armbruster
2018-06-27 12:13     ` Marc-André Lureau
2018-06-28  6:34       ` Markus Armbruster
2018-03-21 11:51 ` Marc-André Lureau [this message]
2018-06-22 12:24   ` [Qemu-devel] [PATCH v3 16/49] qapi: rename QAPISchemaEnumType.values to .members Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 17/49] qapi: change enum visitor to take QAPISchemaMember Marc-André Lureau
2018-06-22 12:24   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 18/49] tests: modify visit_enum_type() in test-qapi to print members Marc-André Lureau
2018-06-22 14:10   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 19/49] qapi: factor out check_known_keys() Marc-André Lureau
2018-06-25 14:10   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 20/49] qapi: add a dictionnary form with 'name' key for enum members Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 21/49] qapi: add 'if' to " Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 22/49] qapi-event: add 'if' condition to implicit event enum Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 23/49] qapi: rename allow_dict to allow_implicit Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 24/49] qapi: add a dictionary form with 'type' key for members Marc-André Lureau
2018-06-20 11:13   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 25/49] qapi: add 'if' to implicit struct members Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 26/49] qapi: add an error in case a discriminator is conditionnal Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 27/49] qapi: add 'if' on union members Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 28/49] qapi: add 'if' to alternate members Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 29/49] qapi: add #if conditions to generated code members Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 30/49] docs: document schema configuration Marc-André Lureau
2018-06-22 11:10   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 31/49] qapi2texi: add 'If:' section to generated documentation Marc-André Lureau
2018-06-21 16:29   ` Markus Armbruster
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 32/49] qapi2texi: add 'If:' condition to enum values Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 33/49] qapi2texi: add 'If:' condition to struct members Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 34/49] qapi2texi: add condition to variants Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 35/49] qapi: add conditions to VNC type/commands/events on the schema Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 36/49] qapi: add conditions to SPICE " Marc-André Lureau
2018-03-21 11:51 ` [Qemu-devel] [PATCH v3 37/49] qapi: add conditions to REPLICATION type/commands " Marc-André Lureau
2018-03-21 11:52 ` [Qemu-devel] [PATCH v3 38/49] build-sys: move qmp-introspect per target Marc-André Lureau
2018-03-21 11:52 ` [Qemu-devel] [PATCH v3 39/49] qapi-commands: don't initialize command list in qmp_init_marshall() Marc-André Lureau
2018-03-21 11:52 ` [Qemu-devel] [PATCH v3 40/49] RFC: qapi: learn to split schema by 'top-unit' Marc-André Lureau
2018-03-21 11:52 ` [Qemu-devel] [PATCH v3 41/49] qapi: add a top-unit 'target' schema Marc-André Lureau
2018-03-21 11:52 ` [Qemu-devel] [PATCH v3 42/49] qapi: make rtc-reset-reinjection and SEV depend on TARGET_I386 Marc-André Lureau
2018-03-21 11:52 ` [Qemu-devel] [PATCH v3 43/49] qapi: make s390 commands depend on TARGET_S390X Marc-André Lureau
2018-03-22  5:42   ` Thomas Huth
2018-03-22  9:41     ` Marc-André Lureau
2018-03-22 16:10       ` Thomas Huth
2018-03-21 11:52 ` [Qemu-devel] [PATCH v3 44/49] target.json: add a note about query-cpu* not being s390x-specific Marc-André Lureau
2018-03-21 11:52 ` [Qemu-devel] [PATCH v3 45/49] qapi: make query-gic-capabilities depend on TARGET_ARM Marc-André Lureau
2018-03-21 11:52 ` [Qemu-devel] [PATCH v3 46/49] qapi: make query-cpu-model-expansion depend on s390 or x86 Marc-André Lureau
2018-03-21 11:52 ` [Qemu-devel] [PATCH v3 47/49] qapi: make query-cpu-definitions depend on specific targets Marc-André Lureau
2018-03-21 11:52 ` [Qemu-devel] [PATCH v3 48/49] qapi: remove qmp_unregister_command() Marc-André Lureau
2018-03-21 11:52 ` [Qemu-devel] [PATCH v3 49/49] RFC: make RTC_CHANGE per-target Marc-André Lureau
2018-03-21 12:47 ` [Qemu-devel] [PATCH v3 00/49] qapi: add #if pre-processor conditions to generated code no-reply
2018-03-21 14:20 ` no-reply
2018-03-21 22:08 ` no-reply
2018-03-22  5:11 ` no-reply
2018-06-21 16:47 ` Markus Armbruster
2018-06-21 17:18   ` Marc-André Lureau
2018-06-22  6:56     ` Markus Armbruster
2018-06-22  9:06     ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180321115211.17937-17-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).