[PATCH 1/3] xcbgen: Add unop support

Marcin Kościelnicki koriakin at 0x04.net
Thu May 13 14:05:58 PDT 2010


---
 xcbgen/expr.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/xcbgen/expr.py b/xcbgen/expr.py
index 522e17d..5b3fe7e 100644
--- a/xcbgen/expr.py
+++ b/xcbgen/expr.py
@@ -26,7 +26,7 @@ class Expression(object):
     Represents a mathematical expression for a list length or exprfield.
 
     Public fields:
-    op is the operation (text +,*,/,<<) or None.
+    op is the operation (text +,*,/,<<,~) or None.
     lhs and rhs are the sub-Expressions if op is set.
     lenfield_name is the name of the length field, or None for request lists.
     lenfield is the Field object for the length field, or None.
@@ -75,6 +75,13 @@ class Expression(object):
             if self.lenfield_name == None:
                 self.lenfield_name = self.rhs.lenfield_name
 
+        elif elt.tag == 'unop':
+            # Op field.  Need to recurse.
+            self.op = elt.get('op')
+            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)
-- 
1.7.0.2



More information about the xorg-devel mailing list