X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=xcbgen%2Fexpr.py;h=79ad8f6a0211cb3be2badfb4a2d25be476359567;hb=e7aa34e6b3d846d0508ef08e74ea95d86da047d0;hp=522e17d09a97d71db8e69e99f0ee1ce0a63ebf2e;hpb=7820273c4b00209d5ace8cbfdb1400728e15c158;p=free-sw%2Fxcb%2Fproto diff --git a/xcbgen/expr.py b/xcbgen/expr.py index 522e17d..79ad8f6 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,9 +75,16 @@ 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) + self.nmemb = int(elt.text, 0) else: # Notreached