diff options
Diffstat (limited to 'src/pyinterp.h')
-rw-r--r-- | src/pyinterp.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/pyinterp.h b/src/pyinterp.h index 9c801a48..f32f4811 100644 --- a/src/pyinterp.h +++ b/src/pyinterp.h @@ -12,14 +12,12 @@ namespace ledger { -using namespace boost::python; - class python_interpreter_t : public xml::xpath_t::scope_t { - handle<> mmodule; + boost::python::handle<> mmodule; public: - dict nspace; + boost::python::dict nspace; python_interpreter_t(xml::xpath_t::scope_t * parent); @@ -27,7 +25,7 @@ class python_interpreter_t : public xml::xpath_t::scope_t Py_Finalize(); } - object import(const string& name); + boost::python::object import(const string& name); enum py_eval_mode_t { PY_EVAL_EXPR, @@ -35,18 +33,21 @@ class python_interpreter_t : public xml::xpath_t::scope_t PY_EVAL_MULTI }; - object eval(std::istream& in, py_eval_mode_t mode = PY_EVAL_EXPR); - object eval(const string& str, py_eval_mode_t mode = PY_EVAL_EXPR); - object eval(const char * c_str, py_eval_mode_t mode = PY_EVAL_EXPR) { + boost::python::object eval(std::istream& in, + py_eval_mode_t mode = PY_EVAL_EXPR); + boost::python::object eval(const string& str, + py_eval_mode_t mode = PY_EVAL_EXPR); + boost::python::object eval(const char * c_str, + py_eval_mode_t mode = PY_EVAL_EXPR) { string str(c_str); return eval(str, mode); } class functor_t : public xml::xpath_t::functor_t { - protected: - object func; - public: - functor_t(const string& name, object _func) + protected: + boost::python::object func; + public: + functor_t(const string& name, boost::python::object _func) : xml::xpath_t::functor_t(name), func(_func) {} virtual void operator()(value_t& result, xml::xpath_t::scope_t * locals); @@ -58,7 +59,7 @@ class python_interpreter_t : public xml::xpath_t::scope_t } virtual xml::xpath_t::op_t * lookup(const string& name) { - object func = eval(name); + boost::python::object func = eval(name); if (! func) return parent ? parent->lookup(name) : NULL; return xml::xpath_t::wrap_functor(new functor_t(name, func)); @@ -66,8 +67,7 @@ class python_interpreter_t : public xml::xpath_t::scope_t class lambda_t : public functor_t { public: - lambda_t(object code) : functor_t("<lambda>", code) {} - + lambda_t(boost::python::object code) : functor_t("<lambda>", code) {} virtual void operator()(value_t& result, xml::xpath_t::scope_t * locals); }; }; |