Further separate dispatching from tracing.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 20 Feb 2011 13:32:19 +0000 (13:32 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Tue, 22 Feb 2011 07:15:58 +0000 (07:15 +0000)
CMakeLists.txt
dispatch.py [new file with mode: 0644]
glproc.py
glxtrace.py
trace.py
wgltrace.py

index 848d737..9aec06f 100644 (file)
@@ -119,7 +119,7 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR})
 add_custom_command (
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
     COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glproc.py > ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
-    DEPENDS glproc.py wglapi.py glxapi.py glapi.py glenum.py stdapi.py
+    DEPENDS glproc.py dispatch.py wglapi.py glxapi.py glapi.py glenum.py stdapi.py
 )
 
 if (WIN32)
diff --git a/dispatch.py b/dispatch.py
new file mode 100644 (file)
index 0000000..bfd332b
--- /dev/null
@@ -0,0 +1,121 @@
+##########################################################################
+#
+# Copyright 2010 VMware, Inc.
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+"""Generate DLL/SO dispatching functions.
+""" 
+
+
+import stdapi
+
+
+def function_pointer_type(function):
+    return '__PFN' + function.name.upper()
+
+
+def function_pointer_value(function):
+    return '__' + function.name + '_ptr'
+
+
+class Dispatcher:
+
+    def header(self):
+        # Must be implemented by derived classes, which should define, declare,
+        # or implement something like:
+        #
+        #  typedef void (*__PROC)(void);
+        #
+        #  static __PROC __getPublicProcAddress(const char *name);
+        #  static __PROC __getPrivateProcAddress(const char *name);
+        #  static void __abort(void);
+        #
+        raise NotImplementedError
+
+    def dispatch_api(self, api):
+        for function in api.functions:
+            self.dispatch_function(function)
+        
+        # define standard name aliases for convenience, but only when not
+        # tracing, as that would cause symbol clashing with the tracing
+        # functions
+        print '#ifdef RETRACE'
+        for function in api.functions:
+            if not self.is_public_function(function):
+                print '#define %s __%s' % (function.name, function.name)
+        print '#endif /* RETRACE */'
+        print
+
+    def dispatch_function(self, function):
+        if self.is_public_function(function):
+            print '#ifndef RETRACE'
+            print
+        ptype = function_pointer_type(function)
+        pvalue = function_pointer_value(function)
+        print 'typedef ' + function.prototype('* %s' % ptype) + ';'
+        print 'static %s %s = NULL;' % (ptype, pvalue)
+        print
+        print 'static inline ' + function.prototype('__' + function.name) + ' {'
+        if function.type is stdapi.Void:
+            ret = ''
+        else:
+            ret = 'return '
+        self.get_true_pointer(function)
+        print '    %s%s(%s);' % (ret, pvalue, ', '.join([str(arg.name) for arg in function.args]))
+        print '}'
+        print
+        if self.is_public_function(function):
+            print '#endif /* !RETRACE */'
+            print
+
+    def is_public_function(self, function):
+        return True
+
+    def get_true_pointer(self, function):
+        ptype = function_pointer_type(function)
+        pvalue = function_pointer_value(function)
+        if self.is_public_function(function):
+            get_proc_address = '__getPublicProcAddress'
+        else:
+            get_proc_address = '__getPrivateProcAddress'
+        print '    if (!%s) {' % (pvalue,)
+        print '        %s = (%s)%s("%s");' % (pvalue, ptype, get_proc_address, function.name)
+        print '        if (!%s) {' % (pvalue,)
+        self.fail_function(function)
+        print '        }'
+        print '    }'
+
+    def fail_function(self, function):
+        print '            OS::DebugMessage("error: unavailable function \\"%s\\"\\n");' % function.name
+        if function.fail is not None:
+            if function.type is stdapi.Void:
+                assert function.fail == ''
+                print '            return;' 
+            else:
+                assert function.fail != ''
+                print '            return %s;' % function.fail
+        else:
+            print '            __abort();'
+
+
index f3dc3d2..fa1db1e 100644 (file)
--- a/glproc.py
+++ b/glproc.py
@@ -30,6 +30,7 @@ covers all the functions we support.
 
 
 import stdapi
+from dispatch import Dispatcher
 from glapi import glapi
 from glxapi import glxapi
 from wglapi import wglapi
@@ -405,90 +406,9 @@ public_symbols = set([
 ])
 
 
-class Dispatcher:
-
-    def header(self):
-        pass
-        #print 'typedef void (*__PROC)(void);'
-        #print
-        #print 'static __PROC __getPublicProcAddress(const char *name);'
-        #print 'static __PROC __getPrivateProcAddress(const char *name);'
-        #print
-
-    def dispatch_api(self, api):
-        for function in api.functions:
-            dispatcher.dispatch_function(function)
-        
-        print '#ifdef RETRACE'
-        for function in api.functions:
-            if not self.is_public_function(function):
-                print '#define %s __%s' % (function.name, function.name)
-        print '#endif /* RETRACE */'
-        print
-
-    def function_pointer_type(self, function):
-        return '__PFN' + function.name.upper()
-
-    def function_pointer_value(self, function):
-        return '__' + function.name + '_ptr'
-
-    def dispatch_function(self, function):
-        if self.is_public_function(function):
-            print '#ifndef RETRACE'
-            print
-        ptype = self.function_pointer_type(function)
-        pvalue = self.function_pointer_value(function)
-        print 'typedef ' + function.prototype('* %s' % ptype) + ';'
-        print 'static %s %s = NULL;' % (ptype, pvalue)
-        print
-        print 'static inline ' + function.prototype('__' + function.name) + ' {'
-        if function.type is stdapi.Void:
-            ret = ''
-        else:
-            ret = 'return '
-        self.get_true_pointer(function)
-        pvalue = self.function_pointer_value(function)
-        print '    %s%s(%s);' % (ret, pvalue, ', '.join([str(arg.name) for arg in function.args]))
-        print '}'
-        print
-        if self.is_public_function(function):
-            print '#endif /* !RETRACE */'
-            print
-
-    def is_public_function(self, function):
-        return True
-
-    def get_true_pointer(self, function):
-        ptype = self.function_pointer_type(function)
-        pvalue = self.function_pointer_value(function)
-        if self.is_public_function(function):
-            get_proc_address = '__getPublicProcAddress'
-        else:
-            get_proc_address = '__getPrivateProcAddress'
-        print '    if (!%s) {' % (pvalue,)
-        print '        %s = (%s)%s("%s");' % (pvalue, ptype, get_proc_address, function.name)
-        print '        if (!%s) {' % (pvalue,)
-        self.fail_function(function)
-        print '        }'
-        print '    }'
-
-    def fail_function(self, function):
-        print '            OS::DebugMessage("error: unavailable function \\"%s\\"\\n");' % function.name
-        if function.fail is not None:
-            if function.type is stdapi.Void:
-                assert function.fail == ''
-                print '            return;' 
-            else:
-                assert function.fail != ''
-                print '            return %s;' % function.fail
-        else:
-            print '            __abort();'
-
-
 class GlDispatcher(Dispatcher):
 
     def header(self):
-        Dispatcher.header(self)
         print '#ifdef RETRACE'
         print '#  ifdef WIN32'
         print '#    define __getPrivateProcAddress(name) wglGetProcAddress(name)'
@@ -515,6 +435,9 @@ class GlDispatcher(Dispatcher):
 
 if __name__ == '__main__':
     print
+    print '#ifndef _GLPROC_HPP_'
+    print '#define _GLPROC_HPP_'
+    print 
     print '#include "glimports.hpp"'
     print '#include "os.hpp"'
     print
@@ -531,56 +454,5 @@ if __name__ == '__main__':
     print
     dispatcher.dispatch_api(glapi)
     print
-    if 0:
-        print '''
-
-#ifdef WIN32
-
-static HINSTANCE g_hDll = NULL;
-
-static __PROC
-__getProcAddress(const char *name)
-{
-    if (!g_hDll) {
-        char szDll[MAX_PATH] = {0};
-        
-        if (!GetSystemDirectoryA(szDll, MAX_PATH)) {
-            return NULL;
-        }
-        
-        strcat(szDll, "\\\\opengl32.dll");
-        
-        g_hDll = LoadLibraryA(szDll);
-        if (!g_hDll) {
-            return NULL;
-        }
-    }
-        
-    return GetProcAddress(g_hDll, name);
-}
-
-#else
-
-static void g_module = NULL;
-
-static __PROC
-__getProcAddress(const char *name)
-{
-    if (!g_module) {
-        g_module = dlopen("libGL.so", RTLD_LAZY);
-        if (!g_module) {
-            return NULL;
-        }
-    }
-        
-    return (__PROC)dlsym(g_module, name);
-}
-
-static inline __PROC
-__glGetProcAddress(const char *name) {
-    return __glXGetProcAddressARB(name);
-}
-
-#endif
-
-    '''
+    print '#endif /* !_GLPROC_HPP_ */'
+    print
index 04680da..a7d0787 100644 (file)
@@ -31,6 +31,7 @@ from stdapi import API
 from glapi import glapi
 from glxapi import glxapi
 from gltrace import GlTracer
+from dispatch import function_pointer_type, function_pointer_value
 
 
 class GlxTracer(GlTracer):
@@ -42,8 +43,8 @@ class GlxTracer(GlTracer):
         if function.name.startswith("glXGetProcAddress"):
             print '    if (%s) {' % instance
             for f in glxapi.functions:
-                ptype = self.function_pointer_type(f)
-                pvalue = self.function_pointer_value(f)
+                ptype = function_pointer_type(f)
+                pvalue = function_pointer_value(f)
                 print '        if(!strcmp("%s", (const char *)procName)) {' % f.name
                 print '            %s = (%s)%s;' % (pvalue, ptype, instance)
                 print '            %s = (%s)&%s;' % (instance, function.type, f.name);
index 01fdeb5..3502258 100644 (file)
--- a/trace.py
+++ b/trace.py
@@ -299,17 +299,7 @@ class Tracer:
     def footer(self, api):
         pass
 
-    def function_pointer_type(self, function):
-        return 'P' + function.name
-
-    def function_pointer_value(self, function):
-        return 'p' + function.name
-
     def trace_function_decl(self, function):
-        ptype = self.function_pointer_type(function)
-        pvalue = self.function_pointer_value(function)
-        print 'typedef ' + function.prototype('* %s' % ptype) + ';'
-        print 'static %s %s = NULL;' % (ptype, pvalue)
         if function.args:
             print '    static const char * __%s_args[%u] = {%s};' % (function.name, len(function.args), ', '.join(['"%s"' % arg.name for arg in function.args]))
         else:
@@ -328,34 +318,24 @@ class Tracer:
         else:
             print '            Trace::Abort();'
 
-    def get_function_address(self, function):
-        raise NotImplementedError
-
-    def _get_true_pointer(self, function):
-        ptype = self.function_pointer_type(function)
-        pvalue = self.function_pointer_value(function)
-        print '    if(!%s) {' % (pvalue,)
-        print '        %s = (%s)%s;' % (pvalue, ptype, self.get_function_address(function))
-        print '        if(!%s)' % (pvalue,)
-        self.trace_function_fail(function)
-        print '    }'
+    def get_dispatch_function(self, function):
+        return '__' + function.name
 
     def trace_function_impl(self, function):
-        pvalue = self.function_pointer_value(function)
         print 'extern "C" ' + function.prototype() + ' {'
         if function.type is stdapi.Void:
             result = ''
         else:
             print '    %s __result;' % function.type
             result = '__result = '
-        self._get_true_pointer(function)
         print '    unsigned __call = Trace::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 '    Trace::EndEnter();'
-        print '    %s%s(%s);' % (result, pvalue, ', '.join([str(arg.name) for arg in function.args]))
+        dispatch = self.get_dispatch_function(function)
+        print '    %s%s(%s);' % (result, dispatch, ', '.join([str(arg.name) for arg in function.args]))
         print '    Trace::BeginLeave(__call);'
         for arg in function.args:
             if arg.output:
index a1c66bb..cef2e1a 100644 (file)
 from stdapi import API
 from glapi import glapi
 from wglapi import wglapi
+from dispatch import function_pointer_type, function_pointer_value
 from gltrace import GlTracer
 from codegen import *
 
 
-public_symbols = set([
-       "glAccum",
-       "glAlphaFunc",
-       "glAreTexturesResident",
-       "glArrayElement",
-       "glBegin",
-       "glBindTexture",
-       "glBitmap",
-       "glBlendFunc",
-       "glCallList",
-       "glCallLists",
-       "glClear",
-       "glClearAccum",
-       "glClearColor",
-       "glClearDepth",
-       "glClearIndex",
-       "glClearStencil",
-       "glClipPlane",
-       "glColor3b",
-       "glColor3bv",
-       "glColor3d",
-       "glColor3dv",
-       "glColor3f",
-       "glColor3fv",
-       "glColor3i",
-       "glColor3iv",
-       "glColor3s",
-       "glColor3sv",
-       "glColor3ub",
-       "glColor3ubv",
-       "glColor3ui",
-       "glColor3uiv",
-       "glColor3us",
-       "glColor3usv",
-       "glColor4b",
-       "glColor4bv",
-       "glColor4d",
-       "glColor4dv",
-       "glColor4f",
-       "glColor4fv",
-       "glColor4i",
-       "glColor4iv",
-       "glColor4s",
-       "glColor4sv",
-       "glColor4ub",
-       "glColor4ubv",
-       "glColor4ui",
-       "glColor4uiv",
-       "glColor4us",
-       "glColor4usv",
-       "glColorMask",
-       "glColorMaterial",
-       "glColorPointer",
-       "glCopyPixels",
-       "glCopyTexImage1D",
-       "glCopyTexImage2D",
-       "glCopyTexSubImage1D",
-       "glCopyTexSubImage2D",
-       "glCullFace",
-#      "glDebugEntry",
-       "glDeleteLists",
-       "glDeleteTextures",
-       "glDepthFunc",
-       "glDepthMask",
-       "glDepthRange",
-       "glDisable",
-       "glDisableClientState",
-       "glDrawArrays",
-       "glDrawBuffer",
-       "glDrawElements",
-       "glDrawPixels",
-       "glEdgeFlag",
-       "glEdgeFlagPointer",
-       "glEdgeFlagv",
-       "glEnable",
-       "glEnableClientState",
-       "glEnd",
-       "glEndList",
-       "glEvalCoord1d",
-       "glEvalCoord1dv",
-       "glEvalCoord1f",
-       "glEvalCoord1fv",
-       "glEvalCoord2d",
-       "glEvalCoord2dv",
-       "glEvalCoord2f",
-       "glEvalCoord2fv",
-       "glEvalMesh1",
-       "glEvalMesh2",
-       "glEvalPoint1",
-       "glEvalPoint2",
-       "glFeedbackBuffer",
-       "glFinish",
-       "glFlush",
-       "glFogf",
-       "glFogfv",
-       "glFogi",
-       "glFogiv",
-       "glFrontFace",
-       "glFrustum",
-       "glGenLists",
-       "glGenTextures",
-       "glGetBooleanv",
-       "glGetClipPlane",
-       "glGetDoublev",
-       "glGetError",
-       "glGetFloatv",
-       "glGetIntegerv",
-       "glGetLightfv",
-       "glGetLightiv",
-       "glGetMapdv",
-       "glGetMapfv",
-       "glGetMapiv",
-       "glGetMaterialfv",
-       "glGetMaterialiv",
-       "glGetPixelMapfv",
-       "glGetPixelMapuiv",
-       "glGetPixelMapusv",
-       "glGetPointerv",
-       "glGetPolygonStipple",
-       "glGetString",
-       "glGetTexEnvfv",
-       "glGetTexEnviv",
-       "glGetTexGendv",
-       "glGetTexGenfv",
-       "glGetTexGeniv",
-       "glGetTexImage",
-       "glGetTexLevelParameterfv",
-       "glGetTexLevelParameteriv",
-       "glGetTexParameterfv",
-       "glGetTexParameteriv",
-       "glHint",
-       "glIndexMask",
-       "glIndexPointer",
-       "glIndexd",
-       "glIndexdv",
-       "glIndexf",
-       "glIndexfv",
-       "glIndexi",
-       "glIndexiv",
-       "glIndexs",
-       "glIndexsv",
-       "glIndexub",
-       "glIndexubv",
-       "glInitNames",
-       "glInterleavedArrays",
-       "glIsEnabled",
-       "glIsList",
-       "glIsTexture",
-       "glLightModelf",
-       "glLightModelfv",
-       "glLightModeli",
-       "glLightModeliv",
-       "glLightf",
-       "glLightfv",
-       "glLighti",
-       "glLightiv",
-       "glLineStipple",
-       "glLineWidth",
-       "glListBase",
-       "glLoadIdentity",
-       "glLoadMatrixd",
-       "glLoadMatrixf",
-       "glLoadName",
-       "glLogicOp",
-       "glMap1d",
-       "glMap1f",
-       "glMap2d",
-       "glMap2f",
-       "glMapGrid1d",
-       "glMapGrid1f",
-       "glMapGrid2d",
-       "glMapGrid2f",
-       "glMaterialf",
-       "glMaterialfv",
-       "glMateriali",
-       "glMaterialiv",
-       "glMatrixMode",
-       "glMultMatrixd",
-       "glMultMatrixf",
-       "glNewList",
-       "glNormal3b",
-       "glNormal3bv",
-       "glNormal3d",
-       "glNormal3dv",
-       "glNormal3f",
-       "glNormal3fv",
-       "glNormal3i",
-       "glNormal3iv",
-       "glNormal3s",
-       "glNormal3sv",
-       "glNormalPointer",
-       "glOrtho",
-       "glPassThrough",
-       "glPixelMapfv",
-       "glPixelMapuiv",
-       "glPixelMapusv",
-       "glPixelStoref",
-       "glPixelStorei",
-       "glPixelTransferf",
-       "glPixelTransferi",
-       "glPixelZoom",
-       "glPointSize",
-       "glPolygonMode",
-       "glPolygonOffset",
-       "glPolygonStipple",
-       "glPopAttrib",
-       "glPopClientAttrib",
-       "glPopMatrix",
-       "glPopName",
-       "glPrioritizeTextures",
-       "glPushAttrib",
-       "glPushClientAttrib",
-       "glPushMatrix",
-       "glPushName",
-       "glRasterPos2d",
-       "glRasterPos2dv",
-       "glRasterPos2f",
-       "glRasterPos2fv",
-       "glRasterPos2i",
-       "glRasterPos2iv",
-       "glRasterPos2s",
-       "glRasterPos2sv",
-       "glRasterPos3d",
-       "glRasterPos3dv",
-       "glRasterPos3f",
-       "glRasterPos3fv",
-       "glRasterPos3i",
-       "glRasterPos3iv",
-       "glRasterPos3s",
-       "glRasterPos3sv",
-       "glRasterPos4d",
-       "glRasterPos4dv",
-       "glRasterPos4f",
-       "glRasterPos4fv",
-       "glRasterPos4i",
-       "glRasterPos4iv",
-       "glRasterPos4s",
-       "glRasterPos4sv",
-       "glReadBuffer",
-       "glReadPixels",
-       "glRectd",
-       "glRectdv",
-       "glRectf",
-       "glRectfv",
-       "glRecti",
-       "glRectiv",
-       "glRects",
-       "glRectsv",
-       "glRenderMode",
-       "glRotated",
-       "glRotatef",
-       "glScaled",
-       "glScalef",
-       "glScissor",
-       "glSelectBuffer",
-       "glShadeModel",
-       "glStencilFunc",
-       "glStencilMask",
-       "glStencilOp",
-       "glTexCoord1d",
-       "glTexCoord1dv",
-       "glTexCoord1f",
-       "glTexCoord1fv",
-       "glTexCoord1i",
-       "glTexCoord1iv",
-       "glTexCoord1s",
-       "glTexCoord1sv",
-       "glTexCoord2d",
-       "glTexCoord2dv",
-       "glTexCoord2f",
-       "glTexCoord2fv",
-       "glTexCoord2i",
-       "glTexCoord2iv",
-       "glTexCoord2s",
-       "glTexCoord2sv",
-       "glTexCoord3d",
-       "glTexCoord3dv",
-       "glTexCoord3f",
-       "glTexCoord3fv",
-       "glTexCoord3i",
-       "glTexCoord3iv",
-       "glTexCoord3s",
-       "glTexCoord3sv",
-       "glTexCoord4d",
-       "glTexCoord4dv",
-       "glTexCoord4f",
-       "glTexCoord4fv",
-       "glTexCoord4i",
-       "glTexCoord4iv",
-       "glTexCoord4s",
-       "glTexCoord4sv",
-       "glTexCoordPointer",
-       "glTexEnvf",
-       "glTexEnvfv",
-       "glTexEnvi",
-       "glTexEnviv",
-       "glTexGend",
-       "glTexGendv",
-       "glTexGenf",
-       "glTexGenfv",
-       "glTexGeni",
-       "glTexGeniv",
-       "glTexImage1D",
-       "glTexImage2D",
-       "glTexParameterf",
-       "glTexParameterfv",
-       "glTexParameteri",
-       "glTexParameteriv",
-       "glTexSubImage1D",
-       "glTexSubImage2D",
-       "glTranslated",
-       "glTranslatef",
-       "glVertex2d",
-       "glVertex2dv",
-       "glVertex2f",
-       "glVertex2fv",
-       "glVertex2i",
-       "glVertex2iv",
-       "glVertex2s",
-       "glVertex2sv",
-       "glVertex3d",
-       "glVertex3dv",
-       "glVertex3f",
-       "glVertex3fv",
-       "glVertex3i",
-       "glVertex3iv",
-       "glVertex3s",
-       "glVertex3sv",
-       "glVertex4d",
-       "glVertex4dv",
-       "glVertex4f",
-       "glVertex4fv",
-       "glVertex4i",
-       "glVertex4iv",
-       "glVertex4s",
-       "glVertex4sv",
-       "glVertexPointer",
-       "glViewport",
-       "wglChoosePixelFormat",
-       "wglCopyContext",
-       "wglCreateContext",
-       "wglCreateLayerContext",
-       "wglDeleteContext",
-       "wglDescribeLayerPlane",
-       "wglDescribePixelFormat",
-       "wglGetCurrentContext",
-       "wglGetCurrentDC",
-       "wglGetDefaultProcAddress",
-       "wglGetLayerPaletteEntries",
-       "wglGetPixelFormat",
-       "wglGetProcAddress",
-       "wglMakeCurrent",
-       "wglRealizeLayerPalette",
-       "wglSetLayerPaletteEntries",
-       "wglSetPixelFormat",
-       "wglShareLists",
-       "wglSwapBuffers",
-       "wglSwapLayerBuffers",
-       "wglSwapMultipleBuffers",
-       "wglUseFontBitmapsA",
-       "wglUseFontBitmapsW",
-       "wglUseFontOutlinesA",
-       "wglUseFontOutlinesW",
-])
+
 
 class WglTracer(GlTracer):
 
@@ -412,8 +50,8 @@ class WglTracer(GlTracer):
 
             def handle_case(function_name):
                 f = func_dict[function_name]
-                ptype = self.function_pointer_type(f)
-                pvalue = self.function_pointer_value(f)
+                ptype = function_pointer_type(f)
+                pvalue = function_pointer_value(f)
                 print '    %s = (%s)%s;' % (pvalue, ptype, instance)
                 print '    %s = (%s)&%s;' % (instance, function.type, f.name);