From nobody Thu Nov 6 15:54:25 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489386646992361.8338643420806; Sun, 12 Mar 2017 23:30:46 -0700 (PDT) Received: from localhost ([::1]:50402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnJVF-0008Eo-7S for importer@patchew.org; Mon, 13 Mar 2017 02:30:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnJJp-0007ZW-JX for qemu-devel@nongnu.org; Mon, 13 Mar 2017 02:19:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnJJl-0003cT-SQ for qemu-devel@nongnu.org; Mon, 13 Mar 2017 02:18:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59478) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cnJJl-0003Zs-9r for qemu-devel@nongnu.org; Mon, 13 Mar 2017 02:18:53 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6DAA513A60; Mon, 13 Mar 2017 06:18:53 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2D6Iqk8018107 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 13 Mar 2017 02:18:53 -0400 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 680D911384AF; Mon, 13 Mar 2017 07:18:47 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 13 Mar 2017 07:18:25 +0100 Message-Id: <1489385927-6735-26-git-send-email-armbru@redhat.com> In-Reply-To: <1489385927-6735-1-git-send-email-armbru@redhat.com> References: <1489385927-6735-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 13 Mar 2017 06:18:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.9 25/47] qapi2texi: Include member type in generated documentation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The recent merge of docs/qmp-commands.txt and docs/qmp-events.txt into the schema lost type information. Fix this documentation regression. Example change (qemu-qmp-ref.txt): -- Struct: InputKeyEvent Keyboard input event. Members: - 'button' + 'button: InputButton' Which button this event is for. - 'down' + 'down: boolean' True for key-down and false for key-up events. Since: 2.0 Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi.py | 14 ++++++++++++++ scripts/qapi2texi.py | 8 ++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index 9430493..b82a2a6 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -1101,6 +1101,11 @@ class QAPISchemaType(QAPISchemaEntity): } return json2qtype.get(self.json_type()) =20 + def doc_type(self): + if self.is_implicit(): + return None + return self.name + =20 class QAPISchemaBuiltinType(QAPISchemaType): def __init__(self, name, json_type, c_type): @@ -1125,6 +1130,9 @@ class QAPISchemaBuiltinType(QAPISchemaType): def json_type(self): return self._json_type_name =20 + def doc_type(self): + return self.json_type() + def visit(self, visitor): visitor.visit_builtin_type(self.name, self.info, self.json_type()) =20 @@ -1184,6 +1192,12 @@ class QAPISchemaArrayType(QAPISchemaType): def json_type(self): return 'array' =20 + def doc_type(self): + elt_doc_type =3D self.element_type.doc_type() + if not elt_doc_type: + return None + return 'array of ' + elt_doc_type + def visit(self, visitor): visitor.visit_array_type(self.name, self.info, self.element_type) =20 diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py index 3dd0146..993b652 100755 --- a/scripts/qapi2texi.py +++ b/scripts/qapi2texi.py @@ -135,8 +135,12 @@ def texi_enum_value(value): =20 def texi_member(member): """Format a table of members item for an object type member""" - return '@item @code{%s}%s\n' % ( - member.name, ' (optional)' if member.optional else '') + typ =3D member.type.doc_type() + return '@item @code{%s%s%s}%s\n' % ( + member.name, + ': ' if typ else '', + typ if typ else '', + ' (optional)' if member.optional else '') =20 =20 def texi_members(doc, what, member_func): --=20 2.7.4