#define _MUSSA_PYTHON_HPP_
#include <boost/python.hpp>
#include <string>
-
-extern "C" void initmussa();
-extern "C" void initmussaqui();
+#include <list>
+#include <utility>
//! Create a singleton class to manage our reference to the python interpreter
class MussaPython {
public:
+ typedef void (*python_module_init)(void);
MussaPython();
+ //! initalize interpreter
+ void init_interpreter();
+ //! add a python module that was statically compiled into this executable
+ void add_module(const std::string& name, python_module_init);
+ //! return main python namespace(initializing the interpreter if needed)
+ boost::python::object get_namespace();
//! pass multi-statement code block to the python interpreter
void run(std::string);
//! pass single expression to the python interpreter and return the result
void simple_interpreter(FILE *fp=stdin);
//! return an object in the python namespace
boost::python::object operator[](std::string);
-
protected:
+ typedef std::pair<std::string, python_module_init> module_item;
+ typedef std::list<module_item> module_list;
+ module_list python_modules;
boost::python::object main_namespace;
+
+ static void AppendInittab(const module_item &item);
};
//! return a reference to a single mussa python interpreter
-MussaPython& get_py();
+MussaPython *get_py();
#endif // _MUSSA_PYTHON_HPP_