summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am11
-rw-r--r--configure.in138
-rw-r--r--src/data/document.h2
-rw-r--r--src/data/journal.h2
-rw-r--r--src/data/node.h8
-rw-r--r--src/data/textual.cc2
-rw-r--r--src/numerics/amount.cc31
-rw-r--r--src/numerics/amount.h8
-rw-r--r--src/numerics/balance.h30
-rw-r--r--src/numerics/balpair.h87
-rw-r--r--src/numerics/commodity.cc4
-rw-r--r--src/numerics/commodity.h8
-rw-r--r--src/numerics/value.h14
-rw-r--r--src/python/py_commodity.cc2
-rw-r--r--src/python/py_times.cc4
-rw-r--r--src/python/py_utils.cc8
-rw-r--r--src/python/pyutils.h4
-rw-r--r--src/python/tuples.hpp116
-rw-r--r--src/traversal/xpath.cc2
-rw-r--r--src/traversal/xpath.h8
-rw-r--r--src/utility/pushvar.h4
-rw-r--r--src/utility/system.hh2
-rw-r--r--src/utility/utils.cc6
-rw-r--r--src/utility/utils.h8
24 files changed, 258 insertions, 251 deletions
diff --git a/Makefile.am b/Makefile.am
index 69ba61ae..cb54ea40 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,9 +25,16 @@ WARNFLAGS = -Wall #-pedantic-errors
#WARNFLAGS += -Wmissing-field-initializers -Wstrict-null-sentinel
#WARNFLAGS += -Wold-style-cast -Woverloaded-virtual
-libledger_la_CPPFLAGS = -I$(top_builddir)/gdtoa -I$(srcdir)/gdtoa \
- -I$(srcdir)/src $(WARNFLAGS)
libledger_la_LDFLAGS = -release $(PACKAGE_VERSION)
+libledger_la_CPPFLAGS = $(WARNFLAGS) \
+ -I$(top_builddir)/gdtoa \
+ -I$(srcdir)/gdtoa \
+ -I$(srcdir)/src \
+ -I$(srcdir)/src/utility \
+ -I$(srcdir)/src/numerics \
+ -I$(srcdir)/src/data \
+ -I$(srcdir)/src/traversal \
+ -I$(srcdir)/src/driver
libledger_la_SOURCES = \
src/utility/utils.cc \
diff --git a/configure.in b/configure.in
index 28f174ca..ee895e84 100644
--- a/configure.in
+++ b/configure.in
@@ -55,31 +55,31 @@ AC_CACHE_CHECK(
[AC_LANG_PUSH(C++)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
- [[#include <sys/types.h>
- #include <sys/wait.h>
- #include <unistd.h>
- #include <stdlib.h>
- #include <string.h>
- #include <stdio.h>]],
- [[int status, pfd[2];
- status = pipe(pfd);
- status = fork();
- if (status < 0) {
- ;
- } else if (status == 0) {
- char *arg0;
-
- status = dup2(pfd[0], STDIN_FILENO);
-
- close(pfd[1]);
- close(pfd[0]);
-
- execlp("", arg0, (char *)0);
- perror("execl");
- exit(1);
- } else {
- close(pfd[0]);
- }]])],
+ [[#include <sys/types.h>
+ #include <sys/wait.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>]],
+ [[int status, pfd[2];
+ status = pipe(pfd);
+ status = fork();
+ if (status < 0) {
+ ;
+ } else if (status == 0) {
+ char *arg0;
+
+ status = dup2(pfd[0], STDIN_FILENO);
+
+ close(pfd[1]);
+ close(pfd[0]);
+
+ execlp("", arg0, (char *)0);
+ perror("execl");
+ exit(1);
+ } else {
+ close(pfd[0]);
+ }]])],
[pipes_avail=true],
[pipes_avail=false])
AC_LANG_POP])
@@ -119,26 +119,26 @@ AC_CACHE_CHECK(
AC_LANG_PUSH(C++)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
- [[#include <boost/date_time/posix_time/posix_time.hpp>
- #include <boost/date_time/gregorian/gregorian.hpp>
- #include <boost/date_time/local_time_adjustor.hpp>
- #include <boost/date_time/time_duration.hpp>
-
- using namespace boost::posix_time;
- using namespace boost::date_time;
-
- #include <ctime>
-
- inline ptime time_to_system_local(const ptime& when) {
- struct std::tm tm_gmt = to_tm(when);
- return from_time_t(mktime(&tm_gmt));
- }]],
- [[ptime t10 = ptime(boost::gregorian::from_string("2007-01-15"),
- ptime::time_duration_type());
-
- ptime t12 = time_to_system_local(t10);
-
- return t10 != t12;]])],
+ [[#include <boost/date_time/posix_time/posix_time.hpp>
+ #include <boost/date_time/gregorian/gregorian.hpp>
+ #include <boost/date_time/local_time_adjustor.hpp>
+ #include <boost/date_time/time_duration.hpp>
+
+ using namespace boost::posix_time;
+ using namespace boost::date_time;
+
+ #include <ctime>
+
+ inline ptime time_to_system_local(const ptime& when) {
+ struct std::tm tm_gmt = to_tm(when);
+ return from_time_t(mktime(&tm_gmt));
+ }]],
+ [[ptime t10 = ptime(boost::gregorian::from_string("2007-01-15"),
+ ptime::time_duration_type());
+
+ ptime t12 = time_to_system_local(t10);
+
+ return t10 != t12;]])],
[boost_date_time_cpplib_avail=true],
[boost_date_time_cpplib_avail=false])
AC_LANG_POP
@@ -159,8 +159,8 @@ AC_CACHE_CHECK(
AC_LANG_PUSH(C++)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
- [[#include <boost/filesystem/path.hpp>]],
- [[boost::filesystem::path this_path("Hello");]])],
+ [[#include <boost/filesystem/path.hpp>]],
+ [[boost::filesystem::path this_path("Hello");]])],
[boost_filesystem_cpplib_avail=true],
[boost_filesystem_cpplib_avail=false])
AC_LANG_POP
@@ -233,8 +233,8 @@ if [test x$ofx = xtrue ]; then
AC_LANG_PUSH(C++)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
- [[#include <libofx.h>]],
- [[LibofxContextPtr libofx_context = libofx_get_new_context();]])],
+ [[#include <libofx.h>]],
+ [[LibofxContextPtr libofx_context = libofx_get_new_context();]])],
[libofx_avail=true],
[libofx_avail=false])
AC_LANG_POP
@@ -271,16 +271,16 @@ if [test x$python = xtrue ]; then
LIBS="-lboost_python$BOOST_SUFFIX -lpython$PYTHON_VERSION $LIBS"
AC_LANG_PUSH(C++)
AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <boost/python.hpp>
- using namespace boost::python;
- class foo {};
- BOOST_PYTHON_MODULE(samp) {
- class_< foo > ("foo") ;
- }]],
- [[return 0]])],
- [boost_python_cpplib_avail=true],
- [boost_python_cpplib_avail=false])
+ [AC_LANG_PROGRAM(
+ [[#include <boost/python.hpp>
+ using namespace boost::python;
+ class foo {};
+ BOOST_PYTHON_MODULE(samp) {
+ class_< foo > ("foo") ;
+ }]],
+ [[return 0]])],
+ [boost_python_cpplib_avail=true],
+ [boost_python_cpplib_avail=false])
AC_LANG_POP
LIBS=$boost_python_save_libs])
@@ -306,16 +306,16 @@ AC_CACHE_CHECK(
AC_LANG_PUSH(C++)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
- [[#include <cppunit/CompilerOutputter.h>
- #include <cppunit/TestResult.h>
- #include <cppunit/TestResultCollector.h>
- #include <cppunit/TestRunner.h>
- #include <cppunit/TextTestProgressListener.h>
- #include <cppunit/BriefTestProgressListener.h>
- #include <cppunit/XmlOutputter.h>
- #include <cppunit/extensions/TestFactoryRegistry.h>]],
- [[CPPUNIT_NS::TestResult controller;
- CPPUNIT_NS::TestResultCollector result;]])],
+ [[#include <cppunit/CompilerOutputter.h>
+ #include <cppunit/TestResult.h>
+ #include <cppunit/TestResultCollector.h>
+ #include <cppunit/TestRunner.h>
+ #include <cppunit/TextTestProgressListener.h>
+ #include <cppunit/BriefTestProgressListener.h>
+ #include <cppunit/XmlOutputter.h>
+ #include <cppunit/extensions/TestFactoryRegistry.h>]],
+ [[CPPUNIT_NS::TestResult controller;
+ CPPUNIT_NS::TestResultCollector result;]])],
[cppunit_avail=true],
[cppunit_avail=false])
AC_LANG_POP
diff --git a/src/data/document.h b/src/data/document.h
index c1dcf88e..2eac4043 100644
--- a/src/data/document.h
+++ b/src/data/document.h
@@ -149,4 +149,4 @@ public:
} // namespace xml
} // namespace ledger
-#endif // _DOCUMENT_H
+#endif // _DOCUMENT_H
diff --git a/src/data/journal.h b/src/data/journal.h
index ed92bffb..821f6910 100644
--- a/src/data/journal.h
+++ b/src/data/journal.h
@@ -358,7 +358,7 @@ bool run_hooks(std::list<T>& list, Data& item, bool post) {
typedef std::list<entry_t *> entries_list;
typedef std::list<auto_entry_t *> auto_entries_list;
typedef std::list<period_entry_t *> period_entries_list;
-typedef std::list<path> path_list;
+typedef std::list<path> path_list;
typedef std::list<string> strings_list;
class journal_t
diff --git a/src/data/node.h b/src/data/node.h
index b0324ca0..36964bdf 100644
--- a/src/data/node.h
+++ b/src/data/node.h
@@ -106,10 +106,10 @@ public:
if (! is_parent_node())
throw_(std::logic_error, "Request to cast leaf node to a parent node");
return downcast<parent_node_t>(*this);
- }
+ }
const parent_node_t& as_parent_node() const {
return const_cast<node_t *>(this)->as_parent_node();
- }
+ }
bool is_terminal_node() const {
return ! has_flags(XML_NODE_IS_PARENT);
@@ -118,10 +118,10 @@ public:
if (! is_terminal_node())
throw_(std::logic_error, "Request to cast parent node to a leaf node");
return downcast<terminal_node_t>(*this);
- }
+ }
const terminal_node_t& as_terminal_node() const {
return const_cast<node_t *>(this)->as_terminal_node();
- }
+ }
virtual value_t to_value() const = 0;
virtual void print(std::ostream& out) const = 0;
diff --git a/src/data/textual.cc b/src/data/textual.cc
index 8fdd4db1..9bee6c39 100644
--- a/src/data/textual.cc
+++ b/src/data/textual.cc
@@ -175,7 +175,7 @@ void parse_entry(std::istream& in,
date = line;
char * p = line;
-
+
while (*p && (std::isdigit(*p) || *p == '/' || *p == '.' || *p == '-'))
p++;
assert(*p);
diff --git a/src/numerics/amount.cc b/src/numerics/amount.cc
index 4c771cc7..79dd663c 100644
--- a/src/numerics/amount.cc
+++ b/src/numerics/amount.cc
@@ -33,9 +33,9 @@
* @file amount.cc
* @author John Wiegley
* @date Thu Apr 26 15:19:46 2007
- *
+ *
* @brief Types for handling commoditized math.
- *
+ *
* This file defines member functions for amount_t, and also defines a
* helper class, bigint_t, which is used as a refcounted wrapper
* around libgmp's mpz_t type.
@@ -43,6 +43,7 @@
#include "amount.h"
#include "binary.h"
+#include "parser.h"
namespace ledger {
@@ -330,7 +331,7 @@ int amount_t::compare(const amount_t& amt) const
else
throw_(amount_error, "Cannot compare two uninitialized amounts");
}
-
+
if (has_commodity() && amt.has_commodity() &&
commodity() != amt.commodity())
throw_(amount_error,
@@ -363,7 +364,7 @@ amount_t& amount_t::operator+=(const amount_t& amt)
else
throw_(amount_error, "Cannot add two uninitialized amounts");
}
-
+
if (commodity() != amt.commodity())
throw_(amount_error,
"Adding amounts with different commodities: " <<
@@ -399,7 +400,7 @@ amount_t& amount_t::operator-=(const amount_t& amt)
else
throw_(amount_error, "Cannot subtract two uninitialized amounts");
}
-
+
if (commodity() != amt.commodity())
throw_(amount_error,
"Subtracting amounts with different commodities: " <<
@@ -483,7 +484,7 @@ amount_t& amount_t::operator*=(const amount_t& amt)
else
throw_(amount_error, "Cannot multiply two uninitialized amounts");
}
-
+
if (has_commodity() && amt.has_commodity() &&
commodity() != amt.commodity())
throw_(amount_error,
@@ -521,7 +522,7 @@ amount_t& amount_t::operator/=(const amount_t& amt)
else
throw_(amount_error, "Cannot divide two uninitialized amounts");
}
-
+
if (has_commodity() && amt.has_commodity() &&
commodity() != amt.commodity())
throw_(amount_error,
@@ -1218,10 +1219,10 @@ namespace {
void amount_t::read(std::istream& in)
{
- using ledger::binary;
+ using namespace ledger::binary;
// Read in the commodity for this amount
-
+
commodity_t::ident_t ident;
read_long(in, ident);
if (ident == 0xffffffff)
@@ -1266,10 +1267,10 @@ void amount_t::read(std::istream& in)
void amount_t::read(const char *& data)
{
- using ledger::binary;
-
+ using namespace ledger::binary;
+
// Read in the commodity for this amount
-
+
commodity_t::ident_t ident;
read_long(data, ident);
if (ident == 0xffffffff)
@@ -1323,10 +1324,10 @@ void amount_t::read(const char *& data)
void amount_t::write(std::ostream& out, bool optimized) const
{
- using ledger::binary;
-
+ using namespace ledger::binary;
+
// Write out the commodity for this amount
-
+
if (! quantity)
throw_(amount_error, "Cannot serialize an uninitialized amount");
diff --git a/src/numerics/amount.h b/src/numerics/amount.h
index f4dbc9bd..1c8ef6d0 100644
--- a/src/numerics/amount.h
+++ b/src/numerics/amount.h
@@ -33,9 +33,9 @@
* @file amount.h
* @author John Wiegley
* @date Wed Apr 18 22:05:53 2007
- *
+ *
* @brief Basic type for handling commoditized math: amount_t.
- *
+ *
* This file contains the most basic numerical type in Ledger:
* amount_t, which relies upon commodity.h (commodity_t) for handling
* commoditized amounts. This class allows Ledger to handle
@@ -78,7 +78,7 @@ class amount_t
// jww (2007-05-03): Make this private, and then make
// ledger::initialize into a member function of session_t.
public:
- /**
+ /**
* The initialize and shutdown methods ready the amount subsystem
* for use. Normally they are called by `ledger::initialize' and
* `ledger::shutdown'.
@@ -347,7 +347,7 @@ public:
return *this;
}
- amount_t round(const optional<precision_t>& prec) const;
+ amount_t round(const optional<precision_t>& prec = none) const;
amount_t unround() const;
amount_t reduce() const {
diff --git a/src/numerics/balance.h b/src/numerics/balance.h
index 1bab4b6b..b132115f 100644
--- a/src/numerics/balance.h
+++ b/src/numerics/balance.h
@@ -33,9 +33,9 @@
* @file balance.h
* @author John Wiegley
* @date Sun May 20 15:28:44 2007
- *
+ *
* @brief Basic type for adding multiple commodities together.
- *
+ *
* Unlike the amount_t class, which throws an exception if amounts of
* differing commodities are added or subtracted, the balance_t class
* is designed to allow this, tracking the amounts of each component
@@ -60,19 +60,19 @@ DECLARE_EXCEPTION(balance_error);
*/
class balance_t
: public equality_comparable<balance_t,
- equality_comparable<balance_t, amount_t,
- equality_comparable<balance_t, double,
- equality_comparable<balance_t, unsigned long,
- equality_comparable<balance_t, long,
- additive<balance_t,
- additive<balance_t, amount_t,
- additive<balance_t, double,
- additive<balance_t, unsigned long,
- additive<balance_t, long,
- multiplicative<balance_t, amount_t,
- multiplicative<balance_t, double,
- multiplicative<balance_t, unsigned long,
- multiplicative<balance_t, long> > > > > > > > > > > > > >
+ equality_comparable<balance_t, amount_t,
+ equality_comparable<balance_t, double,
+ equality_comparable<balance_t, unsigned long,
+ equality_comparable<balance_t, long,
+ additive<balance_t,
+ additive<balance_t, amount_t,
+ additive<balance_t, double,
+ additive<balance_t, unsigned long,
+ additive<balance_t, long,
+ multiplicative<balance_t, amount_t,
+ multiplicative<balance_t, double,
+ multiplicative<balance_t, unsigned long,
+ multiplicative<balance_t, long> > > > > > > > > > > > > >
{
public:
typedef std::map<const commodity_t *, amount_t> amounts_map;
diff --git a/src/numerics/balpair.h b/src/numerics/balpair.h
index 13e4857b..af1a25ab 100644
--- a/src/numerics/balpair.h
+++ b/src/numerics/balpair.h
@@ -33,9 +33,9 @@
* @file balpair.h
* @author John Wiegley
* @date Sun May 20 19:11:58 2007
- *
+ *
* @brief Provides an abstraction around balance_t for tracking costs.
- *
+ *
* When a transaction's amount is added to a balance, only the "value"
* of the amount is added -- not the associated cost of the
* transaction. To provide for this, the balance_pair_t type allows
@@ -56,24 +56,24 @@
namespace ledger {
class balance_pair_t
- : public equality_comparable<balance_pair_t,
- equality_comparable<balance_pair_t, balance_t,
- equality_comparable<balance_pair_t, amount_t,
- equality_comparable<balance_pair_t, double,
- equality_comparable<balance_pair_t, unsigned long,
- equality_comparable<balance_pair_t, long,
- additive<balance_pair_t,
- additive<balance_pair_t, balance_t,
- additive<balance_pair_t, amount_t,
- additive<balance_pair_t, double,
- additive<balance_pair_t, unsigned long,
- additive<balance_pair_t, long,
- multiplicative<balance_pair_t, amount_t,
- multiplicative<balance_pair_t, balance_t,
- multiplicative<balance_pair_t, double,
- multiplicative<balance_pair_t, unsigned long,
- multiplicative2<balance_pair_t, long, balance_t
- > > > > > > > > > > > > > > > > >
+ : public balance_t,
+ public equality_comparable<balance_pair_t,
+ equality_comparable<balance_pair_t, balance_t,
+ equality_comparable<balance_pair_t, amount_t,
+ equality_comparable<balance_pair_t, double,
+ equality_comparable<balance_pair_t, unsigned long,
+ equality_comparable<balance_pair_t, long,
+ additive<balance_pair_t,
+ additive<balance_pair_t, balance_t,
+ additive<balance_pair_t, amount_t,
+ additive<balance_pair_t, double,
+ additive<balance_pair_t, unsigned long,
+ additive<balance_pair_t, long,
+ multiplicative<balance_pair_t, amount_t,
+ multiplicative<balance_pair_t, balance_t,
+ multiplicative<balance_pair_t, double,
+ multiplicative<balance_pair_t, unsigned long,
+ multiplicative<balance_pair_t, long> > > > > > > > > > > > > > > > >
{
/**
* The `cost' member of a balance pair tracks the cost associated
@@ -216,33 +216,22 @@ public:
// comparison
bool operator==(const balance_pair_t& bal_pair) const {
- return quantity == bal_pair.quantity;
+ return quantity() == bal_pair.quantity();
}
bool operator==(const balance_t& bal) const {
- return quantity == bal;
+ return quantity() == bal;
}
bool operator==(const amount_t& amt) const {
- return quantity == amt;
- }
-
- balance_pair_t& operator*=(const amount_t& amt) {
- quantity *= amt;
- if (cost)
- *cost *= amt;
- return *this;
- }
- balance_pair_t& operator/=(const amount_t& amt) {
- quantity /= amt;
- if (cost)
- *cost /= amt;
- return *this;
+ return quantity() == amt;
}
// unary negation
void in_place_negate() {
+#if 0
quantity.in_place_negate();
if (cost)
cost->in_place_negate();
+#endif
}
balance_pair_t negate() const {
balance_pair_t temp = *this;
@@ -255,57 +244,67 @@ public:
// test for non-zero (use ! for zero)
operator bool() const {
- return quantity;
+ return quantity();
}
bool is_realzero() const {
+#if 0
return ((! cost || cost->is_realzero()) && quantity.is_realzero());
+#else
+ return false;
+#endif
}
balance_pair_t abs() const {
+#if 0
balance_pair_t temp = *this;
temp.quantity = temp.quantity.abs();
if (temp.cost)
temp.cost = temp.cost->abs();
return temp;
+#else
+ return balance_pair_t();
+#endif
}
optional<amount_t>
commodity_amount(const optional<const commodity_t&>& commodity = none) const {
- return quantity.commodity_amount(commodity);
+ return quantity().commodity_amount(commodity);
}
optional<balance_t> value(const optional<moment_t>& moment = none) const {
- return quantity.value(moment);
+ return quantity().value(moment);
}
balance_t
strip_annotations(const bool keep_price = amount_t::keep_price,
const bool keep_date = amount_t::keep_date,
const bool keep_tag = amount_t::keep_tag) const {
- return quantity.strip_annotations(keep_price, keep_date, keep_tag);
+ return quantity().strip_annotations(keep_price, keep_date, keep_tag);
}
void print(std::ostream& out, const int first_width,
const int latter_width = -1) const {
- quantity.print(out, first_width, latter_width);
+ quantity().print(out, first_width, latter_width);
}
balance_pair_t& add(const amount_t& amt,
const optional<amount_t>& a_cost = none) {
+#if 0
if (a_cost && ! cost)
cost = quantity;
quantity += amt;
if (cost)
*cost += a_cost ? *a_cost : amt;
+#endif
return *this;
}
bool valid() {
- return quantity.valid() && (! cost || cost->valid());
+ return quantity().valid() && (! cost || cost->valid());
}
void in_place_reduce() {
- quantity.in_place_reduce();
+ quantity().in_place_reduce();
if (cost) cost->in_place_reduce();
}
balance_pair_t reduce() const {
@@ -320,7 +319,7 @@ public:
inline std::ostream& operator<<(std::ostream& out,
const balance_pair_t& bal_pair) {
- bal_pair.quantity.print(out, 12);
+ bal_pair.quantity().print(out, 12);
return out;
}
diff --git a/src/numerics/commodity.cc b/src/numerics/commodity.cc
index 8ab518ee..589ddd05 100644
--- a/src/numerics/commodity.cc
+++ b/src/numerics/commodity.cc
@@ -33,9 +33,9 @@
* @file commodity.cc
* @author John Wiegley
* @date Thu Apr 26 15:19:46 2007
- *
+ *
* @brief Types for dealing with commodities.
- *
+ *
* This file defines member functions for flavors of commodity_t.
*/
diff --git a/src/numerics/commodity.h b/src/numerics/commodity.h
index 6212e743..5389ed46 100644
--- a/src/numerics/commodity.h
+++ b/src/numerics/commodity.h
@@ -33,9 +33,9 @@
* @file commodity.h
* @author John Wiegley
* @date Wed Apr 18 22:05:53 2007
- *
+ *
* @brief Types for handling commodities.
- *
+ *
* This file contains one of the most basic types in Ledger:
* commodity_t, and its annotated cousin, annotated_commodity_t.
*/
@@ -240,7 +240,7 @@ struct annotation_t : public equality_comparable<annotation_t>
out << "price " << (price ? price->to_string() : "NONE") << " "
<< "date " << (date ? *date : moment_t()) << " "
<< "tag " << (tag ? *tag : "NONE");
- }
+ }
bool valid() const {
assert(*this);
@@ -256,7 +256,7 @@ inline std::ostream& operator<<(std::ostream& out, const annotation_t& details)
class annotated_commodity_t
: public commodity_t,
public equality_comparable<annotated_commodity_t,
- equality_comparable2<annotated_commodity_t, commodity_t,
+ equality_comparable2<annotated_commodity_t, commodity_t,
noncopyable> >
{
public:
diff --git a/src/numerics/value.h b/src/numerics/value.h
index 28024767..a70bf33e 100644
--- a/src/numerics/value.h
+++ b/src/numerics/value.h
@@ -51,12 +51,12 @@ namespace xml {
class value_t
: public ordered_field_operators<value_t,
- ordered_field_operators<value_t, balance_pair_t,
- ordered_field_operators<value_t, balance_t,
- ordered_field_operators<value_t, amount_t,
- ordered_field_operators<value_t, double,
- ordered_field_operators<value_t, unsigned long,
- ordered_field_operators<value_t, long> > > > > > >
+ ordered_field_operators<value_t, balance_pair_t,
+ ordered_field_operators<value_t, balance_t,
+ ordered_field_operators<value_t, amount_t,
+ ordered_field_operators<value_t, double,
+ ordered_field_operators<value_t, unsigned long,
+ ordered_field_operators<value_t, long> > > > > > >
{
public:
typedef std::vector<value_t> sequence_t;
@@ -625,7 +625,7 @@ public:
assert(false);
return "<invalid>";
}
-
+
value_t operator-() const {
return negate();
}
diff --git a/src/python/py_commodity.cc b/src/python/py_commodity.cc
index f857a448..0dab3cd3 100644
--- a/src/python/py_commodity.cc
+++ b/src/python/py_commodity.cc
@@ -51,7 +51,7 @@ void export_commodity()
scope().attr("COMMODITY_STYLE_BUILTIN") = COMMODITY_STYLE_BUILTIN;
class_< commodity_t, bases<>,
- commodity_t, boost::noncopyable > ("commodity", no_init)
+ commodity_t, boost::noncopyable > ("commodity", no_init)
.def(self == self)
.def("drop_flags", &commodity_t::drop_flags)
diff --git a/src/python/py_times.cc b/src/python/py_times.cc
index f7672dcc..173f21fa 100644
--- a/src/python/py_times.cc
+++ b/src/python/py_times.cc
@@ -56,7 +56,7 @@ struct date_to_python
return PyDate_FromDate(dte.year(), dte.month(), dte.day());
}
};
-
+
struct date_from_python
{
static void* convertible(PyObject* obj_ptr)
@@ -93,7 +93,7 @@ struct datetime_to_python
tod.total_microseconds() % 1000000);
}
};
-
+
struct datetime_from_python
{
static void* convertible(PyObject* obj_ptr)
diff --git a/src/python/py_utils.cc b/src/python/py_utils.cc
index 73961d43..50ce9712 100644
--- a/src/python/py_utils.cc
+++ b/src/python/py_utils.cc
@@ -50,7 +50,7 @@ struct bool_to_python
Py_RETURN_FALSE;
}
};
-
+
struct bool_from_python
{
static void* convertible(PyObject* obj_ptr)
@@ -82,7 +82,7 @@ struct string_to_python
return incref(object(*boost::polymorphic_downcast<const std::string *>(&str)).ptr());
}
};
-
+
struct string_from_python
{
static void* convertible(PyObject* obj_ptr)
@@ -112,7 +112,7 @@ struct istream_to_python
return incref(boost::python::detail::none());
}
};
-
+
struct istream_from_python
{
static void* convertible(PyObject* obj_ptr)
@@ -140,7 +140,7 @@ struct ostream_to_python
return incref(boost::python::detail::none());
}
};
-
+
struct ostream_from_python
{
static void* convertible(PyObject* obj_ptr)
diff --git a/src/python/pyutils.h b/src/python/pyutils.h
index 216af8b7..41bbbfde 100644
--- a/src/python/pyutils.h
+++ b/src/python/pyutils.h
@@ -62,10 +62,10 @@ struct register_optional_to_python : public boost::noncopyable
{
return boost::python::incref
(value ? boost::python::to_python_value<T>()(*value) :
- boost::python::detail::none());
+ boost::python::detail::none());
}
};
-
+
struct optional_from_python
{
static void * convertible(PyObject * source)
diff --git a/src/python/tuples.hpp b/src/python/tuples.hpp
index 18cbdb83..523846a7 100644
--- a/src/python/tuples.hpp
+++ b/src/python/tuples.hpp
@@ -145,11 +145,11 @@ struct to_py_tuple{
typedef mpl::int_< tuples::length< TTuple >::value > length_type;
static PyObject* convert(const TTuple& c_tuple){
- list values;
- //add all c_tuple items to "values" list
- convert_impl( c_tuple, values, mpl::int_< 0 >(), length_type() );
- //create Python tuple from the list
- return incref( python::tuple( values ).ptr() );
+ list values;
+ //add all c_tuple items to "values" list
+ convert_impl( c_tuple, values, mpl::int_< 0 >(), length_type() );
+ //create Python tuple from the list
+ return incref( python::tuple( values ).ptr() );
}
private:
@@ -157,8 +157,8 @@ private:
template< int index, int length >
static void
convert_impl( const TTuple &c_tuple, list& values, mpl::int_< index >, mpl::int_< length > ) {
- values.append( c_tuple.template get< index >() );
- convert_impl( c_tuple, values, details::increment_index<index>(), length_type() );
+ values.append( c_tuple.template get< index >() );
+ convert_impl( c_tuple, values, details::increment_index<index>(), length_type() );
}
template< int length >
@@ -179,48 +179,48 @@ struct from_py_sequence{
static void*
convertible(PyObject* py_obj){
- if( !PySequence_Check( py_obj ) ){
- return 0;
- }
-
- if( !PyObject_HasAttrString( py_obj, "__len__" ) ){
- return 0;
- }
-
- python::object py_sequence( handle<>( borrowed( py_obj ) ) );
-
- if( tuples::length< TTuple >::value != len( py_sequence ) ){
- return 0;
- }
-
- if( convertible_impl( py_sequence, mpl::int_< 0 >(), length_type() ) ){
- return py_obj;
- }
- else{
- return 0;
- }
+ if( !PySequence_Check( py_obj ) ){
+ return 0;
+ }
+
+ if( !PyObject_HasAttrString( py_obj, "__len__" ) ){
+ return 0;
+ }
+
+ python::object py_sequence( handle<>( borrowed( py_obj ) ) );
+
+ if( tuples::length< TTuple >::value != len( py_sequence ) ){
+ return 0;
+ }
+
+ if( convertible_impl( py_sequence, mpl::int_< 0 >(), length_type() ) ){
+ return py_obj;
+ }
+ else{
+ return 0;
+ }
}
static void
construct( PyObject* py_obj, converter::rvalue_from_python_stage1_data* data){
- typedef converter::rvalue_from_python_storage<TTuple> storage_t;
- storage_t* the_storage = reinterpret_cast<storage_t*>( data );
- void* memory_chunk = the_storage->storage.bytes;
- TTuple* c_tuple = new (memory_chunk) TTuple();
- data->convertible = memory_chunk;
-
- python::object py_sequence( handle<>( borrowed( py_obj ) ) );
- construct_impl( py_sequence, *c_tuple, mpl::int_< 0 >(), length_type() );
+ typedef converter::rvalue_from_python_storage<TTuple> storage_t;
+ storage_t* the_storage = reinterpret_cast<storage_t*>( data );
+ void* memory_chunk = the_storage->storage.bytes;
+ TTuple* c_tuple = new (memory_chunk) TTuple();
+ data->convertible = memory_chunk;
+
+ python::object py_sequence( handle<>( borrowed( py_obj ) ) );
+ construct_impl( py_sequence, *c_tuple, mpl::int_< 0 >(), length_type() );
}
static TTuple to_c_tuple( PyObject* py_obj ){
- if( !convertible( py_obj ) ){
- throw std::runtime_error( "Unable to construct boost::tuples::tuple from Python object!" );
- }
- TTuple c_tuple;
- python::object py_sequence( handle<>( borrowed( py_obj ) ) );
- construct_impl( py_sequence, c_tuple, mpl::int_< 0 >(), length_type() );
- return c_tuple;
+ if( !convertible( py_obj ) ){
+ throw std::runtime_error( "Unable to construct boost::tuples::tuple from Python object!" );
+ }
+ TTuple c_tuple;
+ python::object py_sequence( handle<>( borrowed( py_obj ) ) );
+ construct_impl( py_sequence, c_tuple, mpl::int_< 0 >(), length_type() );
+ return c_tuple;
}
private:
@@ -229,34 +229,34 @@ private:
static bool
convertible_impl( const python::object& py_sequence, mpl::int_< index >, mpl::int_< length > ){
- typedef typename tuples::element< index, TTuple>::type element_type;
+ typedef typename tuples::element< index, TTuple>::type element_type;
- object element = py_sequence[index];
- extract<element_type> type_checker( element );
- if( !type_checker.check() ){
- return false;
- }
- else{
- return convertible_impl( py_sequence, details::increment_index<index>(), length_type() );
- }
+ object element = py_sequence[index];
+ extract<element_type> type_checker( element );
+ if( !type_checker.check() ){
+ return false;
+ }
+ else{
+ return convertible_impl( py_sequence, details::increment_index<index>(), length_type() );
+ }
}
template< int length >
static bool
convertible_impl( const python::object& py_sequence, mpl::int_< length >, mpl::int_< length > ){
- return true;
+ return true;
}
template< int index, int length >
static void
construct_impl( const python::object& py_sequence, TTuple& c_tuple, mpl::int_< index >, mpl::int_< length > ){
- typedef typename tuples::element< index, TTuple>::type element_type;
+ typedef typename tuples::element< index, TTuple>::type element_type;
- object element = py_sequence[index];
- c_tuple.template get< index >() = extract<element_type>( element );
+ object element = py_sequence[index];
+ c_tuple.template get< index >() = extract<element_type>( element );
- construct_impl( py_sequence, c_tuple, details::increment_index<index>(), length_type() );
+ construct_impl( py_sequence, c_tuple, details::increment_index<index>(), length_type() );
}
template< int length >
@@ -272,8 +272,8 @@ void register_tuple(){
to_python_converter< TTuple, to_py_tuple<TTuple> >();
converter::registry::push_back( &from_py_sequence<TTuple>::convertible
- , &from_py_sequence<TTuple>::construct
- , type_id<TTuple>() );
+ , &from_py_sequence<TTuple>::construct
+ , type_id<TTuple>() );
};
} } //boost::python
diff --git a/src/traversal/xpath.cc b/src/traversal/xpath.cc
index ed4c0544..85f25209 100644
--- a/src/traversal/xpath.cc
+++ b/src/traversal/xpath.cc
@@ -1210,7 +1210,7 @@ value_t xpath_t::op_t::calc(scope_t& scope)
case ATTR_NAME:
if (optional<value_t&> value =
kind == ATTR_ID ? current_xml_node(scope).get_attr(as_name()) :
- current_xml_node(scope).get_attr(as_string()))
+ current_xml_node(scope).get_attr(as_string()))
return *value;
break;
diff --git a/src/traversal/xpath.h b/src/traversal/xpath.h
index c9f299fc..26a887a1 100644
--- a/src/traversal/xpath.h
+++ b/src/traversal/xpath.h
@@ -83,9 +83,9 @@ public:
}
virtual void define(const string& name, ptr_op_t def) = 0;
- void define(const string& name, const value_t& val);
+ void define(const string& name, const value_t& val);
virtual ptr_op_t lookup(const string& name) = 0;
- value_t resolve(const string& name) {
+ value_t resolve(const string& name) {
return lookup(name)->calc(*this);
}
@@ -175,7 +175,7 @@ public:
}
virtual void define(const string& name, ptr_op_t def);
- void define(const string& name, const value_t& val) {
+ void define(const string& name, const value_t& val) {
scope_t::define(name, val);
}
virtual ptr_op_t lookup(const string& name);
@@ -232,7 +232,7 @@ public:
const value_t& _element = NULL_VALUE,
const std::size_t _element_index = 0,
const std::size_t _sequence_size = 0)
- : child_scope_t(_parent, CONTEXT_SCOPE), current_element(_element),
+ : child_scope_t(_parent, CONTEXT_SCOPE), current_element(_element),
element_index(_element_index), sequence_size(_sequence_size)
{
TRACE_CTOR(xpath_t::context_scope_t, "scope_t&, const value_t&, ...");
diff --git a/src/utility/pushvar.h b/src/utility/pushvar.h
index 793c0ca6..1a9bdcbc 100644
--- a/src/utility/pushvar.h
+++ b/src/utility/pushvar.h
@@ -33,9 +33,9 @@
* @file scopevar.h
* @author John Wiegley
* @date Sun May 6 20:10:52 2007
- *
+ *
* @brief Adds a facility to C++ for handling "scoped executions".
- *
+ *
* There are sometimes cases where you would like to guarantee that
* something happens at the end of a scope, such as calling a function
* to close a resource for you.
diff --git a/src/utility/system.hh b/src/utility/system.hh
index 96c6575c..92fc5874 100644
--- a/src/utility/system.hh
+++ b/src/utility/system.hh
@@ -36,7 +36,7 @@
* @file system.hh
* @author John Wiegley
* @date Mon Apr 23 03:43:05 2007
- *
+ *
* @brief All system headers needed by Ledger.
*
* These are collected here so that a pre-compiled header can be made.
diff --git a/src/utility/utils.cc b/src/utility/utils.cc
index e9c41cc9..7ddeb677 100644
--- a/src/utility/utils.cc
+++ b/src/utility/utils.cc
@@ -143,7 +143,7 @@ inline void add_to_count_map(object_count_map& the_map,
std::size_t current_memory_size()
{
std::size_t memory_size = 0;
-
+
for (object_count_map::const_iterator i = live_memory_count->begin();
i != live_memory_count->end();
i++)
@@ -262,7 +262,7 @@ inline void report_count_map(std::ostream& out, object_count_map& the_map)
std::size_t current_objects_size()
{
std::size_t objects_size = 0;
-
+
for (object_count_map::const_iterator i = live_object_count->begin();
i != live_object_count->end();
i++)
@@ -617,7 +617,7 @@ void finish_timer(const char * name)
if (need_paren)
_log_buffer << '(';
-
+
_log_buffer << spent.total_milliseconds() << "ms";
if (need_paren)
diff --git a/src/utility/utils.h b/src/utility/utils.h
index 9ddedb0e..b78e716d 100644
--- a/src/utility/utils.h
+++ b/src/utility/utils.h
@@ -33,9 +33,9 @@
* @file utils.h
* @author John Wiegley
* @date Sun May 6 21:20:00 2007
- *
+ *
* @brief This file contains general utility facilities used by Ledger.
- *
+ *
* Ledger has need of the following utility code, which this file
* provides or includes in:
*
@@ -195,7 +195,7 @@ inline string operator+(const string& __lhs, const string& __rhs)
}
string operator+(const char* __lhs, const string& __rhs);
-string operator+(char __lhs, const string& __rhs);
+string operator+(char __lhs, const string& __rhs);
inline string operator+(const string& __lhs, const char* __rhs)
{
@@ -324,7 +324,7 @@ inline bool category_matches(const char * cat) {
#define DEBUG_(msg)
#endif // DEBUG_ON
-
+
#define LOG_MACRO(level, msg) \
(ledger::_log_level >= level ? \
((ledger::_log_buffer << msg), ledger::logger_func(level)) : false)