diff options
author | marha <marha@users.sourceforge.net> | 2010-12-24 12:41:29 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-12-24 12:41:29 +0000 |
commit | c6539c9f45372fb6518bff17a781effd654bd3f0 (patch) | |
tree | 630e613884689bcab0809125ce0fbb72261b5335 /libxcb/xcb-proto/xcbgen/expr.py | |
parent | 8fd06c45853cb2300105db84e4b722f0e2dad8d2 (diff) | |
download | vcxsrv-c6539c9f45372fb6518bff17a781effd654bd3f0.tar.gz vcxsrv-c6539c9f45372fb6518bff17a781effd654bd3f0.tar.bz2 vcxsrv-c6539c9f45372fb6518bff17a781effd654bd3f0.zip |
xorg-server libx11 libxcb git update 24/12/2010
Diffstat (limited to 'libxcb/xcb-proto/xcbgen/expr.py')
-rw-r--r-- | libxcb/xcb-proto/xcbgen/expr.py | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/libxcb/xcb-proto/xcbgen/expr.py b/libxcb/xcb-proto/xcbgen/expr.py index 9b1855425..bbc5a3fd7 100644 --- a/libxcb/xcb-proto/xcbgen/expr.py +++ b/libxcb/xcb-proto/xcbgen/expr.py @@ -40,6 +40,7 @@ class Expression(object): self.lenfield_name = None
self.lenfield_type = None
+ self.lenfield_parent = None
self.lenfield = None
self.lenwire = False
self.bitfield = False
@@ -81,15 +82,46 @@ class Expression(object): self.rhs = Expression(list(elt)[0], parent)
self.lenfield_name = self.rhs.lenfield_name
-
+
elif elt.tag == 'value':
# Constant expression
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:
# Notreached
- raise Exception('XXX')
-
+ raise Exception("undefined tag '%s'" % elt.tag)
def fixed_size(self):
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
+
|