summaryrefslogtreecommitdiffstats
path: root/src/electronics/gpsimprocessor.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 /src/electronics/gpsimprocessor.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 'src/electronics/gpsimprocessor.cpp')
-rw-r--r--src/electronics/gpsimprocessor.cpp154
1 files changed, 77 insertions, 77 deletions
diff --git a/src/electronics/gpsimprocessor.cpp b/src/electronics/gpsimprocessor.cpp
index 1a3b862..efa3d88 100644
--- a/src/electronics/gpsimprocessor.cpp
+++ b/src/electronics/gpsimprocessor.cpp
@@ -28,9 +28,9 @@
#include <kmessagebox.h>
#include <ktempfile.h>
#include <kstandarddirs.h>
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qtimer.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqtimer.h>
#include "gpsim/cod.h"
#include "gpsim/interface.h"
@@ -60,9 +60,9 @@ Work around a bug in gpsim: the directory in a filename is recorded twice, e.g.
"/home/david/afile.asm" is recorded as "/home/david//home/david/afile.asm". This
function will remove the duplicated directory path (by searching for a "//").
*/
-QString sanitizeGpsimFile( QString file )
+TQString sanitizeGpsimFile( TQString file )
{
- int pos = file.find("//");
+ int pos = file.tqfind("//");
if ( pos != -1 )
{
file.remove( 0, pos + 1 );
@@ -71,8 +71,8 @@ QString sanitizeGpsimFile( QString file )
}
-GpsimProcessor::GpsimProcessor( QString symbolFile, QObject *parent )
- : QObject(parent),
+GpsimProcessor::GpsimProcessor( TQString symbolFile, TQObject *tqparent )
+ : TQObject(tqparent),
m_symbolFile(symbolFile)
{
if (!bDoneGpsimInit)
@@ -89,7 +89,7 @@ GpsimProcessor::GpsimProcessor( QString symbolFile, QObject *parent )
m_bCanExecuteNextCycle = true;
m_bIsRunning = false;
m_pPicProcessor = 0l;
- m_codLoadStatus = CodUnknown;
+ m_codLoadtqStatus = CodUnknown;
m_pRegisterMemory = 0l;
m_debugMode = GpsimDebugger::AsmDebugger;
m_pDebugger[0] = m_pDebugger[1] = 0l;
@@ -101,37 +101,37 @@ GpsimProcessor::GpsimProcessor( QString symbolFile, QObject *parent )
switch ( (cod_errors)load_symbol_file( &tempProcessor, fileName ) )
{
case COD_SUCCESS:
- m_codLoadStatus = CodSuccess;
+ m_codLoadtqStatus = CodSuccess;
break;
case COD_FILE_NOT_FOUND:
- m_codLoadStatus = CodFileNotFound;
+ m_codLoadtqStatus = CodFileNotFound;
break;
case COD_UNRECOGNIZED_PROCESSOR:
- m_codLoadStatus = CodUnrecognizedProcessor;
+ m_codLoadtqStatus = CodUnrecognizedProcessor;
break;
case COD_FILE_NAME_TOO_LONG:
- m_codLoadStatus = CodFileNameTooLong;
+ m_codLoadtqStatus = CodFileNameTooLong;
break;
case COD_LST_NOT_FOUND:
- m_codLoadStatus = CodLstNotFound;
+ m_codLoadtqStatus = CodLstNotFound;
break;
case COD_BAD_FILE:
- m_codLoadStatus = CodBadFile;
+ m_codLoadtqStatus = CodBadFile;
break;
default:
- m_codLoadStatus = CodUnknown;
+ m_codLoadtqStatus = CodUnknown;
}
#else // GPSIM_0_21_11+
FILE * pFile = fopen( fileName, "r" );
if ( !pFile )
- m_codLoadStatus = CodFileUnreadable;
+ m_codLoadtqStatus = CodFileUnreadable;
else
- m_codLoadStatus = ( ProgramFileTypeList::GetList().LoadProgramFile( & tempProcessor, fileName, pFile ) ) ? CodSuccess : CodFailure;
+ m_codLoadtqStatus = ( ProgramFileTypeList::GetList().LoadProgramFile( & tempProcessor, fileName, pFile ) ) ? CodSuccess : CodFailure;
#endif
m_pPicProcessor = dynamic_cast<pic_processor*>(tempProcessor);
- if ( codLoadStatus() == CodSuccess )
+ if ( codLoadtqStatus() == CodSuccess )
{
m_pRegisterMemory = new RegisterSet( m_pPicProcessor );
m_pDebugger[0] = new GpsimDebugger( GpsimDebugger::AsmDebugger, this );
@@ -154,33 +154,33 @@ GpsimProcessor::~GpsimProcessor()
}
-void GpsimProcessor::displayCodLoadStatus( )
+void GpsimProcessor::displayCodLoadtqStatus( )
{
- switch (m_codLoadStatus)
+ switch (m_codLoadtqStatus)
{
case CodSuccess:
break;
case CodFileNotFound:
- KMessageBox::sorry( 0l, i18n("The cod file \"%1\" was not found.").arg(m_symbolFile), i18n("File Not Found") );
+ KMessageBox::sorry( 0l, i18n("The cod file \"%1\" was not found.").tqarg(m_symbolFile), i18n("File Not Found") );
break;
case CodUnrecognizedProcessor:
- KMessageBox::sorry( 0l, i18n("The processor for cod file \"%1\" is unrecognized.").arg(m_symbolFile), i18n("Unrecognized Processor") );
+ KMessageBox::sorry( 0l, i18n("The processor for cod file \"%1\" is unrecognized.").tqarg(m_symbolFile), i18n("Unrecognized Processor") );
break;
case CodFileNameTooLong:
- KMessageBox::sorry( 0l, i18n("The file name \"%1\" is too long.").arg(m_symbolFile), i18n("Filename Too Long") );
+ KMessageBox::sorry( 0l, i18n("The file name \"%1\" is too long.").tqarg(m_symbolFile), i18n("Filename Too Long") );
break;
case CodLstNotFound:
- KMessageBox::sorry( 0l, i18n("The lst file associated with the cod file \"%1\" was not found.").arg(m_symbolFile), i18n("LST File Not Found") );
+ KMessageBox::sorry( 0l, i18n("The lst file associated with the cod file \"%1\" was not found.").tqarg(m_symbolFile), i18n("LST File Not Found") );
break;
case CodBadFile:
- KMessageBox::sorry( 0l, i18n("The cod file \"%1\" is bad.").arg(m_symbolFile), i18n("Bad File") );
+ KMessageBox::sorry( 0l, i18n("The cod file \"%1\" is bad.").tqarg(m_symbolFile), i18n("Bad File") );
break;
case CodFileUnreadable:
- KMessageBox::sorry( 0l, i18n("The cod file \"%1\" could not be read from.").arg(m_symbolFile), i18n("Unreadable File") );
+ KMessageBox::sorry( 0l, i18n("The cod file \"%1\" could not be read from.").tqarg(m_symbolFile), i18n("Unreadable File") );
break;
case CodFailure:
case CodUnknown:
- KMessageBox::sorry( 0l, i18n("An error occured with the cod file \"%1\".").arg(m_symbolFile), i18n("Error") );
+ KMessageBox::sorry( 0l, i18n("An error occured with the cod file \"%1\".").tqarg(m_symbolFile), i18n("Error") );
break;
}
}
@@ -192,9 +192,9 @@ unsigned GpsimProcessor::programMemorySize() const
}
-QStringList GpsimProcessor::sourceFileList()
+TQStringList GpsimProcessor::sourceFileList()
{
- QStringList files;
+ TQStringList files;
// Work around nasty bug in gpsim 0.21.4 where nsrc_files value might be used uninitiazed
int max = m_pPicProcessor->files.nsrc_files();
@@ -299,12 +299,12 @@ int GpsimProcessor::operandLiteral( unsigned address )
}
-GpsimProcessor::ProgramFileValidity GpsimProcessor::isValidProgramFile( const QString & programFile )
+GpsimProcessor::ProgramFileValidity GpsimProcessor::isValidProgramFile( const TQString & programFile )
{
if ( !KStandardDirs::exists(programFile) )
return DoesntExist;
- QString extension = programFile.right( programFile.length() - programFile.findRev('.') - 1 ).lower();
+ TQString extension = programFile.right( programFile.length() - programFile.tqfindRev('.') - 1 ).lower();
if ( extension == "flowcode" ||
extension == "asm" ||
@@ -313,40 +313,40 @@ GpsimProcessor::ProgramFileValidity GpsimProcessor::isValidProgramFile( const QS
extension == "c" )
return Valid;
- if ( extension == "hex" && QFile::exists( QString(programFile).replace(".hex",".cod") ) )
+ if ( extension == "hex" && TQFile::exists( TQString(programFile).tqreplace(".hex",".cod") ) )
return Valid;
return IncorrectType;
}
-QString GpsimProcessor::generateSymbolFile( const QString &fileName, QObject *receiver, const char *successMember, const char * failMember )
+TQString GpsimProcessor::generateSymbolFile( const TQString &fileName, TQObject *receiver, const char *successMember, const char * failMember )
{
if ( !isValidProgramFile(fileName) )
- return QString::null;
+ return TQString();
- QString extension = fileName.right( fileName.length() - fileName.findRev('.') - 1 ).lower();
+ TQString extension = fileName.right( fileName.length() - fileName.tqfindRev('.') - 1 ).lower();
if ( extension == "cod" )
{
- QTimer::singleShot( 0, receiver, successMember );
+ TQTimer::singleShot( 0, receiver, successMember );
return fileName;
}
if ( extension == "hex" )
{
- QTimer::singleShot( 0, receiver, successMember );
+ TQTimer::singleShot( 0, receiver, successMember );
// We've already checked for the existance of the ".cod" file in GpsimProcessor::isValidProgramFile
- return QString(fileName).replace(".hex",".cod");
+ return TQString(fileName).tqreplace(".hex",".cod");
}
else if ( extension == "basic" || extension == "microbe" )
{
compileMicrobe( fileName, receiver, successMember, failMember );
- return QString(fileName).replace( "."+extension, ".cod" );
+ return TQString(fileName).tqreplace( "."+extension, ".cod" );
}
else if ( extension == "flowcode" )
{
- const QString hexFile = KTempFile( QString::null, ".hex" ).name();
+ const TQString hexFile = KTempFile( TQString(), ".hex" ).name();
ProcessOptions o;
o.b_addToProject = false;
@@ -359,18 +359,18 @@ QString GpsimProcessor::generateSymbolFile( const QString &fileName, QObject *re
if (receiver)
{
if (successMember)
- connect( pc, SIGNAL(successful()), receiver, successMember );
+ connect( pc, TQT_SIGNAL(successful()), receiver, successMember );
if (failMember)
- connect( pc, SIGNAL(failed()), receiver, failMember );
+ connect( pc, TQT_SIGNAL(failed()), receiver, failMember );
}
- return QString(hexFile).replace( ".hex", ".cod" );
+ return TQString(hexFile).tqreplace( ".hex", ".cod" );
}
else if ( extension == "asm" )
{
ProcessOptions o;
o.b_addToProject = false;
- o.setTargetFile( QString(fileName).replace(".asm",".hex"));
+ o.setTargetFile( TQString(fileName).tqreplace(".asm",".hex"));
o.setInputFiles(fileName);
o.setMethod( ProcessOptions::Method::Forget );
o.setProcessPath( ProcessOptions::ProcessPath::path( ProcessOptions::guessMediaType(fileName), ProcessOptions::ProcessPath::Program ) );
@@ -379,18 +379,18 @@ QString GpsimProcessor::generateSymbolFile( const QString &fileName, QObject *re
if (receiver)
{
if (successMember)
- connect( pc, SIGNAL(successful()), receiver, successMember );
+ connect( pc, TQT_SIGNAL(successful()), receiver, successMember );
if (failMember)
- connect( pc, SIGNAL(failed()), receiver, failMember );
+ connect( pc, TQT_SIGNAL(failed()), receiver, failMember );
}
- return QString(fileName).replace(".asm",".cod");
+ return TQString(fileName).tqreplace(".asm",".cod");
}
else if ( extension == "c" )
{
ProcessOptions o;
o.b_addToProject = false;
- o.setTargetFile( QString(fileName).replace(".c",".hex"));
+ o.setTargetFile( TQString(fileName).tqreplace(".c",".hex"));
o.setInputFiles(fileName);
o.setMethod( ProcessOptions::Method::Forget );
o.setProcessPath( ProcessOptions::ProcessPath::C_Program );
@@ -399,25 +399,25 @@ QString GpsimProcessor::generateSymbolFile( const QString &fileName, QObject *re
if (receiver)
{
if (successMember)
- connect( pc, SIGNAL(successful()), receiver, successMember );
+ connect( pc, TQT_SIGNAL(successful()), receiver, successMember );
if (failMember)
- connect( pc, SIGNAL(failed()), receiver, failMember );
+ connect( pc, TQT_SIGNAL(failed()), receiver, failMember );
}
- return QString(fileName).replace(".c",".cod");
+ return TQString(fileName).tqreplace(".c",".cod");
}
if ( failMember )
- QTimer::singleShot( 0, receiver, failMember );
- return QString::null;
+ TQTimer::singleShot( 0, receiver, failMember );
+ return TQString();
}
-void GpsimProcessor::compileMicrobe( const QString &filename, QObject *receiver, const char * successMember, const char * failMember )
+void GpsimProcessor::compileMicrobe( const TQString &filename, TQObject *receiver, const char * successMember, const char * failMember )
{
ProcessOptions o;
o.b_addToProject = false;
- o.setTargetFile( QString(filename).replace(".microbe",".hex") );
+ o.setTargetFile( TQString(filename).tqreplace(".microbe",".hex") );
o.setInputFiles(filename);
o.setMethod( ProcessOptions::Method::Forget );
o.setProcessPath( ProcessOptions::ProcessPath::Microbe_Program );
@@ -425,9 +425,9 @@ void GpsimProcessor::compileMicrobe( const QString &filename, QObject *receiver,
if (receiver)
{
if (successMember)
- connect( pc, SIGNAL(successful()), receiver, successMember );
+ connect( pc, TQT_SIGNAL(successful()), receiver, successMember );
if (failMember)
- connect( pc, SIGNAL(failed()), receiver, failMember );
+ connect( pc, TQT_SIGNAL(failed()), receiver, failMember );
}
}
//END class GpsimProcessor
@@ -436,7 +436,7 @@ void GpsimProcessor::compileMicrobe( const QString &filename, QObject *receiver,
//BEGIN class GpsimDebugger
GpsimDebugger::GpsimDebugger( Type type, GpsimProcessor * gpsim )
- : QObject()
+ : TQObject()
{
m_pGpsim = gpsim;
m_type = type;
@@ -445,13 +445,13 @@ GpsimDebugger::GpsimDebugger( Type type, GpsimProcessor * gpsim )
m_stackLevelLowerBreak = -1;
m_addressSize = 0;
- connect( m_pGpsim, SIGNAL(runningStatusChanged(bool )), this, SLOT(gpsimRunningStatusChanged(bool )) );
+ connect( m_pGpsim, TQT_SIGNAL(runningStatusChanged(bool )), this, TQT_SLOT(gpsimRunningStatusChanged(bool )) );
if ( type == HLLDebugger )
{
- const QStringList sourceFileList = m_pGpsim->sourceFileList();
- QStringList::const_iterator sflEnd = sourceFileList.end();
- for ( QStringList::const_iterator it = sourceFileList.begin(); it != sflEnd; ++it )
+ const TQStringList sourceFileList = m_pGpsim->sourceFileList();
+ TQStringList::const_iterator sflEnd = sourceFileList.end();
+ for ( TQStringList::const_iterator it = sourceFileList.begin(); it != sflEnd; ++it )
{
AsmParser p(*it);
p.parse(this);
@@ -464,7 +464,7 @@ GpsimDebugger::GpsimDebugger( Type type, GpsimProcessor * gpsim )
GpsimDebugger::~GpsimDebugger()
{
- QValueList<DebugLine*> debugLinesToDelete;
+ TQValueList<DebugLine*> debugLinesToDelete;
for ( unsigned i = 0; i < m_addressSize; ++i )
{
@@ -476,8 +476,8 @@ GpsimDebugger::~GpsimDebugger()
debugLinesToDelete += dl;
}
- const QValueList<DebugLine*>::iterator end = debugLinesToDelete.end();
- for ( QValueList<DebugLine*>::iterator it = debugLinesToDelete.begin(); it != end; ++it )
+ const TQValueList<DebugLine*>::iterator end = debugLinesToDelete.end();
+ for ( TQValueList<DebugLine*>::iterator it = debugLinesToDelete.begin(); it != end; ++it )
delete *it;
delete [] m_addressToLineMap;
@@ -495,7 +495,7 @@ void GpsimDebugger::gpsimRunningStatusChanged( bool isRunning )
}
-void GpsimDebugger::associateLine( const QString & sourceFile, int sourceLine, const QString & assemblyFile, int assemblyLine )
+void GpsimDebugger::associateLine( const TQString & sourceFile, int sourceLine, const TQString & assemblyFile, int assemblyLine )
{
if ( assemblyLine < 0 || sourceLine < 0 )
{
@@ -506,7 +506,7 @@ void GpsimDebugger::associateLine( const QString & sourceFile, int sourceLine, c
SourceLine hllSource = SourceLine( sourceFile, sourceLine );
SourceLine asmSource = SourceLine( assemblyFile, assemblyLine );
- if ( m_sourceLineMap.contains(asmSource) )
+ if ( m_sourceLineMap.tqcontains(asmSource) )
{
kdWarning() << k_funcinfo << "Already have an association for assembly (\""<<assemblyFile<<"\","<<assemblyLine<<")"<<endl;
return;
@@ -546,7 +546,7 @@ void GpsimDebugger::initAddressToLineMap()
int asmToLine = ((next == slmEnd) || (next.key().fileName() != it.key().fileName())) ? -1 : next.key().line() - 1;
- QString asmFile = it.key().fileName();
+ TQString asmFile = it.key().fileName();
int asmFromLine = it.key().line();
SourceLine sourceLine = it.data();
@@ -592,7 +592,7 @@ void GpsimDebugger::initAddressToLineMap()
}
-void GpsimDebugger::setBreakpoints( const QString & path, const IntList & lines )
+void GpsimDebugger::setBreakpoints( const TQString & path, const IntList & lines )
{
for ( unsigned i = 0; i < m_addressSize; i++ )
{
@@ -600,12 +600,12 @@ void GpsimDebugger::setBreakpoints( const QString & path, const IntList & lines
if ( !dl || dl->fileName() != path )
continue;
- dl->setBreakpoint( lines.contains( dl->line() ) );
+ dl->setBreakpoint( lines.tqcontains( dl->line() ) );
}
}
-void GpsimDebugger::setBreakpoint( const QString & path, int line, bool isBreakpoint )
+void GpsimDebugger::setBreakpoint( const TQString & path, int line, bool isBreakpoint )
{
for ( unsigned i = 0; i < m_addressSize; i++ )
{
@@ -659,7 +659,7 @@ void GpsimDebugger::checkForBreak()
}
-int GpsimDebugger::programAddress( const QString & path, int line )
+int GpsimDebugger::programAddress( const TQString & path, int line )
{
for ( unsigned i = 0; i < m_addressSize; ++i )
{
@@ -755,13 +755,13 @@ RegisterInfo * RegisterSet::fromAddress( unsigned address )
}
-RegisterInfo * RegisterSet::fromName( const QString & name )
+RegisterInfo * RegisterSet::fromName( const TQString & name )
{
// First try the name as case sensitive, then as case insensitive.
- if ( m_nameToRegisterMap.contains( name ) )
+ if ( m_nameToRegisterMap.tqcontains( name ) )
return m_nameToRegisterMap[ name ];
- QString nameLower = name.lower();
+ TQString nameLower = name.lower();
RegisterInfoMap::iterator end = m_nameToRegisterMap.end();
for ( RegisterInfoMap::iterator it = m_nameToRegisterMap.begin(); it != end; ++ it )
@@ -831,7 +831,7 @@ void RegisterInfo::update()
}
-QString RegisterInfo::toString( RegisterType type )
+TQString RegisterInfo::toString( RegisterType type )
{
switch ( type )
{
@@ -858,7 +858,7 @@ QString RegisterInfo::toString( RegisterType type )
//BEGIN class DebugLine
-DebugLine::DebugLine( const QString & fileName, int line )
+DebugLine::DebugLine( const TQString & fileName, int line )
: SourceLine( fileName, line )
{
m_bIsBreakpoint = false;