diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
commit | 87a016680e3677da3993f333561e79eb0cead7d5 (patch) | |
tree | cbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /microbe | |
parent | 6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff) | |
download | ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.tar.gz ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.zip |
TQt4 port ktechlab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1238801 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'microbe')
-rw-r--r-- | microbe/btreebase.cpp | 26 | ||||
-rw-r--r-- | microbe/btreebase.h | 6 | ||||
-rw-r--r-- | microbe/btreenode.cpp | 2 | ||||
-rw-r--r-- | microbe/btreenode.h | 24 | ||||
-rw-r--r-- | microbe/expression.cpp | 56 | ||||
-rw-r--r-- | microbe/expression.h | 24 | ||||
-rw-r--r-- | microbe/instruction.cpp | 194 | ||||
-rw-r--r-- | microbe/instruction.h | 144 | ||||
-rw-r--r-- | microbe/main.cpp | 6 | ||||
-rw-r--r-- | microbe/microbe.cpp | 86 | ||||
-rw-r--r-- | microbe/microbe.h | 62 | ||||
-rw-r--r-- | microbe/optimizer.cpp | 24 | ||||
-rw-r--r-- | microbe/optimizer.h | 4 | ||||
-rw-r--r-- | microbe/parser.cpp | 112 | ||||
-rw-r--r-- | microbe/parser.h | 54 | ||||
-rw-r--r-- | microbe/pic14.cpp | 180 | ||||
-rw-r--r-- | microbe/pic14.h | 94 | ||||
-rw-r--r-- | microbe/traverser.cpp | 18 | ||||
-rw-r--r-- | microbe/traverser.h | 6 | ||||
-rw-r--r-- | microbe/variable.cpp | 2 | ||||
-rw-r--r-- | microbe/variable.h | 14 |
21 files changed, 569 insertions, 569 deletions
diff --git a/microbe/btreebase.cpp b/microbe/btreebase.cpp index bd9e38a..7117b26 100644 --- a/microbe/btreebase.cpp +++ b/microbe/btreebase.cpp @@ -41,14 +41,14 @@ BTreeBase::~BTreeBase() } -void BTreeBase::addNode(BTreeNode *parent, BTreeNode *node, bool left) +void BTreeBase::addNode(BTreeNode *tqparent, BTreeNode *node, bool left) { // Debugging lines, remove when expression parsing has been completed. - //if(!parent) cerr<<"Null parent pointer!\n"; + //if(!tqparent) cerr<<"Null tqparent pointer!\n"; //if(!node) cerr<<"Null node pointer!\n"); - if(left) parent->setLeft(node); - else parent->setRight(node); + if(left) tqparent->setLeft(node); + else tqparent->setRight(node); } void BTreeBase::pruneTree(BTreeNode *root, bool /*conditionalRoot*/) @@ -60,7 +60,7 @@ void BTreeBase::pruneTree(BTreeNode *root, bool /*conditionalRoot*/) while(!done) { //t.descendLeftwardToTerminal(); - if( t.current()->parent() ) + if( t.current()->tqparent() ) { if( t.oppositeNode()->hasChildren() ) pruneTree(t.oppositeNode()); } @@ -69,7 +69,7 @@ void BTreeBase::pruneTree(BTreeNode *root, bool /*conditionalRoot*/) if( !t.current()->hasChildren() ) { //if(t.current() == t.root()) done = true; - if(!t.current()->parent()) done = true; + if(!t.current()->tqparent()) done = true; continue; } @@ -88,7 +88,7 @@ void BTreeBase::pruneTree(BTreeNode *root, bool /*conditionalRoot*/) t.current()->setChildOp(Expression::divbyzero); return; } - QString value = QString::number(Parser::doArithmetic(l->value().toInt(),r->value().toInt(),t.current()->childOp())); + TQString value = TQString::number(Parser::doArithmetic(l->value().toInt(),r->value().toInt(),t.current()->childOp())); t.current()->deleteChildren(); t.current()->setChildOp(Expression::noop); t.current()->setType(number); @@ -155,7 +155,7 @@ void BTreeBase::pruneTree(BTreeNode *root, bool /*conditionalRoot*/) { // since we can't call compileError from in this class, we have a special way of handling it: - // Leave the children as they are, and set childOp to divbyzero + // Leave the tqchildren as they are, and set childOp to divbyzero if( t.current()->childOp() == Expression::division ) { t.current()->setChildOp(Expression::divbyzero); @@ -204,7 +204,7 @@ void BTreeBase::pruneTree(BTreeNode *root, bool /*conditionalRoot*/) if(zero) { BTreeNode *p = t.current(); - QString value; + TQString value; if( p->childOp() == Expression::bwand ) { value = "0"; @@ -226,7 +226,7 @@ void BTreeBase::pruneTree(BTreeNode *root, bool /*conditionalRoot*/) } } - if(!t.current()->parent() || t.current() == root) done = true; + if(!t.current()->tqparent() || t.current() == root) done = true; else { @@ -237,12 +237,12 @@ void BTreeBase::pruneTree(BTreeNode *root, bool /*conditionalRoot*/) void BTreeBase::replaceNode(BTreeNode *node, BTreeNode *replacement) { // (This works under the assumption that a node is not linked to two places at once). - if( !node->parent() ) + if( !node->tqparent() ) { setRoot(replacement); replacement->setParent(0L); return; } - if( node->parent()->left() == node ) node->parent()->setLeft(replacement); - if( node->parent()->right() == node ) node->parent()->setRight(replacement); + if( node->tqparent()->left() == node ) node->tqparent()->setLeft(replacement); + if( node->tqparent()->right() == node ) node->tqparent()->setRight(replacement); } diff --git a/microbe/btreebase.h b/microbe/btreebase.h index d8d1040..8b9d6f0 100644 --- a/microbe/btreebase.h +++ b/microbe/btreebase.h @@ -38,10 +38,10 @@ public: void setRoot(BTreeNode *root){m_root = root; } /** Link the node into the tree. a.t.m all this really - does it sets the parent/child relationship pointers, + does it sets the tqparent/child relationship pointers, but is used in case something needs to be changed in the future Added to the left if left == true or the right if left == false */ - void addNode(BTreeNode *parent, BTreeNode *node, bool left); + void addNode(BTreeNode *tqparent, BTreeNode *node, bool left); /** Deletes all nodes in tree and zeros pointer to root node */ void deleteTree(); @@ -49,7 +49,7 @@ public: /** Tidies the tree up; merging constants and removing redundant branches */ void pruneTree(BTreeNode *root, bool conditionalRoot = true); - /** Put a node in place of another, linking it correctly into the parent. */ + /** Put a node in place of another, linking it correctly into the tqparent. */ void replaceNode(BTreeNode *node, BTreeNode *replacement); protected: diff --git a/microbe/btreenode.cpp b/microbe/btreenode.cpp index 27d49cc..063dce2 100644 --- a/microbe/btreenode.cpp +++ b/microbe/btreenode.cpp @@ -38,7 +38,7 @@ BTreeNode::BTreeNode(BTreeNode *p, BTreeNode *l, BTreeNode *r) BTreeNode::~BTreeNode() { - // Must not delete children as might be unlinking!!! deleteChildren(); + // Must not delete tqchildren as might be unlinking!!! deleteChildren(); } void BTreeNode::deleteChildren() diff --git a/microbe/btreenode.h b/microbe/btreenode.h index 7f5fdfb..2594d0c 100644 --- a/microbe/btreenode.h +++ b/microbe/btreenode.h @@ -24,8 +24,8 @@ #include "btreebase.h" #include "expression.h" -#include <qstring.h> -#include <qptrlist.h> +#include <tqstring.h> +#include <tqptrlist.h> /** A node points to the two child nodes (left and right), and contains the binary @@ -46,13 +46,13 @@ class BTreeNode */ // void printTree(); /** - * Recursively delete all children of a node. + * Recursively delete all tqchildren of a node. */ void deleteChildren(); /** - * @return the parent node. + * @return the tqparent node. */ - BTreeNode *parent() const { return m_parent; } + BTreeNode *tqparent() const { return m_parent; } /** * @return the left child node. */ @@ -61,7 +61,7 @@ class BTreeNode * @return the right child node. */ BTreeNode *right() const { return m_right; } - void setParent(BTreeNode *parent) { m_parent = parent; } + void setParent(BTreeNode *tqparent) { m_parent = tqparent; } /** * Set the child node on the left to the one give, and reparents it to * this node. @@ -79,14 +79,14 @@ class BTreeNode ExprType type() const {return m_type;} void setType(ExprType type) { m_type = type; } - QString value() const {return m_value;} - void setValue( const QString & value ) { m_value = value; } + TQString value() const {return m_value;} + void setValue( const TQString & value ) { m_value = value; } Expression::Operation childOp() const {return m_childOp;} void setChildOp(Expression::Operation op){ m_childOp = op;} - void setReg( const QString & r ){ m_reg = r; } - QString reg() const {return m_reg;} + void setReg( const TQString & r ){ m_reg = r; } + TQString reg() const {return m_reg;} bool needsEvaluating() const { return hasChildren(); } @@ -96,10 +96,10 @@ class BTreeNode BTreeNode *m_right; /** This is used to remember what working register contains the value of the node during assembly.*/ - QString m_reg; + TQString m_reg; ExprType m_type; - QString m_value; + TQString m_value; Expression::Operation m_childOp; }; 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(); diff --git a/microbe/expression.h b/microbe/expression.h index 9607f16..1e34bb8 100644 --- a/microbe/expression.h +++ b/microbe/expression.h @@ -23,7 +23,7 @@ #include "microbe.h" -#include <qstring.h> +#include <tqstring.h> class PIC14; class BTreeNode; @@ -69,13 +69,13 @@ class Expression * is generated from the expression string; then that tree is traversed * to generate the assembly. */ - void compileExpression( const QString & expression); - void compileConditional( const QString & expression, Code * ifCode, Code * elseCode ); + void compileExpression( const TQString & expression); + void compileConditional( const TQString & expression, Code * ifCode, Code * elseCode ); /** * Returns a *number* rather than evaluating code, and sets isConstant to true * if it the expression evaluated to a constant. */ - QString processConstant( const QString & expr, bool * isConsant ); + TQString processConstant( const TQString & expr, bool * isConsant ); private: PIC14 *m_pic; @@ -86,20 +86,20 @@ class Expression bool isUnaryOp(Operation op); - void expressionValue( QString expression, BTreeBase *tree, BTreeNode *node ); + void expressionValue( TQString expression, BTreeBase *tree, BTreeNode *node ); void doOp( Operation op, BTreeNode *left, BTreeNode *right ); void doUnaryOp( Operation op, BTreeNode *node ); /** * Parses an expression, and generates a tree structure from it. */ - void buildTree( const QString & expression, BTreeBase *tree, BTreeNode *node, int level ); + void buildTree( const TQString & expression, BTreeBase *tree, BTreeNode *node, int level ); - static int findSkipBrackets( const QString & expr, char ch, int startPos = 0); - static int findSkipBrackets( const QString & expr, QString phrase, int startPos = 0); + static int findSkipBrackets( const TQString & expr, char ch, int startPos = 0); + static int findSkipBrackets( const TQString & expr, TQString phrase, int startPos = 0); - QString stripBrackets( QString expression ); + TQString stripBrackets( TQString expression ); - void mistake( Microbe::MistakeType type, const QString & context = 0 ); + void mistake( Microbe::MistakeType type, const TQString & context = 0 ); SourceLine m_sourceLine; @@ -113,8 +113,8 @@ class Expression * 2 = expression that needs evaluating * (maybe not, see enum). */ - ExprType expressionType( const QString & expression ); - static bool isLiteral( const QString &text ); + ExprType expressionType( const TQString & expression ); + static bool isLiteral( const TQString &text ); /** * Normally, only allow numbers upto 255; but for some uses where the * number is not going to be placed in a PIC register (such as when diff --git a/microbe/instruction.cpp b/microbe/instruction.cpp index b2b02b4..b05423c 100644 --- a/microbe/instruction.cpp +++ b/microbe/instruction.cpp @@ -23,7 +23,7 @@ #include "pic14.h" #include <kdebug.h> -#include <qstringlist.h> +#include <tqstringlist.h> #include <assert.h> #include <iostream> @@ -92,10 +92,10 @@ Register::Register( Type type ) } -Register::Register( const QString & name ) +Register::Register( const TQString & name ) { m_name = name.stripWhiteSpace(); - QString upper = m_name.upper(); + TQString upper = m_name.upper(); if ( upper == "TMR0" ) m_type = TMR0; @@ -134,7 +134,7 @@ Register::Register( const QString & name ) Register::Register( const char * name ) { - *this = Register( QString(name) ); + *this = Register( TQString(name) ); } @@ -310,7 +310,7 @@ RegisterBit::RegisterBit( uchar bitPos, Register::Type reg ) } -RegisterBit::RegisterBit( const QString & name ) +RegisterBit::RegisterBit( const TQString & name ) { m_name = name.upper().stripWhiteSpace(); initFromName(); @@ -319,7 +319,7 @@ RegisterBit::RegisterBit( const QString & name ) RegisterBit::RegisterBit( const char * name ) { - m_name = QString(name).upper().stripWhiteSpace(); + m_name = TQString(name).upper().stripWhiteSpace(); initFromName(); } @@ -780,7 +780,7 @@ uchar & RegisterDepends::reg( const Register & reg ) return status; // If we don't already have the register, we need to reset it first - if ( !m_registers.contains( reg.name() ) ) + if ( !m_registers.tqcontains( reg.name() ) ) m_registers[ reg ] = 0xff; return m_registers[ reg ]; @@ -806,7 +806,7 @@ void Code::merge( Code * code, InstructionPosition middleInsertionPosition ) if ( !code ) return; - // Reparent instructions + // Retqparent instructions for ( unsigned i = 0; i < PositionCount; ++i ) { InstructionList * list = code->instructionList( (InstructionPosition)i ); @@ -820,7 +820,7 @@ void Code::merge( Code * code, InstructionPosition middleInsertionPosition ) } -void Code::queueLabel( const QString & label, InstructionPosition position ) +void Code::queueLabel( const TQString & label, InstructionPosition position ) { // cout << k_funcinfo << "label="<<label<<" position="<<position<<'\n'; m_queuedLabels[ position ] << label; @@ -856,7 +856,7 @@ void Code::removeInstruction( Instruction * instruction ) iterator next = ++iterator(i); - QStringList labels = instruction->labels(); + TQStringList labels = instruction->labels(); i.list->remove( i.it ); if ( previous != e ) @@ -898,14 +898,14 @@ void Code::append( Instruction * instruction, InstructionPosition position ) } -Instruction * Code::instruction( const QString & label ) const +Instruction * Code::instruction( const TQString & label ) const { for ( unsigned i = 0; i < PositionCount; ++i ) { InstructionList::const_iterator end = m_instructionLists[i].end(); for ( InstructionList::const_iterator it = m_instructionLists[i].begin(); it != end; ++it ) { - if ( (*it)->labels().contains( label ) ) + if ( (*it)->labels().tqcontains( label ) ) return *it; } } @@ -913,7 +913,7 @@ Instruction * Code::instruction( const QString & label ) const } -Code::iterator Code::find( Instruction * instruction ) +Code::iterator Code::tqfind( Instruction * instruction ) { iterator e = end(); iterator i = begin(); @@ -934,7 +934,7 @@ void Code::postCompileConstruct() if ( m_queuedLabels[i].isEmpty() ) continue; - QStringList labels = m_queuedLabels[i]; + TQStringList labels = m_queuedLabels[i]; m_queuedLabels[i].clear(); // Find an instruction to dump them onto @@ -960,25 +960,25 @@ void Code::postCompileConstruct() } -QString Code::generateCode( PIC14 * pic ) const +TQString Code::generateCode( PIC14 * pic ) const { - QString code; + TQString code; - const QStringList variables = findVariables(); + const TQStringList variables = findVariables(); if ( !variables.isEmpty() ) { code += "; Variables\n"; uchar reg = pic->gprStart(); - QStringList::const_iterator end = variables.end(); - for ( QStringList::const_iterator it = variables.begin(); it != end; ++it ) - code += QString("%1\tequ\t0x%2\n").arg( *it ).arg( QString::number( reg++, 16 ) ); + TQStringList::const_iterator end = variables.end(); + for ( TQStringList::const_iterator it = variables.begin(); it != end; ++it ) + code += TQString("%1\tequ\t0x%2\n").tqarg( *it ).tqarg( TQString::number( reg++, 16 ) ); code += "\n"; } - QString picString = pic->minimalTypeString(); - code += QString("list p=%1\n").arg( picString ); - code += QString("include \"p%2.inc\"\n\n").arg( picString.lower() ); + TQString picString = pic->minimalTypeString(); + code += TQString("list p=%1\n").tqarg( picString ); + code += TQString("include \"p%2.inc\"\n\n").tqarg( picString.lower() ); code += "; Config options\n"; code += " __config _WDT_OFF\n\n"; @@ -990,12 +990,12 @@ QString Code::generateCode( PIC14 * pic ) const InstructionList::const_iterator end = m_instructionLists[i].end(); for ( InstructionList::const_iterator it = m_instructionLists[i].begin(); it != end; ++it ) { - const QStringList labels = (*it)->labels(); + const TQStringList labels = (*it)->labels(); if ( !labels.isEmpty() ) { code += '\n'; - QStringList::const_iterator labelsEnd = labels.end(); - for ( QStringList::const_iterator labelsIt = labels.begin(); labelsIt != labelsEnd; ++labelsIt ) + TQStringList::const_iterator labelsEnd = labels.end(); + for ( TQStringList::const_iterator labelsIt = labels.begin(); labelsIt != labelsEnd; ++labelsIt ) code += *labelsIt + '\n'; } @@ -1009,9 +1009,9 @@ QString Code::generateCode( PIC14 * pic ) const } -QStringList Code::findVariables() const +TQStringList Code::findVariables() const { - QStringList variables; + TQStringList variables; const_iterator e = end(); for ( const_iterator i = begin(); i != e; ++i ) @@ -1019,8 +1019,8 @@ QStringList Code::findVariables() const if ( (*i)->file().type() != Register::GPR ) continue; - QString alias = (*i)->file().name(); - if ( !variables.contains( alias ) ) + TQString alias = (*i)->file().name(); + if ( !variables.tqcontains( alias ) ) variables << alias; } @@ -1246,13 +1246,13 @@ Instruction::~ Instruction() } -void Instruction::addLabels( const QStringList & labels ) +void Instruction::addLabels( const TQStringList & labels ) { m_labels += labels; } -void Instruction::setLabels( const QStringList & labels ) +void Instruction::setLabels( const TQStringList & labels ) { m_labels = labels; } @@ -1293,7 +1293,7 @@ void Instruction::makeOutputLinks( Code::iterator current, bool firstOutput, boo } -void Instruction::makeLabelOutputLink( const QString & label ) +void Instruction::makeLabelOutputLink( const TQString & label ) { Instruction * output = m_pCode->instruction( label ); if ( output ) @@ -1304,7 +1304,7 @@ void Instruction::makeLabelOutputLink( const QString & label ) void Instruction::addInputLink( Instruction * instruction ) { // Don't forget that a link to ourself is valid! - if ( !instruction || m_inputLinks.contains( instruction ) ) + if ( !instruction || m_inputLinks.tqcontains( instruction ) ) return; m_inputLinks << instruction; @@ -1315,7 +1315,7 @@ void Instruction::addInputLink( Instruction * instruction ) void Instruction::addOutputLink( Instruction * instruction ) { // Don't forget that a link to ourself is valid! - if ( !instruction || m_outputLinks.contains( instruction ) ) + if ( !instruction || m_outputLinks.tqcontains( instruction ) ) return; m_outputLinks << instruction; @@ -1345,9 +1345,9 @@ void Instruction::clearLinks() //BEGIN Byte-Oriented File Register Operations -QString Instr_addwf::code() const +TQString Instr_addwf::code() const { - return QString("addwf\t%1,%2").arg( m_file.name() ).arg( m_dest ); + return TQString("addwf\t%1,%2").tqarg( m_file.name() ).tqarg( m_dest ); } void Instr_addwf::generateLinksAndStates( Code::iterator current ) @@ -1398,9 +1398,9 @@ ProcessorBehaviour Instr_addwf::behaviour() const -QString Instr_andwf::code() const +TQString Instr_andwf::code() const { - return QString("andwf\t%1,%2").arg( m_file.name() ).arg( m_dest ); + return TQString("andwf\t%1,%2").tqarg( m_file.name() ).tqarg( m_dest ); } void Instr_andwf::generateLinksAndStates( Code::iterator current ) @@ -1432,9 +1432,9 @@ ProcessorBehaviour Instr_andwf::behaviour() const } -QString Instr_clrf::code() const +TQString Instr_clrf::code() const { - return QString("clrf\t%1").arg( m_file.name() ); + return TQString("clrf\t%1").tqarg( m_file.name() ); } void Instr_clrf::generateLinksAndStates( Code::iterator current ) @@ -1466,9 +1466,9 @@ ProcessorBehaviour Instr_clrf::behaviour() const //TODO COMF -QString Instr_decf::code() const +TQString Instr_decf::code() const { - return QString("decf\t%1,%2").arg( m_file.name() ).arg( m_dest ); + return TQString("decf\t%1,%2").tqarg( m_file.name() ).tqarg( m_dest ); } void Instr_decf::generateLinksAndStates( Code::iterator current ) @@ -1494,9 +1494,9 @@ ProcessorBehaviour Instr_decf::behaviour() const } -QString Instr_decfsz::code() const +TQString Instr_decfsz::code() const { - return QString("decfsz\t%1,%2").arg( m_file.name() ).arg( m_dest ); + return TQString("decfsz\t%1,%2").tqarg( m_file.name() ).tqarg( m_dest ); } void Instr_decfsz::generateLinksAndStates( Code::iterator current ) @@ -1518,9 +1518,9 @@ ProcessorBehaviour Instr_decfsz::behaviour() const } -QString Instr_incf::code() const +TQString Instr_incf::code() const { - return QString("incf\t%1,%2").arg( m_file.name() ).arg( m_dest ); + return TQString("incf\t%1,%2").tqarg( m_file.name() ).tqarg( m_dest ); } void Instr_incf::generateLinksAndStates( Code::iterator current ) @@ -1548,9 +1548,9 @@ ProcessorBehaviour Instr_incf::behaviour() const //TODO INCFSZ -QString Instr_iorwf::code() const +TQString Instr_iorwf::code() const { - return QString("iorwf\t%1,%2").arg( m_file.name() ).arg( m_dest ); + return TQString("iorwf\t%1,%2").tqarg( m_file.name() ).tqarg( m_dest ); } void Instr_iorwf::generateLinksAndStates( Code::iterator current ) @@ -1577,9 +1577,9 @@ ProcessorBehaviour Instr_iorwf::behaviour() const } -QString Instr_movf::code() const +TQString Instr_movf::code() const { - return QString("movf\t%1,%2").arg( m_file.name() ).arg( m_dest ); + return TQString("movf\t%1,%2").tqarg( m_file.name() ).tqarg( m_dest ); } void Instr_movf::generateLinksAndStates( Code::iterator current ) @@ -1623,9 +1623,9 @@ ProcessorBehaviour Instr_movf::behaviour() const } -QString Instr_movwf::code() const +TQString Instr_movwf::code() const { - return QString("movwf\t%1").arg( m_file.name() ); + return TQString("movwf\t%1").tqarg( m_file.name() ); } void Instr_movwf::generateLinksAndStates( Code::iterator current ) @@ -1653,9 +1653,9 @@ ProcessorBehaviour Instr_movwf::behaviour() const -QString Instr_rlf::code() const +TQString Instr_rlf::code() const { - return QString("rlf\t%1,%2").arg( m_file.name() ).arg( m_dest ); + return TQString("rlf\t%1,%2").tqarg( m_file.name() ).tqarg( m_dest ); } void Instr_rlf::generateLinksAndStates( Code::iterator current ) @@ -1684,9 +1684,9 @@ ProcessorBehaviour Instr_rlf::behaviour() const } -QString Instr_rrf::code() const +TQString Instr_rrf::code() const { - return QString("rrf\t%1,%2").arg( m_file.name() ).arg( m_dest ); + return TQString("rrf\t%1,%2").tqarg( m_file.name() ).tqarg( m_dest ); } void Instr_rrf::generateLinksAndStates( Code::iterator current ) @@ -1714,9 +1714,9 @@ ProcessorBehaviour Instr_rrf::behaviour() const } -QString Instr_subwf::code() const +TQString Instr_subwf::code() const { - return QString("subwf\t%1,%2").arg( m_file.name() ).arg( m_dest ); + return TQString("subwf\t%1,%2").tqarg( m_file.name() ).tqarg( m_dest ); } void Instr_subwf::generateLinksAndStates( Code::iterator current ) @@ -1772,9 +1772,9 @@ ProcessorBehaviour Instr_subwf::behaviour() const } -QString Instr_swapf::code() const +TQString Instr_swapf::code() const { - return QString("swapf\t%1,%2").arg( m_file.name() ).arg( m_dest ); + return TQString("swapf\t%1,%2").tqarg( m_file.name() ).tqarg( m_dest ); } void Instr_swapf::generateLinksAndStates( Code::iterator current ) @@ -1799,9 +1799,9 @@ ProcessorBehaviour Instr_swapf::behaviour() const } -QString Instr_xorwf::code() const +TQString Instr_xorwf::code() const { - return QString("xorwf\t%1,%2").arg( m_file.name() ).arg( m_dest ); + return TQString("xorwf\t%1,%2").tqarg( m_file.name() ).tqarg( m_dest ); } void Instr_xorwf::generateLinksAndStates( Code::iterator current ) @@ -1831,9 +1831,9 @@ ProcessorBehaviour Instr_xorwf::behaviour() const //BEGIN Bit-Oriented File Register Operations -QString Instr_bcf::code() const +TQString Instr_bcf::code() const { - return QString("bcf\t\t%1,%2").arg( m_file.name() ).arg( m_bit.name() ); + return TQString("bcf\t\t%1,%2").tqarg( m_file.name() ).tqarg( m_bit.name() ); } void Instr_bcf::generateLinksAndStates( Code::iterator current ) @@ -1855,9 +1855,9 @@ ProcessorBehaviour Instr_bcf::behaviour() const } -QString Instr_bsf::code() const +TQString Instr_bsf::code() const { - return QString("bsf\t\t%1,%2").arg( m_file.name() ).arg( m_bit.name() ); + return TQString("bsf\t\t%1,%2").tqarg( m_file.name() ).tqarg( m_bit.name() ); } void Instr_bsf::generateLinksAndStates( Code::iterator current ) @@ -1878,9 +1878,9 @@ ProcessorBehaviour Instr_bsf::behaviour() const } -QString Instr_btfsc::code() const +TQString Instr_btfsc::code() const { - return QString("btfsc\t%1,%2").arg( m_file.name() ).arg( m_bit.name() ); + return TQString("btfsc\t%1,%2").tqarg( m_file.name() ).tqarg( m_bit.name() ); } void Instr_btfsc::generateLinksAndStates( Code::iterator current ) @@ -1905,9 +1905,9 @@ ProcessorBehaviour Instr_btfsc::behaviour() const } -QString Instr_btfss::code() const +TQString Instr_btfss::code() const { - return QString("btfss\t%1,%2").arg( m_file.name() ).arg( m_bit.name() ); + return TQString("btfss\t%1,%2").tqarg( m_file.name() ).tqarg( m_bit.name() ); } void Instr_btfss::generateLinksAndStates( Code::iterator current ) @@ -1935,9 +1935,9 @@ ProcessorBehaviour Instr_btfss::behaviour() const //BEGIN Literal and Control Operations -QString Instr_addlw::code() const +TQString Instr_addlw::code() const { - return QString("addlw\t%1").arg( m_literal ); + return TQString("addlw\t%1").tqarg( m_literal ); } void Instr_addlw::generateLinksAndStates( Code::iterator current ) @@ -1962,9 +1962,9 @@ ProcessorBehaviour Instr_addlw::behaviour() const } -QString Instr_andlw::code() const +TQString Instr_andlw::code() const { - return QString("andlw\t%1").arg( m_literal ); + return TQString("andlw\t%1").tqarg( m_literal ); } void Instr_andlw::generateLinksAndStates( Code::iterator current ) @@ -1989,9 +1989,9 @@ ProcessorBehaviour Instr_andlw::behaviour() const } -QString Instr_call::code() const +TQString Instr_call::code() const { - return QString("call\t%1").arg( m_label ); + return TQString("call\t%1").tqarg( m_label ); } void Instr_call::generateLinksAndStates( Code::iterator current ) @@ -2035,7 +2035,7 @@ void Instr_call::linkReturns( Instruction * current, Instruction * returnPoint ) { // Jump over the call instruction to its return point, // which will be the instruction after current. - current = *(++m_pCode->find( current )); + current = *(++m_pCode->tqfind( current )); continue; } @@ -2062,9 +2062,9 @@ void Instr_call::linkReturns( Instruction * current, Instruction * returnPoint ) //TODO CLRWDT -QString Instr_goto::code() const +TQString Instr_goto::code() const { - return QString("goto\t%1").arg( m_label ); + return TQString("goto\t%1").tqarg( m_label ); } void Instr_goto::generateLinksAndStates( Code::iterator current ) @@ -2083,9 +2083,9 @@ ProcessorBehaviour Instr_goto::behaviour() const } -QString Instr_iorlw::code() const +TQString Instr_iorlw::code() const { - return QString("iorlw\t%1").arg( m_literal ); + return TQString("iorlw\t%1").tqarg( m_literal ); } void Instr_iorlw::generateLinksAndStates( Code::iterator current ) @@ -2110,9 +2110,9 @@ ProcessorBehaviour Instr_iorlw::behaviour() const } -QString Instr_movlw::code() const +TQString Instr_movlw::code() const { - return QString("movlw\t%1").arg( m_literal ); + return TQString("movlw\t%1").tqarg( m_literal ); } void Instr_movlw::generateLinksAndStates( Code::iterator current ) @@ -2131,7 +2131,7 @@ ProcessorBehaviour Instr_movlw::behaviour() const } -QString Instr_retfie::code() const +TQString Instr_retfie::code() const { return "retfie"; } @@ -2151,9 +2151,9 @@ ProcessorBehaviour Instr_retfie::behaviour() const } -QString Instr_retlw::code() const +TQString Instr_retlw::code() const { - return QString("retlw\t%1").arg( m_literal ); + return TQString("retlw\t%1").tqarg( m_literal ); } void Instr_retlw::generateLinksAndStates( Code::iterator current ) @@ -2174,7 +2174,7 @@ ProcessorBehaviour Instr_retlw::behaviour() const -QString Instr_return::code() const +TQString Instr_return::code() const { return "return"; } @@ -2193,7 +2193,7 @@ ProcessorBehaviour Instr_return::behaviour() const } -QString Instr_sleep::code() const +TQString Instr_sleep::code() const { return "sleep"; } @@ -2217,9 +2217,9 @@ ProcessorBehaviour Instr_sleep::behaviour() const } -QString Instr_sublw::code() const +TQString Instr_sublw::code() const { - return QString("sublw\t%1").arg( m_literal ); + return TQString("sublw\t%1").tqarg( m_literal ); } void Instr_sublw::generateLinksAndStates( Code::iterator current ) @@ -2262,9 +2262,9 @@ ProcessorBehaviour Instr_sublw::behaviour() const } -QString Instr_xorlw::code() const +TQString Instr_xorlw::code() const { - return QString("xorlw\t%1").arg( m_literal ); + return TQString("xorlw\t%1").tqarg( m_literal ); } void Instr_xorlw::generateLinksAndStates( Code::iterator current ) @@ -2288,20 +2288,20 @@ ProcessorBehaviour Instr_xorlw::behaviour() const //BEGIN Microbe (non-assembly) Operations -QString Instr_sourceCode::code() const +TQString Instr_sourceCode::code() const { - QStringList sourceLines = QStringList::split("\n",m_raw); + TQStringList sourceLines = TQStringList::split("\n",m_raw); return ";" + sourceLines.join("\n;"); } -QString Instr_asm::code() const +TQString Instr_asm::code() const { return "; asm {\n" + m_raw + "\n; }"; } -QString Instr_raw::code() const +TQString Instr_raw::code() const { return m_raw; } diff --git a/microbe/instruction.h b/microbe/instruction.h index 2d43343..595dd16 100644 --- a/microbe/instruction.h +++ b/microbe/instruction.h @@ -21,10 +21,10 @@ #ifndef INSTRUCTION_H #define INSTRUCTION_H -#include <qmap.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qvaluelist.h> +#include <tqmap.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqvaluelist.h> class Code; class CodeIterator; @@ -32,7 +32,7 @@ class CodeConstIterator; class Instruction; class PIC14; -typedef QValueList<Instruction*> InstructionList; +typedef TQValueList<Instruction*> InstructionList; /** @@ -85,7 +85,7 @@ class Register * Construct a Register with the given name. If the name is not * recognized, then it is assumed to be a GPR register. */ - Register( const QString & name ); + Register( const TQString & name ); /** * Construct a Register with the given name. If the name is not * recognized, then it is assumed to be a GPR register. @@ -114,7 +114,7 @@ class Register /** * Returns the name of the register, or the alias for the GPR. */ - QString name() const { return m_name; } + TQString name() const { return m_name; } /** * @return the type of register. */ @@ -129,7 +129,7 @@ class Register bool affectsExternal() const; protected: - QString m_name; + TQString m_name; Type m_type; }; @@ -189,7 +189,7 @@ class RegisterBit /** * Construct a register bit with the given name. */ - RegisterBit( const QString & name ); + RegisterBit( const TQString & name ); /** * Construct a register bit with the given name. */ @@ -211,7 +211,7 @@ class RegisterBit /** * @return the name of the bit, e.g. "Z" for Z. */ - QString name() const { return m_name; } + TQString name() const { return m_name; } protected: @@ -222,7 +222,7 @@ class RegisterBit Register::Type m_registerType; uchar m_bitPos:3; - QString m_name; + TQString m_name; }; @@ -377,7 +377,7 @@ class ProcessorState RegisterState status; protected: - typedef QMap< Register, RegisterState > RegisterMap; + typedef TQMap< Register, RegisterState > RegisterMap; /** * All registers other than working and status. Entries are created on * calls to reg with a new Register. @@ -411,7 +411,7 @@ class ProcessorBehaviour RegisterBehaviour status; protected: - typedef QMap< Register, RegisterBehaviour > RegisterMap; + typedef TQMap< Register, RegisterBehaviour > RegisterMap; /** * All registers other than working and status. Entries are created on * calls to reg with a new Register. @@ -448,7 +448,7 @@ class RegisterDepends uchar status; protected: - typedef QMap< Register, uchar > RegisterMap; + typedef TQMap< Register, uchar > RegisterMap; /** * All registers other than working and status. Entries are created on * calls to reg with a new Register. @@ -492,12 +492,12 @@ class Code * Queues a label to be given to the next instruction to be added in the * given position */ - void queueLabel( const QString & label, InstructionPosition position = Middle ); + void queueLabel( const TQString & label, InstructionPosition position = Middle ); /** * Returns the list of queued labels for the given position. This is * used in merging code, as we also need to merge any queued labels. */ - QStringList queuedLabels( InstructionPosition position ) const { return m_queuedLabels[position]; } + TQStringList queuedLabels( InstructionPosition position ) const { return m_queuedLabels[position]; } /** * Adds the Instruction at the given position. */ @@ -506,13 +506,13 @@ class Code * @returns the Instruction with the given label (or null if no such * Instruction). */ - Instruction * instruction( const QString & label ) const; + Instruction * instruction( const TQString & label ) const; /** * Look for an Assembly instruction (other types are ignored). * @return an iterator to the current instruction, or end if it wasn't * found. */ - iterator find( Instruction * instruction ); + iterator tqfind( Instruction * instruction ); /** * Removes the Instruction (regardless of position). * @warning You should always use only this function to remove an @@ -524,7 +524,7 @@ class Code * Merges all the blocks output together with other magic such as adding * variables, gpasm directives, etc. */ - QString generateCode( PIC14 * pic ) const; + TQString generateCode( PIC14 * pic ) const; /** * Appends the InstructionLists to the end of the ones in this instance. * @param middleInsertionPosition is the position where the middle code @@ -559,10 +559,10 @@ class Code * Used when generating the code. Finds the list of general purpose * registers that are referenced and returns their aliases. */ - QStringList findVariables() const; + TQStringList findVariables() const; InstructionList m_instructionLists[ PositionCount ]; ///< @see InstructionPosition - QStringList m_queuedLabels[ PositionCount ]; ///< @see InstructionPosition + TQStringList m_queuedLabels[ PositionCount ]; ///< @see InstructionPosition private: // Disable copy constructor and operator= Code( const Code & ); @@ -687,7 +687,7 @@ class Instruction /** * The text to output to the generated assembly. */ - virtual QString code() const = 0; + virtual TQString code() const = 0; /** * The input processor state is used to generate the outputlinks and the * output processor state. @@ -748,15 +748,15 @@ class Instruction * with it - these will be printed before the instruction in the * assembly output. */ - QStringList labels() const { return m_labels; } + TQStringList labels() const { return m_labels; } /** * @see labels */ - void addLabels( const QStringList & labels ); + void addLabels( const TQStringList & labels ); /** * @see labels */ - void setLabels( const QStringList & labels ); + void setLabels( const TQStringList & labels ); /** * @see used */ @@ -824,7 +824,7 @@ class Instruction * This function is provided for instructions that jump to a label (i.e. * call and goto). */ - void makeLabelOutputLink( const QString & label ); + void makeLabelOutputLink( const TQString & label ); RegisterDepends m_registerDepends; bool m_bInputStateChanged; @@ -832,13 +832,13 @@ class Instruction bool m_bPositionAffectsBranching; InstructionList m_inputLinks; InstructionList m_outputLinks; - QStringList m_labels; + TQStringList m_labels; Code * m_pCode; // Commonly needed member variables for assembly instructions Register m_file; RegisterBit m_bit; - QString m_raw; // Used by source code, raw asm, etc + TQString m_raw; // Used by source code, raw asm, etc uchar m_literal; unsigned m_dest:1; // is 0 (W) or 1 (file). ProcessorState m_inputState; @@ -856,7 +856,7 @@ class Instr_addwf : public Instruction { public: Instr_addwf( const Register & file, int dest ) { m_file = file; m_dest = dest; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -867,7 +867,7 @@ class Instr_andwf : public Instruction { public: Instr_andwf( const Register & file, int dest ) { m_file = file; m_dest = dest; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -878,7 +878,7 @@ class Instr_clrf : public Instruction { public: Instr_clrf( const Register & file ) { m_file = file; m_dest = 1; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -893,7 +893,7 @@ class Instr_decf : public Instruction { public: Instr_decf( const Register & file, int dest ) { m_file = file; m_dest = dest; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -904,7 +904,7 @@ class Instr_decfsz : public Instruction { public: Instr_decfsz( const Register & file, int dest ) { m_file = file; m_dest = dest; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -915,7 +915,7 @@ class Instr_incf : public Instruction { public: Instr_incf( const Register & file, int dest ) { m_file = file; m_dest = dest; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -929,7 +929,7 @@ class Instr_iorwf : public Instruction { public: Instr_iorwf( const Register & file, int dest ) { m_file = file; m_dest = dest; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -940,7 +940,7 @@ class Instr_movf : public Instruction { public: Instr_movf( const Register & file, int dest ) { m_file = file; m_dest = dest; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -951,7 +951,7 @@ class Instr_movwf : public Instruction { public: Instr_movwf( const Register & file ) { m_file = file; m_dest = 1; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -965,7 +965,7 @@ class Instr_rlf : public Instruction { public: Instr_rlf( const Register & file, int dest ) { m_file = file; m_dest = dest; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -976,7 +976,7 @@ class Instr_rrf : public Instruction { public: Instr_rrf( const Register & file, int dest ) { m_file = file; m_dest = dest; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -987,7 +987,7 @@ class Instr_subwf : public Instruction { public: Instr_subwf( const Register & file, int dest ) { m_file = file; m_dest = dest; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -998,7 +998,7 @@ class Instr_swapf : public Instruction { public: Instr_swapf( const Register & file, int dest ) { m_file = file; m_dest = dest; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -1009,7 +1009,7 @@ class Instr_xorwf : public Instruction { public: Instr_xorwf( const Register & file, int dest ) { m_file = file; m_dest = dest; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return FileOriented; } @@ -1023,7 +1023,7 @@ class Instr_bcf : public Instruction { public: Instr_bcf( const Register & file, const RegisterBit & bit ) { m_file = file; m_bit = bit; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return BitOriented; } @@ -1034,7 +1034,7 @@ class Instr_bsf : public Instruction { public: Instr_bsf( const Register & file, const RegisterBit & bit ) { m_file = file; m_bit = bit; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return BitOriented; } @@ -1045,7 +1045,7 @@ class Instr_btfsc : public Instruction { public: Instr_btfsc( const Register & file, const RegisterBit & bit ) { m_file = file; m_bit = bit; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return Other; } @@ -1056,7 +1056,7 @@ class Instr_btfss : public Instruction { public: Instr_btfss( const Register & file, const RegisterBit & bit ) { m_file = file; m_bit = bit; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return Other; } @@ -1070,7 +1070,7 @@ class Instr_addlw : public Instruction { public: Instr_addlw( int literal ) { m_literal = literal; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return WorkingOriented; } @@ -1082,7 +1082,7 @@ class Instr_andlw : public Instruction { public: Instr_andlw( int literal ) { m_literal = literal; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return WorkingOriented; } @@ -1092,8 +1092,8 @@ class Instr_andlw : public Instruction class Instr_call : public Instruction { public: - Instr_call( const QString & label ) { m_label = label; } - virtual QString code() const; + Instr_call( const TQString & label ) { m_label = label; } + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return Other; } @@ -1107,8 +1107,8 @@ class Instr_call : public Instruction */ void makeReturnLinks( Instruction * next ); - QString label() const { return m_label; } - void setLabel( const QString & label ) { m_label = label; } + TQString label() const { return m_label; } + void setLabel( const TQString & label ) { m_label = label; } protected: /** @@ -1121,7 +1121,7 @@ class Instr_call : public Instruction */ void linkReturns( Instruction * current, Instruction * returnPoint ); - QString m_label; + TQString m_label; }; @@ -1131,17 +1131,17 @@ class Instr_call : public Instruction class Instr_goto : public Instruction { public: - Instr_goto( const QString & label ) { m_label = label; } - virtual QString code() const; + Instr_goto( const TQString & label ) { m_label = label; } + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return Other; } - QString label() const { return m_label; } - void setLabel( const QString & label ) { m_label = label; } + TQString label() const { return m_label; } + void setLabel( const TQString & label ) { m_label = label; } protected: - QString m_label; + TQString m_label; }; @@ -1149,7 +1149,7 @@ class Instr_iorlw : public Instruction { public: Instr_iorlw( int literal ) { m_literal = literal; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return WorkingOriented; } @@ -1160,7 +1160,7 @@ class Instr_movlw : public Instruction { public: Instr_movlw( int literal ) { m_literal = literal; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return WorkingOriented; } @@ -1171,7 +1171,7 @@ class Instr_retfie : public Instruction { public: Instr_retfie() {}; - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return Other; } @@ -1182,7 +1182,7 @@ class Instr_retlw : public Instruction { public: Instr_retlw( int literal ) { m_literal = literal; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return Other; } @@ -1193,7 +1193,7 @@ class Instr_return : public Instruction { public: Instr_return() {}; - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return Other; } @@ -1204,7 +1204,7 @@ class Instr_sleep : public Instruction { public: Instr_sleep() {}; - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return Other; } @@ -1215,7 +1215,7 @@ class Instr_sublw : public Instruction { public: Instr_sublw( int literal ) { m_literal = literal; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return WorkingOriented; } @@ -1226,7 +1226,7 @@ class Instr_xorlw : public Instruction { public: Instr_xorlw( int literal ) { m_literal = literal; } - virtual QString code() const; + virtual TQString code() const; virtual void generateLinksAndStates( Code::iterator current ); virtual ProcessorBehaviour behaviour() const; virtual AssemblyType assemblyType() const { return WorkingOriented; } @@ -1239,8 +1239,8 @@ class Instr_xorlw : public Instruction class Instr_sourceCode : public Instruction { public: - Instr_sourceCode( const QString & source ) { m_raw = source; } - virtual QString code() const; + Instr_sourceCode( const TQString & source ) { m_raw = source; } + virtual TQString code() const; virtual InstructionType type() const { return Comment; } virtual AssemblyType assemblyType() const { return None; } }; @@ -1249,8 +1249,8 @@ class Instr_sourceCode : public Instruction class Instr_asm : public Instruction { public: - Instr_asm( const QString & raw ) { m_raw = raw; } - virtual QString code() const; + Instr_asm( const TQString & raw ) { m_raw = raw; } + virtual TQString code() const; virtual InstructionType type() const { return Raw; } virtual AssemblyType assemblyType() const { return None; } }; @@ -1261,8 +1261,8 @@ class Instr_asm : public Instruction class Instr_raw : public Instruction { public: - Instr_raw( const QString & raw ) { m_raw = raw; } - virtual QString code() const; + Instr_raw( const TQString & raw ) { m_raw = raw; } + virtual TQString code() const; virtual InstructionType type() const { return Raw; } virtual AssemblyType assemblyType() const { return None; } }; diff --git a/microbe/main.cpp b/microbe/main.cpp index 1325159..b294a0b 100644 --- a/microbe/main.cpp +++ b/microbe/main.cpp @@ -25,7 +25,7 @@ #include <kaboutdata.h> #include <kcmdlineargs.h> #include <klocale.h> -#include <qfile.h> +#include <tqfile.h> #include <iostream> #include <fstream> @@ -59,8 +59,8 @@ int main(int argc, char **argv) if(args->count() == 2 ) { Microbe mb; - QString s = mb.compile( args->arg(0), args->isSet("show-source"), args->isSet("optimize")); - QString errorReport = mb.errorReport(); + TQString s = mb.compile( args->arg(0), args->isSet("show-source"), args->isSet("optimize")); + TQString errorReport = mb.errorReport(); if ( !errorReport.isEmpty() ) { diff --git a/microbe/microbe.cpp b/microbe/microbe.cpp index d94cba7..847dc88 100644 --- a/microbe/microbe.cpp +++ b/microbe/microbe.cpp @@ -26,7 +26,7 @@ #include <kdebug.h> #include <klocale.h> -#include <qfile.h> +#include <tqfile.h> #include <iostream> using namespace std; @@ -56,7 +56,7 @@ Microbe::Microbe() { for ( unsigned col = 0; col < 6; ++col ) { - m_aliasList[ QString("Keypad_%1_%2").arg(row+1).arg(col+1) ] = QString::number( bv[row][col] ); + m_aliasList[ TQString("Keypad_%1_%2").tqarg(row+1).tqarg(col+1) ] = TQString::number( bv[row][col] ); } } @@ -70,12 +70,12 @@ Microbe::~Microbe() } -QString Microbe::compile( const QString & url, bool showSource, bool optimize ) +TQString Microbe::compile( const TQString & url, bool showSource, bool optimize ) { - QFile file( url ); + TQFile file( url ); if( file.open( IO_ReadOnly ) ) { - QTextStream stream(&file); + TQTextStream stream(&file); unsigned line = 0; while( !stream.atEnd() ) m_program += SourceLine( stream.readLine(), url, line++ ); @@ -84,7 +84,7 @@ QString Microbe::compile( const QString & url, bool showSource, bool optimize ) } else { - m_errorReport += i18n("Could not open file '%1'\n").arg(url); + m_errorReport += i18n("Could not open file '%1'\n").tqarg(url); return 0; } @@ -134,8 +134,8 @@ void Microbe::simplifyProgram() SourceLineList::const_iterator end = m_program.end(); for ( SourceLineList::const_iterator it = m_program.begin(); it != end; ++it ) { - QString code = (*it).text(); - QString simplifiedLine; + TQString code = (*it).text(); + TQString simplifiedLine; if ( commentType == SingleLine ) commentType = None; @@ -144,7 +144,7 @@ void Microbe::simplifyProgram() for ( unsigned i = 0; i < l; ++i ) { - QChar c = code[i]; + TQChar c = code[i]; switch ( c ) { case '/': @@ -207,16 +207,16 @@ void Microbe::simplifyProgram() } -void Microbe::compileError( MistakeType type, const QString & context, const SourceLine & sourceLine ) +void Microbe::compileError( MistakeType type, const TQString & context, const SourceLine & sourceLine ) { - QString message; + TQString message; switch (type) { case UnknownStatement: message = i18n("Unknown statement"); break; case InvalidPort: - message = i18n("Port '%1' is not supported by target PIC").arg(context); + message = i18n("Port '%1' is not supported by target PIC").tqarg(context); break; case UnassignedPin: message = i18n("Pin identifier was not followed by '='"); @@ -225,19 +225,19 @@ void Microbe::compileError( MistakeType type, const QString & context, const Sou message = i18n("Pin state can only be 'high' or 'low'"); break; case UnassignedPort: - message = i18n("Invalid token '%1'. Port identifier should be followed by '='").arg(context); + message = i18n("Invalid token '%1'. Port identifier should be followed by '='").tqarg(context); break; case UnexpectedStatementBeforeBracket: message = i18n("Unexpected statement before '{'"); break; case MismatchedBrackets: - message = i18n("Mismatched brackets in expression '%1'").arg(context); + message = i18n("Mismatched brackets in expression '%1'").tqarg(context); break; case InvalidEquals: message = i18n("Invalid '=' found in expression"); break; case ReservedKeyword: - message = i18n("Reserved keyword '%1' cannot be a variable name.").arg(context); + message = i18n("Reserved keyword '%1' cannot be a variable name.").tqarg(context); break; case ConsecutiveOperators: message = i18n("Nothing between operators"); @@ -249,10 +249,10 @@ void Microbe::compileError( MistakeType type, const QString & context, const Sou if ( context.isEmpty() ) message = i18n("Unknown variable"); else - message = i18n("Unknown variable '%1'").arg(context); + message = i18n("Unknown variable '%1'").tqarg(context); break; case UnopenableInclude: - message = i18n("Could not open include file '%1'").arg(context); + message = i18n("Could not open include file '%1'").tqarg(context); break; case DivisionByZero: message = i18n("Division by zero"); @@ -267,7 +267,7 @@ void Microbe::compileError( MistakeType type, const QString & context, const Sou message = i18n("Delay must be a positive constant value"); break; case HighLowExpected: - message = i18n("'high' or 'low' expected after pin expression '%1'").arg(context); + message = i18n("'high' or 'low' expected after pin expression '%1'").tqarg(context); break; case InvalidComparison: message = i18n("Comparison operator in '%1' is not recognized"); @@ -285,7 +285,7 @@ void Microbe::compileError( MistakeType type, const QString & context, const Sou message = i18n("Extra tokens at end of line"); break; case FixedStringExpected: - message = i18n("Expected '%1'").arg(context); + message = i18n("Expected '%1'").tqarg(context); break; case PinListExpected: message = i18n("Pin list expected"); @@ -300,19 +300,19 @@ void Microbe::compileError( MistakeType type, const QString & context, const Sou message = i18n("Interrupt already definied"); break; case ReadOnlyVariable: - message = i18n("Variable '%1' is read only").arg(context); + message = i18n("Variable '%1' is read only").tqarg(context); break; case WriteOnlyVariable: - message = i18n("Variable '%1' is write only").arg(context); + message = i18n("Variable '%1' is write only").tqarg(context); break; case InvalidPinMapSize: message = i18n("Invalid pin list size"); break; case VariableRedefined: - message = i18n("Variable '%1' is already defined").arg(context); + message = i18n("Variable '%1' is already defined").tqarg(context); break; case InvalidVariableName: - message = i18n("'%1' is not a valid variable name").arg(context); + message = i18n("'%1' is not a valid variable name").tqarg(context); break; case VariableExpected: message = i18n("Variable expected"); @@ -323,15 +323,15 @@ void Microbe::compileError( MistakeType type, const QString & context, const Sou } - m_errorReport += QString("%1:%2:Error [%3] %4\n") - .arg( sourceLine.url() ) - .arg( sourceLine.line()+1 ) - .arg( type ) - .arg( message ); + m_errorReport += TQString("%1:%2:Error [%3] %4\n") + .tqarg( sourceLine.url() ) + .tqarg( sourceLine.line()+1 ) + .tqarg( type ) + .tqarg( message ); } -bool Microbe::isValidVariableName( const QString & variableName ) +bool Microbe::isValidVariableName( const TQString & variableName ) { if ( variableName.isEmpty() ) return false; @@ -359,7 +359,7 @@ void Microbe::addVariable( const Variable & variable ) } -Variable Microbe::variable( const QString & name ) const +Variable Microbe::variable( const TQString & name ) const { VariableList::const_iterator end = m_variables.end(); for ( VariableList::const_iterator it = m_variables.begin(); it != end; ++it ) @@ -371,7 +371,7 @@ Variable Microbe::variable( const QString & name ) const } -bool Microbe::isVariableKnown( const QString & name ) const +bool Microbe::isVariableKnown( const TQString & name ) const { return variable(name).type() != Variable::invalidType; } @@ -384,41 +384,41 @@ void Microbe::addDelayRoutineWanted( unsigned routine ) } -void Microbe::addAlias( const QString & name, const QString & dest ) +void Microbe::addAlias( const TQString & name, const TQString & dest ) { m_aliasList[name] = dest; } -QString Microbe::alias( const QString & alias ) const +TQString Microbe::alias( const TQString & alias ) const { // If the string is an alias, return the real string, // otherwise just return the alias as that is the real string. - AliasMap::const_iterator it = m_aliasList.find(alias); + AliasMap::const_iterator it = m_aliasList.tqfind(alias); if ( it != m_aliasList.constEnd() ) return it.data(); return alias; } -void Microbe::setInterruptUsed(const QString &interruptName) +void Microbe::setInterruptUsed(const TQString &interruptName) { // Don't add it again if it is already in the list - if ( m_usedInterrupts.contains( interruptName ) ) + if ( m_usedInterrupts.tqcontains( interruptName ) ) return; m_usedInterrupts.append(interruptName); } -bool Microbe::isInterruptUsed( const QString & interruptName ) +bool Microbe::isInterruptUsed( const TQString & interruptName ) { - return m_usedInterrupts.contains( interruptName ); + return m_usedInterrupts.tqcontains( interruptName ); } -QString Microbe::dest() const +TQString Microbe::dest() const { - return QString("__op%1").arg(m_dest); + return TQString("__op%1").tqarg(m_dest); } @@ -445,7 +445,7 @@ void Microbe::resetDest() //BEGIN class SourceLine -SourceLine::SourceLine( const QString & text, const QString & url, int line ) +SourceLine::SourceLine( const TQString & text, const TQString & url, int line ) { m_text = text; m_url = url; @@ -459,9 +459,9 @@ SourceLine::SourceLine() } -QStringList SourceLine::toStringList( const SourceLineList & lines ) +TQStringList SourceLine::toStringList( const SourceLineList & lines ) { - QStringList joined; + TQStringList joined; SourceLineList::const_iterator end = lines.end(); for ( SourceLineList::const_iterator it = lines.begin(); it != end; ++it ) joined << (*it).text(); diff --git a/microbe/microbe.h b/microbe/microbe.h index efa7aa4..c97417a 100644 --- a/microbe/microbe.h +++ b/microbe/microbe.h @@ -25,21 +25,21 @@ #include <variable.h> // #include <pic14.h> -#include <qmap.h> -#include <qstring.h> -#include <qstringlist.h> +#include <tqmap.h> +#include <tqstring.h> +#include <tqstringlist.h> -class QString; +class TQString; class BTreeBase; class BTreeNode; class Code; class PIC14; class PortPin; -typedef QValueList<PortPin> PortPinList; +typedef TQValueList<PortPin> PortPinList; -typedef QValueList<Variable> VariableList; -typedef QMap<QString,QString> AliasMap; +typedef TQValueList<Variable> VariableList; +typedef TQMap<TQString,TQString> AliasMap; enum ExprType { @@ -53,7 +53,7 @@ enum ExprType class SourceLine; -typedef QValueList<SourceLine> SourceLineList; +typedef TQValueList<SourceLine> SourceLineList; /** Represents a source line, with the convention of line number starting at zero. @author David Saxton @@ -62,26 +62,26 @@ class SourceLine { public: /** - * The QValueList template requires a default constructor - calling this + * The TQValueList template requires a default constructor - calling this * though creates an invalid SourceLine with line() returning -1. So * this constructor should never be used. */ SourceLine(); - SourceLine( const QString & text, const QString & url, int line ); + SourceLine( const TQString & text, const TQString & url, int line ); - QString text() const { return m_text; } - QString url() const { return m_url; } + TQString text() const { return m_text; } + TQString url() const { return m_url; } int line() const { return m_line; } /** * Extracts the text from each SourceLine and adds it to the - * returned QStringList. + * returned TQStringList. */ - static QStringList toStringList( const SourceLineList & lines ); + static TQStringList toStringList( const SourceLineList & lines ); protected: - QString m_text; - QString m_url; + TQString m_text; + TQString m_url; int m_line; }; @@ -140,32 +140,32 @@ class Microbe * Returns a list of errors occured during compilation, intended for * outputting to stderr. */ - QString errorReport() const { return m_errorReport; } + TQString errorReport() const { return m_errorReport; } /** * Call this to compile the given code. This serves as the top level of * recursion as it performs initialisation of things, to recurse at * levels use parseUsingChild(), or create your own Parser. * @param url is used for reporting errors */ - QString compile( const QString & url, bool showSource, bool optimize ); + TQString compile( const TQString & url, bool showSource, bool optimize ); /** * Adds the given compiler error at the file line number to the * compilation report. */ - void compileError( MistakeType type, const QString & context, const SourceLine & sourceLine ); + void compileError( MistakeType type, const TQString & context, const SourceLine & sourceLine ); /** * This is for generating unique numbers for computer generated labels. */ - QString uniqueLabel() { return QString("__%1").arg(m_uniqueLabel++); } + TQString uniqueLabel() { return TQString("__%1").tqarg(m_uniqueLabel++); } /** * If alias is an alias for something then it returns that something, * otherwise it just returns alias (which in that case is not an alias!) */ - QString alias( const QString & alias ) const; + TQString alias( const TQString & alias ) const; /** * Aliases the name to the dest. */ - void addAlias( const QString & name, const QString & dest ); + void addAlias( const TQString & name, const TQString & dest ); /** * Tell Microbe that a minimum of the given delay routine needs to be * created. @@ -182,15 +182,15 @@ class Microbe * Add the interrupt as being used, i.e. make sure there is one and only * one occurance of its name in m_usedInterrupts. */ - void setInterruptUsed( const QString & interruptName ); + void setInterruptUsed( const TQString & interruptName ); /** * @returns whether the given interrupt has already been used. */ - bool isInterruptUsed( const QString & interruptName ); + bool isInterruptUsed( const TQString & interruptName ); /** * @returns whether the variable name is valid. */ - static bool isValidVariableName( const QString & variableName ); + static bool isValidVariableName( const TQString & variableName ); /** * Appends the given variable name to the variable list. */ @@ -199,15 +199,15 @@ class Microbe * @returns the variable with the given name, or one of invalidType if * no such variable exists. */ - Variable variable( const QString & variableName ) const; + Variable variable( const TQString & variableName ) const; /** * @returns whether the variable has been declared yet. */ - bool isVariableKnown( const QString & variableName ) const; + bool isVariableKnown( const TQString & variableName ) const; /** * This is used as a temporary variable while evaluating an expression. */ - QString dest() const; + TQString dest() const; void incDest(); void decDest(); void resetDest(); @@ -219,9 +219,9 @@ class Microbe */ void simplifyProgram(); - QStringList m_usedInterrupts; + TQStringList m_usedInterrupts; SourceLineList m_program; - QString m_errorReport; + TQString m_errorReport; int m_uniqueLabel; VariableList m_variables; int m_dest; @@ -234,7 +234,7 @@ class Microbe * alias ken bob * alias mary bob */ - QMap<QString,QString> m_aliasList; + TQMap<TQString,TQString> m_aliasList; /** * Once the child parser has found it, this is set to the pic type * string found in the source file. The pic type directive must be diff --git a/microbe/optimizer.cpp b/microbe/optimizer.cpp index 33b0bcd..7b8d059 100644 --- a/microbe/optimizer.cpp +++ b/microbe/optimizer.cpp @@ -18,10 +18,10 @@ using namespace std; -QString binary( uchar val ) +TQString binary( uchar val ) { - QString bin = QString::number( val, 2 ); - QString pad; + TQString bin = TQString::number( val, 2 ); + TQString pad; pad.fill( '0', 8-bin.length() ); return pad + bin; } @@ -143,7 +143,7 @@ bool Optimizer::pruneInstructions() //BEGIN remove labels without any reference to them // First: build up a list of labels which are referenced - QStringList referencedLabels; + TQStringList referencedLabels; for ( it = m_pCode->begin(); it != end; ++it ) { if ( Instr_goto * ins = dynamic_cast<Instr_goto*>(*it) ) @@ -155,12 +155,12 @@ bool Optimizer::pruneInstructions() // Now remove labels from instructions that aren't in the referencedLabels list for ( it = m_pCode->begin(); it != end; ++it ) { - QStringList labels = (*it)->labels(); + TQStringList labels = (*it)->labels(); - QStringList::iterator labelsEnd = labels.end(); - for ( QStringList::iterator labelsIt = labels.begin(); labelsIt != labelsEnd; ) + TQStringList::iterator labelsEnd = labels.end(); + for ( TQStringList::iterator labelsIt = labels.begin(); labelsIt != labelsEnd; ) { - if ( !referencedLabels.contains( *labelsIt ) ) + if ( !referencedLabels.tqcontains( *labelsIt ) ) { labelsIt = labels.erase( labelsIt ); removed = true; @@ -386,8 +386,8 @@ bool Optimizer::optimizeInstructions() { // If we are testing STATUS, then we assume that the bits changed // are only those that are marked as independent. - uchar bitmask = ( i == 1 ) ? behaviour.reg( Register::STATUS ).indep : 0xff; - if ( !canRemove( *it, (i == 0) ? regSet : Register::STATUS, bitmask ) ) + uchar bittqmask = ( i == 1 ) ? behaviour.reg( Register::STATUS ).indep : 0xff; + if ( !canRemove( *it, (i == 0) ? regSet : Register::STATUS, bittqmask ) ) { ok = false; break; @@ -409,7 +409,7 @@ bool Optimizer::optimizeInstructions() } -bool Optimizer::redirectGotos( Instruction * current, const QString & label ) +bool Optimizer::redirectGotos( Instruction * current, const TQString & label ) { if ( current->isUsed() ) return false; @@ -479,7 +479,7 @@ bool Optimizer::canRemove( Instruction * ins, const Register & reg, uchar bitMas // The bits that are depended upon in the future for this register uchar depends = generateRegisterDepends( ins, reg ); - // Only interested in those bits allowed by the bit mask + // Only interested in those bits allowed by the bit tqmask depends &= bitMask; RegisterState inputState = ins->inputState().reg( reg ); diff --git a/microbe/optimizer.h b/microbe/optimizer.h index 249abd0..26c5f6f 100644 --- a/microbe/optimizer.h +++ b/microbe/optimizer.h @@ -15,7 +15,7 @@ /// Used for debugging; returns the uchar as a binary string (e.g. 01101010). -QString binary( uchar val ); +TQString binary( uchar val ); /** @@ -60,7 +60,7 @@ class Optimizer * label. * @return whether any GOTOs were redirected */ - bool redirectGotos( Instruction * current, const QString & label ); + bool redirectGotos( Instruction * current, const TQString & label ); /** * Find out if the given instruction or any of its outputs overwrite * any of the bits of the given register before they are used. diff --git a/microbe/parser.cpp b/microbe/parser.cpp index 15335e0..0bf3fea 100644 --- a/microbe/parser.cpp +++ b/microbe/parser.cpp @@ -28,9 +28,9 @@ #include <assert.h> #include <kdebug.h> #include <klocale.h> -#include <qfile.h> -#include <qregexp.h> -#include <qstring.h> +#include <tqfile.h> +#include <tqregexp.h> +#include <tqstring.h> #include <iostream> using namespace std; @@ -199,11 +199,11 @@ Code * Parser::parse( const SourceLineList & lines ) { m_currentSourceLine = (*sit).content; - QString line = (*sit).text(); + TQString line = (*sit).text(); - QString command; // e.g. "delay", "for", "subroutine", "increment", etc + TQString command; // e.g. "delay", "for", "subroutine", "increment", etc { - int spacepos = line.find(' '); + int spacepos = line.tqfind(' '); if ( spacepos >= 0 ) command = line.left( spacepos ); else @@ -212,13 +212,13 @@ Code * Parser::parse( const SourceLineList & lines ) OutputFieldMap fieldMap; if ( (*sit).content.line() >= 0 ) - m_code->append( new Instr_sourceCode( QString("#MSRC\t%1; %2\t%3").arg( (*sit).content.line() + 1 ).arg( (*sit).content.url() ).arg( (*sit).content.text() ) )); + m_code->append( new Instr_sourceCode( TQString("#MSRC\t%1; %2\t%3").tqarg( (*sit).content.line() + 1 ).tqarg( (*sit).content.url() ).tqarg( (*sit).content.text() ) )); bool showBracesInSource = (*sit).hasBracedCode(); if ( showBracesInSource ) m_code->append(new Instr_sourceCode("{")); // Use the first token in the line to look up the statement type - DefinitionMap::Iterator dmit = m_definitionMap.find(command); + DefinitionMap::Iterator dmit = m_definitionMap.tqfind(command); if(dmit == m_definitionMap.end()) { if( !processAssignment( (*sit).text() ) ) @@ -226,7 +226,7 @@ Code * Parser::parse( const SourceLineList & lines ) // Not an assignement, maybe a label if( (*sit).isLabel() ) { - QString label = (*sit).text().left( (*sit).text().length() - 1 ); + TQString label = (*sit).text().left( (*sit).text().length() - 1 ); ///TODO sanity check label name and then do error like "Bad label" m_pPic->Slabel( label ); } @@ -257,7 +257,7 @@ Code * Parser::parse( const SourceLineList & lines ) if( errorInLine || finishLine) break; Field field = (*sdit); - QString token; + TQString token; bool saveToken = false; bool saveBraced = false; @@ -269,7 +269,7 @@ Code * Parser::parse( const SourceLineList & lines ) case (Field::Variable): case (Field::Name): { - newPosition = line.find( ' ', position ); + newPosition = line.tqfind( ' ', position ); if(position == newPosition) { newPosition = -1; @@ -303,12 +303,12 @@ Code * Parser::parse( const SourceLineList & lines ) { nextField = (*it); if(nextField.type() == Field::FixedString) - newPosition = line.find(QRegExp("\\b" + nextField.string() + "\\b")); + newPosition = line.tqfind(TQRegExp("\\b" + nextField.string() + "\\b")); // Although code is not neccessarily braced, after an expression it is the only // sensilbe way to have it. else if(nextField.type() == Field::Code) { - newPosition = line.find("{"); + newPosition = line.tqfind("{"); if(newPosition == -1) newPosition = line.length() + 1; } else if(nextField.type() == Field::Newline) @@ -367,7 +367,7 @@ Code * Parser::parse( const SourceLineList & lines ) case (Field::FixedString): { // Is the string found, and is it starting in the right place? - int stringPosition = line.find(QRegExp("\\b"+field.string()+"\\b")); + int stringPosition = line.tqfind(TQRegExp("\\b"+field.string()+"\\b")); if( stringPosition != position || stringPosition == -1 ) { if( !field.compulsory() ) @@ -402,7 +402,7 @@ Code * Parser::parse( const SourceLineList & lines ) if( nextField.type() == Field::FixedString ) { nextStatement = *(++StatementList::Iterator(sit)); - newPosition = nextStatement.text().find(QRegExp("\\b" + nextField.string() + "\\b")); + newPosition = nextStatement.text().tqfind(TQRegExp("\\b" + nextField.string() + "\\b")); if(newPosition != 0) { // If the next field is optional just carry on as nothing happened, @@ -458,15 +458,15 @@ Code * Parser::parse( const SourceLineList & lines ) return m_code; } -bool Parser::processAssignment(const QString &line) +bool Parser::processAssignment(const TQString &line) { - QStringList tokens = Statement::tokenise(line); + TQStringList tokens = Statement::tokenise(line); // Have to have at least 3 tokens for an assignment; if ( tokens.size() < 3 ) return false; - QString firstToken = tokens[0]; + TQString firstToken = tokens[0]; firstToken = mb->alias(firstToken); // Well firstly we look to see if it is a known variable. @@ -476,7 +476,7 @@ bool Parser::processAssignment(const QString &line) // Look for port variables first. - if ( firstToken.contains(".") ) + if ( firstToken.tqcontains(".") ) { PortPin portPin = m_pPic->toPortPin( firstToken ); @@ -487,7 +487,7 @@ bool Parser::processAssignment(const QString &line) if ( tokens[1] != "=" ) mistake( Microbe::UnassignedPin ); - QString state = tokens[2]; + TQString state = tokens[2]; if( state == "high" ) m_pPic->Ssetlh( portPin, true ); else if( state == "low" ) @@ -502,14 +502,14 @@ bool Parser::processAssignment(const QString &line) if ( tokens[1] != "=" ) mistake( Microbe::UnassignedPort, tokens[1] ); - Expression( m_pPic, mb, m_currentSourceLine, false ).compileExpression(line.mid(line.find("=")+1)); + Expression( m_pPic, mb, m_currentSourceLine, false ).compileExpression(line.mid(line.tqfind("=")+1)); m_pPic->saveResultToVar( firstToken ); } else if ( m_pPic->isValidTris( firstToken ) ) { if( tokens[1] == "=" ) { - Expression( m_pPic, mb, m_currentSourceLine, false ).compileExpression(line.mid(line.find("=")+1)); + Expression( m_pPic, mb, m_currentSourceLine, false ).compileExpression(line.mid(line.tqfind("=")+1)); m_pPic->Stristate(firstToken); } } @@ -529,7 +529,7 @@ bool Parser::processAssignment(const QString &line) // hasn't been defined yet. mb->addVariable( Variable( Variable::charType, firstToken ) ); - Expression( m_pPic, mb, m_currentSourceLine, false ).compileExpression(line.mid(line.find("=")+1)); + Expression( m_pPic, mb, m_currentSourceLine, false ).compileExpression(line.mid(line.tqfind("=")+1)); Variable v = mb->variable( firstToken ); switch ( v.type() ) @@ -588,7 +588,7 @@ SourceLineList Parser::getBracedCode( SourceLineList::const_iterator * it, Sourc } -void Parser::processStatement( const QString & name, const OutputFieldMap & fieldMap ) +void Parser::processStatement( const TQString & name, const OutputFieldMap & fieldMap ) { // Name is guaranteed to be something known, the calling // code has taken care of that. Also fieldMap is guaranteed to contain @@ -625,7 +625,7 @@ void Parser::processStatement( const QString & name, const OutputFieldMap & fiel } else if( name == "interrupt" ) { - QString interrupt = fieldMap["label"].string(); + TQString interrupt = fieldMap["label"].string(); if(!m_bPassedEnd) { @@ -653,7 +653,7 @@ void Parser::processStatement( const QString & name, const OutputFieldMap & fiel } else if( name == "for" ) { - QString step = fieldMap["stepExpression"].string(); + TQString step = fieldMap["stepExpression"].string(); bool stepPositive; if( fieldMap["stepExpression"].found() ) @@ -676,8 +676,8 @@ void Parser::processStatement( const QString & name, const OutputFieldMap & fiel stepPositive = true; } - QString variable = fieldMap["initExpression"].string().mid(0,fieldMap["initExpression"].string().find("=")).stripWhiteSpace(); - QString endExpr = variable+ " <= " + fieldMap["toExpression"].string().stripWhiteSpace(); + TQString variable = fieldMap["initExpression"].string().mid(0,fieldMap["initExpression"].string().tqfind("=")).stripWhiteSpace(); + TQString endExpr = variable+ " <= " + fieldMap["toExpression"].string().stripWhiteSpace(); if( fieldMap["stepExpression"].found() ) { @@ -698,8 +698,8 @@ void Parser::processStatement( const QString & name, const OutputFieldMap & fiel // The alias should be the key since two aliases could // point to the same name. - QString alias = fieldMap["alias"].string().stripWhiteSpace(); - QString dest = fieldMap["dest"].string().stripWhiteSpace(); + TQString alias = fieldMap["alias"].string().stripWhiteSpace(); + TQString dest = fieldMap["dest"].string().stripWhiteSpace(); // Check to see whether or not we've already aliased it... // if ( mb->alias(alias) != alias ) @@ -709,7 +709,7 @@ void Parser::processStatement( const QString & name, const OutputFieldMap & fiel } else if( name == "increment" ) { - QString variableName = fieldMap["variable"].string(); + TQString variableName = fieldMap["variable"].string(); if ( !mb->isVariableKnown( variableName ) ) mistake( Microbe::UnknownVariable ); @@ -720,7 +720,7 @@ void Parser::processStatement( const QString & name, const OutputFieldMap & fiel } else if( name == "decrement" ) { - QString variableName = fieldMap["variable"].string(); + TQString variableName = fieldMap["variable"].string(); if ( !mb->isVariableKnown( variableName ) ) mistake( Microbe::UnknownVariable ); @@ -731,7 +731,7 @@ void Parser::processStatement( const QString & name, const OutputFieldMap & fiel } else if( name == "rotateleft" ) { - QString variableName = fieldMap["variable"].string(); + TQString variableName = fieldMap["variable"].string(); if ( !mb->isVariableKnown( variableName ) ) mistake( Microbe::UnknownVariable ); @@ -742,7 +742,7 @@ void Parser::processStatement( const QString & name, const OutputFieldMap & fiel } else if( name == "rotateright" ) { - QString variableName = fieldMap["variable"].string(); + TQString variableName = fieldMap["variable"].string(); if ( !mb->isVariableKnown( variableName ) ) mistake( Microbe::UnknownVariable ); @@ -760,7 +760,7 @@ void Parser::processStatement( const QString & name, const OutputFieldMap & fiel // This is one of the rare occasions that the number will be bigger than a byte, // so suppressNumberTooBig must be used bool isConstant; - QString delay = processConstant(fieldMap["expression"].string(),&isConstant,true); + TQString delay = processConstant(fieldMap["expression"].string(),&isConstant,true); if (!isConstant) mistake( Microbe::NonConstantDelay ); // else m_pPic->Sdelay( fieldMap["expression"].string(), ""); @@ -776,8 +776,8 @@ void Parser::processStatement( const QString & name, const OutputFieldMap & fiel } else if ( name == "keypad" || name == "sevenseg" ) { - QStringList pins = QStringList::split( ' ', fieldMap["pinlist"].string() ); - QString variableName = fieldMap["name"].string(); + TQStringList pins = TQStringList::split( ' ', fieldMap["pinlist"].string() ); + TQString variableName = fieldMap["name"].string(); if ( mb->isVariableKnown( variableName ) ) { @@ -787,8 +787,8 @@ void Parser::processStatement( const QString & name, const OutputFieldMap & fiel PortPinList pinList; - QStringList::iterator end = pins.end(); - for ( QStringList::iterator it = pins.begin(); it != end; ++it ) + TQStringList::iterator end = pins.end(); + for ( TQStringList::iterator it = pins.begin(); it != end; ++it ) { PortPin portPin = m_pPic->toPortPin(*it); if ( portPin.pin() == -1 ) @@ -822,22 +822,22 @@ void Parser::processStatement( const QString & name, const OutputFieldMap & fiel } -void Parser::mistake( Microbe::MistakeType type, const QString & context ) +void Parser::mistake( Microbe::MistakeType type, const TQString & context ) { mb->compileError( type, context, m_currentSourceLine ); } // static function -QStringList Statement::tokenise(const QString &line) +TQStringList Statement::tokenise(const TQString &line) { - QStringList result; - QString current; + TQStringList result; + TQString current; int count = 0; for(int i = 0; i < int(line.length()); i++) { - QChar nextChar = line[i]; + TQChar nextChar = line[i]; if( nextChar.isSpace() ) { if( count > 0 ) @@ -903,7 +903,7 @@ int Parser::doArithmetic(int lvalue, int rvalue, Expression::Operation op) return -1; } -bool Parser::isLiteral( const QString &text ) +bool Parser::isLiteral( const TQString &text ) { bool ok; literalToInt( text, & ok ); @@ -922,7 +922,7 @@ Literal's in form: Everything else is non-literal... */ -int Parser::literalToInt( const QString &literal, bool * ok ) +int Parser::literalToInt( const TQString &literal, bool * ok ) { bool temp; if ( !ok ) @@ -948,14 +948,14 @@ int Parser::literalToInt( const QString &literal, bool * ok ) return *ok ? value : -1; } - // otherwise, let QString try and convert it + // otherwise, let TQString try and convert it // base 0 == automatic base guessing value = literal.toInt( ok, 0 ); return *ok ? value : -1; } -void Parser::compileConditionalExpression( const QString & expression, Code * ifCode, Code * elseCode ) const +void Parser::compileConditionalExpression( const TQString & expression, Code * ifCode, Code * elseCode ) const { ///HACK ///TODO this is a little improper, I don't think we should be using the pic that called us... @@ -963,7 +963,7 @@ void Parser::compileConditionalExpression( const QString & expression, Code * if } -QString Parser::processConstant(const QString &expression, bool * isConstant, bool suppressNumberTooBig) const +TQString Parser::processConstant(const TQString &expression, bool * isConstant, bool suppressNumberTooBig) const { return Expression( m_pPic, mb, m_currentSourceLine, suppressNumberTooBig ).processConstant(expression, isConstant); } @@ -979,7 +979,7 @@ Field::Field() } -Field::Field( Type type, const QString & key ) +Field::Field( Type type, const TQString & key ) { m_type = type; m_compulsory = false; @@ -987,7 +987,7 @@ Field::Field( Type type, const QString & key ) } -Field::Field( Type type, const QString & key, const QString & string, bool compulsory ) +Field::Field( Type type, const TQString & key, const TQString & string, bool compulsory ) { m_type = type; m_compulsory = compulsory; @@ -1011,7 +1011,7 @@ OutputField::OutputField( const SourceLineList & bracedCode ) m_found = true; } -OutputField::OutputField( const QString & string/*, int lineNumber*/ ) +OutputField::OutputField( const TQString & string/*, int lineNumber*/ ) { m_string = string; m_found = true; @@ -1027,17 +1027,17 @@ OutputField::OutputField( const QString & string/*, int lineNumber*/ ) { // only cope with 'sane' strings a.t.m. // e.g. include "filename.extenstion" - QString filename = (*sit).content.mid( (*sit).content.find("\"") ).stripWhiteSpace(); + TQString filename = (*sit).content.mid( (*sit).content.tqfind("\"") ).stripWhiteSpace(); // don't strip whitespace from within quotes as you // can have filenames composed entirely of spaces (kind of weird)... // remove quotes. filename = filename.mid(1); filename = filename.mid(0,filename.length()-1); - QFile includeFile(filename); + TQFile includeFile(filename); if( includeFile.open(IO_ReadOnly) ) { - QTextStream stream( &includeFile ); - QStringList includeCode; + TQTextStream stream( &includeFile ); + TQStringList includeCode; while( !stream.atEnd() ) { includeCode += stream.readLine(); diff --git a/microbe/parser.h b/microbe/parser.h index ece433d..7a51e41 100644 --- a/microbe/parser.h +++ b/microbe/parser.h @@ -25,8 +25,8 @@ #include "instruction.h" #include "microbe.h" -#include "qmap.h" -#include "qvaluelist.h" +#include "tqmap.h" +#include "tqvaluelist.h" class PIC14; @@ -48,7 +48,7 @@ class Statement /** * Returns the microbe code from content. */ - QString text() const { return content.text(); } + TQString text() const { return content.text(); } /** * If this Statement is for a for loop, then content will contain * something like "for x = 1 to 10", and bracedCode will contain the @@ -62,11 +62,11 @@ class Statement /** * This breaks up the line seperated by spaces,{,and =/ */ - static QStringList tokenise(const QString &line); + static TQStringList tokenise(const TQString &line); /** - * @see tokenise(const QString &line) + * @see tokenise(const TQString &line) */ - QStringList tokenise() const { return tokenise( content.text() ); } + TQStringList tokenise() const { return tokenise( content.text() ); } /** * @returns whether or not the content looks like a label (ends with a * colon). @@ -74,7 +74,7 @@ class Statement bool isLabel() const { return content.text().right(1) == ":"; } }; -typedef QValueList<Statement> StatementList; +typedef TQValueList<Statement> StatementList; /** @author Daniel Clarke @@ -114,12 +114,12 @@ class Field /** * Create a Field. */ - Field( Type type, const QString & key = 0 ); + Field( Type type, const TQString & key = 0 ); /** * Create a Field (this constructor should only be used with * FixedStrings. */ - Field( Type type, const QString & key, const QString & string, bool compulsory = true); + Field( Type type, const TQString & key, const TQString & string, bool compulsory = true); /** * The type of field expected. @@ -128,13 +128,13 @@ class Field /** * String data relevant to the field dependent on m_type. */ - QString string() const { return m_string; } + TQString string() const { return m_string; } /** * The key in which the found token will be attached to * in the output map. If it is an empty string, then the field will be * processed but not put in the output, effectively ignoring it. */ - QString key() const { return m_key; } + TQString key() const { return m_key; } /** * Only FixedStrings may be compulsory, that is the only type that can * actually have its presence checked. @@ -147,8 +147,8 @@ class Field private: Type m_type; - QString m_string; - QString m_key; + TQString m_string; + TQString m_key; bool m_compulsory; }; @@ -167,14 +167,14 @@ class OutputField /** * Constructs an output field consisting of a single string. */ - OutputField( const QString &string ); + OutputField( const TQString &string ); - QString string() const { return m_string; } + TQString string() const { return m_string; } SourceLineList bracedCode() const { return m_bracedCode; } bool found() const { return m_found; } private: - QString m_string; + TQString m_string; SourceLineList m_bracedCode; /** * This specifies if a non compulsory field was found or not. @@ -182,9 +182,9 @@ class OutputField bool m_found; }; -typedef QValueList<Field> StatementDefinition; -typedef QMap<QString,StatementDefinition> DefinitionMap; -typedef QMap<QString,OutputField> OutputFieldMap; +typedef TQValueList<Field> StatementDefinition; +typedef TQMap<TQString,StatementDefinition> DefinitionMap; +typedef TQMap<TQString,OutputField> OutputFieldMap; /** @@ -203,7 +203,7 @@ class Parser * message, only applicable to some errors (such as a use of a reserved * keyword). */ - void mistake( Microbe::MistakeType type, const QString & context = 0 ); + void mistake( Microbe::MistakeType type, const TQString & context = 0 ); /** * Creates a new instance of the parser class with all state information * (class members) copied from this instance of the class. Don't forget to @@ -241,21 +241,21 @@ class Parser * 1 = variable. * 2 = expression that needs evaluating. */ - ExprType getExpressionType( const QString & expression ); + ExprType getExpressionType( const TQString & expression ); /** * Examines the text to see if it looks like a literal, i.e. of the form * "321890","021348","0x3C","b'0100110'","0101001b","h'43A'", or "2Ah". * Everything else is considered non-literal. * @see literalToInt. */ - static bool isLiteral( const QString &text ); + static bool isLiteral( const TQString &text ); /** * Tries to convert the given literal string into a integer. If it fails, * i.e. it is not any recognised literal, then it returns -1 and sets *ok to * false. Else, *ok is set to true and the literal value is returned. * @see isLiteral */ - static int literalToInt( const QString & literal, bool * ok = 0l ); + static int literalToInt( const TQString & literal, bool * ok = 0l ); /** * Does the specified operation on the given numbers and returns the result. */ @@ -264,10 +264,10 @@ class Parser * @return whether it was an assignment (which might not have been in * the proper form). */ - bool processAssignment(const QString &line); + bool processAssignment(const TQString &line); - void compileConditionalExpression( const QString & expression, Code * ifCode, Code * elseCode ) const; - QString processConstant(const QString &expression, bool * isConstant, bool suppressNumberTooBig = false) const; + void compileConditionalExpression( const TQString & expression, Code * ifCode, Code * elseCode ) const; + TQString processConstant(const TQString &expression, bool * isConstant, bool suppressNumberTooBig = false) const; private: /** @@ -276,7 +276,7 @@ class Parser * @param name Name of the statement to be processed * @param fieldMap A map of named fields as appropriate to the statement */ - void processStatement( const QString & name, const OutputFieldMap & fieldMap ); + void processStatement( const TQString & name, const OutputFieldMap & fieldMap ); DefinitionMap m_definitionMap; PIC14 * m_pPic; diff --git a/microbe/pic14.cpp b/microbe/pic14.cpp index 7785afb..548d4de 100644 --- a/microbe/pic14.cpp +++ b/microbe/pic14.cpp @@ -62,20 +62,20 @@ PIC14::~PIC14() { } -PortPin PIC14::toPortPin( const QString & portPinString ) +PortPin PIC14::toPortPin( const TQString & portPinString ) { - QString port; + TQString port; int pin = -1; // In form e.g. RB3 if ( portPinString.length() == 3 ) { - port = QString("PORT%1").arg( portPinString[1].upper() ); - pin = QString( portPinString[2] ).toInt(); + port = TQString("PORT%1").tqarg( portPinString[1].upper() ); + pin = TQString( portPinString[2] ).toInt(); } else { - int dotpos = portPinString.find("."); + int dotpos = portPinString.tqfind("."); if ( dotpos == -1 ) return PortPin(); @@ -119,9 +119,9 @@ uchar PIC14::gprStart() const } -PIC14::Type PIC14::toType( const QString & _text ) +PIC14::Type PIC14::toType( const TQString & _text ) { - QString text = _text.upper().simplifyWhiteSpace().remove('P'); + TQString text = _text.upper().simplifyWhiteSpace().remove('P'); if ( text == "16C84" ) return P16C84; @@ -135,12 +135,12 @@ PIC14::Type PIC14::toType( const QString & _text ) if ( text == "16F628" ) return P16F628; - cerr << QString("%1 is not a known PIC identifier\n").arg(_text); + cerr << TQString("%1 is not a known PIC identifier\n").tqarg(_text); return unknown; } -QString PIC14::minimalTypeString() const +TQString PIC14::minimalTypeString() const { switch ( m_type ) { @@ -165,7 +165,7 @@ QString PIC14::minimalTypeString() const } -void PIC14::postCompileConstruct( const QStringList &interrupts ) +void PIC14::postCompileConstruct( const TQStringList &interrupts ) { m_pCode->append( new Instr_raw("\n\tEND\n"), Code::Subroutine ); @@ -203,11 +203,11 @@ void PIC14::postCompileConstruct( const QStringList &interrupts ) m_pCode->append(new Instr_swapf("STATUS",0), Code::InterruptHandler); m_pCode->append(new Instr_movwf("STATUS_TEMP"), Code::InterruptHandler); - QStringList::ConstIterator interruptsEnd = interrupts.end(); - for( QStringList::ConstIterator it = interrupts.begin(); it != interruptsEnd; ++it ) + TQStringList::ConstIterator interruptsEnd = interrupts.end(); + for( TQStringList::ConstIterator it = interrupts.begin(); it != interruptsEnd; ++it ) { // Is the interrupt's flag bit set? - m_pCode->append(new Instr_btfsc("INTCON",QString::number(interruptNameToBit((*it), true))), Code::InterruptHandler); + m_pCode->append(new Instr_btfsc("INTCON",TQString::number(interruptNameToBit((*it), true))), Code::InterruptHandler); m_pCode->append(new Instr_goto("_interrupt_" + (*it)), Code::InterruptHandler); // Yes, do its handler routine // Otherwise fall through to the next. } @@ -225,7 +225,7 @@ void PIC14::postCompileConstruct( const QStringList &interrupts ) m_pCode->queueLabel( "_start", Code::LookupTable ); } -int PIC14::interruptNameToBit(const QString &name, bool flag) +int PIC14::interruptNameToBit(const TQString &name, bool flag) { // 7 --- GIE EEIE T0IE INTE RBIE T0IF INTF RBIF --- 0 @@ -249,7 +249,7 @@ int PIC14::interruptNameToBit(const QString &name, bool flag) } -bool PIC14::isValidPort( const QString & portName ) const +bool PIC14::isValidPort( const TQString & portName ) const { return ( portName == "PORTA" || portName == "porta" || portName == "PORTB" || portName == "portb" ); @@ -268,14 +268,14 @@ bool PIC14::isValidPortPin( const PortPin & portPin ) const } -bool PIC14::isValidTris( const QString & trisName ) const +bool PIC14::isValidTris( const TQString & trisName ) const { return ( trisName == "TRISA" || trisName == "trisa" || trisName == "TRISB" || trisName == "trisb" ); } -bool PIC14::isValidInterrupt( const QString & interruptName ) const +bool PIC14::isValidInterrupt( const TQString & interruptName ) const { if(m_type == "P16F84" || m_type =="P16C84") { @@ -293,12 +293,12 @@ void PIC14::setConditionalCode( Code * ifCode, Code * elseCode ) m_elseCode = elseCode; } -void PIC14::Sgoto(const QString &label) +void PIC14::Sgoto(const TQString &label) { m_pCode->append( new Instr_goto(label) ); } -void PIC14::Slabel(const QString &label) +void PIC14::Slabel(const TQString &label) { // std::cout << k_funcinfo << "label="<<label<<'\n'; m_pCode->queueLabel( label, Code::Middle ); @@ -309,26 +309,26 @@ void PIC14::Send() m_pCode->append( new Instr_sleep() ); } -void PIC14::Ssubroutine( const QString &procName, Code * subCode ) +void PIC14::Ssubroutine( const TQString &procName, Code * subCode ) { m_pCode->queueLabel( procName, Code::Subroutine ); m_pCode->merge( subCode, Code::Subroutine ); m_pCode->append( new Instr_return(), Code::Subroutine ); } -void PIC14::Sinterrupt( const QString &procName, Code * subCode ) +void PIC14::Sinterrupt( const TQString &procName, Code * subCode ) { m_pCode->queueLabel( "_interrupt_" + procName, Code::Subroutine ); // Clear the interrupt flag for this particular interrupt source - m_pCode->append( new Instr_bcf("INTCON",QString::number(interruptNameToBit(procName,true))) ); + m_pCode->append( new Instr_bcf("INTCON",TQString::number(interruptNameToBit(procName,true))) ); m_pCode->merge( subCode, Code::Subroutine ); m_pCode->append( new Instr_goto("_interrupt_end"), Code::Subroutine ); } -void PIC14::Scall(const QString &name) +void PIC14::Scall(const TQString &name) { m_pCode->append( new Instr_call(name) ); } @@ -337,17 +337,17 @@ void PIC14::Scall(const QString &name) void PIC14::Ssetlh( const PortPin & portPin, bool high) { if(high) - m_pCode->append( new Instr_bsf( portPin.port(),QString::number(portPin.pin()) ) ); + m_pCode->append( new Instr_bsf( portPin.port(),TQString::number(portPin.pin()) ) ); else - m_pCode->append( new Instr_bcf( portPin.port(), QString::number(portPin.pin()) ) ); + m_pCode->append( new Instr_bcf( portPin.port(), TQString::number(portPin.pin()) ) ); } -void PIC14::rearrangeOpArguments( QString * val1, QString * val2, LocationType * val1Type, LocationType * val2Type) +void PIC14::rearrangeOpArguments( TQString * val1, TQString * val2, LocationType * val1Type, LocationType * val2Type) { if( *val2Type == work && *val1Type != work ) { LocationType tempType = *val2Type; - QString tempVal = *val2; + TQString tempVal = *val2; *val2Type = *val1Type; *val2 = *val1; @@ -357,7 +357,7 @@ void PIC14::rearrangeOpArguments( QString * val1, QString * val2, LocationType * } } -void PIC14::add( QString val1, QString val2, LocationType val1Type, LocationType val2Type ) +void PIC14::add( TQString val1, TQString val2, LocationType val1Type, LocationType val2Type ) { rearrangeOpArguments( &val1, &val2, &val1Type, &val2Type ); @@ -376,7 +376,7 @@ void PIC14::add( QString val1, QString val2, LocationType val1Type, LocationType } } -void PIC14::subtract( const QString & val1, const QString & val2, LocationType val1Type, LocationType val2Type ) +void PIC14::subtract( const TQString & val1, const TQString & val2, LocationType val1Type, LocationType val2Type ) { switch(val2Type) { @@ -392,27 +392,27 @@ void PIC14::subtract( const QString & val1, const QString & val2, LocationType v } } -void PIC14::assignNum(const QString & val) +void PIC14::assignNum(const TQString & val) { m_pCode->append(new Instr_movlw(val.toInt( 0, 0 ))); } -void PIC14::assignVar(const QString &val) +void PIC14::assignVar(const TQString &val) { m_pCode->append(new Instr_movf(val,0)); } -void PIC14::saveToReg(const QString &dest) +void PIC14::saveToReg(const TQString &dest) { m_pCode->append(new Instr_movwf(dest)); } -void PIC14::saveResultToVar( const QString & var ) +void PIC14::saveResultToVar( const TQString & var ) { m_pCode->append( new Instr_movwf( var ) ); } -void PIC14::mul(QString val1, QString val2, LocationType val1Type, LocationType val2Type) +void PIC14::mul(TQString val1, TQString val2, LocationType val1Type, LocationType val2Type) { multiply(); @@ -465,7 +465,7 @@ void PIC14::multiply() } -void PIC14::div( const QString & val1, const QString & val2, LocationType val1Type, LocationType val2Type) +void PIC14::div( const TQString & val1, const TQString & val2, LocationType val1Type, LocationType val2Type) { divide(); @@ -549,7 +549,7 @@ Code * PIC14::elseCode() } -void PIC14::ifInitCode( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ) +void PIC14::ifInitCode( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ) { // NOO - "x < 2" is NOT the same as "2 < x" // rearrangeOpArguments( val1, val2, val1Type, val2Type ); @@ -584,11 +584,11 @@ void PIC14::ifInitCode( const QString &val1, const QString &val2, LocationType v } } -void PIC14::equal( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ) +void PIC14::equal( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ) { ifInitCode( val1, val2, val1Type, val2Type ); - const QString labelEnd = mb->uniqueLabel()+"_endif"; - const QString labelFalse = mb->uniqueLabel()+"_case_false"; + const TQString labelEnd = mb->uniqueLabel()+"_endif"; + const TQString labelFalse = mb->uniqueLabel()+"_case_false"; m_pCode->append(new Instr_btfss("STATUS","2")); m_pCode->append(new Instr_goto(labelFalse)); @@ -602,11 +602,11 @@ void PIC14::equal( const QString &val1, const QString &val2, LocationType val1Ty m_pCode->queueLabel( labelEnd ); } -void PIC14::notEqual( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ) +void PIC14::notEqual( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ) { ifInitCode( val1, val2, val1Type, val2Type ); - const QString labelEnd = mb->uniqueLabel()+"_endif"; - const QString labelFalse = mb->uniqueLabel()+"_case_false"; + const TQString labelEnd = mb->uniqueLabel()+"_endif"; + const TQString labelFalse = mb->uniqueLabel()+"_case_false"; m_pCode->append(new Instr_btfsc("STATUS","2")); m_pCode->append(new Instr_goto(labelFalse)); @@ -620,11 +620,11 @@ void PIC14::notEqual( const QString &val1, const QString &val2, LocationType val m_pCode->queueLabel( labelEnd ); } -void PIC14::greaterThan( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ) +void PIC14::greaterThan( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ) { ifInitCode( val1, val2, val1Type, val2Type ); - const QString labelEnd = mb->uniqueLabel()+"_endif"; - const QString labelFalse = mb->uniqueLabel()+"_case_false"; + const TQString labelEnd = mb->uniqueLabel()+"_endif"; + const TQString labelFalse = mb->uniqueLabel()+"_case_false"; m_pCode->append(new Instr_btfsc("STATUS","0")); m_pCode->append(new Instr_goto(labelFalse)); @@ -637,12 +637,12 @@ void PIC14::greaterThan( const QString &val1, const QString &val2, LocationType m_pCode->queueLabel( labelEnd ); } -void PIC14::lessThan( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ) +void PIC14::lessThan( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ) { cout << k_funcinfo << endl; ifInitCode( val1, val2, val1Type, val2Type ); - const QString labelEnd = mb->uniqueLabel()+"_endif"; - const QString labelFalse = mb->uniqueLabel()+"_case_false"; + const TQString labelEnd = mb->uniqueLabel()+"_endif"; + const TQString labelFalse = mb->uniqueLabel()+"_case_false"; m_pCode->append(new Instr_btfss("STATUS","0")); m_pCode->append(new Instr_goto(labelFalse)); @@ -658,11 +658,11 @@ void PIC14::lessThan( const QString &val1, const QString &val2, LocationType val m_pCode->queueLabel( labelEnd ); } -void PIC14::greaterOrEqual( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ) +void PIC14::greaterOrEqual( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ) { ifInitCode( val1, val2, val1Type, val2Type ); - const QString labelEnd = mb->uniqueLabel()+"_endif"; - const QString labelTrue = mb->uniqueLabel()+"_case_true"; // Note that unlike the others, this is labelTrue, not labelFalse + const TQString labelEnd = mb->uniqueLabel()+"_endif"; + const TQString labelTrue = mb->uniqueLabel()+"_case_true"; // Note that unlike the others, this is labelTrue, not labelFalse m_pCode->append(new Instr_btfsc("STATUS","2")); m_pCode->append(new Instr_goto(labelTrue)); @@ -678,11 +678,11 @@ void PIC14::greaterOrEqual( const QString &val1, const QString &val2, LocationTy m_pCode->queueLabel( labelEnd ); } -void PIC14::lessOrEqual( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ) +void PIC14::lessOrEqual( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ) { ifInitCode( val1, val2, val1Type, val2Type ); - const QString labelEnd = mb->uniqueLabel()+"_endif"; - const QString labelFalse = mb->uniqueLabel()+"_case_false"; + const TQString labelEnd = mb->uniqueLabel()+"_endif"; + const TQString labelFalse = mb->uniqueLabel()+"_case_false"; m_pCode->append(new Instr_btfss("STATUS","0")); m_pCode->append(new Instr_goto(labelFalse)); @@ -696,10 +696,10 @@ void PIC14::lessOrEqual( const QString &val1, const QString &val2, LocationType } -void PIC14::Swhile( Code * whileCode, const QString &expression) +void PIC14::Swhile( Code * whileCode, const TQString &expression) { - QString result; - QString ul = mb->uniqueLabel(); + TQString result; + TQString ul = mb->uniqueLabel(); whileCode->append( new Instr_goto(ul) ); @@ -710,10 +710,10 @@ void PIC14::Swhile( Code * whileCode, const QString &expression) } -void PIC14::Srepeat( Code * repeatCode, const QString &expression) +void PIC14::Srepeat( Code * repeatCode, const TQString &expression) { - QString result; - QString ul = mb->uniqueLabel(); + TQString result; + TQString ul = mb->uniqueLabel(); Code * elseCode = new Code; elseCode->append( new Instr_goto(ul) ); @@ -725,15 +725,15 @@ void PIC14::Srepeat( Code * repeatCode, const QString &expression) m_parser->compileConditionalExpression( expression, 0, elseCode ); } -void PIC14::Sif( Code * ifCode, Code * elseCode, const QString &expression) +void PIC14::Sif( Code * ifCode, Code * elseCode, const TQString &expression) { m_parser->compileConditionalExpression( expression, ifCode, elseCode ); } -void PIC14::Sfor( Code * forCode, Code * initCode, const QString &expression, const QString &variable, const QString &step, bool stepPositive) +void PIC14::Sfor( Code * forCode, Code * initCode, const TQString &expression, const TQString &variable, const TQString &step, bool stepPositive) { - QString ul = mb->uniqueLabel(); + TQString ul = mb->uniqueLabel(); if ( step == "1" ) { @@ -762,7 +762,7 @@ void PIC14::Sfor( Code * forCode, Code * initCode, const QString &expression, co void PIC14::Spin( const PortPin & portPin, bool NOT) { - QString lowLabel, highLabel, postLabel; + TQString lowLabel, highLabel, postLabel; lowLabel = mb->uniqueLabel(); highLabel = mb->uniqueLabel(); postLabel = mb->uniqueLabel(); @@ -772,10 +772,10 @@ void PIC14::Spin( const PortPin & portPin, bool NOT) result += postLabel + ;*/ if(NOT) - m_pCode->append(new Instr_btfsc( portPin.port(), QString::number( portPin.pin() ) )); - //result +=instruction((QString)(NOT?"btfsc":"btfss")+"\t"+port+","+pin); + m_pCode->append(new Instr_btfsc( portPin.port(), TQString::number( portPin.pin() ) )); + //result +=instruction((TQString)(NOT?"btfsc":"btfss")+"\t"+port+","+pin); else - m_pCode->append(new Instr_btfss( portPin.port(), QString::number( portPin.pin() ) )); + m_pCode->append(new Instr_btfss( portPin.port(), TQString::number( portPin.pin() ) )); m_pCode->append(new Instr_goto(lowLabel));//result += instruction("goto\t" + lowLabel); mergeCode( ifCode() ); @@ -863,7 +863,7 @@ void PIC14::addCommonFunctions( DelaySubroutine delay ) { if ( delay != Delay_None ) { - QString subName = "__delay_subroutine"; + TQString subName = "__delay_subroutine"; m_pCode->queueLabel( subName, Code::Subroutine ); m_pCode->append( new Instr_decfsz( "__i", 1 ), Code::Subroutine ); @@ -897,7 +897,7 @@ void PIC14::SsevenSegment( const Variable & pinMap ) assert( pinMap.type() == Variable::sevenSegmentType ); assert( pinMap.portPinList().size() == 7 ); - QString subName = QString("__output_seven_segment_%1").arg( pinMap.name() ); + TQString subName = TQString("__output_seven_segment_%1").tqarg( pinMap.name() ); m_pCode->append( new Instr_call( subName ) ); @@ -967,7 +967,7 @@ void PIC14::SsevenSegment( const Variable & pinMap ) if ( !portOutput[port].used ) continue; - QString portName = QString("PORT%1").arg( char('A'+port) ); + TQString portName = TQString("PORT%1").tqarg( char('A'+port) ); // Save the current value of the port pins that we should not be writing to m_pCode->append( new Instr_movf( portName, 0 ), Code::Subroutine ); @@ -977,7 +977,7 @@ void PIC14::SsevenSegment( const Variable & pinMap ) if ( overwrittenW ) m_pCode->append( new Instr_movf("__i",0), Code::Subroutine ); - m_pCode->append( new Instr_call( subName + QString("_lookup_%1").arg(port) ), Code::Subroutine ); + m_pCode->append( new Instr_call( subName + TQString("_lookup_%1").tqarg(port) ), Code::Subroutine ); overwrittenW = true; // Restore the state of the pins which aren't used @@ -996,7 +996,7 @@ void PIC14::SsevenSegment( const Variable & pinMap ) if ( !portOutput[port].used ) continue; - m_pCode->queueLabel( subName + QString("_lookup_%1").arg(port), Code::LookupTable ); + m_pCode->queueLabel( subName + TQString("_lookup_%1").tqarg(port), Code::LookupTable ); m_pCode->append( new Instr_andlw(15), Code::LookupTable ); // Generate the lookup table @@ -1020,9 +1020,9 @@ void PIC14::Skeypad( const Variable & pinMap ) assert( pinMap.type() == Variable::keypadType ); assert( pinMap.portPinList().size() >= 7 ); // 4 rows, at least 3 columns - QString subName = QString("__wait_read_keypad_%1").arg( pinMap.name() ); - QString waitName = QString("__wait_keypad_%1").arg( pinMap.name() ); - QString readName = QString("__read_keypad_%1").arg( pinMap.name() ); + TQString subName = TQString("__wait_read_keypad_%1").tqarg( pinMap.name() ); + TQString waitName = TQString("__wait_keypad_%1").tqarg( pinMap.name() ); + TQString readName = TQString("__read_keypad_%1").tqarg( pinMap.name() ); m_pCode->append( new Instr_call( subName ) ); @@ -1070,7 +1070,7 @@ void PIC14::Skeypad( const Variable & pinMap ) for ( unsigned row = 0; row < 4; ++ row ) { PortPin rowPin = pinMap.portPinList()[row]; - m_pCode->append( new Instr_bcf( rowPin.port(), QString::number( rowPin.pin() ) ), Code::Subroutine ); + m_pCode->append( new Instr_bcf( rowPin.port(), TQString::number( rowPin.pin() ) ), Code::Subroutine ); } // Test each row in turn @@ -1078,17 +1078,17 @@ void PIC14::Skeypad( const Variable & pinMap ) { // Make the high low PortPin rowPin = pinMap.portPinList()[row]; - m_pCode->append( new Instr_bsf( rowPin.port(), QString::number( rowPin.pin() ) ), Code::Subroutine ); + m_pCode->append( new Instr_bsf( rowPin.port(), TQString::number( rowPin.pin() ) ), Code::Subroutine ); for ( unsigned col = 0; col < 3; ++ col ) { PortPin colPin = pinMap.portPinList()[4+col]; - m_pCode->append( new Instr_btfsc( colPin.port(), QString::number( colPin.pin() ) ), Code::Subroutine ); - m_pCode->append( new Instr_retlw( mb->alias( QString("Keypad_%1_%2").arg(row+1).arg(col+1) ).toInt( 0, 0 ) ), Code::Subroutine ); + m_pCode->append( new Instr_btfsc( colPin.port(), TQString::number( colPin.pin() ) ), Code::Subroutine ); + m_pCode->append( new Instr_retlw( mb->alias( TQString("Keypad_%1_%2").tqarg(row+1).tqarg(col+1) ).toInt( 0, 0 ) ), Code::Subroutine ); } // Make the low again - m_pCode->append( new Instr_bcf( rowPin.port(), QString::number( rowPin.pin() ) ), Code::Subroutine ); + m_pCode->append( new Instr_bcf( rowPin.port(), TQString::number( rowPin.pin() ) ), Code::Subroutine ); } // No key was pressed @@ -1097,16 +1097,16 @@ void PIC14::Skeypad( const Variable & pinMap ) } -void PIC14::bitwise( Expression::Operation op, const QString &r_val1, const QString &val2, bool val1IsNum, bool val2IsNum ) +void PIC14::bitwise( Expression::Operation op, const TQString &r_val1, const TQString &val2, bool val1IsNum, bool val2IsNum ) { - QString val1 = r_val1; + TQString val1 = r_val1; // There is no instruction for notting a literal, // so instead I am going to XOR with 0xFF if( op == Expression::bwnot ) val1 = "0xFF"; if( val1IsNum ) m_pCode->append(new Instr_movlw(val1.toInt( 0, 0 )));// result += instruction("movlw\t"+val1); else m_pCode->append(new Instr_movf(val1,0));//result += instruction("movf\t"+val1+",0"); - QString opString; + TQString opString; if( val2IsNum ) { switch(op) @@ -1132,27 +1132,27 @@ void PIC14::bitwise( Expression::Operation op, const QString &r_val1, const QStr } } -void PIC14::SincVar( const QString &var ) +void PIC14::SincVar( const TQString &var ) { m_pCode->append(new Instr_incf(var,1) ); } -void PIC14::SdecVar( const QString &var ) +void PIC14::SdecVar( const TQString &var ) { m_pCode->append(new Instr_decf(var,1) ); } -void PIC14::SrotlVar( const QString &var ) +void PIC14::SrotlVar( const TQString &var ) { m_pCode->append(new Instr_rlf(var,1)); } -void PIC14::SrotrVar( const QString &var ) +void PIC14::SrotrVar( const TQString &var ) { m_pCode->append(new Instr_rrf(var,1)); } -void PIC14::Stristate(const QString &port) +void PIC14::Stristate(const TQString &port) { m_pCode->append( new Instr_bsf("STATUS","5") ); @@ -1164,7 +1164,7 @@ void PIC14::Stristate(const QString &port) m_pCode->append( new Instr_bcf(Register("STATUS"),"5") ); } -void PIC14::Sasm(const QString &raw) +void PIC14::Sasm(const TQString &raw) { m_pCode->append(new Instr_asm(raw)); } @@ -1173,7 +1173,7 @@ void PIC14::Sasm(const QString &raw) //BEGIN class PortPin -PortPin::PortPin( const QString & port, int pin ) +PortPin::PortPin( const TQString & port, int pin ) { m_port = port.upper(); m_pin = pin; diff --git a/microbe/pic14.h b/microbe/pic14.h index 5fd5a40..fc97cb4 100644 --- a/microbe/pic14.h +++ b/microbe/pic14.h @@ -24,9 +24,9 @@ #include "expression.h" #include "microbe.h" -#include <qstring.h> -#include <qstringlist.h> -#include <qvaluelist.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqvaluelist.h> class Code; class Microbe; @@ -38,7 +38,7 @@ class Parser; class PortPin { public: - PortPin( const QString & port, int pin ); + PortPin( const TQString & port, int pin ); /** * Creates an invalid PortPin ( pin() will return -1). */ @@ -46,7 +46,7 @@ class PortPin /** * Returns port (uppercase). */ - QString port() const { return m_port; } + TQString port() const { return m_port; } /** * Returns the port position (e.g. "PORTA" is 0, "PORTB" is 1, etc). */ @@ -57,10 +57,10 @@ class PortPin int pin() const { return m_pin; } protected: - QString m_port; + TQString m_port; int m_pin; }; -typedef QValueList<PortPin> PortPinList; +typedef TQValueList<PortPin> PortPinList; /** @@ -103,7 +103,7 @@ class PIC14 * Tries to convert the string to a PIC type, returning unknown if * unsuccessful. */ - static Type toType( const QString & text ); + static Type toType( const TQString & text ); /** * @return the PIC type. */ @@ -111,13 +111,13 @@ class PIC14 /** * @return the Type as a string without the P at the front. */ - QString minimalTypeString() const; + TQString minimalTypeString() const; /** * Translates the portPinString (e.g. "PORTA.2") into a PortPin if the port * and pin combination is valid (otherwise returns an invalid PortPin with * a pin of -1. */ - PortPin toPortPin( const QString & portPinString ); + PortPin toPortPin( const TQString & portPinString ); /** * Returns the address that the General Purpose Registers starts at. */ @@ -134,63 +134,63 @@ class PIC14 Code * m_ifCode; Code * m_elseCode; - void postCompileConstruct( const QStringList &interrupts ); + void postCompileConstruct( const TQStringList &interrupts ); /** * @returns whether or not the port is valid. * @see isValidPortPin */ - bool isValidPort( const QString & portName ) const; + bool isValidPort( const TQString & portName ) const; /** * @returns whether or not the port and pin is a valid combination. * @see isValidPort */ bool isValidPortPin( const PortPin & portPin ) const; - bool isValidTris( const QString & trisName ) const; - bool isValidInterrupt( const QString & interruptName ) const; + bool isValidTris( const TQString & trisName ) const; + bool isValidInterrupt( const TQString & interruptName ) const; - void Sgoto(const QString &label); - void Slabel(const QString &label); + void Sgoto(const TQString &label); + void Slabel(const TQString &label); void Send(); - void Ssubroutine(const QString &procName, Code * compiledProcCode); - void Sinterrupt(const QString & procName, Code * compiledProcCode); - void Scall(const QString &name); + void Ssubroutine(const TQString &procName, Code * compiledProcCode); + void Sinterrupt(const TQString & procName, Code * compiledProcCode); + void Scall(const TQString &name); void Ssetlh( const PortPin & portPin, bool high); - void add( QString val1, QString val2, LocationType val1Type, LocationType val2Type ); - void subtract( const QString & val1, const QString & val2, LocationType val1Type, LocationType val2Type ); - void mul( QString val1, QString val2, LocationType val1Type, LocationType val2Type); - void div( const QString & val1, const QString & val2, LocationType val1Type, LocationType val2Type); + void add( TQString val1, TQString val2, LocationType val1Type, LocationType val2Type ); + void subtract( const TQString & val1, const TQString & val2, LocationType val1Type, LocationType val2Type ); + void mul( TQString val1, TQString val2, LocationType val1Type, LocationType val2Type); + void div( const TQString & val1, const TQString & val2, LocationType val1Type, LocationType val2Type); - void assignNum(const QString & val); - void assignVar(const QString & val); + void assignNum(const TQString & val); + void assignVar(const TQString & val); - void saveToReg(const QString &dest); + void saveToReg(const TQString &dest); /** * Move the contents of the working register to the register with the given * name. */ - void saveResultToVar( const QString & var ); + void saveResultToVar( const TQString & var ); /** Code for "==" */ - void equal( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ); + void equal( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ); /** Code for "!=" */ - void notEqual( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ); + void notEqual( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ); /** Code for ">" */ - void greaterThan( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ); + void greaterThan( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ); /** Code for "<" */ - void lessThan( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ); + void lessThan( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ); /** Code for ">=" */ - void greaterOrEqual( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ); + void greaterOrEqual( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ); /** Code for "<=" */ - void lessOrEqual( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ); + void lessOrEqual( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ); - void bitwise( Expression::Operation op, const QString &val1, const QString &val2, bool val1IsNum, bool val2IsNum ); + void bitwise( Expression::Operation op, const TQString &val1, const TQString &val2, bool val1IsNum, bool val2IsNum ); - void Swhile( Code * whileCode, const QString &expression); - void Srepeat( Code * repeatCode, const QString &expression); - void Sif( Code * ifCode, Code * elseCode, const QString &expression); - void Sfor( Code * forCode, Code * initCode, const QString &expression, const QString &variable, const QString &step, bool stepPositive); + void Swhile( Code * whileCode, const TQString &expression); + void Srepeat( Code * repeatCode, const TQString &expression); + void Sif( Code * ifCode, Code * elseCode, const TQString &expression); + void Sfor( Code * forCode, Code * initCode, const TQString &expression, const TQString &variable, const TQString &step, bool stepPositive); void Spin( const PortPin & portPin, bool NOT); void addCommonFunctions( DelaySubroutine delay ); @@ -215,14 +215,14 @@ class PIC14 void Skeypad( const Variable & pinMap ); //END "Special Functionality" functions - void SincVar( const QString &var ); - void SdecVar( const QString &var ); - void SrotlVar( const QString &var ); - void SrotrVar( const QString &var ); + void SincVar( const TQString &var ); + void SdecVar( const TQString &var ); + void SrotlVar( const TQString &var ); + void SrotrVar( const TQString &var ); - void Stristate( const QString &port ); + void Stristate( const TQString &port ); - void Sasm(const QString &raw); + void Sasm(const TQString &raw); protected: void multiply(); @@ -235,19 +235,19 @@ class PIC14 Microbe * mb; Code * m_pCode; - void ifInitCode( const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type ); + void ifInitCode( const TQString &val1, const TQString &val2, LocationType val1Type, LocationType val2Type ); /** * The function makes sure that val1 always contains a working register * variable, if one has been passed, this is done by swapping val1 and val2 when * neccessary */ - void rearrangeOpArguments( QString * val1, QString * val2, LocationType * val1Type, LocationType * val2Type); + void rearrangeOpArguments( TQString * val1, TQString * val2, LocationType * val1Type, LocationType * val2Type); /** * @param flag True means give flag bit, false means give enable bit instead */ - int interruptNameToBit(const QString &name, bool flag); + int interruptNameToBit(const TQString &name, bool flag); }; #endif diff --git a/microbe/traverser.cpp b/microbe/traverser.cpp index e066381..3436d0c 100644 --- a/microbe/traverser.cpp +++ b/microbe/traverser.cpp @@ -34,8 +34,8 @@ Traverser::~Traverser() BTreeNode * Traverser::start() { /* To find the start we will iterate, or possibly recurse - down the tree, each time turning down the node that has children, - if they both have no children we have reached the end and it shouldn't + down the tree, each time turning down the node that has tqchildren, + if they both have no tqchildren we have reached the end and it shouldn't really matter which we pick (check this algorithm) */ BTreeNode *n = m_root; @@ -54,7 +54,7 @@ BTreeNode * Traverser::start() else n = n->left(); } } - //if(n->parent()) m_current = n->parent(); + //if(n->tqparent()) m_current = n->tqparent(); //else m_current = n; m_current = n; return m_current; @@ -62,22 +62,22 @@ BTreeNode * Traverser::start() BTreeNode * Traverser::next() { - // a.t.m we will just take the next thing to be the parent. - if( m_current != m_root ) m_current = m_current->parent(); + // a.t.m we will just take the next thing to be the tqparent. + if( m_current != m_root ) m_current = m_current->tqparent(); return m_current; } bool Traverser::onLeftBranch() { - return current()->parent()->left() == current(); + return current()->tqparent()->left() == current(); } BTreeNode * Traverser::oppositeNode() { if ( onLeftBranch() ) - return current()->parent()->right(); + return current()->tqparent()->right(); else - return current()->parent()->left(); + return current()->tqparent()->left(); } void Traverser::descendLeftwardToTerminal() @@ -95,6 +95,6 @@ void Traverser::descendLeftwardToTerminal() void Traverser::moveToParent() { - if(current()->parent()) m_current = current()->parent(); + if(current()->tqparent()) m_current = current()->tqparent(); } diff --git a/microbe/traverser.h b/microbe/traverser.h index 7593ba7..a0fcd77 100644 --- a/microbe/traverser.h +++ b/microbe/traverser.h @@ -45,7 +45,7 @@ public: /** Returns true if we are on the left branch, false otherwise. */ bool onLeftBranch(); - /** Returns the node on the opposite branch of the parent. */ + /** Returns the node on the opposite branch of the tqparent. */ BTreeNode * oppositeNode(); BTreeNode * current() const { return m_current; } @@ -57,8 +57,8 @@ public: */ void descendLeftwardToTerminal(); - /** It might occur in the future that next() does not just move to the parent, - so use this for moving to parent + /** It might occur in the future that next() does not just move to the tqparent, + so use this for moving to tqparent */ void moveToParent(); diff --git a/microbe/variable.cpp b/microbe/variable.cpp index dbc20ba..35cf00b 100644 --- a/microbe/variable.cpp +++ b/microbe/variable.cpp @@ -21,7 +21,7 @@ #include "pic14.h" #include "variable.h" -Variable::Variable( VariableType type, const QString & name ) +Variable::Variable( VariableType type, const TQString & name ) { m_type = type; m_name = name; diff --git a/microbe/variable.h b/microbe/variable.h index f5848c1..7162c03 100644 --- a/microbe/variable.h +++ b/microbe/variable.h @@ -21,11 +21,11 @@ #ifndef VARIABLE_H #define VARIABLE_H -#include <qstring.h> -#include <qvaluelist.h> +#include <tqstring.h> +#include <tqvaluelist.h> class PortPin; -typedef QValueList<PortPin> PortPinList; +typedef TQValueList<PortPin> PortPinList; /** @@ -43,12 +43,12 @@ class Variable invalidType }; - Variable( VariableType type, const QString & name ); + Variable( VariableType type, const TQString & name ); Variable(); ~Variable(); VariableType type() const { return m_type; } - QString name() const { return m_name; } + TQString name() const { return m_name; } /** * @returns whether the variable can be read from (e.g. the seven @@ -71,9 +71,9 @@ class Variable protected: VariableType m_type; - QString m_name; + TQString m_name; PortPinList m_portPinList; }; -typedef QValueList<Variable> VariableList; +typedef TQValueList<Variable> VariableList; #endif |