[Xcb-commit] xcbgen
Julien Danjou
jdanjou at kemper.freedesktop.org
Fri May 14 02:29:01 PDT 2010
xcbgen/expr.py | 2 +-
xcbgen/xtypes.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
New commits:
commit dae6b32d78f1a4ee30229d7f944ca6528aa50a7d
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date: Fri May 14 04:24:27 2010 +0700
Revive support for hex literals in protocol
As a side-effect it also adds octal and binary literals. Exact syntax is
described at http://docs.python.org/reference/lexical_analysis.html#numbers
It is unwise to use full syntax, as there might be other binding generators,
octal, binary and hex literals seem to be safe though.
Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Signed-off-by: Julien Danjou <julien at danjou.info>
diff --git a/xcbgen/expr.py b/xcbgen/expr.py
index 522e17d..ed4b975 100644
--- a/xcbgen/expr.py
+++ b/xcbgen/expr.py
@@ -77,7 +77,7 @@ class Expression(object):
elif elt.tag == 'value':
# Constant expression
- self.nmemb = int(elt.text)
+ self.nmemb = int(elt.text, 0)
else:
# Notreached
diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
index 01d765e..35fcb91 100644
--- a/xcbgen/xtypes.py
+++ b/xcbgen/xtypes.py
@@ -131,7 +131,7 @@ class Enum(SimpleType):
if value.tag == 'value':
self.values.append((item.get('name'), value.text))
elif value.tag == 'bit':
- self.values.append((item.get('name'), '%u' % (1 << int(value.text))))
+ self.values.append((item.get('name'), '%u' % (1 << int(value.text, 0))))
self.bits.append((item.get('name'), value.text))
def resolve(self, module):
@@ -243,7 +243,7 @@ class PadType(Type):
Type.__init__(self, tcard8.name)
self.is_pad = True
self.size = 1
- self.nmemb = 1 if (elt == None) else int(elt.get('bytes'))
+ self.nmemb = 1 if (elt == None) else int(elt.get('bytes'), 0)
def resolve(self, module):
self.resolved = True
More information about the xcb-commit
mailing list