[Xcb] [PATCH 1/2] Support unary operator (only bitwise NOT for now).

Arnaud Fontaine arnaud at andesi.org
Wed Jan 25 00:07:41 PST 2012


From: Arnaud Fontaine <arnau at debian.org>

---
 src/py_client.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/py_client.py b/src/py_client.py
index 961c60c..ac8099b 100755
--- a/src/py_client.py
+++ b/src/py_client.py
@@ -278,7 +278,11 @@ def _py_get_expr(expr):
     lenexp = _py_get_length_field(expr)
 
     if expr.op != None:
-        return '(' + _py_get_expr(expr.lhs) + ' ' + expr.op + ' ' + _py_get_expr(expr.rhs) + ')'
+        # Check whether this is an unary operator (only bitwise NOT for now)
+        if expr.lhs == None:
+            return '(' + expr.op + ' ' + _py_get_expr(expr.rhs) + ')'
+        else:
+            return '(' + _py_get_expr(expr.lhs) + ' ' + expr.op + ' ' + _py_get_expr(expr.rhs) + ')'
     elif expr.bitfield:
         return 'xcb.popcount(' + lenexp + ')'
     else:
-- 
1.7.8.3



More information about the Xcb mailing list