diff options
author | Markus Armbruster <armbru@redhat.com> | 2018-02-11 10:35:44 +0100 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2018-03-02 13:14:09 -0600 |
commit | 93b564c444edc41901d0f7e922833eeb751f8249 (patch) | |
tree | af0b36e50877b556dcf2b16c2094586af51ff881 /scripts/qapi-introspect.py | |
parent | 47a6ea9aab1d857015684cda387ffba05a036721 (diff) |
qapi: Reduce use of global variables in generators some
In preparation of the next commit, which will turn the generators into
modules. These global variables will become local to main() then.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180211093607.27351-7-armbru@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts/qapi-introspect.py')
-rw-r--r-- | scripts/qapi-introspect.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/qapi-introspect.py b/scripts/qapi-introspect.py index 0638acda9c..5d9a7abeb8 100644 --- a/scripts/qapi-introspect.py +++ b/scripts/qapi-introspect.py @@ -41,7 +41,8 @@ def to_c_string(string): class QAPISchemaGenIntrospectVisitor(QAPISchemaVisitor): - def __init__(self, unmask): + def __init__(self, prefix, unmask): + self._prefix = prefix self._unmask = unmask self.defn = None self.decl = None @@ -65,7 +66,7 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaVisitor): # generate C # TODO can generate awfully long lines jsons.extend(self._jsons) - name = c_name(prefix, protect=False) + 'qmp_schema_json' + name = c_name(self._prefix, protect=False) + 'qmp_schema_json' self.decl = mcgen(''' extern const char %(c_name)s[]; ''', @@ -190,7 +191,7 @@ genc.add(mcgen(''' prefix=prefix)) schema = QAPISchema(input_file) -vis = QAPISchemaGenIntrospectVisitor(opt_unmask) +vis = QAPISchemaGenIntrospectVisitor(prefix, opt_unmask) schema.visit(vis) genc.add(vis.defn) genh.add(vis.decl) |