summaryrefslogtreecommitdiff
path: root/src/global.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-20 02:53:54 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-20 02:53:54 -0400
commitc1b25fcf8629eca326fe6dd586e4896eeb5f2d45 (patch)
treef7c59ce215ee66513db2f9eb142cdf9e7095c465 /src/global.cc
parentf2f52066d2a9c82619ffea0f3972e48417a90b5b (diff)
downloadfork-ledger-c1b25fcf8629eca326fe6dd586e4896eeb5f2d45.tar.gz
fork-ledger-c1b25fcf8629eca326fe6dd586e4896eeb5f2d45.tar.bz2
fork-ledger-c1b25fcf8629eca326fe6dd586e4896eeb5f2d45.zip
Rewrote the equity command, which is working again
The old implementation used an account formatter, and was very specialized. The new is done as a transaction filter, and works along with everything else, eliminating bugs special to the equity report.
Diffstat (limited to 'src/global.cc')
-rw-r--r--src/global.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/global.cc b/src/global.cc
index 0ecd1fb8..f967d3e9 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -339,7 +339,7 @@ void global_scope_t::normalize_session_options()
function_t global_scope_t::look_for_precommand(scope_t& scope,
const string& verb)
{
- if (expr_t::ptr_op_t def = scope.lookup(string("precmd_") + verb))
+ if (expr_t::ptr_op_t def = scope.lookup(string(PRECMD_PREFIX) + verb))
return def->as_function();
else
return function_t();
@@ -348,7 +348,7 @@ function_t global_scope_t::look_for_precommand(scope_t& scope,
function_t global_scope_t::look_for_command(scope_t& scope,
const string& verb)
{
- if (expr_t::ptr_op_t def = scope.lookup(string("cmd_") + verb))
+ if (expr_t::ptr_op_t def = scope.lookup(string(CMD_PREFIX) + verb))
return def->as_function();
else
return function_t();
@@ -361,7 +361,7 @@ void global_scope_t::normalize_report_options(const string& verb)
report_t& rep(report());
- // jww (2009-02-09): These global are a hack, but hard to avoid
+ // jww (2009-02-09): These global are a hack, but hard to avoid.
item_t::use_effective_date = rep.HANDLED(effective);
if (rep.HANDLED(date_format_)) {
@@ -369,14 +369,15 @@ void global_scope_t::normalize_report_options(const string& verb)
output_date_format = rep.HANDLER(date_format_).str();
}
- // jww (2008-08-14): This code really needs to be rationalized away
- // for 3.0.
+ // jww (2008-08-14): This code really needs to be rationalized away for 3.0.
+ // I might be able to do it with command objects, like register_t, which
+ // each know how to adjust the report based on its current option settings.
if (verb == "print" || verb == "entry" || verb == "dump") {
rep.HANDLER(related).on_only();
rep.HANDLER(related_all).on_only();
}
else if (verb == "equity") {
- rep.HANDLER(subtotal).on_only();
+ rep.HANDLER(equity).on_only();
}
else if (rep.HANDLED(related)) {
if (verb[0] == 'r') {