diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-03-01 13:22:13 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-03-01 13:22:13 -0600 |
commit | 9abf98be4f3111c54f13dcb44902a275bd2d7169 (patch) | |
tree | d6771816657222c79deae56c23c2d6339cba27e3 /src/xml_to_data | |
parent | 2b18f76290022900fe896ebac6b2b6da30a9f136 (diff) | |
download | piklab-9abf98be4f3111c54f13dcb44902a275bd2d7169.tar.gz piklab-9abf98be4f3111c54f13dcb44902a275bd2d7169.zip |
Rename additional global TQt functions
Diffstat (limited to 'src/xml_to_data')
-rw-r--r-- | src/xml_to_data/device_xml_to_data.cpp | 80 | ||||
-rw-r--r-- | src/xml_to_data/prog_xml_to_data.h | 22 | ||||
-rw-r--r-- | src/xml_to_data/xml_to_data.cpp | 24 | ||||
-rw-r--r-- | src/xml_to_data/xml_to_data.h | 2 |
4 files changed, 64 insertions, 64 deletions
diff --git a/src/xml_to_data/device_xml_to_data.cpp b/src/xml_to_data/device_xml_to_data.cpp index 3f0dcc0..5ad40a5 100644 --- a/src/xml_to_data/device_xml_to_data.cpp +++ b/src/xml_to_data/device_xml_to_data.cpp @@ -18,12 +18,12 @@ bool Device::XmlToDataBase::getFrequencyRange(OperatingCondition oc, Special spe TQDomElement range; for (TQDomNode child=element.firstChild(); !child.isNull(); child=child.nextSibling()) { 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; 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 ( !range.isNull() ) qFatal("Duplicated \"frequency_range\""); + if ( !range.isNull() ) tqFatal("Duplicated \"frequency_range\""); range = child.toElement(); } if ( range.isNull() ) return false; @@ -32,7 +32,7 @@ bool Device::XmlToDataBase::getFrequencyRange(OperatingCondition oc, Special spe frange.special = special; for (TQDomNode child=range.firstChild(); !child.isNull(); child=child.nextSibling()) { 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(); bool ok1, ok2, ok3, ok4; RangeBox box; @@ -44,11 +44,11 @@ bool Device::XmlToDataBase::getFrequencyRange(OperatingCondition oc, Special spe if ( !ok1 || !ok2 || !ok3 || !ok4 || box.start.x<0.0 || box.start.x>box.end.x || 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; else { 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.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++) 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() ) - qFatal("Overlapping frequency ranges"); + tqFatal("Overlapping frequency ranges"); 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], // box.start.x, box.start.yMin, box.start.yMax, // box.end.x, box.end.yMin, box.end.yMax); 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); return true; } @@ -76,15 +76,15 @@ bool Device::XmlToDataBase::getMemoryTechnology(TQDomElement element) TQString s = element.attribute("memory_technology"); _data->_memoryTechnology = MemoryTechnology::fromKey(s); if ( _data->_memoryTechnology!=MemoryTechnology::Nb_Types ) return true; - if ( !s.isNull() ) qFatal("Unrecognized memory technology"); + if ( !s.isNull() ) tqFatal("Unrecognized memory technology"); return false; } void Device::XmlToDataBase::processDevice(TQDomElement device) { TQString name = device.attribute("name").upper(); - if ( name.isEmpty() ) qFatal("Device has no name"); - if ( _map.contains(name) ) qFatal(TQString("Device \"%1\" already defined").arg(name)); + if ( name.isEmpty() ) tqFatal("Device has no name"); + if ( _map.contains(name) ) tqFatal(TQString("Device \"%1\" already defined").arg(name)); _data = createData(); _map[name] = _data; _data->_name = name; @@ -93,10 +93,10 @@ void Device::XmlToDataBase::processDevice(TQDomElement device) _data->_status = Status::fromKey(device.attribute("status")); switch (_data->_status.type()) { case Status::Nb_Types: - qFatal("Unrecognized or absent device status"); + tqFatal("Unrecognized or absent device status"); break; case Status::Future: - if ( _data->_alternatives.count() ) qFatal("Future device has alternative"); + if ( _data->_alternatives.count() ) tqFatal("Future device has alternative"); break; case Status::NotRecommended: case Status::Mature: @@ -111,34 +111,34 @@ void Device::XmlToDataBase::processDevice(TQDomElement device) _data->_documents.webpage = device.attribute("document"); // ### REMOVE ME TQDomElement documents = findUniqueElement(device, "documents", TQString(), TQString()); if ( documents.isNull() ) { - if ( _data->_documents.webpage.isEmpty() ) qFatal("Missing \"documents\" element"); + if ( _data->_documents.webpage.isEmpty() ) tqFatal("Missing \"documents\" element"); } 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"); - if ( _data->_documents.webpage.isEmpty() ) qFatal("Missing webpage"); + if ( _data->_documents.webpage.isEmpty() ) tqFatal("Missing webpage"); _data->_documents.datasheet = documents.attribute("datasheet"); TQRegExp rexp("\\d{5}"); 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"); 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")); for (uint i=0; i<uint(_data->_documents.erratas.count()); i++) { TQString errata = _data->_documents.erratas[i]; if ( !rexp.exactMatch(errata) ) { TQRegExp rexp2("\\d{5}e\\d"); 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"); else { 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) ) - 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; } @@ -150,11 +150,11 @@ void Device::XmlToDataBase::processDevice(TQDomElement device) FOR_EACH(Special, special) 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); // memory technology - if ( !getMemoryTechnology(device) ) qFatal("Memory technology not defined"); + if ( !getMemoryTechnology(device) ) tqFatal("Memory technology not defined"); // packages 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 l=0; l<uint(p.types.count()); l++) 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); _data->_packages.append(p); } @@ -184,49 +184,49 @@ Device::Package Device::XmlToDataBase::processPackage(TQDomElement element) // nb pins bool 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); // 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++) { uint i = 0; for (; Package::TYPE_DATA[i].name; i++) { if ( types[k]!=Package::TYPE_DATA[i].name ) continue; 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; for (; j<Package::MAX_NB; j++) 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); 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 TQString name = Package::TYPE_DATA[package.types[0]].name; if ( name=="sot23" ) { - if ( package.types.count()!=1 ) qFatal("SOT23 should be a specific package"); - } else if ( (nb%2)!=0 ) qFatal(TQString("\"nb_pins\" should be even for package \"%1\"").arg(name)); + if ( package.types.count()!=1 ) tqFatal("SOT23 should be a specific package"); + } else if ( (nb%2)!=0 ) tqFatal(TQString("\"nb_pins\" should be even for package \"%1\"").arg(name)); uint have_pins = false; TQMemArray<bool> found(nb); found.fill(false); TQDomNode child = element.firstChild(); while ( !child.isNull() ) { 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(); bool ok; uint i = pin.attribute("index").toUInt(&ok); - if ( !ok || i==0 || i>nb ) qFatal("Malformed pin index"); - if (found[i-1]) qFatal("Duplicated pin index"); + if ( !ok || i==0 || i>nb ) tqFatal("Malformed pin index"); + if (found[i-1]) tqFatal("Duplicated pin index"); found[i-1] = true; TQString name = pin.attribute("name"); if ( !name.isEmpty() && name!="N/C" ) { TQStringList labels = TQStringList::split("/", name); - if ( name.contains(" ") || labels.count()==0 ) qFatal("Malformed pin name"); - if ( name!=name.upper() ) qFatal("Pin name should be uppercase"); + if ( name.contains(" ") || labels.count()==0 ) tqFatal("Malformed pin name"); + if ( name!=name.upper() ) tqFatal("Pin name should be uppercase"); } package.pins[i-1] = name; have_pins = true; @@ -234,7 +234,7 @@ Device::Package Device::XmlToDataBase::processPackage(TQDomElement element) child = child.nextSibling(); } 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; } @@ -246,7 +246,7 @@ void Device::XmlToDataBase::parse() _data = 0; TQDomDocument doc = parseFile(files[i]); 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); } @@ -255,6 +255,6 @@ void Device::XmlToDataBase::parse() for (; ait!=_alternatives.end(); ++ait) { TQStringList::const_iterator lit = ait.data().begin(); 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())); } } diff --git a/src/xml_to_data/prog_xml_to_data.h b/src/xml_to_data/prog_xml_to_data.h index 4995e1e..bcca9da 100644 --- a/src/xml_to_data/prog_xml_to_data.h +++ b/src/xml_to_data/prog_xml_to_data.h @@ -58,22 +58,22 @@ Group::Support ExtXmlToData<Data>::extractSupport(const TQString &s) const { if ( s.isEmpty() ) return Group::Support::Untested; Group::Support support = Group::Support::fromKey(s); - if ( support==Group::Support::None ) qFatal("Cannot be \"not supported\""); - if ( support==Group::Support::Nb_Types ) qFatal("Unknown support type"); + if ( support==Group::Support::None ) tqFatal("Cannot be \"not supported\""); + if ( support==Group::Support::Nb_Types ) tqFatal("Unknown support type"); return support; } template <class Data> 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(); - if ( Device::lister().data(_current)==0 ) qFatal(TQString("Device name \"%1\" unknown").arg(_current)); - if ( _map.contains(_current) ) qFatal(TQString("Device \"%1\" already parsed").arg(_current)); + if ( Device::lister().data(_current)==0 ) tqFatal(TQString("Device name \"%1\" unknown").arg(_current)); + if ( _map.contains(_current) ) tqFatal(TQString("Device \"%1\" already parsed").arg(_current)); PData data; if ( hasFamilies() ) { 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); data.family = familyIndex(family); } @@ -87,13 +87,13 @@ void ExtXmlToData<Data>::parse() { TQDomDocument doc = parseFile(_basename + ".xml"); TQDomElement root = doc.documentElement(); - if ( root.nodeName()!="type" ) qFatal("Root node should be \"type\""); - if ( root.attribute("name")!=_basename ) qFatal(TQString("Root node name is not \"%1\"").arg(_basename)); + if ( root.nodeName()!="type" ) tqFatal("Root node should be \"type\""); + if ( root.attribute("name")!=_basename ) tqFatal(TQString("Root node name is not \"%1\"").arg(_basename)); TQDomNode child = root.firstChild(); while ( !child.isNull() ) { - if ( child.isComment() ) qDebug("comment: %s", child.toComment().data().latin1()); + if ( child.isComment() ) tqDebug("comment: %s", child.toComment().data().latin1()); 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()); } child = child.nextSibling(); @@ -105,7 +105,7 @@ void ExtXmlToData<Data>::output() { // write .cpp file 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); s << "// #### Do not edit: this file is autogenerated !!!" << endl << endl; s << "#include \"devices/list/device_list.h\"" << endl; diff --git a/src/xml_to_data/xml_to_data.cpp b/src/xml_to_data/xml_to_data.cpp index 8176be1..ef41a8d 100644 --- a/src/xml_to_data/xml_to_data.cpp +++ b/src/xml_to_data/xml_to_data.cpp @@ -19,7 +19,7 @@ TQDomElement XmlToData::findUniqueElement(TQDomElement parent, const TQString &t while ( !child.isNull() ) { if ( child.nodeName()==tag && child.isElement() && (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(); } child = child.nextSibling(); @@ -34,38 +34,38 @@ void XmlToData::checkTagNames(TQDomElement element, const TQString &tag, for (uint i=0; i<uint(list.count()); i++) { if ( !list.item(i).isElement() ) continue; 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 { - qDebug("Parsing XML file \"%s\"...", filename.latin1()); + tqDebug("Parsing XML file \"%s\"...", filename.latin1()); TQFile file(filename); - if ( !file.open(IO_ReadOnly) ) qFatal("Cannot open file!"); + if ( !file.open(IO_ReadOnly) ) tqFatal("Cannot open file!"); TQDomDocument doc; TQString error; int 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; } void XmlToData::warning(const TQString &message) const { - if ( currentDevice().isEmpty() ) ::qWarning("Warning: %s", message.latin1()); - else ::qWarning("Warning [%s]: %s", currentDevice().latin1(), message.latin1()); + if ( currentDevice().isEmpty() ) ::tqWarning("Warning: %s", 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()); - else ::qFatal("Fatal [%s]: %s", currentDevice().latin1(), message.latin1()); + if ( currentDevice().isEmpty() ) ::tqFatal("Fatal: %s", message.latin1()); + else ::tqFatal("Fatal [%s]: %s", currentDevice().latin1(), message.latin1()); } void XmlToData::process() { parse(); - qDebug("Parsing XML successful."); + tqDebug("Parsing XML successful."); output(); - qDebug("Output written."); + tqDebug("Output written."); } diff --git a/src/xml_to_data/xml_to_data.h b/src/xml_to_data/xml_to_data.h index 5630f1b..1b45ea6 100644 --- a/src/xml_to_data/xml_to_data.h +++ b/src/xml_to_data/xml_to_data.h @@ -25,7 +25,7 @@ protected: virtual void output() = 0; virtual TQString currentDevice() const = 0; 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, const TQString &attribute, const TQString &value) const; void checkTagNames(TQDomElement element, const TQString &tag, const TQStringList &names) const; |