Added initial implementation of lot_*() functions
This commit is contained in:
parent
c2a77c1237
commit
47e91a8a92
2 changed files with 37 additions and 1 deletions
|
|
@ -194,12 +194,36 @@ 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];
|
||||
}
|
||||
|
||||
value_t session_t::fn_lot_price(call_scope_t& args)
|
||||
{
|
||||
amount_t amt(args.get<amount_t>(1, false));
|
||||
if (amt.has_annotation() && amt.annotation().price)
|
||||
return *amt.annotation().price;
|
||||
else
|
||||
return NULL_VALUE;
|
||||
}
|
||||
value_t session_t::fn_lot_date(call_scope_t& args)
|
||||
{
|
||||
amount_t amt(args.get<amount_t>(1, false));
|
||||
if (amt.has_annotation() && amt.annotation().date)
|
||||
return *amt.annotation().date;
|
||||
else
|
||||
return NULL_VALUE;
|
||||
}
|
||||
value_t session_t::fn_lot_tag(call_scope_t& args)
|
||||
{
|
||||
amount_t amt(args.get<amount_t>(1, false));
|
||||
if (amt.has_annotation() && amt.annotation().tag)
|
||||
return string_value(*amt.annotation().tag);
|
||||
else
|
||||
return NULL_VALUE;
|
||||
}
|
||||
|
||||
option_t<session_t> * session_t::lookup_option(const char * p)
|
||||
{
|
||||
switch (*p) {
|
||||
|
|
@ -252,6 +276,15 @@ expr_t::ptr_op_t session_t::lookup(const symbol_t::kind_t kind,
|
|||
return MAKE_FUNCTOR(session_t::fn_account);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
if (is_eq(p, "lot_price"))
|
||||
return MAKE_FUNCTOR(session_t::fn_lot_price);
|
||||
else if (is_eq(p, "lot_date"))
|
||||
return MAKE_FUNCTOR(session_t::fn_lot_date);
|
||||
else if (is_eq(p, "lot_tag"))
|
||||
return MAKE_FUNCTOR(session_t::fn_lot_tag);
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
if (is_eq(p, "min"))
|
||||
return MAKE_FUNCTOR(session_t::fn_min);
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ public:
|
|||
value_t fn_account(call_scope_t& scope);
|
||||
value_t fn_min(call_scope_t& scope);
|
||||
value_t fn_max(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_tag(call_scope_t& scope);
|
||||
|
||||
void report_options(std::ostream& out)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue