diff options
Diffstat (limited to 'src/sim/init.cc')
-rw-r--r-- | src/sim/init.cc | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/src/sim/init.cc b/src/sim/init.cc index 33cd4040f..70578197f 100644 --- a/src/sim/init.cc +++ b/src/sim/init.cc @@ -127,8 +127,7 @@ EmbeddedPython::addModule() const } /* - * Load and initialize all of the python parts of M5, including Swig - * and the embedded module importer. + * Load and initialize all of the python parts of M5. */ int EmbeddedPython::initAll() @@ -152,40 +151,6 @@ EmbeddedPython::initAll() return 0; } -EmbeddedSwig::EmbeddedSwig(void (*init_func)(), const string& _context) - : initFunc(init_func), context(_context) -{ - getList().push_back(this); -} - -list<EmbeddedSwig *> & -EmbeddedSwig::getList() -{ - static list<EmbeddedSwig *> the_list; - return the_list; -} - -void -EmbeddedSwig::initAll() -{ - char* old_context = _Py_PackageContext; - // initialize SWIG modules. initFunc() is autogenerated and calls - // all of the individual swig initialization functions. - for (auto i : getList()) { - // to ensure that the loaded modules are placed in the right - // package we have to be a bit unorthodox and directly - // manipulate the package context since swig simply calls - // Py_InitModule with nothing but the module name of the - // wrapper - char* cstr = new char[i->context.size() + 1]; - strcpy(cstr, i->context.c_str()); - _Py_PackageContext = cstr; - i->initFunc(); - delete[] cstr; - } - _Py_PackageContext = old_context; -} - EmbeddedPyBind::EmbeddedPyBind(const char *_name, void (*init_func)(py::module &), const char *_base) @@ -265,7 +230,6 @@ EmbeddedPyBind::initAll() int initM5Python() { - EmbeddedSwig::initAll(); EmbeddedPyBind::initAll(); return EmbeddedPython::initAll(); } |