[muparser] Remove m_pParseFormula function pointer

This is a very strange design that determines whether initialization
needs to be performed by reassigning a function pointer. A misguided
optimization? Just check explicitly.
This commit is contained in:
ridiculousfish
2017-12-18 09:30:18 -08:00
parent 3ed9c851a3
commit 4452d9ce18
3 changed files with 17 additions and 23 deletions

View File

@@ -230,10 +230,13 @@ class ParserBase {
OptionalError CreateRPN() const;
ValueOrError ParseString() const;
ValueOrError ParseCmdCode() const;
ValueOrError ExecuteRPN() const;
ValueOrError InvokeFunction(generic_fun_type func, const value_type *args, int argCount) const;
/// Build the RPN if necessary, and then execute it.
/// \return the result, or an error.
ValueOrError BuildAndExecuteRPN() const;
OptionalError CheckName(const string_type &a_strName, const string_type &a_CharSet) const;
OptionalError CheckOprt(const string_type &a_sName, const ParserCallback &a_Callback,
const string_type &a_szCharSet) const;
@@ -245,7 +248,6 @@ class ParserBase {
Eval() calls the function whose address is stored there.
*/
mutable ParseFunction m_pParseFormula;
mutable ParserByteCode m_vRPN; ///< The Bytecode class.
mutable stringbuf_type
m_vStringBuf; ///< String buffer, used for storing string function arguments

View File

@@ -112,6 +112,7 @@ class ParserByteCode {
void clear();
std::size_t GetMaxStackSize() const;
std::size_t GetSize() const;
bool empty() const { return GetSize() == 0; }
const SToken *GetBase() const;
void AsciiDump();