Restored min() and max() virtual functions
This commit is contained in:
parent
6bbfb86d75
commit
526cbc4c93
2 changed files with 20 additions and 0 deletions
|
|
@ -192,6 +192,16 @@ value_t session_t::fn_account(call_scope_t& args)
|
||||||
return NULL_VALUE;
|
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)
|
option_t<session_t> * session_t::lookup_option(const char * p)
|
||||||
{
|
{
|
||||||
switch (*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"))
|
if (is_eq(p, "account"))
|
||||||
return MAKE_FUNCTOR(session_t::fn_account);
|
return MAKE_FUNCTOR(session_t::fn_account);
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ public:
|
||||||
void close_journal_files();
|
void close_journal_files();
|
||||||
|
|
||||||
value_t fn_account(call_scope_t& scope);
|
value_t fn_account(call_scope_t& scope);
|
||||||
|
value_t fn_min(call_scope_t& scope);
|
||||||
|
value_t fn_max(call_scope_t& scope);
|
||||||
|
|
||||||
void report_options(std::ostream& out)
|
void report_options(std::ostream& out)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue