xcbgen: small fix to store anchestor objects more systematic

xml: small fixes according to Xlib or the spec
This commit is contained in:
Christoph Reimann 2010-08-16 18:32:13 +02:00
parent 854e2a05c7
commit 76ca2c0b15
3 changed files with 24 additions and 10 deletions

View file

@ -401,8 +401,12 @@ authorization from the authors.
<struct name="KTMapEntry">
<field name="active" type="BOOL" />
<!-- Xlib uses a different arrangement of fields
<field name="mods_mask" type="CARD8" mask="ModMask" />
<field name="level" type="CARD8" />
-->
<field name="level" type="CARD8" />
<field name="mods_mask" type="CARD8" mask="ModMask" />
<field name="mods_mods" type="CARD8" mask="ModMask" />
<field name="mods_vmods" type="CARD16" mask="VMod" />
<pad bytes="2" />
@ -1626,7 +1630,11 @@ authorization from the authors.
<bitcase>
<enumref ref="NameDetail">KTLevelNames</enumref>
<list name="nLevelsPerType" type="CARD8">
<fieldref>nKTLevels</fieldref>
<!-- Xlib uses NTypes here -
the spec says nKTLevels is correct, but
it does not work in reality
<fieldref>nKTLevels</fieldref> -->
<fieldref>nTypes</fieldref>
</list>
<list name="ktLevelNames" type="ATOM">
<sumof ref="nLevelsPerType" />
@ -1975,7 +1983,14 @@ authorization from the authors.
<fieldref>reported</fieldref>
<bitcase name="types">
<enumref ref="GBNDetail">Types</enumref>
<!-- from the spec, this has to be a GetMap reply -->
<field name="type" type="CARD8" />
<!-- done 'emulating' GetMap reply header-->
<field name="typeDeviceID" type="CARD8" />
<!-- from the spec, this has to be a GetMap reply -->
<field name="sequence" type="CARD16" />
<field name="length" type="CARD32" />
<!-- done 'emulating' GetMap reply header-->
<pad bytes="2" />
<field name="typeMinKeyCode" type="KEYCODE" />
<field name="typeMaxKeyCode" type="KEYCODE" />

View file

@ -833,7 +833,7 @@ authorization from the authors.
<field type="CARD16" name="class" enum="WindowClass" />
<field type="VISUALID" name="visual" />
<field type="CARD32" name="value_mask" enum="CW" />
<switch name="value_list">
<switch name="value_list" fixed_type="CARD32">
<fieldref>value_mask</fieldref>
<bitcase>
<enumref ref="CW">BackPixmap</enumref>

View file

@ -159,7 +159,7 @@ class ListType(Type):
Type.__init__(self, member.name)
self.is_list = True
self.member = member
self.parent = list(parent)
self.parents = list(parent)
if elt.tag == 'list':
elts = list(elt)
@ -180,7 +180,7 @@ class ListType(Type):
needlen = True
# See if the length field is already in the structure.
for parent in self.parent:
for parent in self.parents:
for field in parent.fields:
if field.field_name == lenfield_name:
needlen = False
@ -198,12 +198,12 @@ class ListType(Type):
if self.resolved:
return
self.member.resolve(module)
self.expr.resolve(module, self.parent)
self.expr.resolve(module, self.parents)
# 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.
if not self.fixed_size():
for parent in self.parent:
for parent in self.parents:
for field in parent.fields:
if field.field_name == self.expr.lenfield_name and field.wire:
self.expr.lenfield = field
@ -357,7 +357,7 @@ class SwitchType(ComplexType):
def __init__(self, name, elt, *parents):
ComplexType.__init__(self, name, elt)
self.parent = parents
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,
@ -373,7 +373,7 @@ class SwitchType(ComplexType):
return
# pads = 0
parents = list(self.parent) + [self]
parents = list(self.parents) + [self]
# Resolve all of our field datatypes.
for index, child in enumerate(list(self.elt)):
@ -413,7 +413,6 @@ class SwitchType(ComplexType):
self.calc_size() # Figure out how big we are
self.resolved = True
# FIXME: really necessary for Switch??
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.
@ -424,7 +423,7 @@ class SwitchType(ComplexType):
needlen = True
# See if the length field is already in the structure.
for parent in self.parent:
for parent in self.parents:
for field in parent.fields:
if field.field_name == lenfield_name:
needlen = False