diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-10 14:28:07 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-10 14:28:07 -0400 |
commit | bea90a2b985694acb8554f50136fa5afc7fdba12 (patch) | |
tree | d27bb8f74c157da289d2da92b0728acd47bac9f8 | |
parent | 685b12d8d3d225498f6dfdbe7b17056684cc2ca8 (diff) | |
download | fork-ledger-bea90a2b985694acb8554f50136fa5afc7fdba12.tar.gz fork-ledger-bea90a2b985694acb8554f50136fa5afc7fdba12.tar.bz2 fork-ledger-bea90a2b985694acb8554f50136fa5afc7fdba12.zip |
Fixed the "generate" command
-rw-r--r-- | src/generate.cc | 4 | ||||
-rw-r--r-- | src/print.cc | 8 | ||||
-rw-r--r-- | src/report.cc | 10 | ||||
-rw-r--r-- | src/report.h | 6 |
4 files changed, 11 insertions, 17 deletions
diff --git a/src/generate.cc b/src/generate.cc index 8ea1ab45..3f540b22 100644 --- a/src/generate.cc +++ b/src/generate.cc @@ -60,8 +60,8 @@ generate_posts_iterator::generate_posts_iterator two_six_range(2, 6), two_six_gen(rnd_gen, two_six_range), strlen_range(1, 40), strlen_gen(rnd_gen, strlen_range), - neg_number_range(-1000000, -1), neg_number_gen(rnd_gen, neg_number_range), - pos_number_range(1, 1000000), pos_number_gen(rnd_gen, pos_number_range) + neg_number_range(-10000, -1), neg_number_gen(rnd_gen, neg_number_range), + pos_number_range(1, 10000), pos_number_gen(rnd_gen, pos_number_range) { TRACE_CTOR(generate_posts_iterator, "bool"); diff --git a/src/print.cc b/src/print.cc index 84aa441f..2795c7ad 100644 --- a/src/print.cc +++ b/src/print.cc @@ -119,9 +119,9 @@ namespace { } foreach (post_t * post, xact.posts) { - if (post->has_flags(ITEM_TEMP | ITEM_GENERATED) && - ! post->has_flags(POST_ANONYMIZED) && - ! report.HANDLED(print_virtual)) + if (! report.HANDLED(generated) && + (post->has_flags(ITEM_TEMP | ITEM_GENERATED) && + ! post->has_flags(POST_ANONYMIZED))) continue; out << " "; @@ -157,7 +157,7 @@ namespace { if (account_width < name.length()) account_width = name.length(); - if (! post->has_flags(POST_CALCULATED) || report.HANDLED(print_virtual)) { + if (! post->has_flags(POST_CALCULATED) || report.HANDLED(generated)) { out << name.extract(); int slip = (static_cast<int>(account_width) - static_cast<int>(name.length())); diff --git a/src/report.cc b/src/report.cc index bed3ef5c..1e1827f9 100644 --- a/src/report.cc +++ b/src/report.cc @@ -137,9 +137,6 @@ void report_t::normalize_options(const string& verb) HANDLER(equity).on_only(string("?normalize")); } - if (verb == "print") - HANDLER(limit_).on(string("?normalize"), "actual"); - if (verb[0] != 'b' && verb[0] != 'r') HANDLER(base).on_only(string("?normalize")); @@ -313,8 +310,6 @@ void report_t::posts_report(post_handler_ptr handler) void report_t::generate_report(post_handler_ptr handler) { - HANDLER(limit_).on(string("#generate"), "actual"); - handler = chain_handlers(handler, *this); generate_posts_iterator walker @@ -992,6 +987,7 @@ option_t<report_t> * report_t::lookup_option(const char * p) OPT(gain); else OPT(group_by_); else OPT(group_title_format_); + else OPT(generated); break; case 'h': OPT(head_); @@ -1045,7 +1041,6 @@ option_t<report_t> * report_t::lookup_option(const char * p) else OPT(payee_width_); else OPT(prepend_format_); else OPT(prepend_width_); - else OPT(print_virtual); break; case 'q': OPT(quantity); @@ -1398,7 +1393,7 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind, case 'e': if (is_eq(p, "equity")) { - HANDLER(print_virtual).on_only(string("#equity")); + HANDLER(generated).on_only(string("#equity")); return WRAP_FUNCTOR(reporter<>(new print_xacts(*this), *this, "#equity")); } else if (is_eq(p, "entry")) { @@ -1489,7 +1484,6 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind, break; case 'g': if (is_eq(p, "generate")) { - HANDLER(print_virtual).on_only(string("#generate")); return expr_t::op_t::wrap_functor (reporter<post_t, post_handler_ptr, &report_t::generate_report> (new print_xacts(*this), *this, "#generate")); diff --git a/src/report.h b/src/report.h index 6b0333bd..b893772e 100644 --- a/src/report.h +++ b/src/report.h @@ -257,6 +257,7 @@ public: HANDLER(forecast_years_).report(out); HANDLER(format_).report(out); HANDLER(gain).report(out); + HANDLER(generated).report(out); HANDLER(group_by_).report(out); HANDLER(group_title_format_).report(out); HANDLER(head_).report(out); @@ -289,7 +290,6 @@ public: HANDLER(price).report(out); HANDLER(prices_format_).report(out); HANDLER(pricedb_format_).report(out); - HANDLER(print_virtual).report(out); HANDLER(quantity).report(out); HANDLER(quarterly).report(out); HANDLER(raw).report(out); @@ -599,6 +599,8 @@ public: " - get_at(total_expr, 1)"); }); + OPTION(report_t, generated); + OPTION__ (report_t, group_by_, expr_t expr; @@ -786,8 +788,6 @@ public: "P %(datetime) %(display_account) %(scrub(display_amount))\n"); }); - OPTION(report_t, print_virtual); - OPTION_(report_t, quantity, DO() { // -O parent->HANDLER(revalued).off(); parent->HANDLER(amount_).set_expr(string("--quantity"), "amount"); |