From 5f81c3ae45c738f4c50712877b61a15d96a0b014 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 24 Nov 2010 08:42:22 +0000 Subject: [PATCH] glProgramStringARB --- base.py | 7 ++++--- d3d8types.py | 4 ++-- d3d9types.py | 6 +++--- ddraw.py | 8 ++++---- glapi.py | 8 ++++---- glxtrace.py | 4 ++-- log.cpp | 10 ++++++++++ log.hpp | 1 + wglapi.py | 4 ++-- windows.py | 4 ++-- 10 files changed, 34 insertions(+), 22 deletions(-) diff --git a/base.py b/base.py index 6b49009..c99d065 100644 --- a/base.py +++ b/base.py @@ -415,15 +415,16 @@ def WrapPointer(type): return Pointer(type) -class _String(Type): +class String(Type): - def __init__(self): + def __init__(self, length = None): Type.__init__(self, "char *") + self.length = length def visit(self, visitor, *args, **kwargs): return visitor.visit_string(self, *args, **kwargs) -String = _String() +CString = String() class Opaque(Type): diff --git a/d3d8types.py b/d3d8types.py index ad8b35b..9f87b82 100644 --- a/d3d8types.py +++ b/d3d8types.py @@ -999,8 +999,8 @@ D3DTRIPATCH_INFO = Struct("D3DTRIPATCH_INFO", [ ]) D3DADAPTER_IDENTIFIER8 = Struct("D3DADAPTER_IDENTIFIER8", [ - (String, "Driver"), - (String, "Description"), + (CString, "Driver"), + (CString, "Description"), (LARGE_INTEGER, "DriverVersion"), (DWORD, "VendorId"), (DWORD, "DeviceId"), diff --git a/d3d9types.py b/d3d9types.py index e9e1280..cef8bd7 100644 --- a/d3d9types.py +++ b/d3d9types.py @@ -1171,9 +1171,9 @@ D3DTRIPATCH_INFO = Struct("D3DTRIPATCH_INFO", [ ]) D3DADAPTER_IDENTIFIER9 = Struct("D3DADAPTER_IDENTIFIER9", [ - (String, "Driver"), - (String, "Description"), - (String, "DeviceName"), + (CString, "Driver"), + (CString, "Description"), + (CString, "DeviceName"), (LARGE_INTEGER, "DriverVersion"), (DWORD, "VendorId"), (DWORD, "DeviceId"), diff --git a/ddraw.py b/ddraw.py index bc2065b..d04ae90 100644 --- a/ddraw.py +++ b/ddraw.py @@ -485,8 +485,8 @@ DDGAMMARAMP = Struct("DDGAMMARAMP", [ LPDDGAMMARAMP = Pointer(DDGAMMARAMP) DDDEVICEIDENTIFIER = Struct("DDDEVICEIDENTIFIER", [ - (String, "szDriver"), - (String, "szDescription"), + (CString, "szDriver"), + (CString, "szDescription"), (LARGE_INTEGER, "liDriverVersion"), (DWORD, "dwVendorId"), (DWORD, "dwDeviceId"), @@ -497,8 +497,8 @@ DDDEVICEIDENTIFIER = Struct("DDDEVICEIDENTIFIER", [ LPDDDEVICEIDENTIFIER = Pointer(DDDEVICEIDENTIFIER) DDDEVICEIDENTIFIER2 = Struct("DDDEVICEIDENTIFIER2", [ - (String, "szDriver[MAX_DDDEVICEID_STRING]"), - (String, "szDescription[MAX_DDDEVICEID_STRING]"), + (CString, "szDriver[MAX_DDDEVICEID_STRING]"), + (CString, "szDescription[MAX_DDDEVICEID_STRING]"), (LARGE_INTEGER, "liDriverVersion"), (DWORD, "dwVendorId"), (DWORD, "dwDeviceId"), diff --git a/glapi.py b/glapi.py index 3d78755..a19c412 100644 --- a/glapi.py +++ b/glapi.py @@ -54,8 +54,8 @@ GLhalfNV = Alias("GLhalfNV", UShort) GLint64EXT = Alias("GLint64EXT", LongLong) GLuint64EXT = Alias("GLuint64EXT", ULongLong) -GLstring = Alias("const GLchar *", String) -GLstringARB = Alias("const GLcharARB *", String) +GLstring = Alias("const GLchar *", CString) +GLstringARB = Alias("const GLcharARB *", CString) GLenum = Enum("GLenum", [ #"GL_NO_ERROR", # 0x0 @@ -2807,7 +2807,7 @@ def basic_functions(Function): F(Void, "glGetPixelMapuiv", [(GLenum, "map"), Out(Pointer(GLuint), "values")], sideeffects=False), F(Void, "glGetPixelMapusv", [(GLenum, "map"), Out(Pointer(GLushort), "values")], sideeffects=False), F(Void, "glGetPolygonStipple", [Out(Pointer(GLubyte), "mask")], sideeffects=False), - F(Alias("const GLubyte *", String), "glGetString", [(GLenum, "name")], sideeffects=False), + F(Alias("const GLubyte *", CString), "glGetString", [(GLenum, "name")], sideeffects=False), F(Void, "glGetTexEnvfv", [(GLenum, "target"), (GLenum, "pname"), Out(Pointer(GLfloat), "params")], sideeffects=False), F(Void, "glGetTexEnviv", [(GLenum, "target"), (GLenum, "pname"), Out(Pointer(GLint), "params")], sideeffects=False), F(Void, "glGetTexGendv", [(GLenum, "coord"), (GLenum, "pname"), Out(Pointer(GLdouble), "params")], sideeffects=False), @@ -3004,7 +3004,7 @@ def extended_functions(Function): F(Void, "glProgramLocalParameter4dvARB", [(GLenum, "target"), (GLuint, "index"), (OpaquePointer(Const(GLdouble)), "params")]), F(Void, "glProgramLocalParameter4fARB", [(GLenum, "target"), (GLuint, "index"), (GLfloat, "x"), (GLfloat, "y"), (GLfloat, "z"), (GLfloat, "w")]), F(Void, "glProgramLocalParameter4fvARB", [(GLenum, "target"), (GLuint, "index"), (OpaquePointer(Const(GLfloat)), "params")]), - F(Void, "glProgramStringARB", [(GLenum, "target"), (GLenum, "format"), (GLsizei, "len"), (OpaquePointer(Const(GLvoid)), "string")]), + F(Void, "glProgramStringARB", [(GLenum, "target"), (GLenum, "format"), (GLsizei, "len"), (Alias("const void *", String("len")), "string")]), F(Void, "glVertexAttrib1dARB", [(GLuint, "index"), (GLdouble, "x")]), F(Void, "glVertexAttrib1dvARB", [(GLuint, "index"), (Array(Const(GLdouble), "1"), "v")]), F(Void, "glVertexAttrib1fARB", [(GLuint, "index"), (GLfloat, "x")]), diff --git a/glxtrace.py b/glxtrace.py index 1b9aeac..2fa5ae5 100644 --- a/glxtrace.py +++ b/glxtrace.py @@ -35,8 +35,8 @@ PROC = Opaque("__GLXextFuncPtr") glxapi.add_functions(glapi.functions) glxapi.add_functions([ - Function(PROC, "glXGetProcAddressARB", [(Alias("const GLubyte *", String), "procName")]), - Function(PROC, "glXGetProcAddress", [(Alias("const GLubyte *", String), "procName")]), + Function(PROC, "glXGetProcAddressARB", [(Alias("const GLubyte *", CString), "procName")]), + Function(PROC, "glXGetProcAddress", [(Alias("const GLubyte *", CString), "procName")]), ]) diff --git a/log.cpp b/log.cpp index 7a5911a..3d5d545 100644 --- a/log.cpp +++ b/log.cpp @@ -266,6 +266,16 @@ void LiteralString(const char *str) { WriteString(str); } +void LiteralString(const char *str, size_t len) { + if (!str) { + LiteralNull(); + return; + } + WriteByte(Trace::TYPE_STRING); + WriteUInt(len); + Write(str, len); +} + void LiteralWString(const wchar_t *str) { if (!str) { LiteralNull(); diff --git a/log.hpp b/log.hpp index 7d03e64..56df8c2 100644 --- a/log.hpp +++ b/log.hpp @@ -64,6 +64,7 @@ namespace Log { void LiteralFloat(float value); void LiteralFloat(double value); void LiteralString(const char *str); + void LiteralString(const char *str, size_t size); void LiteralWString(const wchar_t *str); void LiteralBlob(const void *data, size_t size); void LiteralNamedConstant(const char *name, long long value); diff --git a/wglapi.py b/wglapi.py index 4f05e6b..099c898 100644 --- a/wglapi.py +++ b/wglapi.py @@ -212,7 +212,7 @@ wglapi.add_functions([ StdFunction(DWORD, "wglSwapMultipleBuffers", [(UINT, "n"), (Array(Const(WGLSWAP), "n"), "ps")]), # WGL_ARB_extensions_string - StdFunction(Const(String), "wglGetExtensionsStringARB", [(HDC, "hdc")], sideeffects=False), + StdFunction(Const(CString), "wglGetExtensionsStringARB", [(HDC, "hdc")], sideeffects=False), # WGL_ARB_pbuffer StdFunction(HPBUFFERARB, "wglCreatePbufferARB", [(HDC, "hDC"), (Int, "iPixelFormat"), (Int, "iWidth"), (Int, "iHeight"), (Pointer(Const(Int)), "piAttribList")]), @@ -227,7 +227,7 @@ wglapi.add_functions([ StdFunction(BOOL, "wglChoosePixelFormatARB", [(HDC, "hdc"), (Pointer(Const(Int)), "piAttribIList"), (Pointer(Const(FLOAT)), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "nMaxFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]), # WGL_EXT_extensions_string - StdFunction(Const(String), "wglGetExtensionsStringEXT", [], sideeffects=False), + StdFunction(Const(CString), "wglGetExtensionsStringEXT", [], sideeffects=False), # WGL_EXT_pixel_format StdFunction(BOOL, "wglGetPixelFormatAttribivEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False), diff --git a/windows.py b/windows.py index 9c6b96f..001d8dd 100644 --- a/windows.py +++ b/windows.py @@ -51,8 +51,8 @@ LPDWORD = Pointer(DWORD) LPBOOL = Pointer(BOOL) LPSIZE = LPDWORD -LPSTR = String -LPCSTR = Const(String) +LPSTR = CString +LPCSTR = Const(CString) LPWSTR = WString LPCWSTR = Const(WString) -- 2.43.0