summaryrefslogtreecommitdiff
path: root/src/session.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-13 23:35:22 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-13 23:35:22 -0400
commit526cbc4c935fa71376a838ed25247e46a2b019dc (patch)
treec07532fcdd375990925b8153875475516073814e /src/session.cc
parent6bbfb86d75ca128fc7b79ad8f0e81d9e6482eda8 (diff)
downloadfork-ledger-526cbc4c935fa71376a838ed25247e46a2b019dc.tar.gz
fork-ledger-526cbc4c935fa71376a838ed25247e46a2b019dc.tar.bz2
fork-ledger-526cbc4c935fa71376a838ed25247e46a2b019dc.zip
Restored min() and max() virtual functions
Diffstat (limited to 'src/session.cc')
-rw-r--r--src/session.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/session.cc b/src/session.cc
index df6eaf7d..108a5f47 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -192,6 +192,16 @@ value_t session_t::fn_account(call_scope_t& args)
return NULL_VALUE;
}
+value_t session_t::fn_min(call_scope_t& args)
+{
+ return args[1] < args[0] ? args[1] : args[0];
+}
+
+value_t session_t::fn_max(call_scope_t& args)
+{
+ return args[1] > args[0] ? args[1] : args[0];
+}
+
option_t<session_t> * session_t::lookup_option(const char * p)
{
switch (*p) {
@@ -243,6 +253,14 @@ expr_t::ptr_op_t session_t::lookup(const symbol_t::kind_t kind,
if (is_eq(p, "account"))
return MAKE_FUNCTOR(session_t::fn_account);
break;
+
+ case 'm':
+ if (is_eq(p, "min"))
+ return MAKE_FUNCTOR(session_t::fn_min);
+ else if (is_eq(p, "max"))
+ return MAKE_FUNCTOR(session_t::fn_max);
+ break;
+
default:
break;
}