summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Harris <pharris@opentext.com>2009-11-11 14:41:16 -0500
committerPeter Harris <pharris@opentext.com>2010-02-08 12:22:50 -0500
commit9d03507afa4354ce402333f94d01f6bcb2cf41e6 (patch)
tree6202c1b858b2e0ed7c2c01273c4d5d4db207fb19
parent78e48a24c7df2381269fc6c6accc3b44bc237ab2 (diff)
Add description of new protocol elements
These new elements will be used to support XKEYBOARD (and potentially other troublesome extensions in the future). Thanks to Mariusz Ceier <mceier@gmail.com> for starting this work, and to Google's Summer of Code for sponsoring the initial work. Signed-off-by: Peter Harris <pharris@opentext.com>
-rw-r--r--doc/xml-xcb.txt30
-rw-r--r--src/xcb.xsd86
2 files changed, 110 insertions, 6 deletions
diff --git a/doc/xml-xcb.txt b/doc/xml-xcb.txt
index feb9984..3c6a155 100644
--- a/doc/xml-xcb.txt
+++ b/doc/xml-xcb.txt
@@ -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.
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
- 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
-----------
@@ -256,3 +265,22 @@ Expressions
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.
+
+<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.
+
diff --git a/src/xcb.xsd b/src/xcb.xsd
index f3fcb6f..5169b48 100644
--- a/src/xcb.xsd
+++ b/src/xcb.xsd
@@ -55,6 +55,36 @@ authorization from the authors.
<xsd:attribute name="mask" type="xsd:string" use="optional" />
</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: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. -->
<xsd:element name="field" type="var" />
@@ -89,7 +119,40 @@ authorization from the authors.
</xsd:attribute>
</xsd:complexType>
</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="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="bit" type="xsd:integer" />
</xsd:choice>
@@ -126,7 +189,12 @@ authorization from the authors.
<!-- Type for a structure -->
<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:complexType>
@@ -166,12 +234,20 @@ authorization from the authors.
<xsd:element ref="exprfield" />
<xsd:element ref="valueparam" />
</xsd:choice>
+ <xsd:choice minOccurs="0" maxOccurs="1">
+ <xsd:element ref="switch" />
+ </xsd:choice>
<xsd:element name="reply" minOccurs="0" maxOccurs="1">
<xsd:complexType>
- <xsd:choice minOccurs="1" maxOccurs="unbounded">
- <xsd:group ref="fields" />
- <xsd:element ref="valueparam" />
- </xsd:choice>
+ <xsd:sequence>
+ <xsd:choice minOccurs="1" maxOccurs="unbounded">
+ <xsd:group ref="fields" />
+ <xsd:element ref="valueparam" />
+ </xsd:choice>
+ <xsd:choice minOccurs="0" maxOccurs="1">
+ <xsd:element ref="switch" />
+ </xsd:choice>
+ </xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>