def printBody(self, api): print '#ifdef _MSC_VER' print '#ifndef INLINE' print '#define INLINE __inline' print '#endif' print '#endif' print '#define CALL_by_offset(disp, cast, offset, parameters) \\' print ' (*(cast (GET_by_offset(disp, offset)))) parameters' print '#define GET_by_offset(disp, offset) \\' print ' (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL' print '#define SET_by_offset(disp, offset, fn) \\' print ' do { \\' print ' if ( (offset) < 0 ) { \\' print ' /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\\n", */ \\' print ' /* __func__, __LINE__, disp, offset, # fn); */ \\' print ' /* abort(); */ \\' print ' } \\' print ' else { \\' print ' ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \\' print ' } \\' print ' } while(0)' print '' functions = [] abi_functions = [] count = 0 for f in api.functionIterateByOffset(): if not f.is_abi(): functions.append([f, count]) count += 1 else: abi_functions.append([f, -1]) print '/* total number of offsets below */' print '#define _gloffset_COUNT %d' % (len(abi_functions + functions)) print '' for f, index in abi_functions: print '#define _gloffset_%s %d' % (f.name, f.offset) remap_table = "driDispatchRemapTable" print '#define %s_size %u' % (remap_table, count) print 'SERVEXTERN int %s[ %s_size ];' % (remap_table, remap_table) print '' for f, index in functions: print '#define %s_remap_index %u' % (f.name, index) print '' for f, index in functions: print '#define _gloffset_%s %s[%s_remap_index]' % (f.name, remap_table, f.name) print '' for f, index in abi_functions + functions: arg_string = gl_XML.create_parameter_string(f.parameters, 0) print 'typedef %s (GLAPIENTRYP _glptr_%s)(%s);' % (f.return_type, f.name, arg_string) print '#define CALL_%s(disp, parameters) \\' % (f.name) print ' (* GET_%s(disp)) parameters' % (f.name) print 'static INLINE _glptr_%s GET_%s(struct _glapi_table *disp) {' % (f.name, f.name) print ' return (_glptr_%s) (GET_by_offset(disp, _gloffset_%s));' % (f.name, f.name) print '}' print print 'static INLINE void SET_%s(struct _glapi_table *disp, %s (GLAPIENTRYP fn)(%s)) {' % (f.name, f.return_type, arg_string) print ' SET_by_offset(disp, _gloffset_%s, fn);' % (f.name) print '}' print return
def printBody(self, api): print('#ifdef _MSC_VER') print('#ifndef INLINE') print('#define INLINE __inline') print('#endif') print('#endif') print('#define CALL_by_offset(disp, cast, offset, parameters) \\') print(' (*(cast (GET_by_offset(disp, offset)))) parameters') print('#define GET_by_offset(disp, offset) \\') print(' (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL') print('#define SET_by_offset(disp, offset, fn) \\') print(' do { \\') print(' if ( (offset) < 0 ) { \\') print( ' /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\\n", */ \\' ) print( ' /* __func__, __LINE__, disp, offset, # fn); */ \\' ) print(' /* abort(); */ \\') print(' } \\') print(' else { \\') print( ' ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \\' ) print(' } \\') print(' } while(0)') print('') functions = [] abi_functions = [] count = 0 for f in api.functionIterateByOffset(): if not f.is_abi(): functions.append([f, count]) count += 1 else: abi_functions.append([f, -1]) print('/* total number of offsets below */') print('#define _gloffset_COUNT %d' % (len(abi_functions + functions))) print('') for f, index in abi_functions: print('#define _gloffset_%s %d' % (f.name, f.offset)) remap_table = "driDispatchRemapTable" print('#define %s_size %u' % (remap_table, count)) print('SERVEXTERN int %s[ %s_size ];' % (remap_table, remap_table)) print('') for f, index in functions: print('#define %s_remap_index %u' % (f.name, index)) print('') for f, index in functions: print('#define _gloffset_%s %s[%s_remap_index]' % (f.name, remap_table, f.name)) print('') for f, index in abi_functions + functions: arg_string = gl_XML.create_parameter_string(f.parameters, 0) print('typedef %s (GLAPIENTRYP _glptr_%s)(%s);' % (f.return_type, f.name, arg_string)) print('#define CALL_%s(disp, parameters) \\' % (f.name)) print(' (* GET_%s(disp)) parameters' % (f.name)) print( 'static INLINE _glptr_%s GET_%s(struct _glapi_table *disp) {' % (f.name, f.name)) print( ' return (_glptr_%s) (GET_by_offset(disp, _gloffset_%s));' % (f.name, f.name)) print('}') print() print( 'static INLINE void SET_%s(struct _glapi_table *disp, %s (GLAPIENTRYP fn)(%s)) {' % (f.name, f.return_type, arg_string)) print(' SET_by_offset(disp, _gloffset_%s, fn);' % (f.name)) print('}') print() return
def printBody(self, api): print '#define CALL_by_offset(disp, cast, offset, parameters) \\' print ' (*(cast (GET_by_offset(disp, offset)))) parameters' print '#define GET_by_offset(disp, offset) \\' print ' (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL' print '#define SET_by_offset(disp, offset, fn) \\' print ' do { \\' print ' if ( (offset) < 0 ) { \\' print ' /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\\n", */ \\' print ' /* __func__, __LINE__, disp, offset, # fn); */ \\' print ' /* abort(); */ \\' print ' } \\' print ' else { \\' print ' ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \\' print ' } \\' print ' } while(0)' print '' functions = [] abi_functions = [] alias_functions = [] count = 0 for f in api.functionIterateByOffset(): if not f.is_abi(): functions.append([f, count]) count += 1 else: abi_functions.append([f, -1]) if self.es: # remember functions with aliases if len(f.entry_points) > 1: alias_functions.append(f) print '/* total number of offsets below */' print '#define _gloffset_COUNT %d' % (len(abi_functions + functions)) print '' for f, index in abi_functions: print '#define _gloffset_%s %d' % (f.name, f.offset) print '' print '#if !FEATURE_remap_table' print '' for f, index in functions: print '#define _gloffset_%s %d' % (f.name, f.offset) print '' print '#else /* !FEATURE_remap_table */' print '' if self.es: remap_table = "esLocalRemapTable" print '#define %s_size %u' % (remap_table, count) print 'static int %s[ %s_size ];' % (remap_table, remap_table) print '' else: remap_table = "driDispatchRemapTable" print '#define %s_size %u' % (remap_table, count) print 'extern int %s[ %s_size ];' % (remap_table, remap_table) print '' for f, index in functions: print '#define %s_remap_index %u' % (f.name, index) print '' for f, index in functions: print '#define _gloffset_%s %s[%s_remap_index]' % ( f.name, remap_table, f.name) print '' print '#endif /* !FEATURE_remap_table */' print '' for f, index in abi_functions + functions: arg_string = gl_XML.create_parameter_string(f.parameters, 0) print 'typedef %s (GLAPIENTRYP _glptr_%s)(%s);' % ( f.return_type, f.name, arg_string) print '#define CALL_%s(disp, parameters) \\' % (f.name) print ' (* GET_%s(disp)) parameters' % (f.name) print 'static INLINE _glptr_%s GET_%s(struct _glapi_table *disp) {' % ( f.name, f.name) print ' return (_glptr_%s) (GET_by_offset(disp, _gloffset_%s));' % ( f.name, f.name) print '}' print print 'static INLINE void SET_%s(struct _glapi_table *disp, %s (GLAPIENTRYP fn)(%s)) {' % ( f.name, f.return_type, arg_string) print ' SET_by_offset(disp, _gloffset_%s, fn);' % (f.name) print '}' print if alias_functions: print '' print '/* define aliases for compatibility */' for f in alias_functions: for name in f.entry_points: if name != f.name: print '#define CALL_%s(disp, parameters) CALL_%s(disp, parameters)' % ( name, f.name) print '#define GET_%s(disp) GET_%s(disp)' % (name, f.name) print '#define SET_%s(disp, fn) SET_%s(disp, fn)' % ( name, f.name) print '' print '#if FEATURE_remap_table' for f in alias_functions: for name in f.entry_points: if name != f.name: print '#define %s_remap_index %s_remap_index' % ( name, f.name) print '#endif /* FEATURE_remap_table */' print '' return
def printBody(self, api): print '#define CALL_by_offset(disp, cast, offset, parameters) \\' print ' (*(cast (GET_by_offset(disp, offset)))) parameters' print '#define GET_by_offset(disp, offset) \\' print ' (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL' print '#define SET_by_offset(disp, offset, fn) \\' print ' do { \\' print ' if ( (offset) < 0 ) { \\' print ' /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\\n", */ \\' print ' /* __func__, __LINE__, disp, offset, # fn); */ \\' print ' /* abort(); */ \\' print ' } \\' print ' else { \\' print ' ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \\' print ' } \\' print ' } while(0)' print '' functions = [] abi_functions = [] alias_functions = [] count = 0 for f in api.functionIterateByOffset(): if not f.is_abi(): functions.append( [f, count] ) count += 1 else: abi_functions.append( [f, -1] ) if self.es: # remember functions with aliases if len(f.entry_points) > 1: alias_functions.append(f) print '/* total number of offsets below */' print '#define _gloffset_COUNT %d' % (len(abi_functions + functions)) print '' for f, index in abi_functions: print '#define _gloffset_%s %d' % (f.name, f.offset) print '' print '#if !FEATURE_remap_table' print '' for f, index in functions: print '#define _gloffset_%s %d' % (f.name, f.offset) print '' print '#else /* !FEATURE_remap_table */' print '' if self.es: remap_table = "esLocalRemapTable" print '#define %s_size %u' % (remap_table, count) print 'static int %s[ %s_size ];' % (remap_table, remap_table) print '' else: remap_table = "driDispatchRemapTable" print '#define %s_size %u' % (remap_table, count) print 'extern int %s[ %s_size ];' % (remap_table, remap_table) print '' for f, index in functions: print '#define %s_remap_index %u' % (f.name, index) print '' for f, index in functions: print '#define _gloffset_%s %s[%s_remap_index]' % (f.name, remap_table, f.name) print '' print '#endif /* !FEATURE_remap_table */' print '' for f, index in abi_functions + functions: arg_string = gl_XML.create_parameter_string( f.parameters, 0 ) print 'typedef %s (GLAPIENTRYP _glptr_%s)(%s);' % (f.return_type, f.name, arg_string) print '#define CALL_%s(disp, parameters) \\' % (f.name) print ' (* GET_%s(disp)) parameters' % (f.name) print 'static INLINE _glptr_%s GET_%s(struct _glapi_table *disp) {' % (f.name, f.name) print ' return (_glptr_%s) (GET_by_offset(disp, _gloffset_%s));' % (f.name, f.name) print '}' print print 'static INLINE void SET_%s(struct _glapi_table *disp, %s (GLAPIENTRYP fn)(%s)) {' % (f.name, f.return_type, arg_string) print ' SET_by_offset(disp, _gloffset_%s, fn);' % (f.name) print '}' print if alias_functions: print '' print '/* define aliases for compatibility */' for f in alias_functions: for name in f.entry_points: if name != f.name: print '#define CALL_%s(disp, parameters) CALL_%s(disp, parameters)' % (name, f.name) print '#define GET_%s(disp) GET_%s(disp)' % (name, f.name) print '#define SET_%s(disp, fn) SET_%s(disp, fn)' % (name, f.name) print '' print '#if FEATURE_remap_table' for f in alias_functions: for name in f.entry_points: if name != f.name: print '#define %s_remap_index %s_remap_index' % (name, f.name) print '#endif /* FEATURE_remap_table */' print '' return
def printBody(self, api): print "#define CALL_by_offset(disp, cast, offset, parameters) \\" print " (*(cast (GET_by_offset(disp, offset)))) parameters" print "#define GET_by_offset(disp, offset) \\" print " (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL" print "#define SET_by_offset(disp, offset, fn) \\" print " do { \\" print " if ( (offset) < 0 ) { \\" print ' /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\\n", */ \\' print " /* __func__, __LINE__, disp, offset, # fn); */ \\" print " /* abort(); */ \\" print " } \\" print " else { \\" print " ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \\" print " } \\" print " } while(0)" print "" functions = [] abi_functions = [] count = 0 for f in api.functionIterateByOffset(): if not f.is_abi(): functions.append([f, count]) count += 1 else: abi_functions.append([f, -1]) print "/* total number of offsets below */" print "#define _gloffset_COUNT %d" % (len(abi_functions + functions)) print "" for f, index in abi_functions: print "#define _gloffset_%s %d" % (f.name, f.offset) remap_table = "driDispatchRemapTable" print "#define %s_size %u" % (remap_table, count) print "extern int %s[ %s_size ];" % (remap_table, remap_table) print "" for f, index in functions: print "#define %s_remap_index %u" % (f.name, index) print "" for f, index in functions: print "#define _gloffset_%s %s[%s_remap_index]" % (f.name, remap_table, f.name) print "" for f, index in abi_functions + functions: arg_string = gl_XML.create_parameter_string(f.parameters, 0) print "typedef %s (GLAPIENTRYP _glptr_%s)(%s);" % (f.return_type, f.name, arg_string) print "#define CALL_%s(disp, parameters) \\" % (f.name) print " (* GET_%s(disp)) parameters" % (f.name) print "static inline _glptr_%s GET_%s(struct _glapi_table *disp) {" % (f.name, f.name) print " return (_glptr_%s) (GET_by_offset(disp, _gloffset_%s));" % (f.name, f.name) print "}" print print "static inline void SET_%s(struct _glapi_table *disp, %s (GLAPIENTRYP fn)(%s)) {" % ( f.name, f.return_type, arg_string, ) print " SET_by_offset(disp, _gloffset_%s, fn);" % (f.name) print "}" print return
def printBody(self, api): print '#define CALL_by_offset(disp, cast, offset, parameters) \\' print ' (*(cast (GET_by_offset(disp, offset)))) parameters' print '#define GET_by_offset(disp, offset) \\' print ' (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL' print '#define SET_by_offset(disp, offset, fn) \\' print ' do { \\' print ' if ( (offset) < 0 ) { \\' print ' /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\\n", */ \\' print ' /* __func__, __LINE__, disp, offset, # fn); */ \\' print ' /* abort(); */ \\' print ' } \\' print ' else { \\' print ' ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \\' print ' } \\' print ' } while(0)' print '' functions = [] abi_functions = [] alias_functions = [] count = 0 for f in api.functionIterateByOffset(): if not f.is_abi(): functions.append( [f, count] ) count += 1 else: abi_functions.append( f ) if self.es: # remember functions with aliases if len(f.entry_points) > 1: alias_functions.append(f) for f in abi_functions: print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name) print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name) print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name) print '' print '#if !defined(_GLAPI_USE_REMAP_TABLE)' print '' for [f, index] in functions: print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name) print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name) print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name) print '' print '#else' print '' print '#define driDispatchRemapTable_size %u' % (count) print 'extern int driDispatchRemapTable[ driDispatchRemapTable_size ];' print '' for [f, index] in functions: print '#define %s_remap_index %u' % (f.name, index) print '' for [f, index] in functions: arg_string = gl_XML.create_parameter_string( f.parameters, 0 ) cast = '%s (GLAPIENTRYP)(%s)' % (f.return_type, arg_string) print '#define CALL_%s(disp, parameters) CALL_by_offset(disp, (%s), driDispatchRemapTable[%s_remap_index], parameters)' % (f.name, cast, f.name) print '#define GET_%s(disp) GET_by_offset(disp, driDispatchRemapTable[%s_remap_index])' % (f.name, f.name) print '#define SET_%s(disp, fn) SET_by_offset(disp, driDispatchRemapTable[%s_remap_index], fn)' % (f.name, f.name) print '' print '#endif /* !defined(_GLAPI_USE_REMAP_TABLE) */' if alias_functions: print '' print '/* define aliases for compatibility */' for f in alias_functions: for name in f.entry_points: if name != f.name: print '#define CALL_%s(disp, parameters) CALL_%s(disp, parameters)' % (name, f.name) print '#define GET_%s(disp) GET_%s(disp)' % (name, f.name) print '#define SET_%s(disp, fn) SET_%s(disp, fn)' % (name, f.name) print '' print '#if defined(_GLAPI_USE_REMAP_TABLE)' for f in alias_functions: for name in f.entry_points: if name != f.name: print '#define %s_remap_index %s_remap_index' % (name, f.name) print '#endif /* defined(_GLAPI_USE_REMAP_TABLE) */' print '' return
def printBody(self, api): print '#define CALL_by_offset(disp, cast, offset, parameters) \\' print ' (*(cast (GET_by_offset(disp, offset)))) parameters' print '#define GET_by_offset(disp, offset) \\' print ' (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL' print '#define SET_by_offset(disp, offset, fn) \\' print ' do { \\' print ' if ( (offset) < 0 ) { \\' print ' /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\\n", */ \\' print ' /* __func__, __LINE__, disp, offset, # fn); */ \\' print ' /* abort(); */ \\' print ' } \\' print ' else { \\' print ' ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \\' print ' } \\' print ' } while(0)' print '' abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ] functions = [] abi_functions = [] count = 0 for f in api.functionIterateByOffset(): [category, num] = api.get_category_for_name( f.name ) if category not in abi: functions.append( [f, count] ) count += 1 else: abi_functions.append( f ) for f in abi_functions: print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name) print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name) print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name) print '' print '#if !defined(IN_DRI_DRIVER)' print '' for [f, index] in functions: print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name) print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name) print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name) print '' print '#else' print '' print '#define driDispatchRemapTable_size %u' % (count) print 'extern int driDispatchRemapTable[ driDispatchRemapTable_size ];' print '' for [f, index] in functions: print '#define %s_remap_index %u' % (f.name, index) print '' for [f, index] in functions: arg_string = gl_XML.create_parameter_string( f.parameters, 0 ) cast = '%s (GLAPIENTRYP)(%s)' % (f.return_type, arg_string) print '#define CALL_%s(disp, parameters) CALL_by_offset(disp, (%s), driDispatchRemapTable[%s_remap_index], parameters)' % (f.name, cast, f.name) print '#define GET_%s(disp) GET_by_offset(disp, driDispatchRemapTable[%s_remap_index])' % (f.name, f.name) print '#define SET_%s(disp, fn) SET_by_offset(disp, driDispatchRemapTable[%s_remap_index], fn)' % (f.name, f.name) print '' print '#endif /* !defined(IN_DRI_DRIVER) */' return
def printBody(self, api): print('#define CALL_by_offset(disp, cast, offset, parameters) \\') print(' (*(cast (GET_by_offset(disp, offset)))) parameters') print('#define GET_by_offset(disp, offset) \\') print(' (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL') print('#define SET_by_offset(disp, offset, fn) \\') print(' do { \\') print(' if ( (offset) < 0 ) { \\') print( ' /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\\n", */ \\' ) print( ' /* __func__, __LINE__, disp, offset, # fn); */ \\' ) print(' /* abort(); */ \\') print(' } \\') print(' else { \\') print( ' ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \\' ) print(' } \\') print(' } while(0)') print('') functions = [] abi_functions = [] count = 0 for f in api.functionIterateByOffset(): if not f.is_abi(): functions.append([f, count]) count += 1 else: abi_functions.append([f, -1]) print('/* total number of offsets below */') print('#define _gloffset_COUNT %d' % (len(abi_functions + functions))) print('') for f, index in abi_functions: print('#define _gloffset_%s %d' % (f.name, f.offset)) remap_table = "driDispatchRemapTable" print('#define %s_size %u' % (remap_table, count)) print('extern int %s[ %s_size ];' % (remap_table, remap_table)) print('') for f, index in functions: print('#define %s_remap_index %u' % (f.name, index)) print('') for f, index in functions: print('#define _gloffset_%s %s[%s_remap_index]' % (f.name, remap_table, f.name)) print('') for f, index in abi_functions + functions: arg_string = gl_XML.create_parameter_string(f.parameters, 0) print('typedef %s (GLAPIENTRYP _glptr_%s)(%s);' % (f.return_type, f.name, arg_string)) print( '#define CALL_{0}(disp, parameters) (* GET_{0}(disp)) parameters' .format(f.name)) print( '#define GET_{0}(disp) ((_glptr_{0})(GET_by_offset((disp), _gloffset_{0})))' .format(f.name)) print("""#define SET_{0}(disp, func) do {{ \\ {1} (GLAPIENTRYP fn)({2}) = func; \\ SET_by_offset(disp, _gloffset_{0}, fn); \\ }} while (0) """.format(f.name, f.return_type, arg_string)) return
return p_string api = parser.parseAPI() for func in api.functionIterateByOffset(): if func.desktop != True: continue for ep in func.entry_points: ep_params = func.entry_point_parameters[ep] ep_name = "gl" + ep out_str = "gl: " + ep print "static " + func.return_type + " GLAPIENTRY forward_" + ep + "(" + gl_XML.create_parameter_string( ep_params, 1) + ") {" #print "cout << \"" + out_str + "\" << endl;" #print "assert(current_GL_Interface()->" + ep_name + ");" if func.return_type != "void": print " return current_GL_Interface()->" + ep_name + "(" + get_called_parameter_string( func, ep) + ");" else: print " if (!discard_gl_calls)" print " current_GL_Interface()->" + ep_name + "(" + get_called_parameter_string( func, ep) + ");" print "}"
return p_string api = parser.parseAPI() for func in api.functionIterateByOffset(): if func.desktop != True: continue for ep in func.entry_points: if not enabled_procs.isProcEnabled(ep): continue ep_params = func.entry_point_parameters[ep] ep_name = ep print "inline " + func.return_type + " " + ep + "(" + gl_XML.create_parameter_string( ep_params, 1) + ")" print "{" print " auto iface = getCurrentInterface();" if func.return_type != "void": ret_assignment = " auto ret = " else: ret_assignment = " " print ret_assignment + "iface->" + ep_name + "(" + getArgs(func, ep) + ");" print " if (iface->hasError())" print " throw GLError();"
#!/usr/bin/env python import sys import os import parser import gl_XML import enabled_procs api = parser.parseAPI() for func in api.functionIterateByOffset(): if func.desktop != True: continue for ep in func.entry_points: if not enabled_procs.isProcEnabled(ep): continue ep_name = ep ep_params = func.entry_point_parameters[ep] ep_type = func.return_type + " GLAPIENTRY (*) (" + gl_XML.create_parameter_string( ep_params, 0) + ")" print ep_name + " = (" + ep_type + ") get_proc_address(\"gl" + ep + "\");"