[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 31/50] docs: document schema configuration
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v3 31/50] docs: document schema configuration |
Date: |
Mon, 11 Sep 2017 13:06:04 +0200 |
Signed-off-by: Marc-André Lureau <address@hidden>
---
docs/devel/qapi-code-gen.txt | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt
index 0a90f2278a..24fc6f74ee 100644
--- a/docs/devel/qapi-code-gen.txt
+++ b/docs/devel/qapi-code-gen.txt
@@ -682,6 +682,43 @@ Example: Red Hat, Inc. controls redhat.com, and may
therefore add a
downstream command __com.redhat_drive-mirror.
+=== Configuring the schema ===
+
+'struct', 'enum', 'union', 'alternate', 'command' and 'event'
+top-level QAPI expressions can take a 'if' keyword like:
+
+{ 'struct': 'IfStruct', 'data': { 'foo': 'int' },
+ 'if': 'defined(IF_STRUCT) && defined(FOO)' }
+
+Members can be exploded as dictionnary with 'type' & 'if' keys:
+
+{ 'struct': 'IfStruct', 'data':
+ { 'foo': 'int',
+ 'bar': { 'type': 'int', 'if': 'defined(IF_STRUCT_BAR)'} } }
+
+Enum values can be exploded as dictionnary with 'name' & 'if' keys:
+
+{ 'enum': 'IfEnum', 'data':
+ [ 'foo',
+ { 'name' : 'bar', 'if': 'defined(IF_ENUM_BAR)' } ] }
+
+The C code generators will wrap the corresponding lines with #if / #endif
+pre-processor conditions for a given 'if' value.
+
+Example for enum values:
+
+enum IfEnum {
+ IF_ENUM_FOO,
+#if defined(IF_ENUM_BAR)
+ IF_ENUM_BAR,
+#endif /* defined(IF_ENUM_BAR) */
+ IF_ENUM__MAX
+}
+
+Please note that you are responsbile to ensure that the C code will
+compile with an arbitrary combination of conditions, since the
+generators are unable to check it at this point.
+
== Client JSON Protocol introspection ==
Clients of a Client JSON Protocol commonly need to figure out what
--
2.14.1.146.gd35faa819
- [Qemu-devel] [PATCH v3 23/50] qapi: add 'if' to struct members and implicit objects members, (continued)
- [Qemu-devel] [PATCH v3 23/50] qapi: add 'if' to struct members and implicit objects members, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 22/50] tests: add some enum members tests, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 24/50] qapi: add some struct member tests, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 25/50] qapi: add #if conditions to generated struct members, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 27/50] qapi: add #if conditions to generated variants, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 26/50] qapi: add 'if' on union variants, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 28/50] qapi: add 'if' to alternate variant, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 30/50] qapi: add #if conditions to generated alternate variants, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 29/50] qapi: add tests for invalid alternate, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 32/50] qapi2texi: add 'If:' section to generated documentation, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 31/50] docs: document schema configuration,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v3 33/50] qapi2texi: add 'If:' condition to enum values, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 34/50] qapi2texi: add 'If:' condition to struct members, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 35/50] qapi2texi: add condition to variants, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 36/50] qapi: add conditions to VNC type/commands/events on the schema, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 37/50] qapi: add conditions to SPICE type/commands/events on the schema, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 38/50] qapi: add conditions to REPLICATION type/commands on the schema, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 39/50] qapi-commands: don't initialize command list in qmp_init_marshall(), Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 41/50] qapi: add a 'unit' pragma, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 40/50] qapi: add -i/--include filename.h, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 42/50] qapi: add a -u/--unit option to specify which unit to visit, Marc-André Lureau, 2017/09/11