Rename additional global TQt functions

r14.0.x
Timothy Pearson 13 years ago
parent 2b18f76290
commit 9abf98be4f

@ -205,7 +205,7 @@ Coff::Symbol::Symbol(const Object &object, const TQByteArray &data, uint start,
if ( v==sclass.data().id ) { _sclass = sclass; break; } if ( v==sclass.data().id ) { _sclass = sclass; break; }
if ( !getULong(data, offset, 1, log, v) ) return; if ( !getULong(data, offset, 1, log, v) ) return;
uint nbAux = v; uint nbAux = v;
//qDebug("symbol: %s value=%s type=%i dtype=%i class=%i nbAux=%i section=%i", _name.latin1(), toHexLabel(_value, 4).latin1(), _type, _dtype, _class, nbAux, _section); //tqDebug("symbol: %s value=%s type=%i dtype=%i class=%i nbAux=%i section=%i", _name.latin1(), toHexLabel(_value, 4).latin1(), _type, _dtype, _class, nbAux, _section);
AuxSymbolType auxType = AuxSymbolType::Nb_Types; AuxSymbolType auxType = AuxSymbolType::Nb_Types;
if ( _name==".direct" ) auxType = AuxSymbolType::Direct; if ( _name==".direct" ) auxType = AuxSymbolType::Direct;
@ -262,7 +262,7 @@ Coff::Relocation::Relocation(const Object &object, const Section &section,
} }
if ( !getULong(data, offset, 2, log, v) ) return; if ( !getULong(data, offset, 2, log, v) ) return;
_type = v; _type = v;
//qDebug("reloc %s: address=%s offset=%i type=%i", _symbol->_name.latin1(), toHexLabel(_address, 4).latin1(), _offset, _type); //tqDebug("reloc %s: address=%s offset=%i type=%i", _symbol->_name.latin1(), toHexLabel(_address, 4).latin1(), _offset, _type);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -280,7 +280,7 @@ Coff::CodeLine::CodeLine(const Object &object, const Section &section,
if ( _line!=0 ) { if ( _line!=0 ) {
_address = tmp; _address = tmp;
_filename = lastFilename; _filename = lastFilename;
//qDebug("code line %i: %s", _line, toHexLabel(_address, nbChars(_address)).latin1()); //tqDebug("code line %i: %s", _line, toHexLabel(_address, nbChars(_address)).latin1());
} else { } else {
if ( tmp>=object.nbSymbols() ) { 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").arg(tmp));
@ -292,7 +292,7 @@ Coff::CodeLine::CodeLine(const Object &object, const Section &section,
} }
_symbol = static_cast<const Symbol *>(object.symbol(tmp)); _symbol = static_cast<const Symbol *>(object.symbol(tmp));
_filename = _symbol->filename(); _filename = _symbol->filename();
//qDebug("code line %i: %s", _line, _symbol->_name.latin1()); //tqDebug("code line %i: %s", _line, _symbol->_name.latin1());
} }
} else { } else {
if ( tmp>=object.nbSymbols() ) { if ( tmp>=object.nbSymbols() ) {
@ -314,7 +314,7 @@ Coff::CodeLine::CodeLine(const Object &object, const Section &section,
// flags // flags
if ( !getULong(data, offset, 4, log, v) ) return; if ( !getULong(data, offset, 4, log, v) ) return;
// function index // function index
//qDebug("code line %i: %s", _line, toHexLabel(_address, nbChars(_address)).latin1()); //tqDebug("code line %i: %s", _line, toHexLabel(_address, nbChars(_address)).latin1());
} }
// if ( _symbol && _symbol->_class!=Symbol::CFile ) // if ( _symbol && _symbol->_class!=Symbol::CFile )
// log.log(Log::LineType::Warning, i18n("Line without file symbol associated (%1:%2 %3).") // log.log(Log::LineType::Warning, i18n("Line without file symbol associated (%1:%2 %3).")
@ -362,7 +362,7 @@ Coff::Section::Section(const Device::Data &device, const Object &object,
// read data // read data
Q_ASSERT ( device.group().name()=="pic" ); Q_ASSERT ( device.group().name()=="pic" );
const Pic::Data &pdata = static_cast<const Pic::Data &>(device); const Pic::Data &pdata = static_cast<const Pic::Data &>(device);
//qDebug("section %s: address=%s size=%i flags=%i", _name.data(), toHexLabel(_address, 4).latin1(), _size, int(_flags)); //tqDebug("section %s: address=%s size=%i flags=%i", _name.data(), toHexLabel(_address, 4).latin1(), _size, int(_flags));
if ( _size!=0 && dataOffset!=0 ) { if ( _size!=0 && dataOffset!=0 ) {
uint inc = 1; uint inc = 1;
uint nbWords = _size; uint nbWords = _size;
@ -392,7 +392,7 @@ Coff::Section::Section(const Device::Data &device, const Object &object,
_instructions[address+inc].opcode = toHex(op2, pdata.nbCharsWord(Pic::MemoryRangeType::Code)); _instructions[address+inc].opcode = toHex(op2, pdata.nbCharsWord(Pic::MemoryRangeType::Code));
i++; i++;
} }
//qDebug(" %s: %s (%s %s)", toHex(address, 4).data(), _data[address].disasm.data(), _data[address].opcode.data(), (nbop==2 ? _data[address+inc].opcode.data() : "")); //tqDebug(" %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 & 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.maskWith(0xFF), 2);
} }

@ -100,7 +100,7 @@ void Coff::TextObject::init() const
const Section *sec = section(*lines[k]); const Section *sec = section(*lines[k]);
if (sec) { if (sec) {
ldata.codes[k].opcode = "0x" + sec->instructions()[address].opcode.upper(); ldata.codes[k].opcode = "0x" + sec->instructions()[address].opcode.upper();
//qDebug("%s: %s", ldata.codes[k].address.latin1(), ldata.codes[k].opcode.latin1()); //tqDebug("%s: %s", ldata.codes[k].address.latin1(), ldata.codes[k].opcode.latin1());
opcodeWidth = qMax(opcodeWidth, uint(ldata.codes[k].opcode.length())); opcodeWidth = qMax(opcodeWidth, uint(ldata.codes[k].opcode.length()));
TQString s = sec->instructions()[address].disasm; TQString s = sec->instructions()[address].disasm;
int j = s.find('\t'); int j = s.find('\t');

@ -35,14 +35,14 @@ private:
void Coff::XmlToData::parseData(TQDomElement element, Data &data) void Coff::XmlToData::parseData(TQDomElement element, Data &data)
{ {
TQStringList list = TQStringList::split(' ', element.attribute("id")); TQStringList list = TQStringList::split(' ', element.attribute("id"));
if ( list.isEmpty() ) qFatal("Missing id"); if ( list.isEmpty() ) tqFatal("Missing id");
if ( list.count()>MAX_NB_IDS ) qFatal("Please raise MAX_NB_IDS"); if ( list.count()>MAX_NB_IDS ) tqFatal("Please raise MAX_NB_IDS");
for (uint i=0; i<MAX_NB_IDS; i++) { for (uint i=0; i<MAX_NB_IDS; i++) {
if ( i<uint(list.count()) ) { if ( i<uint(list.count()) ) {
bool ok; bool ok;
data.ids[i] = fromHexLabel(list[i], 4, &ok); data.ids[i] = fromHexLabel(list[i], 4, &ok);
if ( !ok ) qFatal("Invalid id"); if ( !ok ) tqFatal("Invalid id");
//if ( _ids.contains(data.ids[i]) ) qFatal("Duplicated id"); //if ( _ids.contains(data.ids[i]) ) tqFatal("Duplicated id");
//_ids[data.ids[i]] = true; //_ids[data.ids[i]] = true;
} else data.ids[i] = 0; } else data.ids[i] = 0;
} }
@ -93,19 +93,19 @@ void Coff::XmlToData::parse()
case Pic::Architecture::P33F: continue; case Pic::Architecture::P33F: continue;
case Pic::Architecture::Nb_Types: Q_ASSERT(false); continue; case Pic::Architecture::Nb_Types: Q_ASSERT(false); continue;
} }
if ( !hasDevice(data->name()) ) qWarning("No id for device %s", data->name().latin1()); if ( !hasDevice(data->name()) ) tqWarning("No id for device %s", data->name().latin1());
} }
// extract COFF id from gputils // extract COFF id from gputils
for (uint i=0; pics[i].tag!=no_processor; i++) { for (uint i=0; pics[i].tag!=no_processor; i++) {
_current = TQString(pics[i].names[2]).upper(); _current = TQString(pics[i].names[2]).upper();
if ( !Device::lister().isSupported(_current) ) continue; if ( !Device::lister().isSupported(_current) ) continue;
if ( !hasDevice(_current) ) qDebug(">> add new id %s: %s", _current.latin1(), toHexLabel(pics[i].coff_type, 4).latin1()); if ( !hasDevice(_current) ) tqDebug(">> add new id %s: %s", _current.latin1(), toHexLabel(pics[i].coff_type, 4).latin1());
else { else {
bool ok = false; bool ok = false;
for (uint k=0; k<MAX_NB_IDS; k++) for (uint k=0; k<MAX_NB_IDS; k++)
if ( _map[_current].data.ids[k]==pics[i].coff_type ) ok = true; if ( _map[_current].data.ids[k]==pics[i].coff_type ) ok = true;
if ( !ok ) qFatal(TQString("Different ids")); if ( !ok ) tqFatal(TQString("Different ids"));
} }
} }
} }

@ -17,7 +17,7 @@ BitValue BitValue::XORn(uint n) const
uint res = 0x0; uint res = 0x0;
for (uint i=0; i<nb; i +=n) { for (uint i=0; i<nb; i +=n) {
res ^= (_value >> i) & mask; res ^= (_value >> i) & mask;
//qDebug("%i %s %s", i, toHexLabel((value>>i) & mask, 4).latin1(), toHexLabel(res, 4).latin1()); //tqDebug("%i %s %s", i, toHexLabel((value>>i) & mask, 4).latin1(), toHexLabel(res, 4).latin1());
} }
return res; return res;
} }

@ -48,7 +48,7 @@ TQString htmlTableRow(const TQString &title, const TQString &value)
void crash(const char *assert, const char *file, int line) void crash(const char *assert, const char *file, int line)
{ {
qDebug("CRASH_ASSERT: \"%s\" in %s (%d)", assert, file, line); tqDebug("CRASH_ASSERT: \"%s\" in %s (%d)", assert, file, line);
int * ptr = 0; int * ptr = 0;
(*ptr)++; (*ptr)++;
} }

@ -26,7 +26,7 @@ const NumberBase::Data NumberBase::DATA[Nb_Types] = {
char toChar(NumberBase base, uint value) char toChar(NumberBase base, uint value)
{ {
Q_ASSERT( value<base.data().base ); Q_ASSERT( value<base.data().base );
if ( value>=base.data().base ) qDebug("toChar %u (%u)", value, base.data().base); if ( value>=base.data().base ) tqDebug("toChar %u (%u)", value, base.data().base);
if ( base==NumberBase::String ) { if ( base==NumberBase::String ) {
if ( !isprint(value) ) return '.'; if ( !isprint(value) ) return '.';
return value; return value;
@ -45,7 +45,7 @@ TQString toString(NumberBase base, ulong value, uint nbChars)
value /= base.data().base; value /= base.data().base;
} }
Q_ASSERT( value==0 ); Q_ASSERT( value==0 );
if ( value!=0 ) qDebug("toString %s nbChars=%u", toLabel(base, tmp, ::nbChars(base, tmp)).latin1(), nbChars); if ( value!=0 ) tqDebug("toString %s nbChars=%u", toLabel(base, tmp, ::nbChars(base, tmp)).latin1(), nbChars);
return s; return s;
} }

@ -51,7 +51,7 @@ GenericConfig::~GenericConfig()
void GenericConfig::rollback() void GenericConfig::rollback()
{ {
#if defined(NO_KDE) #if defined(NO_KDE)
qWarning("Config rollback not supported"); tqWarning("Config rollback not supported");
#else #else
_d->config().rollback(); _d->config().rollback();
#endif #endif

@ -78,7 +78,7 @@ void ProgressMonitor::addTaskProgress(uint nbSteps)
if ( _current==_tasks.end() ) return; if ( _current==_tasks.end() ) return;
uint nb = (*_current).nbDoneSteps + nbSteps; uint nb = (*_current).nbDoneSteps + nbSteps;
Q_ASSERT( nb<=(*_current).nbSteps ); Q_ASSERT( nb<=(*_current).nbSteps );
if ( nb>(*_current).nbSteps ) qDebug("%s %i+%i > %i", (*_current).label.latin1(), (*_current).nbDoneSteps, nbSteps, (*_current).nbSteps); if ( nb>(*_current).nbSteps ) tqDebug("%s %i+%i > %i", (*_current).label.latin1(), (*_current).nbDoneSteps, nbSteps, (*_current).nbSteps);
(*_current).nbDoneSteps = TQMIN(nb, (*_current).nbSteps); (*_current).nbDoneSteps = TQMIN(nb, (*_current).nbSteps);
update(); update();
} }

@ -62,7 +62,7 @@ TQString PURL::Private::getWindowsDrivePath(char drive)
::Process::StringOutput process; ::Process::StringOutput process;
process.setup("winepath", args, false); process.setup("winepath", args, false);
::Process::State state = ::Process::runSynchronously(process, ::Process::Start, 3000); ::Process::State state = ::Process::runSynchronously(process, ::Process::Start, 3000);
if ( state!=::Process::Exited ) qWarning("Error running \"winepath\" with \"%s\" (%i)", args.join(" ").latin1(), state); if ( state!=::Process::Exited ) tqWarning("Error running \"winepath\" with \"%s\" (%i)", args.join(" ").latin1(), state);
s = process.sout() + process.serr(); s = process.sout() + process.serr();
TQDir dir(s.stripWhiteSpace()); TQDir dir(s.stripWhiteSpace());
_winDrives[drive] = dir.canonicalPath(); _winDrives[drive] = dir.canonicalPath();
@ -250,7 +250,7 @@ bool PURL::Base::isInto(const Directory &dir) const
bool PURL::Base::httpUrlExists(bool *ok) const bool PURL::Base::httpUrlExists(bool *ok) const
{ {
qInitNetworkProtocols(); tqInitNetworkProtocols();
if (ok) *ok = false; if (ok) *ok = false;
Http http(_url.host()); Http http(_url.host());
Synchronous sync(500); Synchronous sync(500);

@ -46,7 +46,7 @@ bool ListView::eventFilter(TQObject *o, TQEvent *e)
for (it=_editItems.begin(); it!=_editItems.end(); ++it) { for (it=_editItems.begin(); it!=_editItems.end(); ++it) {
for (uint i=0; i<(*it)->_editWidgets.count(); i++) { for (uint i=0; i<(*it)->_editWidgets.count(); i++) {
if ( TQT_BASE_OBJECT((*it)->_editWidgets[i])==TQT_BASE_OBJECT(o) ) { if ( TQT_BASE_OBJECT((*it)->_editWidgets[i])==TQT_BASE_OBJECT(o) ) {
//qDebug("event %i", e->type()); //tqDebug("event %i", e->type());
switch (e->type()) { switch (e->type()) {
case TQEvent::KeyPress: { case TQEvent::KeyPress: {
TQKeyEvent *ke = TQT_TQKEYEVENT(e); TQKeyEvent *ke = TQT_TQKEYEVENT(e);
@ -62,9 +62,9 @@ bool ListView::eventFilter(TQObject *o, TQEvent *e)
break; break;
} }
case TQEvent::FocusOut: { case TQEvent::FocusOut: {
//qDebug("focus out %i %i=%i", tqApp->focusWidget(), focusWidget(), (*it)->_editWidgets[i]); //tqDebug("focus out %i %i=%i", tqApp->focusWidget(), focusWidget(), (*it)->_editWidgets[i]);
if ( tqApp->focusWidget() && focusWidget()==(*it)->_editWidgets[i] ) break; if ( tqApp->focusWidget() && focusWidget()==(*it)->_editWidgets[i] ) break;
//qDebug("ext"); //tqDebug("ext");
TQCustomEvent *e = new TQCustomEvent(9999); TQCustomEvent *e = new TQCustomEvent(9999);
TQApplication::postEvent(o, e); TQApplication::postEvent(o, e);
return true; return true;
@ -73,7 +73,7 @@ bool ListView::eventFilter(TQObject *o, TQEvent *e)
(*it)->renameDone(false); (*it)->renameDone(false);
return true; return true;
default: default:
//qDebug(" ignored"); //tqDebug(" ignored");
break; break;
} }
} }

@ -165,7 +165,7 @@ KAboutData::setLicenseText( const char *licenseText )
void void
KAboutData::setLicenseTextFile( const TQString &file ) KAboutData::setLicenseTextFile( const TQString &file )
{ {
mLicenseText = qstrdup(TQFile::encodeName(file)); mLicenseText = tqstrdup(TQFile::encodeName(file));
mLicenseKey = License_File; mLicenseKey = License_File;
} }

@ -618,7 +618,7 @@ KCmdLineArgs::parseAllArgs()
else if ( (::qstrcmp(option, "version") == 0) || else if ( (::qstrcmp(option, "version") == 0) ||
(::qstrcmp(option, "v") == 0)) (::qstrcmp(option, "v") == 0))
{ {
printQ( TQString("TQt: %1\n").arg(qVersion())); printQ( TQString("TQt: %1\n").arg(tqVersion()));
// printQ( TQString("KDE: %1\n").arg(TDE_VERSION_STRING)); // printQ( TQString("KDE: %1\n").arg(TDE_VERSION_STRING));
printQ( TQString("%1: %2\n"). printQ( TQString("%1: %2\n").
arg(about->programName()).arg(about->version())); arg(about->programName()).arg(about->version()));
@ -742,11 +742,11 @@ KCmdLineArgs::qt_argv()
} }
qt_argv = new char*[ args->count() + 2 ]; qt_argv = new char*[ args->count() + 2 ];
qt_argv[ 0 ] = qstrdup( appName()); qt_argv[ 0 ] = tqstrdup( appName());
int i = 0; int i = 0;
for(; i < args->count(); i++) for(; i < args->count(); i++)
{ {
qt_argv[i+1] = qstrdup((char *) args->arg(i)); qt_argv[i+1] = tqstrdup((char *) args->arg(i));
} }
qt_argv[i+1] = 0; qt_argv[i+1] = 0;

@ -58,32 +58,32 @@ bool Port::Base::receiveChar(char &c, uint timeout)
bool Port::Base::setPinOn(uint, bool, LogicType) bool Port::Base::setPinOn(uint, bool, LogicType)
{ {
qFatal("setPinOn not implemented"); tqFatal("setPinOn not implemented");
return false; return false;
} }
bool Port::Base::readPin(uint, LogicType, bool &) bool Port::Base::readPin(uint, LogicType, bool &)
{ {
qFatal("readPin not implemented"); tqFatal("readPin not implemented");
return 0; return 0;
} }
TQValueVector<Port::PinData> Port::Base::pinData(IODir) const TQValueVector<Port::PinData> Port::Base::pinData(IODir) const
{ {
qFatal("pinData not implemented"); tqFatal("pinData not implemented");
return TQValueVector<PinData>(); return TQValueVector<PinData>();
} }
bool Port::Base::isGroundPin(uint) const bool Port::Base::isGroundPin(uint) const
{ {
qFatal("isGroundPin not implemented"); tqFatal("isGroundPin not implemented");
return false; return false;
} }
uint Port::Base::groundPin() const uint Port::Base::groundPin() const
{ {
qFatal("groundPin not implemented"); tqFatal("groundPin not implemented");
return 0; return 0;
} }
Port::IODir Port::Base::ioDir(uint) const Port::IODir Port::Base::ioDir(uint) const
{ {
qFatal("ioType not implemented"); tqFatal("ioType not implemented");
return NoIO; return NoIO;
} }
@ -121,7 +121,7 @@ void Port::Base::logData(const TQString &)
} }
} }
} }
qDebug("%s", vs.latin1()); tqDebug("%s", vs.latin1());
*/ */
//log(Log::Debug, vs); //log(Log::Debug, vs);
} }

@ -46,8 +46,8 @@ public:
protected: protected:
virtual bool internalOpen() = 0; virtual bool internalOpen() = 0;
virtual void internalClose() = 0; virtual void internalClose() = 0;
virtual bool internalSend(const char *, uint, uint) { qFatal("Not implemented"); return false; } virtual bool internalSend(const char *, uint, uint) { tqFatal("Not implemented"); return false; }
virtual bool internalReceive(uint, char *, uint) { qFatal("Not implemented"); return false; } virtual bool internalReceive(uint, char *, uint) { tqFatal("Not implemented"); return false; }
virtual void setSystemError(const TQString &message) = 0; virtual void setSystemError(const TQString &message) = 0;
private: private:

@ -39,7 +39,7 @@ void Port::USB::initialize()
usb_init(); usb_init();
VersionData vd = VersionData::fromString(LIBUSB_VERSION); VersionData vd = VersionData::fromString(LIBUSB_VERSION);
TQString s = TQString("libusb %1").arg(vd.pretty()); TQString s = TQString("libusb %1").arg(vd.pretty());
if ( vd<VersionData(0, 1, 8) ) qWarning("%s: may be too old (you need at least version 0.1.8)", s.latin1()); if ( vd<VersionData(0, 1, 8) ) tqWarning("%s: may be too old (you need at least version 0.1.8)", s.latin1());
#endif #endif
} }
@ -71,13 +71,13 @@ bool Port::USB::findBulk(const struct usb_device *dev)
#ifdef HAVE_USB #ifdef HAVE_USB
int configuration = -1, interface = -1, altsetting = -1, bulk_endpoint = -1; int configuration = -1, interface = -1, altsetting = -1, bulk_endpoint = -1;
// walk through the possible configs, etc. // walk through the possible configs, etc.
qDebug("This device has %d possible configuration(s).", dev->descriptor.bNumConfigurations); tqDebug("This device has %d possible configuration(s).", dev->descriptor.bNumConfigurations);
for (int c=0; c<dev->descriptor.bNumConfigurations; c++) { for (int c=0; c<dev->descriptor.bNumConfigurations; c++) {
qDebug("Looking at configuration %d...This configuration has %d interfaces.", c, dev->config[c].bNumInterfaces); tqDebug("Looking at configuration %d...This configuration has %d interfaces.", c, dev->config[c].bNumInterfaces);
for(int i=0; i<dev->config[c].bNumInterfaces; i++) { for(int i=0; i<dev->config[c].bNumInterfaces; i++) {
qDebug(" Looking at interface %d...This interface has %d altsettings.", i, dev->config[c].interface[i].num_altsetting); tqDebug(" Looking at interface %d...This interface has %d altsettings.", i, dev->config[c].interface[i].num_altsetting);
for (int a=0; a < dev->config[c].interface[i].num_altsetting; a++) { for (int a=0; a < dev->config[c].interface[i].num_altsetting; a++) {
qDebug(" Looking at altsetting %d...This altsetting has %d endpoints.", a, dev->config[c].interface[i].altsetting[a].bNumEndpoints); tqDebug(" Looking at altsetting %d...This altsetting has %d endpoints.", a, dev->config[c].interface[i].altsetting[a].bNumEndpoints);
for (int e=0; e < dev->config[c].interface[i].altsetting[a].bNumEndpoints; e++) { for (int e=0; e < dev->config[c].interface[i].altsetting[a].bNumEndpoints; e++) {
TQString s; TQString s;
s.sprintf(" Endpoint %d: Address %02xh, attributes %02xh ", e, dev->config[c].interface[i].altsetting[a].endpoint[e].bEndpointAddress, dev->config[c].interface[i].altsetting[a].endpoint[e].bmAttributes); s.sprintf(" Endpoint %d: Address %02xh, attributes %02xh ", e, dev->config[c].interface[i].altsetting[a].endpoint[e].bEndpointAddress, dev->config[c].interface[i].altsetting[a].endpoint[e].bmAttributes);
@ -109,13 +109,13 @@ bool Port::USB::findBulk(const struct usb_device *dev)
default: s += "ERROR! Got an illegal value in endpoint bEndpointAddress"; default: s += "ERROR! Got an illegal value in endpoint bEndpointAddress";
} }
} }
qDebug("%s", s.latin1()); tqDebug("%s", s.latin1());
} }
} }
} }
} }
if (bulk_endpoint<0) { if (bulk_endpoint<0) {
qDebug("No valid interface found!"); tqDebug("No valid interface found!");
return false; return false;
} }
#endif #endif
@ -151,7 +151,7 @@ struct usb_device *Port::USB::findDevice(uint vendorId, uint productId)
} }
#else #else
Q_UNUSED(vendorId); Q_UNUSED(productId); Q_UNUSED(vendorId); Q_UNUSED(productId);
qDebug("USB support disabled"); tqDebug("USB support disabled");
#endif #endif
return 0; return 0;
} }
@ -350,10 +350,10 @@ bool Port::USB::write(uint ep, const char *data, uint size)
int todo = size; int todo = size;
for (;;) { for (;;) {
int res = 0; int res = 0;
//qDebug("write ep=%i todo=%i/%i", ep, todo, size); //tqDebug("write ep=%i todo=%i/%i", ep, todo, size);
if ( mode==Interrupt ) res = usb_interrupt_write(_handle, ep, (char *)data + size - todo, todo, timeout(todo)); if ( mode==Interrupt ) res = usb_interrupt_write(_handle, ep, (char *)data + size - todo, todo, timeout(todo));
else res = usb_bulk_write(_handle, ep, (char *)data + size - todo, todo, timeout(todo)); else res = usb_bulk_write(_handle, ep, (char *)data + size - todo, todo, timeout(todo));
//qDebug("res: %i", res); //tqDebug("res: %i", res);
if ( res==todo ) break; if ( res==todo ) break;
if ( uint(time.elapsed())>3000 ) { // 3 s if ( uint(time.elapsed())>3000 ) { // 3 s
if ( res<0 ) setSystemError(i18n("Error sending data (ep=%1 res=%2)").arg(toHexLabel(ep, 2)).arg(res)); if ( res<0 ) setSystemError(i18n("Error sending data (ep=%1 res=%2)").arg(toHexLabel(ep, 2)).arg(res));
@ -384,10 +384,10 @@ bool Port::USB::read(uint ep, char *data, uint size, bool *poll)
int todo = size; int todo = size;
for (;;) { for (;;) {
int res = 0; int res = 0;
//qDebug("read ep=%i size=%i", ep, todo); //tqDebug("read ep=%i size=%i", ep, todo);
if ( mode==Interrupt ) res = usb_interrupt_read(_handle, ep, data + size - todo, todo, timeout(todo)); if ( mode==Interrupt ) res = usb_interrupt_read(_handle, ep, data + size - todo, todo, timeout(todo));
else res = usb_bulk_read(_handle, ep, data + size - todo, todo, timeout(todo)); else res = usb_bulk_read(_handle, ep, data + size - todo, todo, timeout(todo));
//qDebug("res: %i", res); //tqDebug("res: %i", res);
if ( res==todo ) break; if ( res==todo ) break;
if ( uint(time.elapsed())>3000 ) { // 3 s: seems to help icd2 in some case (?) if ( uint(time.elapsed())>3000 ) { // 3 s: seems to help icd2 in some case (?)
if ( res<0 ) setSystemError(i18n("Error receiving data (ep=%1 res=%2)").arg(toHexLabel(ep, 2)).arg(res)); if ( res<0 ) setSystemError(i18n("Error receiving data (ep=%1 res=%2)").arg(toHexLabel(ep, 2)).arg(res));

@ -60,7 +60,7 @@ const char * const INSTRUCTIONS[] = {
TQTextStream *initFile(TQFile &file) TQTextStream *initFile(TQFile &file)
{ {
if ( !file.open(IO_WriteOnly) ) qFatal("Cannot create \"%s\".", file.name().latin1()); if ( !file.open(IO_WriteOnly) ) tqFatal("Cannot create \"%s\".", file.name().latin1());
TQTextStream *s = new TQTextStream(&file); TQTextStream *s = new TQTextStream(&file);
(*s) << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl; (*s) << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
(*s) << "<!DOCTYPE language SYSTEM \"language.dtd\">" << endl; (*s) << "<!DOCTYPE language SYSTEM \"language.dtd\">" << endl;

@ -69,7 +69,7 @@ TQPixmap drawGraph(const TQValueVector<Device::RangeBox> &boxes)
xTicks.add(0.0, 0.0); xTicks.add(0.0, 0.0);
yTicks.add(0.0, 0.0); yTicks.add(0.0, 0.0);
for (uint i=0; i<boxes.count(); i++) { for (uint i=0; i<boxes.count(); i++) {
// qDebug("box #%i: %f=[%f %f] %f=[%f %f]", i, boxes[i].start.x, boxes[i].start.yMin, // tqDebug("box #%i: %f=[%f %f] %f=[%f %f]", i, boxes[i].start.x, boxes[i].start.yMin,
// boxes[i].start.yMax, boxes[i].end.x, boxes[i].end.yMin, boxes[i].end.yMax); // boxes[i].start.yMax, boxes[i].end.x, boxes[i].end.yMin, boxes[i].end.yMax);
xTicks.add(boxes[i].start.x, boxes[i].start.yMin); xTicks.add(boxes[i].start.x, boxes[i].start.yMin);
xTicks.add(boxes[i].start.x, boxes[i].start.yMax); xTicks.add(boxes[i].start.x, boxes[i].start.yMax);

@ -217,7 +217,7 @@ void HexBuffer::load(TQTextStream &stream, Format &format, TQValueList<ErrorData
uint data; uint data;
if ( sscanf(p, "%02X", &data)!=1 ) errors += ErrorData(line, UnexpectedEOL); if ( sscanf(p, "%02X", &data)!=1 ) errors += ErrorData(line, UnexpectedEOL);
else if ( ((cksum+data) & 0xFF)!=0 ) errors += ErrorData(line, WrongCRC); else if ( ((cksum+data) & 0xFF)!=0 ) errors += ErrorData(line, WrongCRC);
//qDebug("new address high: %s", toHex(addrH<<16, 8).data()); //tqDebug("new address high: %s", toHex(addrH<<16, 8).data());
continue; // goto next record continue; // goto next record
} }
@ -236,7 +236,7 @@ void HexBuffer::load(TQTextStream &stream, Format &format, TQValueList<ErrorData
/* modified by A.G, because low and hi bytes was swapped in Tobias's code , 8 may 2005 /* modified by A.G, because low and hi bytes was swapped in Tobias's code , 8 may 2005
*/ */
uint addrbase = ((addrH << 16) | addr); uint addrbase = ((addrH << 16) | addr);
//qDebug("line %i: address %s", line, toHex(addrbase, 8).data()); //tqDebug("line %i: address %s", line, toHex(addrbase, 8).data());
for (uint x = 0; x<count; x++) { for (uint x = 0; x<count; x++) {
uint data; uint data;
if ( sscanf(p, "%02X", &data)!=1 ) { if ( sscanf(p, "%02X", &data)!=1 ) {
@ -252,7 +252,7 @@ void HexBuffer::load(TQTextStream &stream, Format &format, TQValueList<ErrorData
BitValue value = (*this)[a]; BitValue value = (*this)[a];
if ( addrbase+x & 1 ) insert(a, value.maskWith(0x00FF) | data << 8); // Odd addr => Hi byte if ( addrbase+x & 1 ) insert(a, value.maskWith(0x00FF) | data << 8); // Odd addr => Hi byte
else insert(a, value.maskWith(0xFF00) | data); // Low byte else insert(a, value.maskWith(0xFF00) | data); // Low byte
//if ( x==0 ) qDebug("fb@%s: %s", toHex(addrbase+x >> 1, 8).data(), toHex(fb[addrbase+x >> 1], 8).data()); //if ( x==0 ) tqDebug("fb@%s: %s", toHex(addrbase+x >> 1, 8).data(), toHex(fb[addrbase+x >> 1], 8).data());
cksum += data; cksum += data;
} }
} else if ( bytecount==count*2 ) { } else if ( bytecount==count*2 ) {
@ -269,7 +269,7 @@ void HexBuffer::load(TQTextStream &stream, Format &format, TQValueList<ErrorData
break; break;
} }
p += 4; p += 4;
//qDebug("%s: %s", toHexLabel(addr+x, 4).latin1(), toHexLabel(datal | (datah << 8), 4).latin1()); //tqDebug("%s: %s", toHexLabel(addr+x, 4).latin1(), toHexLabel(datal | (datah << 8), 4).latin1());
insert(addr+x, datal | (datah << 8)); insert(addr+x, datal | (datah << 8));
cksum += datah; cksum += datah;
cksum += datal; cksum += datal;

@ -30,14 +30,14 @@ virtual void processDevice(TQDomElement device)
TQDomElement e = findUniqueElement(device, "memory", "name", TQString()); TQDomElement e = findUniqueElement(device, "memory", "name", TQString());
bool ok; bool ok;
data()->_nbBytes = fromHexLabel(e.attribute("size"), &ok); data()->_nbBytes = fromHexLabel(e.attribute("size"), &ok);
if ( !ok ) qFatal("Missing or invalid size"); if ( !ok ) tqFatal("Missing or invalid size");
data()->_nbBlocks = e.attribute("nb_blocks").toUInt(&ok); data()->_nbBlocks = e.attribute("nb_blocks").toUInt(&ok);
if ( !ok || data()->_nbBlocks==0 ) qFatal("Missing, zero, or invalid nb_blocks"); if ( !ok || data()->_nbBlocks==0 ) tqFatal("Missing, zero, or invalid nb_blocks");
if ( (data()->_nbBytes % data()->_nbBlocks)!=0 ) qFatal("nb_blocks should divide size"); if ( (data()->_nbBytes % data()->_nbBlocks)!=0 ) tqFatal("nb_blocks should divide size");
if ( data()->_nbBlocks>8 ) qFatal("nb_blocks is too large (>8)"); if ( data()->_nbBlocks>8 ) tqFatal("nb_blocks is too large (>8)");
data()->_nbBytesPage = e.attribute("page_size").toUInt(&ok); data()->_nbBytesPage = e.attribute("page_size").toUInt(&ok);
if ( !ok || data()->_nbBytesPage==0 ) qFatal("Missing, zero, or invalid page_size"); if ( !ok || data()->_nbBytesPage==0 ) tqFatal("Missing, zero, or invalid page_size");
if ( ((data()->_nbBytes/data()->_nbBlocks) % data()->_nbBytesPage)!=0 ) qFatal("page_size should divide size/nb_blocks"); if ( ((data()->_nbBytes/data()->_nbBlocks) % data()->_nbBytesPage)!=0 ) tqFatal("page_size should divide size/nb_blocks");
TQStringList names; TQStringList names;
names.append(TQString()); names.append(TQString());
checkTagNames(device, "memory", names); checkTagNames(device, "memory", names);
@ -45,11 +45,11 @@ virtual void processDevice(TQDomElement device)
virtual void checkPins(const TQMap<TQString, uint> &pinLabels) const virtual void checkPins(const TQMap<TQString, uint> &pinLabels) const
{ {
if ( !pinLabels.contains("VCC") ) qFatal("No VDD pin specified"); if ( !pinLabels.contains("VCC") ) tqFatal("No VDD pin specified");
if ( !pinLabels.contains("VSS") ) qFatal("No VSS pin specified"); if ( !pinLabels.contains("VSS") ) tqFatal("No VSS pin specified");
TQMap<TQString, uint>::const_iterator it; TQMap<TQString, uint>::const_iterator it;
for (it=pinLabels.begin(); it!=pinLabels.end(); ++it) for (it=pinLabels.begin(); it!=pinLabels.end(); ++it)
if ( it.data()!=1 ) qFatal(TQString("Duplicated pin %1").arg(it.key())); if ( it.data()!=1 ) tqFatal(TQString("Duplicated pin %1").arg(it.key()));
} }
}; // class }; // class

@ -123,7 +123,7 @@ bool Pic::Protection::extractRanges(const TQString &name, TQValueVector<Address>
bool ok1; bool ok1;
end = fromHex(regexp.cap(regexp.numCaptures()), &ok1); end = fromHex(regexp.cap(regexp.numCaptures()), &ok1);
if ( !ok1 ) { if ( !ok1 ) {
qDebug("Malformed end address"); tqDebug("Malformed end address");
return true; return true;
} }
starts.clear(); starts.clear();
@ -133,11 +133,11 @@ bool Pic::Protection::extractRanges(const TQString &name, TQValueVector<Address>
TQString s = (i==1 ? regexp.cap(i) : regexp.cap(i).mid(1)); TQString s = (i==1 ? regexp.cap(i) : regexp.cap(i).mid(1));
Address start = fromHex(s, &ok1); Address start = fromHex(s, &ok1);
if ( !ok1 ) { if ( !ok1 ) {
qDebug("Malformed start address %s", s.latin1()); tqDebug("Malformed start address %s", s.latin1());
return true; return true;
} }
if ( start>=end && (starts.count()==0 || starts[starts.count()-1]<start) ) { if ( start>=end && (starts.count()==0 || starts[starts.count()-1]<start) ) {
qDebug("Start addresses should be ordered"); tqDebug("Start addresses should be ordered");
return true; return true;
} }
starts.append(start); starts.append(start);
@ -188,7 +188,7 @@ bool Pic::Protection::checkRange(const TQString &mask, const TQString &name) con
if ( ptype!=Nb_Types ) break; if ( ptype!=Nb_Types ) break;
} }
if ( ptype==Nb_Types ) { if ( ptype==Nb_Types ) {
qDebug("Unknown protected memory range"); tqDebug("Unknown protected memory range");
return false; return false;
} }
// #### TODO // #### TODO
@ -198,13 +198,13 @@ bool Pic::Protection::checkRange(const TQString &mask, const TQString &name) con
Pic::Protection::ProtectedRange Pic::Protection::extractRange(const TQString &mask, const TQString &name, bool &ok) const Pic::Protection::ProtectedRange Pic::Protection::extractRange(const TQString &mask, const TQString &name, bool &ok) const
{ {
Q_ASSERT( family()!=CodeGuard ); Q_ASSERT( family()!=CodeGuard );
//qDebug("extract range %s %s", mask.latin1(), name.latin1()); //tqDebug("extract range %s %s", mask.latin1(), name.latin1());
ProtectedRange pr; ProtectedRange pr;
ok = false; ok = false;
TQRegExp rexp("([A-Z]+)(?:_([0-9])|)"); TQRegExp rexp("([A-Z]+)(?:_([0-9])|)");
if ( !rexp.exactMatch(mask) ) { if ( !rexp.exactMatch(mask) ) {
qDebug("Malformed block range"); tqDebug("Malformed block range");
return pr; return pr;
} }
@ -221,7 +221,7 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const TQString &ma
ptype = Type(k); ptype = Type(k);
if ( !rexp.cap(2).isEmpty() ) { if ( !rexp.cap(2).isEmpty() ) {
if ( isBootBlock || (rtype!=MemoryRangeType::Code && rtype!=MemoryRangeType::Eeprom) ) { if ( isBootBlock || (rtype!=MemoryRangeType::Code && rtype!=MemoryRangeType::Eeprom) ) {
qDebug("Multiple blocks only for code and eeprom"); tqDebug("Multiple blocks only for code and eeprom");
return pr; return pr;
} }
} }
@ -230,7 +230,7 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const TQString &ma
if ( rtype!=MemoryRangeType::Nb_Types ) break; if ( rtype!=MemoryRangeType::Nb_Types ) break;
} }
if ( rtype==MemoryRangeType::Nb_Types ) { if ( rtype==MemoryRangeType::Nb_Types ) {
qDebug("Unknown protected memory range"); tqDebug("Unknown protected memory range");
return pr; return pr;
} }
@ -244,12 +244,12 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const TQString &ma
const MemoryRangeData &rdata = _data.range(rtype); const MemoryRangeData &rdata = _data.range(rtype);
if ( isAllProtectedValueName(name) ) { if ( isAllProtectedValueName(name) ) {
if ( rtype==MemoryRangeType::Code && !isBootBlock && bmask ) { if ( rtype==MemoryRangeType::Code && !isBootBlock && bmask ) {
qDebug("Protected range should be explicit with boot block"); tqDebug("Protected range should be explicit with boot block");
return pr; return pr;
} }
if (isBootBlock) { if (isBootBlock) {
if ( bsmask==0 ) { if ( bsmask==0 ) {
qDebug("Protected range should be explicit when boot size not present"); tqDebug("Protected range should be explicit when boot size not present");
return pr; return pr;
} }
Address start = _data.range(MemoryRangeType::Code).start; Address start = _data.range(MemoryRangeType::Code).start;
@ -258,11 +258,11 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const TQString &ma
bool ok1; bool ok1;
uint size = bsmask->values[k].name.toUInt(&ok1); uint size = bsmask->values[k].name.toUInt(&ok1);
if ( !ok1 ) { if ( !ok1 ) {
qDebug("Could not recognize boot size value"); tqDebug("Could not recognize boot size value");
return pr; return pr;
} }
if ( size==0 ) { if ( size==0 ) {
qDebug("Boot size cannot be zero"); tqDebug("Boot size cannot be zero");
return pr; return pr;
} }
Address end = 2 * size - 1; // instruction words Address end = 2 * size - 1; // instruction words
@ -278,7 +278,7 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const TQString &ma
return pr; return pr;
} }
if ( isBootBlock && bsmask ) { if ( isBootBlock && bsmask ) {
qDebug("Protected range should not be explicit when boot size is present"); tqDebug("Protected range should not be explicit when boot size is present");
return pr; return pr;
} }
@ -286,20 +286,20 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const TQString &ma
Address end; Address end;
bool ok1; bool ok1;
if ( !extractRanges(name, pr.starts, end, ok1) ) { if ( !extractRanges(name, pr.starts, end, ok1) ) {
qDebug("Could not recognized explicit range"); tqDebug("Could not recognized explicit range");
return pr; return pr;
} }
if ( !ok1 ) return pr; if ( !ok1 ) return pr;
if ( end>rdata.end ) { if ( end>rdata.end ) {
qDebug("End is beyond memory range"); tqDebug("End is beyond memory range");
return pr; return pr;
} }
if ( (rtype!=MemoryRangeType::Code || isBootBlock) && (pr.starts.count()>1 || !rexp.cap(2).isEmpty() || bmask==0) ) { if ( (rtype!=MemoryRangeType::Code || isBootBlock) && (pr.starts.count()>1 || !rexp.cap(2).isEmpty() || bmask==0) ) {
qDebug("Only code with blocks and boot can have multiple protected ranges"); tqDebug("Only code with blocks and boot can have multiple protected ranges");
return pr; return pr;
} }
if ( isBootBlock && pr.starts[0]!=0 ) { if ( isBootBlock && pr.starts[0]!=0 ) {
qDebug("Boot block start should be zero"); tqDebug("Boot block start should be zero");
return pr; return pr;
} }
pr.ends.append(end); pr.ends.append(end);
@ -307,7 +307,7 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const TQString &ma
// check with boot block // check with boot block
if ( pr.starts.count()>1 ) { if ( pr.starts.count()>1 ) {
if ( bmask==0 ) { if ( bmask==0 ) {
qDebug("No boot mask"); tqDebug("No boot mask");
return pr; return pr;
} }
for (uint i=0; i<uint(bmask->values.count()); i++) { for (uint i=0; i<uint(bmask->values.count()); i++) {
@ -316,12 +316,12 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const TQString &ma
ProtectedRange bpr = extractRange(bmask->name, bmask->values[i].name, ok1); ProtectedRange bpr = extractRange(bmask->name, bmask->values[i].name, ok1);
if ( !ok1 ) return pr; if ( !ok1 ) return pr;
if ( bpr.ends.count()!=pr.starts.count() ) { if ( bpr.ends.count()!=pr.starts.count() ) {
qDebug("Boot number of ends (%i) should be the same as code number of starts (%i)", int(bpr.ends.count()), int(pr.starts.count())); tqDebug("Boot number of ends (%i) should be the same as code number of starts (%i)", int(bpr.ends.count()), int(pr.starts.count()));
return pr; return pr;
} }
for (uint k=0; k<uint(bpr.ends.count()); k++) { for (uint k=0; k<uint(bpr.ends.count()); k++) {
if ( bpr.ends[k]+1!=pr.starts[k] ) { if ( bpr.ends[k]+1!=pr.starts[k] ) {
qDebug("%i: End of boot block (%s) doesn't match start of code block (%s)", k, toHexLabelAbs(bpr.ends[k]).latin1(), toHexLabelAbs(pr.starts[k]).latin1()); tqDebug("%i: End of boot block (%s) doesn't match start of code block (%s)", k, toHexLabelAbs(bpr.ends[k]).latin1(), toHexLabelAbs(pr.starts[k]).latin1());
return pr; return pr;
} }
} }

@ -32,9 +32,9 @@ Pic::MemoryConfigEditorWidget::MemoryConfigEditorWidget(Memory &memory, bool wit
} }
for(uint i=0; i<nbWords; ++i) { for(uint i=0; i<nbWords; ++i) {
//qDebug("BinWordsEditor for config word #%i", i); //tqDebug("BinWordsEditor for config word #%i", i);
//uint address = device().range(Device::MemoryConfig).start + device().addressIncrement(Device::MemoryConfig) * i; //uint address = device().range(Device::MemoryConfig).start + device().addressIncrement(Device::MemoryConfig) * i;
//qDebug("address: %s %s nb: %i", toHex(address, 8).data(), device().configWord(i).name.latin1(), device().configWord(i).masks.count()); //tqDebug("address: %s %s nb: %i", toHex(address, 8).data(), device().configWord(i).name.latin1(), device().configWord(i).masks.count());
if ( device().config()._words[i].masks.count()==0 ) continue; if ( device().config()._words[i].masks.count()==0 ) continue;
TQWidget *page = 0; TQWidget *page = 0;
if ( nbWords>1 ) { if ( nbWords>1 ) {

@ -156,14 +156,14 @@ void Pic::ConfigWordEditor::setReadOnly(bool readOnly)
void Pic::ConfigWordEditor::slotModified() void Pic::ConfigWordEditor::slotModified()
{ {
BitValue v = memory().word(MemoryRangeType::Config, _configIndex); BitValue v = memory().word(MemoryRangeType::Config, _configIndex);
//qDebug("BinWordEditor::slotModified %i: %s", _configIndex, toHex(v, 4).data()); //tqDebug("BinWordEditor::slotModified %i: %s", _configIndex, toHex(v, 4).data());
for (uint k=0; k<_combos.count(); k++) { for (uint k=0; k<_combos.count(); k++) {
const Config::Mask &cmask = device().config()._words[_configIndex].masks[k]; const Config::Mask &cmask = device().config()._words[_configIndex].masks[k];
v = v.clearMaskBits(cmask.value); v = v.clearMaskBits(cmask.value);
v |= cmask.values[_combos[k]->index()].value; // set value v |= cmask.values[_combos[k]->index()].value; // set value
} }
memory().setWord(MemoryRangeType::Config, _configIndex, v); memory().setWord(MemoryRangeType::Config, _configIndex, v);
//qDebug(" now: %s", toHex(v, 4).data()); //tqDebug(" now: %s", toHex(v, 4).data());
if (_mdb) _mdb->updateDisplay(); if (_mdb) _mdb->updateDisplay();
emit modified(); emit modified();
} }
@ -172,7 +172,7 @@ void Pic::ConfigWordEditor::updateDisplay()
{ {
BitValue v = memory().word(MemoryRangeType::Config, _configIndex); BitValue v = memory().word(MemoryRangeType::Config, _configIndex);
uint nbChars = device().nbCharsWord(MemoryRangeType::Config); uint nbChars = device().nbCharsWord(MemoryRangeType::Config);
//qDebug("BinWordEditor::updateDisplay %i: %s", _configIndex, toHex(v, 4).data()); //tqDebug("BinWordEditor::updateDisplay %i: %s", _configIndex, toHex(v, 4).data());
for (uint k=0; k<_combos.count(); k++) { for (uint k=0; k<_combos.count(); k++) {
const Config::Mask &cmask = device().config()._words[_configIndex].masks[k]; const Config::Mask &cmask = device().config()._words[_configIndex].masks[k];
for (int i=cmask.values.count()-1; i>=0; i--) { for (int i=cmask.values.count()-1; i>=0; i--) {

@ -85,7 +85,7 @@ BitValue Pic::Memory::normalizedWord(MemoryRangeType type, uint offset) const
void Pic::Memory::setWord(MemoryRangeType type, uint offset, BitValue value) void Pic::Memory::setWord(MemoryRangeType type, uint offset, BitValue value)
{ {
if ( offset>=_ranges[type].size() ) qDebug("Memory::setWord: type=%s offset=%s size=%s value=%s", type.key(), toHexLabelAbs(offset).latin1(), toHexLabelAbs(_ranges[type].size()).latin1(), toHexLabelAbs(value).latin1()); if ( offset>=_ranges[type].size() ) tqDebug("Memory::setWord: type=%s offset=%s size=%s value=%s", type.key(), toHexLabelAbs(offset).latin1(), toHexLabelAbs(_ranges[type].size()).latin1(), toHexLabelAbs(value).latin1());
CRASH_ASSERT( offset<_ranges[type].size() ); CRASH_ASSERT( offset<_ranges[type].size() );
_ranges[type][offset] = value; _ranges[type][offset] = value;
} }
@ -204,7 +204,7 @@ AddressRangeVector Pic::Memory::protectedRanges(Protection::Type ptype, MemoryRa
if ( protection.family()!=Protection::CodeGuard ) { if ( protection.family()!=Protection::CodeGuard ) {
TQString maskName = protection.maskName(ptype, type); TQString maskName = protection.maskName(ptype, type);
TQString value = findValue(maskName); TQString value = findValue(maskName);
//qDebug("%s %s", maskName.latin1(), value.latin1()); //tqDebug("%s %s", maskName.latin1(), value.latin1());
if ( !value.isEmpty() ) { if ( !value.isEmpty() ) {
AddressRangeVector tmp = protection.extractRanges(value, type); AddressRangeVector tmp = protection.extractRanges(value, type);
Q_ASSERT( tmp.count()==1 ); Q_ASSERT( tmp.count()==1 );
@ -336,9 +336,9 @@ BitValue Pic::Memory::checksum() const
bool isProtected = !rv.isEmpty(); bool isProtected = !rv.isEmpty();
uint inc = device().addressIncrement(MemoryRangeType::Code); uint inc = device().addressIncrement(MemoryRangeType::Code);
//uint nbChars = device().nbCharsWord(MemoryRangeType::Code); //uint nbChars = device().nbCharsWord(MemoryRangeType::Code);
//qDebug("protected: %i nb: %s (%s)", isProtected, toHexLabelAbs(inc*device().nbWords(MemoryRangeType::Code)).latin1(), toHexLabel(mask, nbChars).latin1()); //tqDebug("protected: %i nb: %s (%s)", isProtected, toHexLabelAbs(inc*device().nbWords(MemoryRangeType::Code)).latin1(), toHexLabel(mask, nbChars).latin1());
//for (uint i=0; i<rv.count(); i++) //for (uint i=0; i<rv.count(); i++)
// qDebug("protected: %s:%s", toHex(rv[i].start, nbChars).latin1(), toHex(rv[i].end, nbChars).latin1()); // tqDebug("protected: %s:%s", toHex(rv[i].start, nbChars).latin1(), toHex(rv[i].end, nbChars).latin1());
if ( isProtected && (device().architecture()==Pic::Architecture::P18J || device().architecture()==Pic::Architecture::P24F) ) if ( isProtected && (device().architecture()==Pic::Architecture::P18J || device().architecture()==Pic::Architecture::P24F) )
return 0x0000; return 0x0000;
Checksum::Algorithm algorithm = Checksum::Algorithm::Normal; Checksum::Algorithm algorithm = Checksum::Algorithm::Normal;
@ -353,12 +353,12 @@ BitValue Pic::Memory::checksum() const
cs = checksums[valueName].constant; cs = checksums[valueName].constant;
} }
} }
//qDebug("constant: %s", toHexLabelAbs(cs).data()); //tqDebug("constant: %s", toHexLabelAbs(cs).data());
//qDebug("algo: %s", Checksum::ALGORITHM_DATA[algorithm].name); //tqDebug("algo: %s", Checksum::ALGORITHM_DATA[algorithm].name);
for (uint i=0; i<device().nbWords(MemoryRangeType::Code); i++) { for (uint i=0; i<device().nbWords(MemoryRangeType::Code); i++) {
if ( algorithm==Checksum::Algorithm::Normal && rv.contains(inc*i) ) continue; if ( algorithm==Checksum::Algorithm::Normal && rv.contains(inc*i) ) continue;
BitValue v = word(MemoryRangeType::Code, i).maskWith(mask); BitValue v = word(MemoryRangeType::Code, i).maskWith(mask);
//if ( i==0 || i==device().nbWords(MemoryRangeType::Code)-1 ) qDebug("%s %s", toHexLabel(i, 4).latin1(), toHexLabel(v, 4).latin1()); //if ( i==0 || i==device().nbWords(MemoryRangeType::Code)-1 ) tqDebug("%s %s", toHexLabel(i, 4).latin1(), toHexLabel(v, 4).latin1());
switch (device().architecture().type()) { switch (device().architecture().type()) {
case Architecture::P10X: case Architecture::P10X:
case Architecture::P16X: case Architecture::P16X:
@ -387,19 +387,19 @@ BitValue Pic::Memory::checksum() const
case Architecture::Nb_Types: Q_ASSERT(false); break; case Architecture::Nb_Types: Q_ASSERT(false); break;
} }
} }
//qDebug("after code: %s", toHexLabelAbs(cs).latin1()); //tqDebug("after code: %s", toHexLabelAbs(cs).latin1());
// config // config
const Config &config = device().config(); const Config &config = device().config();
for (uint i=0; i<uint(config._words.count()); i++) { for (uint i=0; i<uint(config._words.count()); i++) {
const Config::Word &cword = config._words[i]; const Config::Word &cword = config._words[i];
BitValue v = word(MemoryRangeType::Config, i).maskWith(cword.cmask); BitValue v = word(MemoryRangeType::Config, i).maskWith(cword.cmask);
//uint nbChars = device().nbCharsWord(MemoryRangeType::Config); //uint nbChars = device().nbCharsWord(MemoryRangeType::Config);
// qDebug("%i: %s %s", i, toHex(word(MemoryRangeType::Config, i), nbChars).latin1(), toHex(cword.cmask, nbChars).latin1()); // tqDebug("%i: %s %s", i, toHex(word(MemoryRangeType::Config, i), nbChars).latin1(), toHex(cword.cmask, nbChars).latin1());
if ( ( device().name()=="16C61" || device().name()=="16C71" ) && isProtected ) cs += v | 0x0060; if ( ( device().name()=="16C61" || device().name()=="16C71" ) && isProtected ) cs += v | 0x0060;
else if ( device().is16bitFamily() ) cs += v.byte(0) + v.byte(1); else if ( device().is16bitFamily() ) cs += v.byte(0) + v.byte(1);
else cs += v; else cs += v;
} }
//qDebug("after config: %s", toHexLabelAbs(cs).latin1()); //tqDebug("after config: %s", toHexLabelAbs(cs).latin1());
// user ids // user ids
if ( isProtected && device().isPresent(MemoryRangeType::UserId) && !device().is16bitFamily() && algorithm==Checksum::Algorithm::Normal ) { if ( isProtected && device().isPresent(MemoryRangeType::UserId) && !device().is16bitFamily() && algorithm==Checksum::Algorithm::Normal ) {
BitValue id = 0x0; BitValue id = 0x0;
@ -408,14 +408,14 @@ BitValue Pic::Memory::checksum() const
BitValue v = word(MemoryRangeType::UserId, nb-i-1).maskWith(0xF); BitValue v = word(MemoryRangeType::UserId, nb-i-1).maskWith(0xF);
if ( device().is18Family() ) id += v; if ( device().is18Family() ) id += v;
else { else {
// qDebug("id %i (%i): %s %s", i, nbb, toHex(v, 4).latin1(), toHex(v << (nbb*i), 9).latin1()); // tqDebug("id %i (%i): %s %s", i, nbb, toHex(v, 4).latin1(), toHex(v << (nbb*i), 9).latin1());
id += v << (4*i); id += v << (4*i);
} }
} }
//qDebug("id %s", toHexLabelAbs(id).latin1()); //tqDebug("id %s", toHexLabelAbs(id).latin1());
cs += id; cs += id;
} }
//qDebug("checksum: %s %s", toHexLabelAbs(cs).latin1(), toHex(cs & 0xFFFF, 4).latin1()); //tqDebug("checksum: %s %s", toHexLabelAbs(cs).latin1(), toHex(cs & 0xFFFF, 4).latin1());
return cs.maskWith(0xFFFF); return cs.maskWith(0xFFFF);
} }
@ -471,11 +471,11 @@ void Pic::Memory::toHexBuffer(MemoryRangeType type, HexBuffer &hb) const
uint byte = 0; uint byte = 0;
uint wOffset = 0; uint wOffset = 0;
uint wByte = 0; uint wByte = 0;
//qDebug("%s wnb=%i snb=%i div=%i", MEMORY_RANGE_TYPE_DATA[type].label, wNbBytes, sNbBytes, div); //tqDebug("%s wnb=%i snb=%i div=%i", MEMORY_RANGE_TYPE_DATA[type].label, wNbBytes, sNbBytes, div);
for (uint k=0; k<wNbBytes*device().nbWords(type); k++) { for (uint k=0; k<wNbBytes*device().nbWords(type); k++) {
// set byte // set byte
BitValue s = _ranges[type][wOffset].maskWith(mask); BitValue s = _ranges[type][wOffset].maskWith(mask);
//if ( k<4 ) qDebug("s=%s so=%s sb=%i wo=%i wb=%i", toHex(s, 8).data(), toHex(sOffset, 8).data(), sByte, wOffset, wByte); //if ( k<4 ) tqDebug("s=%s so=%s sb=%i wo=%i wb=%i", toHex(s, 8).data(), toHex(sOffset, 8).data(), sByte, wOffset, wByte);
s = s.byte(wByte); s = s.byte(wByte);
if ( (byte%2)==0 ) hb.insert(offset, s); if ( (byte%2)==0 ) hb.insert(offset, s);
else hb.insert(offset, hb[offset] | (s << ((byte%2)*8))); else hb.insert(offset, hb[offset] | (s << ((byte%2)*8)));
@ -517,11 +517,11 @@ void Pic::Memory::fromHexBuffer(MemoryRangeType type, const HexBuffer &hb, Warni
uint byte = 0; uint byte = 0;
uint wOffset = 0; uint wOffset = 0;
uint wByte = 0; uint wByte = 0;
//qDebug("%s wnb=%i snb=%i", MEMORY_RANGE_TYPE_DATA[type].label, wNbBytes, nbBytes); //tqDebug("%s wnb=%i snb=%i", MEMORY_RANGE_TYPE_DATA[type].label, wNbBytes, nbBytes);
for (uint k=0; k<wNbBytes*device().nbWords(type); k++) { for (uint k=0; k<wNbBytes*device().nbWords(type); k++) {
// set byte // set byte
BitValue s = hb[offset]; BitValue s = hb[offset];
//if ( k<4 ) qDebug("s=%s so=%s sb=%i wo=%i wb=%i", toHex(s, 8).data(), toHex(offset, 8).data(), byte, wOffset, wByte); //if ( k<4 ) tqDebug("s=%s so=%s sb=%i wo=%i wb=%i", toHex(s, 8).data(), toHex(offset, 8).data(), byte, wOffset, wByte);
if ( !s.isInitialized() ) { if ( !s.isInitialized() ) {
if ( type==MemoryRangeType::Config ) _ranges[type][wOffset] = mask; if ( type==MemoryRangeType::Config ) _ranges[type][wOffset] = mask;
else _ranges[type][wOffset] = BitValue(); else _ranges[type][wOffset] = BitValue();

@ -29,11 +29,11 @@ bool getVoltages(ProgVoltageType type, TQDomElement element)
data()->_voltages[type].min = voltages.attribute("min").toDouble(&ok1); data()->_voltages[type].min = voltages.attribute("min").toDouble(&ok1);
data()->_voltages[type].max = voltages.attribute("max").toDouble(&ok2); data()->_voltages[type].max = voltages.attribute("max").toDouble(&ok2);
data()->_voltages[type].nominal = voltages.attribute("nominal").toDouble(&ok3); data()->_voltages[type].nominal = voltages.attribute("nominal").toDouble(&ok3);
if ( !ok1 || !ok2 || !ok3 ) qFatal(TQString("Cannot extract voltage value for \"%1\"").arg(type.key())); if ( !ok1 || !ok2 || !ok3 ) tqFatal(TQString("Cannot extract voltage value for \"%1\"").arg(type.key()));
if ( data()->_voltages[type].min>data()->_voltages[type].max if ( data()->_voltages[type].min>data()->_voltages[type].max
|| data()->_voltages[type].nominal<data()->_voltages[type].min || data()->_voltages[type].nominal<data()->_voltages[type].min
|| data()->_voltages[type].nominal>data()->_voltages[type].max ) || data()->_voltages[type].nominal>data()->_voltages[type].max )
qFatal("Inconsistent voltages order"); tqFatal("Inconsistent voltages order");
return true; return true;
} }
@ -45,46 +45,46 @@ bool getMemoryRange(MemoryRangeType type, TQDomElement element)
bool ok; bool ok;
uint nbCharsAddress = data()->nbCharsAddress(); uint nbCharsAddress = data()->nbCharsAddress();
data()->_ranges[type].start = fromHexLabel(range.attribute("start"), nbCharsAddress, &ok); data()->_ranges[type].start = fromHexLabel(range.attribute("start"), nbCharsAddress, &ok);
if ( !ok ) qFatal("Cannot extract start address"); if ( !ok ) tqFatal("Cannot extract start address");
data()->_ranges[type].end = fromHexLabel(range.attribute("end"), nbCharsAddress, &ok); data()->_ranges[type].end = fromHexLabel(range.attribute("end"), nbCharsAddress, &ok);
if ( !ok ) qFatal("Cannot extract end address"); if ( !ok ) tqFatal("Cannot extract end address");
if ( data()->_ranges[type].end<data()->_ranges[type].start ) qFatal("Memory range end is before its start"); if ( data()->_ranges[type].end<data()->_ranges[type].start ) tqFatal("Memory range end is before its start");
uint nbCharsWord = data()->nbCharsWord(type); uint nbCharsWord = data()->nbCharsWord(type);
if ( data()->nbBitsWord(type)==0 ) qFatal(TQString("Architecture doesn't contain memory range %1").arg(type.key())); if ( data()->nbBitsWord(type)==0 ) tqFatal(TQString("Architecture doesn't contain memory range %1").arg(type.key()));
if ( type==MemoryRangeType::UserId ) { if ( type==MemoryRangeType::UserId ) {
data()->_userIdRecommendedMask = fromHexLabel(range.attribute("rmask"), nbCharsWord, &ok); data()->_userIdRecommendedMask = fromHexLabel(range.attribute("rmask"), nbCharsWord, &ok);
if ( !ok ) qFatal("Cannot extract rmask value for user id"); if ( !ok ) tqFatal("Cannot extract rmask value for user id");
if ( !data()->_userIdRecommendedMask.isInside(data()->mask(type)) ) qFatal(TQString("rmask is not inside mask %1 (%2)").arg(toHexLabel(data()->_userIdRecommendedMask, 8)).arg(toHexLabel(data()->mask(type), 8))); if ( !data()->_userIdRecommendedMask.isInside(data()->mask(type)) ) tqFatal(TQString("rmask is not inside mask %1 (%2)").arg(toHexLabel(data()->_userIdRecommendedMask, 8)).arg(toHexLabel(data()->mask(type), 8)));
} }
if ( range.attribute("hexfile_offset")!="?" ) { if ( range.attribute("hexfile_offset")!="?" ) {
data()->_ranges[type].properties |= Programmable; data()->_ranges[type].properties |= Programmable;
if ( !range.attribute("hexfile_offset").isEmpty() ) { if ( !range.attribute("hexfile_offset").isEmpty() ) {
data()->_ranges[type].hexFileOffset = fromHexLabel(range.attribute("hexfile_offset"), nbCharsAddress, &ok); data()->_ranges[type].hexFileOffset = fromHexLabel(range.attribute("hexfile_offset"), nbCharsAddress, &ok);
if ( !ok ) qFatal("Cannot extract hexfile_offset"); if ( !ok ) tqFatal("Cannot extract hexfile_offset");
} }
} }
if ( type==MemoryRangeType::Cal && !data()->is18Family() ) { if ( type==MemoryRangeType::Cal && !data()->is18Family() ) {
data()->_calibration.opcodeMask = fromHexLabel(range.attribute("cal_opmask"), nbCharsWord, &ok); data()->_calibration.opcodeMask = fromHexLabel(range.attribute("cal_opmask"), nbCharsWord, &ok);
if ( !ok ) qFatal("Cannot extract calibration opcode mask"); if ( !ok ) tqFatal("Cannot extract calibration opcode mask");
data()->_calibration.opcode = fromHexLabel(range.attribute("cal_opcode"), nbCharsWord, &ok); data()->_calibration.opcode = fromHexLabel(range.attribute("cal_opcode"), nbCharsWord, &ok);
if ( !ok ) qFatal("Cannot extract calibration opcode"); if ( !ok ) tqFatal("Cannot extract calibration opcode");
if ( !data()->_calibration.opcode.isInside(data()->_calibration.opcodeMask) ) qFatal("Calibration opcode should be inside opcode mask"); if ( !data()->_calibration.opcode.isInside(data()->_calibration.opcodeMask) ) tqFatal("Calibration opcode should be inside opcode mask");
if ( !data()->_calibration.opcodeMask.isInside(data()->mask(type)) ) qFatal("Calibration mask should be inside opcode mask"); if ( !data()->_calibration.opcodeMask.isInside(data()->mask(type)) ) tqFatal("Calibration mask should be inside opcode mask");
} }
TQString wwa = range.attribute("word_write_align"); TQString wwa = range.attribute("word_write_align");
TQString wea = range.attribute("word_erase_align"); TQString wea = range.attribute("word_erase_align");
if ( type==MemoryRangeType::Code ) { if ( type==MemoryRangeType::Code ) {
if ( data()->_architecture==Architecture::P18F || data()->_architecture==Architecture::P18J ) { if ( data()->_architecture==Architecture::P18F || data()->_architecture==Architecture::P18J ) {
data()->_nbWordsCodeWrite = wwa.toUInt(&ok); data()->_nbWordsCodeWrite = wwa.toUInt(&ok);
if ( !ok || data()->_nbWordsCodeWrite==0 || (data()->_nbWordsCodeWrite%4)!=0 ) qFatal("Missing or malformed word write align"); if ( !ok || data()->_nbWordsCodeWrite==0 || (data()->_nbWordsCodeWrite%4)!=0 ) tqFatal("Missing or malformed word write align");
data()->_nbWordsCodeRowErase = wea.toUInt(&ok); data()->_nbWordsCodeRowErase = wea.toUInt(&ok);
if ( !ok || (data()->_nbWordsCodeRowErase%4)!=0 ) qFatal("Missing or malformed word erase align"); if ( !ok || (data()->_nbWordsCodeRowErase%4)!=0 ) tqFatal("Missing or malformed word erase align");
} else { } else {
if ( !wwa.isEmpty() || !wea.isEmpty() ) qFatal("word align should not be defined for this device family/subfamily"); if ( !wwa.isEmpty() || !wea.isEmpty() ) tqFatal("word align should not be defined for this device family/subfamily");
data()->_nbWordsCodeWrite = 0; // #### TODO data()->_nbWordsCodeWrite = 0; // #### TODO
data()->_nbWordsCodeRowErase = 0; // #### TODO data()->_nbWordsCodeRowErase = 0; // #### TODO
} }
} else if ( !wwa.isEmpty() || !wea.isEmpty() ) qFatal("word align should not be defined for this memory range"); } else if ( !wwa.isEmpty() || !wea.isEmpty() ) tqFatal("word align should not be defined for this memory range");
return true; return true;
} }
@ -100,35 +100,35 @@ void processName(const Pic::Config::Mask &cmask, BitValue pmask, Pic::Config::Va
TQStringList &cnames = cvalue.configNames[Pic::ConfigNameType::Default]; TQStringList &cnames = cvalue.configNames[Pic::ConfigNameType::Default];
if ( cvalue.name=="invalid" ) { if ( cvalue.name=="invalid" ) {
cvalue.name = TQString(); cvalue.name = TQString();
if ( !cnames.isEmpty() ) qFatal(TQString("No cname should be defined for invalid value in mask %1").arg(cmask.name)); if ( !cnames.isEmpty() ) tqFatal(TQString("No cname should be defined for invalid value in mask %1").arg(cmask.name));
return; return;
} }
if ( cvalue.name.isEmpty() ) qFatal(TQString("Empty value name in mask %1").arg(cmask.name)); if ( cvalue.name.isEmpty() ) tqFatal(TQString("Empty value name in mask %1").arg(cmask.name));
if ( cmask.value.isInside(pmask) ) { // protected bits if ( cmask.value.isInside(pmask) ) { // protected bits
if ( !cnames.isEmpty() ) qFatal(TQString("Config name should be null for protected config mask \"%1\"").arg(cmask.name)); if ( !cnames.isEmpty() ) tqFatal(TQString("Config name should be null for protected config mask \"%1\"").arg(cmask.name));
} else { } else {
if ( cnames.isEmpty() && cmask.name!="BSSEC" && cmask.name!="BSSIZ" && cmask.name!="SSSEC" && cmask.name!="SSSIZ" ) { if ( cnames.isEmpty() && cmask.name!="BSSEC" && cmask.name!="BSSIZ" && cmask.name!="SSSEC" && cmask.name!="SSSIZ" ) {
// ### FIXME: 18J 24H 30F1010/202X // ### FIXME: 18J 24H 30F1010/202X
if ( data()->architecture()!=Pic::Architecture::P18J && data()->architecture()!=Pic::Architecture::P24H if ( data()->architecture()!=Pic::Architecture::P18J && data()->architecture()!=Pic::Architecture::P24H
&& data()->architecture()!=Pic::Architecture::P24F && data()->architecture()!=Pic::Architecture::P33F && data()->architecture()!=Pic::Architecture::P24F && data()->architecture()!=Pic::Architecture::P33F
&& data()->name()!="30F1010" && data()->name()!="30F2020" && data()->name()!="30F2023" ) && data()->name()!="30F1010" && data()->name()!="30F2020" && data()->name()!="30F2023" )
qFatal(TQString("cname not defined for \"%1\" (%2)").arg(cvalue.name).arg(cmask.name)); tqFatal(TQString("cname not defined for \"%1\" (%2)").arg(cvalue.name).arg(cmask.name));
} }
if ( cnames.count()==1 && cnames[0]=="_" ) cnames.clear(); if ( cnames.count()==1 && cnames[0]=="_" ) cnames.clear();
for (uint i=0; i<uint(cnames.count()); i++) { for (uint i=0; i<uint(cnames.count()); i++) {
if ( cnames[i].startsWith("0x") ) { if ( cnames[i].startsWith("0x") ) {
if ( cnames.count()!=1 ) qFatal("Hex cname cannot be combined"); if ( cnames.count()!=1 ) tqFatal("Hex cname cannot be combined");
bool ok; bool ok;
BitValue v = fromHexLabel(cnames[i], &ok); BitValue v = fromHexLabel(cnames[i], &ok);
uint nbChars = data()->nbCharsWord(MemoryRangeType::Config); uint nbChars = data()->nbCharsWord(MemoryRangeType::Config);
BitValue mask = cmask.value.complementInMask(maxValue(NumberBase::Hex, nbChars)); BitValue mask = cmask.value.complementInMask(maxValue(NumberBase::Hex, nbChars));
if ( ok && v==(mask | cvalue.value) ) continue; if ( ok && v==(mask | cvalue.value) ) continue;
} else if ( XOR(cnames[i].startsWith("_"), data()->architecture()==Pic::Architecture::P30F) ) continue; } else if ( XOR(cnames[i].startsWith("_"), data()->architecture()==Pic::Architecture::P30F) ) continue;
qFatal(TQString("Invalid config name for \"%1\"/\"%2\"").arg(cmask.name).arg(cvalue.name)); tqFatal(TQString("Invalid config name for \"%1\"/\"%2\"").arg(cmask.name).arg(cvalue.name));
} }
TQStringList &ecnames = cvalue.configNames[Pic::ConfigNameType::Extra]; TQStringList &ecnames = cvalue.configNames[Pic::ConfigNameType::Extra];
for (uint i=0; i<uint(ecnames.count()); i++) for (uint i=0; i<uint(ecnames.count()); i++)
if ( ecnames[i][0]!='_' ) qFatal(TQString("Invalid extra config name for %1").arg(cvalue.name)); if ( ecnames[i][0]!='_' ) tqFatal(TQString("Invalid extra config name for %1").arg(cvalue.name));
} }
} }
@ -140,30 +140,30 @@ Pic::Config::Mask toConfigMask(TQDomElement mask, BitValue pmask)
TQMap<Pic::ConfigNameType, TQStringList> defConfigNames; TQMap<Pic::ConfigNameType, TQStringList> defConfigNames;
Config::Mask cmask; Config::Mask cmask;
cmask.name = mask.attribute("name"); cmask.name = mask.attribute("name");
if ( !Config::hasMaskName(cmask.name) ) qFatal(TQString("Unknown mask name %1").arg(cmask.name)); if ( !Config::hasMaskName(cmask.name) ) tqFatal(TQString("Unknown mask name %1").arg(cmask.name));
cmask.value = fromHexLabel(mask.attribute("value"), nbChars, &ok); cmask.value = fromHexLabel(mask.attribute("value"), nbChars, &ok);
if ( !ok || cmask.value==0 || cmask.value>data()->mask(MemoryRangeType::Config) ) if ( !ok || cmask.value==0 || cmask.value>data()->mask(MemoryRangeType::Config) )
qFatal(TQString("Malformed mask value in mask %1").arg(mask.attribute("name"))); tqFatal(TQString("Malformed mask value in mask %1").arg(mask.attribute("name")));
//TQStringList names; //TQStringList names;
TQDomNode child = mask.firstChild(); TQDomNode child = mask.firstChild();
while ( !child.isNull() ) { while ( !child.isNull() ) {
TQDomElement value = child.toElement(); TQDomElement value = child.toElement();
child = child.nextSibling(); child = child.nextSibling();
if ( value.isNull() ) continue; if ( value.isNull() ) continue;
if ( value.nodeName()!="value" ) qFatal(TQString("Non value child in mask %1").arg(cmask.name)); if ( value.nodeName()!="value" ) tqFatal(TQString("Non value child in mask %1").arg(cmask.name));
if ( value.attribute("value")=="default" ) { if ( value.attribute("value")=="default" ) {
if ( !defName.isEmpty() ) qFatal(TQString("Default value already defined for mask %1").arg(cmask.name)); if ( !defName.isEmpty() ) tqFatal(TQString("Default value already defined for mask %1").arg(cmask.name));
defName = value.attribute("name"); defName = value.attribute("name");
//if ( names.contains(defName) ) qFatal(TQString("Value name duplicated in mask %1").arg(cmask.name)); //if ( names.contains(defName) ) tqFatal(TQString("Value name duplicated in mask %1").arg(cmask.name));
//names.append(defName); //names.append(defName);
FOR_EACH(Pic::ConfigNameType, type) defConfigNames[type] = TQStringList::split(' ', value.attribute(type.data().key)); FOR_EACH(Pic::ConfigNameType, type) defConfigNames[type] = TQStringList::split(' ', value.attribute(type.data().key));
continue; continue;
} }
Config::Value cvalue; Config::Value cvalue;
cvalue.value = fromHexLabel(value.attribute("value"), nbChars, &ok); cvalue.value = fromHexLabel(value.attribute("value"), nbChars, &ok);
if ( !ok || !cvalue.value.isInside(cmask.value) ) qFatal(TQString("Malformed value in mask %1").arg(cmask.name)); if ( !ok || !cvalue.value.isInside(cmask.value) ) tqFatal(TQString("Malformed value in mask %1").arg(cmask.name));
cvalue.name = value.attribute("name"); cvalue.name = value.attribute("name");
//if ( names.contains(cvalue.name) ) qFatal(TQString("Value name duplicated in mask %1").arg(cmask.name)); //if ( names.contains(cvalue.name) ) tqFatal(TQString("Value name duplicated in mask %1").arg(cmask.name));
//names.append(cvalue.name); //names.append(cvalue.name);
FOR_EACH(Pic::ConfigNameType, type) cvalue.configNames[type] = TQStringList::split(' ', value.attribute(type.data().key)); FOR_EACH(Pic::ConfigNameType, type) cvalue.configNames[type] = TQStringList::split(' ', value.attribute(type.data().key));
processName(cmask, pmask, cvalue); processName(cmask, pmask, cvalue);
@ -183,7 +183,7 @@ Pic::Config::Mask toConfigMask(TQDomElement mask, BitValue pmask)
processName(cmask, pmask, cvalue); processName(cmask, pmask, cvalue);
cmask.values.append(cvalue); cmask.values.append(cvalue);
} }
if ( nb<=1 ) qFatal(TQString("Default value used less than twice in mask %1").arg(cmask.name)); if ( nb<=1 ) tqFatal(TQString("Default value used less than twice in mask %1").arg(cmask.name));
} }
qHeapSort(cmask.values); qHeapSort(cmask.values);
return cmask; return cmask;
@ -194,34 +194,34 @@ Pic::Config::Word toConfigWord(TQDomElement config)
uint nbChars = data()->nbCharsWord(MemoryRangeType::Config); uint nbChars = data()->nbCharsWord(MemoryRangeType::Config);
Config::Word cword; Config::Word cword;
cword.name = config.attribute("name"); cword.name = config.attribute("name");
if ( cword.name.isNull() ) qFatal("Config word name not specified."); if ( cword.name.isNull() ) tqFatal("Config word name not specified.");
bool ok; bool ok;
cword.wmask = fromHexLabel(config.attribute("wmask"), nbChars, &ok); cword.wmask = fromHexLabel(config.attribute("wmask"), nbChars, &ok);
BitValue gmask = data()->mask(MemoryRangeType::Config); BitValue gmask = data()->mask(MemoryRangeType::Config);
if ( !ok || cword.wmask>gmask ) qFatal(TQString("Missing or malformed config wmask \"%1\"").arg(config.attribute("wmask"))); if ( !ok || cword.wmask>gmask ) tqFatal(TQString("Missing or malformed config wmask \"%1\"").arg(config.attribute("wmask")));
cword.bvalue = fromHexLabel(config.attribute("bvalue"), nbChars, &ok); cword.bvalue = fromHexLabel(config.attribute("bvalue"), nbChars, &ok);
if ( !ok ) qFatal(TQString("Missing or malformed config bvalue \"%1\"").arg(config.attribute("bvalue"))); if ( !ok ) tqFatal(TQString("Missing or malformed config bvalue \"%1\"").arg(config.attribute("bvalue")));
if ( config.attribute("pmask").isEmpty() ) cword.pmask = 0; if ( config.attribute("pmask").isEmpty() ) cword.pmask = 0;
else { else {
bool ok; bool ok;
cword.pmask = fromHexLabel(config.attribute("pmask"), nbChars, &ok); cword.pmask = fromHexLabel(config.attribute("pmask"), nbChars, &ok);
if ( !ok || cword.pmask>gmask ) qFatal("Missing or malformed config pmask"); if ( !ok || cword.pmask>gmask ) tqFatal("Missing or malformed config pmask");
} }
cword.ignoredCNames = TQStringList::split(' ', config.attribute("icnames")); cword.ignoredCNames = TQStringList::split(' ', config.attribute("icnames"));
for (uint i=0; i<uint(cword.ignoredCNames.count()); i++) for (uint i=0; i<uint(cword.ignoredCNames.count()); i++)
if ( cword.ignoredCNames[i][0]!='_' ) qFatal(TQString("Invalid ignored config name for %1").arg(cword.name)); if ( cword.ignoredCNames[i][0]!='_' ) tqFatal(TQString("Invalid ignored config name for %1").arg(cword.name));
TQDomNode child = config.firstChild(); TQDomNode child = config.firstChild();
while ( !child.isNull() ) { while ( !child.isNull() ) {
TQDomElement mask = child.toElement(); TQDomElement mask = child.toElement();
child = child.nextSibling(); child = child.nextSibling();
if ( mask.isNull() ) continue; if ( mask.isNull() ) continue;
if ( mask.nodeName()!="mask" ) qFatal(TQString("Non mask child in config %1").arg(cword.name)); if ( mask.nodeName()!="mask" ) tqFatal(TQString("Non mask child in config %1").arg(cword.name));
if ( mask.attribute("name").isEmpty() ) qFatal(TQString("Empty mask name in config %1").arg(cword.name)); if ( mask.attribute("name").isEmpty() ) tqFatal(TQString("Empty mask name in config %1").arg(cword.name));
Config::Mask cmask = toConfigMask(mask, cword.pmask); Config::Mask cmask = toConfigMask(mask, cword.pmask);
if ( !cmask.value.isInside(gmask) ) qFatal(TQString("Mask value not inside mask in config %1").arg(cword.name)); if ( !cmask.value.isInside(gmask) ) tqFatal(TQString("Mask value not inside mask in config %1").arg(cword.name));
for (uint i=0; i<uint(cword.masks.count()); i++) { for (uint i=0; i<uint(cword.masks.count()); i++) {
if ( cword.masks[i].name==cmask.name ) qFatal(TQString("Duplicated mask name %1 in config %2").arg(cmask.name).arg(cword.name)); if ( cword.masks[i].name==cmask.name ) tqFatal(TQString("Duplicated mask name %1 in config %2").arg(cmask.name).arg(cword.name));
if ( cmask.value.isOverlapping(cword.masks[i].value) ) qFatal(TQString("Overlapping masks in config %1").arg(cword.name)); if ( cmask.value.isOverlapping(cword.masks[i].value) ) tqFatal(TQString("Overlapping masks in config %1").arg(cword.name));
} }
cword.masks.append(cmask); cword.masks.append(cmask);
} }
@ -233,11 +233,11 @@ Pic::Config::Word toConfigWord(TQDomElement config)
} else { } else {
bool ok; bool ok;
cword.cmask = fromHexLabel(config.attribute("cmask"), nbChars, &ok); cword.cmask = fromHexLabel(config.attribute("cmask"), nbChars, &ok);
if ( !ok || cword.cmask>gmask ) qFatal("Missing or malformed config cmask"); if ( !ok || cword.cmask>gmask ) tqFatal("Missing or malformed config cmask");
//if ( data()->_architecture==Pic::Architecture::P30X &&cword.cmask==cword.wmask ) qFatal(TQString("Redundant cmask in %1").arg(cword.name)); //if ( data()->_architecture==Pic::Architecture::P30X &&cword.cmask==cword.wmask ) tqFatal(TQString("Redundant cmask in %1").arg(cword.name));
if ( cword.cmask==mask ) qFatal(TQString("Redundant cmask in %1").arg(cword.name)); if ( cword.cmask==mask ) tqFatal(TQString("Redundant cmask in %1").arg(cword.name));
} }
if ( !cword.pmask.isInside(cword.usedMask()) ) qFatal("pmask should be inside or'ed mask values."); if ( !cword.pmask.isInside(cword.usedMask()) ) tqFatal("pmask should be inside or'ed mask values.");
return cword; return cword;
} }
@ -252,14 +252,14 @@ TQValueVector<Pic::Config::Word> getConfigWords(TQDomElement element)
if ( config.isNull() || config.nodeName()!="config" ) continue; if ( config.isNull() || config.nodeName()!="config" ) continue;
bool ok; bool ok;
uint offset = fromHexLabel(config.attribute("offset"), 1, &ok); uint offset = fromHexLabel(config.attribute("offset"), 1, &ok);
if ( !ok ) qFatal("Missing or malformed config offset"); if ( !ok ) tqFatal("Missing or malformed config offset");
if ( (offset % data()->addressIncrement(MemoryRangeType::Config))!=0 ) qFatal("Config offset not aligned"); if ( (offset % data()->addressIncrement(MemoryRangeType::Config))!=0 ) tqFatal("Config offset not aligned");
offset /= data()->addressIncrement(MemoryRangeType::Config); offset /= data()->addressIncrement(MemoryRangeType::Config);
if ( offset>=nbWords ) qFatal(TQString("Offset too big %1/%2").arg(offset).arg(nbWords)); if ( offset>=nbWords ) tqFatal(TQString("Offset too big %1/%2").arg(offset).arg(nbWords));
if ( !configWords[offset].name.isNull() ) qFatal(TQString("Config offset %1 is duplicated").arg(offset)); if ( !configWords[offset].name.isNull() ) tqFatal(TQString("Config offset %1 is duplicated").arg(offset));
for (uint i=0; i<nbWords; i++) { for (uint i=0; i<nbWords; i++) {
if ( !configWords[i].name.isNull() && configWords[i].name==config.attribute("name") ) if ( !configWords[i].name.isNull() && configWords[i].name==config.attribute("name") )
qFatal(TQString("Duplicated config name %1").arg(configWords[i].name)); tqFatal(TQString("Duplicated config name %1").arg(configWords[i].name));
} }
configWords[offset] = toConfigWord(config); configWords[offset] = toConfigWord(config);
} }
@ -279,40 +279,40 @@ TQString getChecksumData(TQDomElement checksum)
bool ok; bool ok;
uint nb = valueName.toUInt(&ok); uint nb = valueName.toUInt(&ok);
uint max = (protection.hasBootBlock() ? 1 : 0) + protection.nbBlocks(); uint max = (protection.hasBootBlock() ? 1 : 0) + protection.nbBlocks();
if ( !ok || nb>max ) qFatal("Invalid number of protected blocks for checksum"); if ( !ok || nb>max ) tqFatal("Invalid number of protected blocks for checksum");
if ( nb>0 ) cdata.protectedMaskNames += "CPB"; if ( nb>0 ) cdata.protectedMaskNames += "CPB";
for (uint i=1; i<nb; i++) cdata.protectedMaskNames += "CP_" + TQString::number(i-1); for (uint i=1; i<nb; i++) cdata.protectedMaskNames += "CP_" + TQString::number(i-1);
cdata.bbsize = checksum.attribute("bbsize"); cdata.bbsize = checksum.attribute("bbsize");
const Config::Mask *mask = data()->_config->findMask(protection.bootSizeMaskName()); const Config::Mask *mask = data()->_config->findMask(protection.bootSizeMaskName());
if ( mask==0 ) { if ( mask==0 ) {
if ( !cdata.bbsize.isEmpty() ) qFatal("Device does not have a variable boot size (no \"bbsize\" allowed in checksum)"); if ( !cdata.bbsize.isEmpty() ) tqFatal("Device does not have a variable boot size (no \"bbsize\" allowed in checksum)");
} else if ( cdata.bbsize.isEmpty() ) { } else if ( cdata.bbsize.isEmpty() ) {
if ( nb==1 ) qFatal("\"bbsize\" should be define in checksum for \"protected_blocks\"==1"); if ( nb==1 ) tqFatal("\"bbsize\" should be define in checksum for \"protected_blocks\"==1");
} else { } else {
const Config::Value *value = data()->_config->findValue(protection.bootSizeMaskName(), cdata.bbsize); const Config::Value *value = data()->_config->findValue(protection.bootSizeMaskName(), cdata.bbsize);
if ( value==0 ) qFatal("Invalid \"bbsize\" in checksum"); if ( value==0 ) tqFatal("Invalid \"bbsize\" in checksum");
valueName += "_" + cdata.bbsize; valueName += "_" + cdata.bbsize;
} }
} else { } else {
valueName = checksum.attribute("protected"); valueName = checksum.attribute("protected");
if ( protection.family()==Protection::NoProtection && !valueName.isEmpty() ) if ( protection.family()==Protection::NoProtection && !valueName.isEmpty() )
qFatal("Checksum protected attribute for device with no code protection"); tqFatal("Checksum protected attribute for device with no code protection");
} }
if ( data()->_checksums.contains(valueName) ) qFatal("Duplicate checksum protected range"); if ( data()->_checksums.contains(valueName) ) tqFatal("Duplicate checksum protected range");
TQString s = checksum.attribute("constant"); TQString s = checksum.attribute("constant");
if ( s.isEmpty() ) cdata.constant = 0x0000; if ( s.isEmpty() ) cdata.constant = 0x0000;
else { else {
bool ok; bool ok;
cdata.constant = fromHexLabel(s, 4, &ok); cdata.constant = fromHexLabel(s, 4, &ok);
if ( !ok ) qFatal("Malformed checksum constant"); if ( !ok ) tqFatal("Malformed checksum constant");
} }
s = checksum.attribute("type"); s = checksum.attribute("type");
if ( s.isEmpty() ) cdata.algorithm = Checksum::Algorithm::Normal; if ( s.isEmpty() ) cdata.algorithm = Checksum::Algorithm::Normal;
else { else {
cdata.algorithm = Checksum::Algorithm::fromKey(s); cdata.algorithm = Checksum::Algorithm::fromKey(s);
if ( cdata.algorithm==Checksum::Algorithm::Nb_Types ) qFatal("Unrecognized checksum algorithm"); if ( cdata.algorithm==Checksum::Algorithm::Nb_Types ) tqFatal("Unrecognized checksum algorithm");
} }
s = checksum.attribute("mprotected"); s = checksum.attribute("mprotected");
@ -320,32 +320,32 @@ TQString getChecksumData(TQDomElement checksum)
TQStringList list = TQStringList::split(" ", s); TQStringList list = TQStringList::split(" ", s);
for (uint i=0; i<uint(list.count()); i++) { for (uint i=0; i<uint(list.count()); i++) {
const Config::Mask *mask = data()->config().findMask(list[i]); const Config::Mask *mask = data()->config().findMask(list[i]);
if ( mask==0 ) qFatal(TQString("Not valid mask name for \"protected\" tag in checksum: %1").arg(list[i])); if ( mask==0 ) tqFatal(TQString("Not valid mask name for \"protected\" tag in checksum: %1").arg(list[i]));
if ( mask->values.count()==2 ) continue; if ( mask->values.count()==2 ) continue;
for (uint k=0; k<uint(mask->values.count()); k++) { for (uint k=0; k<uint(mask->values.count()); k++) {
TQString valueName = mask->values[k].name; TQString valueName = mask->values[k].name;
if ( valueName.isEmpty() ) continue; if ( valueName.isEmpty() ) continue;
if ( !protection.isNoneProtectedValueName(valueName) && !protection.isAllProtectedValueName(valueName) ) if ( !protection.isNoneProtectedValueName(valueName) && !protection.isAllProtectedValueName(valueName) )
qFatal(TQString("Not switch protection from mask name for \"protected\" tag in checksum: %1").arg(list[i])); tqFatal(TQString("Not switch protection from mask name for \"protected\" tag in checksum: %1").arg(list[i]));
} }
} }
cdata.protectedMaskNames = list; cdata.protectedMaskNames = list;
} }
s = checksum.attribute("bchecksum"); s = checksum.attribute("bchecksum");
if ( s.isEmpty() ) qFatal("No blank checksum"); if ( s.isEmpty() ) tqFatal("No blank checksum");
else { else {
bool ok; bool ok;
cdata.blankChecksum = fromHexLabel(s, 4, &ok); cdata.blankChecksum = fromHexLabel(s, 4, &ok);
if ( !ok ) qFatal("Malformed blank checksum"); if ( !ok ) tqFatal("Malformed blank checksum");
} }
s = checksum.attribute("cchecksum"); s = checksum.attribute("cchecksum");
if ( s.isEmpty() ) qFatal("No check checksum"); if ( s.isEmpty() ) tqFatal("No check checksum");
else { else {
bool ok; bool ok;
cdata.checkChecksum = fromHexLabel(s, 4, &ok); cdata.checkChecksum = fromHexLabel(s, 4, &ok);
if ( !ok ) qFatal("Malformed check checksum"); if ( !ok ) tqFatal("Malformed check checksum");
} }
data()->_checksums[valueName] = cdata; data()->_checksums[valueName] = cdata;
@ -358,24 +358,24 @@ virtual void processDevice(TQDomElement device)
TQString arch = device.attribute("architecture"); TQString arch = device.attribute("architecture");
data()->_architecture = Architecture::fromKey(arch); data()->_architecture = Architecture::fromKey(arch);
if ( data()->_architecture==Architecture::Nb_Types ) qFatal(TQString("Unrecognized architecture \"%1\"").arg(arch)); if ( data()->_architecture==Architecture::Nb_Types ) tqFatal(TQString("Unrecognized architecture \"%1\"").arg(arch));
if ( (data()->_architecture==Architecture::P18F && data()->_name.contains("C")) if ( (data()->_architecture==Architecture::P18F && data()->_name.contains("C"))
|| (data()->_architecture==Architecture::P18F && data()->_name.contains("J")) ) qFatal("Not matching family"); || (data()->_architecture==Architecture::P18F && data()->_name.contains("J")) ) tqFatal("Not matching family");
bool ok; bool ok;
TQString pc = device.attribute("pc"); TQString pc = device.attribute("pc");
data()->_nbBitsPC = data()->_architecture.data().nbBitsPC; data()->_nbBitsPC = data()->_architecture.data().nbBitsPC;
if ( data()->_nbBitsPC==0 ) { if ( data()->_nbBitsPC==0 ) {
data()->_nbBitsPC = pc.toUInt(&ok); data()->_nbBitsPC = pc.toUInt(&ok);
if ( !ok || data()->_nbBitsPC==0 ) qFatal("Malformed or missing PC"); if ( !ok || data()->_nbBitsPC==0 ) tqFatal("Malformed or missing PC");
} else if ( !pc.isEmpty() ) qFatal("No PC should be provided for this device architecture"); } else if ( !pc.isEmpty() ) tqFatal("No PC should be provided for this device architecture");
TQString sw = device.attribute("self_write"); TQString sw = device.attribute("self_write");
data()->_selfWrite = (data()->_memoryTechnology!=Device::MemoryTechnology::Flash ? SelfWrite::No : data()->_architecture.data().selfWrite); data()->_selfWrite = (data()->_memoryTechnology!=Device::MemoryTechnology::Flash ? SelfWrite::No : data()->_architecture.data().selfWrite);
if ( data()->_selfWrite==SelfWrite::Nb_Types ) { if ( data()->_selfWrite==SelfWrite::Nb_Types ) {
data()->_selfWrite = SelfWrite::fromKey(sw); data()->_selfWrite = SelfWrite::fromKey(sw);
if ( data()->_selfWrite==SelfWrite::Nb_Types ) qFatal("Malformed or missing self-write field"); if ( data()->_selfWrite==SelfWrite::Nb_Types ) tqFatal("Malformed or missing self-write field");
} else if ( !sw.isEmpty() ) qFatal("Self-write is set for the whole family or non-flash device"); } else if ( !sw.isEmpty() ) tqFatal("Self-write is set for the whole family or non-flash device");
// device ids // device ids
FOR_EACH(Device::Special, special) { FOR_EACH(Device::Special, special) {
@ -385,7 +385,7 @@ virtual void processDevice(TQDomElement device)
if ( special==Device::Special::Normal ) data()->_ids[special] = 0x0000; if ( special==Device::Special::Normal ) data()->_ids[special] = 0x0000;
} else { } else {
data()->_ids[special] = fromHexLabel(id, 4, &ok); data()->_ids[special] = fromHexLabel(id, 4, &ok);
if ( !ok ) qFatal("Malformed id"); if ( !ok ) tqFatal("Malformed id");
} }
} }
@ -396,16 +396,16 @@ virtual void processDevice(TQDomElement device)
if ( !getVoltages(vtype, device) ) { if ( !getVoltages(vtype, device) ) {
switch (vtype.type()) { switch (vtype.type()) {
case ProgVoltageType::Vpp: case ProgVoltageType::Vpp:
case ProgVoltageType::VddBulkErase: qFatal(TQString("Voltage \"%1\" not defined").arg(vtype.key())); case ProgVoltageType::VddBulkErase: tqFatal(TQString("Voltage \"%1\" not defined").arg(vtype.key()));
case ProgVoltageType::VddWrite: data()->_voltages[ProgVoltageType::VddWrite] = data()->_voltages[ProgVoltageType::VddBulkErase]; break; case ProgVoltageType::VddWrite: data()->_voltages[ProgVoltageType::VddWrite] = data()->_voltages[ProgVoltageType::VddBulkErase]; break;
case ProgVoltageType::Nb_Types: Q_ASSERT(false); break; case ProgVoltageType::Nb_Types: Q_ASSERT(false); break;
} }
} }
} }
//if ( data()->vddMin()>data()->_voltages[ProgVoltageType::VddWrite].min ) qFatal("Vdd min higher than VddWrite min"); //if ( data()->vddMin()>data()->_voltages[ProgVoltageType::VddWrite].min ) tqFatal("Vdd min higher than VddWrite min");
//if ( data()->vddMax()<data()->_voltages[ProgVoltageType::VddWrite].max ) qFatal("Vdd max lower than VddWrite max"); //if ( data()->vddMax()<data()->_voltages[ProgVoltageType::VddWrite].max ) tqFatal("Vdd max lower than VddWrite max");
if ( data()->_voltages[ProgVoltageType::VddWrite].min>data()->_voltages[ProgVoltageType::VddBulkErase].min ) qFatal("VddWrite min higher than VddBulkErase min"); if ( data()->_voltages[ProgVoltageType::VddWrite].min>data()->_voltages[ProgVoltageType::VddBulkErase].min ) tqFatal("VddWrite min higher than VddBulkErase min");
if ( data()->_voltages[ProgVoltageType::VddWrite].max<data()->_voltages[ProgVoltageType::VddBulkErase].max ) qFatal("VddWrite max lower than VddBulkErase max"); if ( data()->_voltages[ProgVoltageType::VddWrite].max<data()->_voltages[ProgVoltageType::VddBulkErase].max ) tqFatal("VddWrite max lower than VddBulkErase max");
checkTagNames(device, "voltages", names); checkTagNames(device, "voltages", names);
// memory ranges // memory ranges
@ -426,12 +426,12 @@ virtual void processDevice(TQDomElement device)
Address start2 = data()->_ranges[i].start + data()->_ranges[i].hexFileOffset; Address start2 = data()->_ranges[i].start + data()->_ranges[i].hexFileOffset;
Address end2 = data()->_ranges[i].end + data()->_ranges[i].hexFileOffset; Address end2 = data()->_ranges[i].end + data()->_ranges[i].hexFileOffset;
if ( end1>=start2 && start1<=end2 ) if ( end1>=start2 && start1<=end2 )
qFatal(TQString("Overlapping memory ranges (%1 and %2)").arg(k.key()).arg(i.key())); tqFatal(TQString("Overlapping memory ranges (%1 and %2)").arg(k.key()).arg(i.key()));
} }
} }
checkTagNames(device, "memory", names); checkTagNames(device, "memory", names);
if ( XOR(data()->_ids[Device::Special::Normal]!=0x0000, (data()->_ranges[MemoryRangeType::DeviceId].properties & Present)) ) if ( XOR(data()->_ids[Device::Special::Normal]!=0x0000, (data()->_ranges[MemoryRangeType::DeviceId].properties & Present)) )
qFatal("Id present and device id memory range absent or the opposite"); tqFatal("Id present and device id memory range absent or the opposite");
// config words // config words
TQValueVector<Config::Word> cwords = getConfigWords(device); TQValueVector<Config::Word> cwords = getConfigWords(device);
@ -440,7 +440,7 @@ virtual void processDevice(TQDomElement device)
FOR_EACH(Pic::ConfigNameType, type) { FOR_EACH(Pic::ConfigNameType, type) {
TQMap<TQString, TQString> cnames; // cname -> mask name TQMap<TQString, TQString> cnames; // cname -> mask name
for (uint i=0; i<nbWords; i++) { for (uint i=0; i<nbWords; i++) {
if ( cwords[i].name.isNull() ) qFatal(TQString("Config word #%1 not defined").arg(i)); if ( cwords[i].name.isNull() ) tqFatal(TQString("Config word #%1 not defined").arg(i));
data()->_config->_words[i] = cwords[i]; data()->_config->_words[i] = cwords[i];
const Config::Word &word = data()->_config->_words[i]; const Config::Word &word = data()->_config->_words[i];
for (uint j=0; j<uint(word.masks.count()); j++) { for (uint j=0; j<uint(word.masks.count()); j++) {
@ -450,7 +450,7 @@ virtual void processDevice(TQDomElement device)
for (uint l=0; l<uint(vcnames.count()); l++) { for (uint l=0; l<uint(vcnames.count()); l++) {
if ( vcnames[l].startsWith("0x") ) continue; if ( vcnames[l].startsWith("0x") ) continue;
if ( cnames.contains(vcnames[l]) && cnames[vcnames[l]]!=mask.name ) if ( cnames.contains(vcnames[l]) && cnames[vcnames[l]]!=mask.name )
qFatal(TQString("Duplicated config name for %1/%2").arg(mask.name).arg(mask.values[k].name)); tqFatal(TQString("Duplicated config name for %1/%2").arg(mask.name).arg(mask.values[k].name));
cnames[vcnames[l]] = word.masks[j].name; cnames[vcnames[l]] = word.masks[j].name;
} }
} }
@ -466,7 +466,7 @@ virtual void processDevice(TQDomElement device)
const Config::Value &value = mask.values[k]; const Config::Value &value = mask.values[k];
if ( !value.isValid() ) continue; if ( !value.isValid() ) continue;
if ( !data()->_config->checkValueName(mask.name, value.name) ) if ( !data()->_config->checkValueName(mask.name, value.name) )
qFatal(TQString("Malformed value name \"%1\" in mask %2").arg(value.name).arg(mask.name)); tqFatal(TQString("Malformed value name \"%1\" in mask %2").arg(value.name).arg(mask.name));
} }
} }
} }
@ -477,14 +477,14 @@ virtual void processDevice(TQDomElement device)
const Config::Mask &mask = word.masks[j]; const Config::Mask &mask = word.masks[j];
BitValue::const_iterator it; BitValue::const_iterator it;
for (it=mask.value.begin(); it!=mask.value.end(); ++it) for (it=mask.value.begin(); it!=mask.value.end(); ++it)
if ( !hasValue(mask, *it) ) qFatal(TQString("Value %1 not defined in mask %2").arg(toHexLabel(*it, data()->nbCharsWord(MemoryRangeType::Config))).arg(mask.name)); if ( !hasValue(mask, *it) ) tqFatal(TQString("Value %1 not defined in mask %2").arg(toHexLabel(*it, data()->nbCharsWord(MemoryRangeType::Config))).arg(mask.name));
} }
} }
// checksums (after config bits!) // checksums (after config bits!)
TQDomElement checksums = findUniqueElement(device, "checksums", TQString(), TQString()); TQDomElement checksums = findUniqueElement(device, "checksums", TQString(), TQString());
if ( checksums.isNull() ) { if ( checksums.isNull() ) {
// qFatal("No checksum defined"); // #### FIXME // tqFatal("No checksum defined"); // #### FIXME
} else { } else {
TQMap<TQString, bool> valueNames; TQMap<TQString, bool> valueNames;
const Pic::Protection &protection = data()->_config->protection(); const Pic::Protection &protection = data()->_config->protection();
@ -497,17 +497,17 @@ virtual void processDevice(TQDomElement device)
TQDomNode child = checksums.firstChild(); TQDomNode child = checksums.firstChild();
while ( !child.isNull() ) { while ( !child.isNull() ) {
if ( !child.isElement() ) continue; if ( !child.isElement() ) continue;
if ( child.nodeName()!="checksum" ) qFatal("Childs of \"checksums\" should \"checksum\""); if ( child.nodeName()!="checksum" ) tqFatal("Childs of \"checksums\" should \"checksum\"");
TQString valueName = getChecksumData(child.toElement()); TQString valueName = getChecksumData(child.toElement());
if ( protection.family()==Protection::BasicProtection ) { if ( protection.family()==Protection::BasicProtection ) {
if ( !valueNames.contains(valueName) ) qFatal("Unknown protected attribute"); if ( !valueNames.contains(valueName) ) tqFatal("Unknown protected attribute");
valueNames[valueName] = true; valueNames[valueName] = true;
} }
child = child.nextSibling(); child = child.nextSibling();
} }
TQMap<TQString, bool>::const_iterator it; TQMap<TQString, bool>::const_iterator it;
for (it=valueNames.begin(); it!=valueNames.end(); ++it) for (it=valueNames.begin(); it!=valueNames.end(); ++it)
if ( !it.key().isEmpty() && !it.data() ) qFatal(TQString("Missing checksum \"%1\"").arg(it.key())); if ( !it.key().isEmpty() && !it.data() ) tqFatal(TQString("Missing checksum \"%1\"").arg(it.key()));
} }
} }
@ -516,16 +516,16 @@ void processMirrored(TQDomElement element)
TQValueVector<RangeData> mirrored; TQValueVector<RangeData> mirrored;
TQDomNode child = element.firstChild(); TQDomNode child = element.firstChild();
while ( !child.isNull() ) { while ( !child.isNull() ) {
if ( !child.isElement() ) qFatal("\"mirror\" child should be an element"); if ( !child.isElement() ) tqFatal("\"mirror\" child should be an element");
TQDomElement e = child.toElement(); TQDomElement e = child.toElement();
if ( e.nodeName()!="range" ) qFatal("\"mirror\" child should be \"range\""); if ( e.nodeName()!="range" ) tqFatal("\"mirror\" child should be \"range\"");
RangeData rd; RangeData rd;
bool ok; bool ok;
rd.start = fromHexLabel(e.attribute("start"), &ok); rd.start = fromHexLabel(e.attribute("start"), &ok);
Address end = fromHexLabel(e.attribute("end"), &ok); Address end = fromHexLabel(e.attribute("end"), &ok);
rd.length = end-rd.start+1; rd.length = end-rd.start+1;
if ( !mirrored.isEmpty() && rd.length!=mirrored[0].length ) if ( !mirrored.isEmpty() && rd.length!=mirrored[0].length )
qFatal("Mirrored are not of the same length"); tqFatal("Mirrored are not of the same length");
mirrored.append(rd); mirrored.append(rd);
child = child.nextSibling(); child = child.nextSibling();
} }
@ -537,43 +537,43 @@ void processUnused(TQDomElement e)
RangeData rd; RangeData rd;
bool ok; bool ok;
rd.start = fromHexLabel(e.attribute("start"), &ok); rd.start = fromHexLabel(e.attribute("start"), &ok);
if (!ok) qFatal("Malformed start for unused register"); if (!ok) tqFatal("Malformed start for unused register");
Address end = fromHexLabel(e.attribute("end"), &ok); Address end = fromHexLabel(e.attribute("end"), &ok);
rd.length = end-rd.start+1; rd.length = end-rd.start+1;
if (!ok) qFatal("Malformed end for unused register"); if (!ok) tqFatal("Malformed end for unused register");
static_cast<RegistersData *>(data()->_registersData)->unused.append(rd); static_cast<RegistersData *>(data()->_registersData)->unused.append(rd);
} }
void processSfr(TQDomElement e) void processSfr(TQDomElement e)
{ {
TQString name = e.attribute("name"); TQString name = e.attribute("name");
if ( name.isEmpty() ) qFatal("SFR cannot have empty name"); if ( name.isEmpty() ) tqFatal("SFR cannot have empty name");
if ( data()->registersData().sfrs.contains(name) || data()->registersData().combined.contains(name) ) if ( data()->registersData().sfrs.contains(name) || data()->registersData().combined.contains(name) )
qFatal("SFR name is duplicated"); tqFatal("SFR name is duplicated");
bool ok; bool ok;
uint address = fromHexLabel(e.attribute("address"), &ok); uint address = fromHexLabel(e.attribute("address"), &ok);
if ( !ok ) qFatal(TQString("SFR %1 address %2 is malformed").arg(name).arg(e.attribute("address"))); if ( !ok ) tqFatal(TQString("SFR %1 address %2 is malformed").arg(name).arg(e.attribute("address")));
uint rlength = data()->registersData().nbBanks * data()->architecture().data().registerBankLength; uint rlength = data()->registersData().nbBanks * data()->architecture().data().registerBankLength;
if ( address>=rlength ) qFatal(TQString("Address %1 outside register range").arg(toHexLabel(address, 3))); if ( address>=rlength ) tqFatal(TQString("Address %1 outside register range").arg(toHexLabel(address, 3)));
RegisterData rdata; RegisterData rdata;
rdata.address = address; rdata.address = address;
uint nb = data()->registersData().nbBits(); uint nb = data()->registersData().nbBits();
if ( nb>Device::MAX_NB_PORT_BITS ) qFatal(TQString("Need higher MAX_NB_PORT_BITS: %1").arg(nb)); if ( nb>Device::MAX_NB_PORT_BITS ) tqFatal(TQString("Need higher MAX_NB_PORT_BITS: %1").arg(nb));
TQString access = e.attribute("access"); TQString access = e.attribute("access");
if ( uint(access.length())!=nb ) qFatal("access is missing or malformed"); if ( uint(access.length())!=nb ) tqFatal("access is missing or malformed");
TQString mclr = e.attribute("mclr"); TQString mclr = e.attribute("mclr");
if ( uint(mclr.length())!=nb ) qFatal("mclr is missing or malformed"); if ( uint(mclr.length())!=nb ) tqFatal("mclr is missing or malformed");
TQString por = e.attribute("por"); TQString por = e.attribute("por");
if ( uint(por.length())!=nb ) qFatal("por is missing or malformed"); if ( uint(por.length())!=nb ) tqFatal("por is missing or malformed");
for (uint i=0; i<nb; i++) { for (uint i=0; i<nb; i++) {
uint k = nb - i - 1; uint k = nb - i - 1;
bool ok; bool ok;
rdata.bits[k].properties = RegisterBitProperties(fromHex(access[i].latin1(), &ok)); rdata.bits[k].properties = RegisterBitProperties(fromHex(access[i].latin1(), &ok));
if ( !ok || rdata.bits[k].properties>MaxRegisterBitProperty ) qFatal(TQString("Malformed access bit %1").arg(k)); if ( !ok || rdata.bits[k].properties>MaxRegisterBitProperty ) tqFatal(TQString("Malformed access bit %1").arg(k));
rdata.bits[k].mclr = RegisterBitState(fromHex(mclr[i].latin1(), &ok)); rdata.bits[k].mclr = RegisterBitState(fromHex(mclr[i].latin1(), &ok));
if ( !ok || rdata.bits[k].mclr>Nb_RegisterBitStates ) qFatal(TQString("Malformed mclr bit %1").arg(k)); if ( !ok || rdata.bits[k].mclr>Nb_RegisterBitStates ) tqFatal(TQString("Malformed mclr bit %1").arg(k));
rdata.bits[k].por = RegisterBitState(fromHex(por[i].latin1(), &ok)); rdata.bits[k].por = RegisterBitState(fromHex(por[i].latin1(), &ok));
if ( !ok || rdata.bits[k].por>Nb_RegisterBitStates ) qFatal(TQString("Malformed por bit %1").arg(k)); if ( !ok || rdata.bits[k].por>Nb_RegisterBitStates ) tqFatal(TQString("Malformed por bit %1").arg(k));
} }
static_cast<RegistersData *>(data()->_registersData)->sfrs[name] = rdata; static_cast<RegistersData *>(data()->_registersData)->sfrs[name] = rdata;
} }
@ -581,19 +581,19 @@ void processSfr(TQDomElement e)
void processCombined(TQDomElement e) void processCombined(TQDomElement e)
{ {
TQString name = e.attribute("name"); TQString name = e.attribute("name");
if ( name.isEmpty() ) qFatal("Combined register cannot have empty name"); if ( name.isEmpty() ) tqFatal("Combined register cannot have empty name");
if ( data()->registersData().sfrs.contains(name) || data()->registersData().combined.contains(name) ) if ( data()->registersData().sfrs.contains(name) || data()->registersData().combined.contains(name) )
qFatal("Combined register name is duplicated"); tqFatal("Combined register name is duplicated");
bool ok; bool ok;
CombinedData rdata; CombinedData rdata;
rdata.address = fromHexLabel(e.attribute("address"), &ok); rdata.address = fromHexLabel(e.attribute("address"), &ok);
if ( !ok ) qFatal(TQString("Combined %1 address %2 is malformed").arg(name).arg(e.attribute("address"))); if ( !ok ) tqFatal(TQString("Combined %1 address %2 is malformed").arg(name).arg(e.attribute("address")));
uint rlength = data()->registersData().nbBanks * data()->architecture().data().registerBankLength; uint rlength = data()->registersData().nbBanks * data()->architecture().data().registerBankLength;
if ( rdata.address>=rlength ) qFatal(TQString("Address %1 outside register range").arg(toHexLabel(rdata.address, 3))); if ( rdata.address>=rlength ) tqFatal(TQString("Address %1 outside register range").arg(toHexLabel(rdata.address, 3)));
rdata.nbChars = 2*e.attribute("size").toUInt(&ok); rdata.nbChars = 2*e.attribute("size").toUInt(&ok);
if ( !ok || rdata.nbChars<2 ) qFatal(TQString("Combined %1 size %2 is malformed").arg(name).arg(e.attribute("size"))); if ( !ok || rdata.nbChars<2 ) tqFatal(TQString("Combined %1 size %2 is malformed").arg(name).arg(e.attribute("size")));
Address end = rdata.address + rdata.nbChars/2 - 1; Address end = rdata.address + rdata.nbChars/2 - 1;
if ( end>=rlength ) qFatal(TQString("Address %1 outside register range").arg(toHexLabel(end, 3))); if ( end>=rlength ) tqFatal(TQString("Address %1 outside register range").arg(toHexLabel(end, 3)));
static_cast<RegistersData *>(data()->_registersData)->combined[name] = rdata; static_cast<RegistersData *>(data()->_registersData)->combined[name] = rdata;
} }
@ -601,7 +601,7 @@ void processDeviceRegisters(TQDomElement element)
{ {
TQString s = element.attribute("same_as"); TQString s = element.attribute("same_as");
if ( !s.isEmpty() ) { if ( !s.isEmpty() ) {
if ( !_map.contains(s) ) qFatal(TQString("Registers same as unknown device %1").arg(s)); if ( !_map.contains(s) ) tqFatal(TQString("Registers same as unknown device %1").arg(s));
const Pic::Data *d = static_cast<const Pic::Data *>(_map[s]); const Pic::Data *d = static_cast<const Pic::Data *>(_map[s]);
data()->_registersData = d->_registersData; data()->_registersData = d->_registersData;
return; return;
@ -610,12 +610,12 @@ void processDeviceRegisters(TQDomElement element)
RegistersData &rdata = *static_cast<RegistersData *>(data()->_registersData); RegistersData &rdata = *static_cast<RegistersData *>(data()->_registersData);
bool ok; bool ok;
rdata.nbBanks = element.attribute("nb_banks").toUInt(&ok); rdata.nbBanks = element.attribute("nb_banks").toUInt(&ok);
if ( !ok || data()->registersData().nbBanks==0 ) qFatal("Malformed number of banks"); if ( !ok || data()->registersData().nbBanks==0 ) tqFatal("Malformed number of banks");
if ( data()->is18Family() ) { if ( data()->is18Family() ) {
rdata.accessBankSplit = fromHexLabel(element.attribute("access_bank_split_offset"), &ok); rdata.accessBankSplit = fromHexLabel(element.attribute("access_bank_split_offset"), &ok);
if ( !ok || rdata.accessBankSplit==0 || rdata.accessBankSplit>=0xFF ) qFatal("Malformed access bank split offset"); if ( !ok || rdata.accessBankSplit==0 || rdata.accessBankSplit>=0xFF ) tqFatal("Malformed access bank split offset");
rdata.unusedBankMask = fromHexLabel(element.attribute("unused_bank_mask"), &ok); rdata.unusedBankMask = fromHexLabel(element.attribute("unused_bank_mask"), &ok);
if ( !ok || rdata.unusedBankMask>=maxValue(NumberBase::Hex, rdata.nbBanks) ) qFatal("Malformed access unused bank mask"); if ( !ok || rdata.unusedBankMask>=maxValue(NumberBase::Hex, rdata.nbBanks) ) tqFatal("Malformed access unused bank mask");
} else { } else {
rdata.accessBankSplit = 0; rdata.accessBankSplit = 0;
rdata.unusedBankMask = 0; rdata.unusedBankMask = 0;
@ -623,13 +623,13 @@ void processDeviceRegisters(TQDomElement element)
TQDomNode child = element.firstChild(); TQDomNode child = element.firstChild();
while ( !child.isNull() ) { while ( !child.isNull() ) {
if ( !child.isElement() ) qFatal("\"device\" child should be an element"); if ( !child.isElement() ) tqFatal("\"device\" child should be an element");
TQDomElement e = child.toElement(); TQDomElement e = child.toElement();
if ( e.nodeName()=="mirror" ) processMirrored(e); if ( e.nodeName()=="mirror" ) processMirrored(e);
else if ( e.nodeName()=="unused" ) processUnused(e); else if ( e.nodeName()=="unused" ) processUnused(e);
else if ( e.nodeName()=="combined" ) processCombined(e); else if ( e.nodeName()=="combined" ) processCombined(e);
else if ( e.nodeName()=="sfr" ) processSfr(e); else if ( e.nodeName()=="sfr" ) processSfr(e);
else qFatal(TQString("Node name \"%1\" is not recognized").arg(e.nodeName())); else tqFatal(TQString("Node name \"%1\" is not recognized").arg(e.nodeName()));
child = child.nextSibling(); child = child.nextSibling();
} }
@ -640,11 +640,11 @@ void processDeviceRegisters(TQDomElement element)
TQString trisname = rdata.trisName(i); TQString trisname = rdata.trisName(i);
if ( trisname.isEmpty() ) continue; if ( trisname.isEmpty() ) continue;
bool hasTris = rdata.sfrs.contains(trisname); bool hasTris = rdata.sfrs.contains(trisname);
if ( !hasPort && hasTris ) qFatal(TQString("%1 needs %2 to be present").arg(trisname).arg(portname)); if ( !hasPort && hasTris ) tqFatal(TQString("%1 needs %2 to be present").arg(trisname).arg(portname));
TQString latchname = rdata.latchName(i); TQString latchname = rdata.latchName(i);
if ( latchname.isEmpty() ) continue; if ( latchname.isEmpty() ) continue;
bool hasLatch = rdata.sfrs.contains(latchname); bool hasLatch = rdata.sfrs.contains(latchname);
if ( !hasPort && hasLatch ) qFatal(TQString("%1 needs %2 to be present").arg(latchname).arg(portname)); if ( !hasPort && hasLatch ) tqFatal(TQString("%1 needs %2 to be present").arg(latchname).arg(portname));
} }
} }
@ -652,15 +652,15 @@ void processRegistersFile(const TQString &filename, TQStringList &devices)
{ {
TQDomDocument doc = parseFile(filename); TQDomDocument doc = parseFile(filename);
TQDomElement root = doc.documentElement(); TQDomElement root = doc.documentElement();
if ( root.nodeName()!="registers" ) qFatal("root node should be \"registers\""); if ( root.nodeName()!="registers" ) tqFatal("root node should be \"registers\"");
for (TQDomNode child=root.firstChild(); !child.isNull(); child = child.nextSibling()) { for (TQDomNode child=root.firstChild(); !child.isNull(); child = child.nextSibling()) {
if ( child.isComment() ) qDebug("comment: %s", child.toComment().data().latin1()); if ( child.isComment() ) tqDebug("comment: %s", child.toComment().data().latin1());
else { else {
if ( !child.isElement() ) qFatal("\"registers\" child should be an element"); if ( !child.isElement() ) tqFatal("\"registers\" child should be an element");
if ( child.nodeName()!="device" ) qFatal("Device node should be named \"device\""); if ( child.nodeName()!="device" ) tqFatal("Device node should be named \"device\"");
TQDomElement device = child.toElement(); TQDomElement device = child.toElement();
TQString name = device.attribute("name"); TQString name = device.attribute("name");
if ( devices.contains(name) ) qFatal(TQString("Registers already defined for %1").arg(name)); if ( devices.contains(name) ) tqFatal(TQString("Registers already defined for %1").arg(name));
if ( _map.contains(name) ) { if ( _map.contains(name) ) {
_data = _map[name]; _data = _map[name];
processDeviceRegisters(device); processDeviceRegisters(device);
@ -680,18 +680,18 @@ void processRegisters()
TQMap<TQString, Device::Data *>::const_iterator it = _map.begin(); TQMap<TQString, Device::Data *>::const_iterator it = _map.begin();
for (; it!=_map.end(); ++it) { for (; it!=_map.end(); ++it) {
_data = it.data(); _data = it.data();
if ( !devices.contains(it.key()) ) qWarning("Register description not found for %s", it.key().latin1()); if ( !devices.contains(it.key()) ) tqWarning("Register description not found for %s", it.key().latin1());
} }
} }
virtual void checkPins(const TQMap<TQString, uint> &pinLabels) const virtual void checkPins(const TQMap<TQString, uint> &pinLabels) const
{ {
if ( !pinLabels.contains("VDD") ) qFatal("No VDD pin specified"); if ( !pinLabels.contains("VDD") ) tqFatal("No VDD pin specified");
if ( !pinLabels.contains("VSS") ) qFatal("No VSS pin specified"); if ( !pinLabels.contains("VSS") ) tqFatal("No VSS pin specified");
TQMap<TQString, uint>::const_iterator it; TQMap<TQString, uint>::const_iterator it;
for (it=pinLabels.begin(); it!=pinLabels.end(); ++it) { for (it=pinLabels.begin(); it!=pinLabels.end(); ++it) {
if ( it.key()=="VDD" || it.key()=="VSS" || it.key().startsWith("CCP") ) continue; if ( it.key()=="VDD" || it.key()=="VSS" || it.key().startsWith("CCP") ) continue;
if ( it.data()!=1 ) qFatal(TQString("Duplicated pin \"%1\"").arg(it.key())); if ( it.data()!=1 ) tqFatal(TQString("Duplicated pin \"%1\"").arg(it.key()));
} }
const Pic::RegistersData &rdata = static_cast<const Pic::RegistersData &>(*_data->registersData()); const Pic::RegistersData &rdata = static_cast<const Pic::RegistersData &>(*_data->registersData());
for (uint i=0; i<Device::MAX_NB_PORTS; i++) { for (uint i=0; i<Device::MAX_NB_PORTS; i++) {
@ -699,7 +699,7 @@ virtual void checkPins(const TQMap<TQString, uint> &pinLabels) const
for (uint k=0; k<Device::MAX_NB_PORT_BITS; k++) { for (uint k=0; k<Device::MAX_NB_PORT_BITS; k++) {
if ( !rdata.hasPortBit(i, k) ) continue; if ( !rdata.hasPortBit(i, k) ) continue;
TQString name = rdata.portBitName(i, k); TQString name = rdata.portBitName(i, k);
if ( !pinLabels.contains(name) ) qFatal(TQString("Pin \"%1\" not present").arg(name)); if ( !pinLabels.contains(name) ) tqFatal(TQString("Pin \"%1\" not present").arg(name));
} }
} }
} }

@ -287,7 +287,7 @@ void LikeBack::autoMove()
move(window->mapToGlobal(TQPoint(0, 0)).x() + window->width() - width(), window->mapToGlobal(TQPoint(0, 0)).y() + 1); move(window->mapToGlobal(TQPoint(0, 0)).x() + window->width() - width(), window->mapToGlobal(TQPoint(0, 0)).y() + 1);
if (window != lastWindow && s_windowListing != NoListing) if (window != lastWindow && s_windowListing != NoListing)
// if (qstricmp(window->name(), "") == 0 || qstricmp(window->name(), "unnamed") == 0) ; // if (tqstricmp(window->name(), "") == 0 || tqstricmp(window->name(), "unnamed") == 0) ;
// std::cout << "===== LikeBack ===== UNNAMED ACTIVE WINDOW OF TYPE " << window->className() << " ======" << activeWindowPath() << std::endl; // std::cout << "===== LikeBack ===== UNNAMED ACTIVE WINDOW OF TYPE " << window->className() << " ======" << activeWindowPath() << std::endl;
// else if (s_windowListing == AllWindows) ; // else if (s_windowListing == AllWindows) ;
// std::cout << "LikeBack: Active Window: " << activeWindowPath() << std::endl; // std::cout << "LikeBack: Active Window: " << activeWindowPath() << std::endl;

@ -46,7 +46,7 @@ TextEditor::TextEditor(bool withDebugger, TQWidget *parent, const char *name)
: Editor(parent, name), _view(0) : Editor(parent, name), _view(0)
{ {
KLibFactory *factory = KLibLoader::self()->factory("libkatepart"); KLibFactory *factory = KLibLoader::self()->factory("libkatepart");
if ( factory==0 ) qFatal("Could not find katepart"); if ( factory==0 ) tqFatal("Could not find katepart");
_document = static_cast<Kate::Document *>(factory->create(TQT_TQOBJECT(this), "kate", "KTextEditor::Document")); _document = static_cast<Kate::Document *>(factory->create(TQT_TQOBJECT(this), "kate", "KTextEditor::Document"));
_oldModified = _document->isModified(); _oldModified = _document->isModified();
_oldReadOnly = !_document->isReadWrite(); _oldReadOnly = !_document->isReadWrite();

@ -980,7 +980,7 @@ void MainWindow::setTotalProgress(uint nb)
//int id = Observer::self()->newJob(job, true); //int id = Observer::self()->newJob(job, true);
//Observer::self()->slotTotalSize(job, total); //Observer::self()->slotTotalSize(job, total);
//Observer::self()->slotInfoMessage(job, "test"); //Observer::self()->slotInfoMessage(job, "test");
//qDebug("set total steps: %i", total); //tqDebug("set total steps: %i", total);
_actionProgress->setTotalSteps(nb); _actionProgress->setTotalSteps(nb);
_actionProgress->setProgress(0); _actionProgress->setProgress(0);
TQApplication::eventLoop()->processEvents(TQEventLoop::ExcludeUserInput); // #### DANGER !!!! TQApplication::eventLoop()->processEvents(TQEventLoop::ExcludeUserInput); // #### DANGER !!!!

@ -15,7 +15,7 @@ void DeviceTest::checkArguments()
{ {
if ( _args->count()==1 ) { if ( _args->count()==1 ) {
_device = TQString(_args->arg(0)).upper(); _device = TQString(_args->arg(0)).upper();
if ( !Device::lister().isSupported(_device) ) qFatal("Specified device \"%s\" not supported.", _device.latin1()); if ( !Device::lister().isSupported(_device) ) tqFatal("Specified device \"%s\" not supported.", _device.latin1());
printf("Testing only %s\n", _device.latin1()); printf("Testing only %s\n", _device.latin1());
} }
} }

@ -83,7 +83,7 @@ bool Direct::P18F::doRead(Pic::MemoryRangeType type, Device::Array &data, const
} }
} }
BitValue mask = device().mask(type); BitValue mask = device().mask(type);
//qDebug("read %s %i", Pic::MEMORY_RANGE_TYPE_DATA[type].label, device().nbWords(type)); //tqDebug("read %s %i", Pic::MEMORY_RANGE_TYPE_DATA[type].label, device().nbWords(type));
//pulseEngine("w300000"); // what for ? //pulseEngine("w300000"); // what for ?
directAccess(type); directAccess(type);
switch (type.type()) { switch (type.type()) {
@ -125,7 +125,7 @@ bool Direct::P18F::doRead(Pic::MemoryRangeType type, Device::Array &data, const
bool Direct::P18F::doWrite(Pic::MemoryRangeType type, const Device::Array &data, bool force) bool Direct::P18F::doWrite(Pic::MemoryRangeType type, const Device::Array &data, bool force)
{ {
uint inc = device().addressIncrement(type); uint inc = device().addressIncrement(type);
//qDebug("write %s %i/%i %i", Pic::MEMORY_RANGE_TYPE_DATA[type].label, nbWords, data.count(), inc); //tqDebug("write %s %i/%i %i", Pic::MEMORY_RANGE_TYPE_DATA[type].label, nbWords, data.count(), inc);
//pulseEngine("w300000"); ?? //pulseEngine("w300000"); ??
configureSinglePanel(); configureSinglePanel();
directAccess(type); directAccess(type);

@ -23,7 +23,7 @@ BitValue Direct::PulseEngine::pulseEngine(const TQString &cmd, BitValue value)
TQByteArray a = toAscii(cmd); TQByteArray a = toAscii(cmd);
BitValue res = 0; BitValue res = 0;
for (const char *ptr=a.data(); (ptr-a.data())<int(a.count()); ++ptr) for (const char *ptr=a.data(); (ptr-a.data())<int(a.count()); ++ptr)
if ( !pulse(ptr, value, res) ) qFatal("pulse engine: invalid command '%c'", *ptr); if ( !pulse(ptr, value, res) ) tqFatal("pulse engine: invalid command '%c'", *ptr);
return res; return res;
} }

@ -27,7 +27,7 @@ void Direct::XmlToData::parseData(TQDomElement element, Data &)
{ {
TQString s = element.attribute("pwidth"); TQString s = element.attribute("pwidth");
const Device::Data *d = Device::lister().data(currentDevice()); const Device::Data *d = Device::lister().data(currentDevice());
if ( d==0 ) qFatal("Invalid device name"); if ( d==0 ) tqFatal("Invalid device name");
} }
void Direct::XmlToData::includes(TQTextStream &s) const void Direct::XmlToData::includes(TQTextStream &s) const

@ -27,7 +27,7 @@ void Icd1::XmlToData::parseData(TQDomElement element, Data &data)
{ {
bool ok; bool ok;
data.part = fromHexLabel(element.attribute("family"), 2, &ok); data.part = fromHexLabel(element.attribute("family"), 2, &ok);
if ( !ok ) qFatal("Missing or malformed family attribute"); if ( !ok ) tqFatal("Missing or malformed family attribute");
} }
void Icd1::XmlToData::outputData(const Data &data, TQTextStream &s) const void Icd1::XmlToData::outputData(const Data &data, TQTextStream &s) const

@ -311,7 +311,7 @@ bool Icd2::Hardware::selfTest(TestData &test)
bool Icd2::Hardware::readBlock(uint nbBytesWord, uint nbWords, Device::Array &data) bool Icd2::Hardware::readBlock(uint nbBytesWord, uint nbWords, Device::Array &data)
{ {
//qDebug("readBlock %i %s", nbBytesWord, toHex(nbWords, 8).data()); //tqDebug("readBlock %i %s", nbBytesWord, toHex(nbWords, 8).data());
// receive data // receive data
uint length = 2*nbBytesWord*nbWords+4; uint length = 2*nbBytesWord*nbWords+4;
TQString s; TQString s;
@ -337,7 +337,7 @@ bool Icd2::Hardware::readBlock(uint nbBytesWord, uint nbWords, Device::Array &da
TQ_UINT8 chk = 0; TQ_UINT8 chk = 0;
for (uint i=0; i<nbWords; i++) { for (uint i=0; i<nbWords; i++) {
TQString ts = s.mid(1+2*nbBytesWord*i, 2*nbBytesWord); TQString ts = s.mid(1+2*nbBytesWord*i, 2*nbBytesWord);
//if ( i<10 ) qDebug("%i: %s", i, ts.data()); //if ( i<10 ) tqDebug("%i: %s", i, ts.data());
data[i] = 0; data[i] = 0;
for (int k=nbBytesWord-1; k>=0; k--) { for (int k=nbBytesWord-1; k>=0; k--) {
data[i] = data[i] << 8; data[i] = data[i] << 8;
@ -366,12 +366,12 @@ bool Icd2::Hardware::readMemory(Pic::MemoryRangeType type, uint wordOffset,
Address start = device().range(type).start; // address Address start = device().range(type).start; // address
uint todo = inc * data.count(); // address uint todo = inc * data.count(); // address
uint offset = inc * wordOffset; // address uint offset = inc * wordOffset; // address
//qDebug("read size=%s div=%i nbBytes=%i", toHex(size, 8).data(), div, nbBytesWord); //tqDebug("read size=%s div=%i nbBytes=%i", toHex(size, 8).data(), div, nbBytesWord);
data.resize(0); data.resize(0);
do { do {
uint size = TQMIN(todo, uint(0x1000)); // addresses uint size = TQMIN(todo, uint(0x1000)); // addresses
uint nb = size / inc; // word uint nb = size / inc; // word
//qDebug("read %s start=%s size=%s", Pic::MEMORY_RANGE_TYPE_DATA[type].label, toHex(start+offset, 8).data(), toHex(nb, 8).data()); //tqDebug("read %s start=%s size=%s", Pic::MEMORY_RANGE_TYPE_DATA[type].label, toHex(start+offset, 8).data(), toHex(nb, 8).data());
TQString cmd = r + toHex(start+offset, 8) + toHex(nb/div, 8); TQString cmd = r + toHex(start+offset, 8) + toHex(nb/div, 8);
if ( !command(cmd, 0) ) return false; if ( !command(cmd, 0) ) return false;
Device::Array pdata; Device::Array pdata;
@ -400,7 +400,7 @@ bool Icd2::Hardware::writeBlock(uint nbBytesWord, const Device::Array &data, uin
for (uint i=0; i<nbWords; i++) { for (uint i=0; i<nbWords; i++) {
TQString ts = toHex(data[wordIndex+i], 2*nbBytesWord); TQString ts = toHex(data[wordIndex+i], 2*nbBytesWord);
for (int k=nbBytesWord-1; k>=0; k--) { for (int k=nbBytesWord-1; k>=0; k--) {
//if ( i<10 || i>=nbWords-10 ) qDebug("send: %i-%i %s", i, k, ts.mid(2*k, 2).data()); //if ( i<10 || i>=nbWords-10 ) tqDebug("send: %i-%i %s", i, k, ts.mid(2*k, 2).data());
s += ts.mid(2*k, 2); s += ts.mid(2*k, 2);
chk += ts[2*k].latin1() + ts[2*k+1].latin1(); chk += ts[2*k].latin1() + ts[2*k+1].latin1();
} }
@ -422,13 +422,13 @@ bool Icd2::Hardware::writeBlock(uint nbBytesWord, const Device::Array &data, uin
i += size; i += size;
} }
//qDebug("done sending %i words (chk=%s)", nbWords, toHex(chk, 2).data()); //tqDebug("done sending %i words (chk=%s)", nbWords, toHex(chk, 2).data());
return true; return true;
} }
bool Icd2::Hardware::writeMemory(Pic::MemoryRangeType type, uint wordOffset, const Device::Array &data) bool Icd2::Hardware::writeMemory(Pic::MemoryRangeType type, uint wordOffset, const Device::Array &data)
{ {
//qDebug("write memory: offset:%s nbWords:%s (size: %s)", toHex(wordOffset, 4).data(), toHex(nbWords, 4).data(), toHex(data.size(), 4).data()); //tqDebug("write memory: offset:%s nbWords:%s (size: %s)", toHex(wordOffset, 4).data(), toHex(nbWords, 4).data(), toHex(data.size(), 4).data());
const char *w = writeCommand(type); const char *w = writeCommand(type);
if ( w==0 ) return true; if ( w==0 ) return true;
uint nbBytesWord = device().nbBytesWord(type); uint nbBytesWord = device().nbBytesWord(type);
@ -439,11 +439,11 @@ bool Icd2::Hardware::writeMemory(Pic::MemoryRangeType type, uint wordOffset, con
uint todo = inc * data.count(); // address uint todo = inc * data.count(); // address
uint offset = inc * wordOffset; // address uint offset = inc * wordOffset; // address
uint index = 0; uint index = 0;
//qDebug("write todo=%s div=%i nbBytes=%i dataSize=%i", toHex(todo, 8).data(), div, nbBytesWord, data.size()); //tqDebug("write todo=%s div=%i nbBytes=%i dataSize=%i", toHex(todo, 8).data(), div, nbBytesWord, data.size());
do { do {
uint size = TQMIN(todo, uint(0x1000)); // address uint size = TQMIN(todo, uint(0x1000)); // address
uint nb = size / inc; // word uint nb = size / inc; // word
//qDebug("write %s start=%s nbWords=%s", Pic::MEMORY_RANGE_TYPE_DATA[type].label, toHex(start+offset, 8).data(), toHex(nb, 8).data()); //tqDebug("write %s start=%s nbWords=%s", Pic::MEMORY_RANGE_TYPE_DATA[type].label, toHex(start+offset, 8).data(), toHex(nb, 8).data());
TQString cmd = w + toHex(start+offset+index, 8) + toHex(nb/div, 8); TQString cmd = w + toHex(start+offset+index, 8) + toHex(nb/div, 8);
if ( !command(cmd, 0) ) return false; if ( !command(cmd, 0) ) return false;
if ( !writeBlock(nbBytesWord, data, index/inc, nb) ) return false; if ( !writeBlock(nbBytesWord, data, index/inc, nb) ) return false;

@ -29,7 +29,7 @@ uint Icd2::XmlToData::familyIndex(const TQString &family) const
uint i = 0; uint i = 0;
for (; Icd2::FAMILY_DATA[i].efid!=0; i++) for (; Icd2::FAMILY_DATA[i].efid!=0; i++)
if ( family==Icd2::FAMILY_DATA[i].name ) break; if ( family==Icd2::FAMILY_DATA[i].name ) break;
if ( Icd2::FAMILY_DATA[i].efid==0 ) qFatal(TQString("Family \"%1\" is unknown").arg(family)); if ( Icd2::FAMILY_DATA[i].efid==0 ) tqFatal(TQString("Family \"%1\" is unknown").arg(family));
return i; return i;
} }
@ -37,7 +37,7 @@ void Icd2::XmlToData::parseData(TQDomElement element, Data &data)
{ {
bool ok; bool ok;
data.famid = fromHexLabel(element.attribute("famid"), 2, &ok); data.famid = fromHexLabel(element.attribute("famid"), 2, &ok);
if ( !ok ) qFatal("Missing or malformed famid attribute"); if ( !ok ) tqFatal("Missing or malformed famid attribute");
data.debugSupport = extractSupport(element.attribute("debug_support_type")); data.debugSupport = extractSupport(element.attribute("debug_support_type"));
} }

@ -28,9 +28,9 @@ private:
void PicdemBootloader::XmlToData::parseData(TQDomElement, Data &) void PicdemBootloader::XmlToData::parseData(TQDomElement, Data &)
{ {
const Device::Data *ddata = Device::lister().data(currentDevice()); const Device::Data *ddata = Device::lister().data(currentDevice());
if ( ddata->group().name()!="pic" ) qFatal("non-pic device not supported"); if ( ddata->group().name()!="pic" ) tqFatal("non-pic device not supported");
const Pic::Data *pdata = static_cast<const Pic::Data *>(ddata); const Pic::Data *pdata = static_cast<const Pic::Data *>(ddata);
if ( !pdata->hasFeature(Pic::Feature::USB) ) qFatal("device does not have USB"); if ( !pdata->hasFeature(Pic::Feature::USB) ) tqFatal("device does not have USB");
} }
} // namespace } // namespace

@ -26,12 +26,12 @@ private:
void Pickit1::XmlToData::parseData(TQDomElement element, Data &data) void Pickit1::XmlToData::parseData(TQDomElement element, Data &data)
{ {
TQString s = element.attribute("entry"); TQString s = element.attribute("entry");
if ( s.length()!=1 || (s[0]!='O' && s[0]!='P') ) qFatal("Invalid or missing entry mode"); if ( s.length()!=1 || (s[0]!='O' && s[0]!='P') ) tqFatal("Invalid or missing entry mode");
data.entryMode = s[0].latin1(); data.entryMode = s[0].latin1();
s = element.attribute("regen"); s = element.attribute("regen");
if ( s.isEmpty() || s=="false" ) data.regenerateOsccal = false; if ( s.isEmpty() || s=="false" ) data.regenerateOsccal = false;
else if ( s=="true" ) data.regenerateOsccal = true; else if ( s=="true" ) data.regenerateOsccal = true;
else qFatal("Invalid regen value"); else tqFatal("Invalid regen value");
} }
void Pickit1::XmlToData::outputData(const Data &data, TQTextStream &s) const void Pickit1::XmlToData::outputData(const Data &data, TQTextStream &s) const

@ -26,25 +26,25 @@ private:
void Pickit2::XmlToData::parseData(TQDomElement element, Data &data) void Pickit2::XmlToData::parseData(TQDomElement element, Data &data)
{ {
TQString s = element.attribute("entry"); TQString s = element.attribute("entry");
if ( s.length()!=1 || (s[0]!='O' && s[0]!='P') ) qFatal("Invalid or missing entry mode"); if ( s.length()!=1 || (s[0]!='O' && s[0]!='P') ) tqFatal("Invalid or missing entry mode");
data.entryMode = s[0].latin1(); data.entryMode = s[0].latin1();
s = element.attribute("pmode"); s = element.attribute("pmode");
if ( s.length()!=1 || (s[0]!='0' && s[0]!='1' && s[0]!='4' && s[0]!='n') ) if ( s.length()!=1 || (s[0]!='0' && s[0]!='1' && s[0]!='4' && s[0]!='n') )
qFatal("Invalid or missing program mode"); tqFatal("Invalid or missing program mode");
data.progMode = s[0].latin1(); data.progMode = s[0].latin1();
s = element.attribute("pwidth"); s = element.attribute("pwidth");
if ( data.progMode!='n' ) { if ( data.progMode!='n' ) {
if ( s.length()!=0 ) qFatal("Program width should not be defined"); if ( s.length()!=0 ) tqFatal("Program width should not be defined");
data.progWidth = 0; data.progWidth = 0;
} else { } else {
bool ok; bool ok;
data.progWidth = s.toUInt(&ok); data.progWidth = s.toUInt(&ok);
if ( !ok ) qFatal("Invalid or missing program width"); if ( !ok ) tqFatal("Invalid or missing program width");
} }
s = element.attribute("regen"); s = element.attribute("regen");
if ( s.isEmpty() || s=="false" ) data.regenerateOsccal = false; if ( s.isEmpty() || s=="false" ) data.regenerateOsccal = false;
else if ( s=="true" ) data.regenerateOsccal = true; else if ( s=="true" ) data.regenerateOsccal = true;
else qFatal("Invalid regen value"); else tqFatal("Invalid regen value");
} }
void Pickit2::XmlToData::outputData(const Data &data, TQTextStream &s) const void Pickit2::XmlToData::outputData(const Data &data, TQTextStream &s) const

@ -28,9 +28,9 @@ private:
void Pickit2Bootloader::XmlToData::parseData(TQDomElement, Data &) void Pickit2Bootloader::XmlToData::parseData(TQDomElement, Data &)
{ {
const Device::Data *ddata = Device::lister().data(currentDevice()); const Device::Data *ddata = Device::lister().data(currentDevice());
if ( ddata->group().name()!="pic" ) qFatal("non-pic device not supported"); if ( ddata->group().name()!="pic" ) tqFatal("non-pic device not supported");
const Pic::Data *pdata = static_cast<const Pic::Data *>(ddata); const Pic::Data *pdata = static_cast<const Pic::Data *>(ddata);
if ( !pdata->hasFeature(Pic::Feature::USB) ) qFatal("device does not have USB"); if ( !pdata->hasFeature(Pic::Feature::USB) ) tqFatal("device does not have USB");
} }
} // namespace } // namespace

@ -27,11 +27,11 @@ void Psp::XmlToData::parseData(TQDomElement element, Data &data)
{ {
bool ok; bool ok;
data.algorithm = element.attribute("algorithm").toUInt(&ok); data.algorithm = element.attribute("algorithm").toUInt(&ok);
if ( !ok ) qFatal("Missing or invalid algorithm"); if ( !ok ) tqFatal("Missing or invalid algorithm");
data.overprogram = element.attribute("overprogram").toUInt(&ok); data.overprogram = element.attribute("overprogram").toUInt(&ok);
if ( !ok ) qFatal("Missing or invalid overprogram"); if ( !ok ) tqFatal("Missing or invalid overprogram");
data.tries = element.attribute("tries").toUInt(&ok); data.tries = element.attribute("tries").toUInt(&ok);
if ( !ok ) qFatal("Missing or invalid tries"); if ( !ok ) tqFatal("Missing or invalid tries");
} }
void Psp::XmlToData::outputData(const Data &data, TQTextStream &s) const void Psp::XmlToData::outputData(const Data &data, TQTextStream &s) const

@ -29,12 +29,12 @@ private:
void TinyBootloader::XmlToData::parseData(TQDomElement element, Data &data) void TinyBootloader::XmlToData::parseData(TQDomElement element, Data &data)
{ {
const Device::Data *ddata = Device::lister().data(currentDevice()); const Device::Data *ddata = Device::lister().data(currentDevice());
if ( ddata->group().name()!="pic" ) qFatal("non-pic device not supported"); if ( ddata->group().name()!="pic" ) tqFatal("non-pic device not supported");
const Pic::Data *pdata = static_cast<const Pic::Data *>(ddata); const Pic::Data *pdata = static_cast<const Pic::Data *>(ddata);
if ( !pdata->hasFeature(Pic::Feature::USART) ) qFatal("device does not have USART"); if ( !pdata->hasFeature(Pic::Feature::USART) ) tqFatal("device does not have USART");
bool ok; bool ok;
data.id = fromHexLabel(element.attribute("id"), 2, &ok); data.id = fromHexLabel(element.attribute("id"), 2, &ok);
if ( !ok ) qFatal("Invalid \"id\" tag"); if ( !ok ) tqFatal("Invalid \"id\" tag");
} }
void TinyBootloader::XmlToData::outputData(const Data &data, TQTextStream &s) const void TinyBootloader::XmlToData::outputData(const Data &data, TQTextStream &s) const

@ -210,7 +210,7 @@ Compile::FileData::List Compile::Process::files(bool *ok) const
PURL::FileType type = PURL::FileType::fromKey(rexp.cap(1)); PURL::FileType type = PURL::FileType::fromKey(rexp.cap(1));
if ( type==PURL::Nb_FileTypes ) { if ( type==PURL::Nb_FileTypes ) {
if (ok) *ok = false; if (ok) *ok = false;
qWarning("Unknown PURL::FileType in file list for %s", _manager->label().latin1()); tqWarning("Unknown PURL::FileType in file list for %s", _manager->label().latin1());
continue; continue;
} }
if ( type.data().group==PURL::LinkerScript ) { if ( type.data().group==PURL::LinkerScript ) {
@ -231,7 +231,7 @@ Compile::FileData::List Compile::Process::files(bool *ok) const
bool Compile::Process::checkIs(const TQString &s, const TQString &key) bool Compile::Process::checkIs(const TQString &s, const TQString &key)
{ {
if ( !s.contains(key) ) return false; if ( !s.contains(key) ) return false;
if ( s!=key ) qWarning("Argument should be only %s, the rest will be ignored...", key.latin1()); if ( s!=key ) tqWarning("Argument should be only %s, the rest will be ignored...", key.latin1());
return true; return true;
} }

@ -18,12 +18,12 @@ bool Device::XmlToDataBase::getFrequencyRange(OperatingCondition oc, Special spe
TQDomElement range; TQDomElement range;
for (TQDomNode child=element.firstChild(); !child.isNull(); child=child.nextSibling()) { for (TQDomNode child=element.firstChild(); !child.isNull(); child=child.nextSibling()) {
if ( child.nodeName()!="frequency_range" ) continue; if ( child.nodeName()!="frequency_range" ) continue;
if ( !child.isElement() ) qFatal("\"frequency_range\" should be an element"); if ( !child.isElement() ) tqFatal("\"frequency_range\" should be an element");
if ( child.toElement().attribute("name")!=oc.key() ) continue; if ( child.toElement().attribute("name")!=oc.key() ) continue;
Special s = Special::fromKey(child.toElement().attribute("special")); Special s = Special::fromKey(child.toElement().attribute("special"));
if ( s==Special::Nb_Types ) qFatal("Unrecognized special"); if ( s==Special::Nb_Types ) tqFatal("Unrecognized special");
if ( special!=s ) continue; if ( special!=s ) continue;
if ( !range.isNull() ) qFatal("Duplicated \"frequency_range\""); if ( !range.isNull() ) tqFatal("Duplicated \"frequency_range\"");
range = child.toElement(); range = child.toElement();
} }
if ( range.isNull() ) return false; if ( range.isNull() ) return false;
@ -32,7 +32,7 @@ bool Device::XmlToDataBase::getFrequencyRange(OperatingCondition oc, Special spe
frange.special = special; frange.special = special;
for (TQDomNode child=range.firstChild(); !child.isNull(); child=child.nextSibling()) { for (TQDomNode child=range.firstChild(); !child.isNull(); child=child.nextSibling()) {
if ( child.nodeName()=="frequency" ) { if ( child.nodeName()=="frequency" ) {
if ( !child.isElement() ) qFatal("Frequency is not an element"); if ( !child.isElement() ) tqFatal("Frequency is not an element");
TQDomElement frequency = child.toElement(); TQDomElement frequency = child.toElement();
bool ok1, ok2, ok3, ok4; bool ok1, ok2, ok3, ok4;
RangeBox box; RangeBox box;
@ -44,11 +44,11 @@ bool Device::XmlToDataBase::getFrequencyRange(OperatingCondition oc, Special spe
if ( !ok1 || !ok2 || !ok3 || !ok4 if ( !ok1 || !ok2 || !ok3 || !ok4
|| box.start.x<0.0 || box.start.x>box.end.x || box.start.x<0.0 || box.start.x>box.end.x
|| box.start.yMin<0.0 || box.start.yMin>box.start.yMax ) || box.start.yMin<0.0 || box.start.yMin>box.start.yMax )
qFatal("Malformed frequency element"); tqFatal("Malformed frequency element");
if ( frequency.attribute("vdd_min_end").isEmpty() ) box.end.yMin = box.start.yMin; if ( frequency.attribute("vdd_min_end").isEmpty() ) box.end.yMin = box.start.yMin;
else { else {
box.end.yMin = frequency.attribute("vdd_min_end").toDouble(&ok1); box.end.yMin = frequency.attribute("vdd_min_end").toDouble(&ok1);
if ( !ok1 || box.end.yMin>box.end.yMax ) qFatal("Malformed frequency element"); if ( !ok1 || box.end.yMin>box.end.yMax ) tqFatal("Malformed frequency element");
} }
box.mode = frequency.attribute("mode"); box.mode = frequency.attribute("mode");
box.osc = frequency.attribute("osc"); box.osc = frequency.attribute("osc");
@ -56,17 +56,17 @@ bool Device::XmlToDataBase::getFrequencyRange(OperatingCondition oc, Special spe
for (uint i=0; i<uint(frange.vdds.count()); i++) for (uint i=0; i<uint(frange.vdds.count()); i++)
if ( box.start.x<frange.vdds[i].end.x && box.end.x>frange.vdds[i].start.x ) { if ( box.start.x<frange.vdds[i].end.x && box.end.x>frange.vdds[i].start.x ) {
if ( box.mode.isEmpty() && box.osc.isEmpty() && box.special.isEmpty() ) if ( box.mode.isEmpty() && box.osc.isEmpty() && box.special.isEmpty() )
qFatal("Overlapping frequency ranges"); tqFatal("Overlapping frequency ranges");
continue; // #### FIXME: ignore additionnal mode continue; // #### FIXME: ignore additionnal mode
} }
// qDebug("add Freq Range: %s %s %f=[%f %f] %f=[%f %f]", // tqDebug("add Freq Range: %s %s %f=[%f %f] %f=[%f %f]",
// Device::FrequencyRange::TYPE_LABELS[type], Device::FrequencyRange::SPECIAL_LABELS[type], // Device::FrequencyRange::TYPE_LABELS[type], Device::FrequencyRange::SPECIAL_LABELS[type],
// box.start.x, box.start.yMin, box.start.yMax, // box.start.x, box.start.yMin, box.start.yMax,
// box.end.x, box.end.yMin, box.end.yMax); // box.end.x, box.end.yMin, box.end.yMax);
frange.vdds.append(box); frange.vdds.append(box);
} }
} }
if ( frange.vdds.count()==0 ) qFatal("Empty frequency range"); if ( frange.vdds.count()==0 ) tqFatal("Empty frequency range");
_data->_frequencyRanges.append(frange); _data->_frequencyRanges.append(frange);
return true; return true;
} }
@ -76,15 +76,15 @@ bool Device::XmlToDataBase::getMemoryTechnology(TQDomElement element)
TQString s = element.attribute("memory_technology"); TQString s = element.attribute("memory_technology");
_data->_memoryTechnology = MemoryTechnology::fromKey(s); _data->_memoryTechnology = MemoryTechnology::fromKey(s);
if ( _data->_memoryTechnology!=MemoryTechnology::Nb_Types ) return true; if ( _data->_memoryTechnology!=MemoryTechnology::Nb_Types ) return true;
if ( !s.isNull() ) qFatal("Unrecognized memory technology"); if ( !s.isNull() ) tqFatal("Unrecognized memory technology");
return false; return false;
} }
void Device::XmlToDataBase::processDevice(TQDomElement device) void Device::XmlToDataBase::processDevice(TQDomElement device)
{ {
TQString name = device.attribute("name").upper(); TQString name = device.attribute("name").upper();
if ( name.isEmpty() ) qFatal("Device has no name"); if ( name.isEmpty() ) tqFatal("Device has no name");
if ( _map.contains(name) ) qFatal(TQString("Device \"%1\" already defined").arg(name)); if ( _map.contains(name) ) tqFatal(TQString("Device \"%1\" already defined").arg(name));
_data = createData(); _data = createData();
_map[name] = _data; _map[name] = _data;
_data->_name = name; _data->_name = name;
@ -93,10 +93,10 @@ void Device::XmlToDataBase::processDevice(TQDomElement device)
_data->_status = Status::fromKey(device.attribute("status")); _data->_status = Status::fromKey(device.attribute("status"));
switch (_data->_status.type()) { switch (_data->_status.type()) {
case Status::Nb_Types: case Status::Nb_Types:
qFatal("Unrecognized or absent device status"); tqFatal("Unrecognized or absent device status");
break; break;
case Status::Future: case Status::Future:
if ( _data->_alternatives.count() ) qFatal("Future device has alternative"); if ( _data->_alternatives.count() ) tqFatal("Future device has alternative");
break; break;
case Status::NotRecommended: case Status::NotRecommended:
case Status::Mature: case Status::Mature:
@ -111,34 +111,34 @@ void Device::XmlToDataBase::processDevice(TQDomElement device)
_data->_documents.webpage = device.attribute("document"); // ### REMOVE ME _data->_documents.webpage = device.attribute("document"); // ### REMOVE ME
TQDomElement documents = findUniqueElement(device, "documents", TQString(), TQString()); TQDomElement documents = findUniqueElement(device, "documents", TQString(), TQString());
if ( documents.isNull() ) { if ( documents.isNull() ) {
if ( _data->_documents.webpage.isEmpty() ) qFatal("Missing \"documents\" element"); if ( _data->_documents.webpage.isEmpty() ) tqFatal("Missing \"documents\" element");
} else { } else {
if ( !_data->_documents.webpage.isEmpty() ) qFatal("document should be removed from root element"); if ( !_data->_documents.webpage.isEmpty() ) tqFatal("document should be removed from root element");
_data->_documents.webpage = documents.attribute("webpage"); _data->_documents.webpage = documents.attribute("webpage");
if ( _data->_documents.webpage.isEmpty() ) qFatal("Missing webpage"); if ( _data->_documents.webpage.isEmpty() ) tqFatal("Missing webpage");
_data->_documents.datasheet = documents.attribute("datasheet"); _data->_documents.datasheet = documents.attribute("datasheet");
TQRegExp rexp("\\d{5}"); TQRegExp rexp("\\d{5}");
if ( _data->_documents.datasheet=="?" ) warning("No datasheet specified"); if ( _data->_documents.datasheet=="?" ) warning("No datasheet specified");
if ( !rexp.exactMatch(_data->_documents.datasheet) ) qFatal(TQString("Malformed datasheet \"%1\" (5 digits)").arg(_data->_documents.datasheet)); if ( !rexp.exactMatch(_data->_documents.datasheet) ) tqFatal(TQString("Malformed datasheet \"%1\" (5 digits)").arg(_data->_documents.datasheet));
_data->_documents.progsheet = documents.attribute("progsheet"); _data->_documents.progsheet = documents.attribute("progsheet");
if ( _data->_documents.progsheet=="?" ) warning("No progsheet specified"); if ( _data->_documents.progsheet=="?" ) warning("No progsheet specified");
if ( !rexp.exactMatch(_data->_documents.datasheet) ) qFatal(TQString("Malformed progsheet \"%1\" (5 digits)").arg(_data->_documents.progsheet)); if ( !rexp.exactMatch(_data->_documents.datasheet) ) tqFatal(TQString("Malformed progsheet \"%1\" (5 digits)").arg(_data->_documents.progsheet));
_data->_documents.erratas = TQStringList::split(" ", documents.attribute("erratas")); _data->_documents.erratas = TQStringList::split(" ", documents.attribute("erratas"));
for (uint i=0; i<uint(_data->_documents.erratas.count()); i++) { for (uint i=0; i<uint(_data->_documents.erratas.count()); i++) {
TQString errata = _data->_documents.erratas[i]; TQString errata = _data->_documents.erratas[i];
if ( !rexp.exactMatch(errata) ) { if ( !rexp.exactMatch(errata) ) {
TQRegExp rexp2("\\d{5}e\\d"); TQRegExp rexp2("\\d{5}e\\d");
if ( !rexp2.exactMatch(errata) && !errata.startsWith("er") && errata.mid(2)!=_data->_name.lower() ) if ( !rexp2.exactMatch(errata) && !errata.startsWith("er") && errata.mid(2)!=_data->_name.lower() )
qFatal(TQString("Malformed erratas \"%1\" (5 digits or 5 digits + e + 1 digit or \"er\" + name)").arg(errata)); tqFatal(TQString("Malformed erratas \"%1\" (5 digits or 5 digits + e + 1 digit or \"er\" + name)").arg(errata));
} }
} }
} }
if ( _data->_documents.webpage=="?" ) warning("No webpage specified"); if ( _data->_documents.webpage=="?" ) warning("No webpage specified");
else { else {
TQRegExp rexp("\\d{6}"); TQRegExp rexp("\\d{6}");
if ( !rexp.exactMatch(_data->_documents.webpage) ) qFatal(TQString("Malformed webpage \"%1\" (6 digits)").arg(_data->_documents.webpage)); if ( !rexp.exactMatch(_data->_documents.webpage) ) tqFatal(TQString("Malformed webpage \"%1\" (6 digits)").arg(_data->_documents.webpage));
if ( _documents.contains(_data->_documents.webpage) ) if ( _documents.contains(_data->_documents.webpage) )
qFatal(TQString("webpage duplicated (already used for %1)").arg(_documents[_data->_documents.webpage])); tqFatal(TQString("webpage duplicated (already used for %1)").arg(_documents[_data->_documents.webpage]));
_documents[_data->_documents.webpage] = name; _documents[_data->_documents.webpage] = name;
} }
@ -150,11 +150,11 @@ void Device::XmlToDataBase::processDevice(TQDomElement device)
FOR_EACH(Special, special) FOR_EACH(Special, special)
if ( getFrequencyRange(oc, special, device) && special==Special::Normal ) ok = true; if ( getFrequencyRange(oc, special, device) && special==Special::Normal ) ok = true;
} }
if ( !ok ) qWarning("No normal frequency range defined"); if ( !ok ) tqWarning("No normal frequency range defined");
checkTagNames(device, "frequency_range", names); checkTagNames(device, "frequency_range", names);
// memory technology // memory technology
if ( !getMemoryTechnology(device) ) qFatal("Memory technology not defined"); if ( !getMemoryTechnology(device) ) tqFatal("Memory technology not defined");
// packages // packages
for (TQDomNode child=device.firstChild(); !child.isNull(); child=child.nextSibling()) { for (TQDomNode child=device.firstChild(); !child.isNull(); child=child.nextSibling()) {
@ -172,7 +172,7 @@ void Device::XmlToDataBase::processDevice(TQDomElement device)
for (uint k=0; k<uint(_data->_packages.count()); k++) for (uint k=0; k<uint(_data->_packages.count()); k++)
for (uint l=0; l<uint(p.types.count()); l++) for (uint l=0; l<uint(p.types.count()); l++)
for (uint j=0; j<uint(_data->_packages[k].types.count()); j++) for (uint j=0; j<uint(_data->_packages[k].types.count()); j++)
if ( _data->_packages[k].types[j]==p.types[l] && _data->_packages[k].pins.count()==p.pins.count() ) qFatal("Duplicated package type"); if ( _data->_packages[k].types[j]==p.types[l] && _data->_packages[k].pins.count()==p.pins.count() ) tqFatal("Duplicated package type");
if ( !pinLabels.isEmpty() ) checkPins(pinLabels); if ( !pinLabels.isEmpty() ) checkPins(pinLabels);
_data->_packages.append(p); _data->_packages.append(p);
} }
@ -184,49 +184,49 @@ Device::Package Device::XmlToDataBase::processPackage(TQDomElement element)
// nb pins // nb pins
bool ok; bool ok;
uint nb = element.attribute("nb_pins").toUInt(&ok); uint nb = element.attribute("nb_pins").toUInt(&ok);
if ( !ok || nb==0 ) qFatal("Malformed \"nb_pins\""); if ( !ok || nb==0 ) tqFatal("Malformed \"nb_pins\"");
package.pins.resize(nb); package.pins.resize(nb);
// types // types
TQStringList types = TQStringList::split(" ", element.attribute("types")); TQStringList types = TQStringList::split(" ", element.attribute("types"));
if ( types.isEmpty() ) qFatal("No package types specified"); if ( types.isEmpty() ) tqFatal("No package types specified");
for (uint k=0; k<uint(types.count()); k++) { for (uint k=0; k<uint(types.count()); k++) {
uint i = 0; uint i = 0;
for (; Package::TYPE_DATA[i].name; i++) { for (; Package::TYPE_DATA[i].name; i++) {
if ( types[k]!=Package::TYPE_DATA[i].name ) continue; if ( types[k]!=Package::TYPE_DATA[i].name ) continue;
for (uint j=0; j<uint(package.types.count()); j++) for (uint j=0; j<uint(package.types.count()); j++)
if ( package.types[j]==i ) qFatal(TQString("Duplicated package type %1").arg(types[k])); if ( package.types[j]==i ) tqFatal(TQString("Duplicated package type %1").arg(types[k]));
uint j = 0; uint j = 0;
for (; j<Package::MAX_NB; j++) for (; j<Package::MAX_NB; j++)
if ( nb==Package::TYPE_DATA[i].nbPins[j] ) break; if ( nb==Package::TYPE_DATA[i].nbPins[j] ) break;
if ( j==Package::MAX_NB ) qFatal(TQString("Package %1 does not have the correct number of pins %2 (%3)").arg(types[k]).arg(nb).arg(Package::TYPE_DATA[i].nbPins[0])); if ( j==Package::MAX_NB ) tqFatal(TQString("Package %1 does not have the correct number of pins %2 (%3)").arg(types[k]).arg(nb).arg(Package::TYPE_DATA[i].nbPins[0]));
package.types.append(i); package.types.append(i);
break; break;
} }
if ( Package::TYPE_DATA[i].name==0 ) qFatal(TQString("Unknown package type \"%1\"").arg(types[k])); if ( Package::TYPE_DATA[i].name==0 ) tqFatal(TQString("Unknown package type \"%1\"").arg(types[k]));
} }
// pins // pins
TQString name = Package::TYPE_DATA[package.types[0]].name; TQString name = Package::TYPE_DATA[package.types[0]].name;
if ( name=="sot23" ) { if ( name=="sot23" ) {
if ( package.types.count()!=1 ) qFatal("SOT23 should be a specific package"); if ( package.types.count()!=1 ) tqFatal("SOT23 should be a specific package");
} else if ( (nb%2)!=0 ) qFatal(TQString("\"nb_pins\" should be even for package \"%1\"").arg(name)); } else if ( (nb%2)!=0 ) tqFatal(TQString("\"nb_pins\" should be even for package \"%1\"").arg(name));
uint have_pins = false; uint have_pins = false;
TQMemArray<bool> found(nb); TQMemArray<bool> found(nb);
found.fill(false); found.fill(false);
TQDomNode child = element.firstChild(); TQDomNode child = element.firstChild();
while ( !child.isNull() ) { while ( !child.isNull() ) {
if ( child.nodeName()=="pin" ) { if ( child.nodeName()=="pin" ) {
if ( !child.isElement() ) qFatal("\"pin\" is not an element"); if ( !child.isElement() ) tqFatal("\"pin\" is not an element");
TQDomElement pin = child.toElement(); TQDomElement pin = child.toElement();
bool ok; bool ok;
uint i = pin.attribute("index").toUInt(&ok); uint i = pin.attribute("index").toUInt(&ok);
if ( !ok || i==0 || i>nb ) qFatal("Malformed pin index"); if ( !ok || i==0 || i>nb ) tqFatal("Malformed pin index");
if (found[i-1]) qFatal("Duplicated pin index"); if (found[i-1]) tqFatal("Duplicated pin index");
found[i-1] = true; found[i-1] = true;
TQString name = pin.attribute("name"); TQString name = pin.attribute("name");
if ( !name.isEmpty() && name!="N/C" ) { if ( !name.isEmpty() && name!="N/C" ) {
TQStringList labels = TQStringList::split("/", name); TQStringList labels = TQStringList::split("/", name);
if ( name.contains(" ") || labels.count()==0 ) qFatal("Malformed pin name"); if ( name.contains(" ") || labels.count()==0 ) tqFatal("Malformed pin name");
if ( name!=name.upper() ) qFatal("Pin name should be uppercase"); if ( name!=name.upper() ) tqFatal("Pin name should be uppercase");
} }
package.pins[i-1] = name; package.pins[i-1] = name;
have_pins = true; have_pins = true;
@ -234,7 +234,7 @@ Device::Package Device::XmlToDataBase::processPackage(TQDomElement element)
child = child.nextSibling(); child = child.nextSibling();
} }
if ( !have_pins ) ;//warning("Pins not specified"); // #### REMOVE ME !! if ( !have_pins ) ;//warning("Pins not specified"); // #### REMOVE ME !!
else for (uint i=0; i<nb; i++) if ( !found[i] ) qFatal(TQString("Pin #%1 not specified").arg(i+1)); else for (uint i=0; i<nb; i++) if ( !found[i] ) tqFatal(TQString("Pin #%1 not specified").arg(i+1));
return package; return package;
} }
@ -246,7 +246,7 @@ void Device::XmlToDataBase::parse()
_data = 0; _data = 0;
TQDomDocument doc = parseFile(files[i]); TQDomDocument doc = parseFile(files[i]);
TQDomElement root = doc.documentElement(); TQDomElement root = doc.documentElement();
if ( root.nodeName()!="device" ) qFatal("root node should be \"device\""); if ( root.nodeName()!="device" ) tqFatal("root node should be \"device\"");
processDevice(root); processDevice(root);
} }
@ -255,6 +255,6 @@ void Device::XmlToDataBase::parse()
for (; ait!=_alternatives.end(); ++ait) { for (; ait!=_alternatives.end(); ++ait) {
TQStringList::const_iterator lit = ait.data().begin(); TQStringList::const_iterator lit = ait.data().begin();
for (; lit!=ait.data().end(); ++lit) for (; lit!=ait.data().end(); ++lit)
if ( !_map.contains(*lit) ) qFatal(TQString("Unknown alternative %1 for device %2").arg((*lit)).arg(ait.key())); if ( !_map.contains(*lit) ) tqFatal(TQString("Unknown alternative %1 for device %2").arg((*lit)).arg(ait.key()));
} }
} }

@ -58,22 +58,22 @@ Group::Support ExtXmlToData<Data>::extractSupport(const TQString &s) const
{ {
if ( s.isEmpty() ) return Group::Support::Untested; if ( s.isEmpty() ) return Group::Support::Untested;
Group::Support support = Group::Support::fromKey(s); Group::Support support = Group::Support::fromKey(s);
if ( support==Group::Support::None ) qFatal("Cannot be \"not supported\""); if ( support==Group::Support::None ) tqFatal("Cannot be \"not supported\"");
if ( support==Group::Support::Nb_Types ) qFatal("Unknown support type"); if ( support==Group::Support::Nb_Types ) tqFatal("Unknown support type");
return support; return support;
} }
template <class Data> template <class Data>
void ExtXmlToData<Data>::parseDevice(TQDomElement element) void ExtXmlToData<Data>::parseDevice(TQDomElement element)
{ {
if ( element.nodeName()!="device" ) qFatal("Root node child should be named \"device\""); if ( element.nodeName()!="device" ) tqFatal("Root node child should be named \"device\"");
_current = element.attribute("name").upper(); _current = element.attribute("name").upper();
if ( Device::lister().data(_current)==0 ) qFatal(TQString("Device name \"%1\" unknown").arg(_current)); if ( Device::lister().data(_current)==0 ) tqFatal(TQString("Device name \"%1\" unknown").arg(_current));
if ( _map.contains(_current) ) qFatal(TQString("Device \"%1\" already parsed").arg(_current)); if ( _map.contains(_current) ) tqFatal(TQString("Device \"%1\" already parsed").arg(_current));
PData data; PData data;
if ( hasFamilies() ) { if ( hasFamilies() ) {
TQString family = element.attribute("family"); TQString family = element.attribute("family");
if ( family.isEmpty() ) qFatal(TQString("Family is empty").arg(family)); if ( family.isEmpty() ) tqFatal(TQString("Family is empty").arg(family));
if ( _families.find(family)==_families.end() ) _families.append(family); if ( _families.find(family)==_families.end() ) _families.append(family);
data.family = familyIndex(family); data.family = familyIndex(family);
} }
@ -87,13 +87,13 @@ void ExtXmlToData<Data>::parse()
{ {
TQDomDocument doc = parseFile(_basename + ".xml"); TQDomDocument doc = parseFile(_basename + ".xml");
TQDomElement root = doc.documentElement(); TQDomElement root = doc.documentElement();
if ( root.nodeName()!="type" ) qFatal("Root node should be \"type\""); if ( root.nodeName()!="type" ) tqFatal("Root node should be \"type\"");
if ( root.attribute("name")!=_basename ) qFatal(TQString("Root node name is not \"%1\"").arg(_basename)); if ( root.attribute("name")!=_basename ) tqFatal(TQString("Root node name is not \"%1\"").arg(_basename));
TQDomNode child = root.firstChild(); TQDomNode child = root.firstChild();
while ( !child.isNull() ) { while ( !child.isNull() ) {
if ( child.isComment() ) qDebug("comment: %s", child.toComment().data().latin1()); if ( child.isComment() ) tqDebug("comment: %s", child.toComment().data().latin1());
else { else {
if ( !child.isElement() ) qFatal("Root node child should be an element"); if ( !child.isElement() ) tqFatal("Root node child should be an element");
parseDevice(child.toElement()); parseDevice(child.toElement());
} }
child = child.nextSibling(); child = child.nextSibling();
@ -105,7 +105,7 @@ void ExtXmlToData<Data>::output()
{ {
// write .cpp file // write .cpp file
TQFile file(_basename + "_data.cpp"); TQFile file(_basename + "_data.cpp");
if ( !file.open(IO_WriteOnly) ) qFatal(TQString("Cannot open output file \"%1\"").arg(file.name())); if ( !file.open(IO_WriteOnly) ) tqFatal(TQString("Cannot open output file \"%1\"").arg(file.name()));
TQTextStream s(&file); TQTextStream s(&file);
s << "// #### Do not edit: this file is autogenerated !!!" << endl << endl; s << "// #### Do not edit: this file is autogenerated !!!" << endl << endl;
s << "#include \"devices/list/device_list.h\"" << endl; s << "#include \"devices/list/device_list.h\"" << endl;

@ -19,7 +19,7 @@ TQDomElement XmlToData::findUniqueElement(TQDomElement parent, const TQString &t
while ( !child.isNull() ) { while ( !child.isNull() ) {
if ( child.nodeName()==tag && child.isElement() if ( child.nodeName()==tag && child.isElement()
&& (attribute.isEmpty() || child.toElement().attribute(attribute)==value) ) { && (attribute.isEmpty() || child.toElement().attribute(attribute)==value) ) {
if ( !element.isNull() ) qFatal(TQString("Duplicated element \"%1/%2\"").arg(tag).arg(value)); if ( !element.isNull() ) tqFatal(TQString("Duplicated element \"%1/%2\"").arg(tag).arg(value));
element = child.toElement(); element = child.toElement();
} }
child = child.nextSibling(); child = child.nextSibling();
@ -34,38 +34,38 @@ void XmlToData::checkTagNames(TQDomElement element, const TQString &tag,
for (uint i=0; i<uint(list.count()); i++) { for (uint i=0; i<uint(list.count()); i++) {
if ( !list.item(i).isElement() ) continue; if ( !list.item(i).isElement() ) continue;
TQString name = list.item(i).toElement().attribute("name"); TQString name = list.item(i).toElement().attribute("name");
if ( names.find(name)==names.end() ) qFatal(TQString("Illegal name %1 for %2 element").arg(name).arg(tag)); if ( names.find(name)==names.end() ) tqFatal(TQString("Illegal name %1 for %2 element").arg(name).arg(tag));
} }
} }
TQDomDocument XmlToData::parseFile(const TQString &filename) const TQDomDocument XmlToData::parseFile(const TQString &filename) const
{ {
qDebug("Parsing XML file \"%s\"...", filename.latin1()); tqDebug("Parsing XML file \"%s\"...", filename.latin1());
TQFile file(filename); TQFile file(filename);
if ( !file.open(IO_ReadOnly) ) qFatal("Cannot open file!"); if ( !file.open(IO_ReadOnly) ) tqFatal("Cannot open file!");
TQDomDocument doc; TQDomDocument doc;
TQString error; TQString error;
int errorLine, errorColumn; int errorLine, errorColumn;
if ( !doc.setContent(&file, false, &error, &errorLine, &errorColumn) ) if ( !doc.setContent(&file, false, &error, &errorLine, &errorColumn) )
qFatal(TQString("Error parsing XML file (%1 at line %2, column %3)").arg(error).arg(errorLine).arg(errorColumn)); tqFatal(TQString("Error parsing XML file (%1 at line %2, column %3)").arg(error).arg(errorLine).arg(errorColumn));
return doc; return doc;
} }
void XmlToData::warning(const TQString &message) const void XmlToData::warning(const TQString &message) const
{ {
if ( currentDevice().isEmpty() ) ::qWarning("Warning: %s", message.latin1()); if ( currentDevice().isEmpty() ) ::tqWarning("Warning: %s", message.latin1());
else ::qWarning("Warning [%s]: %s", currentDevice().latin1(), message.latin1()); else ::tqWarning("Warning [%s]: %s", currentDevice().latin1(), message.latin1());
} }
void XmlToData::qFatal(const TQString &message) const void XmlToData::tqFatal(const TQString &message) const
{ {
if ( currentDevice().isEmpty() ) ::qFatal("Fatal: %s", message.latin1()); if ( currentDevice().isEmpty() ) ::tqFatal("Fatal: %s", message.latin1());
else ::qFatal("Fatal [%s]: %s", currentDevice().latin1(), message.latin1()); else ::tqFatal("Fatal [%s]: %s", currentDevice().latin1(), message.latin1());
} }
void XmlToData::process() void XmlToData::process()
{ {
parse(); parse();
qDebug("Parsing XML successful."); tqDebug("Parsing XML successful.");
output(); output();
qDebug("Output written."); tqDebug("Output written.");
} }

@ -25,7 +25,7 @@ protected:
virtual void output() = 0; virtual void output() = 0;
virtual TQString currentDevice() const = 0; virtual TQString currentDevice() const = 0;
virtual void warning(const TQString &message) const; virtual void warning(const TQString &message) const;
virtual void qFatal(const TQString &message) const; virtual void tqFatal(const TQString &message) const;
TQDomElement findUniqueElement(TQDomElement parent, const TQString &nodeName, TQDomElement findUniqueElement(TQDomElement parent, const TQString &nodeName,
const TQString &attribute, const TQString &value) const; const TQString &attribute, const TQString &value) const;
void checkTagNames(TQDomElement element, const TQString &tag, const TQStringList &names) const; void checkTagNames(TQDomElement element, const TQString &tag, const TQStringList &names) const;

Loading…
Cancel
Save