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>,
	"Michael Roth" <mdroth@linux.vnet.ibm.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Cleber Rosa" <crosa@redhat.com>
Subject: [Qemu-devel] [PATCH v4 18/51] qapi: rename QAPISchemaEnumType.values to .members
Date: Thu, 11 Jan 2018 22:32:17 +0100	[thread overview]
Message-ID: <20180111213250.16511-19-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20180111213250.16511-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.py                | 36 ++++++++++++++++++------------------
 scripts/qapi-introspect.py     |  4 ++--
 scripts/qapi-types.py          | 10 +++++-----
 scripts/qapi-visit.py          |  2 +-
 scripts/qapi2texi.py           |  2 +-
 tests/qapi-schema/test-qapi.py |  4 ++--
 6 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/scripts/qapi.py b/scripts/qapi.py
index ee759489cb..c7cd98a890 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1046,7 +1046,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):
@@ -1134,22 +1134,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()
@@ -1159,7 +1159,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'
@@ -1958,19 +1958,19 @@ def ifcond_decorator(func):
     return func_wrapper
 
 
-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('''
     },
@@ -1981,9 +1981,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('''
 
@@ -1991,11 +1991,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-introspect.py b/scripts/qapi-introspect.py
index 7d3a5c37fd..9fcb342c91 100644
--- a/scripts/qapi-introspect.py
+++ b/scripts/qapi-introspect.py
@@ -153,8 +153,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 789e89ff59..75c1823e44 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -203,16 +203,16 @@ class QAPISchemaGenTypeVisitor(QAPISchemaVisitor):
         self.defn += gen_type_cleanup(name)
 
     @ifcond_decorator
-    def visit_enum_type(self, name, info, ifcond, values, prefix):
+    def visit_enum_type(self, name, info, ifcond, members, prefix):
         # Special case for our lone builtin enum type
         # TODO use something cleaner than existence of info
         if not info:
-            self._btin += gen_enum(name, values, prefix)
+            self._btin += gen_enum(name, members, prefix)
             if do_builtins:
-                self.defn += gen_enum_lookup(name, values, prefix)
+                self.defn += gen_enum_lookup(name, members, prefix)
         else:
-            self._fwdecl += gen_enum(name, values, prefix)
-            self.defn += gen_enum_lookup(name, values, prefix)
+            self._fwdecl += gen_enum(name, members, prefix)
+            self.defn += gen_enum_lookup(name, members, prefix)
 
     @ifcond_decorator
     def visit_array_type(self, name, info, ifcond, element_type):
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 4b0e005437..7e816ae98e 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -284,7 +284,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor):
         self._btin = None
 
     @ifcond_decorator
-    def visit_enum_type(self, name, info, ifcond, values, prefix):
+    def visit_enum_type(self, name, info, ifcond, members, prefix):
         # Special case for our lone builtin enum type
         # TODO use something cleaner than existence of info
         if not info:
diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py
index f24fb89bd5..755bd2f15d 100755
--- a/scripts/qapi2texi.py
+++ b/scripts/qapi2texi.py
@@ -203,7 +203,7 @@ class QAPISchemaGenDocVisitor(qapi.QAPISchemaVisitor):
     def visit_begin(self, schema):
         self.out = ''
 
-    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.out += TYPE_FMT(type='Enum',
                              name=doc.symbol,
diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py
index a4b3a00bbd..1c4f9e0dac 100644
--- a/tests/qapi-schema/test-qapi.py
+++ b/tests/qapi-schema/test-qapi.py
@@ -17,8 +17,8 @@ import sys
 
 
 class QAPISchemaTestVisitor(QAPISchemaVisitor):
-    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.0.rc1.1.gef27df75a1

  parent reply	other threads:[~2018-01-11 21:35 UTC|newest]

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

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=20180111213250.16511-19-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=armbru@redhat.com \
    --cc=crosa@redhat.com \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=mdroth@linux.vnet.ibm.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).