From: Nathan Binkert Date: Sat, 11 Oct 2008 04:45:34 +0000 (-0700) Subject: swig: Add in a %rename to allow the same name to appear in multiple namespaces. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1f57193439925d2098052d0648031dc04b1ad440;p=gem5.git swig: Add in a %rename to allow the same name to appear in multiple namespaces. --- diff --git a/src/SConscript b/src/SConscript index be721d57e..2ea35b778 100644 --- a/src/SConscript +++ b/src/SConscript @@ -532,11 +532,18 @@ def buildParams(target, source, env): continue class_path = obj.cxx_class.split('::') - class_path.reverse() - classname = class_path[0] - namespaces = class_path[1:] + classname = class_path[-1] + namespaces = class_path[:-1] + namespaces.reverse() code = '' + + if namespaces: + code += '// avoid name conflicts\n' + sep_string = '_COLONS_' + flat_name = sep_string.join(class_path) + code += '%%rename(%s) %s;\n' % (flat_name, classname) + code += '// stop swig from creating/wrapping default ctor/dtor\n' code += '%%nodefault %s;\n' % classname code += 'class %s ' % classname