[Xcb-commit] xcbgen

Peter Harris peterh at kemper.freedesktop.org
Thu May 23 07:52:34 PDT 2013


 xcbgen/xtypes.py |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

New commits:
commit a9a892e9a1b65c47917b746085fcf9d737932f58
Author: Daniel Martin <consume.noise at gmail.com>
Date:   Mon May 13 23:33:03 2013 +0200

    xcbgen: Handle multiple <enumref> in a <bitcase>
    
    Adopt the XML schema change from commit
        ee71d96 Allow multiple <enumref> in a <bitcase>
    and its usage with commit
        b3b5e02 XKB: Fix GetKbdByName.
    
    Signed-off-by: Daniel Martin <consume.noise at gmail.com>
    Signed-off-by: Peter Harris <pharris at opentext.com>

diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
index c97273f..5469cd9 100644
--- a/xcbgen/xtypes.py
+++ b/xcbgen/xtypes.py
@@ -481,8 +481,14 @@ class BitcaseType(ComplexType):
     '''
     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.expr = []
+        fields = []
+        for elt in elts:
+            if elt.tag == 'enumref':
+                self.expr.append(Expression(elt, self))
+            else:
+                fields.append(elt)
+        ComplexType.__init__(self, name, fields)
         self.has_name = True
         self.index = 1
         self.lenfield_parent = list(parent) + [self]
@@ -510,8 +516,9 @@ class BitcaseType(ComplexType):
     def resolve(self, module):
         if self.resolved:
             return
-        
-        self.expr.resolve(module, self.parents+[self])
+
+        for e in self.expr:
+            e.resolve(module, self.parents+[self])
 
         # Resolve the bitcase expression
         ComplexType.resolve(self, module)


More information about the xcb-commit mailing list