Commit c4673f51 authored by Tobias WEBER's avatar Tobias WEBER
Browse files

added help function

parent 2104f96e
......@@ -83,6 +83,24 @@ std::shared_ptr<Symbol> Symbol::add(const Symbol &sym1, const Symbol &sym2)
arrNew.emplace_back(Symbol::add(*arr1[idx], *arr2[idx]));
return std::make_shared<SymbolList>(arrNew, false);
}
if(sym1.GetType()==SymbolType::REAL && sym2.GetType()==SymbolType::ARRAY)
{ // 1.23 + [1,2,3], point-wise addition
std::vector<std::shared_ptr<Symbol>> arrNew;
const auto& val = dynamic_cast<const SymbolReal&>(sym1);
const auto& arr = dynamic_cast<const SymbolList&>(sym2).GetValue();
for(std::size_t idx=0; idx<arr.size(); ++idx)
arrNew.emplace_back(Symbol::add(val, *arr[idx]));
return std::make_shared<SymbolList>(arrNew, false);
}
if(sym1.GetType()==SymbolType::ARRAY && sym2.GetType()==SymbolType::REAL)
{ // [1,2,3] + 1.23, point-wise addition
std::vector<std::shared_ptr<Symbol>> arrNew;
const auto& arr = dynamic_cast<const SymbolList&>(sym1).GetValue();
const auto& val = dynamic_cast<const SymbolReal&>(sym2);
for(std::size_t idx=0; idx<arr.size(); ++idx)
arrNew.emplace_back(Symbol::add(*arr[idx], val));
return std::make_shared<SymbolList>(arrNew, false);
}
else if(sym1.GetType()==SymbolType::STRING && sym2.GetType()==SymbolType::STRING)
{ // "abc" + "123"
return std::make_shared<SymbolString>(
......@@ -153,6 +171,15 @@ std::shared_ptr<Symbol> Symbol::sub(const Symbol &sym1, const Symbol &sym2)
arrNew.emplace_back(Symbol::sub(*arr1[idx], *arr2[idx]));
return std::make_shared<SymbolList>(arrNew, false);
}
if(sym1.GetType()==SymbolType::ARRAY && sym2.GetType()==SymbolType::REAL)
{ // [1,2,3] - 1.23, point-wise subtraction
std::vector<std::shared_ptr<Symbol>> arrNew;
const auto& arr = dynamic_cast<const SymbolList&>(sym1).GetValue();
const auto& val = dynamic_cast<const SymbolReal&>(sym2);
for(std::size_t idx=0; idx<arr.size(); ++idx)
arrNew.emplace_back(Symbol::sub(*arr[idx], val));
return std::make_shared<SymbolList>(arrNew, false);
}
else if(sym1.GetType()==SymbolType::DATASET && sym2.GetType()==SymbolType::DATASET)
{ // data1 - data2
return std::make_shared<SymbolDataset>(
......@@ -501,12 +528,12 @@ std::shared_ptr<Symbol> CliASTIdent::Eval(CliParserContext& ctx) const
else if(iter != workspace->end() && iterConst != g_consts_real.end())
{
ctx.PrintError("Identifier \"", m_val, "\" names both a constant and a workspace variable, using constant.");
return std::make_shared<SymbolReal>(iterConst->second);
return std::make_shared<SymbolReal>(std::get<0>(iterConst->second));
}
else if(iter != workspace->end())
return iter->second;
else if(iterConst != g_consts_real.end())
return std::make_shared<SymbolReal>(iterConst->second);
return std::make_shared<SymbolReal>(std::get<0>(iterConst->second));
return nullptr;
}
......@@ -703,23 +730,34 @@ std::shared_ptr<Symbol> CliASTCall::Eval(CliParserContext& ctx) const
}
}
if(args.size() == 1) // function call with one argument requested
if(args.size() == 0) // function call with no arguments requested
{
if(auto iter = g_funcs_gen_0args.find(ident); iter != g_funcs_gen_0args.end())
{
return (*std::get<0>(iter->second))();
}
else
{
ctx.PrintError("No suitable zero-argument function \"", ident, "\" was found.");
return nullptr;
}
}
else if(args.size() == 1) // function call with one argument requested
{
if(auto iter = g_funcs_gen_1arg.find(ident); iter != g_funcs_gen_1arg.end())
{ // general function
return (*iter->second)(args[0]);
return (*std::get<0>(iter->second))(args[0]);
}
else if(auto iter = g_funcs_real_1arg.find(ident);
iter != g_funcs_real_1arg.end() && args[0]->GetType() == SymbolType::REAL)
{ // real function
t_real funcval = (*iter->second)(dynamic_cast<SymbolReal&>(*args[0]).GetValue());
t_real funcval = (*std::get<0>(iter->second))(dynamic_cast<SymbolReal&>(*args[0]).GetValue());
return std::make_shared<SymbolReal>(funcval);
}
else if(auto iter = g_funcs_arr_1arg.find(ident);
iter != g_funcs_arr_1arg.end() && args[0]->GetType() == SymbolType::ARRAY)
{ // array function
return (*iter->second)(*reinterpret_cast<std::shared_ptr<SymbolList>*>(&args[0]));
return (*std::get<0>(iter->second))(*reinterpret_cast<std::shared_ptr<SymbolList>*>(&args[0]));
}
else
{
......@@ -731,7 +769,7 @@ std::shared_ptr<Symbol> CliASTCall::Eval(CliParserContext& ctx) const
{
if(auto iter = g_funcs_gen_2args.find(ident); iter != g_funcs_gen_2args.end())
{ // general function
return (*iter->second)(args[0], args[1]);
return (*std::get<0>(iter->second))(args[0], args[1]);
}
else if(auto iter = g_funcs_real_2args.find(ident);
iter != g_funcs_real_2args.end() &&
......@@ -739,14 +777,14 @@ std::shared_ptr<Symbol> CliASTCall::Eval(CliParserContext& ctx) const
{ // real function
t_real arg1 = dynamic_cast<SymbolReal&>(*args[0]).GetValue();
t_real arg2 = dynamic_cast<SymbolReal&>(*args[1]).GetValue();
t_real funcval = (*iter->second)(arg1, arg2);
t_real funcval = (*std::get<0>(iter->second))(arg1, arg2);
return std::make_shared<SymbolReal>(funcval);
}
else if(auto iter = g_funcs_arr_2args.find(ident);
iter != g_funcs_arr_2args.end()
&& args[0]->GetType() == SymbolType::ARRAY && args[1]->GetType() == SymbolType::ARRAY)
{ // array function
return (*iter->second)(*reinterpret_cast<std::shared_ptr<SymbolList>*>(&args[0]),
return (*std::get<0>(iter->second))(*reinterpret_cast<std::shared_ptr<SymbolList>*>(&args[0]),
*reinterpret_cast<std::shared_ptr<SymbolList>*>(&args[1]));
}
else
......
......@@ -6,6 +6,8 @@
*/
#include "funcs.h"
#include "tools/in20/globals.h"
#include <cmath>
......@@ -16,64 +18,64 @@ using t_real = t_real_cli;
/**
* map of real functions with one argument
*/
std::unordered_map<std::string, t_real_cli(*)(t_real)> g_funcs_real_1arg =
std::unordered_map<std::string, std::tuple<t_real_cli(*)(t_real), std::string>> g_funcs_real_1arg =
{
std::make_pair("sin", static_cast<t_real(*)(t_real)>(&std::sin)),
std::make_pair("cos", static_cast<t_real(*)(t_real)>(&std::cos)),
std::make_pair("tan", static_cast<t_real(*)(t_real)>(&std::tan)),
std::make_pair("asin", static_cast<t_real(*)(t_real)>(&std::asin)),
std::make_pair("acos", static_cast<t_real(*)(t_real)>(&std::acos)),
std::make_pair("atan", static_cast<t_real(*)(t_real)>(&std::atan)),
std::make_pair("sinh", static_cast<t_real(*)(t_real)>(&std::sinh)),
std::make_pair("cosh", static_cast<t_real(*)(t_real)>(&std::cosh)),
std::make_pair("tanh", static_cast<t_real(*)(t_real)>(&std::tanh)),
std::make_pair("asinh", static_cast<t_real(*)(t_real)>(&std::asinh)),
std::make_pair("acosh", static_cast<t_real(*)(t_real)>(&std::acosh)),
std::make_pair("atanh", static_cast<t_real(*)(t_real)>(&std::atanh)),
std::make_pair("sqrt", static_cast<t_real(*)(t_real)>(&std::sqrt)),
std::make_pair("cbrt", static_cast<t_real(*)(t_real)>(&std::cbrt)),
std::make_pair("log", static_cast<t_real(*)(t_real)>(&std::log)),
std::make_pair("log10", static_cast<t_real(*)(t_real)>(&std::log10)),
std::make_pair("log2", static_cast<t_real(*)(t_real)>(&std::log2)),
std::make_pair("exp", static_cast<t_real(*)(t_real)>(&std::exp)),
std::make_pair("exp2", static_cast<t_real(*)(t_real)>(&std::exp2)),
std::make_pair("abs", static_cast<t_real(*)(t_real)>(&std::abs)),
std::make_pair("round", static_cast<t_real(*)(t_real)>(&std::round)),
std::make_pair("nearbyint", static_cast<t_real(*)(t_real)>(&std::nearbyint)),
std::make_pair("trunc", static_cast<t_real(*)(t_real)>(&std::trunc)),
std::make_pair("ceil", static_cast<t_real(*)(t_real)>(&std::ceil)),
std::make_pair("floor", static_cast<t_real(*)(t_real)>(&std::floor)),
std::make_pair("erf", static_cast<t_real(*)(t_real)>(&std::erf)),
std::make_pair("erfc", static_cast<t_real(*)(t_real)>(&std::erfc)),
//std::make_pair("beta", static_cast<t_real(*)(t_real)>(&std::beta)),
std::make_pair("gamma", static_cast<t_real(*)(t_real)>(&std::tgamma)),
std::make_pair("loggamma", static_cast<t_real(*)(t_real)>(&std::lgamma)),
std::make_pair("sin", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::sin), "")),
std::make_pair("cos", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::cos), "")),
std::make_pair("tan", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::tan), "")),
std::make_pair("asin", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::asin), "")),
std::make_pair("acos", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::acos), "")),
std::make_pair("atan", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::atan), "")),
std::make_pair("sinh", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::sinh), "")),
std::make_pair("cosh", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::cosh), "")),
std::make_pair("tanh", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::tanh), "")),
std::make_pair("asinh", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::asinh), "")),
std::make_pair("acosh", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::acosh), "")),
std::make_pair("atanh", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::atanh), "")),
std::make_pair("sqrt", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::sqrt), "")),
std::make_pair("cbrt", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::cbrt), "")),
std::make_pair("log", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::log), "")),
std::make_pair("log10", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::log10), "")),
std::make_pair("log2", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::log2), "")),
std::make_pair("exp", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::exp), "")),
std::make_pair("exp2", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::exp2), "")),
std::make_pair("abs", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::abs), "")),
std::make_pair("round", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::round), "")),
std::make_pair("nearbyint", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::nearbyint), "")),
std::make_pair("trunc", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::trunc), "")),
std::make_pair("ceil", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::ceil), "")),
std::make_pair("floor", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::floor), "")),
std::make_pair("erf", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::erf), "")),
std::make_pair("erfc", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::erfc), "")),
//std::make_pair("beta", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::beta), "")),
std::make_pair("gamma", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::tgamma), "")),
std::make_pair("loggamma", std::make_tuple(static_cast<t_real(*)(t_real)>(&std::lgamma), "")),
};
/**
* map of real functions with two arguments
*/
std::unordered_map<std::string, t_real_cli(*)(t_real, t_real)> g_funcs_real_2args =
std::unordered_map<std::string, std::tuple<t_real_cli(*)(t_real, t_real), std::string>> g_funcs_real_2args =
{
std::make_pair("pow", static_cast<t_real(*)(t_real, t_real)>(&std::pow)),
std::make_pair("pow", std::make_tuple(static_cast<t_real(*)(t_real, t_real)>(&std::pow), "")),
std::make_pair("atan2", static_cast<t_real(*)(t_real, t_real)>(&std::atan2)),
std::make_pair("hypot", static_cast<t_real(*)(t_real, t_real)>(&std::hypot)),
std::make_pair("atan2", std::make_tuple(static_cast<t_real(*)(t_real, t_real)>(&std::atan2), "")),
std::make_pair("hypot", std::make_tuple(static_cast<t_real(*)(t_real, t_real)>(&std::hypot), "")),
std::make_pair("max", static_cast<t_real(*)(t_real, t_real)>(&std::fmax)),
std::make_pair("min", static_cast<t_real(*)(t_real, t_real)>(&std::fmin)),
//std::make_pair("diff", static_cast<t_real(*)(t_real, t_real)>(&std::fdim)),
std::make_pair("max", std::make_tuple(static_cast<t_real(*)(t_real, t_real)>(&std::fmax), "")),
std::make_pair("min", std::make_tuple(static_cast<t_real(*)(t_real, t_real)>(&std::fmin), "")),
//std::make_pair("diff", std::make_tuple(static_cast<t_real(*)(t_real, t_real)>(&std::fdim), "")),
std::make_pair("remainder", static_cast<t_real(*)(t_real, t_real)>(&std::remainder)),
std::make_pair("mod", static_cast<t_real(*)(t_real, t_real)>(&std::fmod)),
std::make_pair("remainder", std::make_tuple(static_cast<t_real(*)(t_real, t_real)>(&std::remainder), "")),
std::make_pair("mod", std::make_tuple(static_cast<t_real(*)(t_real, t_real)>(&std::fmod), "")),
std::make_pair("copysign", static_cast<t_real(*)(t_real, t_real)>(&std::copysign)),
std::make_pair("copysign", std::make_tuple(static_cast<t_real(*)(t_real, t_real)>(&std::copysign), "")),
};
// ----------------------------------------------------------------------------
......@@ -118,19 +120,154 @@ static std::shared_ptr<Symbol> func_sizeof(std::shared_ptr<Symbol> sym)
}
/**
* help
*/
std::shared_ptr<Symbol> func_help()
{
std::ostringstream ostr;
ostr << "<hr>IN20 data treatment tool version " << PROGRAM_VERSION << ".<br>\n";
ostr << "Written by Tobias Weber, tweber@ill.fr, 2018.<hr><br>\n";
ostr << "<table border=\"1\" width=\"75%\">\n";
ostr << "<caption><b>Real functions with one argument</b></caption>\n";
ostr << "<tr>" << "<th>" << "Function" << "</th>" << "<th>" << "Description" << "</th>" << "</tr>\n";
for(const auto& pair : g_funcs_real_1arg)
{
ostr << "<tr>";
ostr << "<td>" << pair.first << "</td>" << "<td>" << std::get<1>(pair.second) << "</td>\n";
ostr << "</tr>\n";
}
ostr << "</table>\n";
ostr << "<br>\n";
ostr << "<table border=\"1\" width=\"75%\">\n";
ostr << "<caption><b>Real functions with two arguments</b></caption>\n";
ostr << "<tr>" << "<th>" << "Function" << "</th>" << "<th>" << "Description" << "</th>" << "</tr>\n";
for(const auto& pair : g_funcs_real_2args)
{
ostr << "<tr>";
ostr << "<td>" << pair.first << "</td>" << "<td>" << std::get<1>(pair.second) << "</td>\n";
ostr << "</tr>\n";
}
ostr << "</table>\n";
ostr << "<br>\n";
ostr << "<table border=\"1\" width=\"75%\">\n";
ostr << "<caption><b>Array functions with one argument</b></caption>\n";
ostr << "<tr>" << "<th>" << "Function" << "</th>" << "<th>" << "Description" << "</th>" << "</tr>\n";
for(const auto& pair : g_funcs_arr_1arg)
{
ostr << "<tr>";
ostr << "<td>" << pair.first << "</td>" << "<td>" << std::get<1>(pair.second) << "</td>\n";
ostr << "</tr>\n";
}
ostr << "</table>\n";
ostr << "<br>\n";
ostr << "<table border=\"1\" width=\"75%\">\n";
ostr << "<caption><b>Array functions with two arguments</b></caption>\n";
ostr << "<tr>" << "<th>" << "Function" << "</th>" << "<th>" << "Description" << "</th>" << "</tr>\n";
for(const auto& pair : g_funcs_arr_2args)
{
ostr << "<tr>";
ostr << "<td>" << pair.first << "</td>" << "<td>" << std::get<1>(pair.second) << "</td>\n";
ostr << "</tr>\n";
}
ostr << "</table>\n";
ostr << "<br>\n";
ostr << "<table border=\"1\" width=\"75%\">\n";
ostr << "<caption><b>General functions with no arguments</b></caption>\n";
ostr << "<tr>" << "<th>" << "Function" << "</th>" << "<th>" << "Description" << "</th>" << "</tr>\n";
for(const auto& pair : g_funcs_gen_0args)
{
ostr << "<tr>";
ostr << "<td>" << pair.first << "</td>" << "<td>" << std::get<1>(pair.second) << "</td>\n";
ostr << "</tr>\n";
}
ostr << "</table>\n";
ostr << "<br>\n";
ostr << "<table border=\"1\" width=\"75%\">\n";
ostr << "<caption><b>General functions with one argument</b></caption>\n";
ostr << "<tr>" << "<th>" << "Function" << "</th>" << "<th>" << "Description" << "</th>" << "</tr>\n";
for(const auto& pair : g_funcs_gen_1arg)
{
ostr << "<tr>";
ostr << "<td>" << pair.first << "</td>" << "<td>" << std::get<1>(pair.second) << "</td>\n";
ostr << "</tr>\n";
}
ostr << "</table>\n";
ostr << "<br>\n";
ostr << "<table border=\"1\" width=\"75%\" >\n";
ostr << "<caption><b>General functions with two arguments</b></caption>\n";
ostr << "<tr>" << "<th>" << "Function" << "</th>" << "<th>" << "Description" << "</th>" << "</tr>\n";
for(const auto& pair : g_funcs_gen_2args)
{
ostr << "<tr>";
ostr << "<td>" << pair.first << "</td>" << "<td>" << std::get<1>(pair.second) << "</td>\n";
ostr << "</tr>\n";
}
ostr << "</table>\n";
ostr << "<br>\n";
ostr << "<table border=\"1\" width=\"75%\" >\n";
ostr << "<caption><b>Real constants</b></caption>\n";
ostr << "<tr>" << "<th>" << "Constant" << "</th>" << "<th>" << "Value" << "</th>" << "<th>" << "Description" << "</th>" << "</tr>\n";
for(const auto& pair : g_consts_real)
{
ostr << "<tr>";
ostr << "<td>" << pair.first << "</td>" << "<td>" << std::get<0>(pair.second) << "</td>" << "<td>" << std::get<1>(pair.second) << "</td>\n";
ostr << "</tr>\n";
}
ostr << "</table>\n";
ostr << "<br>\n";
return std::make_shared<SymbolString>(ostr.str());
}
/**
* map of general functions with zero arguments
*/
std::unordered_map<std::string, std::tuple<std::shared_ptr<Symbol>(*)(), std::string>> g_funcs_gen_0args =
{
std::make_pair("help", std::make_tuple(&func_help, "display help")),
};
/**
* map of general functions with one argument
*/
std::unordered_map<std::string, std::shared_ptr<Symbol>(*)(std::shared_ptr<Symbol>)> g_funcs_gen_1arg =
std::unordered_map<std::string, std::tuple<std::shared_ptr<Symbol>(*)(std::shared_ptr<Symbol>), std::string>> g_funcs_gen_1arg =
{
std::make_pair("typeof", &func_typeof),
std::make_pair("sizeof", &func_sizeof),
std::make_pair("typeof", std::make_tuple(&func_typeof, "return symbol type")),
std::make_pair("sizeof", std::make_tuple(&func_sizeof, "return symbol size")),
};
/**
* map of general functions with two arguments
*/
std::unordered_map<std::string, std::shared_ptr<Symbol>(*)(std::shared_ptr<Symbol>, std::shared_ptr<Symbol>)> g_funcs_gen_2args =
std::unordered_map<std::string, std::tuple<std::shared_ptr<Symbol>(*)(std::shared_ptr<Symbol>, std::shared_ptr<Symbol>), std::string>> g_funcs_gen_2args =
{
};
......@@ -148,7 +285,7 @@ std::shared_ptr<Symbol> func_dot(std::shared_ptr<SymbolList> sym1, std::shared_p
std::shared_ptr<Symbol> symDot = std::make_shared<SymbolReal>(0);
const auto& arr1 = sym1->GetValue();
const auto& arr2 = sym2->GetValue();
for(std::size_t idx=0; idx<(arr1.size(), arr2.size()); ++idx)
for(std::size_t idx=0; idx<std::min(arr1.size(), arr2.size()); ++idx)
symDot = Symbol::add(symDot, Symbol::mul(arr1[idx], arr2[idx]));
return symDot;
}
......@@ -191,18 +328,18 @@ std::shared_ptr<Symbol> func_norm(std::shared_ptr<SymbolList> sym)
/**
* map of general functions with one argument
*/
std::unordered_map<std::string, std::shared_ptr<Symbol>(*)(std::shared_ptr<SymbolList>)> g_funcs_arr_1arg =
std::unordered_map<std::string, std::tuple<std::shared_ptr<Symbol>(*)(std::shared_ptr<SymbolList>), std::string>> g_funcs_arr_1arg =
{
std::make_pair("norm", &func_norm),
std::make_pair("norm", std::make_tuple(&func_norm, "Euclidian norm")),
};
/**
* map of general functions with two arguments
*/
std::unordered_map<std::string, std::shared_ptr<Symbol>(*)(std::shared_ptr<SymbolList>, std::shared_ptr<SymbolList>)> g_funcs_arr_2args =
std::unordered_map<std::string, std::tuple<std::shared_ptr<Symbol>(*)(std::shared_ptr<SymbolList>, std::shared_ptr<SymbolList>), std::string>> g_funcs_arr_2args =
{
std::make_pair("dot", &func_dot),
std::make_pair("cross", &func_cross),
std::make_pair("dot", std::make_tuple(&func_dot, "inner product")),
std::make_pair("cross", std::make_tuple(&func_cross, "cross product")),
};
// ----------------------------------------------------------------------------
......@@ -213,8 +350,8 @@ std::unordered_map<std::string, std::shared_ptr<Symbol>(*)(std::shared_ptr<Symbo
/**
* map of real constants
*/
std::unordered_map<std::string, t_real_cli> g_consts_real
std::unordered_map<std::string, std::tuple<t_real_cli, std::string>> g_consts_real
{
std::make_pair("pi", t_real(M_PI)),
std::make_pair("pi", std::make_tuple(t_real(M_PI), "pi")),
};
// ----------------------------------------------------------------------------
......@@ -9,6 +9,7 @@
#define __FUNCS_H__
#include <unordered_map>
#include <tuple>
#include <string>
#include <memory>
......@@ -17,19 +18,20 @@
// real functions
extern std::unordered_map<std::string, t_real_cli(*)(t_real_cli)> g_funcs_real_1arg;
extern std::unordered_map<std::string, t_real_cli(*)(t_real_cli, t_real_cli)> g_funcs_real_2args;
extern std::unordered_map<std::string, std::tuple<t_real_cli(*)(t_real_cli), std::string>> g_funcs_real_1arg;
extern std::unordered_map<std::string, std::tuple<t_real_cli(*)(t_real_cli, t_real_cli), std::string>> g_funcs_real_2args;
// array functions
extern std::unordered_map<std::string, std::shared_ptr<Symbol>(*)(std::shared_ptr<SymbolList>)> g_funcs_arr_1arg;
extern std::unordered_map<std::string, std::shared_ptr<Symbol>(*)(std::shared_ptr<SymbolList>, std::shared_ptr<SymbolList>)> g_funcs_arr_2args;
extern std::unordered_map<std::string, std::tuple<std::shared_ptr<Symbol>(*)(std::shared_ptr<SymbolList>), std::string>> g_funcs_arr_1arg;
extern std::unordered_map<std::string, std::tuple<std::shared_ptr<Symbol>(*)(std::shared_ptr<SymbolList>, std::shared_ptr<SymbolList>), std::string>> g_funcs_arr_2args;
// general functions
extern std::unordered_map<std::string, std::shared_ptr<Symbol>(*)(std::shared_ptr<Symbol>)> g_funcs_gen_1arg;
extern std::unordered_map<std::string, std::shared_ptr<Symbol>(*)(std::shared_ptr<Symbol>, std::shared_ptr<Symbol>)> g_funcs_gen_2args;
extern std::unordered_map<std::string, std::tuple<std::shared_ptr<Symbol>(*)(), std::string>> g_funcs_gen_0args;
extern std::unordered_map<std::string, std::tuple<std::shared_ptr<Symbol>(*)(std::shared_ptr<Symbol>), std::string>> g_funcs_gen_1arg;
extern std::unordered_map<std::string, std::tuple<std::shared_ptr<Symbol>(*)(std::shared_ptr<Symbol>, std::shared_ptr<Symbol>), std::string>> g_funcs_gen_2args;
// constants
extern std::unordered_map<std::string, t_real_cli> g_consts_real;
extern std::unordered_map<std::string, std::tuple<t_real_cli, std::string>> g_consts_real;
......
......@@ -61,7 +61,7 @@ void CommandLineWidget::CommandEntered()
m_pEditCLI->clearEditText();
if(!cmd.length()) return;
m_pEditHistory->insertHtml("<font color=\"#0000ff\"><b>> </b>" + cmd + "</font><br>");
m_pEditHistory->insertHtml("<font color=\"#0000ff\">" + cmd + "</font><br>");
// parse command
......
......@@ -10,6 +10,8 @@
#include "command.h"
#define PROGRAM_VERSION "0.0.1"
// the GUI's command line widget
extern CommandLine *g_pCLI;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment