self.csize = "%d*sizeof(%s)"%(self.size, self.base_ctype)
elif self.size.startswith("COMPSIZE("):
self.csize = self.func.compsize(self.size[9:-1], self.base_ctype)
- elif self.size=="" and (self.type=="charARB" or self.type=="Char"):
- self.csize = "strlen"
else:
s = self.func.get_param(self.size.split('*')[0])
if (s.type=="SizeI" or s.type.endswith("Int32") or s.type.startswith("BufferSize")) and s.kind=="value":
sys.stderr.write("Compsize '%s' for function '%s' failed: Parameter '%s' has unknown type '%s'\n"%(size, self.name, param.name, param.type))
return
if not have_type:
- res += "*sizeof(%s)"%param.ctype
+ res += "*sizeof(%s)"%btype
return res
def finalize(self):
class Template:
def __init__(self, fn):
self.sections = []
+ self.handcode = []
literal = True
text = ""
text = ""
text += line[1:]+"\n"
literal = True
+ elif line[0]=='!':
+ parts = line[1:].split()
+ if parts[0]=="handcode":
+ self.handcode.append(parts[1])
else:
if literal and text:
self.add_section(text, literal)
print sect
else:
for func in functions:
+ if func.name in self.handcode:
+ continue
globals = {
"w": self.write,
"wl": self.writeln,
prefix gl
ignore category VERSION_3_2
ignore category ARB_sync
-ignore function glGetError
BlendingFactorSrc,*,*, GLenum,*,*
Boolean,*,*, GLboolean,*,*
BooleanPointer,*,*, GLboolean*,*,*
-Char,*,*, GLchar,*,*
+Char,*,array, GLchar *,*,value
CharPointer,*,*, GLchar*,*,*
CheckedFloat32,*,*, GLfloat,*,*
CheckedInt32,*,*, GLint,*,*
UInt64,*,*, GLuint64,*,*
# Object handle & data pointers
handleARB,*,*, GLhandleARB,*,*
-charARB,*,*, GLcharARB,*,*
+charARB,*,array, GLcharARB *,*,value
charPointerARB,*,*, GLcharARB*,*,*
sync,*,*, GLsync,*,*,
# EXT_timer_query
ignore category SGIX_hyperpipe
ignore category NV_video_output
ignore category NV_video_capture
-ignore function glXGetProcAddress
-ignore function glXGetProcAddressARB
float, float, %g
unsigned int *, pointer, %p
char *, string, \"%s\"
+ubyte *, string, \"%s\"
Bool, int, %i
Display *, pointer, %p
XVisualInfo *, pointer, %p
GLXPbuffer, long, %#lx
GLXWindow, long, %#lx
GLXPixmap, long, %#lx
+__GLXextFuncPtr, pointer, %p
GLfunction,*,*, GLfunction,*,*
GLint,*,*, GLint,*,*
GLsizei,*,*, GLsizei,*,*
-GLubyte,*,*, GLubyte,*,*
+GLubyte,*,reference, GLubyte *,*,value
GLuint,*,*, GLuint,*,*
Pixmap,*,*, Pixmap,*,*
Status,*,*, Status,*,*
init_print(dec);
dec->gldError = print_gldError;
+
+ return dec;
}
char *glprint_get_buffer(GlDecoder *dec)
{
GLenum ret = cur_error;
cur_error = GL_NO_ERROR;
+ begin_packet(FUNC_GLGETERROR);
+ write_int(ret);
+ send_packet();
return ret;
}
void (*glXGetProcAddress(const GLubyte *procname))(void)
{
void *handle = dlopen(NULL, RTLD_LAZY);
- return dlsym(handle, (const char *)procname);
+ void (*ret)() = dlsym(handle, (const char *)procname);
+ begin_packet(FUNC_GLXGETPROCADDRESS);
+ write_pointer(ret);
+ write_string(procname);
+ send_packet();
+ return ret;
}
void (*glXGetProcAddressARB(const GLubyte *))(void) __attribute__((alias("glXGetProcAddress")));
# $Id$
+!handcode glGetError
+!handcode glXGetProcAddress
+!handcode glXGetProcAddressARB
wl('%s APIENTRY %s(%s)', ret.ctype, func.name, ", ".join([p.ctype+" "+p.name for p in params]))
wl('{')
wl(' static %s (*orig)(%s);', ret.ctype, ", ".join([p.ctype for p in params]))