diff options
Diffstat (limited to 'microbe/expression.cpp')
-rw-r--r-- | microbe/expression.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/microbe/expression.cpp b/microbe/expression.cpp index 33fd514..33a70f2 100644 --- a/microbe/expression.cpp +++ b/microbe/expression.cpp @@ -27,7 +27,7 @@ #include <kdebug.h> #include <klocale.h> -#include <qregexp.h> +#include <tqregexp.h> Expression::Expression( PIC14 *pic, Microbe *master, SourceLine sourceLine, bool suppressNumberTooBig ) : m_sourceLine(sourceLine) @@ -98,9 +98,9 @@ void Expression::traverseTree( BTreeNode *root, bool conditionalRoot ) evaluateSecond = t.current()->left(); } - QString dest1 = mb->dest(); + TQString dest1 = mb->dest(); mb->incDest(); - QString dest2 = mb->dest(); + TQString dest2 = mb->dest(); mb->decDest(); bool evaluated = false; @@ -171,13 +171,13 @@ void Expression::traverseTree( BTreeNode *root, bool conditionalRoot ) void Expression::doOp( Operation op, BTreeNode *left, BTreeNode *right ) { - QString lvalue; + TQString lvalue; if(left->reg().isEmpty()) lvalue = left->value(); else lvalue = left->reg(); - QString rvalue; + TQString rvalue; if(right->reg().isEmpty()) rvalue = right->value(); else @@ -249,13 +249,13 @@ void Expression::doOp( Operation op, BTreeNode *left, BTreeNode *right ) } } -void Expression::buildTree( const QString & unstrippedExpression, BTreeBase *tree, BTreeNode *node, int level ) +void Expression::buildTree( const TQString & unstrippedExpression, BTreeBase *tree, BTreeNode *node, int level ) { int firstEnd = 0; int secondStart = 0; bool unary = false; Operation op; - QString expression = stripBrackets( unstrippedExpression ); + TQString expression = stripBrackets( unstrippedExpression ); switch(level) { // ==, != @@ -418,7 +418,7 @@ void Expression::buildTree( const QString & unstrippedExpression, BTreeBase *tre node->setChildOp(op); - QString tokens[2]; + TQString tokens[2]; tokens[0] = expression.left(firstEnd).stripWhiteSpace(); tokens[1] = expression.mid(secondStart).stripWhiteSpace(); @@ -462,7 +462,7 @@ void Expression::buildTree( const QString & unstrippedExpression, BTreeBase *tre void Expression::doUnaryOp(Operation op, BTreeNode *node) { /* Note that this isn't for unary operations as such, - rather for things that are operations that have no direct children, + rather for things that are operations that have no direct tqchildren, e.g. portx.n is high, and functionname(args)*/ if ( op == pin || op == notpin ) @@ -472,7 +472,7 @@ void Expression::doUnaryOp(Operation op, BTreeNode *node) m_pic->Skeypad( mb->variable( node->value() ) ); } -void Expression::compileExpression( const QString & expression ) +void Expression::compileExpression( const TQString & expression ) { // Make a tree to put the expression in. BTreeBase *tree = new BTreeBase(); @@ -491,14 +491,14 @@ void Expression::compileExpression( const QString & expression ) return; } -void Expression::compileConditional( const QString & expression, Code * ifCode, Code * elseCode ) +void Expression::compileConditional( const TQString & expression, Code * ifCode, Code * elseCode ) { - if( expression.contains(QRegExp("=>|=<|=!")) ) + if( expression.tqcontains(TQRegExp("=>|=<|=!")) ) { mistake( Microbe::InvalidComparison, expression ); return; } - if( expression.contains(QRegExp("[^=><!][=][^=]"))) + if( expression.tqcontains(TQRegExp("[^=><!][=][^=]"))) { mistake( Microbe::InvalidEquals ); return; @@ -568,12 +568,12 @@ bool Expression::isUnaryOp(Operation op) } -void Expression::mistake( Microbe::MistakeType type, const QString & context ) +void Expression::mistake( Microbe::MistakeType type, const TQString & context ) { mb->compileError( type, context, m_sourceLine ); } -int Expression::findSkipBrackets( const QString & expr, char ch, int startPos) +int Expression::findSkipBrackets( const TQString & expr, char ch, int startPos) { bool found = false; int i = startPos; @@ -611,7 +611,7 @@ int Expression::findSkipBrackets( const QString & expr, char ch, int startPos) return i; } -int Expression::findSkipBrackets( const QString & expr, QString phrase, int startPos) +int Expression::findSkipBrackets( const TQString & expr, TQString phrase, int startPos) { bool found = false; int i = startPos; @@ -649,7 +649,7 @@ int Expression::findSkipBrackets( const QString & expr, QString phrase, int star return i; } -QString Expression::stripBrackets( QString expression ) +TQString Expression::stripBrackets( TQString expression ) { bool stripping = true; int bracketLevel = 0; @@ -680,7 +680,7 @@ QString Expression::stripBrackets( QString expression ) return expression; } -void Expression::expressionValue( QString expr, BTreeBase */*tree*/, BTreeNode *node) +void Expression::expressionValue( TQString expr, BTreeBase */*tree*/, BTreeNode *node) { /* The "end of the line" for the expression parsing, the expression has been broken down into the fundamental elements of expr.value()=="to"|| @@ -711,12 +711,12 @@ void Expression::expressionValue( QString expr, BTreeBase */*tree*/, BTreeNode * { // If so, turn it into a number, and use the ASCII code as the value t = number; - expr = QString::number(expr[1].latin1()); + expr = TQString::number(expr[1].latin1()); } } // Check for the most common mistake ever! - if(expr.contains("=")) + if(expr.tqcontains("=")) mistake( Microbe::InvalidEquals ); // Check for reserved keywords if(expr=="to"||expr=="step"||expr=="then") @@ -726,7 +726,7 @@ void Expression::expressionValue( QString expr, BTreeBase */*tree*/, BTreeNode * // both indicating a Mistake. if(expr.isEmpty()) mistake( Microbe::ConsecutiveOperators ); - else if(expr.contains(QRegExp("\\s")) && t!= extpin) + else if(expr.tqcontains(TQRegExp("\\s")) && t!= extpin) mistake( Microbe::MissingOperator ); if( t == variable && !mb->isVariableKnown(expr) && !m_pic->isValidPort( expr ) && !m_pic->isValidTris( expr ) ) @@ -750,11 +750,11 @@ void Expression::expressionValue( QString expr, BTreeBase */*tree*/, BTreeNode * if( t == extpin ) { bool NOT; - int i = expr.find("is"); + int i = expr.tqfind("is"); if(i > 0) { - NOT = expr.contains("low"); - if(!expr.contains("high") && !expr.contains("low")) + NOT = expr.tqcontains("low"); + if(!expr.tqcontains("high") && !expr.tqcontains("low")) mistake( Microbe::HighLowExpected, expr ); expr = expr.left(i-1); } @@ -768,7 +768,7 @@ void Expression::expressionValue( QString expr, BTreeBase */*tree*/, BTreeNode * node->setValue(expr); } -ExprType Expression::expressionType( const QString & expression ) +ExprType Expression::expressionType( const TQString & expression ) { // So we can't handle complex expressions yet anyway, // let's just decide whether it is a variable or number. @@ -796,7 +796,7 @@ ExprType Expression::expressionType( const QString & expression ) if ( value != -1 ) return number; - if( expression.contains('.') ) + if( expression.tqcontains('.') ) return extpin; if ( mb->variable( expression ).type() == Variable::keypadType ) @@ -805,13 +805,13 @@ ExprType Expression::expressionType( const QString & expression ) return variable; } -QString Expression::processConstant( const QString & expr, bool * isConstant ) +TQString Expression::processConstant( const TQString & expr, bool * isConstant ) { bool temp; if (!isConstant) isConstant = &temp; - QString code; + TQString code; // Make a tree to put the expression in. BTreeBase *tree = new BTreeBase(); |