diff options
author | Nathan Binkert <nate@binkert.org> | 2010-09-09 14:15:42 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2010-09-09 14:15:42 -0700 |
commit | e6ee56c6571999631ce31b05d0e563d66a7bbdd8 (patch) | |
tree | 174a7431f8a5b5e80c90b8a9887c90b245af07d8 /src/sim/init.hh | |
parent | 710ed8f492aa783933df6551ff98c9a6750fd9f7 (diff) | |
download | gem5-e6ee56c6571999631ce31b05d0e563d66a7bbdd8.tar.xz |
init: don't build files that centralize python and swig code
Instead of putting all object files into m5/object/__init__.py, interrogate
the importer to find out what should be imported.
Instead of creating a single file that lists all of the embedded python
modules, use static object construction to put those objects onto a list.
Do something similar for embedded swig (C++) code.
Diffstat (limited to 'src/sim/init.hh')
-rw-r--r-- | src/sim/init.hh | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/sim/init.hh b/src/sim/init.hh index 76cdcb74e..8fc0be982 100644 --- a/src/sim/init.hh +++ b/src/sim/init.hh @@ -34,19 +34,43 @@ /* * Data structure describing an embedded python file. */ -struct EmbeddedPyModule +#include <list> + +#ifndef PyObject_HEAD +struct _object; +typedef _object PyObject; +#endif + +struct EmbeddedPython { const char *filename; const char *abspath; const char *modpath; const char *code; - const char *code_end; int zlen; - int mlen; + int len; + + EmbeddedPython(const char *filename, const char *abspath, + const char *modpath, const char *code, int zlen, int len); + + PyObject *getCode() const; + bool addModule() const; + + static EmbeddedPython *importer; + static PyObject *importerModule; + static std::list<EmbeddedPython *> &getList(); + static int initAll(); }; -extern const EmbeddedPyModule embeddedPyImporter; -extern const EmbeddedPyModule embeddedPyModules[]; +struct EmbeddedSwig +{ + void (*initFunc)(); + + EmbeddedSwig(void (*init_func)()); + + static std::list<EmbeddedSwig *> &getList(); + static void initAll(); +}; void initSignals(); int initM5Python(); |