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):
])
D3DADAPTER_IDENTIFIER8 = Struct("D3DADAPTER_IDENTIFIER8", [
- (String, "Driver"),
- (String, "Description"),
+ (CString, "Driver"),
+ (CString, "Description"),
(LARGE_INTEGER, "DriverVersion"),
(DWORD, "VendorId"),
(DWORD, "DeviceId"),
])
D3DADAPTER_IDENTIFIER9 = Struct("D3DADAPTER_IDENTIFIER9", [
- (String, "Driver"),
- (String, "Description"),
- (String, "DeviceName"),
+ (CString, "Driver"),
+ (CString, "Description"),
+ (CString, "DeviceName"),
(LARGE_INTEGER, "DriverVersion"),
(DWORD, "VendorId"),
(DWORD, "DeviceId"),
LPDDGAMMARAMP = Pointer(DDGAMMARAMP)
DDDEVICEIDENTIFIER = Struct("DDDEVICEIDENTIFIER", [
- (String, "szDriver"),
- (String, "szDescription"),
+ (CString, "szDriver"),
+ (CString, "szDescription"),
(LARGE_INTEGER, "liDriverVersion"),
(DWORD, "dwVendorId"),
(DWORD, "dwDeviceId"),
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"),
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
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),
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")]),
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")]),
])
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();
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);
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")]),
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),
LPBOOL = Pointer(BOOL)
LPSIZE = LPDWORD
-LPSTR = String
-LPCSTR = Const(String)
+LPSTR = CString
+LPCSTR = Const(CString)
LPWSTR = WString
LPCWSTR = Const(WString)