From 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 30 Jun 2011 00:15:53 +0000 Subject: 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 --- src/piklab-test/base/device_test.cpp | 2 +- src/piklab-test/base/device_test.h | 2 +- src/piklab-test/base/generator_check.cpp | 54 ++++++++++----------- src/piklab-test/base/generator_check.h | 6 +-- src/piklab-test/base/main_test.cpp | 2 +- src/piklab-test/base/main_test.h | 4 +- src/piklab-test/checksum/checksum_check.cpp | 56 +++++++++++----------- src/piklab-test/checksum/checksum_check.h | 6 +-- src/piklab-test/misc/misc_check.cpp | 2 +- .../save_load_memory/save_load_memory_check.cpp | 4 +- 10 files changed, 69 insertions(+), 69 deletions(-) (limited to 'src/piklab-test') diff --git a/src/piklab-test/base/device_test.cpp b/src/piklab-test/base/device_test.cpp index 9346a13..07a5fdd 100644 --- a/src/piklab-test/base/device_test.cpp +++ b/src/piklab-test/base/device_test.cpp @@ -14,7 +14,7 @@ void DeviceTest::checkArguments() { if ( _args->count()==1 ) { - _device = QString(_args->arg(0)).upper(); + _device = TQString(_args->arg(0)).upper(); if ( !Device::lister().isSupported(_device) ) qFatal("Specified device \"%s\" not supported.", _device.latin1()); printf("Testing only %s\n", _device.latin1()); } diff --git a/src/piklab-test/base/device_test.h b/src/piklab-test/base/device_test.h index 24447ed..cd96edc 100644 --- a/src/piklab-test/base/device_test.h +++ b/src/piklab-test/base/device_test.h @@ -26,7 +26,7 @@ protected: virtual void checkArguments(); private: - QString _device; + TQString _device; }; #endif diff --git a/src/piklab-test/base/generator_check.cpp b/src/piklab-test/base/generator_check.cpp index 68ad2c5..5819188 100644 --- a/src/piklab-test/base/generator_check.cpp +++ b/src/piklab-test/base/generator_check.cpp @@ -92,21 +92,21 @@ bool GeneratorCheck::execute(const Device::Data &data) // run compiler Process::State state = Process::runSynchronously(*_helper->_cprocess, Process::Start, 2000); // 2s timeout if ( state!=Process::Exited ) TEST_FAILED_RETURN("Error while running compilation") - if ( _helper->_cprocess->exitCode()!=0 ) TEST_FAILED_RETURN(QString("Error in compilation for %1:\n%2%3").arg(data.name()).arg(_helper->_cprocess->sout()+_helper->_cprocess->serr()).arg(QString::null)) + if ( _helper->_cprocess->exitCode()!=0 ) TEST_FAILED_RETURN(TQString("Error in compilation for %1:\n%2%3").tqarg(data.name()).tqarg(_helper->_cprocess->sout()+_helper->_cprocess->serr()).tqarg(TQString())) // run linker if (_helper->_lprocess) { state = Process::runSynchronously(*_helper->_lprocess, Process::Start, 2000); // 2s timeout if ( state!=Process::Exited ) TEST_FAILED_RETURN("Error while running linking") - if ( _helper->_lprocess->exitCode()!=0 ) TEST_FAILED_RETURN(QString("Error in linking for %1:\n%2%3").arg(data.name()).arg(_helper->_lprocess->sout()+_helper->_lprocess->serr()).arg(QString::null)) + if ( _helper->_lprocess->exitCode()!=0 ) TEST_FAILED_RETURN(TQString("Error in linking for %1:\n%2%3").tqarg(data.name()).tqarg(_helper->_lprocess->sout()+_helper->_lprocess->serr()).tqarg(TQString())) } // load hex file if ( !_fhex->openForRead() ) TEST_FAILED_RETURN("") - QStringList errors, warnings; + TQStringList errors, warnings; Device::Memory::WarningTypes warningTypes; - if ( !_memory1->load(_fhex->stream(), errors, warningTypes, warnings) ) TEST_FAILED_RETURN(QString("Error loading hex into memory: %1").arg(errors.join(" "))) - //if ( warningTypes!=Device::Memory::NoWarning ) TEST_FAILED(QString("Warning loading hex into memory: %1").arg(warnings.join(" "))) + if ( !_memory1->load(_fhex->stream(), errors, warningTypes, warnings) ) TEST_FAILED_RETURN(TQString("Error loading hex into memory: %1").tqarg(errors.join(" "))) + //if ( warningTypes!=Device::Memory::NoWarning ) TEST_FAILED(TQString("Warning loading hex into memory: %1").tqarg(warnings.join(" "))) TEST_PASSED return true; @@ -129,11 +129,11 @@ bool ConfigGeneratorCheck::execute(const Device::Data &data) bool ok = false; for (uint i=0; isetConfigValue(cmask.name, cmask.values[l].name); + if ( !ctqmask.values[l].name.isEmpty() ) _memory2->setConfigValue(ctqmask.name, ctqmask.values[l].name); } } } @@ -157,23 +157,23 @@ bool ConfigGeneratorCheck::execute(const Device::Data &data) BitValue word1 = _memory1->word(Pic::MemoryRangeType::Config, i); BitValue word2 = _memory2->word(Pic::MemoryRangeType::Config, i); if ( word1==word2 ) continue; - for (uint k=0; kgenerator()->templateSourceFile(ttype, data, ok); _source = SourceLine::text(sfamily, lines, 2); - if (!ok) TEST_FAILED_RETURN(QString("Incomplete template generator for %1").arg(data.name())) + if (!ok) TEST_FAILED_RETURN(TQString("Incomplete template generator for %1").tqarg(data.name())) return true; } @@ -211,7 +211,7 @@ GPUtilsGeneratorCheckHelper::GPUtilsGeneratorCheckHelper() void GPUtilsGeneratorCheckHelper::initSupported() { Process::StringOutput p; - QStringList options; + TQStringList options; options += "-l"; p.setup("gpasm", options, false); Process::runSynchronously(p, Process::Start, 2000); // 2s timeout @@ -221,7 +221,7 @@ void GPUtilsGeneratorCheckHelper::initSupported() bool GPUtilsGeneratorCheckHelper::init(const Device::Data &data) { _cprocess = new Process::StringOutput; - QStringList options; + TQStringList options; options = "-c"; options += "-p" + GPUtils::toDeviceName(data.name()); options += "test.asm"; @@ -257,8 +257,8 @@ void SDCCGeneratorCheckHelper::initSupported() _supported.clear(); for (uint i=0; i _supported; + TQValueList _supported; Process::StringOutput *_cprocess, *_lprocess; Tool::SourceGenerator *_generator; @@ -54,7 +54,7 @@ protected: CLI::View *_view; PURL::File *_fdest, *_fhex; Pic::Memory *_memory1; - QString _source; + TQString _source; }; //---------------------------------------------------------------------------- diff --git a/src/piklab-test/base/main_test.cpp b/src/piklab-test/base/main_test.cpp index 10d0414..bfacdf8 100644 --- a/src/piklab-test/base/main_test.cpp +++ b/src/piklab-test/base/main_test.cpp @@ -23,7 +23,7 @@ void Test::runTest() printf("RESULTS: %i PASSED / %i FAILED / %i SKIPPED \n", _nbPassed, _nbFailed, _nbSkipped); } -void Test::failed(const QString &message, const char *file, int line) +void Test::failed(const TQString &message, const char *file, int line) { _nbFailed++; printf("\n"); diff --git a/src/piklab-test/base/main_test.h b/src/piklab-test/base/main_test.h index 601b779..4006bd9 100644 --- a/src/piklab-test/base/main_test.h +++ b/src/piklab-test/base/main_test.h @@ -36,10 +36,10 @@ public: protected: KCmdLineArgs *_args; - QString _message; + TQString _message; void passed() { _nbPassed++; } - void failed(const QString &message, const char *file, int line); + void failed(const TQString &message, const char *file, int line); void skipped() { _nbSkipped++; } virtual bool execute() = 0; // returns false if failed or skipped virtual void checkArguments() {} diff --git a/src/piklab-test/checksum/checksum_check.cpp b/src/piklab-test/checksum/checksum_check.cpp index fdba104..86877c0 100644 --- a/src/piklab-test/checksum/checksum_check.cpp +++ b/src/piklab-test/checksum/checksum_check.cpp @@ -29,46 +29,46 @@ void ChecksumCheck::cleanup(const Device::Data &) } void ChecksumCheck::setProtection(const Pic::Data &data, const Pic::Checksum::Data &cdata, - const QString &maskName, const QString &valueName) + const TQString &tqmaskName, const TQString &valueName) { const Pic::Protection &protection = data.config().protection(); - if ( !maskName.isEmpty() && !valueName.isEmpty() ) _memory->setConfigValue(maskName, valueName); + if ( !tqmaskName.isEmpty() && !valueName.isEmpty() ) _memory->setConfigValue(tqmaskName, valueName); if ( !valueName.isEmpty() ) _memory->setUserIdToUnprotectedChecksum(); for (uint i=0; ivalues.count()-1; k>=0; k--) { - if ( mask->values[k].name.isEmpty() ) continue; - if ( protection.isNoneProtectedValueName(mask->values[k].name) ) continue; - _memory->setConfigValue(pmName, mask->values[k].name); + TQString pmName = cdata.protectedMaskNames[i]; + const Pic::Config::Mask *tqmask = data.config().findMask(pmName, 0); + for (int k=tqmask->values.count()-1; k>=0; k--) { + if ( tqmask->values[k].name.isEmpty() ) continue; + if ( protection.isNoneProtectedValueName(tqmask->values[k].name) ) continue; + _memory->setConfigValue(pmName, tqmask->values[k].name); break; } } if ( !cdata.bbsize.isEmpty() ) _memory->setConfigValue(protection.bootSizeMaskName(), cdata.bbsize); } -bool ChecksumCheck::checkChecksum(BitValue checksum, const QString &label) +bool ChecksumCheck::checkChecksum(BitValue checksum, const TQString &label) { BitValue c = _memory->checksum(); - if ( c!=checksum ) TEST_FAILED_RETURN(QString("%1 %2/%3").arg(label).arg(toHexLabel(c, 4)).arg(toHexLabel(checksum, 4))) + if ( c!=checksum ) TEST_FAILED_RETURN(TQString("%1 %2/%3").tqarg(label).tqarg(toHexLabel(c, 4)).tqarg(toHexLabel(checksum, 4))) return true; } -void ChecksumCheck::checkChecksum(const Pic::Data &pdata, const QString &maskName, const QString &valueName, bool &ok) +void ChecksumCheck::checkChecksum(const Pic::Data &pdata, const TQString &tqmaskName, const TQString &valueName, bool &ok) { - if ( !pdata.checksums().contains(valueName) ) { - const Pic::Config::Mask *mask = pdata.config().findMask(maskName); - QString label = valueName + (mask ? "/" + mask->name : QString::null); + if ( !pdata.checksums().tqcontains(valueName) ) { + const Pic::Config::Mask *tqmask = pdata.config().findMask(tqmaskName); + TQString label = valueName + (tqmask ? "/" + tqmask->name : TQString()); printf("Missing checksum for \"%s\"", label.latin1()); return; } const Pic::Checksum::Data &cdata = pdata.checksums()[valueName]; _memory->clear(); - setProtection(pdata, cdata, maskName, valueName); - if ( !checkChecksum(cdata.blankChecksum, maskName + ":" + valueName + "/" + "blank") ) ok = false; + setProtection(pdata, cdata, tqmaskName, valueName); + if ( !checkChecksum(cdata.blankChecksum, tqmaskName + ":" + valueName + "/" + "blank") ) ok = false; _memory->checksumCheckFill(); - setProtection(pdata, cdata, maskName, valueName); - if ( !checkChecksum(cdata.checkChecksum, maskName + ":" + valueName + "/" + "check") ) ok = false; + setProtection(pdata, cdata, tqmaskName, valueName); + if ( !checkChecksum(cdata.checkChecksum, tqmaskName + ":" + valueName + "/" + "check") ) ok = false; } bool ChecksumCheck::execute(const Device::Data &data) @@ -80,16 +80,16 @@ bool ChecksumCheck::execute(const Device::Data &data) const Pic::Protection &protection = pdata.config().protection(); switch ( protection.family() ) { case Pic::Protection::NoProtection: - checkChecksum(pdata, QString::null, QString::null, ok); + checkChecksum(pdata, TQString(), TQString(), ok); break; case Pic::Protection::BasicProtection: { - QString maskName = protection.maskName(Pic::Protection::ProgramProtected, Pic::MemoryRangeType::Code); - const Pic::Config::Mask *mask = pdata.config().findMask(maskName); - Q_ASSERT(mask); - for (uint i=0; ivalues.count(); i++) { - QString valueName = mask->values[i].name; + TQString tqmaskName = protection.tqmaskName(Pic::Protection::ProgramProtected, Pic::MemoryRangeType::Code); + const Pic::Config::Mask *tqmask = pdata.config().findMask(tqmaskName); + Q_ASSERT(tqmask); + for (uint i=0; ivalues.count(); i++) { + TQString valueName = tqmask->values[i].name; if ( valueName.isEmpty() ) continue; // invalid value - checkChecksum(pdata, maskName, valueName, ok); + checkChecksum(pdata, tqmaskName, valueName, ok); } break; } @@ -98,10 +98,10 @@ bool ChecksumCheck::execute(const Device::Data &data) checkChecksum(pdata, "GSSEC", "High Security", ok); break; case Pic::Protection::BlockProtection: { - const QMap &cmap = pdata.checksums(); - QMap::const_iterator it; + const TQMap &cmap = pdata.checksums(); + TQMap::const_iterator it; for (it=cmap.begin(); it!=cmap.end(); ++it) - checkChecksum(pdata, QString::null, it.key(), ok); + checkChecksum(pdata, TQString(), it.key(), ok); break; } case Pic::Protection::Nb_Families: Q_ASSERT(false); break; diff --git a/src/piklab-test/checksum/checksum_check.h b/src/piklab-test/checksum/checksum_check.h index 6483984..e56fd2b 100644 --- a/src/piklab-test/checksum/checksum_check.h +++ b/src/piklab-test/checksum/checksum_check.h @@ -27,9 +27,9 @@ private: Pic::Memory *_memory; void setProtection(const Pic::Data &data, const Pic::Checksum::Data &cdata, - const QString &maskName, const QString &valueName); - bool checkChecksum(BitValue checksum, const QString &label); - void checkChecksum(const Pic::Data &data, const QString &maskName, const QString &valueName, bool &ok); + const TQString &tqmaskName, const TQString &valueName); + bool checkChecksum(BitValue checksum, const TQString &label); + void checkChecksum(const Pic::Data &data, const TQString &tqmaskName, const TQString &valueName, bool &ok); }; #endif diff --git a/src/piklab-test/misc/misc_check.cpp b/src/piklab-test/misc/misc_check.cpp index 3f14287..7f8c710 100644 --- a/src/piklab-test/misc/misc_check.cpp +++ b/src/piklab-test/misc/misc_check.cpp @@ -14,7 +14,7 @@ bool MiscCheck::execute() { { - PURL::Url url = PURL::Url::fromPathOrUrl(QString::null); + PURL::Url url = PURL::Url::fromPathOrUrl(TQString()); if ( !url.isEmpty() ) TEST_FAILED("isEmpty"); TEST_PASSED; } diff --git a/src/piklab-test/save_load_memory/save_load_memory_check.cpp b/src/piklab-test/save_load_memory/save_load_memory_check.cpp index 22eb1ea..e6bb1be 100644 --- a/src/piklab-test/save_load_memory/save_load_memory_check.cpp +++ b/src/piklab-test/save_load_memory/save_load_memory_check.cpp @@ -50,9 +50,9 @@ bool SaveLoadMemoryCheck::execute(const Device::Data &data) // read hex file if ( !_fdest->openForRead() ) TEST_FAILED_RETURN("") - QStringList errors, warnings; + TQStringList errors, warnings; Device::Memory::WarningTypes wtypes; - if ( !_memory2->load(_fdest->stream(), errors, wtypes, warnings) ) TEST_FAILED_RETURN(QString("Error loading hex file into memory %1").arg(data.name())) + if ( !_memory2->load(_fdest->stream(), errors, wtypes, warnings) ) TEST_FAILED_RETURN(TQString("Error loading hex file into memory %1").tqarg(data.name())) // compare checksums if ( _memory1->checksum()!=_memory2->checksum() ) TEST_FAILED_RETURN("Memory saved and loaded is different") -- cgit v1.2.1