diff options
author | John Wiegley <johnw@newartisans.com> | 2010-05-08 02:01:23 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-05-08 02:01:23 -0400 |
commit | 8acdb85a917d36a2b8468349d1fe82688d73fed9 (patch) | |
tree | 96fe50ac009ef7efcb9705e4236a889969ad9202 /src | |
parent | 2d28b34ff35f78ace6e95a652c30c02be7ef5a06 (diff) | |
download | fork-ledger-8acdb85a917d36a2b8468349d1fe82688d73fed9.tar.gz fork-ledger-8acdb85a917d36a2b8468349d1fe82688d73fed9.tar.bz2 fork-ledger-8acdb85a917d36a2b8468349d1fe82688d73fed9.zip |
Added a simple print() value expression function
This is really for debugging more than anything else.
Diffstat (limited to 'src')
-rw-r--r-- | src/report.cc | 16 | ||||
-rw-r--r-- | src/report.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/report.cc b/src/report.cc index 2189812b..1180c019 100644 --- a/src/report.cc +++ b/src/report.cc @@ -443,6 +443,20 @@ value_t report_t::fn_trim(call_scope_t& args) } } +value_t report_t::fn_print(call_scope_t& args) +{ + std::ostream& out(output_stream); + bool first = true; + for (call_scope_t::iterator i = args.begin(); i != args.end(); i++) { + if (first) + first = false; + else + out << ' '; + (*i).print(out); + } + return true; +} + value_t report_t::scrub(value_t val) { value_t temp(val.strip_annotations(what_to_keep())); @@ -1117,6 +1131,8 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind, return MAKE_FUNCTOR(report_t::fn_percent); else if (is_eq(p, "price")) return MAKE_FUNCTOR(report_t::fn_price); + else if (is_eq(p, "print")) + return MAKE_FUNCTOR(report_t::fn_print); break; case 'q': diff --git a/src/report.h b/src/report.h index 50071940..6b10dbcc 100644 --- a/src/report.h +++ b/src/report.h @@ -144,6 +144,7 @@ public: value_t fn_is_seq(call_scope_t& scope); value_t fn_strip(call_scope_t& scope); value_t fn_trim(call_scope_t& scope); + value_t fn_print(call_scope_t& scope); value_t scrub(value_t val); value_t fn_scrub(call_scope_t& scope); value_t fn_quantity(call_scope_t& scope); |