summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosh Triplett <josh@freedesktop.org>2006-07-30 22:02:37 -0700
committerJosh Triplett <josh@freedesktop.org>2006-07-30 22:03:50 -0700
commitdbd2d9689305ce5bf24aebd894551bb6b590f6e4 (patch)
treeb8b602bae62300a76e6edc615df38da60563d9e5 /src
parent65ed274f05ba670eb02a55b098aed141fa9611ec (diff)
Implement error handling plan 7.
Needs improvement: should not duplicate the code of every request function.
Diffstat (limited to 'src')
-rw-r--r--src/c-client.xsl51
1 files changed, 36 insertions, 15 deletions
diff --git a/src/c-client.xsl b/src/c-client.xsl
index e58d990..218e093 100644
--- a/src/c-client.xsl
+++ b/src/c-client.xsl
@@ -217,6 +217,33 @@ authorization from the authors.
<xsl:text>Cookie</xsl:text>
</xsl:template>
+ <xsl:template name="request-function">
+ <xsl:param name="checked" />
+ <xsl:param name="req" />
+ <function>
+ <xsl:attribute name="name">
+ <xsl:text>XCB</xsl:text>
+ <xsl:value-of select="$ext" />
+ <xsl:value-of select="$req/@name" />
+ <xsl:if test="$checked='true' and not($req/reply)">Checked</xsl:if>
+ <xsl:if test="$checked='false' and $req/reply">Unchecked</xsl:if>
+ </xsl:attribute>
+ <xsl:attribute name="type">
+ <xsl:call-template name="cookie-type">
+ <xsl:with-param name="request" select="$req" />
+ </xsl:call-template>
+ </xsl:attribute>
+ <field type="XCBConnection *" name="c" />
+ <xsl:apply-templates select="$req/*[not(self::reply)]" mode="param" />
+ <do-request ref="XCB{$ext}{$req/@name}Req" opcode="{$req/@opcode}"
+ checked="{$checked}">
+ <xsl:if test="$req/reply">
+ <xsl:attribute name="has-reply">true</xsl:attribute>
+ </xsl:if>
+ </do-request>
+ </function>
+ </xsl:template>
+
<xsl:template match="request" mode="pass1">
<xsl:variable name="req" select="." />
<xsl:if test="reply">
@@ -234,20 +261,14 @@ authorization from the authors.
<field type="CARD16" name="length" no-assign="true" />
</middle>
</struct>
- <function name="XCB{$ext}{$req/@name}">
- <xsl:attribute name="type">
- <xsl:call-template name="cookie-type">
- <xsl:with-param name="request" select="$req" />
- </xsl:call-template>
- </xsl:attribute>
- <field type="XCBConnection *" name="c" />
- <xsl:apply-templates select="$req/*[not(self::reply)]" mode="param" />
- <do-request ref="XCB{$ext}{$req/@name}Req" opcode="{$req/@opcode}">
- <xsl:if test="$req/reply">
- <xsl:attribute name="has-reply">true</xsl:attribute>
- </xsl:if>
- </do-request>
- </function>
+ <xsl:call-template name="request-function">
+ <xsl:with-param name="checked" select="'true'" />
+ <xsl:with-param name="req" select="$req" />
+ </xsl:call-template>
+ <xsl:call-template name="request-function">
+ <xsl:with-param name="checked" select="'false'" />
+ <xsl:with-param name="req" select="$req" />
+ </xsl:call-template>
<xsl:if test="reply">
<struct name="XCB{$ext}{@name}Rep">
<field type="BYTE" name="response_type" />
@@ -612,7 +633,7 @@ authorization from the authors.
<l>xcb_ret.sequence = XCBSendRequest(c, <!--
--><xsl:choose>
- <xsl:when test="@has-reply">XCB_REQUEST_CHECKED</xsl:when>
+ <xsl:when test="@checked='true'">XCB_REQUEST_CHECKED</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>, xcb_parts + 2, &amp;xcb_req);</l>
<l>return xcb_ret;</l>