_h('')
_h('#define XCB_%s_MAJOR_VERSION %s', _ns.ext_name.upper(), _ns.major_version)
_h('#define XCB_%s_MINOR_VERSION %s', _ns.ext_name.upper(), _ns.minor_version)
_h('')
_h('#define XCB_%s_MAJOR_VERSION %s', _ns.ext_name.upper(), _ns.major_version)
_h('#define XCB_%s_MINOR_VERSION %s', _ns.ext_name.upper(), _ns.minor_version)
self.c_need_sizeof = True
field.c_iterator_type = _t(field.field_type + ('iterator',)) # xcb_fieldtype_iterator_t
self.c_need_sizeof = True
field.c_iterator_type = _t(field.field_type + ('iterator',)) # xcb_fieldtype_iterator_t
# no list with switch as element, so no call to
# _c_iterator(field.type, field_name) necessary
# no list with switch as element, so no call to
# _c_iterator(field.type, field_name) necessary
if self.c_need_serialize:
if self.c_serialize_name not in finished_serializers:
finished_serializers.append(self.c_serialize_name)
if self.c_need_serialize:
if self.c_serialize_name not in finished_serializers:
finished_serializers.append(self.c_serialize_name)
all_fields[f.field_name] = (fname, f)
if f.type.is_container and flat==False:
all_fields[f.field_name] = (fname, f)
if f.type.is_container and flat==False:
tmp_prefix.append((name, sep, obj))
all_fields.update(_c_helper_field_mapping(obj, tmp_prefix, flat=True))
tmp_prefix.append((name, sep, obj))
all_fields.update(_c_helper_field_mapping(obj, tmp_prefix, flat=True))
for n, expr in enumerate(b.type.expr):
bitcase_expr = _c_accessor_get_expr(expr, None)
# only one <enumref> in the <bitcase>
if len_expr == 1:
for n, expr in enumerate(b.type.expr):
bitcase_expr = _c_accessor_get_expr(expr, None)
# only one <enumref> in the <bitcase>
if len_expr == 1:
code_lines.append('%s /* %s.%s */' % (space, self.c_type, field.c_field_name))
else:
scoped_name = [p[2].c_type if idx==0 else p[0] for idx, p in enumerate(prefix)]
code_lines.append('%s /* %s.%s */' % (space, self.c_type, field.c_field_name))
else:
scoped_name = [p[2].c_type if idx==0 else p[0] for idx, p in enumerate(prefix)]
if prev_field_was_variable and need_padding:
# insert padding
# count += _c_serialize_helper_insert_padding(context, code_lines, space,
if prev_field_was_variable and need_padding:
# insert padding
# count += _c_serialize_helper_insert_padding(context, code_lines, space,
count += _c_serialize_helper_insert_padding(context, code_lines, space,
self.c_var_followed_by_fixed_fields)
count += _c_serialize_helper_insert_padding(context, code_lines, space,
self.c_var_followed_by_fixed_fields)
code_lines.append('%s%s' % (space, value))
if field.type.fixed_size():
code_lines.append('%s%s' % (space, value))
if field.type.fixed_size():
# keep track of (un)serialized object's size
code_lines.append('%s xcb_block_len += %s;' % (space, length))
if context in ('unserialize', 'unpack', 'sizeof'):
# keep track of (un)serialized object's size
code_lines.append('%s xcb_block_len += %s;' % (space, length))
if context in ('unserialize', 'unpack', 'sizeof'):
switch_obj = self.parents[-1]
if switch_obj is not None:
c_type = switch_obj.c_type
switch_obj = self.parents[-1]
if switch_obj is not None:
c_type = switch_obj.c_type
# the reason is that switch is either a child of a request/reply or nested in another switch,
# so whenever we need to access a length field, we might need to refer to some anchestor type
switch_obj = self if self.is_switch else None
# the reason is that switch is either a child of a request/reply or nested in another switch,
# so whenever we need to access a length field, we might need to refer to some anchestor type
switch_obj = self if self.is_switch else None
switch_obj = self.parents[-1]
if switch_obj is not None:
c_type = switch_obj.c_type
switch_obj = self.parents[-1]
if switch_obj is not None:
c_type = switch_obj.c_type
for p in parents[2:] + [self]:
# the separator between parent and child is always '.' here,
# because of nested switch statements
for p in parents[2:] + [self]:
# the separator between parent and child is always '.' here,
# because of nested switch statements
prefix.append((p.name[-1], '.', p))
fields.update(_c_helper_field_mapping(p, prefix, flat=True))
prefix.append((p.name[-1], '.', p))
fields.update(_c_helper_field_mapping(p, prefix, flat=True))
if checked:
_h(' * This form can be used only if the request will not cause')
_h(' * a reply to be generated. Any returned error will be')
if checked:
_h(' * This form can be used only if the request will not cause')
_h(' * a reply to be generated. Any returned error will be')
_c(' /* opcode */ %s,', self.c_request_name.upper())
_c(' /* isvoid */ %d', 1 if void else 0)
_c(' };')
_c(' /* opcode */ %s,', self.c_request_name.upper())
_c(' /* isvoid */ %d', 1 if void else 0)
_c(' };')
_c(' struct iovec xcb_parts[%d];', dimension)
_c(' %s xcb_ret;', func_cookie)
_c(' struct iovec xcb_parts[%d];', dimension)
_c(' %s xcb_ret;', func_cookie)
if not self.c_var_followed_by_fixed_fields:
_c(' xcb_parts[2].iov_base = (char *) &xcb_out;')
_c(' xcb_parts[2].iov_len = sizeof(xcb_out);')
if not self.c_var_followed_by_fixed_fields:
_c(' xcb_parts[2].iov_base = (char *) &xcb_out;')
_c(' xcb_parts[2].iov_len = sizeof(xcb_out);')
idx = serial_fields.index(field)
aux_var = '&xcb_aux%d' % idx
context = 'serialize' if aux else 'sizeof'
idx = serial_fields.index(field)
aux_var = '&xcb_aux%d' % idx
context = 'serialize' if aux else 'sizeof'
if aux:
serialize_args = get_serialize_args(field.type, aux_var, field.c_field_name, context)
_c(' %s (%s);', field.type.c_serialize_name, serialize_args)
if aux:
serialize_args = get_serialize_args(field.type, aux_var, field.c_field_name, context)
_c(' %s (%s);', field.type.c_serialize_name, serialize_args)
free_calls.append(' free(xcb_aux);')
# no padding necessary - _serialize() keeps track of padding automatically
free_calls.append(' free(xcb_aux);')
# no padding necessary - _serialize() keeps track of padding automatically
for field in param_fields:
if field.isfd:
_c(' xcb_send_fd(c, %s);', field.c_field_name)
for field in param_fields:
if field.isfd:
_c(' xcb_send_fd(c, %s);', field.c_field_name)
_h(' * @param e The xcb_generic_error_t supplied')
_h(' *')
_h(' * Returns the reply of the request asked by')
_h(' * @param e The xcb_generic_error_t supplied')
_h(' *')
_h(' * Returns the reply of the request asked by')
_h(' * The parameter @p e supplied to this function must be NULL if')
_h(' * %s(). is used.', self.c_unchecked_name)
_h(' * Otherwise, it stores the error if any.')
_h(' * The parameter @p e supplied to this function must be NULL if')
_h(' * %s(). is used.', self.c_unchecked_name)
_h(' * Otherwise, it stores the error if any.')
switch_obj = self.parents[-1]
if switch_obj is not None:
c_type = switch_obj.c_type
switch_obj = self.parents[-1]
if switch_obj is not None:
c_type = switch_obj.c_type
# the reason is that switch is either a child of a request/reply or nested in another switch,
# so whenever we need to access a length field, we might need to refer to some anchestor type
switch_obj = self if self.is_switch else None
# the reason is that switch is either a child of a request/reply or nested in another switch,
# so whenever we need to access a length field, we might need to refer to some anchestor type
switch_obj = self if self.is_switch else None
switch_obj = self.parents[-1]
if switch_obj is not None:
c_type = switch_obj.c_type
switch_obj = self.parents[-1]
if switch_obj is not None:
c_type = switch_obj.c_type
for p in parents[2:] + [self]:
# the separator between parent and child is always '.' here,
# because of nested switch statements
for p in parents[2:] + [self]:
# the separator between parent and child is always '.' here,
# because of nested switch statements
prefix.append((p.name[-1], '.', p))
fields.update(_c_helper_field_mapping(p, prefix, flat=True))
prefix.append((p.name[-1], '.', p))
fields.update(_c_helper_field_mapping(p, prefix, flat=True))