summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-07 22:49:53 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-07 22:49:53 -0400
commitcb0faac58dde384e817d671c49d250e5beda07c9 (patch)
treebc50cadc1b1f41f72dfcd13a6d0cb46f8b274c0a /python
parent71591555fd4069075e02a25c6403f300d9ecd59d (diff)
downloadfork-ledger-cb0faac58dde384e817d671c49d250e5beda07c9.tar.gz
fork-ledger-cb0faac58dde384e817d671c49d250e5beda07c9.tar.bz2
fork-ledger-cb0faac58dde384e817d671c49d250e5beda07c9.zip
Removed a great many unnecessary Boost.Python files.
Diffstat (limited to 'python')
-rw-r--r--python/py_amount.cc333
-rw-r--r--python/py_balance.cc270
-rw-r--r--python/py_balpair.cc66
-rw-r--r--python/py_commodity.cc9
-rw-r--r--python/py_compare.cc68
-rw-r--r--python/py_emacs.cc68
-rw-r--r--python/py_expr.cc145
-rw-r--r--python/py_filters.cc120
-rw-r--r--python/py_hooks.cc68
-rw-r--r--python/py_iterators.cc82
-rw-r--r--python/py_mask.cc66
-rw-r--r--python/py_op.cc68
-rw-r--r--python/py_option.cc63
-rw-r--r--python/py_output.cc74
-rw-r--r--python/py_parser.cc113
-rw-r--r--python/py_predicate.cc68
-rw-r--r--python/py_quotes.cc68
-rw-r--r--python/py_stream.cc68
-rw-r--r--python/py_token.cc68
-rw-r--r--python/py_value.cc38
-rw-r--r--python/pyinterp.cc36
21 files changed, 11 insertions, 1948 deletions
diff --git a/python/py_amount.cc b/python/py_amount.cc
deleted file mode 100644
index a12104d8..00000000
--- a/python/py_amount.cc
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "amount.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-boost::optional<amount_t> py_value_0(const amount_t& amount) {
- return amount.value();
-}
-boost::optional<amount_t> py_value_1(const amount_t& amount,
- const boost::optional<datetime_t>& moment) {
- return amount.value(moment);
-}
-boost::optional<amount_t> py_value_2(const amount_t& amount,
- const boost::optional<datetime_t>& moment,
- const boost::optional<commodity_t&>& in_terms_of) {
- return amount.value(moment, in_terms_of);
-}
-
-void py_parse_2(amount_t& amount, object in, unsigned char flags) {
- if (PyFile_Check(in.ptr())) {
- pyifstream instr(reinterpret_cast<PyFileObject *>(in.ptr()));
- amount.parse(instr, flags);
- } else {
- PyErr_SetString(PyExc_IOError,
- "Argument to amount.parse(file) is not a file object");
- }
-}
-void py_parse_1(amount_t& amount, object in) {
- py_parse_2(amount, in, 0);
-}
-
-void py_parse_str_1(amount_t& amount, const string& str) {
- amount.parse(str);
-}
-void py_parse_str_2(amount_t& amount, const string& str, unsigned char flags) {
- amount.parse(str, flags);
-}
-
-void py_print(amount_t& amount, object out)
-{
- if (PyFile_Check(out.ptr())) {
- pyofstream outstr(reinterpret_cast<PyFileObject *>(out.ptr()));
- amount.print(outstr);
- } else {
- PyErr_SetString(PyExc_IOError,
- "Argument to amount.print_(file) is not a file object");
- }
-}
-
-void py_amount_initialize() {
- amount_t::initialize();
-}
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-EXC_TRANSLATOR(amount_error)
-
-void export_amount()
-{
- class_< amount_t > ("Amount")
- .def("initialize", py_amount_initialize) // only for the PyUnitTests
- .staticmethod("initialize")
- .def("shutdown", &amount_t::shutdown)
- .staticmethod("shutdown")
-
- .add_static_property("current_pool",
- make_getter(&amount_t::current_pool,
- return_value_policy<reference_existing_object>()))
-
- .add_static_property("stream_fullstrings",
- make_getter(&amount_t::stream_fullstrings),
- make_setter(&amount_t::stream_fullstrings))
-
-#if 0
- .def(init<double>())
-#endif
- .def(init<long>())
- .def(init<std::string>())
-
- .def("exact", &amount_t::exact, args("value"),
- "Construct an amount object whose display precision is always equal to its\n\
-internal precision.")
- .staticmethod("exact")
-
- .def(init<amount_t>())
-
- .def("compare", &amount_t::compare)
-
- .def(self == self)
- .def(self == long())
- .def(long() == self)
-#if 0
- .def(self == double())
- .def(double() == self)
-#endif
-
- .def(self != self)
- .def(self != long())
- .def(long() != self)
-#if 0
- .def(self != double())
- .def(double() != self)
-#endif
-
- .def(! self)
-
- .def(self < self)
- .def(self < long())
- .def(long() < self)
-#if 0
- .def(self < double())
- .def(double() < self)
-#endif
-
- .def(self <= self)
- .def(self <= long())
- .def(long() <= self)
-#if 0
- .def(self <= double())
- .def(double() <= self)
-#endif
-
- .def(self > self)
- .def(self > long())
- .def(long() > self)
-#if 0
- .def(self > double())
- .def(double() > self)
-#endif
-
- .def(self >= self)
- .def(self >= long())
- .def(long() >= self)
-#if 0
- .def(self >= double())
- .def(double() >= self)
-#endif
-
- .def(self += self)
- .def(self += long())
-#if 0
- .def(self += double())
-#endif
-
- .def(self + self)
- .def(self + long())
- .def(long() + self)
-#if 0
- .def(self + double())
- .def(double() + self)
-#endif
-
- .def(self -= self)
- .def(self -= long())
-#if 0
- .def(self -= double())
-#endif
-
- .def(self - self)
- .def(self - long())
- .def(long() - self)
-#if 0
- .def(self - double())
- .def(double() - self)
-#endif
-
- .def(self *= self)
- .def(self *= long())
-#if 0
- .def(self *= double())
-#endif
-
- .def(self * self)
- .def(self * long())
- .def(long() * self)
-#if 0
- .def(self * double())
- .def(double() * self)
-#endif
-
- .def(self /= self)
- .def(self /= long())
-#if 0
- .def(self /= double())
-#endif
-
- .def(self / self)
- .def(self / long())
- .def(long() / self)
-#if 0
- .def(self / double())
- .def(double() / self)
-#endif
-
- .def("precision", &amount_t::precision)
-
- .def("negate", &amount_t::negate)
- .def("in_place_negate", &amount_t::in_place_negate,
- return_value_policy<reference_existing_object>())
- .def(- self)
-
- .def("abs", &amount_t::abs)
- .def("__abs__", &amount_t::abs)
-
- .def("rounded", &amount_t::rounded)
- .def("unrounded", &amount_t::unrounded)
-
- .def("reduce", &amount_t::reduce)
- .def("in_place_reduce", &amount_t::in_place_reduce,
- return_value_policy<reference_existing_object>())
-
- .def("unreduce", &amount_t::unreduce)
- .def("in_place_unreduce", &amount_t::in_place_unreduce,
- return_value_policy<reference_existing_object>())
-
- .def("value", py_value_0)
- .def("value", py_value_1)
- .def("value", py_value_2)
-
- .def("sign", &amount_t::sign)
- .def("__nonzero__", &amount_t::is_nonzero)
- .def("is_nonzero", &amount_t::is_nonzero)
- .def("is_zero", &amount_t::is_zero)
- .def("is_realzero", &amount_t::is_realzero)
- .def("is_null", &amount_t::is_null)
-
- .def("to_double", &amount_t::to_double)
- .def("__float__", &amount_t::to_double)
- .def("to_long", &amount_t::to_long)
- .def("__int__", &amount_t::to_long)
- .def("to_string", &amount_t::to_string)
- .def("__str__", &amount_t::to_string)
- .def("to_fullstring", &amount_t::to_fullstring)
- .def("__repr__", &amount_t::to_fullstring)
-
- .def("fits_in_long", &amount_t::fits_in_long)
-
- .def("quantity_string", &amount_t::quantity_string)
-
- .def("commodity", &amount_t::commodity,
- return_value_policy<reference_existing_object>())
- .def("set_commodity", &amount_t::set_commodity,
- with_custodian_and_ward<1, 2>())
-
- .def("has_commodity", &amount_t::has_commodity)
- .def("clear_commodity", &amount_t::clear_commodity)
- .def("number", &amount_t::number)
-
- .def("annotate", &amount_t::annotate)
- .def("is_annotated", &amount_t::is_annotated)
-#if 0
- .def("annotation", &amount_t::annotation)
-#endif
- .def("strip_annotations", &amount_t::strip_annotations)
-
- .def("parse", py_parse_1)
- .def("parse", py_parse_2)
- .def("parse", py_parse_str_1)
- .def("parse", py_parse_str_2)
-
- .def("parse_conversion", &amount_t::parse_conversion)
- .staticmethod("parse_conversion")
-
- .def("print_", py_print)
-
- .def("dump", &amount_t::dump)
-
- .def("valid", &amount_t::valid)
- ;
-
- enum_< amount_t::parse_flags_enum_t >("AmountParse")
- .value("DEFAULT", amount_t::PARSE_DEFAULT)
- .value("NO_MIGRATE", amount_t::PARSE_NO_MIGRATE)
- .value("NO_REDUCE", amount_t::PARSE_NO_REDUCE)
- .value("SOFT_FAIL", amount_t::PARSE_SOFT_FAIL)
- ;
-
- register_optional_to_python<amount_t>();
-
-#if 0
- implicitly_convertible<double, amount_t>();
-#endif
- implicitly_convertible<long, amount_t>();
- implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- EXC_TRANSLATE(amount_error);
-}
-
-} // namespace ledger
diff --git a/python/py_balance.cc b/python/py_balance.cc
deleted file mode 100644
index 4215519c..00000000
--- a/python/py_balance.cc
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "balance.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-EXC_TRANSLATOR(balance_error)
-
-void export_balance()
-{
-#if 0
- class_< balance_t > ("Balance")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(balance_error);
-}
-
-} // namespace ledger
-
-#if 0
-unsigned int balance_len(balance_t& bal)
-{
- return bal.amounts.size();
-}
-
-amount_t balance_getitem(balance_t& bal, int i)
-{
- std::size_t len = bal.amounts.size();
-
- if (abs(i) >= len) {
- PyErr_SetString(PyExc_IndexError, "Index out of range");
- throw_error_already_set();
- }
-
- int x = i < 0 ? len + i : i;
- balance_t::amounts_map::iterator elem = bal.amounts.begin();
- while (--x >= 0)
- elem++;
-
- return (*elem).second;
-}
-
-unsigned int balance_pair_len(balance_pair_t& bal_pair)
-{
- return balance_len(bal_pair.quantity);
-}
-
-amount_t balance_pair_getitem(balance_pair_t& bal_pair, int i)
-{
- return balance_getitem(bal_pair.quantity, i);
-}
-
-void export_balance()
-{
- class_< balance_t > ("Balance")
- .def(init<balance_t>())
- .def(init<amount_t>())
- .def(init<long>())
- .def(init<unsigned long>())
- .def(init<double>())
-
- .def(self += self)
- .def(self += other<amount_t>())
- .def(self += long())
- .def(self + self)
- .def(self + other<amount_t>())
- .def(self + long())
- .def(self -= self)
- .def(self -= other<amount_t>())
- .def(self -= long())
- .def(self - self)
- .def(self - other<amount_t>())
- .def(self - long())
- .def(self *= self)
- .def(self *= other<amount_t>())
- .def(self *= long())
- .def(self * self)
- .def(self * other<amount_t>())
- .def(self * long())
- .def(self /= self)
- .def(self /= other<amount_t>())
- .def(self /= long())
- .def(self / self)
- .def(self / other<amount_t>())
- .def(self / long())
- .def(- self)
-
- .def(self < self)
- .def(self < other<amount_t>())
- .def(self < long())
- .def(self <= self)
- .def(self <= other<amount_t>())
- .def(self <= long())
- .def(self > self)
- .def(self > other<amount_t>())
- .def(self > long())
- .def(self >= self)
- .def(self >= other<amount_t>())
- .def(self >= long())
- .def(self == self)
- .def(self == other<amount_t>())
- .def(self == long())
- .def(self != self)
- .def(self != other<amount_t>())
- .def(self != long())
- .def(! self)
-
- .def(self_ns::str(self))
-
- .def("__abs__", &balance_t::abs)
- .def("__len__", balance_len)
- .def("__getitem__", balance_getitem)
-
- .def("valid", &balance_t::valid)
-
- .def("realzero", &balance_t::realzero)
- .def("amount", &balance_t::amount)
- .def("value", &balance_t::value)
- .def("price", &balance_t::price)
- .def("date", &balance_t::date)
- .def("strip_annotations", &balance_t::strip_annotations)
- .def("write", &balance_t::write)
- .def("round", &balance_t::round)
- .def("negate", &balance_t::negate)
- .def("negated", &balance_t::negated)
- ;
-
- class_< balance_pair_t > ("BalancePair")
- .def(init<balance_pair_t>())
- .def(init<balance_t>())
- .def(init<amount_t>())
- .def(init<long>())
- .def(init<unsigned long>())
- .def(init<double>())
-
- .def(self += self)
- .def(self += other<balance_t>())
- .def(self += other<amount_t>())
- .def(self += long())
- .def(self + self)
- .def(self + other<balance_t>())
- .def(self + other<amount_t>())
- .def(self + long())
- .def(self -= self)
- .def(self -= other<balance_t>())
- .def(self -= other<amount_t>())
- .def(self -= long())
- .def(self - self)
- .def(self - other<balance_t>())
- .def(self - other<amount_t>())
- .def(self - long())
- .def(self *= self)
- .def(self *= other<balance_t>())
- .def(self *= other<amount_t>())
- .def(self *= long())
- .def(self * self)
- .def(self * other<balance_t>())
- .def(self * other<amount_t>())
- .def(self * long())
- .def(self /= self)
- .def(self /= other<balance_t>())
- .def(self /= other<amount_t>())
- .def(self /= long())
- .def(self / self)
- .def(self / other<balance_t>())
- .def(self / other<amount_t>())
- .def(self / long())
- .def(- self)
-
- .def(self < self)
- .def(self < other<balance_t>())
- .def(self < other<amount_t>())
- .def(self < long())
- .def(self <= self)
- .def(self <= other<balance_t>())
- .def(self <= other<amount_t>())
- .def(self <= long())
- .def(self > self)
- .def(self > other<balance_t>())
- .def(self > other<amount_t>())
- .def(self > long())
- .def(self >= self)
- .def(self >= other<balance_t>())
- .def(self >= other<amount_t>())
- .def(self >= long())
- .def(self == self)
- .def(self == other<balance_t>())
- .def(self == other<amount_t>())
- .def(self == long())
- .def(self != self)
- .def(self != other<balance_t>())
- .def(self != other<amount_t>())
- .def(self != long())
- .def(! self)
-
- .def(self_ns::str(self))
-
- .def("__abs__", &balance_pair_t::abs)
- .def("__len__", balance_pair_len)
- .def("__getitem__", balance_pair_getitem)
-
- .def("valid", &balance_pair_t::valid)
-
- .def("realzero", &balance_pair_t::realzero)
- .def("amount", &balance_pair_t::amount)
- .def("value", &balance_pair_t::value)
- .def("price", &balance_pair_t::price)
- .def("date", &balance_pair_t::date)
- .def("strip_annotations", &balance_pair_t::strip_annotations)
- .def("write", &balance_pair_t::write)
- .def("round", &balance_pair_t::round)
- .def("negate", &balance_pair_t::negate)
- .def("negated", &balance_pair_t::negated)
-
- .add_property("cost",
- make_getter(&balance_pair_t::cost,
- return_value_policy<reference_existing_object>()))
- ;
-}
-#endif
diff --git a/python/py_balpair.cc b/python/py_balpair.cc
deleted file mode 100644
index 74d7716f..00000000
--- a/python/py_balpair.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "balpair.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(balance_pair_error)
-
-void export_balpair()
-{
- class_< balance_pair_t > ("BalancePair")
- ;
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(balance_pair_error);
-}
-
-} // namespace ledger
diff --git a/python/py_commodity.cc b/python/py_commodity.cc
index c071da18..d29ec83d 100644
--- a/python/py_commodity.cc
+++ b/python/py_commodity.cc
@@ -70,9 +70,6 @@ void export_commodity()
;
#if 0
- class_< price_point_t, bases<>,
- commodity_t, boost::noncopyable > ("PricePoint", no_init)
- ;
class_< annotation_t, bases<>,
commodity_t, boost::noncopyable > ("Annotation", no_init)
;
@@ -82,12 +79,6 @@ void export_commodity()
class_< annotated_commodity_t, bases<>,
commodity_t, boost::noncopyable > ("AnnotatedCommodity", no_init)
;
- class_< compare_amount_commodities, bases<>,
- commodity_t, boost::noncopyable > ("CompareAmountCommodities", no_init)
- ;
- class_< commodity_pool_t, bases<>,
- commodity_t, boost::noncopyable > ("CommodityPool", no_init)
- ;
#endif
}
diff --git a/python/py_compare.cc b/python/py_compare.cc
deleted file mode 100644
index fda349e3..00000000
--- a/python/py_compare.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "compare.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(compare_error)
-
-void export_compare()
-{
-#if 0
- class_< compare_items > ("CompareItems")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(compare_error);
-}
-
-} // namespace ledger
diff --git a/python/py_emacs.cc b/python/py_emacs.cc
deleted file mode 100644
index afba9132..00000000
--- a/python/py_emacs.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "emacs.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(emacs_error)
-
-void export_emacs()
-{
-#if 0
- class_< format_emacs_xacts > ("FormatEmacsXacts")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(emacs_error);
-}
-
-} // namespace ledger
diff --git a/python/py_expr.cc b/python/py_expr.cc
deleted file mode 100644
index 07f390af..00000000
--- a/python/py_expr.cc
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "expr.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(expr_error)
-
-void export_expr()
-{
- class_< expr_t > ("Expr")
- ;
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(expr_error);
-}
-
-} // namespace ledger
-
-#if 0
-value_t py_calc_1(xpath_t::op_t& xpath_t, const details_t& item)
-{
- value_t result;
- xpath_t.calc(result, item);
- return result;
-}
-
-template <typename T>
-value_t py_calc(xpath_t::op_t& xpath_t, const T& item)
-{
- value_t result;
- xpath_t.calc(result, details_t(item));
- return result;
-}
-
-xpath_t::op_t * py_parse_xpath_t_1(const string& str)
-{
- return parse_xpath_t(str);
-}
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_RuntimeError, err.what()); \
- }
-
-EXC_TRANSLATOR(xpath_t_error)
-EXC_TRANSLATOR(calc_error)
-#if 0
-EXC_TRANSLATOR(mask_error)
-#endif
-
-void export_xpath()
-{
- class_< details_t > ("Details", init<const entry_t&>())
- .def(init<const transaction_t&>())
- .def(init<const account_t&>())
- .add_property("entry",
- make_getter(&details_t::entry,
- return_value_policy<reference_existing_object>()))
- .add_property("xact",
- make_getter(&details_t::xact,
- return_value_policy<reference_existing_object>()))
- .add_property("account",
- make_getter(&details_t::account,
- return_value_policy<reference_existing_object>()))
- ;
-
- class_< xpath_t::op_t > ("ValueExpr", init<xpath_t::op_t::kind_t>())
- .def("calc", py_calc_1)
- .def("calc", py_calc<account_t>)
- .def("calc", py_calc<entry_t>)
- .def("calc", py_calc<transaction_t>)
- ;
-
- def("parse_xpath_t", py_parse_xpath_t_1,
- return_value_policy<manage_new_object>());
-
- class_< item_predicate<transaction_t> >
- ("TransactionPredicate", init<string>())
- .def("__call__", &item_predicate<transaction_t>::operator())
- ;
-
- class_< item_predicate<account_t> >
- ("AccountPredicate", init<string>())
- .def("__call__", &item_predicate<account_t>::operator())
- ;
-
-#define EXC_TRANSLATE(type) \
- register_error_translator<type>(&exc_translate_ ## type);
-
- EXC_TRANSLATE(xpath_t_error);
- EXC_TRANSLATE(calc_error);
-#if 0
- EXC_TRANSLATE(mask_error);
-#endif
-}
-#endif
diff --git a/python/py_filters.cc b/python/py_filters.cc
deleted file mode 100644
index 14f5b014..00000000
--- a/python/py_filters.cc
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "filters.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(filters_error)
-
-void export_filters()
-{
-#if 0
- class_< ignore_xacts > ("IgnoreXacts")
- ;
- class_< clear_xact_xdata > ("ClearXactXdata")
- ;
- class_< pass_down_xacts > ("PassDownXacts")
- ;
- class_< push_to_xacts_list > ("PushToXactsList")
- ;
- class_< truncate_entries > ("TruncateEntries")
- ;
- class_< set_account_value > ("SetAccountValue")
- ;
- class_< sort_xacts > ("SortXacts")
- ;
- class_< sort_entries > ("SortEntries")
- ;
- class_< filter_xacts > ("FilterXacts")
- ;
- class_< anonymize_xacts > ("AnonymizeXacts")
- ;
- class_< calc_xacts > ("CalcXacts")
- ;
- class_< invert_xacts > ("InvertXacts")
- ;
- class_< collapse_xacts > ("CollapseXacts")
- ;
- class_< component_xacts > ("ComponentXacts")
- ;
- class_< related_xacts > ("RelatedXacts")
- ;
- class_< changed_value_xacts > ("ChangedValueXacts")
- ;
- class_< subtotal_xacts > ("SubtotalXacts")
- ;
- class_< interval_xacts > ("IntervalXacts")
- ;
- class_< by_payee_xacts > ("ByPayeeXacts")
- ;
- class_< set_comm_as_payee > ("SetCommAsPayee")
- ;
- class_< set_code_as_payee > ("SetCodeAsPayee")
- ;
- class_< dow_xacts > ("DowXacts")
- ;
- class_< generate_xacts > ("GenerateXacts")
- ;
- class_< budget_xacts > ("BudgetXacts")
- ;
- class_< forecast_xacts > ("ForecastXacts")
- ;
- class_< clear_account_xdata > ("ClearAccountXdata")
- ;
- class_< pass_down_accounts > ("PassDownAccounts")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(filters_error);
-}
-
-} // namespace ledger
diff --git a/python/py_hooks.cc b/python/py_hooks.cc
deleted file mode 100644
index 7121b587..00000000
--- a/python/py_hooks.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "hooks.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(hooks_error)
-
-void export_hooks()
-{
-#if 0
- class_< hooks_t > ("Hooks")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(hooks_error);
-}
-
-} // namespace ledger
diff --git a/python/py_iterators.cc b/python/py_iterators.cc
deleted file mode 100644
index 4f5b1d42..00000000
--- a/python/py_iterators.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "iterators.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(iterators_error)
-
-void export_iterators()
-{
-#if 0
- class_< xacts_iterator > ("XactsIterator")
- ;
- class_< entry_xacts_iterator > ("EntryXactsIterator")
- ;
- class_< entries_iterator > ("EntriesIterator")
- ;
- class_< session_xacts_iterator > ("SessionXactsIterator")
- ;
- class_< accounts_iterator > ("AccountsIterator")
- ;
- class_< basic_accounts_iterator > ("BasicAccountsIterator")
- ;
- class_< sorted_accounts_iterator > ("SortedAccountsIterator")
- ;
- class_< journals_iterator > ("JournalsIterator")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(iterators_error);
-}
-
-} // namespace ledger
diff --git a/python/py_mask.cc b/python/py_mask.cc
deleted file mode 100644
index 4c49d17e..00000000
--- a/python/py_mask.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "mask.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(mask_error)
-
-void export_mask()
-{
- class_< mask_t > ("Mask")
- ;
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(mask_error);
-}
-
-} // namespace ledger
diff --git a/python/py_op.cc b/python/py_op.cc
deleted file mode 100644
index a0b20921..00000000
--- a/python/py_op.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "op.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(op_error)
-
-void export_op()
-{
-#if 0
- class_< op_t > ("Op")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(op_error);
-}
-
-} // namespace ledger
diff --git a/python/py_option.cc b/python/py_option.cc
deleted file mode 100644
index 9148b330..00000000
--- a/python/py_option.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "option.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(option_error)
-
-void export_option()
-{
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(option_error);
-}
-
-} // namespace ledger
diff --git a/python/py_output.cc b/python/py_output.cc
deleted file mode 100644
index 8484639e..00000000
--- a/python/py_output.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "output.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(output_error)
-
-void export_output()
-{
-#if 0
- class_< format_xacts > ("FormatXacts")
- ;
- class_< format_entries > ("FormatEntries")
- ;
- class_< format_accounts > ("FormatAccounts")
- ;
- class_< format_equity > ("FormatEquity")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(output_error);
-}
-
-} // namespace ledger
diff --git a/python/py_parser.cc b/python/py_parser.cc
deleted file mode 100644
index fc881a0f..00000000
--- a/python/py_parser.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "parser.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(parser_error)
-
-void export_parser()
-{
-#if 0
- class_< expr_t::parser_t > ("Parser")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(parser_error);
-}
-
-} // namespace ledger
-
-#if 0
-#include "parser.h"
-
-using namespace boost::python;
-using namespace ledger;
-
-struct py_parser_t : public parser_t
-{
- PyObject * self;
- py_parser_t(PyObject * self_) : self(self_) {}
-
- virtual bool test(std::istream& in) const {
- return call_method<bool>(self, "test", in);
- }
-
- virtual repitem_t * parse(std::istream& in,
- journal_t * journal,
- account_t * master = NULL,
- const string * original_file = NULL) {
- return call_method<unsigned int>(self, "parse", in, journal, master,
- original_file);
- }
-};
-
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(parser_parse_overloads,
- py_parser_t::parse, 2, 4)
-
-BOOST_PYTHON_FUNCTION_OVERLOADS(parse_journal_overloads, parse_journal, 2, 4)
-BOOST_PYTHON_FUNCTION_OVERLOADS(parse_journal_file_overloads,
- parse_journal_file, 2, 4)
-
-void export_parser() {
- class_< parser_t, py_parser_t, boost::noncopyable > ("Parser")
- .def("test", &py_parser_t::test)
- .def("parse", &py_parser_t::parse, parser_parse_overloads())
- ;
-
- def("register_parser", register_parser);
- def("unregister_parser", unregister_parser);
-
- def("parse_journal", parse_journal, parse_journal_overloads());
- def("parse_journal_file", parse_journal_file, parse_journal_file_overloads());
-}
-#endif
diff --git a/python/py_predicate.cc b/python/py_predicate.cc
deleted file mode 100644
index 69c8de64..00000000
--- a/python/py_predicate.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "predicate.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(predicate_error)
-
-void export_predicate()
-{
-#if 0
- class_< item_predicate > ("ItemPredicate")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(predicate_error);
-}
-
-} // namespace ledger
diff --git a/python/py_quotes.cc b/python/py_quotes.cc
deleted file mode 100644
index e8f97141..00000000
--- a/python/py_quotes.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "quotes.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(quotes_error)
-
-void export_quotes()
-{
-#if 0
- class_< quotes_by_script > ("QuotesByScript")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(quotes_error);
-}
-
-} // namespace ledger
diff --git a/python/py_stream.cc b/python/py_stream.cc
deleted file mode 100644
index 17faf700..00000000
--- a/python/py_stream.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "stream.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(stream_error)
-
-void export_stream()
-{
-#if 0
- class_< output_stream_t > ("OutputStream")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(stream_error);
-}
-
-} // namespace ledger
diff --git a/python/py_token.cc b/python/py_token.cc
deleted file mode 100644
index 168b8c92..00000000
--- a/python/py_token.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2003-2009, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pyinterp.h"
-#include "pyutils.h"
-#include "token.h"
-
-#include <boost/python/exception_translator.hpp>
-#include <boost/python/implicit.hpp>
-#include <boost/python/args.hpp>
-
-namespace ledger {
-
-using namespace boost::python;
-
-#define EXC_TRANSLATOR(type) \
- void exc_translate_ ## type(const type& err) { \
- PyErr_SetString(PyExc_ArithmeticError, err.what()); \
- }
-
-//EXC_TRANSLATOR(token_error)
-
-void export_token()
-{
-#if 0
- struct_< expr_t::token_t > ("Token")
- ;
-#endif
-
- //register_optional_to_python<amount_t>();
-
- //implicitly_convertible<string, amount_t>();
-
-#define EXC_TRANSLATE(type) \
- register_exception_translator<type>(&exc_translate_ ## type);
-
- //EXC_TRANSLATE(token_error);
-}
-
-} // namespace ledger
diff --git a/python/py_value.cc b/python/py_value.cc
index 59be1d33..6c8c232f 100644
--- a/python/py_value.cc
+++ b/python/py_value.cc
@@ -41,18 +41,7 @@ namespace ledger {
using namespace boost::python;
-boost::optional<value_t> py_value_0(const value_t& amount) {
- return amount.value();
-}
-boost::optional<value_t> py_value_1(const value_t& amount,
- const boost::optional<datetime_t>& moment) {
- return amount.value(moment);
-}
-boost::optional<value_t> py_value_2(const value_t& amount,
- const boost::optional<datetime_t>& moment,
- const boost::optional<commodity_t&>& in_terms_of) {
- return amount.value(moment, in_terms_of);
-}
+BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(value_overloads, value, 0, 2)
string py_dump(const value_t& value) {
std::ostringstream buf;
@@ -92,11 +81,6 @@ void export_value()
.def(init<std::string>())
.def(init<date_t>())
.def(init<datetime_t>())
- .def(init<amount_t>())
-#if 0
- .def(init<balance_t>())
- .def(init<balance_pair_t>())
-#endif
.def(init<value_t>())
@@ -199,9 +183,10 @@ void export_value()
.def("reduce", &value_t::reduce)
.def("in_place_reduce", &value_t::in_place_reduce)
- .def("value", py_value_0)
- .def("value", py_value_1)
- .def("value", py_value_2)
+ .def("unreduce", &value_t::unreduce)
+ .def("in_place_unreduce", &value_t::in_place_unreduce)
+
+ .def("value", &value_t::value, value_overloads())
.def("cost", &value_t::cost)
@@ -230,13 +215,10 @@ void export_value()
.def("set_long", &value_t::set_long)
.def("is_amount", &value_t::is_amount)
- .def("set_amount", &value_t::set_amount)
.def("is_balance", &value_t::is_balance)
- .def("set_balance", &value_t::set_balance)
.def("is_balance_pair", &value_t::is_balance_pair)
- .def("set_balance_pair", &value_t::set_balance_pair)
.def("is_string", &value_t::is_string)
.def("set_string", py_set_string)
@@ -249,9 +231,6 @@ void export_value()
.def("__int__", &value_t::to_long)
.def("to_datetime", &value_t::to_datetime)
.def("to_date", &value_t::to_date)
- .def("to_amount", &value_t::to_amount)
- .def("to_balance", &value_t::to_balance)
- .def("to_balance_pair", &value_t::to_balance_pair)
.def("to_string", &value_t::to_string)
.def("to_sequence", &value_t::to_sequence)
@@ -264,11 +243,17 @@ void export_value()
.def("simplify", &value_t::simplify)
.def("in_place_simplify", &value_t::in_place_simplify)
+ // jww (2009-02-07): Allow annotating, and retrieving annotations
.def("strip_annotations", &value_t::strip_annotations)
// jww (2009-01-28): Allow for transparent exchanging with sequence
// protocol objects in Python too; and conversion to a list.
#if 0
+ // jww (2009-02-07): Methods to implement:
+ // Allow accepting and returning tuples as sequences
+ // count_commodities
+ // has_commodity(COMM)
+ // decompose
.def("__getitem__", &value_t::operator[])
#endif
.def("push_back", &value_t::push_back)
@@ -308,7 +293,6 @@ void export_value()
implicitly_convertible<string, value_t>();
implicitly_convertible<date_t, value_t>();
implicitly_convertible<datetime_t, value_t>();
- implicitly_convertible<amount_t, value_t>();
#define EXC_TRANSLATE(type) \
register_exception_translator<type>(&exc_translate_ ## type);
diff --git a/python/pyinterp.cc b/python/pyinterp.cc
index d6248709..f2f712d9 100644
--- a/python/pyinterp.cc
+++ b/python/pyinterp.cc
@@ -37,74 +37,38 @@ namespace ledger {
using namespace boost::python;
-void export_amount();
-void export_balance();
-void export_balpair();
void export_chain();
void export_commodity();
-void export_compare();
-void export_emacs();
void export_entry();
-void export_expr();
-void export_filters();
void export_flags();
void export_format();
void export_global();
-void export_hooks();
void export_item();
-void export_iterators();
void export_journal();
-void export_mask();
-void export_op();
-void export_option();
-void export_output();
-void export_parser();
-void export_predicate();
-void export_quotes();
void export_report();
void export_scope();
void export_session();
-void export_stream();
void export_timelog();
void export_times();
-void export_token();
void export_utils();
void export_value();
void export_xact();
void initialize_for_python()
{
- export_amount();
- export_balance();
- export_balpair();
export_chain();
export_commodity();
- export_compare();
- export_emacs();
export_entry();
- export_expr();
- export_filters();
export_flags();
export_format();
export_global();
- export_hooks();
export_item();
- export_iterators();
export_journal();
- export_mask();
- export_op();
- export_option();
- export_output();
- export_parser();
- export_predicate();
- export_quotes();
export_report();
export_scope();
export_session();
- export_stream();
export_timelog();
export_times();
- export_token();
export_utils();
export_value();
export_xact();