diff options
Diffstat (limited to 'libxcb/src/c_client.py')
-rw-r--r-- | libxcb/src/c_client.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libxcb/src/c_client.py b/libxcb/src/c_client.py index 2d3d78a0b..6241239e6 100644 --- a/libxcb/src/c_client.py +++ b/libxcb/src/c_client.py @@ -162,6 +162,7 @@ def c_open(self): _c('#include <assert.h>')
_c('#include "xcbext.h"')
_c('#include "%s.h"', _ns.header)
+ _c('#include <X11/Xtrans/Xtrans.h>')
if _ns.is_ext:
for (n, h) in self.imports:
@@ -478,7 +479,8 @@ def _c_accessors_field(self, field): _c('%s (const %s *R /**< */)', field.c_accessor_name, self.c_type)
_c('{')
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' return * (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ sizeoftype='char' if field.first_field_after_varsized.type.c_type == 'void' else field.first_field_after_varsized.type.c_type
+ _c(' return * (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, sizeoftype, field.prev_varsized_offset)
_c('}')
else:
_hc('')
@@ -497,7 +499,8 @@ def _c_accessors_field(self, field): _c('%s (const %s *R /**< */)', field.c_accessor_name, self.c_type)
_c('{')
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' return (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ sizeoftype='char' if field.first_field_after_varsized.type.c_type == 'void' else field.first_field_after_varsized.type.c_type
+ _c(' return (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, sizeoftype, field.prev_varsized_offset)
_c('}')
def _c_accessors_list(self, field):
@@ -531,7 +534,8 @@ def _c_accessors_list(self, field): _c(' return (%s *) (R + 1);', field.c_field_type)
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' return (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ sizeoftype='char' if field.first_field_after_varsized.type.c_type == 'void' else field.first_field_after_varsized.type.c_type
+ _c(' return (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, sizeoftype, field.prev_varsized_offset)
_c('}')
@@ -604,7 +608,8 @@ def _c_accessors_list(self, field): _c(' i.data = (%s *) (R + 1);', field.c_field_type)
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' i.data = (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index));', field.c_field_type, field.c_field_type)
+ sizeoftype='char' if field.c_field_type == 'void' else field.c_field_type
+ _c(' i.data = (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index));', field.c_field_type, sizeoftype)
_c(' i.rem = %s;', _c_accessor_get_expr(field.type.expr, 'R'))
_c(' i.index = (char *) i.data - (char *) R;')
@@ -1017,7 +1022,7 @@ except getopt.GetoptError, err: for (opt, arg) in opts:
if opt == '-p':
- sys.path.append(arg)
+ sys.path.insert(0,arg)
# Import the module class
try:
|