diff options
Diffstat (limited to 'xorg-server/hw/xwin/glx/gen_gl_wrappers.py')
-rwxr-xr-x[-rw-r--r--] | xorg-server/hw/xwin/glx/gen_gl_wrappers.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py index 2273589c9..00e4aab1c 100644..100755 --- a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py +++ b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py @@ -67,7 +67,7 @@ if dispatchheader : fh = open(dispatchheader) dispatchh = fh.readlines() - dispatch_regex = re.compile(r'^SET_(\S*)\(') + dispatch_regex = re.compile(r'(?:#define|static\s+INLINE\s+void)\s+SET_([^\()]+)\(') for line in dispatchh : line = line.strip() @@ -100,6 +100,8 @@ for line in tm : continue l = line.split(',') + if len(l)<4: + continue typemap[l[0]] = l[3].strip() # interestingly, * is not a C type @@ -222,6 +224,8 @@ for w in sorted(wrappers.keys()) : if l[2] == 'in' : if l[3] == 'array' : arg = 'const ' + typemap[l[1]] + ' *' + l[0] + elif l[3] == 'reference' : + arg = 'const ' + typemap[l[1]] + ' *' + l[0] else : arg = typemap[l[1]] + ' ' + l[0] elif l[2] == 'out' : @@ -237,10 +241,12 @@ for w in sorted(wrappers.keys()) : if wrappers[w]['category'].startswith('VERSION_1_0') or wrappers[w]['category'].startswith('VERSION_1_1') : if staticwrappers : print 'static', - print returntype + ' ' + funcname + 'Wrapper(' + arglist + ')' + print returntype + ' __stdcall ' + funcname + 'Wrapper(' + arglist + ')' print '{' + print '#ifdef _DEBUG' print ' if (glxWinDebugSettings.enable' + prefix.upper() + 'callTrace) ErrorF("'+ funcname + '\\n");' print ' glWinDirectProcCalls++;' + print '#endif' if returntype.lower() == 'void' : print ' ' + funcname + '(', else : @@ -255,7 +261,7 @@ for w in sorted(wrappers.keys()) : else: if staticwrappers : print 'static', - print returntype + ' ' + funcname + 'Wrapper(' + arglist + ')' + print returntype + ' __stdcall ' + funcname + 'Wrapper(' + arglist + ')' print '{' stringname = funcname @@ -285,11 +291,15 @@ for w in sorted(wrappers.keys()) : if returntype.lower() == 'void' : print ' RESOLVE(' + pfntypename + ', "' + stringname + '");' + print '#ifdef _DEBUG' print ' if (glxWinDebugSettings.enable' + prefix.upper() + 'callTrace) ErrorF("'+ funcname + '\\n");' + print '#endif' print ' RESOLVED_PROC(' + pfntypename + ')(', else : print ' RESOLVE_RET(' + pfntypename + ', "' + stringname + '", FALSE);' + print '#ifdef _DEBUG' print ' if (glxWinDebugSettings.enable' + prefix.upper() + 'callTrace) ErrorF("'+ funcname + '\\n");' + print '#endif' print ' return RESOLVED_PROC(' + pfntypename + ')(', if arglist != 'void' : @@ -306,20 +316,12 @@ for w in sorted(wrappers.keys()) : if dispatchheader : print 'void glWinSetupDispatchTable(void)' print '{' - print ' static struct _glapi_table *disp = NULL;' - print '' - print ' if (!disp)' - print ' {' - print ' disp = calloc(sizeof(void *), _glapi_get_dispatch_table_size());' - print ' assert(disp);' + print ' struct _glapi_table *disp = _glapi_get_dispatch();' for d in sorted(dispatch.keys()) : if wrappers.has_key(d) : print ' SET_'+ d + '(disp, (void *)' + prefix + d + 'Wrapper);' else : - print '#warning No wrapper for ' + prefix + d + ' !' + print '#pragma message("No wrapper for ' + prefix + d + ' !")' - print ' }' - print '' - print ' _glapi_set_dispatch(disp);' print '}' |