Added int and str value expression functions
This commit is contained in:
parent
c62ceeef5a
commit
b0cf90ab50
2 changed files with 21 additions and 0 deletions
|
|
@ -268,6 +268,15 @@ value_t session_t::fn_max(call_scope_t& args)
|
||||||
return args[1] > args[0] ? args[1] : args[0];
|
return args[1] > args[0] ? args[1] : args[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
value_t session_t::fn_int(call_scope_t& args)
|
||||||
|
{
|
||||||
|
return args[0].to_long();
|
||||||
|
}
|
||||||
|
value_t session_t::fn_str(call_scope_t& args)
|
||||||
|
{
|
||||||
|
return string_value(args[0].to_string());
|
||||||
|
}
|
||||||
|
|
||||||
value_t session_t::fn_lot_price(call_scope_t& args)
|
value_t session_t::fn_lot_price(call_scope_t& args)
|
||||||
{
|
{
|
||||||
amount_t amt(args.get<amount_t>(1, false));
|
amount_t amt(args.get<amount_t>(1, false));
|
||||||
|
|
@ -360,6 +369,11 @@ expr_t::ptr_op_t session_t::lookup(const symbol_t::kind_t kind,
|
||||||
return MAKE_FUNCTOR(session_t::fn_lot_tag);
|
return MAKE_FUNCTOR(session_t::fn_lot_tag);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'i':
|
||||||
|
if (is_eq(p, "int"))
|
||||||
|
return MAKE_FUNCTOR(session_t::fn_int);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
if (is_eq(p, "min"))
|
if (is_eq(p, "min"))
|
||||||
return MAKE_FUNCTOR(session_t::fn_min);
|
return MAKE_FUNCTOR(session_t::fn_min);
|
||||||
|
|
@ -367,6 +381,11 @@ expr_t::ptr_op_t session_t::lookup(const symbol_t::kind_t kind,
|
||||||
return MAKE_FUNCTOR(session_t::fn_max);
|
return MAKE_FUNCTOR(session_t::fn_max);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 's':
|
||||||
|
if (is_eq(p, "str"))
|
||||||
|
return MAKE_FUNCTOR(session_t::fn_str);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,8 @@ public:
|
||||||
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_min(call_scope_t& scope);
|
||||||
value_t fn_max(call_scope_t& scope);
|
value_t fn_max(call_scope_t& scope);
|
||||||
|
value_t fn_int(call_scope_t& scope);
|
||||||
|
value_t fn_str(call_scope_t& scope);
|
||||||
value_t fn_lot_price(call_scope_t& scope);
|
value_t fn_lot_price(call_scope_t& scope);
|
||||||
value_t fn_lot_date(call_scope_t& scope);
|
value_t fn_lot_date(call_scope_t& scope);
|
||||||
value_t fn_lot_tag(call_scope_t& scope);
|
value_t fn_lot_tag(call_scope_t& scope);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue