From: Andreas Hartmetz Date: Tue, 9 Jul 2013 20:38:29 +0000 (+0200) Subject: Allow a custom terminator and support valueless keys better. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=7a0de29433983f36e612da08c0b1b9519df993a8;p=apitrace Allow a custom terminator and support valueless keys better. --- diff --git a/specs/stdapi.py b/specs/stdapi.py index 5d5d570..88711e1 100644 --- a/specs/stdapi.py +++ b/specs/stdapi.py @@ -272,7 +272,7 @@ class Array(Type): class AttribArray(Type): - def __init__(self, keyType, valueTypes, isConst = True): + def __init__(self, keyType, valueTypes, isConst = True, terminator = '0'): if isConst: Type.__init__(self, (Pointer(Const(Int))).expr) else: @@ -280,6 +280,11 @@ class AttribArray(Type): self.type = (Pointer(Const(Int))) # for function prototypes and such 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) @@ -796,7 +801,8 @@ class Traverser(Visitor): def visitAttribArray(self, attribs, *args, **kwargs): for key, valueType in attribs.valueTypes: - self.visit(valueType, *args, **kwargs) + if valueType is not None: + self.visit(valueType, *args, **kwargs) def visitBlob(self, array, *args, **kwargs): pass