summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/session.cc19
-rw-r--r--src/session.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/src/session.cc b/src/session.cc
index 3e7cdb3d..7c546b82 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -268,6 +268,15 @@ value_t session_t::fn_max(call_scope_t& args)
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)
{
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);
break;
+ case 'i':
+ if (is_eq(p, "int"))
+ return MAKE_FUNCTOR(session_t::fn_int);
+ break;
+
case 'm':
if (is_eq(p, "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);
break;
+ case 's':
+ if (is_eq(p, "str"))
+ return MAKE_FUNCTOR(session_t::fn_str);
+ break;
+
default:
break;
}
diff --git a/src/session.h b/src/session.h
index cfeced39..b06c4a42 100644
--- a/src/session.h
+++ b/src/session.h
@@ -86,6 +86,8 @@ 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_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_date(call_scope_t& scope);
value_t fn_lot_tag(call_scope_t& scope);