[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 34/51] qapi2texi: add 'If:' condition to enum val
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v4 34/51] qapi2texi: add 'If:' condition to enum values |
Date: |
Thu, 11 Jan 2018 22:32:33 +0100 |
Signed-off-by: Marc-André Lureau <address@hidden>
---
scripts/qapi2texi.py | 5 ++++-
tests/qapi-schema/doc-good.json | 4 +++-
tests/qapi-schema/doc-good.out | 1 +
tests/qapi-schema/doc-good.texi | 2 ++
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py
index 76c336af34..d1e69358f6 100755
--- a/scripts/qapi2texi.py
+++ b/scripts/qapi2texi.py
@@ -128,7 +128,10 @@ def texi_body(doc):
def texi_enum_value(value):
"""Format a table of members item for an enumeration value"""
- return '@item @code{%s}\n' % value.name
+ return '@item @code{%s}%s\n' % (
+ value.name,
+ 'address@hidden:} @code{%s}\n' %
+ ', '.join(value.ifcond) if value.ifcond else '')
def texi_member(member, suffix=''):
diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json
index 984cd8ed06..c7fe08c530 100644
--- a/tests/qapi-schema/doc-good.json
+++ b/tests/qapi-schema/doc-good.json
@@ -55,7 +55,9 @@
#
# @two is undocumented
##
-{ 'enum': 'Enum', 'data': [ 'one', 'two' ], 'if': 'defined(IFCOND)' }
+{ 'enum': 'Enum', 'data':
+ [ { 'name': 'one', 'if': 'defined(IFENUM)' }, 'two' ],
+ 'if': 'defined(IFCOND)' }
##
# @Base:
diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out
index 8c75da180c..74bf60bb83 100644
--- a/tests/qapi-schema/doc-good.out
+++ b/tests/qapi-schema/doc-good.out
@@ -2,6 +2,7 @@ object Base
member base1: Enum optional=False
enum Enum
member one
+ if ['defined(IFENUM)']
member two
if ['defined(IFCOND)']
object Object
diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.texi
index cd422f8a8f..c9988c1305 100644
--- a/tests/qapi-schema/doc-good.texi
+++ b/tests/qapi-schema/doc-good.texi
@@ -81,6 +81,8 @@ Examples:
@b{Values:}
@table @asis
@item @code{one}
address@hidden:} @code{defined(IFENUM)}
+
The @emph{one} @{and address@hidden
@item @code{two}
Not documented
--
2.16.0.rc1.1.gef27df75a1
- [Qemu-devel] [PATCH v4 23/51] qapi: add 'if' to enum members, (continued)
- [Qemu-devel] [PATCH v4 23/51] qapi: add 'if' to enum members, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 25/51] qapi: rename allow_dict to allow_implicit, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 27/51] qapi: add 'if' to implicit struct members, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 26/51] qapi: add a dictionary form with 'type' key for members, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 28/51] qapi: add an error in case a discriminator is conditionnal, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 29/51] qapi: add 'if' on union members, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 30/51] qapi: add 'if' to alternate members, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 31/51] qapi: add #if conditions to generated code, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 32/51] docs: document schema configuration, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 33/51] qapi2texi: add 'If:' section to generated documentation, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 34/51] qapi2texi: add 'If:' condition to enum values,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v4 36/51] qapi2texi: add condition to variants, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 35/51] qapi2texi: add 'If:' condition to struct members, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 37/51] qapi: add conditions to VNC type/commands/events on the schema, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 38/51] qapi: add conditions to SPICE type/commands/events on the schema, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 39/51] qapi: add conditions to REPLICATION type/commands on the schema, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 40/51] qapi-commands: don't initialize command list in qmp_init_marshall(), Marc-André Lureau, 2018/01/11