diff options
author | José Fonseca <jose.r.fonseca@gmail.com> | 2012-08-07 21:07:22 +0100 |
---|---|---|
committer | José Fonseca <jose.r.fonseca@gmail.com> | 2012-08-07 21:07:22 +0100 |
commit | bcfc81b9014c68fb4e34d5cbbeb0aab1c75aa280 (patch) | |
tree | f0f3d88c0d6351feac2184a3f6523d6acf87a3c2 | |
parent | a083c51c66239841c42cc1a1c42ba8a259397115 (diff) |
Cleanup strings constness.
Allows to distinguish between a const char *, and char * const.
-rw-r--r-- | specs/cglapi.py | 2 | ||||
-rw-r--r-- | specs/d3d10sdklayers.py | 2 | ||||
-rw-r--r-- | specs/eglapi.py | 4 | ||||
-rw-r--r-- | specs/glapi.py | 88 | ||||
-rw-r--r-- | specs/glesapi.py | 8 | ||||
-rw-r--r-- | specs/gltypes.py | 9 | ||||
-rw-r--r-- | specs/glxapi.py | 10 | ||||
-rw-r--r-- | specs/stdapi.py | 82 | ||||
-rw-r--r-- | specs/wglapi.py | 4 | ||||
-rw-r--r-- | specs/winapi.py | 4 | ||||
-rw-r--r-- | wrappers/trace.py | 10 |
11 files changed, 119 insertions, 104 deletions
diff --git a/specs/cglapi.py b/specs/cglapi.py index c5930f6e..fbae1b14 100644 --- a/specs/cglapi.py +++ b/specs/cglapi.py @@ -233,7 +233,7 @@ cglapi.addFunctions([ Function(CGLError, "CGLLockContext", [(CGLContextObj, "ctx")]), Function(CGLError, "CGLUnlockContext", [(CGLContextObj, "ctx")]), Function(Void, "CGLGetVersion", [Out(Pointer(GLint), "majorvers"), Out(Pointer(GLint), "minorvers")]), - Function(Const(CString), "CGLErrorString", [(CGLError, "error")]), + Function(ConstCString, "CGLErrorString", [(CGLError, "error")]), # CGLIOSurface.h, OpenGL framework Function(CGLError, "CGLTexImageIOSurface2D", [(CGLContextObj, "ctx"), (GLenum, "target"), (GLenum, "internal_format"), (GLsizei, "width"), (GLsizei, "height"), (GLenum, "format"), (GLenum, "type"), (IOSurfaceRef, "ioSurface"), (GLuint, "plane")]), diff --git a/specs/d3d10sdklayers.py b/specs/d3d10sdklayers.py index 8f5c59f2..7dd5cc8b 100644 --- a/specs/d3d10sdklayers.py +++ b/specs/d3d10sdklayers.py @@ -561,7 +561,7 @@ D3D10_MESSAGE = Struct("D3D10_MESSAGE", [ (D3D10_MESSAGE_CATEGORY, "Category"), (D3D10_MESSAGE_SEVERITY, "Severity"), (D3D10_MESSAGE_ID, "ID"), - (Const(CString), "pDescription"), + (ConstCString, "pDescription"), (SIZE_T, "DescriptionByteLength"), ]) diff --git a/specs/eglapi.py b/specs/eglapi.py index d34c282d..74584784 100644 --- a/specs/eglapi.py +++ b/specs/eglapi.py @@ -307,7 +307,7 @@ eglapi.addFunctions([ Function(EGLBoolean, "eglInitialize", [(EGLDisplay, "dpy"), Out(Pointer(EGLint), "major"), Out(Pointer(EGLint), "minor")]), Function(EGLBoolean, "eglTerminate", [(EGLDisplay, "dpy")]), - Function(Const(CString), "eglQueryString", [(EGLDisplay, "dpy"), (EGLName, "name")], sideeffects=False), + Function(ConstCString, "eglQueryString", [(EGLDisplay, "dpy"), (EGLName, "name")], sideeffects=False), Function(EGLBoolean, "eglGetConfigs", [(EGLDisplay, "dpy"), (Array(EGLConfig, "config_size"), "configs"), (EGLint, "config_size"), Out(Pointer(EGLint), "num_config")]), Function(EGLBoolean, "eglChooseConfig", [(EGLDisplay, "dpy"), (EGLAttribList, "attrib_list"), (Array(EGLConfig, "config_size"), "configs"), (EGLint, "config_size"), Out(Pointer(EGLint), "num_config")]), @@ -349,7 +349,7 @@ eglapi.addFunctions([ Function(EGLBoolean, "eglSwapBuffers", [(EGLDisplay, "dpy"), (EGLSurface, "surface")]), Function(EGLBoolean, "eglCopyBuffers", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLNativePixmapType, "target")]), - Function(EGLProc, "eglGetProcAddress", [(Const(CString), "procname")]), + Function(EGLProc, "eglGetProcAddress", [(ConstCString, "procname")]), # EGL_KHR_lock_surface Function(EGLBoolean, "eglLockSurfaceKHR", [(EGLDisplay, "display"), (EGLSurface, "surface"), (EGLAttribList, "attrib_list")]), diff --git a/specs/glapi.py b/specs/glapi.py index 7bde5e41..96800fee 100644 --- a/specs/glapi.py +++ b/specs/glapi.py @@ -88,7 +88,7 @@ glapi.addFunctions([ GlFunction(GLenum_error, "glGetError", [], sideeffects=False), GlFunction(Void, "glGetFloatv", [(GLenum, "pname"), Out(Array(GLfloat, "_gl_param_size(pname)"), "params")], sideeffects=False), GlFunction(Void, "glGetIntegerv", [(GLenum, "pname"), Out(Array(GLint, "_gl_param_size(pname)"), "params")], sideeffects=False), - GlFunction(String("const GLubyte *"), "glGetString", [(GLenum, "name")], sideeffects=False), + GlFunction(String(Const(GLubyte)), "glGetString", [(GLenum, "name")], sideeffects=False), GlFunction(Void, "glGetTexImage", [(GLenum, "target"), (GLint, "level"), (GLenum, "format"), (GLenum, "type"), Out(GLpointer, "pixels")]), GlFunction(Void, "glGetTexParameterfv", [(GLenum, "target"), (GLenum, "pname"), Out(Array(GLfloat, "_gl_param_size(pname)"), "params")], sideeffects=False), GlFunction(Void, "glGetTexParameteriv", [(GLenum, "target"), (GLenum, "pname"), Out(Array(GLint, "_gl_param_size(pname)"), "params")], sideeffects=False), @@ -561,7 +561,7 @@ glapi.addFunctions([ GlFunction(Void, "glStencilFuncSeparate", [(GLenum, "face"), (GLenum, "func"), (GLint, "ref"), (GLuint, "mask")]), GlFunction(Void, "glStencilMaskSeparate", [(GLenum, "face"), (GLuint, "mask")]), GlFunction(Void, "glAttachShader", [(GLprogram, "program"), (GLshader, "shader")]), - GlFunction(Void, "glBindAttribLocation", [(GLprogram, "program"), (GLuint, "index"), (Const(GLstring), "name")]), + GlFunction(Void, "glBindAttribLocation", [(GLprogram, "program"), (GLuint, "index"), (GLstringConst, "name")]), GlFunction(Void, "glCompileShader", [(GLshader, "shader")]), GlFunction(GLprogram, "glCreateProgram", []), GlFunction(GLshader, "glCreateShader", [(GLenum, "type")]), @@ -573,13 +573,13 @@ glapi.addFunctions([ GlFunction(Void, "glGetActiveAttrib", [(GLprogram, "program"), (GLuint, "index"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(Pointer(GLint), "size"), Out(Pointer(GLenum), "type"), Out(GLstring, "name")], sideeffects=False), GlFunction(Void, "glGetActiveUniform", [(GLprogram, "program"), (GLuint, "index"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(Pointer(GLint), "size"), Out(Pointer(GLenum), "type"), Out(GLstring, "name")], sideeffects=False), GlFunction(Void, "glGetAttachedShaders", [(GLprogram, "program"), (GLsizei, "maxCount"), Out(Pointer(GLsizei), "count"), Out(Array(GLuint, "(count ? *count : maxCount)"), "obj")], sideeffects=False), - GlFunction(GLint, "glGetAttribLocation", [(GLprogram, "program"), (Const(GLstring), "name")]), + GlFunction(GLint, "glGetAttribLocation", [(GLprogram, "program"), (GLstringConst, "name")]), GlFunction(Void, "glGetProgramiv", [(GLprogram, "program"), (GLenum, "pname"), Out(Array(GLint, "_gl_param_size(pname)"), "params")], sideeffects=False), GlFunction(Void, "glGetProgramInfoLog", [(GLprogram, "program"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(GLstring, "infoLog")], sideeffects=False), GlFunction(Void, "glGetShaderiv", [(GLshader, "shader"), (GLenum, "pname"), Out(Array(GLint, "_gl_param_size(pname)"), "params")], sideeffects=False), GlFunction(Void, "glGetShaderInfoLog", [(GLshader, "shader"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(GLstring, "infoLog")], sideeffects=False), - GlFunction(Void, "glGetShaderSource", [(GLshader, "shader"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(String("GLchar *", "*length"), "source")], sideeffects=False), - GlFunction(GLlocation, "glGetUniformLocation", [(GLprogram, "program"), (Const(GLstring), "name")]), + GlFunction(Void, "glGetShaderSource", [(GLshader, "shader"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(String(GLchar, "*length"), "source")], sideeffects=False), + GlFunction(GLlocation, "glGetUniformLocation", [(GLprogram, "program"), (GLstringConst, "name")]), GlFunction(Void, "glGetUniformfv", [(GLprogram, "program"), (GLlocation, "location"), Out(OpaquePointer(GLfloat), "params")], sideeffects=False), GlFunction(Void, "glGetUniformiv", [(GLprogram, "program"), (GLlocation, "location"), Out(OpaquePointer(GLint), "params")], sideeffects=False), GlFunction(Void, "glGetVertexAttribdv", [(GLuint, "index"), (GLenum, "pname"), Out(Array(GLdouble, "_gl_param_size(pname)"), "params")], sideeffects=False), @@ -589,7 +589,7 @@ glapi.addFunctions([ GlFunction(GLboolean, "glIsProgram", [(GLprogram, "program")], sideeffects=False), GlFunction(GLboolean, "glIsShader", [(GLshader, "shader")], sideeffects=False), GlFunction(Void, "glLinkProgram", [(GLprogram, "program")]), - GlFunction(Void, "glShaderSource", [(GLshader, "shader"), (GLsizei, "count"), (Const(Array(Const(GLstringARB), "count")), "string"), (Array(Const(GLint), "count"), "length")]), + GlFunction(Void, "glShaderSource", [(GLshader, "shader"), (GLsizei, "count"), (Const(Array(GLstringConstARB, "count")), "string"), (Array(Const(GLint), "count"), "length")]), GlFunction(Void, "glUseProgram", [(GLprogram, "program")]), GlFunction(Void, "glUniform1f", [(GLlocation, "location"), (GLfloat, "v0")]), GlFunction(Void, "glUniform2f", [(GLlocation, "location"), (GLfloat, "v0"), (GLfloat, "v1")]), @@ -668,7 +668,7 @@ glapi.addFunctions([ GlFunction(Void, "glEndTransformFeedback", []), GlFunction(Void, "glBindBufferRange", [(GLenum, "target"), (GLuint, "index"), (GLbuffer, "buffer"), (GLintptr, "offset"), (GLsizeiptr, "size")]), GlFunction(Void, "glBindBufferBase", [(GLenum, "target"), (GLuint, "index"), (GLbuffer, "buffer")]), - GlFunction(Void, "glTransformFeedbackVaryings", [(GLprogram, "program"), (GLsizei, "count"), (Const(Array(Const(GLstring), "count")), "varyings"), (GLenum, "bufferMode")]), + GlFunction(Void, "glTransformFeedbackVaryings", [(GLprogram, "program"), (GLsizei, "count"), (Const(Array(GLstringConst, "count")), "varyings"), (GLenum, "bufferMode")]), GlFunction(Void, "glGetTransformFeedbackVarying", [(GLprogram, "program"), (GLuint, "index"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(Pointer(GLsizei), "size"), Out(Pointer(GLenum), "type"), Out(GLstring, "name")], sideeffects=False), GlFunction(Void, "glClampColor", [(GLenum, "target"), (GLenum, "clamp")]), GlFunction(Void, "glBeginConditionalRender", [(GLuint, "id"), (GLenum, "mode")]), @@ -697,8 +697,8 @@ glapi.addFunctions([ GlFunction(Void, "glVertexAttribI4ubv", [(GLuint, "index"), (Array(Const(GLubyte), 4), "v")]), GlFunction(Void, "glVertexAttribI4usv", [(GLuint, "index"), (Array(Const(GLushort), 4), "v")]), GlFunction(Void, "glGetUniformuiv", [(GLprogram, "program"), (GLlocation, "location"), Out(OpaqueArray(GLuint, "_glGetUniformuiv_size(program, location)"), "params")], sideeffects=False), - GlFunction(Void, "glBindFragDataLocation", [(GLprogram, "program"), (GLuint, "color"), (Const(GLstring), "name")]), - GlFunction(GLlocation, "glGetFragDataLocation", [(GLprogram, "program"), (Const(GLstring), "name")]), + GlFunction(Void, "glBindFragDataLocation", [(GLprogram, "program"), (GLuint, "color"), (GLstringConst, "name")]), + GlFunction(GLlocation, "glGetFragDataLocation", [(GLprogram, "program"), (GLstringConst, "name")]), GlFunction(Void, "glUniform1ui", [(GLlocation, "location"), (GLuint, "v0")]), GlFunction(Void, "glUniform2ui", [(GLlocation, "location"), (GLuint, "v0"), (GLuint, "v1")]), GlFunction(Void, "glUniform3ui", [(GLlocation, "location"), (GLuint, "v0"), (GLuint, "v1"), (GLuint, "v2")]), @@ -715,7 +715,7 @@ glapi.addFunctions([ GlFunction(Void, "glClearBufferuiv", [(GLenum, "buffer"), (GLint, "drawbuffer"), (Array(Const(GLuint), "_glClearBuffer_size(buffer)"), "value")]), GlFunction(Void, "glClearBufferfv", [(GLenum, "buffer"), (GLint, "drawbuffer"), (Array(Const(GLfloat), "_glClearBuffer_size(buffer)"), "value")]), GlFunction(Void, "glClearBufferfi", [(GLenum, "buffer"), (GLint, "drawbuffer"), (GLfloat, "depth"), (GLint, "stencil")]), - GlFunction(String("const GLubyte *"), "glGetStringi", [(GLenum, "name"), (GLuint, "index")], sideeffects=False), + GlFunction(String(Const(GLubyte)), "glGetStringi", [(GLenum, "name"), (GLuint, "index")], sideeffects=False), # GL_VERSION_3_1 GlFunction(Void, "glDrawArraysInstanced", [(GLenum_mode, "mode"), (GLint, "first"), (GLsizei, "count"), (GLsizei, "primcount")]), @@ -873,7 +873,7 @@ glapi.addFunctions([ GlFunction(Void, "glVertexAttribPointerARB", [(GLuint, "index"), (GLint, "size"), (GLenum, "type"), (GLboolean, "normalized"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), GlFunction(Void, "glEnableVertexAttribArrayARB", [(GLuint, "index")]), GlFunction(Void, "glDisableVertexAttribArrayARB", [(GLuint, "index")]), - GlFunction(Void, "glProgramStringARB", [(GLenum, "target"), (GLenum, "format"), (GLsizei, "len"), (String("const void *", "len"), "string")]), + GlFunction(Void, "glProgramStringARB", [(GLenum, "target"), (GLenum, "format"), (GLsizei, "len"), (String(Const(Void), "len"), "string")]), GlFunction(Void, "glBindProgramARB", [(GLenum, "target"), (GLprogramARB, "program")]), GlFunction(Void, "glDeleteProgramsARB", [(GLsizei, "n"), (Array(Const(GLprogramARB), "n"), "programs")]), GlFunction(Void, "glGenProgramsARB", [(GLsizei, "n"), Out(Array(GLprogramARB, "n"), "programs")]), @@ -925,7 +925,7 @@ glapi.addFunctions([ GlFunction(GLhandleARB, "glGetHandleARB", [(GLenum, "pname")], sideeffects=False), GlFunction(Void, "glDetachObjectARB", [(GLhandleARB, "containerObj"), (GLhandleARB, "attachedObj")]), GlFunction(GLhandleARB, "glCreateShaderObjectARB", [(GLenum, "shaderType")]), - GlFunction(Void, "glShaderSourceARB", [(GLhandleARB, "shaderObj"), (GLsizei, "count"), (Const(Array(Const(GLstringARB), "count")), "string"), (Array(Const(GLint), "count"), "length")]), + GlFunction(Void, "glShaderSourceARB", [(GLhandleARB, "shaderObj"), (GLsizei, "count"), (Const(Array(GLstringConstARB, "count")), "string"), (Array(Const(GLint), "count"), "length")]), GlFunction(Void, "glCompileShaderARB", [(GLhandleARB, "shaderObj")]), GlFunction(GLhandleARB, "glCreateProgramObjectARB", []), GlFunction(Void, "glAttachObjectARB", [(GLhandleARB, "containerObj"), (GLhandleARB, "obj")]), @@ -955,16 +955,16 @@ glapi.addFunctions([ GlFunction(Void, "glGetObjectParameterivARB", [(GLhandleARB, "obj"), (GLenum, "pname"), Out(Array(GLint, "_gl_param_size(pname)"), "params")], sideeffects=False), GlFunction(Void, "glGetInfoLogARB", [(GLhandleARB, "obj"), (GLsizei, "maxLength"), Out(Pointer(GLsizei), "length"), Out(GLstringARB, "infoLog")], sideeffects=False), GlFunction(Void, "glGetAttachedObjectsARB", [(GLhandleARB, "containerObj"), (GLsizei, "maxCount"), Out(Pointer(GLsizei), "count"), Out(Array(GLhandleARB, "(count ? *count : maxCount)"), "obj")], sideeffects=False), - GlFunction(GLlocationARB, "glGetUniformLocationARB", [(GLhandleARB, "programObj"), (Const(GLstringARB), "name")]), + GlFunction(GLlocationARB, "glGetUniformLocationARB", [(GLhandleARB, "programObj"), (GLstringConstARB, "name")]), GlFunction(Void, "glGetActiveUniformARB", [(GLhandleARB, "programObj"), (GLuint, "index"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(Pointer(GLint), "size"), Out(Pointer(GLenum), "type"), Out(GLstringARB, "name")], sideeffects=False), GlFunction(Void, "glGetUniformfvARB", [(GLhandleARB, "programObj"), (GLlocationARB, "location"), Out(OpaquePointer(GLfloat), "params")], sideeffects=False), GlFunction(Void, "glGetUniformivARB", [(GLhandleARB, "programObj"), (GLlocationARB, "location"), Out(OpaquePointer(GLint), "params")], sideeffects=False), GlFunction(Void, "glGetShaderSourceARB", [(GLhandleARB, "obj"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(GLstringARB, "source")], sideeffects=False), # GL_ARB_vertex_shader - GlFunction(Void, "glBindAttribLocationARB", [(GLhandleARB, "programObj"), (GLuint, "index"), (Const(GLstringARB), "name")]), + GlFunction(Void, "glBindAttribLocationARB", [(GLhandleARB, "programObj"), (GLuint, "index"), (GLstringConstARB, "name")]), GlFunction(Void, "glGetActiveAttribARB", [(GLhandleARB, "programObj"), (GLuint, "index"), (GLsizei, "maxLength"), Out(Pointer(GLsizei), "length"), Out(Pointer(GLint), "size"), Out(Pointer(GLenum), "type"), Out(GLstringARB, "name")], sideeffects=False), - GlFunction(GLint, "glGetAttribLocationARB", [(GLhandleARB, "programObj"), (Const(GLstringARB), "name")]), + GlFunction(GLint, "glGetAttribLocationARB", [(GLhandleARB, "programObj"), (GLstringConstARB, "name")]), # GL_ARB_draw_buffers GlFunction(Void, "glDrawBuffersARB", [(GLsizei, "n"), (Array(Const(GLenum), "n"), "bufs")]), @@ -1021,10 +1021,10 @@ glapi.addFunctions([ GlFunction(GLboolean, "glIsVertexArray", [(GLarray, "array")], sideeffects=False), # GL_ARB_uniform_buffer_object - GlFunction(Void, "glGetUniformIndices", [(GLprogram, "program"), (GLsizei, "uniformCount"), (Array(Const(GLstring), "uniformCount"), "uniformNames"), Out(Array(GLuint, "uniformCount"), "uniformIndices")], sideeffects=False), + GlFunction(Void, "glGetUniformIndices", [(GLprogram, "program"), (GLsizei, "uniformCount"), (Array(GLstringConst, "uniformCount"), "uniformNames"), Out(Array(GLuint, "uniformCount"), "uniformIndices")], sideeffects=False), GlFunction(Void, "glGetActiveUniformsiv", [(GLprogram, "program"), (GLsizei, "uniformCount"), (Array(Const(GLuint), "uniformCount"), "uniformIndices"), (GLenum, "pname"), Out(OpaqueArray(GLint, "_glGetActiveUniformsiv_size(pname)"), "params")], sideeffects=False), GlFunction(Void, "glGetActiveUniformName", [(GLprogram, "program"), (GLuint, "uniformIndex"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(Array(GLchar, "bufSize"), "uniformName")], sideeffects=False), - GlFunction(GLuint, "glGetUniformBlockIndex", [(GLprogram, "program"), (Const(GLstring), "uniformBlockName")]), + GlFunction(GLuint, "glGetUniformBlockIndex", [(GLprogram, "program"), (GLstringConst, "uniformBlockName")]), GlFunction(Void, "glGetActiveUniformBlockiv", [(GLprogram, "program"), (GLuint, "uniformBlockIndex"), (GLenum, "pname"), Out(OpaqueArray(GLint, "_glGetActiveUniformBlockiv_size(pname)"), "params")], sideeffects=False), GlFunction(Void, "glGetActiveUniformBlockName", [(GLprogram, "program"), (GLuint, "uniformBlockIndex"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(Array(GLchar, "bufSize"), "uniformBlockName")], sideeffects=False), GlFunction(Void, "glUniformBlockBinding", [(GLprogram, "program"), (GLuint, "uniformBlockIndex"), (GLuint, "uniformBlockBinding")]), @@ -1066,16 +1066,16 @@ glapi.addFunctions([ GlFunction(Void, "glMinSampleShadingARB", [(GLclampf, "value")]), # GL_ARB_shading_language_include - GlFunction(Void, "glNamedStringARB", [(GLenum, "type"), (GLint, "namelen"), (Const(String('GLchar *', "namelen")), "name"), (GLint, "stringlen"), (Const(String('GLchar *', "stringlen")), "string")]), - GlFunction(Void, "glDeleteNamedStringARB", [(GLint, "namelen"), (Const(String('GLchar *', "namelen")), "name")]), - GlFunction(Void, "glCompileShaderIncludeARB", [(GLshader, "shader"), (GLsizei, "count"), (Array(String("const GLchar *"), "count"), "path"), (Array(Const(GLint), "count"), "length")]), - GlFunction(GLboolean, "glIsNamedStringARB", [(GLint, "namelen"), (Const(String('GLchar *', "namelen")), "name")], sideeffects=False), - GlFunction(Void, "glGetNamedStringARB", [(GLint, "namelen"), (Const(String('GLchar *', "namelen")), "name"), (GLsizei, "bufSize"), Out(Pointer(GLint), "stringlen"), Out(Array(GLchar, "bufSize"), "string")], sideeffects=False), - GlFunction(Void, "glGetNamedStringivARB", [(GLint, "namelen"), (Const(String('GLchar *', "namelen")), "name"), (GLenum, "pname"), Out(OpaqueArray(GLint, "_glGetNamedStringivARB_size(pname)"), "params")], sideeffects=False), + GlFunction(Void, "glNamedStringARB", [(GLenum, "type"), (GLint, "namelen"), (String(Const(GLchar), "namelen"), "name"), (GLint, "stringlen"), (String(Const(GLchar), "stringlen"), "string")]), + GlFunction(Void, "glDeleteNamedStringARB", [(GLint, "namelen"), (String(Const(GLchar), "namelen"), "name")]), + GlFunction(Void, "glCompileShaderIncludeARB", [(GLshader, "shader"), (GLsizei, "count"), (Array(String(Const(GLchar)), "count"), "path"), (Array(Const(GLint), "count"), "length")]), + GlFunction(GLboolean, "glIsNamedStringARB", [(GLint, "namelen"), (String(Const(GLchar), "namelen"), "name")], sideeffects=False), + GlFunction(Void, "glGetNamedStringARB", [(GLint, "namelen"), (String(Const(GLchar), "namelen"), "name"), (GLsizei, "bufSize"), Out(Pointer(GLint), "stringlen"), Out(Array(GLchar, "bufSize"), "string")], sideeffects=False), + GlFunction(Void, "glGetNamedStringivARB", [(GLint, "namelen"), (String(Const(GLchar), "namelen"), "name"), (GLenum, "pname"), Out(OpaqueArray(GLint, "_glGetNamedStringivARB_size(pname)"), "params")], sideeffects=False), # GL_ARB_blend_func_extended - GlFunction(Void, "glBindFragDataLocationIndexed", [(GLprogram, "program"), (GLuint, "colorNumber"), (GLuint, "index"), (Const(GLstring), "name")]), - GlFunction(GLint, "glGetFragDataIndex", [(GLprogram, "program"), (Const(GLstring), "name")], sideeffects=False), + GlFunction(Void, "glBindFragDataLocationIndexed", [(GLprogram, "program"), (GLuint, "colorNumber"), (GLuint, "index"), (GLstringConst, "name")]), + GlFunction(GLint, "glGetFragDataIndex", [(GLprogram, "program"), (GLstringConst, "name")], sideeffects=False), # GL_ARB_sampler_objects GlFunction(Void, "glGenSamplers", [(GLsizei, "count"), Out(Array(GLsampler, "count"), "samplers")]), @@ -1163,8 +1163,8 @@ glapi.addFunctions([ GlFunction(Void, "glGetUniformdv", [(GLprogram, "program"), (GLlocation, "location"), Out(OpaqueArray(GLdouble, "_glGetUniformdv_size(location)"), "params")], sideeffects=False), # GL_ARB_shader_subroutine - GlFunction(GLlocation, "glGetSubroutineUniformLocation", [(GLprogram, "program"), (GLenum, "shadertype"), (Const(GLstring), "name")]), - GlFunction(GLuint, "glGetSubroutineIndex", [(GLprogram, "program"), (GLenum, "shadertype"), (Const(GLstring), "name")]), + GlFunction(GLlocation, "glGetSubroutineUniformLocation", [(GLprogram, "program"), (GLenum, "shadertype"), (GLstringConst, "name")]), + GlFunction(GLuint, "glGetSubroutineIndex", [(GLprogram, "program"), (GLenum, "shadertype"), (GLstringConst, "name")]), GlFunction(Void, "glGetActiveSubroutineUniformiv", [(GLprogram, "program"), (GLenum, "shadertype"), (GLuint, "index"), (GLenum, "pname"), Out(OpaqueArray(GLint, "_glGetActiveSubroutineUniformiv_size(pname)"), "values")], sideeffects=False), GlFunction(Void, "glGetActiveSubroutineUniformName", [(GLprogram, "program"), (GLenum, "shadertype"), (GLuint, "index"), (GLsizei, "bufsize"), Out(Pointer(GLsizei), "length"), Out(Array(GLchar, "bufsize"), "name")], sideeffects=False), GlFunction(Void, "glGetActiveSubroutineName", [(GLprogram, "program"), (GLenum, "shadertype"), (GLuint, "index"), (GLsizei, "bufsize"), Out(Pointer(GLsizei), "length"), Out(Array(GLchar, "bufsize"), "name")], sideeffects=False), @@ -1206,7 +1206,7 @@ glapi.addFunctions([ # GL_ARB_separate_shader_objects GlFunction(Void, "glUseProgramStages", [(GLpipeline, "pipeline"), (GLbitfield_shader, "stages"), (GLprogram, "program")]), GlFunction(Void, "glActiveShaderProgram", [(GLpipeline, "pipeline"), (GLprogram, "program")]), - GlFunction(GLprogram, "glCreateShaderProgramv", [(GLenum, "type"), (GLsizei, "count"), (Const(Array(Const(GLstring), "count")), "strings")]), + GlFunction(GLprogram, "glCreateShaderProgramv", [(GLenum, "type"), (GLsizei, "count"), (Const(Array(GLstringConst, "count")), "strings")]), GlFunction(Void, "glBindProgramPipeline", [(GLpipeline, "pipeline")]), GlFunction(Void, "glDeleteProgramPipelines", [(GLsizei, "n"), (Array(Const(GLuint), "n"), "pipelines")]), GlFunction(Void, "glGenProgramPipelines", [(GLsizei, "n"), Out(Array(GLpipeline, "n"), "pipelines")]), @@ -1291,7 +1291,7 @@ glapi.addFunctions([ # GL_ARB_debug_output GlFunction(Void, "glDebugMessageControlARB", [(GLenum, "source"), (GLenum, "type"), (GLenum, "severity"), (GLsizei, "count"), (Array(Const(GLuint), "count"), "ids"), (GLboolean, "enabled")], sideeffects=False), - GlFunction(Void, "glDebugMessageInsertARB", [(GLenum, "source"), (GLenum, "type"), (GLuint, "id"), (GLenum, "severity"), (GLsizei, "length"), (Const(String("GLchar *", "length")), "buf")], sideeffects=False), + GlFunction(Void, "glDebugMessageInsertARB", [(GLenum, "source"), (GLenum, "type"), (GLuint, "id"), (GLenum, "severity"), (GLsizei, "length"), (String(Const(GLchar), "length"), "buf")], sideeffects=False), GlFunction(Void, "glDebugMessageCallbackARB", [(GLDEBUGPROCARB, "callback"), (GLpointerConst, "userParam")], sideeffects=False), GlFunction(GLuint, "glGetDebugMessageLogARB", [(GLuint, "count"), (GLsizei, "bufsize"), Out(Array(GLenum, "count"), "sources"), Out(Array(GLenum, "count"), "types"), Out(Array(GLuint, "count"), "ids"), Out(Array(GLenum, "count"), "severities"), Out(Array(GLsizei, "count"), "lengths"), Out(GLstring, "messageLog")], sideeffects=False), @@ -1836,7 +1836,7 @@ glapi.addFunctions([ GlFunction(Void, "glGetVertexAttribivNV", [(GLuint, "index"), (GLenum, "pname"), Out(Array(GLint, "_gl_param_size(pname)"), "params")], sideeffects=False), GlFunction(Void, "glGetVertexAttribPointervNV", [(GLuint, "index"), (GLenum, "pname"), Out(Pointer(GLpointer), "pointer")], sideeffects=False), GlFunction(GLboolean, "glIsProgramNV", [(GLprogramARB, "program")], sideeffects=False), - GlFunction(Void, "glLoadProgramNV", [(GLenum, "target"), (GLprogramARB, "id"), (GLsizei, "len"), (String("const GLubyte *", "len"), "program")]), + GlFunction(Void, "glLoadProgramNV", [(GLenum, "target"), (GLprogramARB, "id"), (GLsizei, "len"), (String(Const(GLubyte), "len"), "program")]), GlFunction(Void, "glProgramParameter4dNV", [(GLenum, "target"), (GLuint, "index"), (GLdouble, "x"), (GLdouble, "y"), (GLdouble, "z"), (GLdouble, "w")]), GlFunction(Void, "glProgramParameter4dvNV", [(GLenum, "target"), (GLuint, "index"), (Array(Const(GLdouble), 4), "v")]), GlFunction(Void, "glProgramParameter4fNV", [(GLenum, "target"), (GLuint, "index"), (GLfloat, "x"), (GLfloat, "y"), (GLfloat, "z"), (GLfloat, "w")]), @@ -2078,12 +2078,12 @@ glapi.addFunctions([ GlFunction(Void, "glDrawBuffersATI", [(GLsizei, "n"), (Array(Const(GLenum), "n"), "bufs")]), # GL_NV_fragment_program - GlFunction(Void, "glProgramNamedParameter4fNV", [(GLprogramARB, "id"), (GLsizei, "len"), (String("const GLubyte *", "len"), "name"), (GLfloat, "x"), (GLfloat, "y"), (GLfloat, "z"), (GLfloat, "w")]), - GlFunction(Void, "glProgramNamedParameter4dNV", [(GLprogramARB, "id"), (GLsizei, "len"), (String("const GLubyte *", "len"), "name"), (GLdouble, "x"), (GLdouble, "y"), (GLdouble, "z"), (GLdouble, "w")]), - GlFunction(Void, "glProgramNamedParameter4fvNV", [(GLprogramARB, "id"), (GLsizei, "len"), (String("const GLubyte *", "len"), "name"), (Array(Const(GLfloat), 4), "v")]), - GlFunction(Void, "glProgramNamedParameter4dvNV", [(GLprogramARB, "id"), (GLsizei, "len"), (String("const GLubyte *", "len"), "name"), (Array(Const(GLdouble), 4), "v")]), - GlFunction(Void, "glGetProgramNamedParameterdvNV", [(GLprogramARB, "id"), (GLsizei, "len"), (String("const GLubyte *", "len"), "name"), Out(Array(GLdouble, 4), "params")], sideeffects=False), - GlFunction(Void, "glGetProgramNamedParameterfvNV", [(GLprogramARB, "id"), (GLsizei, "len"), (String("const GLubyte *", "len"), "name"), Out(Array(GLfloat, 4), "params")], sideeffects=False), + GlFunction(Void, "glProgramNamedParameter4fNV", [(GLprogramARB, "id"), (GLsizei, "len"), (String(Const(GLubyte), "len"), "name"), (GLfloat, "x"), (GLfloat, "y"), (GLfloat, "z"), (GLfloat, "w")]), + GlFunction(Void, "glProgramNamedParameter4dNV", [(GLprogramARB, "id"), (GLsizei, "len"), (String(Const(GLubyte), "len"), "name"), (GLdouble, "x"), (GLdouble, "y"), (GLdouble, "z"), (GLdouble, "w")]), + GlFunction(Void, "glProgramNamedParameter4fvNV", [(GLprogramARB, "id"), (GLsizei, "len"), (String(Const(GLubyte), "len"), "name"), (Array(Const(GLfloat), 4), "v")]), + GlFunction(Void, "glProgramNamedParameter4dvNV", [(GLprogramARB, "id"), (GLsizei, "len"), (String(Const(GLubyte), "len"), "name"), (Array(Const(GLdouble), 4), "v")]), + GlFunction(Void, "glGetProgramNamedParameterdvNV", [(GLprogramARB, "id"), (GLsizei, "len"), (String(Const(GLubyte), "len"), "name"), Out(Array(GLdouble, 4), "params")], sideeffects=False), + GlFunction(Void, "glGetProgramNamedParameterfvNV", [(GLprogramARB, "id"), (GLsizei, "len"), (String(Const(GLubyte), "len"), "name"), Out(Array(GLfloat, 4), "params")], sideeffects=False), # GL_NV_half_float GlFunction(Void, "glVertex2hNV", [(GLhalfNV, "x"), (GLhalfNV, "y")]), @@ -2180,7 +2180,7 @@ glapi.addFunctions([ GlFunction(Void, "glGenerateMipmapEXT", [(GLenum, "target")]), # GL_GREMEDY_string_marker - GlFunction(Void, "glStringMarkerGREMEDY", [(GLsizei, "len"), (Const(String("GLvoid *", "len ? len : strlen((const char *)string)")), "string")], sideeffects=False), + GlFunction(Void, "glStringMarkerGREMEDY", [(GLsizei, "len"), (String(Const(GLvoid), "len ? len : strlen((const char *)string)"), "string")], sideeffects=False), # GL_EXT_stencil_clear_tag GlFunction(Void, "glStencilClearTagEXT", [(GLsizei, "stencilTagBits"), (GLuint, "stencilClearTag")]), @@ -2257,8 +2257,8 @@ glapi.addFunctions([ # GL_EXT_gpu_shader4 GlFunction(Void, "glGetUniformuivEXT", [(GLprogram, "program"), (GLlocation, "location"), Out(OpaqueArray(GLuint, "_glGetUniformuivEXT_size(program, location)"), "params")], sideeffects=False), - GlFunction(Void, "glBindFragDataLocationEXT", [(GLprogram, "program"), (GLuint, "color"), (Const(GLstring), "name")]), - GlFunction(GLlocation, "glGetFragDataLocationEXT", [(GLprogram, "program"), (Const(GLstring), "name")]), + GlFunction(Void, "glBindFragDataLocationEXT", [(GLprogram, "program"), (GLuint, "color"), (GLstringConst, "name")]), + GlFunction(GLlocation, "glGetFragDataLocationEXT", [(GLprogram, "program"), (GLstringConst, "name")]), GlFunction(Void, "glUniform1uiEXT", [(GLlocation, "location"), (GLuint, "v0")]), GlFunction(Void, "glUniform2uiEXT", [(GLlocation, "location"), (GLuint, "v0"), (GLuint, "v1")]), GlFunction(Void, "glUniform3uiEXT", [(GLlocation, "location"), (GLuint, "v0"), (GLuint, "v1"), (GLuint, "v2")]), @@ -2304,8 +2304,8 @@ glapi.addFunctions([ GlFunction(Void, "glBindBufferOffsetNV", [(GLenum, "target"), (GLuint, "index"), (GLbuffer, "buffer"), (GLintptr, "offset")]), GlFunction(Void, "glBindBufferBaseNV", [(GLenum, "target"), (GLuint, "index"), (GLbuffer, "buffer")]), GlFunction(Void, "glTransformFeedbackVaryingsNV", [(GLprogram, "program"), (GLsizei, "count"), (Array(Const(GLint), "count"), "locations"), (GLenum, "bufferMode")]), - GlFunction(Void, "glActiveVaryingNV", [(GLprogram, "program"), (Const(GLstring), "name")]), - GlFunction(GLlocation, "glGetVaryingLocationNV", [(GLprogram, "program"), (Const(GLstring), "name")]), + GlFunction(Void, "glActiveVaryingNV", [(GLprogram, "program"), (GLstringConst, "name")]), + GlFunction(GLlocation, "glGetVaryingLocationNV", [(GLprogram, "program"), (GLstringConst, "name")]), GlFunction(Void, "glGetActiveVaryingNV", [(GLprogram, "program"), (GLuint, "index"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(Pointer(GLsizei), "size"), Out(Pointer(GLenum), "type"), Out(GLstring, "name")], sideeffects=False), GlFunction(Void, "glGetTransformFeedbackVaryingNV", [(GLprogram, "program"), (GLuint, "index"), Out(Pointer(GLlocation), "location")], sideeffects=False), GlFunction(Void, "glTransformFeedbackStreamAttribsNV", [(GLsizei, "count"), (Array(Const(GLint), "count"), "attribs"), (GLsizei, "nbuffers"), (Array(Const(GLint), "nbuffers"), "bufstreams"), (GLenum, "bufferMode")]), @@ -2344,7 +2344,7 @@ glapi.addFunctions([ GlFunction(Void, "glBindBufferRangeEXT", [(GLenum, "target"), (GLuint, "index"), (GLbuffer, "buffer"), (GLintptr, "offset"), (GLsizeiptr, "size")]), GlFunction(Void, "glBindBufferOffsetEXT", [(GLenum, "target"), (GLuint, "index"), (GLbuffer, "buffer"), (GLintptr, "offset")]), GlFunction(Void, "glBindBufferBaseEXT", [(GLenum, "target"), (GLuint, "index"), (GLbuffer, "buffer")]), - GlFunction(Void, "glTransformFeedbackVaryingsEXT", [(GLprogram, "program"), (GLsizei, "count"), (Const(Array(Const(GLstring), "count")), "varyings"), (GLenum, "bufferMode")]), + GlFunction(Void, "glTransformFeedbackVaryingsEXT", [(GLprogram, "program"), (GLsizei, "count"), (Const(Array(GLstringConst, "count")), "varyings"), (GLenum, "bufferMode")]), GlFunction(Void, "glGetTransformFeedbackVaryingEXT", [(GLprogram, "program"), (GLuint, "index"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(Pointer(GLsizei), "size"), Out(Pointer(GLenum), "type"), Out(GLstring, "name")], sideeffects=False), # GL_EXT_direct_state_access @@ -2445,7 +2445,7 @@ glapi.addFunctions([ GlFunction(Void, "glCompressedMultiTexSubImage2DEXT", [(GLenum, "texunit"), (GLenum, "target"), (GLint, "level"), (GLint, "xoffset"), (GLint, "yoffset"), (GLsizei, "width"), (GLsizei, "height"), (GLenum, "format"), (GLsizei, "imageSize"), (Blob(Const(GLvoid), "imageSize"), "bits")]), GlFunction(Void, "glCompressedMultiTexSubImage1DEXT", [(GLenum, "texunit"), (GLenum, "target"), (GLint, "level"), (GLint, "xoffset"), (GLsizei, "width"), (GLenum, "format"), (GLsizei, "imageSize"), (Blob(Const(GLvoid), "imageSize"), "bits")]), GlFunction(Void, "glGetCompressedMultiTexImageEXT", [(GLenum, "texunit"), (GLenum, "target"), (GLint, "lod"), Out(OpaqueBlob(GLvoid, "_glGetCompressedMultiTexImageEXT_size(target, lod)"), "img")], sideeffects=False), - GlFunction(Void, "glNamedProgramStringEXT", [(GLprogram, "program"), (GLenum, "target"), (GLenum, "format"), (GLsizei, "len"), (Const(String("GLvoid *", "len")), "string")]), + GlFunction(Void, "glNamedProgramStringEXT", [(GLprogram, "program"), (GLenum, "target"), (GLenum, "format"), (GLsizei, "len"), (String(Const(GLvoid), "len"), "string")]), GlFunction(Void, "glNamedProgramLocalParameter4dEXT", [(GLprogram, "program"), (GLenum, "target"), (GLuint, "index"), (GLdouble, "x"), (GLdouble, "y"), (GLdouble, "z"), (GLdouble, "w")]), GlFunction(Void, "glNamedProgramLocalParameter4dvEXT", [(GLprogram, "program"), (GLenum, "target"), (GLuint, "index"), (Array(Const(GLdouble), 4), "params")]), GlFunction(Void, "glNamedProgramLocalParameter4fEXT", [(GLprogram, "program"), (GLenum, "target"), (GLuint, "index"), (GLfloat, "x"), (GLfloat, "y"), (GLfloat, "z"), (GLfloat, "w")]), @@ -2652,7 +2652,7 @@ glapi.addFunctions([ # GL_EXT_separate_shader_objects GlFunction(Void, "glUseShaderProgramEXT", [(GLenum, "type"), (GLprogram, "program")]), GlFunction(Void, "glActiveProgramEXT", [(GLprogram, "program")]), - GlFunction(GLprogram, "glCreateShaderProgramEXT", [(GLenum, "type"), (Const(GLstring), "string")]), + GlFunction(GLprogram, "glCreateShaderProgramEXT", [(GLenum, "type"), (GLstringConst, "string")]), # GL_NV_shader_buffer_load GlFunction(Void, "glMakeBufferResidentNV", [(GLenum, "target"), (GLenum, "access")]), diff --git a/specs/glesapi.py b/specs/glesapi.py index 2bf28531..46c6ef02 100644 --- a/specs/glesapi.py +++ b/specs/glesapi.py @@ -207,12 +207,12 @@ glesapi.addFunctions([ GlFunction(Void, "glReadBufferNV", [(GLenum, "mode")]), # GL_EXT_debug_label - GlFunction(Void, "glLabelObjectEXT", [(GLenum, "type"), (GLuint, "object"), (GLsizei, "length"), (Const(GLstring), "label")]), + GlFunction(Void, "glLabelObjectEXT", [(GLenum, "type"), (GLuint, "object"), (GLsizei, "length"), (GLstringConst, "label")]), GlFunction(Void, "glGetObjectLabelEXT", [(GLenum, "type"), (GLuint, "object"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(GLstring, "label")], sideeffects=False), # GL_EXT_debug_marker - GlFunction(Void, "glInsertEventMarkerEXT", [(GLsizei, "length"), (Const(String("GLchar *", "length ? length : strlen(marker)")), "marker")], sideeffects=False), - GlFunction(Void, "glPushGroupMarkerEXT", [(GLsizei, "length"), (Const(String("GLchar *", "length ? length : strlen(marker)")), "marker")], sideeffects=False), + GlFunction(Void, "glInsertEventMarkerEXT", [(GLsizei, "length"), (String(Const(GLchar), "length ? length : strlen(marker)"), "marker")], sideeffects=False), + GlFunction(Void, "glPushGroupMarkerEXT", [(GLsizei, "length"), (String(Const(GLchar), "length ? length : strlen(marker)"), "marker")], sideeffects=False), GlFunction(Void, "glPopGroupMarkerEXT", [], sideeffects=False), # GL_EXT_occlusion_query_boolean @@ -227,7 +227,7 @@ glesapi.addFunctions([ # GL_EXT_separate_shader_objects GlFunction(Void, "glUseProgramStagesEXT", [(GLpipeline, "pipeline"), (GLbitfield_shader, "stages"), (GLprogram, "program")]), GlFunction(Void, "glActiveShaderProgramEXT", [(GLpipeline, "pipeline"), (GLprogram, "program")]), - GlFunction(GLprogram, "glCreateShaderProgramvEXT", [(GLenum, "type"), (GLsizei, "count"), (Const(Array(Const(GLstring), "count")), "strings")]), + GlFunction(GLprogram, "glCreateShaderProgramvEXT", [(GLenum, "type"), (GLsizei, "count"), (Const(Array(GLstringConst, "count")), "strings")]), GlFunction(Void, "glBindProgramPipelineEXT", [(GLpipeline, "pipeline")]), GlFunction(Void, "glDeleteProgramPipelinesEXT", [(GLsizei, "n"), (Array(Const(GLuint), "n"), "pipelines")]), GlFunction(Void, "glGenProgramPipelinesEXT", [(GLsizei, "n"), Out(Array(GLpipeline, "n"), "pipelines")]), diff --git a/specs/gltypes.py b/specs/gltypes.py index 71d7cd61..7831a9c7 100644 --- a/specs/gltypes.py +++ b/specs/gltypes.py @@ -53,11 +53,9 @@ GLfloat = Alias("GLfloat", Float) GLclampf = Alias("GLclampf", Float) GLdouble = Alias("GLdouble", Double) GLclampd = Alias("GLclampd", Double) -GLchar = Alias("GLchar", SChar) -GLstring = String("GLchar *") +GLchar = Alias("GLchar", Char) GLcharARB = Alias("GLcharARB", SChar) -GLstringARB = String("GLcharARB *") GLintptrARB = Alias("GLintptrARB", Int) GLsizeiptrARB = Alias("GLsizeiptrARB", Int) GLhandleARB = Handle("handleARB", Alias("GLhandleARB", UInt)) @@ -68,6 +66,11 @@ GLuint64EXT = Alias("GLuint64EXT", UInt64) GLDEBUGPROCARB = Opaque("GLDEBUGPROCARB") GLDEBUGPROCAMD = Opaque("GLDEBUGPROCAMD") +GLstring = String(GLchar) +GLstringConst = String(Const(GLchar)) +GLstringARB = String(GLcharARB) +GLstringConstARB = String(Const(GLcharARB)) + GLpointer = OpaquePointer(GLvoid) GLpointerConst = OpaquePointer(Const(GLvoid)) diff --git a/specs/glxapi.py b/specs/glxapi.py index b6588760..85699ead 100644 --- a/specs/glxapi.py +++ b/specs/glxapi.py @@ -270,9 +270,9 @@ glxapi.addFunctions([ Function(Void, "glXUseXFont", [(Font, "font"), (Int, "first"), (Int, "count"), (Int, "list")]), # GLX 1.1 and later - Function((Const(CString)), "glXQueryExtensionsString", [(Display, "dpy"), (Int, "screen")]), - Function((Const(CString)), "glXQueryServerString", [(Display, "dpy"), (Int, "screen"), (GLXname, "name")]), - Function((Const(CString)), "glXGetClientString", [(Display, "dpy"), (GLXname, "name")]), + Function((ConstCString), "glXQueryExtensionsString", [(Display, "dpy"), (Int, "screen")]), + Function((ConstCString), "glXQueryServerString", [(Display, "dpy"), (Int, "screen"), (GLXname, "name")]), + Function((ConstCString), "glXGetClientString", [(Display, "dpy"), (GLXname, "name")]), # GLX 1.2 and later Function(Display, "glXGetCurrentDisplay", [], sideeffects=False), @@ -449,8 +449,8 @@ glxapi.addFunctions([ Function(Void, "glXFreeMemoryNV", [(OpaquePointer(Void), "pointer")]), # Must be last - Function(PROC, "glXGetProcAddressARB", [(Alias("const GLubyte *", CString), "procName")]), - Function(PROC, "glXGetProcAddress", [(Alias("const GLubyte *", CString), "procName")]), + Function(PROC, "glXGetProcAddressARB", [(String(Const(GLubyte)), "procName")]), + Function(PROC, "glXGetProcAddress", [(String(Const(GLubyte)), "procName")]), ]) diff --git a/specs/stdapi.py b/specs/stdapi.py index b2bd9040..cde94cb6 100644 --- a/specs/stdapi.py +++ b/specs/stdapi.py @@ -102,17 +102,41 @@ class Literal(Type): return visitor.visitLiteral(self, *args, **kwargs) +Bool = Literal("bool", "Bool") +SChar = Literal("signed char", "SInt") +UChar = Literal("unsigned char", "UInt") +Short = Literal("short", "SInt") +Int = Literal("int", "SInt") +Long = Literal("long", "SInt") +LongLong = Literal("long long", "SInt") +UShort = Literal("unsigned short", "UInt") +UInt = Literal("unsigned int", "UInt") +ULong = Literal("unsigned long", "UInt") +ULongLong = Literal("unsigned long long", "UInt") +Float = Literal("float", "Float") +Double = Literal("double", "Double") +SizeT = Literal("size_t", "UInt") + +Char = Literal("char", "SInt") +WChar = Literal("wchar_t", "SInt") + +Int8 = Literal("int8_t", "SInt") +UInt8 = Literal("uint8_t", "UInt") +Int16 = Literal("int16_t", "SInt") +UInt16 = Literal("uint16_t", "UInt") +Int32 = Literal("int32_t", "SInt") +UInt32 = Literal("uint32_t", "UInt") +Int64 = Literal("int64_t", "SInt") +UInt64 = Literal("uint64_t", "UInt") + + class Const(Type): def __init__(self, type): # While "const foo" and "foo const" are synonymous, "const foo *" and # "foo * const" are not quite the same, and some compilers do enforce # strict const correctness. - if isinstance(type, String) or type is WString: - # For strings we never intend to say a const pointer to chars, but - # rather a point to const chars. - expr = "const " + type.expr - elif type.expr.startswith("const ") or '*' in type.expr: + if type.expr.startswith("const ") or '*' in type.expr: expr = type.expr + " const" else: # The most legible @@ -453,11 +477,14 @@ def StdMethod(*args, **kwargs): class String(Type): + '''Human-legible character string.''' - def __init__(self, expr = "char *", length = None, kind = 'String'): - Type.__init__(self, expr) + def __init__(self, type = Char, length = None, wide = False): + assert isinstance(type, Type) + Type.__init__(self, type.expr + ' *') + self.type = type self.length = length - self.kind = kind + self.wide = wide def visit(self, visitor, *args, **kwargs): return visitor.visitString(self, *args, **kwargs) @@ -610,7 +637,11 @@ class Rebuilder(Visitor): return literal def visitString(self, string): - return string + string_type = self.visit(string.type) + if string_type is string.type: + return string + else: + return String(string_type, string.length, string.wide) def visitConst(self, const): const_type = self.visit(const.type) @@ -699,6 +730,9 @@ class Rebuilder(Visitor): class MutableRebuilder(Rebuilder): '''Type visitor which derives a mutable type.''' + def visitString(self, string): + return string + def visitConst(self, const): # Strip out const qualifier return const.type @@ -859,30 +893,8 @@ class API: return None -Bool = Literal("bool", "Bool") -SChar = Literal("signed char", "SInt") -UChar = Literal("unsigned char", "UInt") -Short = Literal("short", "SInt") -Int = Literal("int", "SInt") -Long = Literal("long", "SInt") -LongLong = Literal("long long", "SInt") -UShort = Literal("unsigned short", "UInt") -UInt = Literal("unsigned int", "UInt") -ULong = Literal("unsigned long", "UInt") -ULongLong = Literal("unsigned long long", "UInt") -Float = Literal("float", "Float") -Double = Literal("double", "Double") -SizeT = Literal("size_t", "UInt") - # C string (i.e., zero terminated) -CString = String() -WString = String("wchar_t *", kind="WString") - -Int8 = Literal("int8_t", "SInt") -UInt8 = Literal("uint8_t", "UInt") -Int16 = Literal("int16_t", "SInt") -UInt16 = Literal("uint16_t", "UInt") -Int32 = Literal("int32_t", "SInt") -UInt32 = Literal("uint32_t", "UInt") -Int64 = Literal("int64_t", "SInt") -UInt64 = Literal("uint64_t", "UInt") +CString = String(Char) +WString = String(WChar, wide=True) +ConstCString = String(Const(Char)) +ConstWString = String(Const(WChar), wide=True) diff --git a/specs/wglapi.py b/specs/wglapi.py index ff789377..e3d8b236 100644 --- a/specs/wglapi.py +++ b/specs/wglapi.py @@ -175,7 +175,7 @@ wglapi.addFunctions([ StdFunction(BOOL, "wglRestoreBufferRegionARB", [(HANDLE, "hRegion"), (Int, "x"), (Int, "y"), (Int, "width"), (Int, "height"), (Int, "xSrc"), (Int, "ySrc")]), # WGL_ARB_extensions_string - StdFunction(Const(CString), "wglGetExtensionsStringARB", [(HDC, "hdc")], sideeffects=False), + StdFunction(ConstCString, "wglGetExtensionsStringARB", [(HDC, "hdc")], sideeffects=False), # WGL_ARB_pixel_format StdFunction(BOOL, "wglGetPixelFormatAttribivARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(WGLenum, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False), @@ -202,7 +202,7 @@ wglapi.addFunctions([ StdFunction(HGLRC, "wglCreateContextAttribsARB", [(HDC, "hDC"), (HGLRC, "hShareContext"), (Array(Const(WGLenum), "_AttribPairList_size(attribList)"), "attribList")]), # WGL_EXT_extensions_string - StdFunction(Const(CString), "wglGetExtensionsStringEXT", [], sideeffects=False), + StdFunction(ConstCString, "wglGetExtensionsStringEXT", [], sideeffects=False), # WGL_EXT_make_current_read StdFunction(BOOL, "wglMakeContextCurrentEXT", [(HDC, "hDrawDC"), (HDC, "hReadDC"), (HGLRC, "hglrc")]), diff --git a/specs/winapi.py b/specs/winapi.py index c27d0be1..23d6419f 100644 --- a/specs/winapi.py +++ b/specs/winapi.py @@ -65,9 +65,9 @@ LPDWORD = Pointer(DWORD) LPBOOL = Pointer(BOOL) LPSTR = CString -LPCSTR = Const(CString) +LPCSTR = ConstCString LPWSTR = WString -LPCWSTR = Const(WString) +LPCWSTR = ConstWString LARGE_INTEGER = Struct("LARGE_INTEGER", [ (LONGLONG, 'QuadPart'), diff --git a/wrappers/trace.py b/wrappers/trace.py index 2146f68b..30668365 100644 --- a/wrappers/trace.py +++ b/wrappers/trace.py @@ -162,12 +162,12 @@ class ValueSerializer(stdapi.Visitor): print ' trace::localWriter.write%s(%s);' % (literal.kind, instance) def visitString(self, string, instance): - if string.kind == 'String': + if not string.wide: cast = 'const char *' - elif string.kind == 'WString': - cast = 'const wchar_t *' + suffix = 'String' else: - assert False + cast = 'const wchar_t *' + suffix = 'WString' if cast != string.expr: # reinterpret_cast is necessary for GLubyte * <=> char * instance = 'reinterpret_cast<%s>(%s)' % (cast, instance) @@ -175,7 +175,7 @@ class ValueSerializer(stdapi.Visitor): length = ', %s' % string.length else: length = '' - print ' trace::localWriter.write%s(%s%s);' % (string.kind, instance, length) + print ' trace::localWriter.write%s(%s%s);' % (suffix, instance, length) def visitConst(self, const, instance): self.visit(const.type, instance) |