X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=specs%2Fstdapi.py;h=5cf1a37def1295c08620014332487f5539298876;hb=edea899194c441353943c22577bc22bf0e64d187;hp=b86668bd13be9d2a44b34227fbf5d06eee7733f5;hpb=77373c35010d89e5ab3f030e4c60f8f6e3fdbe82;p=apitrace diff --git a/specs/stdapi.py b/specs/stdapi.py index b86668b..5cf1a37 100644 --- a/specs/stdapi.py +++ b/specs/stdapi.py @@ -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): @@ -385,6 +407,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 +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(): @@ -560,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 @@ -764,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