From nobody Tue Feb 10 16:22:42 2026 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@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.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@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506958605537473.42977372390055; Mon, 2 Oct 2017 08:36:45 -0700 (PDT) Received: from localhost ([::1]:52863 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2lm-0007zA-C0 for importer@patchew.org; Mon, 02 Oct 2017 11:36:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2bd-0007yL-5j for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz2bb-0007xU-PL for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34806) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dz2bb-0007wN-Fx for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:03 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 68EBF7E44A; Mon, 2 Oct 2017 15:26:02 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-91.ams2.redhat.com [10.36.116.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 28ED517977; Mon, 2 Oct 2017 15:26:02 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id C9D5511562EB; Mon, 2 Oct 2017 17:25:52 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 68EBF7E44A Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=armbru@redhat.com From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 17:25:44 +0200 Message-Id: <20171002152552.27999-25-armbru@redhat.com> In-Reply-To: <20171002152552.27999-1-armbru@redhat.com> References: <20171002152552.27999-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 02 Oct 2017 15:26:02 +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] [RFC PATCH 24/32] qapi-options: Generate help string X-BeenThere: qemu-devel@gnu.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@gnu.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" Signed-off-by: Markus Armbruster --- scripts/qapi-options.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/qapi-options.py b/scripts/qapi-options.py index 240c9021c7..820d70f71f 100644 --- a/scripts/qapi-options.py +++ b/scripts/qapi-options.py @@ -13,12 +13,15 @@ from qapi import * =20 =20 class QAPISchemaGenOptionVisitor(QAPISchemaVisitor): + # TODO keep help in source order + # TODO generate the part of help that shows syntax def __init__(self): self.decl =3D None self.defn =3D None self._shortopts =3D None self._longopts =3D None self._cases =3D None + self._help =3D None =20 def visit_begin(self, schema): self.decl =3D '' @@ -26,15 +29,22 @@ class QAPISchemaGenOptionVisitor(QAPISchemaVisitor): self._shortopts =3D '' self._longopts =3D '' self._cases =3D '' + self._help =3D [] =20 def visit_end(self): if self._cases: c_max =3D c_enum_const(args.prefix + 'QAPIOptionKind', '_MAX') + c_help =3D '\n '.join([c_string(h) for h in self._help]) self.decl +=3D mcgen(''' +extern const char %(c_prefix)sqapi_options_help[]; + %(c_prefix)sQAPIOption *%(c_prefix)sqapi_options_parse(int argc, char *arg= v[]); ''', c_prefix=3Dc_name(args.prefix, protect=3DFa= lse)) self.defn +=3D mcgen(''' +const char %(c_prefix)sqapi_options_help[] =3D + %(c_help)s; + %(c_prefix)sQAPIOption *%(c_prefix)sqapi_options_parse(int argc, char *arg= v[]) { static const struct option longopts[] =3D { @@ -72,6 +82,7 @@ class QAPISchemaGenOptionVisitor(QAPISchemaVisitor): } ''', c_prefix=3Dc_name(args.prefix, protect=3DFa= lse), + c_help=3Dc_help, c_shortopts=3Dc_string(self._shortopts), longopts=3Dself._longopts, cases=3Dself._cases, @@ -79,6 +90,7 @@ class QAPISchemaGenOptionVisitor(QAPISchemaVisitor): self._shortopts =3D None self._longopts =3D None self._cases =3D None + self._help =3D None =20 def visit_option(self, name, info, arg_type, short, implied_key, boxed, help_): @@ -140,6 +152,7 @@ case 256 + %(case)s: ''') =20 pop_indent(8) + self._help +=3D help_ =20 =20 args =3D common_argument_parser().parse_args() --=20 2.13.6