X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=glproc.py;h=7c7beb90e072fba7cfc845cd8237139819d442ef;hb=447f4a55a01e82b0265f44212b8d439fa83750d7;hp=067017b7f9bdf9a89deb327ec21fde385fed48d8;hpb=4364860d389bf273bcfce9c5286cc7a3642469c9;p=apitrace diff --git a/glproc.py b/glproc.py index 067017b..7c7beb9 100644 --- a/glproc.py +++ b/glproc.py @@ -411,19 +411,22 @@ class GlDispatcher(Dispatcher): def header(self): print '#ifdef RETRACE' - print '# ifdef _WIN32' + print '# if defined(_WIN32)' print '# define __getPrivateProcAddress(name) wglGetProcAddress(name)' + print '# elif defined(__APPLE__)' + print '# include ' + print '# define __getPrivateProcAddress(name) dlsym(RTLD_DEFAULT, name)' print '# else' print '# define __getPrivateProcAddress(name) glXGetProcAddressARB((const GLubyte *)(name))' print '# endif' - print '# define __abort() OS::Abort()' print '#else /* !RETRACE */' print '# ifdef _WIN32' + print ' PROC __getPublicProcAddress(LPCSTR lpProcName);' print '# define __getPrivateProcAddress(name) __wglGetProcAddress(name)' print ' static inline PROC __stdcall __wglGetProcAddress(const char * lpszProc);' print '# else' - print '# define __getPublicProcAddress(name) __dlsym(name)' - print ' static void * __dlsym(const char *symbol);' + print '# define __getPublicProcAddress(name) __libgl_sym(name)' + print ' void * __libgl_sym(const char *symbol);' print '# ifdef __APPLE__' print '# define __getPrivateProcAddress(name) __getPublicProcAddress(name)' print '# else' @@ -431,12 +434,11 @@ class GlDispatcher(Dispatcher): print ' static inline __GLXextFuncPtr __glXGetProcAddressARB(const GLubyte * procName);' print '# endif' print '# endif' - print '# define __abort() Trace::Abort()' print '#endif /* !RETRACE */' print def is_public_function(self, function): - return function.name in public_symbols + return function.name in public_symbols or function.name.startswith('CGL') if __name__ == '__main__': @@ -450,17 +452,15 @@ if __name__ == '__main__': print dispatcher = GlDispatcher() dispatcher.header() - print '#ifdef _WIN32' + print '#if defined(_WIN32)' print dispatcher.dispatch_api(wglapi) - print '#else /* !_WIN32 */' + print '#elif defined(__APPLE__)' + dispatcher.dispatch_api(cglapi) + print '#else' print dispatcher.dispatch_api(glxapi) - print '#endif /* !_WIN32 */' - print - print '#ifdef __APPLE__' - dispatcher.dispatch_api(cglapi) - print '#endif /* __APPLE__ */' + print '#endif' print dispatcher.dispatch_api(glapi) print