X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace.py;h=81652e5eddb1afd0bf9ec9ffab8be71fe4552c35;hb=933070e4c7dfd94f30f92172f870172d73480a0b;hp=7b8c3daf361a9fb73f41270461455751f78e6bae;hpb=7ebb9e259c7b94bb3aef3a0308a27eb01e0f2ec3;p=apitrace diff --git a/retrace.py b/retrace.py index 7b8c3da..81652e5 100644 --- a/retrace.py +++ b/retrace.py @@ -51,10 +51,8 @@ def handle_entry(handle, value): class ValueExtractor(stdapi.Visitor): def visit_literal(self, literal, lvalue, rvalue): - if literal.format == 'Bool': - print ' %s = static_cast(%s);' % (lvalue, rvalue) - else: - print ' %s = %s;' % (lvalue, rvalue) + #if literal.format in ('Bool', 'UInt'): + print ' %s = (%s).to%s();' % (lvalue, rvalue, literal.format) def visit_const(self, const, lvalue, rvalue): self.visit(const.type, lvalue, rvalue) @@ -63,7 +61,7 @@ class ValueExtractor(stdapi.Visitor): self.visit(alias.type, lvalue, rvalue) def visit_enum(self, enum, lvalue, rvalue): - print ' %s = %s;' % (lvalue, rvalue) + print ' %s = (%s).toSInt();' % (lvalue, rvalue) def visit_bitmask(self, bitmask, lvalue, rvalue): self.visit(bitmask.type, lvalue, rvalue) @@ -188,6 +186,9 @@ class Retracer: print def retrace_function_body(self, function): + if not function.sideeffects: + return + success = True for arg in function.args: arg_type = ConstRemover().visit(arg.type) @@ -243,8 +244,7 @@ class Retracer: functions = filter(self.filter_function, functions) for function in functions: - if function.sideeffects: - self.retrace_function(function) + self.retrace_function(function) print 'void retrace::retrace_call(Trace::Call &call) {' print ' const char *name = call.name().c_str();' @@ -254,8 +254,7 @@ class Retracer: def handle_case(function_name): function = func_dict[function_name] - if function.sideeffects: - print ' retrace_%s(call);' % function.name + print ' retrace_%s(call);' % function.name print ' return;' string_switch('name', func_dict.keys(), handle_case)