diff options
Diffstat (limited to 'src/formula.h')
-rw-r--r-- | src/formula.h | 21 |
1 files changed, 18 insertions, 3 deletions
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 | |||
60 | 60 | ||
61 | prec run( const Bu::FString &sFormulaSrc ) | 61 | prec run( const Bu::FString &sFormulaSrc ) |
62 | { | 62 | { |
63 | /* | ||
64 | if( !sOper.isEmpty() ) | ||
65 | printf("sOper.isEmpty() == false!\n"); | ||
66 | if( !sValue.isEmpty() ) | ||
67 | printf("sValue.isEmpty() == false!\n"); | ||
68 | if( !sFunc.isEmpty() ) | ||
69 | printf("sFunc.isEmpty() == false!\n"); | ||
70 | */ | ||
63 | const char *sFormula = sFormulaSrc.getStr(); | 71 | const char *sFormula = sFormulaSrc.getStr(); |
64 | for(;;) | 72 | for(;;) |
65 | { | 73 | { |
@@ -91,8 +99,11 @@ namespace Bu | |||
91 | if( tOpr == symEOS ) | 99 | if( tOpr == symEOS ) |
92 | { | 100 | { |
93 | reduce(); | 101 | reduce(); |
94 | return sValue.top(); | 102 | prec ret = sValue.top(); |
95 | break; | 103 | sValue.clear(); |
104 | sFunc.clear(); | ||
105 | sOper.clear(); | ||
106 | return ret; | ||
96 | } | 107 | } |
97 | if( !sOper.isEmpty() && getPrec( sOper.top() ) > getPrec( tOpr ) ) | 108 | if( !sOper.isEmpty() && getPrec( sOper.top() ) > getPrec( tOpr ) ) |
98 | { | 109 | { |
@@ -108,7 +119,11 @@ namespace Bu | |||
108 | goto oppart; | 119 | goto oppart; |
109 | } | 120 | } |
110 | } | 121 | } |
111 | return sValue.top(); | 122 | prec ret = sValue.top(); |
123 | sValue.clear(); | ||
124 | sFunc.clear(); | ||
125 | sOper.clear(); | ||
126 | return ret; | ||
112 | } | 127 | } |
113 | 128 | ||
114 | varHash hVars; | 129 | varHash hVars; |