summaryrefslogtreecommitdiff
path: root/src/SConscript
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2008-10-10 21:45:34 -0700
committerNathan Binkert <nate@binkert.org>2008-10-10 21:45:34 -0700
commit1f57193439925d2098052d0648031dc04b1ad440 (patch)
tree847380e1494a8edcc11fbbe7fc5ee8d2d09a5b72 /src/SConscript
parent96936c6bf57b40c6da2582ad6dd1bdd0de2ea3db (diff)
downloadgem5-1f57193439925d2098052d0648031dc04b1ad440.tar.xz
swig: Add in a %rename to allow the same name to appear in multiple namespaces.
Diffstat (limited to 'src/SConscript')
-rw-r--r--src/SConscript13
1 files changed, 10 insertions, 3 deletions
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