summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reimann <oss@arcor.de>2010-07-22 22:53:49 +0200
committerChristoph Reimann <oss@arcor.de>2010-07-22 22:53:49 +0200
commitdd227908abdb36ba630ac9d8a5449470721e38b8 (patch)
tree5c78b9dca5a65a5dfdcc3fd95b50943b5f322316
parent9895cf562c5842813782ce494253c9127e699354 (diff)
support name attribute for bitcases and set BitcaseType.has_name accordingly
-rw-r--r--src/xkb.xml16
-rw-r--r--xcbgen/xtypes.py12
2 files changed, 19 insertions, 9 deletions
diff --git a/src/xkb.xml b/src/xkb.xml
index 33d3ea3..3ccc586 100644
--- a/src/xkb.xml
+++ b/src/xkb.xml
@@ -1973,7 +1973,7 @@ authorization from the authors.
<pad bytes="16" />
<switch name="replies">
<fieldref>reported</fieldref>
- <bitcase>
+ <bitcase name="types">
<enumref ref="GBNDetail">Types</enumref>
<field name="typeDeviceID" type="CARD8" />
<pad bytes="2" />
@@ -2058,7 +2058,7 @@ authorization from the authors.
</bitcase>
</switch>
</bitcase>
- <bitcase>
+ <bitcase name="compat_map">
<enumref ref="GBNDetail">CompatMap</enumref>
<field name="compatDeviceID" type="CARD8" />
<field name="groupsRtrn" type="CARD8" mask="SetOfGroup" />
@@ -2079,7 +2079,7 @@ authorization from the authors.
</popcount>
</list>
</bitcase>
- <bitcase>
+ <bitcase name="client_symbols">
<enumref ref="GBNDetail">ClientSymbols</enumref>
<field name="clientDeviceID" type="CARD8" />
<pad bytes="2" />
@@ -2164,7 +2164,7 @@ authorization from the authors.
</bitcase>
</switch>
</bitcase>
- <bitcase>
+ <bitcase name="server_symbols">
<enumref ref="GBNDetail">ServerSymbols</enumref>
<field name="serverDeviceID" type="CARD8" />
<pad bytes="2" />
@@ -2249,7 +2249,7 @@ authorization from the authors.
</bitcase>
</switch>
</bitcase>
- <bitcase>
+ <bitcase name="indicator_maps">
<enumref ref="GBNDetail">IndicatorMaps</enumref>
<field name="indicatorDeviceID" type="CARD8" />
<field name="which" type="CARD32" />
@@ -2260,7 +2260,7 @@ authorization from the authors.
<fieldref>nIndicators</fieldref>
</list>
</bitcase>
- <bitcase>
+ <bitcase name="key_names">
<enumref ref="GBNDetail">KeyNames</enumref>
<field name="keyDeviceID" type="CARD8" />
<field name="which" type="CARD32" mask="NameDetail" />
@@ -2361,7 +2361,7 @@ authorization from the authors.
</bitcase>
</switch>
</bitcase>
- <bitcase>
+ <bitcase name="other_names">
<enumref ref="GBNDetail">OtherNames</enumref>
<field name="otherDeviceID" type="CARD8" />
<field name="which" type="CARD32" mask="NameDetail" />
@@ -2462,7 +2462,7 @@ authorization from the authors.
</bitcase>
</switch>
</bitcase>
- <bitcase>
+ <bitcase name="geometry">
<enumref ref="GBNDetail">Geometry</enumref>
<field name="geometryDeviceID" type="CARD8" />
<field name="name" type="ATOM" />
diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
index abfb841..363608d 100644
--- a/xcbgen/xtypes.py
+++ b/xcbgen/xtypes.py
@@ -378,16 +378,25 @@ class SwitchType(ComplexType):
# Resolve all of our field datatypes.
for index, child in enumerate(list(self.elt)):
if child.tag == 'bitcase':
+ field_name = child.get('name')
+ # construct the switch type name from the parent type and the field 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, self.name, child, *parents)
+ if field_name is None:
+ type.has_name = False
visible = True
# Get the full type name for the field
field_type = type.name
# add the field to ourself
- type.make_member_of(module, self, field_type, index, visible, True, False)
+ 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)
@@ -470,6 +479,7 @@ class BitcaseType(ComplexType):
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)