//---------------------------------------------------------------------------- void LayMap::addCriticalPoints(Clst &c,short *mtx) // // adds points belonging to critical area and laying under mirror axis // if it's really critical { int ver=imageMap->rows, hor=imageMap->cols; List& list=c.criticalPoints; int x=c.cX,y=c.cY; ArrayIterator aIter(imageMap->criLines); for(;(Item&)aIter != NOITEM;aIter++) { List &criLine = (List&)(Item&)aIter; ListIterator criIter(criLine); for(;(Item&)criIter != NOITEM;criIter++) { CriCandidate &cp = (CriCandidate&)(Item&)criIter; if (cp.neighbors == 0 || (cp.neighbors & c.pattern)!= cp.neighbors) { // we don't have to check points laying // on mirror axis between two sectors // taken by this cell or belonging // to critical universal feeds laying // inside this cell // cp.neighbors in this place contains set of // bits on positions of sectors on // both sides of axis for restricted feed // or sectors to which belong critical // universal feed int net=findNetId(x*hor+cp.x,y*ver+cp.y,layerType(cp.layer),mtx); if (net != 0) // this point is connected // to one of terminals { CriPoint &newCp = * new CriPoint(cp.x,cp.y,layerType(cp.layer),net); if ( ! list.hasItem( newCp) ) list.add( newCp ); else delete (void*)&newCp; } } } } }// LayMap::addCriticalPoints //
void TerminateKilledThreads() { static bool once = false; if (!once) { if (fgThreads.GetSize()) { SystemLog::Warning("mtfoundation: following threads were still active !!"); String strbuf; StringStream stream(strbuf); fgThreads.PrintOn(stream) << "\n"; stream.flush(); SystemLog::WriteToStderr(strbuf); AnyExtensions::Iterator<ROAnything> aIter(fgThreads); ROAnything aAny; while (aIter.Next(aAny)) { Thread *pThr = (Thread *)aAny["Addr"].AsIFAObject(); SystemLog::Warning(String(" Thread[") << aAny["Name"].AsString() << "] Handle[" << aAny["id"].AsLong() << "] Addr [" << (long)aAny["Addr"].AsIFAObject() << "]"); if (pThr && pThr->IsAlive()) { pThr->IntSetState(Thread::eTerminationRequested); } } } once = true; } }
//---------------------------------------------------------------------------- void LayMap::recognizeTerminals() // // Recognizes terminals of this layout : Each gets a number. When a terminal // name is one of user defined "free" nets then number = position in array+2. // It's because in map 0 means "no terminal" and "1" "contrained" net, // otherwise number == 1. { for(LAYPORT *pPtr=layout->layport;pPtr!=NULL;pPtr=pPtr->next) { ArrayIterator aIter(*freeNets); int pos=0; for(;(Item&)aIter != NOITEM;aIter++,pos++) { CriNet &net = (CriNet&)(Item&)aIter; if ( pPtr->cirport->name == net.name ) break; } if((Item&)aIter == NOITEM) // no such name => "constrained" net pPtr->flag.l=1; else pPtr->flag.l=pos+2; } }// LayMap::recognizeTerminals //
int XmpParser::decode( XmpData& xmpData, const std::string& xmpPacket) { try { xmpData.clear(); if (xmpPacket.empty()) return 0; if (!initialize()) { #ifndef SUPPRESS_WARNINGS std::cerr << "XMP Toolkit initialization failed.\n"; #endif return 2; } SXMPMeta meta(xmpPacket.data(), static_cast<XMP_StringLen>(xmpPacket.size())); SXMPIterator iter(meta); std::string schemaNs, propPath, propValue; XMP_OptionBits opt; while (iter.Next(&schemaNs, &propPath, &propValue, &opt)) { #ifdef DEBUG printNode(schemaNs, propPath, propValue, opt); #endif if (XMP_PropIsAlias(opt)) { throw Error(47, schemaNs, propPath, propValue); continue; } if (XMP_NodeIsSchema(opt)) { // Register unknown namespaces with Exiv2 // (Namespaces are automatically registered with the XMP Toolkit) if (XmpProperties::prefix(schemaNs).empty()) { std::string prefix; bool ret = meta.GetNamespacePrefix(schemaNs.c_str(), &prefix); if (!ret) throw Error(45, schemaNs); prefix = prefix.substr(0, prefix.size() - 1); XmpProperties::registerNs(schemaNs, prefix); } continue; } XmpKey::AutoPtr key = makeXmpKey(schemaNs, propPath); if (XMP_ArrayIsAltText(opt)) { // Read Lang Alt property LangAltValue::AutoPtr val(new LangAltValue); XMP_Index count = meta.CountArrayItems(schemaNs.c_str(), propPath.c_str()); while (count-- > 0) { // Get the text bool haveNext = iter.Next(&schemaNs, &propPath, &propValue, &opt); #ifdef DEBUG printNode(schemaNs, propPath, propValue, opt); #endif if ( !haveNext || !XMP_PropIsSimple(opt) || !XMP_PropHasLang(opt)) { throw Error(41, propPath, opt); } const std::string text = propValue; // Get the language qualifier haveNext = iter.Next(&schemaNs, &propPath, &propValue, &opt); #ifdef DEBUG printNode(schemaNs, propPath, propValue, opt); #endif if ( !haveNext || !XMP_PropIsSimple(opt) || !XMP_PropIsQualifier(opt) || propPath.substr(propPath.size() - 8, 8) != "xml:lang") { throw Error(42, propPath, opt); } val->value_[propValue] = text; } xmpData.add(*key.get(), val.get()); continue; } if ( XMP_PropIsArray(opt) && !XMP_PropHasQualifiers(opt) && !XMP_ArrayIsAltText(opt)) { // Check if all elements are simple bool simpleArray = true; SXMPIterator aIter(meta, schemaNs.c_str(), propPath.c_str()); std::string aSchemaNs, aPropPath, aPropValue; XMP_OptionBits aOpt; while (aIter.Next(&aSchemaNs, &aPropPath, &aPropValue, &aOpt)) { if (propPath == aPropPath) continue; if ( !XMP_PropIsSimple(aOpt) || XMP_PropHasQualifiers(aOpt) || XMP_PropIsQualifier(aOpt) || XMP_NodeIsSchema(aOpt) || XMP_PropIsAlias(aOpt)) { simpleArray = false; break; } } if (simpleArray) { // Read the array into an XmpArrayValue XmpArrayValue::AutoPtr val(new XmpArrayValue(arrayValueTypeId(opt))); XMP_Index count = meta.CountArrayItems(schemaNs.c_str(), propPath.c_str()); while (count-- > 0) { iter.Next(&schemaNs, &propPath, &propValue, &opt); #ifdef DEBUG printNode(schemaNs, propPath, propValue, opt); #endif val->read(propValue); } xmpData.add(*key.get(), val.get()); continue; } } XmpTextValue::AutoPtr val(new XmpTextValue); if ( XMP_PropIsStruct(opt) || XMP_PropIsArray(opt)) { // Create a metadatum with only XMP options val->setXmpArrayType(xmpArrayType(opt)); val->setXmpStruct(xmpStruct(opt)); xmpData.add(*key.get(), val.get()); continue; } if ( XMP_PropIsSimple(opt) || XMP_PropIsQualifier(opt)) { val->read(propValue); xmpData.add(*key.get(), val.get()); continue; } // Don't let any node go by unnoticed throw Error(39, key->key(), opt); } // iterate through all XMP nodes return 0; } catch (const XMP_Error& e) { #ifndef SUPPRESS_WARNINGS std::cerr << Error(40, e.GetID(), e.GetErrMsg()) << "\n"; #endif xmpData.clear(); return 3; }} // XmpParser::decode