diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
commit | 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch) | |
tree | b95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/coff | |
parent | b79a2c28534cf09987eeeba3077fff9236df182a (diff) | |
download | piklab-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')
-rw-r--r-- | src/coff/base/cdb_parser.cpp | 42 | ||||
-rw-r--r-- | src/coff/base/cdb_parser.h | 38 | ||||
-rw-r--r-- | src/coff/base/coff.cpp | 26 | ||||
-rw-r--r-- | src/coff/base/coff.h | 10 | ||||
-rw-r--r-- | src/coff/base/coff_archive.cpp | 48 | ||||
-rw-r--r-- | src/coff/base/coff_archive.h | 18 | ||||
-rw-r--r-- | src/coff/base/coff_data.h | 2 | ||||
-rw-r--r-- | src/coff/base/coff_object.cpp | 148 | ||||
-rw-r--r-- | src/coff/base/coff_object.h | 108 | ||||
-rw-r--r-- | src/coff/base/disassembler.cpp | 88 | ||||
-rw-r--r-- | src/coff/base/disassembler.h | 28 | ||||
-rw-r--r-- | src/coff/base/gpdis.cpp | 14 | ||||
-rw-r--r-- | src/coff/base/gpopcode.h | 2 | ||||
-rw-r--r-- | src/coff/base/text_coff.cpp | 84 | ||||
-rw-r--r-- | src/coff/base/text_coff.h | 20 | ||||
-rw-r--r-- | src/coff/xml/xml_coff_parser.cpp | 26 |
16 files changed, 351 insertions, 351 deletions
diff --git a/src/coff/base/cdb_parser.cpp b/src/coff/base/cdb_parser.cpp index 2e38b84..eb7495b 100644 --- a/src/coff/base/cdb_parser.cpp +++ b/src/coff/base/cdb_parser.cpp @@ -65,7 +65,7 @@ CDB::Object::Object(const PURL::Url &url, Log::Base &log) { PURL::File file(url, log); if ( !file.openForRead() ) return; - QStringList lines = file.readLines(); + TQStringList lines = file.readLines(); for (_line=0; _line<uint(lines.count()); _line++) { _col = 0; @@ -99,12 +99,12 @@ CDB::Object::~Object() for (uint i=0; i<uint(_records.count()); i++) delete _records[i]; } -void CDB::Object::log(Log::LineType type, const QString &message) +void CDB::Object::log(Log::LineType type, const TQString &message) { - _log.log(type, message + " " + i18n("at line #%1, column #%2").arg(_line+1).arg(_col+1)); + _log.log(type, message + " " + i18n("at line #%1, column #%2").tqarg(_line+1).tqarg(_col+1)); } -void CDB::Object::logMalformed(const QString &detail) +void CDB::Object::logMalformed(const TQString &detail) { log(Log::LineType::Error, i18n("Malformed record: ") + detail); } @@ -125,13 +125,13 @@ bool CDB::Object::readAndCheckChar(char c) char r; if ( !readChar(r) ) return false; if ( r!=c ) { - logMalformed(i18n("was expecting '%1'").arg(c)); + logMalformed(i18n("was expecting '%1'").tqarg(c)); return false; } return true; } -bool CDB::Object::getString(const QString &s, QString &r) +bool CDB::Object::getString(const TQString &s, TQString &r) { r = s; if ( r.isEmpty() ) { @@ -141,9 +141,9 @@ bool CDB::Object::getString(const QString &s, QString &r) return true; } -bool CDB::Object::readFixedLengthString(QString &s, uint size) +bool CDB::Object::readFixedLengthString(TQString &s, uint size) { - s = QString::null; + s = TQString(); for (uint i=0; i<size; i++) { char c; if ( !readChar(c) ) return false; @@ -152,9 +152,9 @@ bool CDB::Object::readFixedLengthString(QString &s, uint size) return true; } -bool CDB::Object::readStoppedString(QString &name, char stop) +bool CDB::Object::readStoppedString(TQString &name, char stop) { - QString s; + TQString s; for (;;) { if ( _col==uint(_current.length()) ) { if ( stop!=0 ) { @@ -170,7 +170,7 @@ bool CDB::Object::readStoppedString(QString &name, char stop) return getString(s, name); } -bool CDB::Object::getUInt(const QString &s, uint &v) +bool CDB::Object::getUInt(const TQString &s, uint &v) { bool ok; v = s.toUInt(&ok); @@ -180,7 +180,7 @@ bool CDB::Object::getUInt(const QString &s, uint &v) bool CDB::Object::readUInt(uint &v) { - QString s; + TQString s; for (;;) { if ( _col==uint(_current.length()) ) break; if ( !isdigit(_current[_col].latin1()) ) break; @@ -197,7 +197,7 @@ bool CDB::Object::readBool(bool &b) if ( c=='0' ) b = false; else if ( c=='1' ) b = true; else { - logMalformed(i18n("was expecting a bool ('%1')").arg(c)); + logMalformed(i18n("was expecting a bool ('%1')").tqarg(c)); return false; } return true; @@ -205,7 +205,7 @@ bool CDB::Object::readBool(bool &b) bool CDB::Object::readHex(uint &v) { - QString s; + TQString s; for (;;) { if ( _col==uint(_current.length()) ) break; if ( !isxdigit(_current[_col].latin1()) ) break; @@ -222,9 +222,9 @@ bool CDB::Object::parseModuleRecord(Record * &record) return readStoppedString(mr->filename, 0); } -bool CDB::Object::parse(Scope &scope, QString &name) +bool CDB::Object::parse(Scope &scope, TQString &name) { - QString s; + TQString s; if ( !readFixedLengthString(s, 1) ) return false; scope.type = ScopeType::fromKey(s); switch (scope.type.type()) { @@ -253,12 +253,12 @@ bool CDB::Object::parse(TypeChain &typeChain) if ( !readAndCheckChar('{') ) return false; if ( !readUInt(nb) ) return false; if ( !readAndCheckChar('}') ) return false; - QString s; + TQString s; if ( !readStoppedString(s, ':') ) return false; - QStringList list = QStringList::split(',', s, true); + TQStringList list = TQStringList::split(',', s, true); for (uint i=0; i<uint(list.count()); i++) { DCLType type; - QString key = list[i].mid(0, 2); + TQString key = list[i].mid(0, 2); type.type = VarType::fromKey(key); switch (type.type.type()) { case VarType::Array: @@ -287,7 +287,7 @@ bool CDB::Object::parse(TypeChain &typeChain) bool CDB::Object::parse(AddressSpace &as) { - QString s; + TQString s; if ( !readFixedLengthString(s, 1) ) return false; as.type = AddressSpaceType::fromKey(s); if ( as.type==AddressSpaceType::Nb_Types ) { @@ -302,7 +302,7 @@ bool CDB::Object::parse(AddressSpace &as) if ( !readAndCheckChar(',') ) return false; if ( !readAndCheckChar('[') ) return false; if ( !readStoppedString(s, ']') ) return false; - as.registers = QStringList::split(',', s, true); + as.registers = TQStringList::split(',', s, true); if ( as.registers.count()==0 ) { logMalformed(i18n("no register defined")); return false; diff --git a/src/coff/base/cdb_parser.h b/src/coff/base/cdb_parser.h index 42572ab..52fa17a 100644 --- a/src/coff/base/cdb_parser.h +++ b/src/coff/base/cdb_parser.h @@ -25,7 +25,7 @@ public: class ModuleRecord : public Record { public: - QString filename; + TQString filename; }; BEGIN_DECLARE_ENUM(ScopeType) @@ -36,7 +36,7 @@ class Scope { public: ScopeType type; - QString name; // file or function name + TQString name; // file or function name uint level, block; }; @@ -51,7 +51,7 @@ class DCLType public: VarType type; uint nb; // for Array and BitField - QString name; // for Structure + TQString name; // for Structure }; BEGIN_DECLARE_ENUM(Sign) @@ -61,7 +61,7 @@ END_DECLARE_ENUM_STD(Sign) class TypeChain { public: - QValueVector<DCLType> types; + TQValueVector<DCLType> types; Sign sign; }; @@ -76,13 +76,13 @@ public: AddressSpaceType type; bool onStack; uint stackOffset; // valid if onStack is true - QStringList registers; // for Register type + TQStringList registers; // for Register type }; class SymbolRecord : public Record { public: - QString name; + TQString name; Scope scope; TypeChain typeChain; AddressSpace addressSpace; @@ -105,8 +105,8 @@ public: class TypeRecord : public Record { public: - QString filename, name; - QValueVector<TypeMember> members; + TQString filename, name; + TQValueVector<TypeMember> members; }; class LinkerRecord : public Record @@ -115,10 +115,10 @@ public: enum Type { Address = 0, EndAddress, AsmLine, CLine, Nb_Types }; Type type; Scope scope; // for Address and EndAddress - QString name; // for Address and EndAddress + TQString name; // for Address and EndAddress uint address; uint line; // for AsmLine and CLine - QString filename; // for AsmLine and CLine + TQString filename; // for AsmLine and CLine uint block, level; // for CLine }; @@ -131,23 +131,23 @@ public: private: Log::Base &_log; - QString _current; + TQString _current; uint _line, _col; - QValueVector<Record *> _records; + TQValueVector<Record *> _records; - void log(Log::LineType type, const QString &message); - void logMalformed(const QString &detail); + void log(Log::LineType type, const TQString &message); + void logMalformed(const TQString &detail); bool readBool(bool &b); - bool getUInt(const QString &s, uint &r); + bool getUInt(const TQString &s, uint &r); bool readUInt(uint &v); bool readChar(char &c); bool readAndCheckChar(char c); - bool getString(const QString &s, QString &r); - bool readStoppedString(QString &s, char stop); - bool readFixedLengthString(QString &s, uint size); + bool getString(const TQString &s, TQString &r); + bool readStoppedString(TQString &s, char stop); + bool readFixedLengthString(TQString &s, uint size); bool readHex(uint &v); - bool parse(Scope &scope, QString &name); + bool parse(Scope &scope, TQString &name); bool parse(TypeChain &typeChain); bool parse(TypeRecord &typeRecord); bool parse(SymbolRecord &sr); diff --git a/src/coff/base/coff.cpp b/src/coff/base/coff.cpp index 5eaad84..83100a4 100644 --- a/src/coff/base/coff.cpp +++ b/src/coff/base/coff.cpp @@ -33,64 +33,64 @@ CoffType Coff::identify(const PURL::Url &url, Log::Base &log) { PURL::File file(url, log); if ( !file.openForRead() ) return CoffType::Nb_Types; - QByteArray data = file.readAll(); + TQByteArray data = file.readAll(); if ( log.hasError() ) return CoffType::Nb_Types; uint offset = 0; Format format; - Q_UINT32 magic; + TQ_UINT32 magic; return identify(data, offset, log, format, magic); } -CoffType Coff::identify(const QByteArray &data, uint &offset, Log::Base &log, Format &format, Q_UINT32 &magic) +CoffType Coff::identify(const TQByteArray &data, uint &offset, Log::Base &log, Format &format, TQ_UINT32 &magic) { - QString id = "!<arch>\012"; + TQString id = "!<arch>\012"; if ( data.count()>=id.length() ) { - QString s = QString::fromAscii(data.data(), id.length()); + TQString s = TQString::fromAscii(data.data(), id.length()); if ( s==id ) { offset += id.length(); return CoffType::Archive; } } if ( !getULong(data, offset, 2, log, magic) ) return CoffType::Nb_Types; - log.log(Log::DebugLevel::Extra, QString("COFF format: %1").arg(toHexLabel(magic, 4))); + log.log(Log::DebugLevel::Extra, TQString("COFF format: %1").tqarg(toHexLabel(magic, 4))); format = Format::Nb_Types; FOR_EACH(Format, f) if ( magic==f.data().magic ) format = f; return CoffType::Object; } //---------------------------------------------------------------------------- -bool Coff::getULong(const QByteArray &data, uint &offset, uint nbBytes, Log::Base &log, Q_UINT32 &v) +bool Coff::getULong(const TQByteArray &data, uint &offset, uint nbBytes, Log::Base &log, TQ_UINT32 &v) { bool ok; v = ::getULong(data, offset, nbBytes, &ok); if ( !ok ) { - log.log(Log::LineType::Error, i18n("COFF file is truncated (offset: %1 nbBytes: %2 size:%3).").arg(offset).arg(nbBytes).arg(data.count())); + log.log(Log::LineType::Error, i18n("COFF file is truncated (offset: %1 nbBytes: %2 size:%3).").tqarg(offset).tqarg(nbBytes).tqarg(data.count())); return false; } offset += nbBytes; return true; } -bool Coff::getString(const QByteArray &data, uint &offset, uint nbChars, Log::Base &log, QString &name) +bool Coff::getString(const TQByteArray &data, uint &offset, uint nbChars, Log::Base &log, TQString &name) { if ( !checkAvailable(data, offset, nbChars) ) { - log.log(Log::LineType::Error, i18n("COFF file is truncated (offset: %1 nbBytes: %2 size:%3).").arg(offset).arg(nbChars).arg(data.count())); + log.log(Log::LineType::Error, i18n("COFF file is truncated (offset: %1 nbBytes: %2 size:%3).").tqarg(offset).tqarg(nbChars).tqarg(data.count())); return false; } - name = QString::fromAscii(data.data()+offset, nbChars); + name = TQString::fromAscii(data.data()+offset, nbChars); offset += nbChars; return true; } //---------------------------------------------------------------------------- -bool Coff::Base::initParse(CoffType type, QByteArray &data, uint &offset, Log::Base &log) +bool Coff::Base::initParse(CoffType type, TQByteArray &data, uint &offset, Log::Base &log) { PURL::File file(_url, log); if ( !file.openForRead() ) return false; data = file.readAll(); if ( log.hasError() ) return false; if ( identify(data, offset, log, _format, _magic)!=type ) { - log.log(Log::LineType::Error, i18n("Could not recognize file (magic number is %1).").arg(toHexLabel(_magic, 4))); + log.log(Log::LineType::Error, i18n("Could not recognize file (magic number is %1).").tqarg(toHexLabel(_magic, 4))); return false; } return true; diff --git a/src/coff/base/coff.h b/src/coff/base/coff.h index edd0ae5..8e69ef0 100644 --- a/src/coff/base/coff.h +++ b/src/coff/base/coff.h @@ -21,8 +21,8 @@ END_DECLARE_ENUM_STD(CoffType) //---------------------------------------------------------------------------- namespace Coff { -extern bool getString(const QByteArray &data, uint &offset, uint nbChars, Log::Base &log, QString &name); -extern bool getULong(const QByteArray &data, uint &offset, uint nbBytes, Log::Base &log, Q_UINT32 &v); +extern bool getString(const TQByteArray &data, uint &offset, uint nbChars, Log::Base &log, TQString &name); +extern bool getULong(const TQByteArray &data, uint &offset, uint nbBytes, Log::Base &log, TQ_UINT32 &v); //---------------------------------------------------------------------------- enum SizeType { HeaderSize = 0, OptHeaderSize, SectionHeaderSize, SymbolSize, @@ -37,7 +37,7 @@ BEGIN_DECLARE_ENUM(Format) END_DECLARE_ENUM(Format, FormatData) extern CoffType identify(const PURL::Url &url, Log::Base &log); -extern CoffType identify(const QByteArray &data, uint &offset, Log::Base &log, Format &format, Q_UINT32 &magic); +extern CoffType identify(const TQByteArray &data, uint &offset, Log::Base &log, Format &format, TQ_UINT32 &magic); //---------------------------------------------------------------------------- class Base @@ -54,9 +54,9 @@ public: protected: PURL::Url _url; Format _format; - Q_UINT32 _magic; + TQ_UINT32 _magic; - bool initParse(CoffType type, QByteArray &data, uint &offset, Log::Base &log); + bool initParse(CoffType type, TQByteArray &data, uint &offset, Log::Base &log); }; } // namespace diff --git a/src/coff/base/coff_archive.cpp b/src/coff/base/coff_archive.cpp index 72a8883..ea9a2b9 100644 --- a/src/coff/base/coff_archive.cpp +++ b/src/coff/base/coff_archive.cpp @@ -9,35 +9,35 @@ #include "coff_archive.h" //---------------------------------------------------------------------------- -Coff::Member::Member(const QByteArray &data, uint &offset, Log::Base &log) +Coff::Member::Member(const TQByteArray &data, uint &offset, Log::Base &log) { // parse header - QString s; + TQString s; if ( !getString(data, offset, 256, log, s) ) return; - int i = s.find('/'); + int i = s.tqfind('/'); if ( i==-1 ) { - log.log(Log::LineType::Error, i18n("Member name not terminated by '/' (\"%1\").").arg(s)); + log.log(Log::LineType::Error, i18n("Member name not terminated by '/' (\"%1\").").tqarg(s)); return; } _name = s.mid(0, i); if ( !getString(data, offset, 12, log, s) ) return; // mtime if ( !getString(data, offset, 10, log, s) ) return; - i = s.find('l'); + i = s.tqfind('l'); if ( i==-1 ) { - log.log(Log::LineType::Error, i18n("File size not terminated by 'l' (\"%1\").").arg(s)); + log.log(Log::LineType::Error, i18n("File size not terminated by 'l' (\"%1\").").tqarg(s)); return; } bool ok; _nbBytes = s.mid(0, i).toUInt(&ok); if ( !ok ) { - log.log(Log::LineType::Error, i18n("Wrong format for file size \"%1\".").arg(s)); + log.log(Log::LineType::Error, i18n("Wrong format for file size \"%1\".").tqarg(s)); return; } - Q_UINT32 v; + TQ_UINT32 v; if ( !getULong(data, offset, 2, log, v) ) return; - log.log(Log::DebugLevel::Extra, i18n("Magic number: %1").arg(toHexLabel(v, 4))); + log.log(Log::DebugLevel::Extra, i18n("Magic number: %1").tqarg(toHexLabel(v, 4))); // if ( v!=0x600A ) { -// log.log(Log::LineType::Error, i18n("Wrong magic for Microchip archive (\"%1\").").arg(toHexLabel(v, 4))); +// log.log(Log::LineType::Error, i18n("Wrong magic for Microchip archive (\"%1\").").tqarg(toHexLabel(v, 4))); // return; // } offset += _nbBytes; @@ -50,7 +50,7 @@ Coff::Archive::Archive(const PURL::Url &url) bool Coff::Archive::parse(Log::Base &log) { - QByteArray data; + TQByteArray data; uint offset = 0, symbolEnd = 0; Member *symbol = 0; if ( !initParse(CoffType::Archive, data, offset, log) ) return false; @@ -76,26 +76,26 @@ bool Coff::Archive::parse(Log::Base &log) Coff::Archive::~Archive() { - QMap<QString, Member *>::const_iterator it; + TQMap<TQString, Member *>::const_iterator it; for (it=_members.begin(); it!=_members.end(); ++it) delete it.data(); } -bool Coff::Archive::readSymbols(const QByteArray &data, uint offset, Log::Base &log) +bool Coff::Archive::readSymbols(const TQByteArray &data, uint offset, Log::Base &log) { - Q_UINT32 nb; + TQ_UINT32 nb; if ( !getULong(data, offset, 4, log, nb) ) return false; - QValueVector<Member *> members(nb); + TQValueVector<Member *> members(nb); for (uint i=0; i<nb; i++) { - Q_UINT32 start; + TQ_UINT32 start; if ( !getULong(data, offset, 4, log, start) ) return false; - if ( !_offsets.contains(start) ) { - log.log(Log::LineType::Error, i18n("Unknown file member offset: %1").arg(toHexLabel(start, 8))); + if ( !_offsets.tqcontains(start) ) { + log.log(Log::LineType::Error, i18n("Unknown file member offset: %1").tqarg(toHexLabel(start, 8))); return false; } members[i] = _offsets[start]; } for (uint i=0; i<nb; i++) { - QString name(data.data() + offset); + TQString name(data.data() + offset); offset += name.length() + 1; _symbols[name] = members[i]; } @@ -105,24 +105,24 @@ bool Coff::Archive::readSymbols(const QByteArray &data, uint offset, Log::Base & Log::KeyList Coff::Archive::information() const { Log::KeyList keys(i18n("Information:")); - keys.append(i18n("No. of file members:"), QString::number(members().count())); - keys.append(i18n("No. of symbols:"), QString::number(symbols().count())); + keys.append(i18n("No. of file members:"), TQString::number(members().count())); + keys.append(i18n("No. of symbols:"), TQString::number(symbols().count())); return keys; } Log::KeyList Coff::Archive::membersInformation() const { Log::KeyList keys(i18n("File Members:")); - QMap<QString, Member *>::const_iterator it; + TQMap<TQString, Member *>::const_iterator it; for (it=members().begin(); it!=members().end(); ++it) - keys.append(it.key(), i18n("size: %1 bytes").arg(it.data()->nbBytes())); + keys.append(it.key(), i18n("size: %1 bytes").tqarg(it.data()->nbBytes())); return keys; } Log::KeyList Coff::Archive::symbolsInformation() const { Log::KeyList keys(i18n("Symbols:")); - QMap<QString, Member *>::const_iterator it; + TQMap<TQString, Member *>::const_iterator it; for (it=symbols().begin(); it!=symbols().end(); ++it) keys.append(it.key(), it.data()->name()); return keys; diff --git a/src/coff/base/coff_archive.h b/src/coff/base/coff_archive.h index ba43a38..e4d0032 100644 --- a/src/coff/base/coff_archive.h +++ b/src/coff/base/coff_archive.h @@ -17,12 +17,12 @@ namespace Coff class Member { public: - Member(const QByteArray &data, uint &offset, Log::Base &log); - QString name() const { return _name; } + Member(const TQByteArray &data, uint &offset, Log::Base &log); + TQString name() const { return _name; } uint nbBytes() const { return _nbBytes; } private: - QString _name; + TQString _name; uint _nbBytes; }; @@ -33,19 +33,19 @@ public: Archive(const PURL::Url &url); virtual ~Archive(); virtual bool parse(Log::Base &log); - const QMap<QString, Member *>members() const { return _members; } - const QMap<QString, Member *>symbols() const { return _symbols; } + const TQMap<TQString, Member *>members() const { return _members; } + const TQMap<TQString, Member *>symbols() const { return _symbols; } virtual Log::KeyList information() const; Log::KeyList membersInformation() const; Log::KeyList symbolsInformation() const; private: - QMap<QString, Member *> _members; // name -> Member * - QMap<uint, Member *> _offsets; // offset -> Member * - QMap<QString, Member *> _symbols; // name -> Member * + TQMap<TQString, Member *> _members; // name -> Member * + TQMap<uint, Member *> _offsets; // offset -> Member * + TQMap<TQString, Member *> _symbols; // name -> Member * - bool readSymbols(const QByteArray &data, uint offset, Log::Base &log); + bool readSymbols(const TQByteArray &data, uint offset, Log::Base &log); }; } // namespace diff --git a/src/coff/base/coff_data.h b/src/coff/base/coff_data.h index 9676e42..17a0e0e 100644 --- a/src/coff/base/coff_data.h +++ b/src/coff/base/coff_data.h @@ -15,7 +15,7 @@ namespace Coff struct Data { uint ids[MAX_NB_IDS]; }; - extern QString findId(uint id); + extern TQString findId(uint id); } // namespace diff --git a/src/coff/base/coff_object.cpp b/src/coff/base/coff_object.cpp index f4109f9..f6263fd 100644 --- a/src/coff/base/coff_object.cpp +++ b/src/coff/base/coff_object.cpp @@ -16,10 +16,10 @@ #include "common/global/pfile.h" //---------------------------------------------------------------------------- -bool Coff::getName(const QByteArray &data, uint &offset, uint nbChars, uint stringTableOffset, - Log::Base &log, QString &name) +bool Coff::getName(const TQByteArray &data, uint &offset, uint nbChars, uint stringTableOffset, + Log::Base &log, TQString &name) { - Q_UINT32 v; + TQ_UINT32 v; if ( !getULong(data, offset, 4, log, v) ) return false; if ( v!=0 ) { // name is not in string table offset -= 4; @@ -27,7 +27,7 @@ bool Coff::getName(const QByteArray &data, uint &offset, uint nbChars, uint stri } if ( !getULong(data, offset, 4, log, v) ) return false; // ### do a sanity check here - name = QString(data.data()+stringTableOffset+v); + name = TQString(data.data()+stringTableOffset+v); return true; } @@ -55,7 +55,7 @@ const Coff::AuxSymbolType::Data Coff::AuxSymbolType::DATA[Nb_Types] = { { 0, I18N_NOOP("Section") } }; -Coff::AuxSymbol *Coff::AuxSymbol::factory(const Object &object, AuxSymbolType type, const QByteArray &data, uint offset, uint stringTableOffset, Log::Base &log) +Coff::AuxSymbol *Coff::AuxSymbol::factory(const Object &object, AuxSymbolType type, const TQByteArray &data, uint offset, uint stringTableOffset, Log::Base &log) { switch (type.type()) { case AuxSymbolType::Direct: return new AuxSymbolDirect(object, data, offset, stringTableOffset, log); @@ -68,47 +68,47 @@ Coff::AuxSymbol *Coff::AuxSymbol::factory(const Object &object, AuxSymbolType ty return 0; } -Coff::AuxSymbolDirect::AuxSymbolDirect(const Object &object, const QByteArray &data, uint start, uint stringTableOffset, Log::Base &log) +Coff::AuxSymbolDirect::AuxSymbolDirect(const Object &object, const TQByteArray &data, uint start, uint stringTableOffset, Log::Base &log) : AuxSymbol(object) { uint offset = start; - Q_UINT32 v; + TQ_UINT32 v; if ( !getULong(data, offset, 1, log, v) ) return; _command = v; if ( !getULong(data, offset, 4, log, v) ) return; - _string = QString(data.data()+stringTableOffset+v); + _string = TQString(data.data()+stringTableOffset+v); } -Coff::AuxSymbolFile::AuxSymbolFile(const Object &object, const QByteArray &data, uint start, uint stringTableOffset, Log::Base &log) +Coff::AuxSymbolFile::AuxSymbolFile(const Object &object, const TQByteArray &data, uint start, uint stringTableOffset, Log::Base &log) : AuxSymbol(object) { uint offset = start; - Q_UINT32 v; + TQ_UINT32 v; if ( object.format()==Format::PIC30 ) { if ( !getName(data, offset, 14, stringTableOffset, log, _filename) ) return; _line = 0; } else { if ( !getULong(data, offset, 4, log, v) ) return; - _filename = QString(data.data()+stringTableOffset+v); + _filename = TQString(data.data()+stringTableOffset+v); if ( !getULong(data, offset, 4, log, v) ) return; _line = v; } } -Coff::AuxSymbolIdentifier::AuxSymbolIdentifier(const Object &object, const QByteArray &data, uint start, uint stringTableOffset, Log::Base &log) +Coff::AuxSymbolIdentifier::AuxSymbolIdentifier(const Object &object, const TQByteArray &data, uint start, uint stringTableOffset, Log::Base &log) : AuxSymbol(object) { uint offset = start; - Q_UINT32 v; + TQ_UINT32 v; if ( !getULong(data, offset, 4, log, v) ) return; - _string = QString(data.data()+stringTableOffset+v); + _string = TQString(data.data()+stringTableOffset+v); } -Coff::AuxSymbolSection::AuxSymbolSection(const Object &object, const QByteArray &data, uint start, uint, Log::Base &log) +Coff::AuxSymbolSection::AuxSymbolSection(const Object &object, const TQByteArray &data, uint start, uint, Log::Base &log) : AuxSymbol(object) { uint offset = start; - Q_UINT32 v; + TQ_UINT32 v; if ( !getULong(data, offset, 4, log, v) ) return; _length = v; if ( !getULong(data, offset, 2, log, v) ) return; @@ -180,12 +180,12 @@ const Coff::SymbolDerivedType::Data Coff::SymbolDerivedType::DATA[Nb_Types] = { { 0, I18N_NOOP("Array"), 0x110000 } }; -Coff::Symbol::Symbol(const Object &object, const QByteArray &data, uint start, - uint stringTableOffset, const QString &lastFilename, Log::Base &log) +Coff::Symbol::Symbol(const Object &object, const TQByteArray &data, uint start, + uint stringTableOffset, const TQString &lastFilename, Log::Base &log) : BaseSymbol(object) { uint offset = start; - Q_UINT32 v; + TQ_UINT32 v; if ( !getName(data, offset, 8, stringTableOffset, log, _name) ) return; if ( !getULong(data, offset, 4, log, v) ) return; _value = v; @@ -212,7 +212,7 @@ Coff::Symbol::Symbol(const Object &object, const QByteArray &data, uint start, else if ( _name==".ident" ) auxType = AuxSymbolType::Identifier; else if ( _sclass==SymbolClass::Filename ) auxType = AuxSymbolType::File; else if ( _sclass==SymbolClass::Section ) auxType = AuxSymbolType::Section; - if ( auxType!=AuxSymbolType::Nb_Types && nbAux==0 ) log.log(Log::LineType::Warning, i18n("Symbol without needed auxilliary symbol (type=%1)").arg(auxType.type())); + if ( auxType!=AuxSymbolType::Nb_Types && nbAux==0 ) log.log(Log::LineType::Warning, i18n("Symbol without needed auxilliary symbol (type=%1)").tqarg(auxType.type())); Q_ASSERT( (offset-start)==object.size(SymbolSize) ); _aux.resize(nbAux); for (uint i=0; i<nbAux; i++) { @@ -238,21 +238,21 @@ Coff::SymbolSectionType Coff::Symbol::sectionType() const //---------------------------------------------------------------------------- Coff::Relocation::Relocation(const Object &object, const Section §ion, - const QByteArray &data, uint start, Log::Base &log) + const TQByteArray &data, uint start, Log::Base &log) : Element(object), _symbol(0) { uint offset = start; - Q_UINT32 v; + TQ_UINT32 v; if ( !getULong(data, offset, 4, log, v) ) return; _address = v; - if ( _address>section.size() ) log.log(Log::LineType::Warning, i18n("Relocation address beyong section size: %1/%2").arg(v).arg(section.size())); + if ( _address>section.size() ) log.log(Log::LineType::Warning, i18n("Relocation address beyong section size: %1/%2").tqarg(v).tqarg(section.size())); if ( !getULong(data, offset, 4, log, v) ) return; if ( v>=object.nbSymbols() ) { - log.log(Log::LineType::Error, i18n("Relocation has unknown symbol: %1").arg(v)); + log.log(Log::LineType::Error, i18n("Relocation has unknown symbol: %1").tqarg(v)); return; } if ( object.symbol(v)->isAuxSymbol() ) { - log.log(Log::LineType::Error, i18n("Relocation is an auxiliary symbol: %1").arg(v)); + log.log(Log::LineType::Error, i18n("Relocation is an auxiliary symbol: %1").tqarg(v)); return; } _symbol = static_cast<const Symbol *>(object.symbol(v)); @@ -267,11 +267,11 @@ Coff::Relocation::Relocation(const Object &object, const Section §ion, //---------------------------------------------------------------------------- Coff::CodeLine::CodeLine(const Object &object, const Section §ion, - const QByteArray &data, uint start, const QString &lastFilename, Log::Base &log) + const TQByteArray &data, uint start, const TQString &lastFilename, Log::Base &log) : Element(object), _section(section), _symbol(0) { uint offset = start; - Q_UINT32 v; + TQ_UINT32 v; if ( !getULong(data, offset, 4, log, v) ) return; uint tmp = v; if ( object.format()==Format::PIC30 ) { @@ -283,11 +283,11 @@ Coff::CodeLine::CodeLine(const Object &object, const Section §ion, //qDebug("code line %i: %s", _line, toHexLabel(_address, nbChars(_address)).latin1()); } else { if ( tmp>=object.nbSymbols() ) { - log.log(Log::LineType::Error, i18n("Codeline has unknown symbol: %1").arg(tmp)); + log.log(Log::LineType::Error, i18n("Codeline has unknown symbol: %1").tqarg(tmp)); return; } if ( object.symbol(tmp)->isAuxSymbol() ) { - log.log(Log::LineType::Error, i18n("Codeline is an auxiliary symbol: %1").arg(tmp)); + log.log(Log::LineType::Error, i18n("Codeline is an auxiliary symbol: %1").tqarg(tmp)); return; } _symbol = static_cast<const Symbol *>(object.symbol(tmp)); @@ -296,11 +296,11 @@ Coff::CodeLine::CodeLine(const Object &object, const Section §ion, } } else { if ( tmp>=object.nbSymbols() ) { - log.log(Log::LineType::Error, i18n("Codeline has unknown symbol: %1").arg(tmp)); + log.log(Log::LineType::Error, i18n("Codeline has unknown symbol: %1").tqarg(tmp)); return; } if ( object.symbol(tmp)->isAuxSymbol() ) { - log.log(Log::LineType::Error, i18n("Codeline is an auxiliary symbol: %1").arg(tmp)); + log.log(Log::LineType::Error, i18n("Codeline is an auxiliary symbol: %1").tqarg(tmp)); return; } _symbol = static_cast<const Symbol *>(object.symbol(tmp)); @@ -318,7 +318,7 @@ Coff::CodeLine::CodeLine(const Object &object, const Section §ion, } // if ( _symbol && _symbol->_class!=Symbol::CFile ) // log.log(Log::LineType::Warning, i18n("Line without file symbol associated (%1:%2 %3).") -// .arg(_section._name).arg(toHexLabel(_address, nbChars(_address))).arg(_symbol->_class)); +// .tqarg(_section._name).tqarg(toHexLabel(_address, nbChars(_address))).tqarg(_symbol->_class)); } //---------------------------------------------------------------------------- @@ -333,17 +333,17 @@ const Coff::SectionType::Data Coff::SectionType::DATA[Nb_Types] = { }; Coff::Section::Section(const Device::Data &device, const Object &object, - const QByteArray &data, uint start, uint stringTableOffset, Log::Base &log) + const TQByteArray &data, uint start, uint stringTableOffset, Log::Base &log) : Element(object) { uint offset = start; - Q_UINT32 v; + TQ_UINT32 v; if ( !getName(data, offset, 8, stringTableOffset, log, _name) ) return; if ( !getULong(data, offset, 4, log, v) ) return; _address = v; if ( !getULong(data, offset, 4, log, v) ) return; //if ( _address!=v ) log.log(Log::LineType::Warning, i18n("Virtual address (%1) does not match physical address (%2) in %3.") - // .arg(toHexLabel(v, 4)).arg(toHexLabel(_address, 4)).arg(_name)); + // .tqarg(toHexLabel(v, 4)).tqarg(toHexLabel(_address, 4)).tqarg(_name)); if ( !getULong(data, offset, 4, log, v) ) return; _size = v; if ( !getULong(data, offset, 4, log, v) ) return; @@ -386,7 +386,7 @@ Coff::Section::Section(const Device::Data &device, const Object &object, buffer[0] = 0; BitValue op2 = ((i+1)<nbWords ? _instructions[address+inc].value : 0); uint nbop = disassemble(op.toUInt(), op2.toUInt(), address.toUInt()/inc, pdata.architecture(), buffer, 512); - _instructions[address].disasm = QString(buffer); + _instructions[address].disasm = TQString(buffer); _instructions[address].opcode = toHex(op, pdata.nbCharsWord(Pic::MemoryRangeType::Code)); if ( nbop==2 ) { _instructions[address+inc].opcode = toHex(op2, pdata.nbCharsWord(Pic::MemoryRangeType::Code)); @@ -394,7 +394,7 @@ Coff::Section::Section(const Device::Data &device, const Object &object, } //qDebug(" %s: %s (%s %s)", toHex(address, 4).data(), _data[address].disasm.data(), _data[address].opcode.data(), (nbop==2 ? _data[address+inc].opcode.data() : "")); } else if ( _flags & FDataRom ) _instructions[address].opcode = toHex(op, 4); - else if ( _flags & FData ) _instructions[address].opcode = toHex(op.maskWith(0xFF), 2); + else if ( _flags & FData ) _instructions[address].opcode = toHex(op.tqmaskWith(0xFF), 2); } } @@ -410,7 +410,7 @@ Coff::Section::Section(const Device::Data &device, const Object &object, // read line numbers if ( lineNumberOffset!=0 ) { - QString lastFilename; + TQString lastFilename; _lines.resize(nbLineNumbers); for (uint i=0; i<nbLineNumbers; i++) { _lines[i] = new CodeLine(object, *this, data, lineNumberOffset, lastFilename, log); @@ -447,35 +447,35 @@ Coff::Object::Object(const Device::Data *device, const PURL::Url &url) bool Coff::Object::parse(Log::Base &log) { // header - QByteArray data; + TQByteArray data; uint offset = 0; if ( !initParse(CoffType::Object, data, offset, log) ) return false; if ( _format==Format::Nb_Types ) { - log.log(Log::LineType::Error, i18n("COFF format not supported: magic number is %1.").arg(toHexLabel(_magic, 4))); + log.log(Log::LineType::Error, i18n("COFF format not supported: magic number is %1.").tqarg(toHexLabel(_magic, 4))); return false; } - log.log(Log::DebugLevel::Extra, QString("COFF format: %1").arg(toHexLabel(_magic, 4))); + log.log(Log::DebugLevel::Extra, TQString("COFF format: %1").tqarg(toHexLabel(_magic, 4))); if ( !parseHeader(data, offset, log) ) return false; // optionnal header Q_ASSERT( offset==size(HeaderSize) ); if ( !getULong(data, offset, 2, log, _optHeaderMagic) ) return false; - log.log(Log::DebugLevel::Extra, QString("COFF optionnal header format: %1").arg(toHexLabel(_optHeaderMagic, 4))); + log.log(Log::DebugLevel::Extra, TQString("COFF optionnal header format: %1").tqarg(toHexLabel(_optHeaderMagic, 4))); _optHeaderFormat = OptHeaderFormat::Nb_Types; uint i = 0; for (; OPT_HEADER_DATA[i].optHeaderFormat!=OptHeaderFormat::Nb_Types; i++) if ( _optHeaderMagic==OPT_HEADER_DATA[i].magic ) break; _optHeaderFormat = OPT_HEADER_DATA[i].optHeaderFormat; if ( _optHeaderFormat==OptHeaderFormat::Nb_Types ) { - log.log(Log::LineType::Warning, i18n("Optional header format not supported: magic number is %1.").arg(toHexLabel(_optHeaderMagic, 4))); + log.log(Log::LineType::Warning, i18n("Optional header format not supported: magic number is %1.").tqarg(toHexLabel(_optHeaderMagic, 4))); offset += size(OptHeaderSize)-2; } else if ( !OPT_HEADER_DATA[i].parsed ) { - log.log(Log::DebugLevel::Normal, QString("Optional header not parsed: magic number is %1.").arg(toHexLabel(_optHeaderMagic, 4))); + log.log(Log::DebugLevel::Normal, TQString("Optional header not parsed: magic number is %1.").tqarg(toHexLabel(_optHeaderMagic, 4))); offset += size(OptHeaderSize)-2; } else if ( !parseOptionnalHeader(data, offset, log) ) return false; // parse symbol table uint stringTableOffset = _symbolOffset + _nbSymbols*size(SymbolSize); - QString lastFilename; + TQString lastFilename; _symbols.resize(_nbSymbols); for (uint i=0; i<_nbSymbols; i++) { Symbol *s = new Symbol(*this, data, _symbolOffset, stringTableOffset, lastFilename, log); @@ -503,8 +503,8 @@ bool Coff::Object::parse(Log::Base &log) // extract filenames for (uint i=0; i<_nbSymbols; i++) { if ( _symbols[i]==0 || _symbols[i]->isAuxSymbol() ) continue; - QString s = static_cast<const Symbol *>(_symbols[i])->filename(); - if ( s.isEmpty() || s=="fake" || _filenames.contains(s) ) continue; + TQString s = static_cast<const Symbol *>(_symbols[i])->filename(); + if ( s.isEmpty() || s=="fake" || _filenames.tqcontains(s) ) continue; _filenames.append(s); } @@ -514,7 +514,7 @@ bool Coff::Object::parse(Log::Base &log) const Symbol *sym = static_cast<const Symbol *>(_symbols[i]); if ( sym->symbolClass()!=SymbolClass::Static ) continue; if ( sym->sectionType()!=SymbolSectionType::InsideSection ) continue; - QString name = sym->name(); + TQString name = sym->name(); if ( name.startsWith("_$_") || name.startsWith("__") || name.startsWith(".") ) continue; // special variables (?) _variables[name] = sym->value() & 0xFFF; // #### ?? } @@ -522,9 +522,9 @@ bool Coff::Object::parse(Log::Base &log) return true; } -bool Coff::Object::parseHeader(const QByteArray &data, uint &offset, Log::Base &log) +bool Coff::Object::parseHeader(const TQByteArray &data, uint &offset, Log::Base &log) { - Q_UINT32 v; + TQ_UINT32 v; if ( !getULong(data, offset, 2, log, v) ) return false; _nbSections = v; if ( !getULong(data, offset, 4, log, v) ) return false; @@ -535,7 +535,7 @@ bool Coff::Object::parseHeader(const QByteArray &data, uint &offset, Log::Base & _nbSymbols = v; if ( !getULong(data, offset, 2, log, v) ) return false; if ( v!=size(OptHeaderSize) ) { - log.log(Log::LineType::Error, i18n("Optionnal header size is not %1: %2").arg(size(OptHeaderSize)).arg(v)); + log.log(Log::LineType::Error, i18n("Optionnal header size is not %1: %2").tqarg(size(OptHeaderSize)).tqarg(v)); return false; } if ( !getULong(data, offset, 2, log, v) ) return false; @@ -543,9 +543,9 @@ bool Coff::Object::parseHeader(const QByteArray &data, uint &offset, Log::Base & return true; } -bool Coff::Object::parseOptionnalHeader(const QByteArray &data, uint &offset, Log::Base &log) +bool Coff::Object::parseOptionnalHeader(const TQByteArray &data, uint &offset, Log::Base &log) { - Q_UINT32 v; + TQ_UINT32 v; int nb = (_format==Format::NewMicrochip ? 4 : 2); if ( !getULong(data, offset, nb, log, v) ) return false; // version stamp if ( _format==Format::PIC30 ) { @@ -560,24 +560,24 @@ bool Coff::Object::parseOptionnalHeader(const QByteArray &data, uint &offset, Lo if ( !getULong(data, offset, 4, log, v) ) return false; // #### at least for C18 compiler, it can be compiled for generic processor: in such case // the pic type will be 18C452 in non-extended mode and 18F4620 for extended mode... - QString name = Coff::findId(v); - log.log(Log::DebugLevel::Normal, QString("Device name: \"%1\"").arg(name)); + TQString name = Coff::findId(v); + log.log(Log::DebugLevel::Normal, TQString("Device name: \"%1\"").tqarg(name)); if ( name.isEmpty() ) { - log.log(Log::DebugLevel::Normal, QString("Unknown processor type: %1").arg(toHexLabel(v, 4))); - log.log(Log::LineType::Error, i18n("Could not determine processor (%1).").arg(toHexLabel(v, 4))); + log.log(Log::DebugLevel::Normal, TQString("Unknown processor type: %1").tqarg(toHexLabel(v, 4))); + log.log(Log::LineType::Error, i18n("Could not determine processor (%1).").tqarg(toHexLabel(v, 4))); return false; } else if ( _device==0 ) _device = Device::lister().data(name); - else if ( name!=_device->name() ) log.log(Log::DebugLevel::Normal, QString("Different processor name: %1").arg(name)); + else if ( name!=_device->name() ) log.log(Log::DebugLevel::Normal, TQString("Different processor name: %1").tqarg(name)); if ( !getULong(data, offset, 4, log, v) ) return false; const Pic::Data *pdata = static_cast<const Pic::Data *>(_device); if (pdata) { uint nbBits = pdata->nbBitsWord(Pic::MemoryRangeType::Code) / pdata->addressIncrement(Pic::MemoryRangeType::Code); - if ( v!=nbBits ) log.log(Log::DebugLevel::Normal, QString("Rom width is not %1: %2").arg(nbBits).arg(v)); + if ( v!=nbBits ) log.log(Log::DebugLevel::Normal, TQString("Rom width is not %1: %2").tqarg(nbBits).tqarg(v)); } if ( !getULong(data, offset, 4, log, v) ) return false; if (pdata) { uint nbBits = pdata->registersData().nbBits(); - if ( v!=nbBits ) log.log(Log::DebugLevel::Normal, QString("Ram width is not %1: %2").arg(nbBits).arg(v)); + if ( v!=nbBits ) log.log(Log::DebugLevel::Normal, TQString("Ram width is not %1: %2").tqarg(nbBits).tqarg(v)); } } return true; @@ -589,18 +589,18 @@ Coff::Object::~Object() for (uint i=0; i<nbSections(); i++) delete _sections[i]; } -QString Coff::Object::variableName(Address address) const +TQString Coff::Object::variableName(Address address) const { - QMap<QString, Address>::const_iterator it; + TQMap<TQString, Address>::const_iterator it; for (it=_variables.begin(); it!=_variables.end(); ++it) if ( it.data()==address ) return it.key(); - return QString::null; + return TQString(); } //---------------------------------------------------------------------------- -QValueVector<Pic::RegisterNameData> Pic::sfrList(const Pic::Data &data) +TQValueVector<Pic::RegisterNameData> Pic::sfrList(const Pic::Data &data) { - QValueVector<Pic::RegisterNameData> list; + TQValueVector<Pic::RegisterNameData> list; const Pic::RegistersData &rdata = data.registersData(); for (uint i=0; i<rdata.nbRegisters(); i++) { uint address = rdata.nbBytes() * i; @@ -610,7 +610,7 @@ QValueVector<Pic::RegisterNameData> Pic::sfrList(const Pic::Data &data) Register::TypeData rtd(address, rdata.nbChars()); if ( type==Pic::Sfr ) list.append(Pic::RegisterNameData(rdata.label(address), rtd)); } - QMap<QString, Pic::CombinedData>::const_iterator it; + TQMap<TQString, Pic::CombinedData>::const_iterator it; for (it=rdata.combined.begin(); it!=rdata.combined.end(); ++it) { Register::TypeData td(it.key(), it.data().address, it.data().nbChars); list.append(Pic::RegisterNameData(it.key(), td)); @@ -621,9 +621,9 @@ QValueVector<Pic::RegisterNameData> Pic::sfrList(const Pic::Data &data) return list; } -QValueVector<Pic::RegisterNameData> Pic::gprList(const Pic::Data &data, const Coff::Object *coff) +TQValueVector<Pic::RegisterNameData> Pic::gprList(const Pic::Data &data, const Coff::Object *coff) { - QValueVector<Pic::RegisterNameData> list; + TQValueVector<Pic::RegisterNameData> list; const Pic::RegistersData &rdata = data.registersData(); for (uint i=0; i<rdata.nbRegisters(); i++) { uint address = rdata.nbBytes() * i; @@ -631,9 +631,9 @@ QValueVector<Pic::RegisterNameData> Pic::gprList(const Pic::Data &data, const Co Device::RegisterProperties rp = rdata.properties(address); if ( !(rp & Device::Readable) ) continue; if (type==Pic::Gpr ) { - QString s = toHexLabel(address, rdata.nbCharsAddress()); + TQString s = toHexLabel(address, rdata.nbCharsAddress()); if (coff) { - QString name = coff->variableName(address); + TQString name = coff->variableName(address); if ( !name.isEmpty() ) s += " (" + name + ")"; } Register::TypeData rtd(address, rdata.nbChars()); @@ -643,12 +643,12 @@ QValueVector<Pic::RegisterNameData> Pic::gprList(const Pic::Data &data, const Co return list; } -QValueVector<Pic::RegisterNameData> Pic::variableList(const Pic::Data &data, const Coff::Object &coff) +TQValueVector<Pic::RegisterNameData> Pic::variableList(const Pic::Data &data, const Coff::Object &coff) { - QValueVector<Pic::RegisterNameData> list; + TQValueVector<Pic::RegisterNameData> list; const Pic::RegistersData &rdata = data.registersData(); - QMap<QString, Address> variables = coff.variables(); - QMap<QString, Address>::const_iterator vit; + TQMap<TQString, Address> variables = coff.variables(); + TQMap<TQString, Address>::const_iterator vit; for (vit=variables.begin(); vit!=variables.end(); ++vit) { Register::TypeData rtd(vit.data(), rdata.nbChars()); list.append(Pic::RegisterNameData(vit.key() + " (" + toHexLabel(vit.data(), rdata.nbCharsAddress()) + ")", rtd)); diff --git a/src/coff/base/coff_object.h b/src/coff/base/coff_object.h index 8b98129..fccb744 100644 --- a/src/coff/base/coff_object.h +++ b/src/coff/base/coff_object.h @@ -15,7 +15,7 @@ namespace Coff { //---------------------------------------------------------------------------- -extern bool getName(const QByteArray &data, uint &offset, uint nbChars, uint stringTableOffset, Log::Base &log, QString &name); +extern bool getName(const TQByteArray &data, uint &offset, uint nbChars, uint stringTableOffset, Log::Base &log, TQString &name); extern int disassemble(long int opcode, long int opcode2, int org, Pic::Architecture architecture, char *buffer, size_t sizeof_buffer); BEGIN_DECLARE_ENUM(OptHeaderFormat) @@ -59,7 +59,7 @@ class AuxSymbol : public BaseSymbol { public: virtual bool isAuxSymbol() const { return true; } - static AuxSymbol *factory(const Object &object, AuxSymbolType type, const QByteArray &data, + static AuxSymbol *factory(const Object &object, AuxSymbolType type, const TQByteArray &data, uint offset, uint stringTableOffset, Log::Base &log); public: @@ -70,42 +70,42 @@ public: class AuxSymbolDirect : public AuxSymbol { public: - AuxSymbolDirect(const Object &object, const QByteArray &data, uint offset, uint stringTableOffset, Log::Base &log); + AuxSymbolDirect(const Object &object, const TQByteArray &data, uint offset, uint stringTableOffset, Log::Base &log); virtual AuxSymbolType type() const { return AuxSymbolType::Direct; } private: uchar _command; - QString _string; + TQString _string; }; class AuxSymbolFile : public AuxSymbol { public: - AuxSymbolFile(const Object &object, const QByteArray &data, uint offset, uint stringTableOffset, Log::Base &log); + AuxSymbolFile(const Object &object, const TQByteArray &data, uint offset, uint stringTableOffset, Log::Base &log); virtual AuxSymbolType type() const { return AuxSymbolType::File; } - QString filename() const { return _filename; } + TQString filename() const { return _filename; } uint line() const { return _line; } private: uint _line; - QString _filename; + TQString _filename; }; class AuxSymbolIdentifier : public AuxSymbol { public: - AuxSymbolIdentifier(const Object &object, const QByteArray &data, uint offset, uint stringTableOffset, Log::Base &log); + AuxSymbolIdentifier(const Object &object, const TQByteArray &data, uint offset, uint stringTableOffset, Log::Base &log); virtual AuxSymbolType type() const { return AuxSymbolType::Identifier; } - QString string() const { return _string; } + TQString string() const { return _string; } private: - QString _string; + TQString _string; }; class AuxSymbolSection : public AuxSymbol { public: - AuxSymbolSection(const Object &object, const QByteArray &data, uint offset, uint stringTableOffset, Log::Base &log); + AuxSymbolSection(const Object &object, const TQByteArray &data, uint offset, uint stringTableOffset, Log::Base &log); virtual AuxSymbolType type() const { return AuxSymbolType::Section; } private: @@ -157,12 +157,12 @@ END_DECLARE_ENUM(SymbolDerivedType, SymbolDerivedTypeData) class Symbol : public BaseSymbol { public: - Symbol(const Object &object, const QByteArray &data, uint offset, uint stringTableOffset, - const QString &lastFilename, Log::Base &log); + Symbol(const Object &object, const TQByteArray &data, uint offset, uint stringTableOffset, + const TQString &lastFilename, Log::Base &log); virtual bool isAuxSymbol() const { return false; } - QString name() const { return _name; } - QString filename() const { return _filename; } - const QValueVector<AuxSymbol *> &auxSymbols() const { return _aux; } + TQString name() const { return _name; } + TQString filename() const { return _filename; } + const TQValueVector<AuxSymbol *> &auxSymbols() const { return _aux; } SymbolClass symbolClass() const { return _sclass; } SymbolSectionType sectionType() const; SymbolType type() const { return _type; } @@ -171,19 +171,19 @@ public: uint section() const { Q_ASSERT( sectionType()==SymbolSectionType::InsideSection ); return _section; } private: - QString _name, _filename; + TQString _name, _filename; uint _value, _section; SymbolClass _sclass; SymbolType _type; SymbolDerivedType _dtype; - QValueVector<AuxSymbol *> _aux; + TQValueVector<AuxSymbol *> _aux; }; //---------------------------------------------------------------------------- class Relocation : public Element { public: - Relocation(const Object &object, const Section §ion, const QByteArray &data, + Relocation(const Object &object, const Section §ion, const TQByteArray &data, uint offset, Log::Base &log); private: @@ -196,10 +196,10 @@ private: class CodeLine : public Element { public: - CodeLine(const Object &object, const Section §ion, const QByteArray &data, - uint offset, const QString &lastFilename, Log::Base &log); + CodeLine(const Object &object, const Section §ion, const TQByteArray &data, + uint offset, const TQString &lastFilename, Log::Base &log); const Section §ion() const { return _section; } - QString filename() const { return _filename; } + TQString filename() const { return _filename; } uint line() const { return _line; } Address address() const { return _address; } const Symbol *symbol() const { return _symbol; } @@ -208,7 +208,7 @@ private: const Section &_section; uint _line; Address _address; - QString _filename; + TQString _filename; const Symbol *_symbol; }; @@ -223,29 +223,29 @@ public: class InstructionData { public: BitValue value; - QString opcode, disasm; + TQString opcode, disasm; }; public: - Section(const Device::Data &device, const Object &object, const QByteArray &data, uint offset, + Section(const Device::Data &device, const Object &object, const TQByteArray &data, uint offset, uint stringTableOffset, Log::Base &log); ~Section(); SectionType type() const; - QString name() const { return _name; } + TQString name() const { return _name; } Address address() const { return _address; } uint size() const { return _size; } uint flags() const { return _flags; } - const QMap<Address, InstructionData> &instructions() const { return _instructions; } - const QValueVector<Relocation *> &relocations() const { return _relocations; } - const QValueVector<CodeLine *> &lines() const { return _lines; } + const TQMap<Address, InstructionData> &instructions() const { return _instructions; } + const TQValueVector<Relocation *> &relocations() const { return _relocations; } + const TQValueVector<CodeLine *> &lines() const { return _lines; } private: - QString _name; + TQString _name; Address _address; uint _size, _flags; - QMap<Address, InstructionData> _instructions; - QValueVector<Relocation *> _relocations; - QValueVector<CodeLine *> _lines; + TQMap<Address, InstructionData> _instructions; + TQValueVector<Relocation *> _relocations; + TQValueVector<CodeLine *> _lines; enum Flag { FText = 0x00020, FData = 0x00040, FBSS = 0x00080, FDataRom = 0x00100, FAbs = 0x01000, FShared = 0x02000, FOverlay = 0x04000, FAccess = 0x08000, @@ -266,33 +266,33 @@ public: uint optHeaderMagic() const { return _optHeaderMagic; } uint nbSymbols() const { return _symbols.count(); } const BaseSymbol *symbol(uint i) const { return _symbols[i]; } - const Symbol *symbol(const QString &name) const { return (_msymbols.contains(name) ? _msymbols[name] : 0); } + const Symbol *symbol(const TQString &name) const { return (_msymbols.tqcontains(name) ? _msymbols[name] : 0); } uint nbSections() const { return _sections.count(); } const Section *section(uint i) const { return _sections[i]; } - const QStringList &filenames() const { return _filenames; } - const QMap<QString, Address> &variables() const { return _variables; } - QString variableName(Address address) const; + const TQStringList &filenames() const { return _filenames; } + const TQMap<TQString, Address> &variables() const { return _variables; } + TQString variableName(Address address) const; enum Flag { RelocationStripped = 0x0001, Executable = 0x0002, LineNumberStripped = 0x0004, SymbolStripped = 0x0080, Extended18 = 0x4000, Generic = 0x8000 }; - Q_DECLARE_FLAGS(Flags, Flag) + TQ_DECLARE_FLAGS(Flags, Flag) protected: - Q_UINT32 _optHeaderMagic; + TQ_UINT32 _optHeaderMagic; OptHeaderFormat _optHeaderFormat; const Device::Data *_device; uint _nbSections, _nbSymbols, _symbolOffset; Flags _flags; - QValueVector<BaseSymbol *> _symbols; - QMap<QString, Symbol *> _msymbols; // name -> Symbol * - QValueVector<Section *> _sections; - QStringList _filenames; - QMap<QString, Address> _variables; // name -> address - - virtual bool parseHeader(const QByteArray &data, uint &offset, Log::Base &log); - virtual bool parseOptionnalHeader(const QByteArray &data, uint &offset, Log::Base &log); + TQValueVector<BaseSymbol *> _symbols; + TQMap<TQString, Symbol *> _msymbols; // name -> Symbol * + TQValueVector<Section *> _sections; + TQStringList _filenames; + TQMap<TQString, Address> _variables; // name -> address + + virtual bool parseHeader(const TQByteArray &data, uint &offset, Log::Base &log); + virtual bool parseOptionnalHeader(const TQByteArray &data, uint &offset, Log::Base &log); }; -Q_DECLARE_OPERATORS_FOR_FLAGS(Object::Flags) +TQ_DECLARE_OPERATORS_FOR_FLAGS(Object::Flags) } // namespace @@ -304,18 +304,18 @@ class RegisterNameData { public: RegisterNameData() {} - RegisterNameData(const QString &label, const Register::TypeData &data) : _label(label), _data(data) {} - QString label() const { return _label; } + RegisterNameData(const TQString &label, const Register::TypeData &data) : _label(label), _data(data) {} + TQString label() const { return _label; } const Register::TypeData &data() const { return _data; } bool operator <(const RegisterNameData &rnd) const { return _label<rnd._label; }; private: - QString _label; + TQString _label; Register::TypeData _data; }; -extern QValueVector<RegisterNameData> sfrList(const Pic::Data &data); -extern QValueVector<RegisterNameData> gprList(const Pic::Data &data, const Coff::Object *coff); -extern QValueVector<RegisterNameData> variableList(const Pic::Data &data, const Coff::Object &coff); +extern TQValueVector<RegisterNameData> sfrList(const Pic::Data &data); +extern TQValueVector<RegisterNameData> gprList(const Pic::Data &data, const Coff::Object *coff); +extern TQValueVector<RegisterNameData> variableList(const Pic::Data &data, const Coff::Object &coff); } // namespace 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); diff --git a/src/coff/base/disassembler.h b/src/coff/base/disassembler.h index e713610..c2f7725 100644 --- a/src/coff/base/disassembler.h +++ b/src/coff/base/disassembler.h @@ -22,30 +22,30 @@ enum Type { Indented, NotIndented, Title, Separator, Empty }; class Data { public: - Data(Type _type = Empty, const QString &_code = QString::null, const QString &_comment = QString::null) + Data(Type _type = Empty, const TQString &_code = TQString(), const TQString &_comment = TQString()) : type(_type), code(_code), comment(_comment) {} Type type; - QString code, comment; + TQString code, comment; }; -class List : public QValueList<Data> +class List : public TQValueList<Data> { public: List() {} void appendSeparator() { append(Separator); } void appendEmpty() { append(Empty); } - void appendTitle(const QString &text) { append(Data(Title, QString::null, text)); } - void appendIndentedCode(const QString &code, const QString &comment = QString::null) { append(Data(Indented, code, comment)); } - void appendNotIndentedCode(const QString &code, const QString &comment = QString::null) { append(Data(NotIndented, code, comment)); } + void appendTitle(const TQString &text) { append(Data(Title, TQString(), text)); } + void appendIndentedCode(const TQString &code, const TQString &comment = TQString()) { append(Data(Indented, code, comment)); } + void appendNotIndentedCode(const TQString &code, const TQString &comment = TQString()) { append(Data(NotIndented, code, comment)); } }; -extern QString comment(PURL::SourceFamily family, const QString &text); -extern QStringList lines(PURL::SourceFamily family, const List &list, uint nbSpaces); -extern QString text(PURL::SourceFamily family, const List &list, uint nbSpaces); -extern QString transformConfigName(const Pic::Data &data, uint wordIndex, const QString &name); -extern QStringList ignoredConfigNames(const Pic::Data &data, uint wordIndex); -extern QStringList extraConfigNames(const Pic::Data &data, uint wordIndex, const Pic::Config::Value &value); -extern QStringList configNames(Pic::ConfigNameType type, const Pic::Memory &memory, uint word, bool &ok); +extern TQString comment(PURL::SourceFamily family, const TQString &text); +extern TQStringList lines(PURL::SourceFamily family, const List &list, uint nbSpaces); +extern TQString text(PURL::SourceFamily family, const List &list, uint nbSpaces); +extern TQString transformConfigName(const Pic::Data &data, uint wordIndex, const TQString &name); +extern TQStringList ignoredConfigNames(const Pic::Data &data, uint wordIndex); +extern TQStringList extraConfigNames(const Pic::Data &data, uint wordIndex, const Pic::Config::Value &value); +extern TQStringList configNames(Pic::ConfigNameType type, const Pic::Memory &memory, uint word, bool &ok); } // namespace @@ -53,7 +53,7 @@ extern QStringList configNames(Pic::ConfigNameType type, const Pic::Memory &memo namespace GPUtils { -extern QString toDeviceName(const QString &device); +extern TQString toDeviceName(const TQString &device); extern SourceLine::List includeLines(const Device::Data &data); extern SourceLine::List generateConfigLines(const Pic::Memory &memory, bool &ok); extern SourceLine::List disassemble(const Pic::Memory &memory); diff --git a/src/coff/base/gpdis.cpp b/src/coff/base/gpdis.cpp index 2df4f24..abec54f 100644 --- a/src/coff/base/gpdis.cpp +++ b/src/coff/base/gpdis.cpp @@ -69,7 +69,7 @@ int Coff::disassemble(long int opcode, long int opcode2, return 0; case Pic::Architecture::P10X: for(i = 0; i < num_op_12c5xx; i++) { - if((op_12c5xx[i].mask & opcode) == op_12c5xx[i].opcode) { + if((op_12c5xx[i].tqmask & opcode) == op_12c5xx[i].opcode) { instruction = &op_12c5xx[i]; break; } @@ -77,7 +77,7 @@ int Coff::disassemble(long int opcode, long int opcode2, break; /* case PROC_CLASS_SX: for(i = 0; i < num_op_sx; i++) { - if((op_sx[i].mask & opcode) == op_sx[i].opcode) { + if((op_sx[i].tqmask & opcode) == op_sx[i].opcode) { instruction = &op_sx[i]; break; } @@ -86,7 +86,7 @@ int Coff::disassemble(long int opcode, long int opcode2, */ case Pic::Architecture::P16X: for(i = 0; i < num_op_16cxx; i++) { - if((op_16cxx[i].mask & opcode) == op_16cxx[i].opcode) { + if((op_16cxx[i].tqmask & opcode) == op_16cxx[i].opcode) { instruction = &op_16cxx[i]; break; } @@ -94,7 +94,7 @@ int Coff::disassemble(long int opcode, long int opcode2, break; case Pic::Architecture::P17C: for(i = 0; i < num_op_17cxx; i++) { - if((op_17cxx[i].mask & opcode) == op_17cxx[i].opcode) { + if((op_17cxx[i].tqmask & opcode) == op_17cxx[i].opcode) { instruction = &op_17cxx[i]; break; } @@ -105,7 +105,7 @@ int Coff::disassemble(long int opcode, long int opcode2, case Pic::Architecture::P18J: if (gp_decode_mnemonics) { for(i = 0; i < num_op_18cxx_sp; i++) { - if((op_18cxx_sp[i].mask & opcode) == op_18cxx_sp[i].opcode) { + if((op_18cxx_sp[i].tqmask & opcode) == op_18cxx_sp[i].opcode) { instruction = &op_18cxx_sp[i]; break; } @@ -113,7 +113,7 @@ int Coff::disassemble(long int opcode, long int opcode2, } if (instruction == NULL) { for(i = 0; i < num_op_18cxx; i++) { - if((op_18cxx[i].mask & opcode) == op_18cxx[i].opcode) { + if((op_18cxx[i].tqmask & opcode) == op_18cxx[i].opcode) { instruction = &op_18cxx[i]; break; } @@ -122,7 +122,7 @@ int Coff::disassemble(long int opcode, long int opcode2, if ((instruction == NULL) && (gp_decode_extended)) { /* might be from the extended instruction set */ for(i = 0; i < num_op_18cxx_ext; i++) { - if((op_18cxx_ext[i].mask & opcode) == op_18cxx_ext[i].opcode) { + if((op_18cxx_ext[i].tqmask & opcode) == op_18cxx_ext[i].opcode) { instruction = &op_18cxx_ext[i]; break; } diff --git a/src/coff/base/gpopcode.h b/src/coff/base/gpopcode.h index aed25f9..91a4dea 100644 --- a/src/coff/base/gpopcode.h +++ b/src/coff/base/gpopcode.h @@ -75,7 +75,7 @@ enum insn_class { struct insn { const char *name; - long int mask; + long int tqmask; long int opcode; enum insn_class classType; //int attribs; diff --git a/src/coff/base/text_coff.cpp b/src/coff/base/text_coff.cpp index 0d0862e..1a749fe 100644 --- a/src/coff/base/text_coff.cpp +++ b/src/coff/base/text_coff.cpp @@ -14,18 +14,18 @@ namespace Coff { class CodeData { public: - QString address, opcode, disasm1, disasm2; + TQString address, opcode, disasm1, disasm2; }; class LineData { public: - QValueVector<CodeData> codes; - QString lineNumber, lineText; + TQValueVector<CodeData> codes; + TQString lineNumber, lineText; }; class FileData { public: PURL::Url url; bool read; - QValueVector<LineData> lines; + TQValueVector<LineData> lines; }; } @@ -40,7 +40,7 @@ bool Coff::TextObject::parse(Log::Base &log) return ok; } -PURL::Url Coff::TextObject::urlForFilename(const QString &filename) const +PURL::Url Coff::TextObject::urlForFilename(const TQString &filename) const { PURL::Url rurl = PURL::Url::fromPathOrUrl(filename); return rurl.toAbsolute(url().directory()); @@ -48,11 +48,11 @@ PURL::Url Coff::TextObject::urlForFilename(const QString &filename) const const Coff::Section *Coff::TextObject::section(const CodeLine &cline) const { - if ( cline.section().instructions().contains(cline.address()) ) return &cline.section(); + if ( cline.section().instructions().tqcontains(cline.address()) ) return &cline.section(); // possible for coff generated by picc... for (uint i=0; i<uint(_sections.count()); i++) { if ( _sections[i]->type()!=SectionType::Code ) continue; - if ( _sections[i]->instructions().contains(cline.address()) ) return _sections[i]; + if ( _sections[i]->instructions().tqcontains(cline.address()) ) return _sections[i]; } return 0; } @@ -63,12 +63,12 @@ void Coff::TextObject::init() const _initialized = true; // open and read files - QMap<QString, FileData> fd; + TQMap<TQString, FileData> fd; for (uint i=0; i<uint(_sections.count()); i++) { if ( _sections[i]->type()!=SectionType::Code ) continue; for (uint k=0; k<uint(_sections[i]->lines().count()); k++) { - QString filename = _sections[i]->lines()[k]->filename(); - if ( filename.isEmpty() || fd.contains(filename) ) continue; + TQString filename = _sections[i]->lines()[k]->filename(); + if ( filename.isEmpty() || fd.tqcontains(filename) ) continue; _filenames.append(filename); FileData fdata; fdata.url = urlForFilename(filename); @@ -76,7 +76,7 @@ void Coff::TextObject::init() const PURL::File file(fdata.url, sview); fdata.read = file.openForRead(); if (fdata.read) { - QStringList lines = file.readLines(); + TQStringList lines = file.readLines(); fdata.lines.resize(lines.count()); for (uint i=0; i<uint(lines.count()); i++) fdata.lines[i].lineText = lines[i]; @@ -88,11 +88,11 @@ void Coff::TextObject::init() const // create strings (for later justification) const uint addressWidth = _device->nbCharsAddress(); uint opcodeWidth = 0, disasm1Width = 0, disasm2Width = 0, lineNumberWidth = 0, lineTextWidth = 0; - QMap<QString, FileData>::iterator it; + TQMap<TQString, FileData>::iterator it; for (it=fd.begin(); it!=fd.end(); ++it) { for (uint i=0; i<uint(it.data().lines.count()); i++) { LineData &ldata = it.data().lines[i]; - QValueVector<const CodeLine *> lines = findCodeLines(it.key(), i); + TQValueVector<const CodeLine *> lines = findCodeLines(it.key(), i); ldata.codes.resize(lines.count()); for (uint k=0; k<uint(lines.count()); k++) { Address address = lines[k]->address(); @@ -102,8 +102,8 @@ void Coff::TextObject::init() const ldata.codes[k].opcode = "0x" + sec->instructions()[address].opcode.upper(); //qDebug("%s: %s", ldata.codes[k].address.latin1(), ldata.codes[k].opcode.latin1()); opcodeWidth = qMax(opcodeWidth, uint(ldata.codes[k].opcode.length())); - QString s = sec->instructions()[address].disasm; - int j = s.find('\t'); + TQString s = sec->instructions()[address].disasm; + int j = s.tqfind('\t'); if ( j!=-1 ) { ldata.codes[k].disasm2 = s.mid(j+1); disasm2Width = qMax(disasm2Width, uint(ldata.codes[k].disasm2.length())); @@ -112,7 +112,7 @@ void Coff::TextObject::init() const disasm1Width = qMax(disasm1Width, uint(ldata.codes[k].disasm1.length())); } } - ldata.lineNumber = QString::number(i+1); + ldata.lineNumber = TQString::number(i+1); lineNumberWidth = qMax(lineNumberWidth, uint(ldata.lineNumber.length())); lineTextWidth = qMax(lineTextWidth, uint(ldata.lineText.length())); } @@ -122,19 +122,19 @@ void Coff::TextObject::init() const // create text for (it = fd.begin(); it!=fd.end(); ++it) { - QString s = QString("--- ") + it.data().url.pretty() + " "; + TQString s = TQString("--- ") + it.data().url.pretty() + " "; _list += s.leftJustify(totalWidth, '-'); if ( !it.data().read ) { - s = QString("--- ") + i18n("File could not be read") + " "; + s = TQString("--- ") + i18n("File could not be read") + " "; _list += s.leftJustify(totalWidth, '-'); } for (uint i=0; i<uint(it.data().lines.count()); i++) { const LineData &ldata = it.data().lines[i]; - QString cline = repeat(" ", 4) + ldata.lineNumber.leftJustify(lineNumberWidth) + ": " + ldata.lineText; + TQString cline = repeat(" ", 4) + ldata.lineNumber.leftJustify(lineNumberWidth) + ": " + ldata.lineText; if ( ldata.codes.count()==0 ) _list += stripEndingWhiteSpaces(repeat(" ", asmWidth) + cline); else for (uint k=0; k<uint(ldata.codes.count()); k++) { if ( ldata.codes[k].opcode.isEmpty() ) continue; - QString line; + TQString line; line += ldata.codes[k].address + repeat(" ", 4); line += ldata.codes[k].opcode.leftJustify(opcodeWidth) + repeat(" ", 4); line += ldata.codes[k].disasm1.leftJustify(disasm1Width) + repeat(" ", 2); @@ -147,7 +147,7 @@ void Coff::TextObject::init() const } } -uint Coff::TextObject::nbLines(const QString &filename) const +uint Coff::TextObject::nbLines(const TQString &filename) const { init(); uint nb = 0; @@ -161,10 +161,10 @@ uint Coff::TextObject::nbLines(const QString &filename) const return nb; } -QValueVector<const Coff::CodeLine *> Coff::TextObject::findCodeLines(const QString &filename, uint line) const +TQValueVector<const Coff::CodeLine *> Coff::TextObject::findCodeLines(const TQString &filename, uint line) const { init(); - QValueVector<const CodeLine *> list; + TQValueVector<const CodeLine *> list; for (uint i=0; i<uint(_sections.count()); i++) { if ( _sections[i]->type()!=SectionType::Code ) continue; for (uint k=0; k<uint(_sections[i]->lines().count()); k++) { @@ -178,13 +178,13 @@ QValueVector<const Coff::CodeLine *> Coff::TextObject::findCodeLines(const QStri int Coff::TextObject::lineForAddress(const PURL::Url &url, Address address) const { init(); - if ( url==_url && _lines.contains(address) ) return _lines[address]-1; + if ( url==_url && _lines.tqcontains(address) ) return _lines[address]-1; for (uint i=0; i<uint(_sections.count()); i++) { if ( _sections[i]->type()!=SectionType::Code ) continue; for (uint k=0; k<uint(_sections[i]->lines().count()); k++) { const CodeLine *cl = _sections[i]->lines()[k]; if ( cl->address()!=address ) continue; - QString filename = cl->filename(); + TQString filename = cl->filename(); if ( filename.isEmpty() || urlForFilename(filename)!=url ) continue; return cl->line()-1; } @@ -192,30 +192,30 @@ int Coff::TextObject::lineForAddress(const PURL::Url &url, Address address) cons return -1; } -QMap<PURL::Url, uint> Coff::TextObject::sourceLinesForAddress(Address address) const +TQMap<PURL::Url, uint> Coff::TextObject::sourceLinesForAddress(Address address) const { - QMap<PURL::Url, uint> slines; + TQMap<PURL::Url, uint> slines; init(); for (uint i=0; i<uint(_sections.count()); i++) { if ( _sections[i]->type()!=SectionType::Code ) continue; for (uint k=0; k<uint(_sections[i]->lines().count()); k++) { const CodeLine *cl = _sections[i]->lines()[k]; if ( cl->address()!=address ) continue; - QString filename = cl->filename(); + TQString filename = cl->filename(); if ( filename.isEmpty() ) continue; slines[urlForFilename(filename)] = cl->line()-1; } } - if ( _lines.contains(address) ) slines[_url] = _lines[address] - 1; + if ( _lines.tqcontains(address) ) slines[_url] = _lines[address] - 1; return slines; } -QValueVector<Address> Coff::TextObject::addresses(const PURL::Url &url, uint line) const +TQValueVector<Address> Coff::TextObject::addresses(const PURL::Url &url, uint line) const { init(); - QValueVector<Address> ad; + TQValueVector<Address> ad; if ( url==_url ) { - QMap<Address, uint>::const_iterator it; + TQMap<Address, uint>::const_iterator it; for (it=_lines.begin(); it!=_lines.end(); ++it) if ( line==(it.data()-1) ) ad.append(it.key()); return ad; @@ -225,7 +225,7 @@ QValueVector<Address> Coff::TextObject::addresses(const PURL::Url &url, uint lin for (uint k=0; k<uint(_sections[i]->lines().count()); k++) { const CodeLine *cl = _sections[i]->lines()[k]; if ( line!=(cl->line()-1) ) continue; - QString filename = cl->filename(); + TQString filename = cl->filename(); if ( filename.isEmpty() || urlForFilename(filename)!=url ) continue; ad.append(cl->address()); } @@ -233,13 +233,13 @@ QValueVector<Address> Coff::TextObject::addresses(const PURL::Url &url, uint lin return ad; } -const QStringList &Coff::TextObject::filenames() const +const TQStringList &Coff::TextObject::filenames() const { init(); return _filenames; } -QString Coff::TextObject::disassembly() const +TQString Coff::TextObject::disassembly() const { init(); if ( _list.isEmpty() ) return i18n("Parsing COFF file is not supported for this device or an error occured."); @@ -249,14 +249,14 @@ QString Coff::TextObject::disassembly() const Log::KeyList Coff::TextObject::information() const { Log::KeyList keys; - keys.append(i18n("Format:"), i18n("%1 (magic id: %2)").arg(format().label()).arg(toHexLabel(format().data().magic, 4))); - QString name = (format()==Format::PIC30 || device()==0 ? "?" : device()->name()); + keys.append(i18n("Format:"), i18n("%1 (magic id: %2)").tqarg(format().label()).tqarg(toHexLabel(format().data().magic, 4))); + TQString name = (format()==Format::PIC30 || device()==0 ? "?" : device()->name()); keys.append(i18n("Device:"), name); OptHeaderFormat ohf = optHeaderFormat(); - QString label = (ohf==OptHeaderFormat::Nb_Types ? i18n("Unknown") : ohf.label()); - keys.append(i18n("Option header:"), i18n("%1 (magic id: %2)").arg(label).arg(toHexLabel(optHeaderMagic(), 4))); - keys.append(i18n("No. of sections:"), QString::number(nbSections())); - keys.append(i18n("No. of symbols:"), QString::number(nbSymbols())); - keys.append(i18n("No. of variables:"), QString::number(variables().count())); + TQString label = (ohf==OptHeaderFormat::Nb_Types ? i18n("Unknown") : ohf.label()); + keys.append(i18n("Option header:"), i18n("%1 (magic id: %2)").tqarg(label).tqarg(toHexLabel(optHeaderMagic(), 4))); + keys.append(i18n("No. of sections:"), TQString::number(nbSections())); + keys.append(i18n("No. of symbols:"), TQString::number(nbSymbols())); + keys.append(i18n("No. of variables:"), TQString::number(variables().count())); return keys; } diff --git a/src/coff/base/text_coff.h b/src/coff/base/text_coff.h index 7b6e673..a8a2a11 100644 --- a/src/coff/base/text_coff.h +++ b/src/coff/base/text_coff.h @@ -20,22 +20,22 @@ public: TextObject(const Device::Data *device, const PURL::Url &url); virtual bool parse(Log::Base &log); int lineForAddress(const PURL::Url &url, Address address) const; - QMap<PURL::Url, uint> sourceLinesForAddress(Address address) const; // url -> line - QValueVector<Address> addresses(const PURL::Url &url, uint line) const; - const QStringList &filenames() const; + TQMap<PURL::Url, uint> sourceLinesForAddress(Address address) const; // url -> line + TQValueVector<Address> addresses(const PURL::Url &url, uint line) const; + const TQStringList &filenames() const; - QString disassembly() const; + TQString disassembly() const; virtual Log::KeyList information() const; private: mutable bool _initialized; - mutable QMap<Address, uint> _lines; // address -> line in disassembly listing - mutable QStringList _list; - mutable QStringList _filenames; + mutable TQMap<Address, uint> _lines; // address -> line in disassembly listing + mutable TQStringList _list; + mutable TQStringList _filenames; - uint nbLines(const QString &filename) const; - QValueVector<const CodeLine *> findCodeLines(const QString &filename, uint line) const; - PURL::Url urlForFilename(const QString &filename) const; + uint nbLines(const TQString &filename) const; + TQValueVector<const CodeLine *> findCodeLines(const TQString &filename, uint line) const; + PURL::Url urlForFilename(const TQString &filename) const; void init() const; const Section *section(const CodeLine &cline) const; }; diff --git a/src/coff/xml/xml_coff_parser.cpp b/src/coff/xml/xml_coff_parser.cpp index b6fa2d8..460df7d 100644 --- a/src/coff/xml/xml_coff_parser.cpp +++ b/src/coff/xml/xml_coff_parser.cpp @@ -24,17 +24,17 @@ public: XmlToData() : ExtXmlToData<Data>("coff", "Coff") {} private: - QMap<uint, bool> _ids; + TQMap<uint, bool> _ids; virtual bool hasFamilies() const { return false; } - virtual void parseData(QDomElement element, Data &data); - virtual void outputData(const Data &data, QTextStream &s) const; - virtual void outputFunctions(QTextStream &s) const; + virtual void parseData(TQDomElement element, Data &data); + virtual void outputData(const Data &data, TQTextStream &s) const; + virtual void outputFunctions(TQTextStream &s) const; virtual void parse(); }; -void Coff::XmlToData::parseData(QDomElement element, Data &data) +void Coff::XmlToData::parseData(TQDomElement element, Data &data) { - QStringList list = QStringList::split(' ', element.attribute("id")); + TQStringList list = TQStringList::split(' ', element.attribute("id")); if ( list.isEmpty() ) qFatal("Missing id"); if ( list.count()>MAX_NB_IDS ) qFatal("Please raise MAX_NB_IDS"); for (uint i=0; i<MAX_NB_IDS; i++) { @@ -42,13 +42,13 @@ void Coff::XmlToData::parseData(QDomElement element, Data &data) bool ok; data.ids[i] = fromHexLabel(list[i], 4, &ok); if ( !ok ) qFatal("Invalid id"); - //if ( _ids.contains(data.ids[i]) ) qFatal("Duplicated id"); + //if ( _ids.tqcontains(data.ids[i]) ) qFatal("Duplicated id"); //_ids[data.ids[i]] = true; } else data.ids[i] = 0; } } -void Coff::XmlToData::outputData(const Data &data, QTextStream &s) const +void Coff::XmlToData::outputData(const Data &data, TQTextStream &s) const { s << "{ "; for (uint i=0; i<MAX_NB_IDS; i++) { @@ -58,16 +58,16 @@ void Coff::XmlToData::outputData(const Data &data, QTextStream &s) const s << "}"; } -void Coff::XmlToData::outputFunctions(QTextStream &s) const +void Coff::XmlToData::outputFunctions(TQTextStream &s) const { ExtXmlToData<Data>::outputFunctions(s); - s << "QString findId(uint id)" << endl; + s << "TQString findId(uint id)" << endl; s << "{" << endl; s << " for (uint i=0; DATA_LIST[i]; i++) {" << endl; s << " for (uint k=0; k<MAX_NB_IDS; k++)" << endl; s << " if ( DATA_LIST[i]->data.ids[k]==id ) return DATA_LIST[i]->name;" << endl; s << " }" << endl; - s << " return QString::null;" << endl; + s << " return TQString();" << endl; s << "}" << endl; } @@ -98,14 +98,14 @@ void Coff::XmlToData::parse() // extract COFF id from gputils for (uint i=0; pics[i].tag!=no_processor; i++) { - _current = QString(pics[i].names[2]).upper(); + _current = TQString(pics[i].names[2]).upper(); if ( !Device::lister().isSupported(_current) ) continue; if ( !hasDevice(_current) ) qDebug(">> add new id %s: %s", _current.latin1(), toHexLabel(pics[i].coff_type, 4).latin1()); else { bool ok = false; for (uint k=0; k<MAX_NB_IDS; k++) if ( _map[_current].data.ids[k]==pics[i].coff_type ) ok = true; - if ( !ok ) qFatal(QString("Different ids")); + if ( !ok ) qFatal(TQString("Different ids")); } } } |