]> git.cworth.org Git - apitrace/blobdiff - specs/stdapi.py
Allow float-based attrib_lists as found in WGL.
[apitrace] / specs / stdapi.py
index c652736a8383e9156e5bd7e88af34dde79760382..5cf1a37def1295c08620014332487f5539298876 100644 (file)
@@ -270,6 +270,28 @@ class Array(Type):
         return visitor.visitArray(self, *args, **kwargs)
 
 
+class AttribArray(Type):
+
+    def __init__(self, keyType, valueTypes, isConst = True, punType = None, terminator = '0'):
+        self.baseType = Int
+        if punType is not None:
+            self.baseType = punType
+        if isConst:
+            Type.__init__(self, (Pointer(Const(self.baseType))).expr)
+        else:
+            Type.__init__(self, (Pointer(self.baseType)).expr)
+        self.keyType = keyType
+        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):
@@ -434,6 +456,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():
@@ -566,6 +594,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
 
@@ -770,6 +801,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