summaryrefslogtreecommitdiff
path: root/noncore/tools/calc2
Side-by-side diff
Diffstat (limited to 'noncore/tools/calc2') (more/less context) (show whitespace changes)
-rw-r--r--noncore/tools/calc2/engine.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/noncore/tools/calc2/engine.cpp b/noncore/tools/calc2/engine.cpp
index e843e29..74cd701 100644
--- a/noncore/tools/calc2/engine.cpp
+++ b/noncore/tools/calc2/engine.cpp
@@ -10,48 +10,55 @@
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "engine.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+
+/* QT */
#include <qstring.h>
-#include <math.h>
#include <qlcdnumber.h>
+/* STD */
+#include <math.h>
+
Data Engine::evalStack (Data num, bool inbrace = FALSE)
{
if (state != sError) {
Instruction *i;
// Pop the next op from the stack
while (!stack.isEmpty () && (braces || !inbrace)) {
i = stack.pop ();
// Check this ops prec vs next ops prec
if (!stack.isEmpty ())
if (i->precedence <= stack.top()->precedence)
i->acc = evalStack (i->acc, inbrace);
// Evaluate this instruction
num = i->eval (num);
// Error-check ( change this to work for all types )
if (isnan (num.dbl) || isinf (num.dbl)) {
- qDebug ("bad result from operation");
+ odebug << "bad result from operation" << oendl;
state = sError;
clearData(&num);
return num;
}
}
}
return num;
}
// Plugins call this to request the stack be evaluated
void Engine::eval ()
{
@@ -104,25 +111,25 @@ void Engine::pushValue (char v)
odebug << "pushValue() - num->string conversion" << oendl;
} else {
const QString constString = displayString;
emit(display(constString));
};
} else if (state == sStart) {
softReset();
displayString.truncate(0);
state = sAppend;
pushValue (v);
} else if (state == sError) {
- qDebug ("in error state");
+ odebug << "in error state" << oendl;
return;
}
}
void Engine::del ()
{
bool ok;
switch (currentRep) {
case rDouble:
displayString.truncate(displayString.length());
num.dbl=displayString.toDouble(&ok);
break;