summaryrefslogtreecommitdiffstats
path: root/microbe/instruction.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-29 16:05:55 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-29 16:05:55 +0000
commit87a016680e3677da3993f333561e79eb0cead7d5 (patch)
treecbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /microbe/instruction.cpp
parent6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff)
downloadktechlab-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/instruction.cpp')
-rw-r--r--microbe/instruction.cpp194
1 files changed, 97 insertions, 97 deletions
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;
}