diff options
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/bgen/bgen/bgenGenerator.py | 4 | ||||
-rw-r--r-- | Tools/bgen/bgen/bgenGeneratorGroup.py | 6 | ||||
-rw-r--r-- | Tools/bgen/bgen/bgenObjectDefinition.py | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/Tools/bgen/bgen/bgenGenerator.py b/Tools/bgen/bgen/bgenGenerator.py index 2c0a399..bf81096 100644 --- a/Tools/bgen/bgen/bgenGenerator.py +++ b/Tools/bgen/bgen/bgenGenerator.py @@ -67,6 +67,10 @@ class BaseFunctionGenerator: def docstring(self): return None + def __cmp__(self, other): + if not hasattr(other, 'name'): + return cmp(id(self), id(other)) + return cmp(self.name, other.name) _stringify_map = {'\n': '\\n', '\t': '\\t', '\r': '\\r', '\b': '\\b', '\e': '\\e', '\a': '\\a', '\f': '\\f', '"': '\\"'} diff --git a/Tools/bgen/bgen/bgenGeneratorGroup.py b/Tools/bgen/bgen/bgenGeneratorGroup.py index 294828f..5a62905 100644 --- a/Tools/bgen/bgen/bgenGeneratorGroup.py +++ b/Tools/bgen/bgen/bgenGeneratorGroup.py @@ -6,7 +6,11 @@ class GeneratorGroup: self.prefix = prefix self.generators = [] - def add(self, g): + def add(self, g, dupcheck=0): + if dupcheck: + if g in self.generators: + print 'DUP', g.name + return g.setprefix(self.prefix) self.generators.append(g) diff --git a/Tools/bgen/bgen/bgenObjectDefinition.py b/Tools/bgen/bgen/bgenObjectDefinition.py index d554f2f..f3d120c 100644 --- a/Tools/bgen/bgen/bgenObjectDefinition.py +++ b/Tools/bgen/bgen/bgenObjectDefinition.py @@ -23,9 +23,9 @@ class ObjectDefinition(GeneratorGroup): self.static = "static " # set to "" to make <type>_New and <type>_Convert public self.basechain = "NULL" # set to &<basetype>_chain to chain methods - def add(self, g): + def add(self, g, dupcheck=0): g.setselftype(self.objecttype, self.itselftype) - GeneratorGroup.add(self, g) + GeneratorGroup.add(self, g, dupcheck) def reference(self): # In case we are referenced from a module |