# Emit a fake function
print ' {'
print ' static const Trace::FunctionSig &__sig = %s ? __glEnableClientState_sig : __glDisableClientState_sig;' % flag_name
- print ' unsigned __call = __writer.beginEnter(&__sig);'
- print ' __writer.beginArg(0);'
+ print ' unsigned __call = Trace::localWriter.beginEnter(&__sig);'
+ print ' Trace::localWriter.beginArg(0);'
dump_instance(glapi.GLenum, enable_name)
- print ' __writer.endArg();'
- print ' __writer.endEnter();'
- print ' __writer.beginLeave(__call);'
- print ' __writer.endLeave();'
+ print ' Trace::localWriter.endArg();'
+ print ' Trace::localWriter.endEnter();'
+ print ' Trace::localWriter.beginLeave(__call);'
+ print ' Trace::localWriter.endLeave();'
print ' }'
print ' return;'
Tracer.dispatch_function(self, function)
def emit_memcpy(self, dest, src, length):
- print ' unsigned __call = __writer.beginEnter(&__memcpy_sig);'
- print ' __writer.beginArg(0);'
- print ' __writer.writeOpaque(%s);' % dest
- print ' __writer.endArg();'
- print ' __writer.beginArg(1);'
- print ' __writer.writeBlob(%s, %s);' % (src, length)
- print ' __writer.endArg();'
- print ' __writer.beginArg(2);'
- print ' __writer.writeUInt(%s);' % length
- print ' __writer.endArg();'
- print ' __writer.endEnter();'
- print ' __writer.beginLeave(__call);'
- print ' __writer.endLeave();'
+ print ' unsigned __call = Trace::localWriter.beginEnter(&__memcpy_sig);'
+ print ' Trace::localWriter.beginArg(0);'
+ print ' Trace::localWriter.writeOpaque(%s);' % dest
+ print ' Trace::localWriter.endArg();'
+ print ' Trace::localWriter.beginArg(1);'
+ print ' Trace::localWriter.writeBlob(%s, %s);' % (src, length)
+ print ' Trace::localWriter.endArg();'
+ print ' Trace::localWriter.beginArg(2);'
+ print ' Trace::localWriter.writeUInt(%s);' % length
+ print ' Trace::localWriter.endArg();'
+ print ' Trace::localWriter.endEnter();'
+ print ' Trace::localWriter.beginLeave(__call);'
+ print ' Trace::localWriter.endLeave();'
buffer_targets = [
'ARRAY_BUFFER',
print ' __glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &__element_array_buffer);'
print ' if (!__element_array_buffer) {'
if isinstance(arg.type, stdapi.Array):
- print ' __writer.beginArray(%s);' % arg.type.length
+ print ' Trace::localWriter.beginArray(%s);' % arg.type.length
print ' for(GLsizei i = 0; i < %s; ++i) {' % arg.type.length
- print ' __writer.beginElement();'
- print ' __writer.writeBlob(%s[i], count[i]*__gl_type_size(type));' % (arg.name)
- print ' __writer.endElement();'
+ print ' Trace::localWriter.beginElement();'
+ print ' Trace::localWriter.writeBlob(%s[i], count[i]*__gl_type_size(type));' % (arg.name)
+ print ' Trace::localWriter.endElement();'
print ' }'
- print ' __writer.endArray();'
+ print ' Trace::localWriter.endArray();'
else:
- print ' __writer.writeBlob(%s, count*__gl_type_size(type));' % (arg.name)
+ print ' Trace::localWriter.writeBlob(%s, count*__gl_type_size(type));' % (arg.name)
print ' } else {'
Tracer.dump_arg_instance(self, function, arg)
print ' }'
print ' GLint __unpack_buffer = 0;'
print ' __glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &__unpack_buffer);'
print ' if (__unpack_buffer) {'
- print ' __writer.writeOpaque(%s);' % arg.name
+ print ' Trace::localWriter.writeOpaque(%s);' % arg.name
print ' } else {'
Tracer.dump_arg_instance(self, function, arg)
print ' }'
# Emit a fake function
self.array_trace_intermezzo(api, uppercase_name)
- print ' unsigned __call = __writer.beginEnter(&__%s_sig);' % (function.name,)
+ print ' unsigned __call = Trace::localWriter.beginEnter(&__%s_sig);' % (function.name,)
for arg in function.args:
assert not arg.output
- print ' __writer.beginArg(%u);' % (arg.index,)
+ print ' Trace::localWriter.beginArg(%u);' % (arg.index,)
if arg.name != 'pointer':
dump_instance(arg.type, arg.name)
else:
- print ' __writer.writeBlob((const void *)%s, __size);' % (arg.name)
- print ' __writer.endArg();'
+ print ' Trace::localWriter.writeBlob((const void *)%s, __size);' % (arg.name)
+ print ' Trace::localWriter.endArg();'
- print ' __writer.endEnter();'
- print ' __writer.beginLeave(__call);'
- print ' __writer.endLeave();'
+ print ' Trace::localWriter.endEnter();'
+ print ' Trace::localWriter.beginLeave(__call);'
+ print ' Trace::localWriter.endLeave();'
print ' }'
print ' }'
self.array_epilog(api, uppercase_name)
print ' size_t __size = __%s_size(%s, maxindex);' % (function.name, arg_names)
# Emit a fake function
- print ' unsigned __call = __writer.beginEnter(&__%s_sig);' % (function.name,)
+ print ' unsigned __call = Trace::localWriter.beginEnter(&__%s_sig);' % (function.name,)
for arg in function.args:
assert not arg.output
- print ' __writer.beginArg(%u);' % (arg.index,)
+ print ' Trace::localWriter.beginArg(%u);' % (arg.index,)
if arg.name != 'pointer':
dump_instance(arg.type, arg.name)
else:
- print ' __writer.writeBlob((const void *)%s, __size);' % (arg.name)
- print ' __writer.endArg();'
+ print ' Trace::localWriter.writeBlob((const void *)%s, __size);' % (arg.name)
+ print ' Trace::localWriter.endArg();'
- print ' __writer.endEnter();'
- print ' __writer.beginLeave(__call);'
- print ' __writer.endLeave();'
+ print ' Trace::localWriter.endEnter();'
+ print ' Trace::localWriter.beginLeave(__call);'
+ print ' Trace::localWriter.endLeave();'
print ' }'
print ' }'
print ' }'
self.fake_call(function, [texture])
def fake_call(self, function, args):
- print ' unsigned __fake_call = __writer.beginEnter(&__%s_sig);' % (function.name,)
+ print ' unsigned __fake_call = Trace::localWriter.beginEnter(&__%s_sig);' % (function.name,)
for arg, instance in zip(function.args, args):
assert not arg.output
- print ' __writer.beginArg(%u);' % (arg.index,)
+ print ' Trace::localWriter.beginArg(%u);' % (arg.index,)
dump_instance(arg.type, instance)
- print ' __writer.endArg();'
- print ' __writer.endEnter();'
- print ' __writer.beginLeave(__fake_call);'
- print ' __writer.endLeave();'
+ print ' Trace::localWriter.endArg();'
+ print ' Trace::localWriter.endEnter();'
+ print ' Trace::localWriter.beginLeave(__fake_call);'
+ print ' Trace::localWriter.endLeave();'
print ' static const Trace::StructSig sig = {'
print ' %u, "%s", %u, members' % (int(struct.id), struct.name, len(struct.members))
print ' };'
- print ' __writer.beginStruct(&sig);'
+ print ' Trace::localWriter.beginStruct(&sig);'
for type, name in struct.members:
dump_instance(type, 'value.%s' % (name,))
- print ' __writer.endStruct();'
+ print ' Trace::localWriter.endStruct();'
print '}'
print
print ' sig = &sig%u;' % i
print ' break;'
print ' default:'
- print ' __writer.writeSInt(value);'
+ print ' Trace::localWriter.writeSInt(value);'
print ' return;'
print ' }'
- print ' __writer.writeEnum(sig);'
+ print ' Trace::localWriter.writeEnum(sig);'
print '}'
print
'''Dump an instance.'''
def visit_literal(self, literal, instance):
- print ' __writer.write%s(%s);' % (literal.format, instance)
+ print ' Trace::localWriter.write%s(%s);' % (literal.format, instance)
def visit_string(self, string, instance):
if string.length is not None:
- print ' __writer.writeString((const char *)%s, %s);' % (instance, string.length)
+ print ' Trace::localWriter.writeString((const char *)%s, %s);' % (instance, string.length)
else:
- print ' __writer.writeString((const char *)%s);' % instance
+ print ' Trace::localWriter.writeString((const char *)%s);' % instance
def visit_const(self, const, instance):
self.visit(const.type, instance)
index = '__i' + array.type.id
print ' if (%s) {' % instance
print ' size_t %s = %s;' % (length, array.length)
- print ' __writer.beginArray(%s);' % length
+ print ' Trace::localWriter.beginArray(%s);' % length
print ' for (size_t %s = 0; %s < %s; ++%s) {' % (index, index, length, index)
- print ' __writer.beginElement();'
+ print ' Trace::localWriter.beginElement();'
self.visit(array.type, '(%s)[%s]' % (instance, index))
- print ' __writer.endElement();'
+ print ' Trace::localWriter.endElement();'
print ' }'
- print ' __writer.endArray();'
+ print ' Trace::localWriter.endArray();'
print ' } else {'
- print ' __writer.writeNull();'
+ print ' Trace::localWriter.writeNull();'
print ' }'
def visit_blob(self, blob, instance):
- print ' __writer.writeBlob(%s, %s);' % (instance, blob.size)
+ print ' Trace::localWriter.writeBlob(%s, %s);' % (instance, blob.size)
def visit_enum(self, enum, instance):
print ' __traceEnum%s(%s);' % (enum.id, instance)
def visit_bitmask(self, bitmask, instance):
- print ' __writer.writeBitmask(&__bitmask%s_sig, %s);' % (bitmask.id, instance)
+ print ' Trace::localWriter.writeBitmask(&__bitmask%s_sig, %s);' % (bitmask.id, instance)
def visit_pointer(self, pointer, instance):
print ' if (%s) {' % instance
- print ' __writer.beginArray(1);'
- print ' __writer.beginElement();'
+ print ' Trace::localWriter.beginArray(1);'
+ print ' Trace::localWriter.beginElement();'
dump_instance(pointer.type, "*" + instance)
- print ' __writer.endElement();'
- print ' __writer.endArray();'
+ print ' Trace::localWriter.endElement();'
+ print ' Trace::localWriter.endArray();'
print ' } else {'
- print ' __writer.writeNull();'
+ print ' Trace::localWriter.writeNull();'
print ' }'
def visit_handle(self, handle, instance):
self.visit(alias.type, instance)
def visit_opaque(self, opaque, instance):
- print ' __writer.writeOpaque((const void *)%s);' % instance
+ print ' Trace::localWriter.writeOpaque((const void *)%s);' % instance
def visit_interface(self, interface, instance):
- print ' __writer.writeOpaque((const void *)&%s);' % instance
+ print ' Trace::localWriter.writeOpaque((const void *)&%s);' % instance
dump_instance = DumpImplementer().visit
self.footer(api)
def header(self, api):
- print 'Trace::LocalWriter __writer;'
- print
+ pass
def footer(self, api):
pass
print
def trace_function_impl_body(self, function):
- print ' unsigned __call = __writer.beginEnter(&__%s_sig);' % (function.name,)
+ print ' unsigned __call = Trace::localWriter.beginEnter(&__%s_sig);' % (function.name,)
for arg in function.args:
if not arg.output:
self.unwrap_arg(function, arg)
self.dump_arg(function, arg)
- print ' __writer.endEnter();'
+ print ' Trace::localWriter.endEnter();'
self.dispatch_function(function)
- print ' __writer.beginLeave(__call);'
+ print ' Trace::localWriter.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 stdapi.Void:
self.dump_ret(function, "__result")
- print ' __writer.endLeave();'
+ print ' Trace::localWriter.endLeave();'
def dispatch_function(self, function):
if function.type is stdapi.Void:
print ' %s%s(%s);' % (result, dispatch, ', '.join([str(arg.name) for arg in function.args]))
def dump_arg(self, function, arg):
- print ' __writer.beginArg(%u);' % (arg.index,)
+ print ' Trace::localWriter.beginArg(%u);' % (arg.index,)
self.dump_arg_instance(function, arg)
- print ' __writer.endArg();'
+ print ' Trace::localWriter.endArg();'
def dump_arg_instance(self, function, arg):
dump_instance(arg.type, arg.name)
unwrap_instance(arg.type, arg.name)
def dump_ret(self, function, instance):
- print ' __writer.beginReturn();'
+ print ' Trace::localWriter.beginReturn();'
dump_instance(function.type, instance)
- print ' __writer.endReturn();'
+ print ' Trace::localWriter.endReturn();'
def wrap_ret(self, function, instance):
wrap_instance(function.type, instance)
print method.prototype(interface_wrap_name(interface) + '::' + method.name) + ' {'
print ' static const char * __args[%u] = {%s};' % (len(method.args) + 1, ', '.join(['"this"'] + ['"%s"' % arg.name for arg in method.args]))
print ' static const Trace::FunctionSig __sig = {%u, "%s", %u, __args};' % (int(method.id), interface.name + '::' + method.name, len(method.args) + 1)
- print ' unsigned __call = __writer.beginEnter(&__sig);'
- print ' __writer.beginArg(0);'
- print ' __writer.writeOpaque((const void *)m_pInstance);'
- print ' __writer.endArg();'
+ print ' unsigned __call = Trace::localWriter.beginEnter(&__sig);'
+ print ' Trace::localWriter.beginArg(0);'
+ print ' Trace::localWriter.writeOpaque((const void *)m_pInstance);'
+ print ' Trace::localWriter.endArg();'
for arg in method.args:
if not arg.output:
self.unwrap_arg(method, arg)
else:
print ' %s __result;' % method.type
result = '__result = '
- print ' __writer.endEnter();'
+ print ' Trace::localWriter.endEnter();'
print ' %sm_pInstance->%s(%s);' % (result, method.name, ', '.join([str(arg.name) for arg in method.args]))
- print ' __writer.beginLeave(__call);'
+ print ' Trace::localWriter.beginLeave(__call);'
for arg in method.args:
if arg.output:
self.dump_arg(method, arg)
self.wrap_arg(method, arg)
if method.type is not stdapi.Void:
- print ' __writer.beginReturn();'
+ print ' Trace::localWriter.beginReturn();'
dump_instance(method.type, "__result")
- print ' __writer.endReturn();'
+ print ' Trace::localWriter.endReturn();'
wrap_instance(method.type, '__result')
- print ' __writer.endLeave();'
+ print ' Trace::localWriter.endLeave();'
if method.name == 'QueryInterface':
print ' if (ppvObj && *ppvObj) {'
print ' if (*ppvObj == m_pInstance) {'