<xsl:for-each select="/xcb/import">
<path><xsl:value-of select="concat($extension-path, ., '.xml')" /></path>
</xsl:for-each>
- <xsl:choose>
- <xsl:when test="$header='xproto'">
- <path><xsl:value-of select="concat($base-path,
- 'xcb_types.xml')" /></path>
- </xsl:when>
- <xsl:when test="$header='xcb_types'" />
- <xsl:otherwise>
- <path><xsl:value-of select="concat($base-path,
- 'xproto.xml')" /></path>
- <path><xsl:value-of select="concat($base-path,
- 'xcb_types.xml')" /></path>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:if test="not($header='xproto')">
+ <path><xsl:value-of select="concat($base-path, 'xproto.xml')" /></path>
+ </xsl:if>
</xsl:variable>
<xsl:variable name="search-path" select="e:node-set($search-path-rtf)/path"/>
</xsl:template>
<!-- Helper template for requests, that outputs the cookie type. The
- context node must be the request. -->
+ parameter "request" must be the request node, which defaults to the
+ context node. -->
<xsl:template name="cookie-type">
+ <xsl:param name="request" select="." />
<xsl:text>XCB</xsl:text>
<xsl:choose>
- <xsl:when test="reply">
- <xsl:value-of select="concat($ext, @name)" />
+ <xsl:when test="$request/reply">
+ <xsl:value-of select="concat($ext, $request/@name)" />
</xsl:when>
<xsl:otherwise>
<xsl:text>Void</xsl:text>
<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">
<struct name="XCB{$ext}{@name}Cookie">
<field type="unsigned int" name="sequence" />
<field type="CARD16" name="length" no-assign="true" />
</middle>
</struct>
- <function name="XCB{$ext}{@name}">
- <xsl:attribute name="type">
- <xsl:call-template name="cookie-type" />
- </xsl:attribute>
- <field type="XCBConnection *" name="c" />
- <xsl:apply-templates select="*[not(self::reply)]" mode="param" />
- <do-request ref="XCB{$ext}{@name}Req" opcode="{@opcode}">
- <xsl:if test="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" />
<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, &xcb_req);</l>
<l>return xcb_ret;</l>
/*[self::valueparam or self::list]" />
<xsl:if test="not($is-variable)">
<function type="{@type} *" name="{$ref}{$field-name}">
- <field type="{$ref}{$kind} *" name="R" />
+ <field type="const {$ref}{$kind} *" name="R" />
<xsl:choose>
<xsl:when test="$is-first">
<l>return (<xsl:value-of select="@type" /> *) <!--
</function>
</xsl:if>
<function type="int" name="{$ref}{$field-name}Length">
- <field type="{$ref}{$kind} *" name="R" />
+ <field type="const {$ref}{$kind} *" name="R" />
<l>return <xsl:apply-templates mode="output-expression">
<xsl:with-param name="field-prefix" select="'R->'" />
</xsl:apply-templates>;</l>
<xsl:choose>
<xsl:when test="substring(@type, 1, 3) = 'XCB'">
<function type="{@type}Iter" name="{$ref}{$field-name}Iter">
- <field type="{$ref}{$kind} *" name="R" />
+ <field type="const {$ref}{$kind} *" name="R" />
<l><xsl:value-of select="@type" />Iter i;</l>
<xsl:choose>
<xsl:when test="$is-first">
</xsl:choose>
</xsl:variable>
<function type="XCBGenericIter" name="{$ref}{$field-name}End">
- <field type="{$ref}{$kind} *" name="R" />
+ <field type="const {$ref}{$kind} *" name="R" />
<l>XCBGenericIter i;</l>
<xsl:choose>
<xsl:when test="$is-first">