diff options
author | 2017-01-26 19:55:37 +0100 | |
---|---|---|
committer | 2017-01-26 19:55:37 +0100 | |
commit | f603c763fe35a81bd3a7f41ab8a53c61c953e2cb (patch) | |
tree | 26b3659573426ea0111c3d5203b3eea78e508357 /src/lib/netlist/plib/pfunction.h | |
parent | 4e5f922341d962577d19a62ee4ed21c7de1fc8f0 (diff) | |
parent | 4ba1c0f2cad36dc23613e0dec24e7e439d3e80fd (diff) |
Merge branch 'master' of https://github.com/mamedev/mame
Diffstat (limited to 'src/lib/netlist/plib/pfunction.h')
-rw-r--r-- | src/lib/netlist/plib/pfunction.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/lib/netlist/plib/pfunction.h b/src/lib/netlist/plib/pfunction.h index 2ad32106569..0f4960d4e1c 100644 --- a/src/lib/netlist/plib/pfunction.h +++ b/src/lib/netlist/plib/pfunction.h @@ -16,10 +16,10 @@ namespace plib { //============================================================ - // function evaluation - reverse polish notation + // function evaluation //============================================================ - /*! Class providing support for precompiled rpn expressions + /*! Class providing support for evaluating expressions * */ class pfunction @@ -47,12 +47,26 @@ namespace plib { { } + /*! Compile an expression + * + * @param inputs Vector of input variables, e.g. {"A","B"} + * @param expr infix or postfix expression. default is infix, postrix + * to be prefixed with rpn, e.g. "rpn:A B + 1.3 /" + */ + void compile(const std::vector<pstring> &inputs, const pstring expr); + /*! Compile a rpn expression * * @param inputs Vector of input variables, e.g. {"A","B"} * @param expr Reverse polish notation expression, e.g. "A B + 1.3 /" */ void compile_postfix(const std::vector<pstring> &inputs, const pstring expr); + /*! Compile an infix expression + * + * @param inputs Vector of input variables, e.g. {"A","B"} + * @param expr Infix expression, e.g. "(A+B)/1.3" + */ + void compile_infix(const std::vector<pstring> &inputs, const pstring expr); /*! Evaluate the expression * * @param values for input variables, e.g. {1.1, 2.2} @@ -61,6 +75,10 @@ namespace plib { double evaluate(const std::vector<double> &values); private: + + void compile_postfix(const std::vector<pstring> &inputs, + const std::vector<pstring> &cmds, const pstring expr); + std::vector<rpn_inst> m_precompiled; //!< precompiled expression }; |