summaryrefslogtreecommitdiffstats
path: root/src/progs/gpsim/base
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 00:15:53 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 00:15:53 +0000
commit0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch)
treeb95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/progs/gpsim/base
parentb79a2c28534cf09987eeeba3077fff9236df182a (diff)
downloadpiklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.tar.gz
piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.zip
TQt4 port piklab
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/progs/gpsim/base')
-rw-r--r--src/progs/gpsim/base/gpsim.cpp28
-rw-r--r--src/progs/gpsim/base/gpsim.h11
-rw-r--r--src/progs/gpsim/base/gpsim_debug.cpp68
-rw-r--r--src/progs/gpsim/base/gpsim_debug.h19
4 files changed, 64 insertions, 62 deletions
diff --git a/src/progs/gpsim/base/gpsim.cpp b/src/progs/gpsim/base/gpsim.cpp
index e6c17bd..4352162 100644
--- a/src/progs/gpsim/base/gpsim.cpp
+++ b/src/progs/gpsim/base/gpsim.cpp
@@ -8,7 +8,7 @@
***************************************************************************/
#include "gpsim.h"
-#include <qregexp.h>
+#include <tqregexp.h>
#include "progs/base/generic_prog.h"
#include "progs/base/generic_debug.h"
@@ -16,7 +16,7 @@
GPSim::Process::Process(Log::Base *base)
: ::Process::LineOutput(0, "gpsim_process"), Log::Base(base), _ready(false)
{
- connect(this, SIGNAL(stdoutDataReceived()), SLOT(stdoutDataReceivedSlot()));
+ connect(this, TQT_SIGNAL(stdoutDataReceived()), TQT_SLOT(stdoutDataReceivedSlot()));
}
void GPSim::Process::stdoutDataReceivedSlot()
@@ -28,15 +28,15 @@ void GPSim::Process::stdoutDataReceivedSlot()
}
}
-void GPSim::Process::addStdoutLine(const QString &line)
+void GPSim::Process::addStdoutLine(const TQString &line)
{
log(Log::DebugLevel::Extra, " " + line, Log::Delayed);
if ( line.startsWith("***ERROR:") ) {
log(Log::LineType::Error, line);
return;
}
- QString s = line;
- QString prompt = "**gpsim> ";
+ TQString s = line;
+ TQString prompt = "**gpsim> ";
while ( s.startsWith(prompt) ) {
_ready = true;
s = s.mid(prompt.length());
@@ -53,7 +53,7 @@ GPSim::ProcessManager::ProcessManager(Log::Base *base)
bool GPSim::ProcessManager::start()
{
_process._ready = false;
- _process.setup("gpsim", QStringList("-i"), false);
+ _process.setup("gpsim", TQStringList("-i"), false);
if ( !_process.start(0) ) {
log(Log::LineType::Error, i18n("Failed to start \"gpsim\"."));
return false;
@@ -75,11 +75,11 @@ bool GPSim::ProcessManager::runSynchronously()
return true;
}
-bool GPSim::ProcessManager::sendCommand(const QString &cmd, bool synchronous)
+bool GPSim::ProcessManager::sendCommand(const TQString &cmd, bool synchronous)
{
_process._ready = false;
_process._stdoutLines.clear();
- _process._stdout = QString::null;
+ _process._stdout = TQString();
_process.writeToStdin(cmd + '\n');
if (synchronous) return runSynchronously();
return true;
@@ -89,7 +89,7 @@ bool GPSim::ProcessManager::sendSignal(uint n, bool synchronous)
{
_process._ready = false;
_process._stdoutLines.clear();
- _process._stdout = QString::null;
+ _process._stdout = TQString();
if ( !_process.signal(n) ) {
log(Log::LineType::Error, i18n("Error send a signal to the subprocess."));
return false;
@@ -101,7 +101,7 @@ bool GPSim::ProcessManager::sendSignal(uint n, bool synchronous)
bool GPSim::ProcessManager::getVersion(VersionData &version)
{
if ( !sendCommand("version", true) ) return false;
- QRegExp reg("\\w*\\s*(\\d+\\.\\d+\\.\\d+).*");
+ TQRegExp reg("\\w*\\s*(\\d+\\.\\d+\\.\\d+).*");
if ( _process.sout().count()==0 || !reg.exactMatch(_process.sout()[0]) ) {
version = VersionData();
return true;
@@ -136,18 +136,18 @@ void GPSim::Hardware::internalDisconnectHardware()
_manager = 0;
}
-bool GPSim::Hardware::execute(const QString &command, bool synchronous, QStringList *output)
+bool GPSim::Hardware::execute(const TQString &command, bool synchronous, TQStringList *output)
{
- log(Log::DebugLevel::Normal, QString("command: %1").arg(command));
+ log(Log::DebugLevel::Normal, TQString("command: %1").tqarg(command));
if (output) output->clear();
if ( !_manager->sendCommand(command, synchronous) ) return false;
if (output) *output = _manager->process().sout();
return true;
}
-bool GPSim::Hardware::signal(uint n, bool synchronous, QStringList *output)
+bool GPSim::Hardware::signal(uint n, bool synchronous, TQStringList *output)
{
- log(Log::DebugLevel::Normal, QString("signal: %1").arg(n));
+ log(Log::DebugLevel::Normal, TQString("signal: %1").tqarg(n));
if (output) output->clear();
if ( !_manager->sendSignal(n, synchronous) ) return false;
if (output) *output = _manager->process().sout();
diff --git a/src/progs/gpsim/base/gpsim.h b/src/progs/gpsim/base/gpsim.h
index ab004a3..fcdabab 100644
--- a/src/progs/gpsim/base/gpsim.h
+++ b/src/progs/gpsim/base/gpsim.h
@@ -20,6 +20,7 @@ namespace GPSim
class Process : public ::Process::LineOutput, public Log::Base
{
Q_OBJECT
+ TQ_OBJECT
public:
Process(Log::Base *base);
@@ -29,7 +30,7 @@ private slots:
private:
bool _ready;
- virtual void addStdoutLine(const QString &line);
+ virtual void addStdoutLine(const TQString &line);
friend class ProcessManager;
};
@@ -43,7 +44,7 @@ public:
bool isReady() const { return _process._ready; }
bool start();
bool runSynchronously();
- bool sendCommand(const QString &cmd, bool synchronous);
+ bool sendCommand(const TQString &cmd, bool synchronous);
bool sendSignal(uint n, bool synchronous);
bool getVersion(VersionData &version);
@@ -55,11 +56,11 @@ private:
class Hardware : public Programmer::Hardware
{
public:
- Hardware(::Programmer::Base &base) : Programmer::Hardware(base, 0, QString::null), _manager(0) {}
+ Hardware(::Programmer::Base &base) : Programmer::Hardware(base, 0, TQString()), _manager(0) {}
virtual ~Hardware();
bool isReady() const { return _manager->isReady(); }
- bool execute(const QString &command, bool synchronous, QStringList *output = 0);
- bool signal(uint n, bool synchronous, QStringList *output = 0);
+ bool execute(const TQString &command, bool synchronous, TQStringList *output = 0);
+ bool signal(uint n, bool synchronous, TQStringList *output = 0);
const VersionData &version() const { return _version; }
private:
diff --git a/src/progs/gpsim/base/gpsim_debug.cpp b/src/progs/gpsim/base/gpsim_debug.cpp
index b2bcec5..eca9841 100644
--- a/src/progs/gpsim/base/gpsim_debug.cpp
+++ b/src/progs/gpsim/base/gpsim_debug.cpp
@@ -9,7 +9,7 @@
#include "gpsim_debug.h"
#include <signal.h>
-#include <qregexp.h>
+#include <tqregexp.h>
#include "devices/list/device_list.h"
#include "devices/pic/base/pic_register.h"
@@ -52,10 +52,10 @@ bool GPSim::Debugger::internalStep()
return hardware()->execute("step", true);
}
-bool GPSim::Debugger::setBreakpoints(const QValueList<Address> &list)
+bool GPSim::Debugger::setBreakpoints(const TQValueList<Address> &list)
{
for (uint i=0; i<_nbBreakpoints; i++)
- if ( !hardware()->execute("clear " + QString::number(i), true) ) return false;
+ if ( !hardware()->execute("clear " + TQString::number(i), true) ) return false;
for (uint i=0; i<uint(list.count()); i++)
if ( !hardware()->execute("break e 0x" + toHex(list[i], nbChars(list[i].toUInt())), true) ) return false;
_nbBreakpoints = list.count();
@@ -75,15 +75,15 @@ bool GPSim::Debugger::updateState()
return true;
}
-bool GPSim::Debugger::findRegExp(const QStringList &lines, const QString &pattern,
- const QString &label, QString &value) const
+bool GPSim::Debugger::findRegExp(const TQStringList &lines, const TQString &pattern,
+ const TQString &label, TQString &value) const
{
- QRegExp rexp(pattern);
+ TQRegExp rexp(pattern);
uint i = 0;
for (; i<uint(lines.count()); i++) {
int offset = 0;
for (;;) {
- offset = rexp.search(lines[i], offset, QRegExp::CaretAtOffset);
+ offset = rexp.search(lines[i], offset, TQRegExp::CaretAtOffset);
if ( offset==-1 || rexp.cap(1)==label ) break;
offset += rexp.cap(0).length();
}
@@ -99,22 +99,22 @@ bool GPSim::Debugger::readWreg(BitValue &value)
// #### only known for version 4 and 11
if ( hardware()->version()<=VersionData(0, 21, 7) || hardware()->version()>=VersionData(0, 22, 0) )
return getRegister("W", value);
- QStringList lines;
+ TQStringList lines;
if ( !hardware()->execute("dump s", true, &lines) ) return false;
- QString w = (_coff->symbol("_WREG") ? "_WREG" : "W");
- QString s;
+ TQString w = (_coff->symbol("_WREG") ? "_WREG" : "W");
+ TQString s;
if ( !findRegExp(lines, "^\\s*[0-9A-Fa-f]+\\s+(\\w+)\\s*=\\s*([0-9A-Fa-f]+)", w, s) ) {
- log(Log::LineType::Error, i18n("Error reading register \"%1\"").arg(w));
+ log(Log::LineType::Error, i18n("Error reading register \"%1\"").tqarg(w));
return false;
}
value = fromHex(s, 0);
return true;
}
-bool GPSim::Debugger::getRegister(const QString &name, BitValue &value)
+bool GPSim::Debugger::getRegister(const TQString &name, BitValue &value)
{
- QStringList lines;
- QRegExp r;
+ TQStringList lines;
+ TQRegExp r;
if ( hardware()->version()<VersionData(0, 22, 0) ) {
if ( !hardware()->execute("x " + name, true, &lines) ) return false;
r.setPattern("\\w+\\s*[][\\w]+\\s*=\\s*(?:0x|)([0-9A-Fa-f]+)(?:\\W.*|)");
@@ -126,7 +126,7 @@ bool GPSim::Debugger::getRegister(const QString &name, BitValue &value)
for (; i<uint(lines.count()); i++)
if ( r.exactMatch(lines[i]) ) break;
if ( i==uint(lines.count()) ) {
- log(Log::LineType::Error, i18n("Error reading register \"%1\"").arg(name));
+ log(Log::LineType::Error, i18n("Error reading register \"%1\"").tqarg(name));
return false;
}
value = fromHex(r.cap(1), 0);
@@ -136,9 +136,9 @@ bool GPSim::Debugger::getRegister(const QString &name, BitValue &value)
bool GPSim::Debugger::getRegister(Address address, BitValue &value)
{
const Pic::RegistersData &rdata = device()->registersData();
- QString name = toHex(address, rdata.nbCharsAddress());
+ TQString name = toHex(address, rdata.nbCharsAddress());
if ( hardware()->version()<VersionData(0, 22, 0) ) return getRegister("0x" + name, value);
- return getRegister(QString("ramData[$%1]").arg(name), value);
+ return getRegister(TQString("ramData[$%1]").tqarg(name), value);
}
bool GPSim::Debugger::readRegister(const Register::TypeData &data, BitValue &value)
@@ -149,27 +149,27 @@ bool GPSim::Debugger::readRegister(const Register::TypeData &data, BitValue &val
Q_ASSERT(false);
return true;
}
- QString name = device()->registersData().sfrNames[data.address()];
+ TQString name = device()->registersData().sfrNames[data.address()];
if ( name=="WREG" ) return readWreg(value);
if ( !name.isEmpty() ) return getRegister(name.lower(), value);
return getRegister(data.address(), value);
}
-bool GPSim::Debugger::setRegister(const QString &name, BitValue value)
+bool GPSim::Debugger::setRegister(const TQString &name, BitValue value)
{
if ( hardware()->version()<VersionData(0, 22, 0) ) {
log(Log::LineType::Warning, i18n("Writing registers is not supported by this version of gpsim"));
return true;
}
const Pic::RegistersData &rdata = device()->registersData();
- QString s = QString("%1 = %2").arg(name).arg(toHexLabel(value, rdata.nbChars()));
+ TQString s = TQString("%1 = %2").tqarg(name).tqarg(toHexLabel(value, rdata.nbChars()));
return hardware()->execute(s, true);
}
bool GPSim::Debugger::setRegister(Address address, BitValue value)
{
const Pic::RegistersData &rdata = device()->registersData();
- QString s = QString("ramData[$%1]").arg(toHex(address, rdata.nbCharsAddress()));
+ TQString s = TQString("ramData[$%1]").tqarg(toHex(address, rdata.nbCharsAddress()));
return setRegister(s, value);
}
@@ -185,7 +185,7 @@ bool GPSim::Debugger::writeRegister(const Register::TypeData &data, BitValue val
return false;
}
const Pic::RegistersData &rdata = device()->registersData();
- QString name = rdata.sfrNames[data.address()];
+ TQString name = rdata.sfrNames[data.address()];
if ( !name.isEmpty() ) return setRegister(name.lower(), value);
return setRegister(data.address(), value);
}
@@ -195,16 +195,16 @@ bool GPSim::Debugger::writeWreg(BitValue value)
return setRegister("W", value);
}
-bool GPSim::Debugger::updatePortStatus(uint index, QMap<uint, Device::PortBitData> &bits)
+bool GPSim::Debugger::updatePorttqStatus(uint index, TQMap<uint, Device::PortBitData> &bits)
{
for (uint i=0; i<Device::MAX_NB_PORT_BITS; i++) {
if ( !device()->registersData().hasPortBit(index, i) ) continue;
- QString name = device()->registersData().portName(index).lower() + QString::number(i);
- QStringList lines;
+ TQString name = device()->registersData().portName(index).lower() + TQString::number(i);
+ TQStringList lines;
if ( !hardware()->execute("symbol " + name, true, &lines) ) return false;
- QString pattern = "^(\\w+)=([^\\s])+\\s*", value;
+ TQString pattern = "^(\\w+)=([^\\s])+\\s*", value;
if ( !findRegExp(lines, pattern, "bitState", value) || value.length()!=1 ) {
- log(Log::LineType::Error, i18n("Error reading state of IO bit: %1").arg(name));
+ log(Log::LineType::Error, i18n("Error reading state of IO bit: %1").tqarg(name));
return false;
}
switch (value[0].latin1()) {
@@ -218,24 +218,24 @@ bool GPSim::Debugger::updatePortStatus(uint index, QMap<uint, Device::PortBitDat
case 'X': bits[i].state = Device::Unknown; break;
default:
bits[i].state = Device::Unknown;
- log(Log::LineType::Warning, i18n("Unknown state for IO bit: %1 (%2)").arg(name).arg(value));
+ log(Log::LineType::Warning, i18n("Unknown state for IO bit: %1 (%2)").tqarg(name).tqarg(value));
break;
}
if ( !findRegExp(lines, pattern, "Driving", value) || value.length()!=1 ) {
- log(Log::LineType::Error, i18n("Error reading driving state of IO bit: %1").arg(name));
+ log(Log::LineType::Error, i18n("Error reading driving state of IO bit: %1").tqarg(name));
return false;
}
bits[i].driving = ( value[0]=='1' );
if (bits[i].driving) {
if ( !findRegExp(lines, pattern, "drivingState", value) || value.length()!=1 ) {
- log(Log::LineType::Error, i18n("Error reading driving state of IO bit: %1").arg(name));
+ log(Log::LineType::Error, i18n("Error reading driving state of IO bit: %1").tqarg(name));
return false;
}
bits[i].drivingState = (value[0]=='0' ? Device::IoLow : Device::IoHigh);
bits[i].drivenState = Device::IoUnknown;
} else {
if ( !findRegExp(lines, pattern, "drivenState", value) || value.length()!=1 ) {
- log(Log::LineType::Error, i18n("Error reading driven state of IO bit: %1").arg(name));
+ log(Log::LineType::Error, i18n("Error reading driven state of IO bit: %1").tqarg(name));
return false;
}
bits[i].drivenState = (value[0]=='0' ? Device::IoLow : Device::IoHigh);
@@ -246,7 +246,7 @@ bool GPSim::Debugger::updatePortStatus(uint index, QMap<uint, Device::PortBitDat
}
//----------------------------------------------------------------------------
-QString GPSim::Group::statusLabel() const
+TQString GPSim::Group::statusLabel() const
{
return i18n("GPSim (4MHz)"); // #### FIXME: add config
}
@@ -259,9 +259,9 @@ void GPSim::Group::initSupported()
if ( !manager.getVersion(version) ) return;
bool oldGpsim = ( version<VersionData(0, 21, 11) );
if ( !manager.sendCommand("processor list", true) ) return;
- QStringList devices = QStringList::split(" ", manager.process().sout().join(" "));
+ TQStringList devices = TQStringList::split(" ", manager.process().sout().join(" "));
for (uint i=0; i<uint(devices.count()); i++) {
- QString s = devices[i].upper();
+ TQString s = devices[i].upper();
if ( s.startsWith("PIC") ) s = s.mid(3);
const Pic::Data *data = static_cast<const Pic::Data *>(Device::lister().data(s));
if (data) {
diff --git a/src/progs/gpsim/base/gpsim_debug.h b/src/progs/gpsim/base/gpsim_debug.h
index ad838b2..7c258d9 100644
--- a/src/progs/gpsim/base/gpsim_debug.h
+++ b/src/progs/gpsim/base/gpsim_debug.h
@@ -19,6 +19,7 @@ namespace GPSim
class Programmer : public ::Programmer::PicBase
{
Q_OBJECT
+ TQ_OBJECT
public:
Programmer(const ::Programmer::Group &group, const Pic::Data *data)
: Programmer::PicBase(group, data, "gpsim_programmer") {}
@@ -41,18 +42,18 @@ class Debugger : public ::Debugger::PicBase
{
public:
Debugger(Programmer &programmer);
- virtual bool setBreakpoints(const QValueList<Address> &list);
+ virtual bool setBreakpoints(const TQValueList<Address> &list);
virtual bool readRegister(const Register::TypeData &data, BitValue &value);
virtual bool writeRegister(const Register::TypeData &data, BitValue value);
- virtual bool updatePortStatus(uint index, QMap<uint, Device::PortBitData> &bits);
+ virtual bool updatePorttqStatus(uint index, TQMap<uint, Device::PortBitData> &bits);
private:
uint _nbBreakpoints;
- bool findRegExp(const QStringList &lines, const QString &pattern,
- const QString &label, QString &value) const;
- bool getRegister(const QString &name, BitValue &value);
- bool setRegister(const QString &name, BitValue value);
+ bool findRegExp(const TQStringList &lines, const TQString &pattern,
+ const TQString &label, TQString &value) const;
+ bool getRegister(const TQString &name, BitValue &value);
+ bool setRegister(const TQString &name, BitValue value);
bool getRegister(Address address, BitValue &value);
bool setRegister(Address address, BitValue value);
Hardware *hardware() { return static_cast<Hardware *>(_programmer.hardware()); }
@@ -72,9 +73,9 @@ private:
class Group : public ::Programmer::PicGroup
{
public:
- virtual QString name() const { return "gpsim"; }
- virtual QString label() const { return i18n("GPSim"); }
- virtual QString statusLabel() const;
+ virtual TQString name() const { return "gpsim"; }
+ virtual TQString label() const { return i18n("GPSim"); }
+ virtual TQString statusLabel() const;
virtual ::Programmer::Properties properties() const { return ::Programmer::Debugger | ::Programmer::HasConnectedState; }
virtual ::Programmer::TargetPowerMode targetPowerMode() const { return ::Programmer::TargetSelfPowered; }
virtual bool isPortSupported(PortType) const { return false; }