summaryrefslogtreecommitdiff
path: root/src/pyinterp.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-05-19 02:58:38 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:53 -0400
commitb6ab7deb63d3e3e22ecd4d6c70c6249db2ba558c (patch)
tree6cfe58ee8e093d310aa7ea84de87db3190c576bf /src/pyinterp.h
parent2d8512af88eab26176089e53916f309f2d3b3be4 (diff)
downloadfork-ledger-b6ab7deb63d3e3e22ecd4d6c70c6249db2ba558c.tar.gz
fork-ledger-b6ab7deb63d3e3e22ecd4d6c70c6249db2ba558c.tar.bz2
fork-ledger-b6ab7deb63d3e3e22ecd4d6c70c6249db2ba558c.zip
Completely revised the way XPath expressions are calculated.
Diffstat (limited to 'src/pyinterp.h')
-rw-r--r--src/pyinterp.h21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/pyinterp.h b/src/pyinterp.h
index 037c70e1..3d69d972 100644
--- a/src/pyinterp.h
+++ b/src/pyinterp.h
@@ -29,8 +29,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _PY_EVAL_H
-#define _PY_EVAL_H
+#ifndef _PYINTERP_H
+#define _PYINTERP_H
#include "xpath.h"
@@ -39,7 +39,7 @@
namespace ledger {
-class python_interpreter_t : public xml::xpath_t::scope_t
+class python_interpreter_t : public xml::xpath_t::symbol_scope_t
{
boost::python::handle<> mmodule;
@@ -76,28 +76,23 @@ class python_interpreter_t : public xml::xpath_t::scope_t
public:
functor_t(const string& name, boost::python::object _func) : func(_func) {}
virtual ~functor_t() {}
- virtual value_t operator()(xml::xpath_t::scope_t& locals);
+ virtual value_t operator()(xml::xpath_t::call_scope_t& args);
};
- virtual void define(const string& name, xml::xpath_t::ptr_op_t def) {
- // Pass any definitions up to our parent
- parent->define(name, def);
- }
-
virtual xml::xpath_t::ptr_op_t lookup(const string& name) {
if (boost::python::object func = eval(name))
- return xml::xpath_t::wrap_functor(functor_t(name, func));
+ return WRAP_FUNCTOR(functor_t(name, func));
else
- return parent ? parent->lookup(name) : NULL;
+ return xml::xpath_t::symbol_scope_t::lookup(name);
}
class lambda_t : public functor_t {
public:
lambda_t(boost::python::object code) : functor_t("<lambda>", code) {}
- virtual value_t operator()(xml::xpath_t::scope_t& locals);
+ virtual value_t operator()(xml::xpath_t::call_scope_t& args);
};
};
} // namespace ledger
-#endif // _PY_EVAL_H
+#endif // _PYINTERP_H