"""C basic types"""
-import base
+import stdapi
all_types = {}
-class DumpDeclarator(base.OnceVisitor):
+class DumpDeclarator(stdapi.OnceVisitor):
'''Declare helper functions to dump complex types.'''
def visit_void(self, literal):
for type, name in struct.members:
self.visit(type)
print 'static void __traceStruct%s(const %s &value) {' % (struct.id, struct.expr)
- print ' Log::BeginStruct("%s");' % struct.name
+ print ' Log::BeginStruct(%u);' % len(struct.members)
for type, name in struct.members:
print ' Log::BeginMember("%s");' % (name,)
dump_instance(type, 'value.%s' % (name,))
pass
-class DumpImplementer(base.Visitor):
+class DumpImplementer(stdapi.Visitor):
'''Dump an instance.'''
def visit_literal(self, literal, instance):
-class Wrapper(base.Visitor):
+class Wrapper(stdapi.Visitor):
'''Wrap an instance.'''
def visit_void(self, type, instance):
def trace_function_fail(self, function):
if function.fail is not None:
- if function.type is base.Void:
+ if function.type is stdapi.Void:
assert function.fail == ''
print ' return;'
else:
def trace_function_impl(self, function):
pvalue = self.function_pointer_value(function)
print function.prototype() + ' {'
- if function.type is base.Void:
+ if function.type is stdapi.Void:
result = ''
else:
print ' %s __result;' % function.type
result = '__result = '
self._get_true_pointer(function)
- print ' Log::BeginCall("%s");' % (function.name)
+ print ' unsigned __call = Log::BeginEnter("%s");' % (function.name)
for arg in function.args:
if not arg.output:
self.unwrap_arg(function, arg)
self.dump_arg(function, arg)
+ print ' Log::EndEnter();'
print ' %s%s(%s);' % (result, pvalue, ', '.join([str(arg.name) for arg in function.args]))
+ print ' Log::BeginLeave(__call);'
for arg in function.args:
if arg.output:
self.dump_arg(function, arg)
self.wrap_arg(function, arg)
- if function.type is not base.Void:
+ if function.type is not stdapi.Void:
self.dump_ret(function, "__result")
- print ' Log::EndCall();'
- if function.type is not base.Void:
+ print ' Log::EndLeave();'
+ if function.type is not stdapi.Void:
self.wrap_ret(function, "__result")
print ' return __result;'
print '}'
print
def dump_arg(self, function, arg):
- print ' Log::BeginArg("%s");' % (arg.name,)
+ print ' Log::BeginArg(%u, "%s");' % (arg.index, arg.name,)
dump_instance(arg.type, arg.name)
print ' Log::EndArg();'
print ' %s __result;' % method.type
result = '__result = '
print ' Log::BeginCall("%s");' % (interface.name + '::' + method.name)
- print ' Log::BeginArg("this");'
+ print ' Log::BeginArg(0, "this");'
print ' Log::LiteralOpaque((const void *)m_pInstance);'
print ' Log::EndArg();'
for arg in method.args: