summaryrefslogtreecommitdiff
path: root/docs/newapi.xsl
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2019-01-24 12:23:15 +0100
committerPeter Krempa <pkrempa@redhat.com>2019-01-31 12:02:35 +0100
commit63cbad4e052ad503143e2c056972c838b27062e0 (patch)
tree80223db160c21a88d7bf7ff38c6936ba80a56af2 /docs/newapi.xsl
parent6a306a6b8fba1bb323565354d5f1089fde12ce0d (diff)
downloadlibvirt-63cbad4e052ad503143e2c056972c838b27062e0.tar.gz
docs: Format bit shift and hex notation for bitwise flag enums
Big number itself does not make much sense in some cases. Format the bitshift format as well. Changes our web page docs from: VIR_MIGRATE_POSTCOPY = 32768 : Setting the VIR_MIGRATE_POSTCOPY... VIR_MIGRATE_TLS = 65536 : Setting the VIR_MIGRATE_TLS flag... to: VIR_MIGRATE_POSTCOPY = 32768 (0x8000; 1 << 15) : Setting the VIR_MIGRATE_POSTCOPY... VIR_MIGRATE_TLS = 65536 (0x10000; 1 << 16) : Setting the VIR_MIGRATE_TLS flag... Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Diffstat (limited to 'docs/newapi.xsl')
-rw-r--r--docs/newapi.xsl22
1 files changed, 20 insertions, 2 deletions
diff --git a/docs/newapi.xsl b/docs/newapi.xsl
index 8d4c032c03..c808fe5ff8 100644
--- a/docs/newapi.xsl
+++ b/docs/newapi.xsl
@@ -288,6 +288,24 @@
</xsl:choose>
</xsl:template>
+ <xsl:template name="enumvalue">
+ <xsl:param name="value" select="@value"/>
+ <xsl:param name="valuehex" select="@value_hex"/>
+ <xsl:param name="valuebitshift" select="@value_bitshift"/>
+ <xsl:value-of select="@value"/>
+ <xsl:if test="$valuehex != '' or $valuebitshift != ''">
+ <xsl:text> (</xsl:text>
+ <xsl:if test="$valuehex != ''">
+ <xsl:value-of select="@value_hex"/>
+ </xsl:if>
+ <xsl:if test="$valuebitshift != ''">
+ <xsl:text>; 1 &lt;&lt; </xsl:text>
+ <xsl:value-of select="@value_bitshift"/>
+ </xsl:if>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
<xsl:template match="typedef[@type = 'enum']">
<xsl:variable name="name" select="string(@name)"/>
<h3><a name="{$name}"><code><xsl:value-of select="$name"/></code></a></h3>
@@ -306,7 +324,7 @@
<td><xsl:text> = </xsl:text></td>
<xsl:choose>
<xsl:when test="@info != ''">
- <td><xsl:value-of select="@value"/></td>
+ <td class="enumvalue"><xsl:call-template name="enumvalue"/></td>
<td>
<div class="comment">
<xsl:call-template name="dumptext">
@@ -316,7 +334,7 @@
</td>
</xsl:when>
<xsl:otherwise>
- <td colspan="2"><xsl:value-of select="@value"/></td>
+ <td colspan="2" class="enumvalue"><xsl:call-template name="enumvalue"/></td>
</xsl:otherwise>
</xsl:choose>
</tr>