"""Generic retracing code generator."""
-import stdapi
-import glapi
-from codegen import *
+import specs.stdapi as stdapi
+import specs.glapi as glapi
class ConstRemover(stdapi.Rebuilder):
def extract_arg(self, function, arg, arg_type, lvalue, rvalue):
ValueExtractor().visit(arg_type, lvalue, rvalue)
+
+ def extract_opaque_arg(self, function, arg, arg_type, lvalue, rvalue):
+ OpaqueValueExtractor().visit(arg_type, lvalue, rvalue)
def call_function(self, function):
arg_names = ", ".join([arg.name for arg in function.args])
def filter_function(self, function):
return True
+ table_name = 'retrace::callbacks'
+
def retrace_functions(self, functions):
functions = filter(self.filter_function, functions)
for function in functions:
self.retrace_function(function)
- print 'void retrace::retrace_call(Trace::Call &call) {'
- print ' const char *name = call.name().c_str();'
- print
-
- func_dict = dict([(function.name, function) for function in functions])
-
- def handle_case(function_name):
- function = func_dict[function_name]
- print ' retrace_%s(call);' % function.name
- print ' return;'
-
- string_switch('name', func_dict.keys(), handle_case)
-
- print ' retrace_unknown(call);'
- print '}'
+ print 'const retrace::Entry %s[] = {' % self.table_name
+ for function in functions:
+ print ' {"%s", &retrace_%s},' % (function.name, function.name)
+ print ' {NULL, NULL}'
+ print '};'
print