summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Koƛcielnicki <koriakin@0x04.net>2010-05-13 21:05:57 +0000
committerJulien Danjou <julien@danjou.info>2010-05-14 13:19:28 +0200
commite4b746ac13e89b99abd80b3d1fa2a16796da3b6d (patch)
tree6c93fc06ed77f81764846335cb53aea12b6a8ac8
parent5e86cb05666c448de2f61c23ae94e94ef4b38d64 (diff)
Add ~ operator support in code generator
Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Julien Danjou <julien@danjou.info>
-rwxr-xr-xsrc/c_client.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/c_client.py b/src/c_client.py
index d86d05e..4f3b089 100755
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -448,7 +448,9 @@ def _c_accessor_get_expr(expr, prefix=''):
'''
lenexp = _c_accessor_get_length(expr, prefix)
- if expr.op != None:
+ if expr.op == '~':
+ return '(' + '~' + _c_accessor_get_expr(expr.rhs, prefix) + ')'
+ elif expr.op != None:
return '(' + _c_accessor_get_expr(expr.lhs, prefix) + ' ' + expr.op + ' ' + _c_accessor_get_expr(expr.rhs, prefix) + ')'
elif expr.bitfield:
return 'xcb_popcount(' + lenexp + ')'