]> git.cworth.org Git - apitrace/blobdiff - specs/stdapi.py
retrace: Implement glxCopySubBufferMESA
[apitrace] / specs / stdapi.py
index b86668bd13be9d2a44b34227fbf5d06eee7733f5..c2a154db0f19936b4048ac2609886ea223340e2a 100644 (file)
@@ -270,6 +270,22 @@ class Array(Type):
         return visitor.visitArray(self, *args, **kwargs)
 
 
+class AttribArray(Type):
+
+    def __init__(self, baseType, valueTypes, terminator = '0'):
+        self.baseType = baseType
+        Type.__init__(self, (Pointer(self.baseType)).expr)
+        self.valueTypes = valueTypes
+        self.terminator = terminator
+        self.hasKeysWithoutValues = False
+        for key, value in valueTypes:
+            if value is None:
+                self.hasKeysWithoutValues = True
+
+    def visit(self, visitor, *args, **kwargs):
+        return visitor.visitAttribArray(self, *args, **kwargs)
+
+
 class Blob(Type):
 
     def __init__(self, type, size):
@@ -385,6 +401,12 @@ class Function:
     def argNames(self):
         return [arg.name for arg in self.args]
 
+    def getArgByName(self, name):
+        for arg in self.args:
+            if arg.name == name:
+                return arg
+        return None
+
 
 def StdFunction(*args, **kwargs):
     kwargs.setdefault('call', '__stdcall')
@@ -428,6 +450,12 @@ class Interface(Type):
             iface = iface.base
         raise StopIteration
 
+    def hasBase(self, *bases):
+        for iface in self.iterBases():
+            if iface in bases:
+                return True
+        return False
+
     def iterBaseMethods(self):
         if self.base is not None:
             for iface, method in self.base.iterBaseMethods():
@@ -560,6 +588,9 @@ class Visitor:
     def visitArray(self, array, *args, **kwargs):
         raise NotImplementedError
 
+    def visitAttribArray(self, array, *args, **kwargs):
+        raise NotImplementedError
+
     def visitBlob(self, blob, *args, **kwargs):
         raise NotImplementedError
 
@@ -764,6 +795,11 @@ class Traverser(Visitor):
     def visitArray(self, array, *args, **kwargs):
         self.visit(array.type, *args, **kwargs)
 
+    def visitAttribArray(self, attribs, *args, **kwargs):
+        for key, valueType in attribs.valueTypes:
+            if valueType is not None:
+                self.visit(valueType, *args, **kwargs)
+
     def visitBlob(self, array, *args, **kwargs):
         pass