summaryrefslogtreecommitdiffstats
path: root/src/coff/base/disassembler.cpp
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/coff/base/disassembler.cpp
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/coff/base/disassembler.cpp')
-rw-r--r--src/coff/base/disassembler.cpp88
1 files changed, 44 insertions, 44 deletions
diff --git a/src/coff/base/disassembler.cpp b/src/coff/base/disassembler.cpp
index 663c163..c818beb 100644
--- a/src/coff/base/disassembler.cpp
+++ b/src/coff/base/disassembler.cpp
@@ -8,14 +8,14 @@
***************************************************************************/
#include "disassembler.h"
-#include <qregexp.h>
+#include <tqregexp.h>
#include "devices/base/device_group.h"
#include "devices/pic/pic/pic_memory.h"
#include "coff_object.h"
//-----------------------------------------------------------------------------
-QString SourceLine::comment(PURL::SourceFamily family, const QString &text)
+TQString SourceLine::comment(PURL::SourceFamily family, const TQString &text)
{
switch (family.type()) {
case PURL::SourceFamily::Asm: return "; " + text;
@@ -26,7 +26,7 @@ QString SourceLine::comment(PURL::SourceFamily family, const QString &text)
case PURL::SourceFamily::Nb_Types: break;
}
Q_ASSERT(false);
- return QString::null;
+ return TQString();
}
namespace SourceLine
@@ -34,15 +34,15 @@ namespace SourceLine
class LineData {
public:
LineData() : group(-1) {}
- QString text, comment;
+ TQString text, comment;
int group;
};
} // namespace
-QStringList SourceLine::lines(PURL::SourceFamily family, const List &list, uint nbSpaces)
+TQStringList SourceLine::lines(PURL::SourceFamily family, const List &list, uint nbSpaces)
{
- QValueList<LineData> lines;
- QValueList<uint> groupCommentColumn;
+ TQValueList<LineData> lines;
+ TQValueList<uint> groupCommentColumn;
groupCommentColumn.append(0);
List::const_iterator it;
for (it=list.begin(); it!=list.end(); ++it) {
@@ -71,8 +71,8 @@ QStringList SourceLine::lines(PURL::SourceFamily family, const List &list, uint
}
lines += data;
}
- QStringList slines;
- QValueList<LineData>::const_iterator lit;
+ TQStringList slines;
+ TQValueList<LineData>::const_iterator lit;
for (lit=lines.begin(); lit!=lines.end(); ++lit) {
if ( (*lit).group==-1 || (*lit).comment.isEmpty() ) slines += (*lit).text;
else {
@@ -83,55 +83,55 @@ QStringList SourceLine::lines(PURL::SourceFamily family, const List &list, uint
return slines;
}
-QString SourceLine::text(PURL::SourceFamily family, const List &list, uint nbSpaces)
+TQString SourceLine::text(PURL::SourceFamily family, const List &list, uint nbSpaces)
{
return lines(family, list, nbSpaces).join("\n") + "\n";
}
-QString SourceLine::transformConfigName(const Pic::Data &data, uint wordIndex, const QString &name)
+TQString SourceLine::transformConfigName(const Pic::Data &data, uint wordIndex, const TQString &name)
{
if ( !data.is18Family() ) return name;
bool ok;
(void)fromHexLabel(name, &ok);
if (ok) return name;
- QString s = name + '_';
+ TQString s = name + '_';
if ( data.name()=="18C601" || data.name()=="18C801" || data.name().startsWith("18F" ) )
- s += QString::number(wordIndex/2+1) + (wordIndex%2==0 ? 'L' : 'H');
- else s += QString::number(wordIndex);
+ s += TQString::number(wordIndex/2+1) + (wordIndex%2==0 ? 'L' : 'H');
+ else s += TQString::number(wordIndex);
return s;
}
-QStringList SourceLine::ignoredConfigNames(const Pic::Data &data, uint wordIndex)
+TQStringList SourceLine::ignoredConfigNames(const Pic::Data &data, uint wordIndex)
{
- QStringList cnames;
- const QStringList &names = data.config()._words[wordIndex].ignoredCNames;
+ TQStringList cnames;
+ const TQStringList &names = data.config()._words[wordIndex].ignoredCNames;
for (uint i=0; i<uint(names.count()); i++) cnames += transformConfigName(data, wordIndex, names[i]);
return cnames;
}
-QStringList SourceLine::extraConfigNames(const Pic::Data &data, uint wordIndex, const Pic::Config::Value &value)
+TQStringList SourceLine::extraConfigNames(const Pic::Data &data, uint wordIndex, const Pic::Config::Value &value)
{
- QStringList cnames;
- const QStringList &names = value.configNames[Pic::ConfigNameType::Extra];
+ TQStringList cnames;
+ const TQStringList &names = value.configNames[Pic::ConfigNameType::Extra];
for (uint i=0; i<uint(names.count()); i++) cnames += transformConfigName(data, wordIndex, names[i]);
return cnames;
}
-QStringList SourceLine::configNames(Pic::ConfigNameType type, const Pic::Memory &memory, uint word, bool &ok)
+TQStringList SourceLine::configNames(Pic::ConfigNameType type, const Pic::Memory &memory, uint word, bool &ok)
{
ok = true;
const Pic::Data &data = memory.device();
const Pic::Config &config = data.config();
BitValue v = memory.normalizedWord(Pic::MemoryRangeType::Config, word);
const Pic::Config::Word &cword = config._words[word];
- QStringList cnames;
- for (uint k=0; k<uint(cword.masks.count()); k++) {
- const Pic::Config::Mask &cmask = cword.masks[k];
- if ( cmask.value.isInside(cword.pmask) ) continue; // protected bits
- for (int l=cmask.values.count()-1; l>=0; l--) {
- const Pic::Config::Value &cvalue = cmask.values[l];
+ TQStringList cnames;
+ for (uint k=0; k<uint(cword.tqmasks.count()); k++) {
+ const Pic::Config::Mask &ctqmask = cword.tqmasks[k];
+ if ( ctqmask.value.isInside(cword.ptqmask) ) continue; // protected bits
+ for (int l=ctqmask.values.count()-1; l>=0; l--) {
+ const Pic::Config::Value &cvalue = ctqmask.values[l];
if ( !cvalue.value.isInside(v) ) continue;
- QStringList vcnames = cvalue.configNames[type];
+ TQStringList vcnames = cvalue.configNames[type];
if ( vcnames.isEmpty() && type!=Pic::ConfigNameType::Default ) vcnames = cvalue.configNames[Pic::ConfigNameType::Default];
for (uint i=0; i<uint(vcnames.count()); i++) {
if ( vcnames[i].isEmpty() ) ok = false;
@@ -144,7 +144,7 @@ QStringList SourceLine::configNames(Pic::ConfigNameType type, const Pic::Memory
}
//-----------------------------------------------------------------------------
-QString GPUtils::toDeviceName(const QString &device)
+TQString GPUtils::toDeviceName(const TQString &device)
{
if ( device.startsWith("PS") ) return device.lower();
return "p" + device.lower();
@@ -153,10 +153,10 @@ QString GPUtils::toDeviceName(const QString &device)
SourceLine::List GPUtils::includeLines(const Device::Data &data)
{
SourceLine::List lines;
- QString include = toDeviceName(data.name());
+ TQString include = toDeviceName(data.name());
if ( data.name()=="12CR509A" ) include = "p12c509a";
- else if ( QRegExp("16CR?5.?[A-C]?").exactMatch(data.name()) ) include = "p16c5x";
- else if ( QRegExp("16F5.?").exactMatch(data.name()) ) include = "p16f5x";
+ else if ( TQRegExp("16CR?5.?[A-C]?").exactMatch(data.name()) ) include = "p16c5x";
+ else if ( TQRegExp("16F5.?").exactMatch(data.name()) ) include = "p16f5x";
else if ( data.name()=="16CR620A" ) include = "p16c620a";
lines.appendIndentedCode("#include <" + include + ".inc>");
return lines;
@@ -169,9 +169,9 @@ SourceLine::List GPUtils::generateConfigLines(const Pic::Memory &memory, bool &o
const Pic::Config &config = data.config();
for (uint i=0; i<data.nbWords(Pic::MemoryRangeType::Config); i++) {
const Pic::Config::Word &cword = config._words[i];
- QStringList cnames = SourceLine::configNames(Pic::ConfigNameType::Default, memory, i, ok);
+ TQStringList cnames = SourceLine::configNames(Pic::ConfigNameType::Default, memory, i, ok);
if ( cnames.isEmpty() ) continue;
- QString code = "__CONFIG ";
+ TQString code = "__CONFIG ";
if ( !cword.name.isEmpty() ) code += "_" + cword.name + ", ";
code += cnames.join(" & ");
lines.appendIndentedCode(code);
@@ -192,8 +192,8 @@ SourceLine::List GPUtils::disassemble(const Pic::Memory &memory)
bool isDefault = true;
for (uint k=0; k<data.nbWords(Pic::MemoryRangeType::Config); k++) {
BitValue op = memory.normalizedWord(Pic::MemoryRangeType::Config, k);
- BitValue mask = data.config()._words[k].usedMask();
- if ( !mask.isInside(op) ) isDefault = false; // this is not completely correct but otherwise empty config is written...
+ BitValue tqmask = data.config()._words[k].usedMask();
+ if ( !tqmask.isInside(op) ) isDefault = false; // this is not completely correct but otherwise empty config is written...
}
if ( !isDefault ) {
lines.appendEmpty();
@@ -203,11 +203,11 @@ SourceLine::List GPUtils::disassemble(const Pic::Memory &memory)
}
// user ids
- QString tmp;
+ TQString tmp;
for (uint k=0; k<data.nbWords(Pic::MemoryRangeType::UserId); k++) {
BitValue op = memory.normalizedWord(Pic::MemoryRangeType::UserId, k);
- BitValue mask = data.userIdRecommendedMask();
- if ( mask.isInside(op) ) continue;
+ BitValue tqmask = data.userIdRecommendedMask();
+ if ( tqmask.isInside(op) ) continue;
if ( data.is18Family() ) {
Address ad = data.range(Pic::MemoryRangeType::UserId).start + data.range(Pic::MemoryRangeType::UserId).hexFileOffset + k*data.addressIncrement(Pic::MemoryRangeType::UserId);
lines.appendIndentedCode("__IDLOCS " + toHexLabel(ad, data.nbCharsAddress()) + ", " + toHexLabel(op, data.nbCharsWord(Pic::MemoryRangeType::UserId)));
@@ -227,8 +227,8 @@ SourceLine::List GPUtils::disassemble(const Pic::Memory &memory)
uint nb = data.nbWords(Pic::MemoryRangeType::Code);
for (uint k=0; k<nb; k++) {
BitValue op = memory.normalizedWord(Pic::MemoryRangeType::Code, k);
- BitValue mask = data.mask(Pic::MemoryRangeType::Code);
- if ( mask.isInside(op) ) newOrg = true;
+ BitValue tqmask = data.tqmask(Pic::MemoryRangeType::Code);
+ if ( tqmask.isInside(op) ) newOrg = true;
else {
if (newOrg) {
if ( !first ) tmp += '\n';
@@ -241,7 +241,7 @@ SourceLine::List GPUtils::disassemble(const Pic::Memory &memory)
buffer[0] = 0;
BitValue op2 = ((k+1)<nb ? memory.word(Pic::MemoryRangeType::Code, k+1) : 0);
uint n = Coff::disassemble(op.toUInt(), op2.toUInt(), k, data.architecture(), buffer, 512);
- lines.appendIndentedCode(QString(buffer));
+ lines.appendIndentedCode(TQString(buffer));
if ( n==2 ) k++;
}
}
@@ -254,8 +254,8 @@ SourceLine::List GPUtils::disassemble(const Pic::Memory &memory)
nb = data.nbWords(Pic::MemoryRangeType::Eeprom);
for (uint k=0; k<nb; k++) {
BitValue op = memory.normalizedWord(Pic::MemoryRangeType::Eeprom, k);
- BitValue mask = data.mask(Pic::MemoryRangeType::Eeprom);
- if ( mask.isInside(op) ) newOrg = true;
+ BitValue tqmask = data.tqmask(Pic::MemoryRangeType::Eeprom);
+ if ( tqmask.isInside(op) ) newOrg = true;
else {
if (newOrg) {
Address org = data.range(Pic::MemoryRangeType::Eeprom).start + data.range(Pic::MemoryRangeType::Eeprom).hexFileOffset + k*data.addressIncrement(Pic::MemoryRangeType::Eeprom);