if isinstance(elem_type, stdapi.Interface):
self.visitInterfacePointer(elem_type, instance)
else:
- self.visitPointer(self, pointer, instance)
+ self.visitPointer(pointer, instance)
def visitInterface(self, interface, instance):
raise NotImplementedError
print ' %s _result;' % function.type
self.traceFunctionImplBody(function)
if function.type is not stdapi.Void:
- self.wrapRet(function, "_result")
print ' return _result;'
print '}'
print
if function.type is not stdapi.Void:
self.serializeRet(function, "_result")
print ' trace::localWriter.endLeave();'
+ if function.type is not stdapi.Void:
+ self.wrapRet(function, "_result")
def invokeFunction(self, function, prefix='_', suffix=''):
if function.type is stdapi.Void:
for method in interface.iterMethods():
print " " + method.prototype() + ";"
print
- self.declareWrapperInterfaceVariables(interface)
+ #print "private:"
+ for type, name, value in self.enumWrapperInterfaceVariables(interface):
+ print ' %s %s;' % (type, name)
print "};"
print
- def declareWrapperInterfaceVariables(self, interface):
- #print "private:"
- print " DWORD m_dwMagic;"
- print " %s * m_pInstance;" % (interface.name,)
+ def enumWrapperInterfaceVariables(self, interface):
+ return [
+ ("DWORD", "m_dwMagic", "0xd8365d6c"),
+ ("%s *" % interface.name, "m_pInstance", "pInstance"),
+ ]
def implementWrapperInterface(self, interface):
self.interface = interface
print '%s::%s(%s * pInstance) {' % (getWrapperInterfaceName(interface), getWrapperInterfaceName(interface), interface.name)
- print ' m_dwMagic = 0xd8365d6c;'
- print ' m_pInstance = pInstance;'
+ for type, name, value in self.enumWrapperInterfaceVariables(interface):
+ print ' %s = %s;' % (name, value)
print '}'
print
print '%s::~%s() {' % (getWrapperInterfaceName(interface), getWrapperInterfaceName(interface))
self.wrapArg(method, arg)
if method.type is not stdapi.Void:
- print ' trace::localWriter.beginReturn();'
- self.serializeValue(method.type, "_result")
- print ' trace::localWriter.endReturn();'
- self.wrapValue(method.type, '_result')
+ self.serializeRet(method, '_result')
print ' trace::localWriter.endLeave();'
+ if method.type is not stdapi.Void:
+ self.wrapRet(method, '_result')
+
if method.name == 'Release':
assert method.type is not stdapi.Void
print ' if (!_result)'