Define and use constants for opcode numbers.
authorZephaniah E. Hull <warp@aehallh.com>
Sun, 15 Oct 2006 02:52:23 +0000 (19:52 -0700)
committerJamey Sharp <jamey@minilop.net>
Sun, 15 Oct 2006 02:52:23 +0000 (19:52 -0700)
Hard coding the opcode numbers in the function just makes it harder to figure
out what's going on, but much more to the point, not defining the opcodes in
the header makes it impossible to use the generated headers instead of the
x11proto headers in the server.

The name I settled on is very simple, for an extension by the name of xconf,
and a request by the name of list_devices, we get XCB_XCONF_LIST_DEVICES.  If
this somehow causes problems, we can probably add a _OP somewhere in there,
but.

Acked-by: Jamey Sharp <jamey@minilop.net>
Closes: #8641

src/c-client.xsl

index f9897f7..445a8a6 100644 (file)
@@ -342,7 +342,7 @@ authorization from the authors.
       </xsl:attribute>
       <field type="xcb_connection_t *" name="c" />
       <xsl:apply-templates select="$req/*[not(self::reply)]" mode="param" />
-      <do-request ref="{xcb:xcb-prefix($req/@name)}_request_t" opcode="{$req/@opcode}"
+      <do-request ref="{xcb:xcb-prefix($req/@name)}_request_t" opcode="{translate(xcb:xcb-prefix($req/@name), $lcase, $ucase)}"
                   checked="{$checked}">
         <xsl:if test="$req/reply">
           <xsl:attribute name="has-reply">true</xsl:attribute>
@@ -358,6 +358,7 @@ authorization from the authors.
         <field type="unsigned int" name="sequence" />
       </struct>
     </xsl:if>
+    <constant type="number" name="{xcb:xcb-prefix($req/@name)}" value="{$req/@opcode}" />
     <struct name="{xcb:xcb-prefix(@name)}_request_t">
       <field type="uint8_t" name="major_opcode" no-assign="true" />
       <xsl:if test="$ext">