void Spreadsheet::setUp(const FactControl & x) { const GBList<int> & V = x.indicesOfPermanentFacts(); GBList<int>::const_iterator w = V.begin(); const int n = V.size(); //GBStream << "#:rules:" << n << '\n'; d_rules.reserve(n); for(int i=0;i<n;++i,++w) { int j = *w; const GroebnerRule & r = x.fact(j); VariableSet variables; d_rules.push_back(r); int nfac = r.LHS().numberOfFactors(); if(nfac==1) { d_singleRules.push_back(r); d_singleVariables.insert(*(r.LHS().begin())); d_digested.push_back(i); } else { GrabVariables(r,variables); VariableSet knownvariables,unknownvariables; ((AdmWithLevels *)d_order)->sortIntoKnownsAndUnknowns( variables,knownvariables,unknownvariables); Categories * ptr = findCategory(unknownvariables); if(!ptr) { RECORDHERE(ptr = new Categories(); ) ptr->addUnknowns(unknownvariables); addCategory(*ptr); RECORDHERE(delete ptr;) ptr = findCategory(unknownvariables); if(!ptr) DBG(); };
Preset* Set::findPreset(int hbank, int lbank, int prog) { Category* c=findCategory(hbank); if(c) { Preset* p=c->findPreset(lbank, prog); if(p) return(p); } return NULL; }
//--------------------------------------------------------- // findSubcategory // take hbank and lbank and return the subcategory corresponding, // NULL if doesn't exist //--------------------------------------------------------- Subcategory* Set::findSubcategory(int hbank, int lbank) { Category* c = findCategory(hbank); Subcategory* s; if(c) { s = c->findSubcategory(lbank); return s; } else return NULL; }
//-------------------------------------------------------------- // Set::merge //-------------------------------------------------------------- void Set::merge(Category* c) { if(isFreeHBank(c->_hbank)) c->linkSet(this); else { Category* cFromSet=findCategory(c->_hbank); cFromSet->_categoryName=c->_categoryName; for(std::vector<Subcategory*>::iterator i=c->_subcategoryVector.begin(); i!=c->_subcategoryVector.end(); i++) cFromSet->merge(*i); //delete(c); } }
///------------------------------------------------------------- void CXMLAnalyser::addCategory( int category, const QString &text ) ///------------------------------------------------------------- { QList< CXMLAnalyser::SCategoryInfo >::iterator iter = findCategory( category ); if ( true != text.isEmpty( ) ) { if ( iter != mResult.end( ) ) { iter->mEntries.push_back( text ); } else { SCategoryInfo info; info.mCategory = category; info.mEntries.push_back( text ); mResult.push_back( info ); } } }
bool SpecialCaseList::findCategory(const Module &M, StringRef &Category) const { return findCategory("src", M.getModuleIdentifier(), Category); }
bool SpecialCaseList::findCategory(const GlobalVariable &G, StringRef &Category) const { return findCategory(*G.getParent(), Category) || findCategory("global", G.getName(), Category) || findCategory("type", GetGVTypeString(G), Category); }
bool SpecialCaseList::findCategory(const Function &F, StringRef &Category) const { return findCategory(*F.getParent(), Category) || findCategory("fun", F.getName(), Category); }
//--------------------------------------------------------- // isFreeHBank, firstFreeHBank -1 otherwise //--------------------------------------------------------- bool Set::isFreeHBank(int hbank) { if(findCategory(hbank)) return(false); else return(true); }