From f4b191f0ea396b58465bfba40749977780a3af58 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 11 Feb 2009 05:29:41 +0000 Subject: Just removing some things that are cluttering up the source tree. --- src/old/formula.h | 77 ------------------------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 src/old/formula.h (limited to 'src/old/formula.h') diff --git a/src/old/formula.h b/src/old/formula.h deleted file mode 100644 index 939eb09..0000000 --- a/src/old/formula.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef FORMULA_H -#define FORMULA_H - -#include - -#include -#include -#include "sbuffer.h" - -#include "exceptionbase.h" -#include "hash.h" - -subExceptionDecl( ParseException ); - -/** - * Implements a very simple formula parser that allows use of variables and - * custom functions. This is based on a simple calculator-type parser that - * executes as it processes, accounting for operator precedence and grouping. - */ -class Formula -{ -public: - Formula(); - virtual ~Formula(); - - double run( char *sFormula ); - - typedef Hash varHash; - varHash hVars; - - typedef struct Func - { - double operator()( double x ) - { - return 0.0; - } - } Func; - - typedef Hash funcHash; - funcHash hFunc; - - typedef struct FuncSin : Func - { - double operator()( double x ) - { - return sin( x ); - } - } FuncSin; - -private: - enum - { - symEOS, - symAdd, - symSubtract, - symMultiply, - symDivide, - symOpenParen, - symCloseParen, - symNumber, - symVariable, - symExponent, - symModulus - }; - - typedef uint8_t symType; - - std::stack sOper; - std::stack sValue; - -private: - symType getPrec( symType nOper ); - symType nextToken( char **sBuf ); - void reduce( bool bCloseParen = false ); -}; - -#endif -- cgit v1.2.3