Update to xcb-proto 1.7. Tested by krw@, mpi@, shadchin@

This commit is contained in:
matthieu 2012-03-27 19:12:47 +00:00
parent fd19764796
commit bfe2e894a1
19 changed files with 3398 additions and 51 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.4 2010/04/18 19:55:51 matthieu Exp $ # $OpenBSD: Makefile,v 1.5 2012/03/27 19:12:47 matthieu Exp $
PKGCONFIG= xcb-proto.pc PKGCONFIG= xcb-proto.pc
@ -21,6 +21,7 @@ FILES= \
sync.xml \ sync.xml \
xc_misc.xml \ xc_misc.xml \
xevie.xml \ xevie.xml \
xkb.xml \
xf86dri.xml \ xf86dri.xml \
xfixes.xml \ xfixes.xml \
xinerama.xml \ xinerama.xml \

View File

@ -1,5 +1,37 @@
Release 1.7 (2012-01-11)
========================
* Add missing padding bytes to ChangeKeyboardMapping request
* Corrected type of FakeInput rootX & rootY fields
* Changed Exception message in case of unknown/unhandled XML tags
* xcbgen: perform lenfield lookup within all anchestors
* Add support for new expr tags popcount, enumref, sumof
* Changed handling of anchestor types
* Assign switch name to bitcases
* Support name attribute for bitcases and set BitcaseType.has_name accordingly
* Use absolute imports in xcbgen for Python 3 compatibilit
* dri2: Update to version 1.3 (v2)
* glx: Replace some 'reserved' fields with explicit padding
* glx: Use glx:CONTEXT for share_list parameter of CreateNewContext
* glx: Use FBCONFIG type for fbconfig parameter of CreateNewContext and CreatePixmap
* glx: Add protocol for GLX_ARB_create_context and GLX_ARB_create_context_profile
* Add support for fence sync objects
* xf86dri: fix GetDrawableInfo reply
* xproto: fix TranslateCoordinates reply
* xcbgen: Add unop support
* xf86vidmode: Fix padding expressions
* dri2: Add proper padding before driver_name
* Add libdir/exec_prefix to xcb-xproto.pc
* Revive support for hex literals in protocol
* Add description of new protocol elements
* Add XKEYBOARD protocol description
* Fix ChangeHosts address string
* Fix SetFontPath path string encoding
* Fix some fields name
* Fix XKB GetState missing lookupMods field
* Add RENDER 0.11 definitions
Release 1.6 (2009-12-02) Release 1.6 (2009-12-02)
======================= ========================
* Add DRI2 protocol, based off of dri2proto.h and the server code. (v2) * Add DRI2 protocol, based off of dri2proto.h and the server code. (v2)
* xf86dri.xml seems to have been wrong forever. Fixes bug #16894. * xf86dri.xml seems to have been wrong forever. Fixes bug #16894.
* shape: add missing padding bytes to GetRectangles * shape: add missing padding bytes to GetRectangles

View File

@ -3,7 +3,7 @@
AC_PREREQ(2.57) AC_PREREQ(2.57)
AC_INIT([XCB Proto], AC_INIT([XCB Proto],
1.6, 1.7,
[xcb@lists.freedesktop.org]) [xcb@lists.freedesktop.org])
AC_CONFIG_SRCDIR([xcb-proto.pc.in]) AC_CONFIG_SRCDIR([xcb-proto.pc.in])
AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_INIT_AUTOMAKE([foreign dist-bzip2])

View File

@ -225,8 +225,17 @@ enum; the value is restricted to one of the constants named in the enum.
defining the set of values included, and a list containing these values. defining the set of values included, and a list containing these values.
value-mask-type gives the type of the bitmask; this must be CARD16 or value-mask-type gives the type of the bitmask; this must be CARD16 or
CARD32. value-mask-name gives the field name of the bitmask, and CARD32. value-mask-name gives the field name of the bitmask, and
value-list-name gives the field name of the list of values. value-list-name gives the field name of the list of values. Please use
<switch> instead for new protocol definitions.
<switch name="identifier"> switch expression
<bitcase> bitcase expression, fields </bitcase> </switch>
This element represents conditional inclusion of fields. It can be viewed
as sequence of multiple ifs: if ( switch expression & bitcase expression )
is equal to bitcase expression, bitcase fields are included in structure.
It can be used only as the last field of structure. New protocol definitions
should prefer to use this instead of <valueparam>.
Expressions Expressions
----------- -----------
@ -256,3 +265,22 @@ Expressions
The bit element represents a literal bitmask value in an expression. The bit element represents a literal bitmask value in an expression.
The integer must be in the range 0..31, expanding to (1<<n) in C. The integer must be in the range 0..31, expanding to (1<<n) in C.
<enumref ref="identifier">enum item identifier</enumref>
This element represents a reference to item of enum.
<unop op="operator">expression</unop>
This element represents a unary operator, with the op attribute specifying
which operator. The only supported operation so far is ~, and its semantic
is identical to the corresponding operator in C.
<sumof ref="identifier" />
This element represents a sumation of the elements of the referenced list.
<popcount>expression</popcount>
This element represents the number of bits set in the expression.

View File

@ -21,6 +21,7 @@ xcbinclude_HEADERS = \
xfixes.xml \ xfixes.xml \
xinerama.xml \ xinerama.xml \
xinput.xml \ xinput.xml \
xkb.xml \
xprint.xml \ xprint.xml \
xselinux.xml \ xselinux.xml \
xtest.xml \ xtest.xml \

View File

@ -28,7 +28,7 @@ authorization from the authors.
--> -->
<xcb header="dri2" extension-xname="DRI2" extension-name="DRI2" <xcb header="dri2" extension-xname="DRI2" extension-name="DRI2"
major-version="1" minor-version="1"> major-version="1" minor-version="3">
<import>xproto</import> <import>xproto</import>
<enum name="Attachment"> <enum name="Attachment">
@ -42,10 +42,18 @@ authorization from the authors.
<item name="BufferFakeFrontLeft" /> <item name="BufferFakeFrontLeft" />
<item name="BufferFakeFrontRight" /> <item name="BufferFakeFrontRight" />
<item name="BufferDepthStencil" /> <item name="BufferDepthStencil" />
<item name="BufferHiz" />
</enum> </enum>
<enum name="DriverType"> <enum name="DriverType">
<item name="DRI" /> <item name="DRI" />
<item name="VDPAU" />
</enum>
<enum name="EventType">
<item name="ExchangeComplete"><value>1</value></item>
<item name="BlitComplete"> <value>2</value></item>
<item name="FlipComplete"> <value>3</value></item>
</enum> </enum>
<!-- Types --> <!-- Types -->
@ -85,6 +93,20 @@ authorization from the authors.
<list type="char" name="driver_name"> <list type="char" name="driver_name">
<fieldref>driver_name_length</fieldref> <fieldref>driver_name_length</fieldref>
</list> </list>
<list type="void" name="alignment_pad">
<op op="-">
<op op="&amp;">
<op op="+">
<fieldref>driver_name_length</fieldref>
<value> 3 </value>
</op>
<unop op="~">
<value>3</value>
</unop>
</op>
<fieldref>driver_name_length</fieldref>
</op>
</list>
<list type="char" name="device_name"> <list type="char" name="device_name">
<fieldref>device_name_length</fieldref> <fieldref>device_name_length</fieldref>
</list> </list>
@ -149,4 +171,94 @@ authorization from the authors.
</list> </list>
</reply> </reply>
</request> </request>
<!-- Version 1.2 -->
<request name="SwapBuffers" opcode="8">
<field type="DRAWABLE" name="drawable" />
<field type="CARD32" name="target_msc_hi" />
<field type="CARD32" name="target_msc_lo" />
<field type="CARD32" name="divisor_hi" />
<field type="CARD32" name="divisor_lo" />
<field type="CARD32" name="remainder_hi" />
<field type="CARD32" name="remainder_lo" />
<reply>
<pad bytes="1" />
<field type="CARD32" name="swap_hi" />
<field type="CARD32" name="swap_lo" />
</reply>
</request>
<request name="GetMSC" opcode="9">
<field type="DRAWABLE" name="drawable" />
<reply>
<pad bytes="1" />
<field type="CARD32" name="ust_hi" />
<field type="CARD32" name="ust_lo" />
<field type="CARD32" name="msc_hi" />
<field type="CARD32" name="msc_lo" />
<field type="CARD32" name="sbc_hi" />
<field type="CARD32" name="sbc_lo" />
</reply>
</request>
<request name="WaitMSC" opcode="10">
<field type="DRAWABLE" name="drawable" />
<field type="CARD32" name="target_msc_hi" />
<field type="CARD32" name="target_msc_lo" />
<field type="CARD32" name="divisor_hi" />
<field type="CARD32" name="divisor_lo" />
<field type="CARD32" name="remainder_hi" />
<field type="CARD32" name="remainder_lo" />
<reply>
<pad bytes="1" />
<field type="CARD32" name="ust_hi" />
<field type="CARD32" name="ust_lo" />
<field type="CARD32" name="msc_hi" />
<field type="CARD32" name="msc_lo" />
<field type="CARD32" name="sbc_hi" />
<field type="CARD32" name="sbc_lo" />
</reply>
</request>
<request name="WaitSBC" opcode="11">
<field type="DRAWABLE" name="drawable" />
<field type="CARD32" name="target_sbc_hi" />
<field type="CARD32" name="target_sbc_lo" />
<reply>
<pad bytes="1" />
<field type="CARD32" name="ust_hi" />
<field type="CARD32" name="ust_lo" />
<field type="CARD32" name="msc_hi" />
<field type="CARD32" name="msc_lo" />
<field type="CARD32" name="sbc_hi" />
<field type="CARD32" name="sbc_lo" />
</reply>
</request>
<request name="SwapInterval" opcode="12">
<field type="DRAWABLE" name="drawable" />
<field type="CARD32" name="interval" />
</request>
<!-- Events -->
<event name="BufferSwapComplete" number="0">
<pad bytes="1" />
<field type="CARD16" name="event_type" enum="EventType" />
<pad bytes="2" />
<field type="DRAWABLE" name="drawable" />
<field type="CARD32" name="ust_hi" />
<field type="CARD32" name="ust_lo" />
<field type="CARD32" name="msc_hi" />
<field type="CARD32" name="msc_lo" />
<field type="CARD32" name="sbc" />
</event>
<!-- Version 1.3 -->
<event name="InvalidateBuffers" number="1">
<pad bytes="1" />
<field type="DRAWABLE" name="drawable" />
</event>
</xcb> </xcb>

View File

@ -89,6 +89,7 @@ The patch that fixed this server bug in X.org CVS is here:
<errorcopy name="BadPbuffer" number="10" ref="Generic" /> <errorcopy name="BadPbuffer" number="10" ref="Generic" />
<errorcopy name="BadCurrentDrawable" number="11" ref="Generic" /> <errorcopy name="BadCurrentDrawable" number="11" ref="Generic" />
<errorcopy name="BadWindow" number="12" ref="Generic" /> <errorcopy name="BadWindow" number="12" ref="Generic" />
<errorcopy name="GLXBadProfileARB" number="13" ref="Generic" />
<!-- Events --> <!-- Events -->
<event name="PbufferClobber" number="0"> <event name="PbufferClobber" number="0">
@ -348,7 +349,7 @@ The patch that fixed this server bug in X.org CVS is here:
<request name="CreatePixmap" opcode="22"> <request name="CreatePixmap" opcode="22">
<field type="CARD32" name="screen" /> <field type="CARD32" name="screen" />
<field type="CARD32" name="fbconfig" /> <field type="FBCONFIG" name="fbconfig" />
<field type="xproto:PIXMAP" name="pixmap" /> <field type="xproto:PIXMAP" name="pixmap" />
<field type="glx:PIXMAP" name="glx_pixmap" /> <field type="glx:PIXMAP" name="glx_pixmap" />
<field type="CARD32" name="num_attribs" /> <field type="CARD32" name="num_attribs" />
@ -366,13 +367,12 @@ The patch that fixed this server bug in X.org CVS is here:
<request name="CreateNewContext" opcode="24"> <request name="CreateNewContext" opcode="24">
<field type="glx:CONTEXT" name="context" /> <field type="glx:CONTEXT" name="context" />
<field type="CARD32" name="fbconfig" /> <field type="FBCONFIG" name="fbconfig" />
<field type="CARD32" name="screen" /> <field type="CARD32" name="screen" />
<field type="CARD32" name="render_type" /> <field type="CARD32" name="render_type" />
<field type="CARD32" name="share_list" /> <field type="glx:CONTEXT" name="share_list" />
<field type="BOOL" name="is_direct" /> <field type="BOOL" name="is_direct" />
<field type="CARD8" name="reserved1" /> <pad bytes="3" />
<field type="CARD16" name="reserved2" />
</request> </request>
<request name="QueryContext" opcode="25"> <request name="QueryContext" opcode="25">
@ -463,6 +463,64 @@ The patch that fixed this server bug in X.org CVS is here:
<field type="glx:WINDOW" name="glxwindow" /> <field type="glx:WINDOW" name="glxwindow" />
</request> </request>
<!-- Start of GLX_ARB_create_context and GLX_ARB_create_context_profile
requests. -->
<request name="SetClientInfoARB" opcode="33">
<field type="CARD32" name="major_version" />
<field type="CARD32" name="minor_version" />
<field type="CARD32" name="num_versions" />
<field type="CARD32" name="gl_str_len" />
<field type="CARD32" name="glx_str_len" />
<list type="CARD32" name="gl_versions">
<op op="*">
<fieldref>num_versions</fieldref>
<value>2</value>
</op>
</list>
<list type="char" name="gl_extension_string">
<fieldref>gl_str_len</fieldref>
</list>
<list type="char" name="glx_extension_string">
<fieldref>glx_str_len</fieldref>
</list>
</request>
<request name="CreateContextAttribsARB" opcode="34">
<field type="glx:CONTEXT" name="context" />
<field type="FBCONFIG" name="fbconfig" />
<field type="CARD32" name="screen" />
<field type="glx:CONTEXT" name="share_list" />
<field type="BOOL" name="is_direct" />
<pad bytes="3" />
<field type="CARD32" name="num_attribs" />
<list type="CARD32" name="attribs">
<op op="*">
<fieldref>num_attribs</fieldref>
<value>2</value>
</op>
</list>
</request>
<request name="SetClientInfo2ARB" opcode="35">
<field type="CARD32" name="major_version" />
<field type="CARD32" name="minor_version" />
<field type="CARD32" name="num_versions" />
<field type="CARD32" name="gl_str_len" />
<field type="CARD32" name="glx_str_len" />
<list type="CARD32" name="gl_versions">
<op op="*">
<fieldref>num_versions</fieldref>
<value>3</value>
</op>
</list>
<list type="char" name="gl_extension_string">
<fieldref>gl_str_len</fieldref>
</list>
<list type="char" name="glx_extension_string">
<fieldref>glx_str_len</fieldref>
</list>
</request>
<!-- Requests for GL Non-rendering Commands (single ops) --> <!-- Requests for GL Non-rendering Commands (single ops) -->
<request name="NewList" opcode="101"> <request name="NewList" opcode="101">

View File

@ -5,8 +5,8 @@ All Rights Reserved. See the file COPYING in this directory
for licensing information. for licensing information.
--> -->
<xcb header="render" extension-xname="RENDER" extension-name="Render" <xcb header="render" extension-xname="RENDER" extension-name="Render"
major-version="0" minor-version="10"> major-version="0" minor-version="11">
<!-- supports version 0.10 --> <!-- supports version 0.11 -->
<import>xproto</import> <import>xproto</import>
@ -20,6 +20,7 @@ for licensing information.
</enum> </enum>
<!-- Disjoint* and Conjoint* are new in version 0.2 --> <!-- Disjoint* and Conjoint* are new in version 0.2 -->
<!-- PDF blend modes are new in version 0.11 -->
<enum name="PictOp"> <enum name="PictOp">
<item name="Clear" /> <item name="Clear" />
<item name="Src" /> <item name="Src" />
@ -61,6 +62,23 @@ for licensing information.
<item name="ConjointAtop" /> <item name="ConjointAtop" />
<item name="ConjointAtopReverse" /> <item name="ConjointAtopReverse" />
<item name="ConjointXor" /> <item name="ConjointXor" />
<!-- PDF blend modes are new in version 0.11 -->
<item name="Multiply"><value>48</value></item>
<item name="Screen" />
<item name="Overlay" />
<item name="Darken" />
<item name="Lighten" />
<item name="ColorDodge" />
<item name="ColorBurn" />
<item name="HardLight" />
<item name="SoftLight" />
<item name="Difference" />
<item name="Exclusion" />
<item name="HSLHue" />
<item name="HSLSaturation" />
<item name="HSLColor" />
<item name="HSLLuminosity" />
</enum> </enum>
<enum name="PolyEdge"> <enum name="PolyEdge">

View File

@ -5,7 +5,7 @@ All Rights Reserved. See the file COPYING in this directory
for licensing information. for licensing information.
--> -->
<xcb header="sync" extension-xname="SYNC" extension-name="Sync" <xcb header="sync" extension-xname="SYNC" extension-name="Sync"
major-version="3" minor-version="0"> major-version="3" minor-version="1">
<import>xproto</import> <import>xproto</import>
<xidtype name="ALARM" /> <xidtype name="ALARM" />
@ -18,6 +18,8 @@ for licensing information.
<xidtype name="COUNTER" /> <xidtype name="COUNTER" />
<xidtype name="FENCE" />
<enum name="TESTTYPE"> <enum name="TESTTYPE">
<item name="PositiveTransition" /> <item name="PositiveTransition" />
<item name="NegativeTransition" /> <item name="NegativeTransition" />
@ -173,6 +175,37 @@ for licensing information.
</reply> </reply>
</request> </request>
<request name="CreateFence" opcode="14">
<field type="DRAWABLE" name="drawable" />
<field type="FENCE" name="fence" />
<field type="BOOL" name="initially_triggered" />
</request>
<request name="TriggerFence" opcode="15">
<field type="FENCE" name="fence" />
</request>
<request name="ResetFence" opcode="16">
<field type="FENCE" name="fence" />
</request>
<request name="DestroyFence" opcode="17">
<field type="FENCE" name="fence" />
</request>
<request name="QueryFence" opcode="18">
<field type="FENCE" name="fence" />
<reply>
<pad bytes="1" />
<field type="BOOL" name="triggered" />
<pad bytes="23" />
</reply>
</request>
<request name="AwaitFence" opcode="19">
<list type="FENCE" name="fence_list" />
</request>
<event name="CounterNotify" number="0"> <event name="CounterNotify" number="0">
<field type="CARD8" name="kind" /> <field type="CARD8" name="kind" />
<field type="COUNTER" name="counter" /> <field type="COUNTER" name="counter" />

View File

@ -55,6 +55,37 @@ authorization from the authors.
<xsd:attribute name="mask" type="xsd:string" use="optional" /> <xsd:attribute name="mask" type="xsd:string" use="optional" />
</xsd:complexType> </xsd:complexType>
<!-- case expression -->
<xsd:complexType name="caseexpr">
<xsd:sequence>
<!-- case expression: -->
<xsd:group ref="expression" minOccurs="1" maxOccurs="1" />
<!-- match -->
<xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" />
<xsd:choice>
<xsd:element ref="switch" minOccurs="0" maxOccurs="unbounded" />
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="optional" />
</xsd:complexType>
<!-- switch expression -->
<xsd:complexType name="switchexpr">
<xsd:sequence>
<!-- switch(expression) -->
<xsd:group ref="expression" minOccurs="1" maxOccurs="1" />
<xsd:choice>
<!-- bitcase expression - bit test -->
<xsd:element name="bitcase" type="caseexpr" minOccurs="1" maxOccurs="unbounded" />
</xsd:choice>
<!-- default: -->
<xsd:group ref="fields" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
<xsd:element name="switch" type="switchexpr" />
<!-- field replaces FIELD, PARAM, and REPLY. --> <!-- field replaces FIELD, PARAM, and REPLY. -->
<xsd:element name="field" type="var" /> <xsd:element name="field" type="var" />
@ -89,7 +120,40 @@ authorization from the authors.
</xsd:attribute> </xsd:attribute>
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="unop">
<xsd:complexType>
<xsd:sequence>
<xsd:group ref="expression" />
</xsd:sequence>
<xsd:attribute name="op" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="~" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="fieldref" type="xsd:string" /> <xsd:element name="fieldref" type="xsd:string" />
<xsd:element name="enumref">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="ref" use="required" type="xsd:string" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="popcount">
<xsd:complexType>
<xsd:group ref="expression" />
</xsd:complexType>
</xsd:element>
<xsd:element name="sumof">
<xsd:complexType>
<xsd:attribute name="ref" use="required" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="value" type="dec-or-hex-integer" /> <xsd:element name="value" type="dec-or-hex-integer" />
<xsd:element name="bit" type="xsd:integer" /> <xsd:element name="bit" type="xsd:integer" />
</xsd:choice> </xsd:choice>
@ -126,7 +190,12 @@ authorization from the authors.
<!-- Type for a structure --> <!-- Type for a structure -->
<xsd:complexType name="struct"> <xsd:complexType name="struct">
<xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" /> <xsd:sequence>
<xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" />
<xsd:choice minOccurs="0" maxOccurs="1">
<xsd:element ref="switch" />
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" /> <xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType> </xsd:complexType>
@ -166,12 +235,20 @@ authorization from the authors.
<xsd:element ref="exprfield" /> <xsd:element ref="exprfield" />
<xsd:element ref="valueparam" /> <xsd:element ref="valueparam" />
</xsd:choice> </xsd:choice>
<xsd:choice minOccurs="0" maxOccurs="1">
<xsd:element ref="switch" />
</xsd:choice>
<xsd:element name="reply" minOccurs="0" maxOccurs="1"> <xsd:element name="reply" minOccurs="0" maxOccurs="1">
<xsd:complexType> <xsd:complexType>
<xsd:choice minOccurs="1" maxOccurs="unbounded"> <xsd:sequence>
<xsd:group ref="fields" /> <xsd:choice minOccurs="1" maxOccurs="unbounded">
<xsd:element ref="valueparam" /> <xsd:group ref="fields" />
</xsd:choice> <xsd:element ref="valueparam" />
</xsd:choice>
<xsd:choice minOccurs="0" maxOccurs="1">
<xsd:element ref="switch" />
</xsd:choice>
</xsd:sequence>
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:sequence> </xsd:sequence>

View File

@ -132,10 +132,15 @@ authorization from the authors.
<field type="INT16" name="drawable_size_W" /> <field type="INT16" name="drawable_size_W" />
<field type="INT16" name="drawable_size_H" /> <field type="INT16" name="drawable_size_H" />
<field type="CARD32" name="num_clip_rects" /> <field type="CARD32" name="num_clip_rects" />
<pad bytes="4" /> <field type="INT16" name="back_x" />
<field type="INT16" name="back_y" />
<field type="CARD32" name="num_back_clip_rects" />
<list type="DrmClipRect" name="clip_rects"> <list type="DrmClipRect" name="clip_rects">
<fieldref>num_clip_rects</fieldref> <fieldref>num_clip_rects</fieldref>
</list> </list>
<list type="DrmClipRect" name="back_clip_rects">
<fieldref>num_back_clip_rects</fieldref>
</list>
</reply> </reply>
</request> </request>

2775
proto/xcb-proto/src/xkb.xml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1296,8 +1296,8 @@ authorization from the authors.
<reply> <reply>
<field type="BOOL" name="same_screen" /> <field type="BOOL" name="same_screen" />
<field type="WINDOW" name="child" altenum="Window" /> <field type="WINDOW" name="child" altenum="Window" />
<field type="CARD16" name="dst_x" /> <field type="INT16" name="dst_x" />
<field type="CARD16" name="dst_y" /> <field type="INT16" name="dst_y" />
</reply> </reply>
</request> </request>
@ -1482,7 +1482,10 @@ authorization from the authors.
<request name="SetFontPath" opcode="51"> <request name="SetFontPath" opcode="51">
<pad bytes="1" /> <pad bytes="1" />
<field type="CARD16" name="font_qty" /> <field type="CARD16" name="font_qty" />
<list type="char" name="path" /> <pad bytes="2" />
<list type="STR" name="font">
<fieldref>font_qty</fieldref>
</list>
</request> </request>
<request name="GetFontPath" opcode="52"> <request name="GetFontPath" opcode="52">
@ -2155,6 +2158,7 @@ authorization from the authors.
<field type="CARD8" name="keycode_count" /> <field type="CARD8" name="keycode_count" />
<field type="KEYCODE" name="first_keycode" /> <field type="KEYCODE" name="first_keycode" />
<field type="CARD8" name="keysyms_per_keycode" /> <field type="CARD8" name="keysyms_per_keycode" />
<pad bytes="2" />
<list type="KEYSYM" name="keysyms"> <list type="KEYSYM" name="keysyms">
<op op="*"> <op op="*">
<fieldref>keycode_count</fieldref> <fieldref>keycode_count</fieldref>
@ -2294,7 +2298,7 @@ authorization from the authors.
<field type="CARD8" name="family" enum="Family" /> <field type="CARD8" name="family" enum="Family" />
<pad bytes="1" /> <pad bytes="1" />
<field type="CARD16" name="address_len" /> <field type="CARD16" name="address_len" />
<list type="char" name="address"> <list type="BYTE" name="address">
<fieldref>address_len</fieldref> <fieldref>address_len</fieldref>
</list> </list>
</request> </request>

View File

@ -88,8 +88,8 @@ authorization from the authors.
<field type="CARD32" name="time" /> <field type="CARD32" name="time" />
<field type="WINDOW" name="root" /> <field type="WINDOW" name="root" />
<pad bytes="8" /> <pad bytes="8" />
<field type="CARD16" name="rootX" /> <field type="INT16" name="rootX" />
<field type="CARD16" name="rootY" /> <field type="INT16" name="rootY" />
<pad bytes="7" /> <pad bytes="7" />
<!-- Version 2.2: XInput device --> <!-- Version 2.2: XInput device -->
<field type="CARD8" name="deviceid" /> <field type="CARD8" name="deviceid" />

View File

@ -1,6 +1,8 @@
prefix=@prefix@ prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@ datarootdir=@datarootdir@
datadir=@datadir@ datadir=@datadir@
libdir=@libdir@
xcbincludedir=@xcbincludedir@ xcbincludedir=@xcbincludedir@
pythondir=@pythondir@ pythondir=@pythondir@

View File

@ -26,7 +26,7 @@ class Expression(object):
Represents a mathematical expression for a list length or exprfield. Represents a mathematical expression for a list length or exprfield.
Public fields: Public fields:
op is the operation (text +,*,/,<<) or None. op is the operation (text +,*,/,<<,~) or None.
lhs and rhs are the sub-Expressions if op is set. lhs and rhs are the sub-Expressions if op is set.
lenfield_name is the name of the length field, or None for request lists. lenfield_name is the name of the length field, or None for request lists.
lenfield is the Field object for the length field, or None. lenfield is the Field object for the length field, or None.
@ -40,6 +40,7 @@ class Expression(object):
self.lenfield_name = None self.lenfield_name = None
self.lenfield_type = None self.lenfield_type = None
self.lenfield_parent = None
self.lenfield = None self.lenfield = None
self.lenwire = False self.lenwire = False
self.bitfield = False self.bitfield = False
@ -75,14 +76,52 @@ class Expression(object):
if self.lenfield_name == None: if self.lenfield_name == None:
self.lenfield_name = self.rhs.lenfield_name self.lenfield_name = self.rhs.lenfield_name
elif elt.tag == 'unop':
# Op field. Need to recurse.
self.op = elt.get('op')
self.rhs = Expression(list(elt)[0], parent)
self.lenfield_name = self.rhs.lenfield_name
elif elt.tag == 'value': elif elt.tag == 'value':
# Constant expression # Constant expression
self.nmemb = int(elt.text) self.nmemb = int(elt.text, 0)
elif elt.tag == 'popcount':
self.op = 'popcount'
self.rhs = Expression(list(elt)[0], parent)
self.lenfield_name = self.rhs.lenfield_name
# xcb_popcount returns 'int' - handle the type in the language-specific part
elif elt.tag == 'enumref':
self.op = 'enumref'
self.lenfield_name = (elt.get('ref'), elt.text)
elif elt.tag == 'sumof':
self.op = 'sumof'
self.lenfield_name = elt.get('ref')
else: else:
# Notreached # Notreached
raise Exception('XXX') raise Exception("undefined tag '%s'" % elt.tag)
def fixed_size(self): def fixed_size(self):
return self.nmemb != None return self.nmemb != None
def resolve(self, module, parents):
if self.op == 'enumref':
self.lenfield_type = module.get_type(self.lenfield_name[0])
self.lenfield_name = self.lenfield_name[1]
elif self.op == 'sumof':
# need to find the field with lenfield_name
for p in reversed(parents):
fields = dict([(f.field_name, f) for f in p.fields])
if self.lenfield_name in fields.keys():
if p.is_bitcase:
# switch is the anchestor
self.lenfield_parent = p.parents[-1]
else:
self.lenfield_parent = p
self.lenfield_type = fields[self.lenfield_name].field_type
break

View File

@ -9,14 +9,15 @@ we do not create a new type object, we just record the existing one under a new
from os.path import join from os.path import join
from xml.etree.cElementTree import parse from xml.etree.cElementTree import parse
import state from xcbgen.xtypes import *
from xtypes import *
def import_(node, module, namespace): def import_(node, module, namespace):
''' '''
For imports, we load the file, create a new namespace object, For imports, we load the file, create a new namespace object,
execute recursively, then record the import (for header files, etc.) execute recursively, then record the import (for header files, etc.)
''' '''
# To avoid circular import error
from xcbgen import state
new_file = join(namespace.dir, '%s.xml' % node.text) new_file = join(namespace.dir, '%s.xml' % node.text)
new_root = parse(new_file).getroot() new_root = parse(new_file).getroot()
new_namespace = state.Namespace(new_file) new_namespace = state.Namespace(new_file)

View File

@ -4,9 +4,9 @@ This module contains the namespace class and the singleton module class.
from os.path import dirname, basename from os.path import dirname, basename
from xml.etree.cElementTree import parse from xml.etree.cElementTree import parse
import matcher from xcbgen import matcher
from error import * from xcbgen.error import *
from xtypes import * from xcbgen.xtypes import *
import __main__ import __main__

View File

@ -1,7 +1,7 @@
''' '''
This module contains the classes which represent XCB data types. This module contains the classes which represent XCB data types.
''' '''
from expr import Field, Expression from xcbgen.expr import Field, Expression
import __main__ import __main__
class Type(object): class Type(object):
@ -32,6 +32,8 @@ class Type(object):
self.is_reply = False self.is_reply = False
self.is_union = False self.is_union = False
self.is_pad = False self.is_pad = False
self.is_switch = False
self.is_bitcase = False
def resolve(self, module): def resolve(self, module):
''' '''
@ -73,6 +75,7 @@ class Type(object):
complex_type.fields.append(new_field) complex_type.fields.append(new_field)
class SimpleType(Type): class SimpleType(Type):
''' '''
Derived class which represents a cardinal type like CARD32 or char. Derived class which represents a cardinal type like CARD32 or char.
@ -131,7 +134,7 @@ class Enum(SimpleType):
if value.tag == 'value': if value.tag == 'value':
self.values.append((item.get('name'), value.text)) self.values.append((item.get('name'), value.text))
elif value.tag == 'bit': elif value.tag == 'bit':
self.values.append((item.get('name'), '%u' % (1 << int(value.text)))) self.values.append((item.get('name'), '%u' % (1 << int(value.text, 0))))
self.bits.append((item.get('name'), value.text)) self.bits.append((item.get('name'), value.text))
def resolve(self, module): def resolve(self, module):
@ -152,11 +155,11 @@ class ListType(Type):
parent is the structure type containing the list. parent is the structure type containing the list.
expr is an Expression object containing the length information, for variable-sized lists. expr is an Expression object containing the length information, for variable-sized lists.
''' '''
def __init__(self, elt, member, parent): def __init__(self, elt, member, *parent):
Type.__init__(self, member.name) Type.__init__(self, member.name)
self.is_list = True self.is_list = True
self.member = member self.member = member
self.parent = parent self.parents = list(parent)
if elt.tag == 'list': if elt.tag == 'list':
elts = list(elt) elts = list(elt)
@ -177,9 +180,10 @@ class ListType(Type):
needlen = True needlen = True
# See if the length field is already in the structure. # See if the length field is already in the structure.
for field in self.parent.fields: for parent in self.parents:
if field.field_name == lenfield_name: for field in parent.fields:
needlen = False if field.field_name == lenfield_name:
needlen = False
# It isn't, so we need to add it to the structure ourself. # It isn't, so we need to add it to the structure ourself.
if needlen: if needlen:
@ -194,15 +198,17 @@ class ListType(Type):
if self.resolved: if self.resolved:
return return
self.member.resolve(module) self.member.resolve(module)
self.expr.resolve(module, self.parents)
# Find my length field again. We need the actual Field object in the expr. # Find my length field again. We need the actual Field object in the expr.
# This is needed because we might have added it ourself above. # This is needed because we might have added it ourself above.
if not self.fixed_size(): if not self.fixed_size():
for field in self.parent.fields: for parent in self.parents:
if field.field_name == self.expr.lenfield_name and field.wire: for field in parent.fields:
self.expr.lenfield = field if field.field_name == self.expr.lenfield_name and field.wire:
break self.expr.lenfield = field
break
self.resolved = True self.resolved = True
def fixed_size(self): def fixed_size(self):
@ -215,7 +221,7 @@ class ExprType(Type):
Public fields added: Public fields added:
expr is an Expression object containing the value of the field. expr is an Expression object containing the value of the field.
''' '''
def __init__(self, elt, member, parent): def __init__(self, elt, member, *parent):
Type.__init__(self, member.name) Type.__init__(self, member.name)
self.is_expr = True self.is_expr = True
self.member = member self.member = member
@ -243,7 +249,7 @@ class PadType(Type):
Type.__init__(self, tcard8.name) Type.__init__(self, tcard8.name)
self.is_pad = True self.is_pad = True
self.size = 1 self.size = 1
self.nmemb = 1 if (elt == None) else int(elt.get('bytes')) self.nmemb = 1 if (elt == None) else int(elt.get('bytes'), 0)
def resolve(self, module): def resolve(self, module):
self.resolved = True self.resolved = True
@ -266,6 +272,7 @@ class ComplexType(Type):
self.fields = [] self.fields = []
self.nmemb = 1 self.nmemb = 1
self.size = 0 self.size = 0
self.lenfield_parent = [self]
def resolve(self, module): def resolve(self, module):
if self.resolved: if self.resolved:
@ -288,18 +295,27 @@ class ComplexType(Type):
elif child.tag == 'exprfield': elif child.tag == 'exprfield':
field_name = child.get('name') field_name = child.get('name')
fkey = child.get('type') fkey = child.get('type')
type = ExprType(child, module.get_type(fkey), self) type = ExprType(child, module.get_type(fkey), *self.lenfield_parent)
visible = False visible = False
elif child.tag == 'list': elif child.tag == 'list':
field_name = child.get('name') field_name = child.get('name')
fkey = child.get('type') fkey = child.get('type')
type = ListType(child, module.get_type(fkey), self) type = ListType(child, module.get_type(fkey), *self.lenfield_parent)
visible = True visible = True
elif child.tag == 'valueparam': elif child.tag == 'valueparam':
field_name = child.get('value-list-name') field_name = child.get('value-list-name')
fkey = 'CARD32' fkey = 'CARD32'
type = ListType(child, module.get_type(fkey), self) type = ListType(child, module.get_type(fkey), *self.lenfield_parent)
visible = True visible = True
elif child.tag == 'switch':
field_name = child.get('name')
# construct the switch type name from the parent type and the field name
field_type = self.name + (field_name,)
type = SwitchType(field_type, child, *self.lenfield_parent)
visible = True
type.make_member_of(module, self, field_type, field_name, visible, True, False)
type.resolve(module)
continue
else: else:
# Hit this on Reply # Hit this on Reply
continue continue
@ -331,6 +347,109 @@ class ComplexType(Type):
return False return False
return True return True
class SwitchType(ComplexType):
'''
Derived class which represents a List of Items.
Public fields added:
bitcases is an array of Bitcase objects describing the list items
'''
def __init__(self, name, elt, *parents):
ComplexType.__init__(self, name, elt)
self.parents = parents
# FIXME: switch cannot store lenfields, so it should just delegate the parents
self.lenfield_parent = list(parents) + [self]
# self.fields contains all possible fields collected from the Bitcase objects,
# whereas self.items contains the Bitcase objects themselves
self.bitcases = []
self.is_switch = True
elts = list(elt)
self.expr = Expression(elts[0] if len(elts) else elt, self)
def resolve(self, module):
if self.resolved:
return
# pads = 0
parents = list(self.parents) + [self]
# Resolve all of our field datatypes.
for index, child in enumerate(list(self.elt)):
if child.tag == 'bitcase':
field_name = child.get('name')
if field_name is None:
field_type = self.name + ('bitcase%d' % index,)
else:
field_type = self.name + (field_name,)
# use self.parent to indicate anchestor,
# as switch does not contain named fields itself
type = BitcaseType(index, field_type, child, *parents)
# construct the switch type name from the parent type and the field name
if field_name is None:
type.has_name = False
# Get the full type name for the field
field_type = type.name
visible = True
# add the field to ourself
type.make_member_of(module, self, field_type, field_name, visible, True, False)
# recursively resolve the type (could be another structure, list)
type.resolve(module)
inserted = False
for new_field in type.fields:
# We dump the _placeholder_byte if any fields are added.
for (idx, field) in enumerate(self.fields):
if field == _placeholder_byte:
self.fields[idx] = new_field
inserted = True
break
if False == inserted:
self.fields.append(new_field)
self.calc_size() # Figure out how big we are
self.resolved = True
def make_member_of(self, module, complex_type, field_type, field_name, visible, wire, auto):
if not self.fixed_size():
# We need a length field.
# Ask our Expression object for it's name, type, and whether it's on the wire.
lenfid = self.expr.lenfield_type
lenfield_name = self.expr.lenfield_name
lenwire = self.expr.lenwire
needlen = True
# See if the length field is already in the structure.
for parent in self.parents:
for field in parent.fields:
if field.field_name == lenfield_name:
needlen = False
# It isn't, so we need to add it to the structure ourself.
if needlen:
type = module.get_type(lenfid)
lenfield_type = module.get_type_name(lenfid)
type.make_member_of(module, complex_type, lenfield_type, lenfield_name, True, lenwire, False)
# Add ourself to the structure by calling our original method.
Type.make_member_of(self, module, complex_type, field_type, field_name, visible, wire, auto)
# size for switch can only be calculated at runtime
def calc_size(self):
pass
# note: switch is _always_ of variable size, but we indicate here wether
# it contains elements that are variable-sized themselves
def fixed_size(self):
return False
# for m in self.fields:
# if not m.type.fixed_size():
# return False
# return True
class Struct(ComplexType): class Struct(ComplexType):
''' '''
@ -350,6 +469,48 @@ class Union(ComplexType):
out = __main__.output['union'] out = __main__.output['union']
class BitcaseType(ComplexType):
'''
Derived class representing a struct data type.
'''
def __init__(self, index, name, elt, *parent):
elts = list(elt)
self.expr = Expression(elts[0] if len(elts) else elt, self)
ComplexType.__init__(self, name, elts[1:])
self.has_name = True
self.index = 1
self.lenfield_parent = list(parent) + [self]
self.parents = list(parent)
self.is_bitcase = True
def make_member_of(self, module, switch_type, field_type, field_name, visible, wire, auto):
'''
register BitcaseType with the corresponding SwitchType
module is the global module object.
complex_type is the structure object.
see Field for the meaning of the other parameters.
'''
new_field = Field(self, field_type, field_name, visible, wire, auto)
# We dump the _placeholder_byte if any bitcases are added.
for (idx, field) in enumerate(switch_type.bitcases):
if field == _placeholder_byte:
switch_type.bitcases[idx] = new_field
return
switch_type.bitcases.append(new_field)
def resolve(self, module):
if self.resolved:
return
self.expr.resolve(module, self.parents+[self])
# Resolve the bitcase expression
ComplexType.resolve(self, module)
class Reply(ComplexType): class Reply(ComplexType):
''' '''
Derived class representing a reply. Only found as a field of Request. Derived class representing a reply. Only found as a field of Request.