summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/pfunction.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/plib/pfunction.h')
-rw-r--r--src/lib/netlist/plib/pfunction.h22
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
};