From d4cf48613dd9b1338e174edbf4f47a7736bb2505 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 23 Jan 2009 22:02:15 +0000 Subject: Fixed a peculiar formula residue bug...eeew, formula residue. Also added a clear function to Bu::Stack --- src/formula.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/formula.h') diff --git a/src/formula.h b/src/formula.h index d1e77e3..20ffa5b 100644 --- a/src/formula.h +++ b/src/formula.h @@ -60,6 +60,14 @@ namespace Bu prec run( const Bu::FString &sFormulaSrc ) { + /* + if( !sOper.isEmpty() ) + printf("sOper.isEmpty() == false!\n"); + if( !sValue.isEmpty() ) + printf("sValue.isEmpty() == false!\n"); + if( !sFunc.isEmpty() ) + printf("sFunc.isEmpty() == false!\n"); + */ const char *sFormula = sFormulaSrc.getStr(); for(;;) { @@ -91,8 +99,11 @@ namespace Bu if( tOpr == symEOS ) { reduce(); - return sValue.top(); - break; + prec ret = sValue.top(); + sValue.clear(); + sFunc.clear(); + sOper.clear(); + return ret; } if( !sOper.isEmpty() && getPrec( sOper.top() ) > getPrec( tOpr ) ) { @@ -108,7 +119,11 @@ namespace Bu goto oppart; } } - return sValue.top(); + prec ret = sValue.top(); + sValue.clear(); + sFunc.clear(); + sOper.clear(); + return ret; } varHash hVars; -- cgit v1.2.3