generator: no type-setup for eventcopies anymore
_c_type_setup is not called for eventcopies anymore: Reasons: * the type-setup of an eventcopy would overwrite members of the original event object such as c_type, ... * it is needed for the next patch, i.e., generating accessors: type_setup would create sizeof-etc funtions which called undefined accessor functions. Sizeof-functions are generated for compatibility: Reason: * Type-setup of eventcopies has previously generated sizeof-functions for eventcopies. So, we still need to generate these functions. These new sizeof-functions simply call the sizeof-function of the defining event of the eventcopy. Message-ID: <1409845851-38950-1-git-send-email-chris@demorecorder.com> Patch-Thread-Subject: [Xcb] support popcount of a list and associated xml changes Patch-Set: PopcountList Patch-Number: libxcb 1/4 Patch-Version: V1 Signed-off-by: Christian Linhart <chris@DemoRecorder.com>
This commit is contained in:
parent
18ff453edd
commit
6234225b4b
|
@ -3075,7 +3075,14 @@ def c_event(self, name):
|
||||||
force_packed = any(f.type.size == 8 and f.type.is_simple for f in self.fields[(idx+1):])
|
force_packed = any(f.type.size == 8 and f.type.is_simple for f in self.fields[(idx+1):])
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if self.name == name:
|
||||||
_c_type_setup(self, name, ('event',))
|
_c_type_setup(self, name, ('event',))
|
||||||
|
else:
|
||||||
|
# no type-setup needed for eventcopies
|
||||||
|
# (the type-setup of an eventcopy would overwrite members of the original
|
||||||
|
# event, and it would create sizeof-etc funtions which
|
||||||
|
# called undefined accessor functions)
|
||||||
|
pass
|
||||||
|
|
||||||
# Opcode define
|
# Opcode define
|
||||||
_c_opcode(name, self.opcodes[name])
|
_c_opcode(name, self.opcodes[name])
|
||||||
|
@ -3088,6 +3095,22 @@ def c_event(self, name):
|
||||||
_h('')
|
_h('')
|
||||||
_h('typedef %s %s;', _t(self.name + ('event',)), _t(name + ('event',)))
|
_h('typedef %s %s;', _t(self.name + ('event',)), _t(name + ('event',)))
|
||||||
|
|
||||||
|
# Create sizeof-function for eventcopies for compatibility reasons
|
||||||
|
if self.c_need_sizeof:
|
||||||
|
_h_setlevel(1)
|
||||||
|
_c_setlevel(1)
|
||||||
|
_h('')
|
||||||
|
_h('int')
|
||||||
|
_h('%s (const void *_buffer /**< */);', _n(name + ('sizeof',)))
|
||||||
|
_c('')
|
||||||
|
_c('int')
|
||||||
|
_c('%s (const void *_buffer /**< */)', _n(name + ('sizeof',)))
|
||||||
|
_c('{');
|
||||||
|
_c(' return %s(_buffer);', _n(self.name + ('sizeof',)))
|
||||||
|
_c('}');
|
||||||
|
_h_setlevel(0)
|
||||||
|
_c_setlevel(0)
|
||||||
|
|
||||||
_man_event(self, name)
|
_man_event(self, name)
|
||||||
|
|
||||||
def c_error(self, name):
|
def c_error(self, name):
|
||||||
|
|
Loading…
Reference in New Issue