author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (unidiff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/tools/calc2 | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
-rw-r--r-- | noncore/tools/calc2/engine.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/noncore/tools/calc2/engine.cpp b/noncore/tools/calc2/engine.cpp index a9a47c4..e843e29 100644 --- a/noncore/tools/calc2/engine.cpp +++ b/noncore/tools/calc2/engine.cpp | |||
@@ -92,25 +92,25 @@ void Engine::pushValue (char v) | |||
92 | case rDouble: | 92 | case rDouble: |
93 | displayString.append(v); | 93 | displayString.append(v); |
94 | num.dbl=displayString.toDouble(&ok); | 94 | num.dbl=displayString.toDouble(&ok); |
95 | break; | 95 | break; |
96 | case rFraction: | 96 | case rFraction: |
97 | break; | 97 | break; |
98 | default: | 98 | default: |
99 | displayString.append(v); | 99 | displayString.append(v); |
100 | num.i=displayString.toInt(&ok, calcBase()); | 100 | num.i=displayString.toInt(&ok, calcBase()); |
101 | }; | 101 | }; |
102 | if (!ok) { | 102 | if (!ok) { |
103 | state = sError; | 103 | state = sError; |
104 | qDebug("pushValue() - num->string conversion"); | 104 | odebug << "pushValue() - num->string conversion" << oendl; |
105 | } else { | 105 | } else { |
106 | const QString constString = displayString; | 106 | const QString constString = displayString; |
107 | emit(display(constString)); | 107 | emit(display(constString)); |
108 | }; | 108 | }; |
109 | 109 | ||
110 | } else if (state == sStart) { | 110 | } else if (state == sStart) { |
111 | softReset(); | 111 | softReset(); |
112 | displayString.truncate(0); | 112 | displayString.truncate(0); |
113 | state = sAppend; | 113 | state = sAppend; |
114 | pushValue (v); | 114 | pushValue (v); |
115 | } else if (state == sError) { | 115 | } else if (state == sError) { |
116 | qDebug ("in error state"); | 116 | qDebug ("in error state"); |
@@ -118,70 +118,70 @@ void Engine::pushValue (char v) | |||
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | void Engine::del () | 121 | void Engine::del () |
122 | { | 122 | { |
123 | bool ok; | 123 | bool ok; |
124 | switch (currentRep) { | 124 | switch (currentRep) { |
125 | case rDouble: | 125 | case rDouble: |
126 | displayString.truncate(displayString.length()); | 126 | displayString.truncate(displayString.length()); |
127 | num.dbl=displayString.toDouble(&ok); | 127 | num.dbl=displayString.toDouble(&ok); |
128 | break; | 128 | break; |
129 | case rFraction: | 129 | case rFraction: |
130 | qDebug("not available"); | 130 | odebug << "not available" << oendl; |
131 | break; | 131 | break; |
132 | default: | 132 | default: |
133 | displayString.truncate(displayString.length()); | 133 | displayString.truncate(displayString.length()); |
134 | num.i = displayString.toInt(&ok, calcBase()); | 134 | num.i = displayString.toInt(&ok, calcBase()); |
135 | }; | 135 | }; |
136 | 136 | ||
137 | if (!ok) { | 137 | if (!ok) { |
138 | state = sError; | 138 | state = sError; |
139 | qDebug("del() - num->string conversion"); | 139 | odebug << "del() - num->string conversion" << oendl; |
140 | } else { | 140 | } else { |
141 | const QString constString = displayString; | 141 | const QString constString = displayString; |
142 | emit(display(constString)); | 142 | emit(display(constString)); |
143 | }; | 143 | }; |
144 | } | 144 | } |
145 | 145 | ||
146 | void Engine::displayData(Data d) { | 146 | void Engine::displayData(Data d) { |
147 | switch (currentRep) { | 147 | switch (currentRep) { |
148 | case rDouble: | 148 | case rDouble: |
149 | displayString.setNum(d.dbl); | 149 | displayString.setNum(d.dbl); |
150 | break; | 150 | break; |
151 | case rFraction: | 151 | case rFraction: |
152 | qDebug("fractional display not yet impl"); | 152 | odebug << "fractional display not yet impl" << oendl; |
153 | break; | 153 | break; |
154 | default: | 154 | default: |
155 | displayString.setNum(d.i, calcBase()); | 155 | displayString.setNum(d.i, calcBase()); |
156 | break; | 156 | break; |
157 | }; | 157 | }; |
158 | const QString constString= displayString; | 158 | const QString constString= displayString; |
159 | emit(display(constString)); | 159 | emit(display(constString)); |
160 | } | 160 | } |
161 | 161 | ||
162 | // Returns the base when Rep is an integer type | 162 | // Returns the base when Rep is an integer type |
163 | int Engine::calcBase () { | 163 | int Engine::calcBase () { |
164 | switch (currentRep) { | 164 | switch (currentRep) { |
165 | case rBin: | 165 | case rBin: |
166 | return 2; | 166 | return 2; |
167 | case rOct: | 167 | case rOct: |
168 | return 8; | 168 | return 8; |
169 | case rDec: | 169 | case rDec: |
170 | return 10; | 170 | return 10; |
171 | case rHex: | 171 | case rHex: |
172 | return 16; | 172 | return 16; |
173 | default: | 173 | default: |
174 | state = sError; | 174 | state = sError; |
175 | qDebug("Error - attempt to calc base for non-integer"); | 175 | odebug << "Error - attempt to calc base for non-integer" << oendl; |
176 | return 10; | 176 | return 10; |
177 | }; | 177 | }; |
178 | } | 178 | } |
179 | 179 | ||
180 | // Special instruction for internal use only | 180 | // Special instruction for internal use only |
181 | class iOpenBrace:public Instruction { | 181 | class iOpenBrace:public Instruction { |
182 | public: | 182 | public: |
183 | iOpenBrace (Engine *e):Instruction (100) {engine = e;}; | 183 | iOpenBrace (Engine *e):Instruction (100) {engine = e;}; |
184 | ~iOpenBrace () {}; | 184 | ~iOpenBrace () {}; |
185 | 185 | ||
186 | Data eval (Data num) { | 186 | Data eval (Data num) { |
187 | engine->decBraces(); | 187 | engine->decBraces(); |