diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-11 03:45:37 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-11 04:22:41 -0500 |
commit | dae24c259ba70cfdba92a5d66bc424eef5773188 (patch) | |
tree | 340a9b9dacc786ecdda0d1f2cd4cc974078daadd | |
parent | e8ea2d4938fcbb0988fd1e2021d97a519c67ffd8 (diff) | |
download | ledger-dae24c259ba70cfdba92a5d66bc424eef5773188.tar.gz ledger-dae24c259ba70cfdba92a5d66bc424eef5773188.tar.bz2 ledger-dae24c259ba70cfdba92a5d66bc424eef5773188.zip |
Added floor() value expression function
-rw-r--r-- | src/report.cc | 8 | ||||
-rw-r--r-- | src/report.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/report.cc b/src/report.cc index 4d1a9700..b866970f 100644 --- a/src/report.cc +++ b/src/report.cc @@ -207,6 +207,12 @@ value_t report_t::fn_quantity(call_scope_t& scope) return args.get<amount_t>(0).number(); } +value_t report_t::fn_floor(call_scope_t& scope) +{ + interactive_t args(scope, "v"); + return args.value_at(0).floored(); +} + value_t report_t::fn_abs(call_scope_t& scope) { interactive_t args(scope, "v"); @@ -735,6 +741,8 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind, case 'f': if (is_eq(p, "format_date")) return MAKE_FUNCTOR(report_t::fn_format_date); + else if (is_eq(p, "floor")) + return MAKE_FUNCTOR(report_t::fn_floor); break; case 'g': diff --git a/src/report.h b/src/report.h index 3afb0107..e27abbf9 100644 --- a/src/report.h +++ b/src/report.h @@ -143,6 +143,7 @@ public: value_t fn_rounded(call_scope_t& scope); value_t fn_unrounded(call_scope_t& scope); value_t fn_truncated(call_scope_t& scope); + value_t fn_floor(call_scope_t& scope); value_t fn_abs(call_scope_t& scope); value_t fn_justify(call_scope_t& scope); value_t fn_quoted(call_scope_t& scope); |