diff options
author | John Wiegley <johnw@newartisans.com> | 2009-03-04 23:53:43 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-03-04 23:53:43 -0400 |
commit | c11d32571246e51f401deee88f4ebd752b467fdc (patch) | |
tree | ccfe6c759d1f2f46a501495eeedecc8c679865d7 | |
parent | 9a47298d811496816903515bdba7652e275cc32a (diff) | |
download | fork-ledger-c11d32571246e51f401deee88f4ebd752b467fdc.tar.gz fork-ledger-c11d32571246e51f401deee88f4ebd752b467fdc.tar.bz2 fork-ledger-c11d32571246e51f401deee88f4ebd752b467fdc.zip |
Reduced the #include dependency tree to a minimum
83 files changed, 244 insertions, 191 deletions
diff --git a/Makefile.am b/Makefile.am index b59d2cf5..406c0a58 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,75 +5,75 @@ SUBDIRS = po intl EXTRA_DIST = config.rpath contrib lib_LTLIBRARIES = \ - libledger_report.la \ - libledger_data.la \ - libledger_expr.la \ + libledger_util.la \ libledger_math.la \ - libledger_util.la + libledger_expr.la \ + libledger_data.la \ + libledger_report.la lib_cppflags = -I$(srcdir)/src -I$(srcdir)/lib \ -I$(srcdir)/lib/utfcpp/source libledger_util_la_SOURCES = \ - src/stream.cc \ - src/mask.cc \ - src/times.cc \ - src/error.cc \ - src/utils.cc \ + lib/sha1.cpp \ src/accum.cc \ - lib/sha1.cpp + src/utils.cc \ + src/error.cc \ + src/times.cc \ + src/mask.cc \ + src/stream.cc libledger_util_la_CPPFLAGS = $(lib_cppflags) libledger_util_la_LDFLAGS = -release $(VERSION).0 libledger_math_la_SOURCES = \ - src/value.cc \ - src/balance.cc \ + src/amount.cc \ src/commodity.cc \ - src/amount.cc + src/balance.cc \ + src/value.cc libledger_math_la_CPPFLAGS = $(lib_cppflags) libledger_math_la_LDFLAGS = -release $(VERSION).0 libledger_expr_la_SOURCES = \ - src/option.cc \ - src/format.cc \ - src/predicate.cc \ - src/scope.cc \ - src/interactive.cc \ - src/expr.cc \ - src/op.cc \ + src/token.cc \ src/parser.cc \ - src/token.cc + src/op.cc \ + src/expr.cc \ + src/interactive.cc \ + src/scope.cc \ + src/predicate.cc \ + src/format.cc \ + src/option.cc libledger_expr_la_CPPFLAGS = $(lib_cppflags) libledger_expr_la_LDFLAGS = -release $(VERSION).0 libledger_data_la_SOURCES = \ - src/compare.cc \ - src/iterators.cc \ - src/timelog.cc \ - src/textual.cc \ - src/journal.cc \ - src/account.cc \ - src/xact.cc \ + src/item.cc \ src/post.cc \ - src/item.cc + src/xact.cc \ + src/account.cc \ + src/journal.cc \ + src/textual.cc \ + src/timelog.cc \ + src/iterators.cc \ + src/compare.cc libledger_data_la_CPPFLAGS = $(lib_cppflags) libledger_data_la_LDFLAGS = -release $(VERSION).0 libledger_report_la_SOURCES = \ - src/quotes.cc \ - src/generate.cc \ - src/derive.cc \ - src/emacs.cc \ - src/output.cc \ - src/precmd.cc \ - src/chain.cc \ - src/filters.cc \ + src/session.cc \ src/report.cc \ - src/session.cc + src/filters.cc \ + src/chain.cc \ + src/precmd.cc \ + src/output.cc \ + src/emacs.cc \ + src/derive.cc \ + src/generate.cc \ + src/quotes.cc libledger_report_la_CPPFLAGS = $(lib_cppflags) libledger_report_la_LDFLAGS = -release $(VERSION).0 diff --git a/src/account.h b/src/account.h index bc635829..d0516e78 100644 --- a/src/account.h +++ b/src/account.h @@ -46,7 +46,6 @@ #ifndef _ACCOUNT_H #define _ACCOUNT_H -#include "utils.h" #include "scope.h" namespace ledger { diff --git a/src/amount.cc b/src/amount.cc index 3a1fd0ad..65dccb84 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -31,7 +31,6 @@ #include "amount.h" #include "commodity.h" -#include "unistring.h" namespace ledger { diff --git a/src/amount.h b/src/amount.h index 52cb2be9..990b326f 100644 --- a/src/amount.h +++ b/src/amount.h @@ -54,6 +54,8 @@ #define _AMOUNT_H #include "utils.h" +#include "times.h" +#include "flags.h" namespace ledger { diff --git a/src/balance.cc b/src/balance.cc index 1b343fb7..366eb7a7 100644 --- a/src/balance.cc +++ b/src/balance.cc @@ -30,10 +30,32 @@ */ #include "balance.h" -#include "unistring.h" +#include "commodity.h" +#include "unistring.h" // for justify() namespace ledger { +balance_t::balance_t(const double val) +{ + TRACE_CTOR(balance_t, "const double"); + amounts.insert + (amounts_map::value_type(amount_t::current_pool->null_commodity, val)); +} + +balance_t::balance_t(const unsigned long val) +{ + TRACE_CTOR(balance_t, "const unsigned long"); + amounts.insert + (amounts_map::value_type(amount_t::current_pool->null_commodity, val)); +} + +balance_t::balance_t(const long val) +{ + TRACE_CTOR(balance_t, "const long"); + amounts.insert + (amounts_map::value_type(amount_t::current_pool->null_commodity, val)); +} + balance_t& balance_t::operator+=(const balance_t& bal) { foreach (const amounts_map::value_type& pair, bal.amounts) diff --git a/src/balance.h b/src/balance.h index ea0e3a4e..15657c5e 100644 --- a/src/balance.h +++ b/src/balance.h @@ -49,7 +49,7 @@ #ifndef _BALANCE_H #define _BALANCE_H -#include "commodity.h" +#include "amount.h" namespace ledger { @@ -115,21 +115,9 @@ public: if (! amt.is_realzero()) amounts.insert(amounts_map::value_type(&amt.commodity(), amt)); } - balance_t(const double val) { - TRACE_CTOR(balance_t, "const double"); - amounts.insert - (amounts_map::value_type(amount_t::current_pool->null_commodity, val)); - } - balance_t(const unsigned long val) { - TRACE_CTOR(balance_t, "const unsigned long"); - amounts.insert - (amounts_map::value_type(amount_t::current_pool->null_commodity, val)); - } - balance_t(const long val) { - TRACE_CTOR(balance_t, "const long"); - amounts.insert - (amounts_map::value_type(amount_t::current_pool->null_commodity, val)); - } + balance_t(const double val); + balance_t(const unsigned long val); + balance_t(const long val); explicit balance_t(const string& val) { TRACE_CTOR(balance_t, "const string&"); diff --git a/src/chain.cc b/src/chain.cc index 5b1ba18c..9d74f744 100644 --- a/src/chain.cc +++ b/src/chain.cc @@ -30,8 +30,10 @@ */ #include "chain.h" -#include "report.h" +#include "predicate.h" #include "filters.h" +#include "report.h" +#include "session.h" namespace ledger { diff --git a/src/chain.h b/src/chain.h index 89f4ab6e..b22bb665 100644 --- a/src/chain.h +++ b/src/chain.h @@ -46,11 +46,13 @@ #ifndef _CHAIN_H #define _CHAIN_H -#include "post.h" -#include "account.h" +#include "utils.h" namespace ledger { +class post_t; +class account_t; + /** * @brief Brief * diff --git a/src/commodity.cc b/src/commodity.cc index 71658103..9e6865ab 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -29,6 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "amount.h" #include "commodity.h" namespace ledger { diff --git a/src/commodity.h b/src/commodity.h index c152dfc7..8121199a 100644 --- a/src/commodity.h +++ b/src/commodity.h @@ -47,8 +47,6 @@ #ifndef _COMMODITY_H #define _COMMODITY_H -#include "amount.h" - namespace ledger { class keep_details_t; diff --git a/src/compare.cc b/src/compare.cc index 1c92143f..d2d30d36 100644 --- a/src/compare.cc +++ b/src/compare.cc @@ -31,6 +31,8 @@ #include "compare.h" #include "op.h" +#include "post.h" +#include "account.h" namespace ledger { diff --git a/src/compare.h b/src/compare.h index 92cee665..e1207bc3 100644 --- a/src/compare.h +++ b/src/compare.h @@ -47,11 +47,12 @@ #define _COMPARE_H #include "expr.h" -#include "post.h" -#include "account.h" namespace ledger { +class post_t; +class account_t; + /** * @brief Brief * diff --git a/src/derive.cc b/src/derive.cc index b367307d..4c85e1fb 100644 --- a/src/derive.cc +++ b/src/derive.cc @@ -30,6 +30,12 @@ */ #include "derive.h" +#include "xact.h" +#include "post.h" +#include "account.h" +#include "journal.h" +#include "session.h" +#include "report.h" #include "output.h" namespace ledger { @@ -229,7 +235,7 @@ namespace { } xact_t * derive_xact_from_template(xact_template_t& tmpl, - report_t& report) + report_t& report) { if (tmpl.payee_mask.empty()) throw std::runtime_error(_("'xact' command requires at least a payee")); diff --git a/src/derive.h b/src/derive.h index 9825d496..cf764b10 100644 --- a/src/derive.h +++ b/src/derive.h @@ -46,18 +46,20 @@ #ifndef _DERIVE_H #define _DERIVE_H -#include "scope.h" +#include "value.h" namespace ledger { +class call_scope_t; + value_t xact_command(call_scope_t& args); value_t template_command(call_scope_t& args); class xact_t; class report_t; xact_t * derive_new_xact(report_t& report, - value_t::sequence_t::const_iterator i, - value_t::sequence_t::const_iterator end); + value_t::sequence_t::const_iterator i, + value_t::sequence_t::const_iterator end); } // namespace ledger diff --git a/src/emacs.cc b/src/emacs.cc index fb54783b..64dee55d 100644 --- a/src/emacs.cc +++ b/src/emacs.cc @@ -30,6 +30,8 @@ */ #include "emacs.h" +#include "xact.h" +#include "post.h" #include "account.h" namespace ledger { diff --git a/src/emacs.h b/src/emacs.h index dec7d183..1467cdaf 100644 --- a/src/emacs.h +++ b/src/emacs.h @@ -46,10 +46,12 @@ #ifndef _EMACS_H #define _EMACS_H -#include "output.h" +#include "chain.h" namespace ledger { +class xact_t; + /** * @brief Brief * diff --git a/src/expr.cc b/src/expr.cc index 20b52f71..2b14e962 100644 --- a/src/expr.cc +++ b/src/expr.cc @@ -31,7 +31,6 @@ #include "expr.h" #include "parser.h" -#include "op.h" namespace ledger { diff --git a/src/filters.cc b/src/filters.cc index 36219b0d..adf8b33a 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -31,9 +31,9 @@ #include "filters.h" #include "iterators.h" -#include "compare.h" -#include "format.h" +#include "journal.h" #include "report.h" +#include "compare.h" namespace ledger { diff --git a/src/filters.h b/src/filters.h index aafdf082..68df6e06 100644 --- a/src/filters.h +++ b/src/filters.h @@ -47,7 +47,6 @@ #define _FILTERS_H #include "chain.h" -#include "predicate.h" #include "xact.h" #include "post.h" #include "account.h" diff --git a/src/flags.h b/src/flags.h index 754f0871..fb51a3e6 100644 --- a/src/flags.h +++ b/src/flags.h @@ -46,7 +46,6 @@ #ifndef _FLAGS_H #define _FLAGS_H -#include "utils.h" /** * @brief Brief diff --git a/src/format.cc b/src/format.cc index 79f95375..131ba9e2 100644 --- a/src/format.cc +++ b/src/format.cc @@ -31,6 +31,8 @@ #include "format.h" #include "scope.h" +#include "unistring.h" +#include "pstream.h" namespace ledger { diff --git a/src/format.h b/src/format.h index df757eeb..13dd0876 100644 --- a/src/format.h +++ b/src/format.h @@ -47,10 +47,11 @@ #define _FORMAT_H #include "expr.h" -#include "unistring.h" namespace ledger { +class unistring; + DECLARE_EXCEPTION(format_error, std::runtime_error); /** diff --git a/src/generate.h b/src/generate.h index 7a837bfb..ee8c564d 100644 --- a/src/generate.h +++ b/src/generate.h @@ -50,6 +50,8 @@ namespace ledger { +class session_t; + class generate_posts_iterator : public posts_iterator { session_t& session; diff --git a/src/global.cc b/src/global.cc index 51760436..7789bb85 100644 --- a/src/global.cc +++ b/src/global.cc @@ -29,9 +29,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <ledger.h> - #include "global.h" +#if defined(HAVE_BOOST_PYTHON) +#include "pyinterp.h" +#endif +#include "item.h" +#include "journal.h" namespace ledger { diff --git a/src/global.h b/src/global.h index dcccb214..2ef5a545 100644 --- a/src/global.h +++ b/src/global.h @@ -38,10 +38,15 @@ #ifndef _GLOBAL_H #define _GLOBAL_H +#include "interactive.h" +#include "option.h" #include "report.h" namespace ledger { +class session_t; +class report_t; + class global_scope_t : public noncopyable, public scope_t { shared_ptr<session_t> session_ptr; diff --git a/src/hooks.h b/src/hooks.h index 7a80f3be..511749ca 100644 --- a/src/hooks.h +++ b/src/hooks.h @@ -46,7 +46,6 @@ #ifndef _HOOKS_H #define _HOOKS_H -#include "utils.h" /** * @brief Brief @@ -46,7 +46,6 @@ #ifndef _ITEM_H #define _ITEM_H -#include "utils.h" #include "scope.h" namespace ledger { diff --git a/src/iterators.h b/src/iterators.h index d4c99fbf..7ea78118 100644 --- a/src/iterators.h +++ b/src/iterators.h @@ -46,12 +46,14 @@ #ifndef _ITERATORS_H #define _ITERATORS_H -#include "journal.h" #include "xact.h" +#include "post.h" #include "account.h" namespace ledger { +class journal_t; + /** * @brief Brief * diff --git a/src/journal.cc b/src/journal.cc index d455939b..ded5d54f 100644 --- a/src/journal.cc +++ b/src/journal.cc @@ -30,12 +30,11 @@ */ #include "journal.h" +#include "xact.h" #include "account.h" namespace ledger { -const string version = PACKAGE_VERSION; - journal_t::~journal_t() { TRACE_DTOR(journal_t); diff --git a/src/journal.h b/src/journal.h index b8af8b00..43309590 100644 --- a/src/journal.h +++ b/src/journal.h @@ -48,13 +48,21 @@ #include "utils.h" #include "hooks.h" -#include "xact.h" namespace ledger { typedef std::list<path> paths_list; +class xact_t; +class auto_xact_t; +class xact_finalizer_t; +class period_xact_t; class account_t; +class scope_t; + +typedef std::list<xact_t *> xacts_list; +typedef std::list<auto_xact_t *> auto_xacts_list; +typedef std::list<period_xact_t *> period_xacts_list; /** * @brief Brief @@ -64,9 +72,9 @@ class account_t; class journal_t : public noncopyable { public: - account_t * master; - account_t * basket; - xacts_list xacts; + account_t * master; + account_t * basket; + xacts_list xacts; auto_xacts_list auto_xacts; period_xacts_list period_xacts; @@ -104,8 +112,6 @@ public: bool valid() const; }; -extern const string version; - } // namespace ledger #endif // _JOURNAL_H diff --git a/src/ledger.h b/src/ledger.h index a0be6687..d37fddaa 100644 --- a/src/ledger.h +++ b/src/ledger.h @@ -67,24 +67,12 @@ #ifndef _LEDGER_H #define _LEDGER_H -#include <utils.h> -#include <option.h> -#include <value.h> -#include <expr.h> -#include <journal.h> -#include <iterators.h> -#include <compare.h> -#include <session.h> -#include <report.h> -#include <quotes.h> -#include <emacs.h> #if defined(HAVE_BOOST_PYTHON) -#include <pyinterp.h> #define LEDGER_SESSION_T python_interpreter_t #else #define LEDGER_SESSION_T session_t diff --git a/src/main.cc b/src/main.cc index 02bb335b..0933abcf 100644 --- a/src/main.cc +++ b/src/main.cc @@ -29,10 +29,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <ledger.h> // Read this file for a top-level overview - #include "global.h" // This is where the meat of main() is, which - // was moved there for the sake of clarity + // was moved there for the sake of clarity here +#include "session.h" + using namespace ledger; namespace { @@ -31,6 +31,7 @@ #include "op.h" #include "scope.h" +#include "commodity.h" namespace ledger { diff --git a/src/option.h b/src/option.h index 841fe409..86899931 100644 --- a/src/option.h +++ b/src/option.h @@ -46,10 +46,12 @@ #ifndef _OPTION_H #define _OPTION_H -#include "interactive.h" +#include "scope.h" namespace ledger { +class call_scope_t; + template <typename T> class option_t { diff --git a/src/output.cc b/src/output.cc index b559f253..f10de042 100644 --- a/src/output.cc +++ b/src/output.cc @@ -30,6 +30,11 @@ */ #include "output.h" +#include "xact.h" +#include "post.h" +#include "account.h" +#include "session.h" +#include "report.h" namespace ledger { @@ -58,6 +63,11 @@ format_posts::format_posts(report_t& _report, } } +void format_posts::flush() +{ + report.output_stream.flush(); +} + void format_posts::operator()(post_t& post) { std::ostream& out(report.output_stream); diff --git a/src/output.h b/src/output.h index c154bed1..c7e108fe 100644 --- a/src/output.h +++ b/src/output.h @@ -46,11 +46,17 @@ #ifndef _OUTPUT_H #define _OUTPUT_H -#include "report.h" +#include "chain.h" +#include "predicate.h" #include "format.h" namespace ledger { +class xact_t; +class post_t; +class account_t; +class report_t; + /** * @brief Brief * @@ -74,9 +80,7 @@ public: TRACE_DTOR(format_posts); } - virtual void flush() { - report.output_stream.flush(); - } + virtual void flush(); virtual void operator()(post_t& post); }; diff --git a/src/post.cc b/src/post.cc index 92fe84d1..4289433e 100644 --- a/src/post.cc +++ b/src/post.cc @@ -30,10 +30,11 @@ */ #include "post.h" -#include "journal.h" +#include "xact.h" #include "account.h" #include "interactive.h" -#include "format.h" +#include "unistring.h" // jww (2009-03-04): really?? +#include "format.h" // jww (2009-03-04): really?? namespace ledger { diff --git a/src/precmd.cc b/src/precmd.cc index e04470b8..3ed179f4 100644 --- a/src/precmd.cc +++ b/src/precmd.cc @@ -30,8 +30,12 @@ */ #include "precmd.h" -#include "interactive.h" +#include "xact.h" +#include "post.h" +#include "account.h" +#include "session.h" #include "report.h" +#include "format.h" namespace ledger { diff --git a/src/predicate.h b/src/predicate.h index 9eafa95a..47eba04b 100644 --- a/src/predicate.h +++ b/src/predicate.h @@ -47,7 +47,7 @@ #define _PREDICATE_H #include "expr.h" -#include "scope.h" +#include "commodity.h" namespace ledger { diff --git a/src/py_amount.cc b/src/py_amount.cc index b016b7e7..171cb586 100644 --- a/src/py_amount.cc +++ b/src/py_amount.cc @@ -31,11 +31,8 @@ #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> +#include "pyfstream.h" +#include "commodity.h" namespace ledger { diff --git a/src/py_balance.cc b/src/py_balance.cc index 27be7969..1e0834b8 100644 --- a/src/py_balance.cc +++ b/src/py_balance.cc @@ -30,12 +30,6 @@ */ #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 { diff --git a/src/py_chain.cc b/src/py_chain.cc index 279d4375..7cc4bab4 100644 --- a/src/py_chain.cc +++ b/src/py_chain.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "chain.h" namespace ledger { diff --git a/src/py_commodity.cc b/src/py_commodity.cc index 7b101ec1..592116df 100644 --- a/src/py_commodity.cc +++ b/src/py_commodity.cc @@ -30,8 +30,7 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "amount.h" +#include "commodity.h" namespace ledger { diff --git a/src/py_expr.cc b/src/py_expr.cc index 047fd2bc..61ce4007 100644 --- a/src/py_expr.cc +++ b/src/py_expr.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "expr.h" namespace ledger { diff --git a/src/py_flags.cc b/src/py_flags.cc index 440c81c6..b683fefb 100644 --- a/src/py_flags.cc +++ b/src/py_flags.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "flags.h" namespace ledger { diff --git a/src/py_format.cc b/src/py_format.cc index 2880cf3e..8b061ddd 100644 --- a/src/py_format.cc +++ b/src/py_format.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "format.h" namespace ledger { diff --git a/src/py_global.cc b/src/py_global.cc index c064f9d8..af07ed7f 100644 --- a/src/py_global.cc +++ b/src/py_global.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "global.h" namespace ledger { diff --git a/src/py_item.cc b/src/py_item.cc index f0e3f440..94483a10 100644 --- a/src/py_item.cc +++ b/src/py_item.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "item.h" namespace ledger { diff --git a/src/py_journal.cc b/src/py_journal.cc index 812dc881..ea006516 100644 --- a/src/py_journal.cc +++ b/src/py_journal.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "journal.h" namespace ledger { diff --git a/src/py_post.cc b/src/py_post.cc index a60b79f9..2d4fcfb8 100644 --- a/src/py_post.cc +++ b/src/py_post.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "post.h" namespace ledger { diff --git a/src/py_report.cc b/src/py_report.cc index 1a42b1d7..7683f46c 100644 --- a/src/py_report.cc +++ b/src/py_report.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "report.h" namespace ledger { diff --git a/src/py_scope.cc b/src/py_scope.cc index 35fb1a7f..1bcb323a 100644 --- a/src/py_scope.cc +++ b/src/py_scope.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "scope.h" namespace ledger { diff --git a/src/py_session.cc b/src/py_session.cc index df0c6dd8..7b025aab 100644 --- a/src/py_session.cc +++ b/src/py_session.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "session.h" namespace ledger { diff --git a/src/py_timelog.cc b/src/py_timelog.cc index 03416ec2..fc25c3e0 100644 --- a/src/py_timelog.cc +++ b/src/py_timelog.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "timelog.h" namespace ledger { diff --git a/src/py_utils.cc b/src/py_utils.cc index ac1ed822..c211c507 100644 --- a/src/py_utils.cc +++ b/src/py_utils.cc @@ -31,6 +31,7 @@ #include "pyinterp.h" #include "pyutils.h" +#include "pyfstream.h" namespace ledger { diff --git a/src/py_value.cc b/src/py_value.cc index b1b2bba4..42d455d7 100644 --- a/src/py_value.cc +++ b/src/py_value.cc @@ -31,7 +31,7 @@ #include "pyinterp.h" #include "pyutils.h" -#include "value.h" +#include "commodity.h" namespace ledger { diff --git a/src/py_xact.cc b/src/py_xact.cc index 441d5741..cc1887f9 100644 --- a/src/py_xact.cc +++ b/src/py_xact.cc @@ -30,8 +30,6 @@ */ #include "pyinterp.h" -#include "pyutils.h" -#include "xact.h" namespace ledger { diff --git a/src/pyledger.cc b/src/pyledger.cc index 963efe11..b7f88a8e 100644 --- a/src/pyledger.cc +++ b/src/pyledger.cc @@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <pyledger.h> +#include "pyinterp.h" using namespace boost::python; diff --git a/src/pyledger.h b/src/pyledger.h index ee27767a..3374e895 100644 --- a/src/pyledger.h +++ b/src/pyledger.h @@ -32,7 +32,5 @@ #ifndef _PYLEDGER_H #define _PYLEDGER_H -#include <ledger.h> -#include <pyinterp.h> #endif // _PYLEDGER_H diff --git a/src/pyutils.h b/src/pyutils.h index c0e5a38a..d9b94d50 100644 --- a/src/pyutils.h +++ b/src/pyutils.h @@ -32,7 +32,6 @@ #ifndef _PY_UTILS_H #define _PY_UTILS_H -#include "pyfstream.h" template <typename T, typename TfromPy> struct object_from_python diff --git a/src/quotes.cc b/src/quotes.cc index 5ccc076f..90e3d70e 100644 --- a/src/quotes.cc +++ b/src/quotes.cc @@ -30,7 +30,6 @@ */ #include "quotes.h" -#include "utils.h" namespace ledger { diff --git a/src/quotes.h b/src/quotes.h index caf159ce..68c7cade 100644 --- a/src/quotes.h +++ b/src/quotes.h @@ -46,7 +46,6 @@ #ifndef _QUOTES_H #define _QUOTES_H -#include "amount.h" namespace ledger { diff --git a/src/report.cc b/src/report.cc index 160cb698..080ba433 100644 --- a/src/report.cc +++ b/src/report.cc @@ -30,15 +30,16 @@ */ #include "report.h" -#include "interactive.h" +#include "session.h" +#include "unistring.h" // jww (2009-03-04): really?? +#include "format.h" // jww (2009-03-04): really?? +#include "output.h" #include "iterators.h" -#include "generate.h" #include "filters.h" -#include "chain.h" -#include "output.h" #include "precmd.h" -#include "emacs.h" +#include "generate.h" #include "derive.h" +#include "emacs.h" namespace ledger { @@ -379,6 +380,13 @@ namespace { }; } +value_t report_t::reload_command(call_scope_t&) +{ + session.close_journal_files(); + session.read_journal_files(); + return true; +} + bool report_t::maybe_import(const string& module) { if (lookup(string(OPT_PREFIX) + "import_")) { @@ -620,6 +628,11 @@ option_t<report_t> * report_t::lookup_option(const char * p) return NULL; } +void report_t::define(const string& name, expr_t::ptr_op_t def) +{ + session.define(name, def); +} + expr_t::ptr_op_t report_t::lookup(const string& name) { if (expr_t::ptr_op_t def = session.lookup(name)) diff --git a/src/report.h b/src/report.h index f83f1745..b39cd53a 100644 --- a/src/report.h +++ b/src/report.h @@ -46,11 +46,18 @@ #ifndef _REPORT_H #define _REPORT_H -#include "session.h" +#include "interactive.h" +#include "expr.h" #include "chain.h" +#include "stream.h" +#include "option.h" +#include "commodity.h" namespace ledger { +class session_t; +class xact_t; + // These are the elements of any report: // // 1. Formatting string used for outputting the underlying ReportedType. @@ -156,11 +163,7 @@ public: return option.str(); } - value_t reload_command(call_scope_t&) { - session.close_journal_files(); - session.read_journal_files(); - return true; - } + value_t reload_command(call_scope_t&); keep_details_t what_to_keep() { bool lots = HANDLED(lots) || HANDLED(lots_actual); @@ -174,9 +177,7 @@ public: option_t<report_t> * lookup_option(const char * p); - virtual void define(const string& name, expr_t::ptr_op_t def) { - session.define(name, def); - } + virtual void define(const string& name, expr_t::ptr_op_t def); virtual expr_t::ptr_op_t lookup(const string& name); diff --git a/src/scope.h b/src/scope.h index f42bf9a5..2539074e 100644 --- a/src/scope.h +++ b/src/scope.h @@ -46,7 +46,6 @@ #ifndef _SCOPE_H #define _SCOPE_H -#include "expr.h" #include "op.h" namespace ledger { diff --git a/src/session.cc b/src/session.cc index 22434f5a..ff23719b 100644 --- a/src/session.cc +++ b/src/session.cc @@ -30,7 +30,10 @@ */ #include "session.h" -#include "report.h" +#include "commodity.h" +#include "xact.h" +#include "account.h" +#include "journal.h" #include "iterators.h" #include "filters.h" diff --git a/src/session.h b/src/session.h index 37c694fa..1d700d1b 100644 --- a/src/session.h +++ b/src/session.h @@ -46,13 +46,16 @@ #ifndef _SESSION_H #define _SESSION_H -#include "option.h" -#include "journal.h" +#include "interactive.h" #include "account.h" -#include "format.h" +#include "journal.h" +#include "option.h" namespace ledger { +class commodity_pool_t; +class xact_t; + /** * @brief Brief * diff --git a/src/stream.cc b/src/stream.cc index 18f730a2..283ac7e7 100644 --- a/src/stream.cc +++ b/src/stream.cc @@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "utils.h" +#include "stream.h" namespace ledger { diff --git a/src/stream.h b/src/stream.h index 624c3eee..e87da67a 100644 --- a/src/stream.h +++ b/src/stream.h @@ -48,6 +48,8 @@ #ifndef _STREAM_H #define _STREAM_H +#include "utils.h" + namespace ledger { /** diff --git a/src/textual.cc b/src/textual.cc index bb30309c..1c3bcb02 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -30,8 +30,12 @@ */ #include "journal.h" +#include "xact.h" +#include "post.h" #include "account.h" #include "option.h" +#include "pstream.h" + #define TIMELOG_SUPPORT 1 #if defined(TIMELOG_SUPPORT) #include "timelog.h" diff --git a/src/timelog.cc b/src/timelog.cc index 68e1ab79..decc65bd 100644 --- a/src/timelog.cc +++ b/src/timelog.cc @@ -30,6 +30,10 @@ */ #include "timelog.h" +#include "xact.h" +#include "post.h" +#include "account.h" +#include "journal.h" namespace ledger { diff --git a/src/timelog.h b/src/timelog.h index a704743c..85ea56c6 100644 --- a/src/timelog.h +++ b/src/timelog.h @@ -46,10 +46,14 @@ #ifndef _TIMELOG_H #define _TIMELOG_H -#include "journal.h" +#include "utils.h" +#include "times.h" namespace ledger { +class account_t; +class journal_t; + /** * @brief Brief * diff --git a/src/times.cc b/src/times.cc index c3b5009d..6e67f2f7 100644 --- a/src/times.cc +++ b/src/times.cc @@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "utils.h" // this brings in times.h +#include "times.h" namespace ledger { diff --git a/src/times.h b/src/times.h index 8e0f72f9..b83c65b5 100644 --- a/src/times.h +++ b/src/times.h @@ -44,6 +44,8 @@ #ifndef _TIMES_H #define _TIMES_H +#include "utils.h" + namespace ledger { DECLARE_EXCEPTION(datetime_error, std::runtime_error); diff --git a/src/unistring.h b/src/unistring.h index 74f17181..b3086c39 100644 --- a/src/unistring.h +++ b/src/unistring.h @@ -46,7 +46,6 @@ #ifndef _UNISTRING_H #define _UNISTRING_H -#include "utils.h" namespace ledger { diff --git a/src/utils.cc b/src/utils.cc index 0e208b45..14f89d84 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "utils.h" +#include "times.h" /********************************************************************** * @@ -656,6 +656,8 @@ void sigpipe_handler(int) namespace ledger { +const string version = PACKAGE_VERSION; + path expand_path(const path& pathname) { if (pathname.empty()) diff --git a/src/utils.h b/src/utils.h index 323d82b4..667cd6e8 100644 --- a/src/utils.h +++ b/src/utils.h @@ -464,10 +464,6 @@ void finish_timer(const char * name); */ #include "error.h" -#include "times.h" -#include "flags.h" -#include "stream.h" // output_stream_t -#include "pstream.h" // pstristream enum caught_signal_t { NONE_CAUGHT, @@ -600,6 +596,8 @@ inline char peek_next_nonws(std::istream& in) { *_p = '\0'; \ } +extern const string version; + } // namespace ledger /*@}*/ diff --git a/src/value.cc b/src/value.cc index c47a4f6e..2797eb0c 100644 --- a/src/value.cc +++ b/src/value.cc @@ -30,6 +30,7 @@ */ #include "value.h" +#include "commodity.h" #include "unistring.h" namespace ledger { diff --git a/src/value.h b/src/value.h index bd25c7a7..410ff22a 100644 --- a/src/value.h +++ b/src/value.h @@ -49,7 +49,7 @@ #ifndef _VALUE_H #define _VALUE_H -#include "balance.h" +#include "balance.h" // includes amount.h #include "mask.h" namespace ledger { diff --git a/src/xact.cc b/src/xact.cc index 132f2ebf..8fb1d14c 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -30,9 +30,9 @@ */ #include "xact.h" -#include "journal.h" +#include "post.h" #include "account.h" -#include "format.h" +#include "journal.h" namespace ledger { @@ -46,13 +46,16 @@ #ifndef _XACT_H #define _XACT_H -#include "post.h" +#include "item.h" #include "predicate.h" namespace ledger { +class post_t; class journal_t; +typedef std::list<post_t *> posts_list; + /** * @brief Brief * @@ -244,7 +247,7 @@ inline bool auto_xact_finalizer_t::operator()(xact_t& xact, bool post) { return true; } -typedef std::list<xact_t *> xacts_list; +typedef std::list<xact_t *> xacts_list; typedef std::list<auto_xact_t *> auto_xacts_list; typedef std::list<period_xact_t *> period_xacts_list; diff --git a/test/unit/t_commodity.cc b/test/unit/t_commodity.cc index c546c750..969b14c2 100644 --- a/test/unit/t_commodity.cc +++ b/test/unit/t_commodity.cc @@ -1,5 +1,6 @@ #include "t_commodity.h" +#include "amount.h" #include "commodity.h" using namespace ledger; diff --git a/test/unit/t_times.cc b/test/unit/t_times.cc index 5b2e4d8f..9f97be35 100644 --- a/test/unit/t_times.cc +++ b/test/unit/t_times.cc @@ -1,6 +1,7 @@ #include "t_times.h" #include "utils.h" +#include "times.h" using namespace ledger; |