elem_type = pointer.type.mutable()
if isinstance(elem_type, stdapi.Interface):
self.visitInterfacePointer(elem_type, instance)
+ elif isinstance(elem_type, stdapi.Alias) and isinstance(elem_type.type, stdapi.Interface):
+ self.visitInterfacePointer(elem_type.type, instance)
else:
self.visitPointer(pointer, instance)
allocated = False
+ def visitStruct(self, struct, instance):
+ if not self.allocated:
+ # Argument is constant. We need to create a non const
+ print ' {'
+ print " %s * _t = static_cast<%s *>(alloca(sizeof *_t));" % (struct, struct)
+ print ' *_t = %s;' % (instance,)
+ assert instance.startswith('*')
+ print ' %s = _t;' % (instance[1:],)
+ instance = '*_t'
+ self.allocated = True
+ try:
+ return ValueWrapper.visitStruct(self, struct, instance)
+ finally:
+ print ' }'
+ else:
+ return ValueWrapper.visitStruct(self, struct, instance)
+
def visitArray(self, array, instance):
if self.allocated or isinstance(instance, stdapi.Interface):
return ValueWrapper.visitArray(self, array, instance)
self.header(api)
# Includes
- for header in api.headers:
- print header
+ for module in api.modules:
+ for header in module.headers:
+ print header
print
# Generate the serializer functions
# Function wrappers
self.interface = None
self.base = None
- map(self.traceFunctionDecl, api.functions)
- map(self.traceFunctionImpl, api.functions)
+ for function in api.getAllFunctions():
+ self.traceFunctionDecl(function)
+ for function in api.getAllFunctions():
+ self.traceFunctionImpl(function)
print
self.footer(api)
return 'true'
if str(function.type) == 'HRESULT':
return 'SUCCEEDED(_result)'
- return 'false'
+ return 'true'
def serializeArg(self, function, arg):
print ' trace::localWriter.beginArg(%u);' % (arg.index,)