[muparser] Remove fun_type overloads that have four or more parameters

Supporting these is rather excessive.
This commit is contained in:
ridiculousfish 2017-12-18 02:00:16 -08:00
parent bb9e15675e
commit fdefabdb1d
6 changed files with 0 additions and 155 deletions

View file

@ -53,13 +53,6 @@ class ParserCallback final {
ParserCallback(fun_type2 a_pFun, int a_iPrec, EOprtAssociativity a_eAssociativity);
explicit ParserCallback(fun_type2 a_pFun);
explicit ParserCallback(fun_type3 a_pFun);
explicit ParserCallback(fun_type4 a_pFun);
explicit ParserCallback(fun_type5 a_pFun);
explicit ParserCallback(fun_type6 a_pFun);
explicit ParserCallback(fun_type7 a_pFun);
explicit ParserCallback(fun_type8 a_pFun);
explicit ParserCallback(fun_type9 a_pFun);
explicit ParserCallback(fun_type10 a_pFun);
explicit ParserCallback(multfun_type a_pFun);
explicit ParserCallback(strfun_type1 a_pFun);

View file

@ -416,32 +416,6 @@ typedef ValueOrError (*fun_type2)(value_type, value_type);
/** \brief Callback type used for functions with three arguments. */
typedef ValueOrError (*fun_type3)(value_type, value_type, value_type);
/** \brief Callback type used for functions with four arguments. */
typedef ValueOrError (*fun_type4)(value_type, value_type, value_type, value_type);
/** \brief Callback type used for functions with five arguments. */
typedef ValueOrError (*fun_type5)(value_type, value_type, value_type, value_type, value_type);
/** \brief Callback type used for functions with five arguments. */
typedef ValueOrError (*fun_type6)(value_type, value_type, value_type, value_type, value_type,
value_type);
/** \brief Callback type used for functions with five arguments. */
typedef ValueOrError (*fun_type7)(value_type, value_type, value_type, value_type, value_type,
value_type, value_type);
/** \brief Callback type used for functions with five arguments. */
typedef ValueOrError (*fun_type8)(value_type, value_type, value_type, value_type, value_type,
value_type, value_type, value_type);
/** \brief Callback type used for functions with five arguments. */
typedef ValueOrError (*fun_type9)(value_type, value_type, value_type, value_type, value_type,
value_type, value_type, value_type, value_type);
/** \brief Callback type used for functions with five arguments. */
typedef ValueOrError (*fun_type10)(value_type, value_type, value_type, value_type, value_type,
value_type, value_type, value_type, value_type, value_type);
/** \brief Callback type used for functions with a variable argument list. */
typedef ValueOrError (*multfun_type)(const value_type *, int);

View file

@ -59,27 +59,6 @@ class ParserTester // final
static ValueOrError f2of3(value_type, value_type v, value_type) { return v; };
static ValueOrError f3of3(value_type, value_type, value_type v) { return v; };
static ValueOrError f1of4(value_type v, value_type, value_type, value_type) { return v; }
static ValueOrError f2of4(value_type, value_type v, value_type, value_type) { return v; }
static ValueOrError f3of4(value_type, value_type, value_type v, value_type) { return v; }
static ValueOrError f4of4(value_type, value_type, value_type, value_type v) { return v; }
static ValueOrError f1of5(value_type v, value_type, value_type, value_type, value_type) {
return v;
}
static ValueOrError f2of5(value_type, value_type v, value_type, value_type, value_type) {
return v;
}
static ValueOrError f3of5(value_type, value_type, value_type v, value_type, value_type) {
return v;
}
static ValueOrError f4of5(value_type, value_type, value_type, value_type v, value_type) {
return v;
}
static ValueOrError f5of5(value_type, value_type, value_type, value_type, value_type v) {
return v;
}
static ValueOrError Min(value_type a_fVal1, value_type a_fVal2) {
return (a_fVal1 < a_fVal2) ? a_fVal1 : a_fVal2;
}

View file

@ -810,23 +810,6 @@ ValueOrError ParserBase::InvokeFunction(generic_fun_type func, const value_type
return ((fun_type2)func)(args[0], args[1]);
case 3:
return ((fun_type3)func)(args[0], args[1], args[2]);
case 4:
return ((fun_type4)func)(args[0], args[1], args[2], args[3]);
case 5:
return ((fun_type5)func)(args[0], args[1], args[2], args[3], args[4]);
case 6:
return ((fun_type6)func)(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7:
return ((fun_type7)func)(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
case 8:
return ((fun_type8)func)(args[0], args[1], args[2], args[3], args[4], args[5], args[6],
args[7]);
case 9:
return ((fun_type9)func)(args[0], args[1], args[2], args[3], args[4], args[5], args[6],
args[7], args[8]);
case 10:
return ((fun_type10)func)(args[0], args[1], args[2], args[3], args[4], args[5], args[6],
args[7], args[8], args[9]);
default:
// Unreachable.
assert(0 && "Internal error");

View file

@ -83,69 +83,6 @@ ParserCallback::ParserCallback(fun_type3 a_pFun)
m_iCode(cmFUNC),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(fun_type4 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(4),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(fun_type5 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(5),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(fun_type6 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(6),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(fun_type7 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(7),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(fun_type8 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(8),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(fun_type9 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(9),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(fun_type10 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(10),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(multfun_type a_pFun)
: m_pFun((void*)a_pFun),

View file

@ -455,15 +455,6 @@ int ParserTester::TestMultiArg() {
iStat += EqnTest(_T("f1of3(1, 2, 3)"), 1, true);
iStat += EqnTest(_T("f2of3(1, 2, 3)"), 2, true);
iStat += EqnTest(_T("f3of3(1, 2, 3)"), 3, true);
iStat += EqnTest(_T("f1of4(1, 2, 3, 4)"), 1, true);
iStat += EqnTest(_T("f2of4(1, 2, 3, 4)"), 2, true);
iStat += EqnTest(_T("f3of4(1, 2, 3, 4)"), 3, true);
iStat += EqnTest(_T("f4of4(1, 2, 3, 4)"), 4, true);
iStat += EqnTest(_T("f1of5(1, 2, 3, 4, 5)"), 1, true);
iStat += EqnTest(_T("f2of5(1, 2, 3, 4, 5)"), 2, true);
iStat += EqnTest(_T("f3of5(1, 2, 3, 4, 5)"), 3, true);
iStat += EqnTest(_T("f4of5(1, 2, 3, 4, 5)"), 4, true);
iStat += EqnTest(_T("f5of5(1, 2, 3, 4, 5)"), 5, true);
// Too few arguments / Too many arguments
iStat += EqnTest(_T("1+ping()"), 11, true);
iStat += EqnTest(_T("ping()+1"), 11, true);
@ -477,8 +468,6 @@ int ParserTester::TestMultiArg() {
iStat += EqnTest(_T("f1of2(1)"), 0, false);
iStat += EqnTest(_T("f1of3(1, 2, 3, 4)"), 0, false);
iStat += EqnTest(_T("f1of3(1)"), 0, false);
iStat += EqnTest(_T("f1of4(1, 2, 3, 4, 5)"), 0, false);
iStat += EqnTest(_T("f1of4(1)"), 0, false);
iStat += EqnTest(_T("(1,2,3)"), 0, false);
iStat += EqnTest(_T("1,2,3"), 0, false);
iStat += EqnTest(_T("(1*a,2,3)"), 0, false);
@ -613,7 +602,6 @@ int ParserTester::TestPostFix() {
iStat += EqnTest(_T("f1of1(1000){m}"), 1, true);
iStat += EqnTest(_T("-f1of1(1000){m}"), -1, true);
iStat += EqnTest(_T("-f1of1(-1000){m}"), 1, true);
iStat += EqnTest(_T("f4of4(0,0,0,1000){m}"), 1, true);
iStat += EqnTest(_T("2+(a*1000){m}"), 3, true);
// can postfix operators "m" und "meg" be told apart properly?
@ -1098,15 +1086,6 @@ int ParserTester::EqnTest(const string_type &a_str, double a_fRes, bool a_fPass)
throwIfError(p1->DefineFun(_T("f1of3"), f1of3)); // three parameter
throwIfError(p1->DefineFun(_T("f2of3"), f2of3));
throwIfError(p1->DefineFun(_T("f3of3"), f3of3));
throwIfError(p1->DefineFun(_T("f1of4"), f1of4)); // four parameter
throwIfError(p1->DefineFun(_T("f2of4"), f2of4));
throwIfError(p1->DefineFun(_T("f3of4"), f3of4));
throwIfError(p1->DefineFun(_T("f4of4"), f4of4));
throwIfError(p1->DefineFun(_T("f1of5"), f1of5)); // five parameter
throwIfError(p1->DefineFun(_T("f2of5"), f2of5));
throwIfError(p1->DefineFun(_T("f3of5"), f3of5));
throwIfError(p1->DefineFun(_T("f4of5"), f4of5));
throwIfError(p1->DefineFun(_T("f5of5"), f5of5));
// binary operators
throwIfError(p1->DefineOprt(_T("add"), add, 0));