From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: mdroth@linux.vnet.ibm.com, marcandre.lureau@redhat.com,
eblake@redhat.com
Subject: [Qemu-devel] [PATCH RFC 03/14] qapi/introspect: Simplify WIP
Date: Mon, 12 Feb 2018 08:21:56 +0100 [thread overview]
Message-ID: <20180212072207.9367-4-armbru@redhat.com> (raw)
In-Reply-To: <20180212072207.9367-1-armbru@redhat.com>
---
scripts/qapi/introspect.py | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index f66c397fb0..6c86673a09 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -51,36 +51,32 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor):
self._jsons = []
self._used_types = []
self._name_map = {}
+ var = c_name(self._prefix, protect=False) + 'qmp_schema_json'
self._genc.add(mcgen('''
#include "qemu/osdep.h"
#include "%(prefix)sqapi-introspect.h"
+const char %(var)s[] = ''',
+ var=var, prefix=prefix))
+ self._genh.add(mcgen('''
+extern const char %(var)s[];
''',
- prefix=prefix))
+ var=var))
def visit_begin(self, schema):
self._schema = schema
def visit_end(self):
# visit the types that are actually used
- jsons = self._jsons
- self._jsons = []
for typ in self._used_types:
typ.visit(self)
# generate C
# TODO can generate awfully long lines
- jsons.extend(self._jsons)
- name = c_name(self._prefix, protect=False) + 'qmp_schema_json'
- self._genh.add(mcgen('''
-extern const char %(c_name)s[];
-''',
- c_name=c_name(name)))
- lines = to_json(jsons).split('\n')
+ lines = to_json(self._jsons).split('\n')
c_string = '\n '.join([to_c_string(line) for line in lines])
self._genc.add(mcgen('''
-const char %(c_name)s[] = %(c_string)s;
+%(c_string)s;
''',
- c_name=c_name(name),
c_string=c_string))
self._schema = None
self._jsons = []
--
2.13.6
next prev parent reply other threads:[~2018-02-12 7:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180212072207.9367-1-armbru@redhat.com>
2018-02-12 7:21 ` [Qemu-devel] [PATCH RFC 01/14] qlit: use QType instead of int Markus Armbruster
2018-02-12 7:21 ` [Qemu-devel] [PATCH RFC 02/14] qlit: add qobject_from_qlit() Markus Armbruster
2018-02-12 7:21 ` Markus Armbruster [this message]
2018-02-12 7:21 ` [Qemu-devel] [PATCH RFC 04/14] qapi: generate a literal qobject for introspection Markus Armbruster
2018-02-12 7:21 ` [Qemu-devel] [PATCH RFC 05/14] qapi2texi: minor python code simplification Markus Armbruster
2018-02-12 7:21 ` [Qemu-devel] [PATCH RFC 06/14] qapi: add 'if' to top-level expressions Markus Armbruster
2018-02-12 7:22 ` [Qemu-devel] [PATCH RFC 07/14] qapi: pass 'if' condition into QAPISchemaEntity objects Markus Armbruster
2018-02-12 7:22 ` [Qemu-devel] [PATCH RFC 08/14] qapi: leave the ifcond attribute undefined until check() Markus Armbruster
2018-02-12 7:22 ` [Qemu-devel] [PATCH RFC 09/14] qapi: Pass ifcond to visitors Markus Armbruster
2018-02-12 7:22 ` [Qemu-devel] [PATCH RFC 10/14] qapi: mcgen() shouldn't indent # lines Markus Armbruster
2018-02-12 7:22 ` [Qemu-devel] [PATCH RFC 11/14] qapi: add #if/#endif helpers Markus Armbruster
2018-02-12 7:22 ` [Qemu-devel] [PATCH RFC 12/14] qapi-introspect: modify to_qlit() to append ', ' on level > 0 Markus Armbruster
2018-02-12 7:22 ` [Qemu-devel] [PATCH RFC 13/14] qapi-introspect: Add #if conditions to introspection value Markus Armbruster
2018-02-12 7:22 ` [Qemu-devel] [PATCH RFC 14/14] qapi: Add #if conditions to commands, events, types, visitors Markus Armbruster
2018-02-14 15:28 ` Marc-Andre Lureau
2018-02-23 18:13 ` Markus Armbruster
2018-04-19 22:35 ` Eric Blake
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=20180212072207.9367-4-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=marcandre.lureau@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.