From 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 30 Jun 2011 00:15:53 +0000 Subject: TQt4 port piklab This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/coff/base/cdb_parser.cpp | 42 +++++------ src/coff/base/cdb_parser.h | 38 +++++----- src/coff/base/coff.cpp | 26 +++---- src/coff/base/coff.h | 10 +-- src/coff/base/coff_archive.cpp | 48 ++++++------- src/coff/base/coff_archive.h | 18 ++--- src/coff/base/coff_data.h | 2 +- src/coff/base/coff_object.cpp | 148 +++++++++++++++++++-------------------- src/coff/base/coff_object.h | 108 ++++++++++++++-------------- src/coff/base/disassembler.cpp | 88 +++++++++++------------ src/coff/base/disassembler.h | 28 ++++---- src/coff/base/gpdis.cpp | 14 ++-- src/coff/base/gpopcode.h | 2 +- src/coff/base/text_coff.cpp | 84 +++++++++++----------- src/coff/base/text_coff.h | 20 +++--- src/coff/xml/xml_coff_parser.cpp | 26 +++---- 16 files changed, 351 insertions(+), 351 deletions(-) (limited to 'src/coff') 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; _linefilename, 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 types; + TQValueVector 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 members; + TQString filename, name; + TQValueVector 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 _records; + TQValueVector _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 = "!\012"; + TQString id = "!\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::const_iterator it; + TQMap::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 members(nb); + TQValueVector members(nb); for (uint i=0; i::const_iterator it; + TQMap::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::const_iterator it; + TQMap::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 QMapmembers() const { return _members; } - const QMapsymbols() const { return _symbols; } + const TQMapmembers() const { return _members; } + const TQMapsymbols() const { return _symbols; } virtual Log::KeyList information() const; Log::KeyList membersInformation() const; Log::KeyList symbolsInformation() const; private: - QMap _members; // name -> Member * - QMap _offsets; // offset -> Member * - QMap _symbols; // name -> Member * + TQMap _members; // name -> Member * + TQMap _offsets; // offset -> Member * + TQMap _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; isection.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(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(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(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)isAuxSymbol() ) continue; - QString s = static_cast(_symbols[i])->filename(); - if ( s.isEmpty() || s=="fake" || _filenames.contains(s) ) continue; + TQString s = static_cast(_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(_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(_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::const_iterator it; + TQMap::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::sfrList(const Pic::Data &data) +TQValueVector Pic::sfrList(const Pic::Data &data) { - QValueVector list; + TQValueVector list; const Pic::RegistersData &rdata = data.registersData(); for (uint i=0; i 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::const_iterator it; + TQMap::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::sfrList(const Pic::Data &data) return list; } -QValueVector Pic::gprList(const Pic::Data &data, const Coff::Object *coff) +TQValueVector Pic::gprList(const Pic::Data &data, const Coff::Object *coff) { - QValueVector list; + TQValueVector list; const Pic::RegistersData &rdata = data.registersData(); for (uint i=0; i 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::gprList(const Pic::Data &data, const Co return list; } -QValueVector Pic::variableList(const Pic::Data &data, const Coff::Object &coff) +TQValueVector Pic::variableList(const Pic::Data &data, const Coff::Object &coff) { - QValueVector list; + TQValueVector list; const Pic::RegistersData &rdata = data.registersData(); - QMap variables = coff.variables(); - QMap::const_iterator vit; + TQMap variables = coff.variables(); + TQMap::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 &auxSymbols() const { return _aux; } + TQString name() const { return _name; } + TQString filename() const { return _filename; } + const TQValueVector &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 _aux; + TQValueVector _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 &instructions() const { return _instructions; } - const QValueVector &relocations() const { return _relocations; } - const QValueVector &lines() const { return _lines; } + const TQMap &instructions() const { return _instructions; } + const TQValueVector &relocations() const { return _relocations; } + const TQValueVector &lines() const { return _lines; } private: - QString _name; + TQString _name; Address _address; uint _size, _flags; - QMap _instructions; - QValueVector _relocations; - QValueVector _lines; + TQMap _instructions; + TQValueVector _relocations; + TQValueVector _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 &variables() const { return _variables; } - QString variableName(Address address) const; + const TQStringList &filenames() const { return _filenames; } + const TQMap &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 _symbols; - QMap _msymbols; // name -> Symbol * - QValueVector
_sections; - QStringList _filenames; - QMap _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 _symbols; + TQMap _msymbols; // name -> Symbol * + TQValueVector
_sections; + TQStringList _filenames; + TQMap _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 sfrList(const Pic::Data &data); -extern QValueVector gprList(const Pic::Data &data, const Coff::Object *coff); -extern QValueVector variableList(const Pic::Data &data, const Coff::Object &coff); +extern TQValueVector sfrList(const Pic::Data &data); +extern TQValueVector gprList(const Pic::Data &data, const Coff::Object *coff); +extern TQValueVector 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 +#include #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 lines; - QValueList groupCommentColumn; + TQValueList lines; + TQValueList 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::const_iterator lit; + TQStringList slines; + TQValueList::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=0; l--) { - const Pic::Config::Value &cvalue = cmask.values[l]; + TQStringList cnames; + for (uint k=0; k=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"); 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 +class List : public TQValueList { 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 codes; - QString lineNumber, lineText; + TQValueVector codes; + TQString lineNumber, lineText; }; class FileData { public: PURL::Url url; bool read; - QValueVector lines; + TQValueVector 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; itype()!=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 fd; + TQMap fd; for (uint i=0; itype()!=SectionType::Code ) continue; for (uint k=0; klines().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; inbCharsAddress(); uint opcodeWidth = 0, disasm1Width = 0, disasm2Width = 0, lineNumberWidth = 0, lineTextWidth = 0; - QMap::iterator it; + TQMap::iterator it; for (it=fd.begin(); it!=fd.end(); ++it) { for (uint i=0; i lines = findCodeLines(it.key(), i); + TQValueVector lines = findCodeLines(it.key(), i); ldata.codes.resize(lines.count()); for (uint k=0; kaddress(); @@ -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 Coff::TextObject::findCodeLines(const QString &filename, uint line) const +TQValueVector Coff::TextObject::findCodeLines(const TQString &filename, uint line) const { init(); - QValueVector list; + TQValueVector list; for (uint i=0; itype()!=SectionType::Code ) continue; for (uint k=0; klines().count()); k++) { @@ -178,13 +178,13 @@ QValueVector 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; itype()!=SectionType::Code ) continue; for (uint k=0; klines().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 Coff::TextObject::sourceLinesForAddress(Address address) const +TQMap Coff::TextObject::sourceLinesForAddress(Address address) const { - QMap slines; + TQMap slines; init(); for (uint i=0; itype()!=SectionType::Code ) continue; for (uint k=0; klines().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
Coff::TextObject::addresses(const PURL::Url &url, uint line) const +TQValueVector
Coff::TextObject::addresses(const PURL::Url &url, uint line) const { init(); - QValueVector
ad; + TQValueVector
ad; if ( url==_url ) { - QMap::const_iterator it; + TQMap::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
Coff::TextObject::addresses(const PURL::Url &url, uint lin for (uint k=0; klines().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
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 sourceLinesForAddress(Address address) const; // url -> line - QValueVector
addresses(const PURL::Url &url, uint line) const; - const QStringList &filenames() const; + TQMap sourceLinesForAddress(Address address) const; // url -> line + TQValueVector
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 _lines; // address -> line in disassembly listing - mutable QStringList _list; - mutable QStringList _filenames; + mutable TQMap _lines; // address -> line in disassembly listing + mutable TQStringList _list; + mutable TQStringList _filenames; - uint nbLines(const QString &filename) const; - QValueVector findCodeLines(const QString &filename, uint line) const; - PURL::Url urlForFilename(const QString &filename) const; + uint nbLines(const TQString &filename) const; + TQValueVector 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("coff", "Coff") {} private: - QMap _ids; + TQMap _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::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; kdata.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