X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=wgltrace.py;h=3a49c87b2289ef5524d8e1a99429f75c4ea2c9c1;hb=212718d6191b4a43c710a7979e566dbbb4123585;hp=5ab4c0fa43228f17212cb0b11ac9156475cd3bc6;hpb=0ab4cc048e53fe6e10fa0adecaaf69b10c53b103;p=apitrace diff --git a/wgltrace.py b/wgltrace.py index 5ab4c0f..3a49c87 100644 --- a/wgltrace.py +++ b/wgltrace.py @@ -27,9 +27,9 @@ """WGL tracing code generator.""" -from stdapi import API -from glapi import glapi -from wglapi import wglapi +from specs.stdapi import API +from specs.glapi import glapi +from specs.wglapi import wglapi from dispatch import function_pointer_type, function_pointer_value from gltrace import GlTracer from codegen import * @@ -37,10 +37,9 @@ from codegen import * class WglTracer(GlTracer): - def get_function_address(self, function): - return '__%s' % (function.name,) - def wrap_ret(self, function, instance): + GlTracer.wrap_ret(self, function, instance) + if function.name == "wglGetProcAddress": print ' if (%s) {' % instance @@ -54,7 +53,7 @@ class WglTracer(GlTracer): print ' %s = (%s)&%s;' % (instance, function.type, f.name); def handle_default(): - print ' OS::DebugMessage("apitrace: unknown function \\"%s\\"\\n", lpszProc);' + print ' OS::DebugMessage("apitrace: warning: unknown function \\"%s\\"\\n", lpszProc);' string_switch('lpszProc', func_dict.keys(), handle_case, handle_default) print ' }' @@ -67,13 +66,13 @@ if __name__ == '__main__': print '#include ' print '#include ' print - print '#include "trace_write.hpp"' + print '#include "trace_writer.hpp"' print '#include "os.hpp"' print print ''' static HINSTANCE g_hDll = NULL; -static PROC +PROC __getPublicProcAddress(LPCSTR lpProcName) { if (!g_hDll) { @@ -95,15 +94,15 @@ __getPublicProcAddress(LPCSTR lpProcName) } ''' + print '// To validate our prototypes' + print '#define GL_GLEXT_PROTOTYPES' + print '#define WGL_GLXEXT_PROTOTYPES' + print print '#include "glproc.hpp"' print '#include "glsize.hpp"' print - print 'extern "C" {' - print api = API() api.add_api(glapi) api.add_api(wglapi) tracer = WglTracer() tracer.trace_api(api) - print - print '} /* extern "C" */'