]> git.cworth.org Git - apitrace/commitdiff
First stab at arrays.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 22 Jul 2009 17:14:12 +0000 (18:14 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 22 Jul 2009 17:14:12 +0000 (18:14 +0100)
base.py
opengl32.py

diff --git a/base.py b/base.py
index 2874489c3e7ccd81948392d2ff21f862416d4b70..0d94daaa9a75e7eb869c6c2411584698484e1d1f 100644 (file)
--- a/base.py
+++ b/base.py
@@ -206,6 +206,28 @@ class Flags(Concrete):
         print '    }'
 
 
+class Array(Type):
+
+    def __init__(self, type, length):
+        Type.__init__(self, type.expr + " *", 'P' + type.id)
+        self.type = type
+        self.length = length
+
+    def dump(self, instance):
+        index = '__i' + self.type.id
+        print '    for (int %s; %s < %s; ++%s) {' % (index, index, self.length, index)
+        print '        Log::BeginElement("%s");' % (self.type,)
+        self.type.dump('(%s)[%s]' % (instance, index))
+        print '        Log::EndElement();'
+        print '    }'
+
+    def wrap_instance(self, instance):
+        self.type.wrap_instance("*" + instance)
+
+    def unwrap_instance(self, instance):
+        self.type.wrap_instance("*" + instance)
+
+
 class Struct(Concrete):
 
     def __init__(self, name, members):
index 6b946af1d41a02b266cc4aa748111d7a3ebf4516..5cb4419a207c687ae6a00f0c4e0f7cf2d73d4d73 100644 (file)
@@ -36,7 +36,7 @@ opengl32.functions += [
     DllFunction(Void, "glColor3d", [(GLdouble, "red"), (GLdouble, "green"), (GLdouble, "blue")]),
     DllFunction(Void, "glColor3dv", [(Pointer(Const(GLdouble)), "v")]),
     DllFunction(Void, "glColor3f", [(GLfloat, "red"), (GLfloat, "green"), (GLfloat, "blue")]),
-    DllFunction(Void, "glColor3fv", [(Pointer(Const(GLfloat)), "v")]),
+    DllFunction(Void, "glColor3fv", [(Array(Const(GLfloat), "3"), "v")]),
     DllFunction(Void, "glColor3i", [(GLint, "red"), (GLint, "green"), (GLint, "blue")]),
     DllFunction(Void, "glColor3iv", [(Pointer(Const(GLint)), "v")]),
     DllFunction(Void, "glColor3s", [(GLshort, "red"), (GLshort, "green"), (GLshort, "blue")]),