// update service data when process moved from m0 to m void Service::updateWithProcessReassign(Process* p, Machine* m0, Machine* m) { if(m0 == 0) // process was not assigned { if(m != 0) { addLocation(m->getLocation()); addNeighborhood(m->getNeighborhood()); number_of_processes_in_location_[m->getLocation()->getId()] ++; number_of_processes_in_neighborhood_[m->getNeighborhood()->getId()] ++; } if(p->getInitialMachine() == m) number_of_moved_processes_ --; } else { if(m == 0) { removeLocation(m0->getLocation()); number_of_processes_in_location_[m0->getLocation()->getId()] --; } else if(m->getLocation() != m0->getLocation()) { addLocation(m->getLocation()); number_of_processes_in_location_[m->getLocation()->getId()] ++; removeLocation(m0->getLocation()); number_of_processes_in_location_[m0->getLocation()->getId()] --; } if(m == 0) { removeNeighborhood(m0->getNeighborhood()); number_of_processes_in_neighborhood_[m0->getNeighborhood()->getId()] --; } else if(m->getNeighborhood() != m0->getNeighborhood()) { addNeighborhood(m->getNeighborhood()); number_of_processes_in_neighborhood_[m->getNeighborhood()->getId()] ++; removeNeighborhood(m0->getNeighborhood()); number_of_processes_in_neighborhood_[m0->getNeighborhood()->getId()] --; } if(m == 0) { //number_of_moved_processes_ ++; } else if(p->getInitialMachine() == m0 && p->getInitialMachine() != m) number_of_moved_processes_ ++; else if(p->getInitialMachine() == m && p->getInitialMachine() != m0) number_of_moved_processes_ --; } }
/*! * \brief LocationsFactory::LocationsFactory() * \param parent * * Locations emit needsAuthentication() signal, the connection * with LocationsFactory is Direct, but the connection between * the Location and the \ref DirModel is Queued * \sa Location::notifyItemNeedsAuthentication() */ LocationsFactory::LocationsFactory(QObject *parent) : QObject(parent) , m_curLoc(0) , m_lastValidFileInfo(0) , m_authDataStore(NetAuthenticationDataList::getInstance(this)) , m_lastUrlNeedsAuthentication(false) { addLocation(new DiskLocation(Location::LocalDisk)); addLocation(new TrashLocation(Location::TrashDisk)); #if ENABLE_SMBCLIENT addLocation(new SmbLocation(Location::NetSambaShare)); #endif }
//--------------------------------------------------------- void DocumentXML::addLocationRange(const SourceRange& R) { PresumedLoc PStartLoc = addLocation(R.getBegin()); if (R.getBegin() != R.getEnd()) { SourceManager& SM = Ctx->getSourceManager(); SourceLocation SpellingLoc = SM.getSpellingLoc(R.getEnd()); if (!SpellingLoc.isInvalid()) { PresumedLoc PLoc = SM.getPresumedLoc(SpellingLoc); if (PStartLoc.isInvalid() || strcmp(PLoc.getFilename(), PStartLoc.getFilename()) != 0) { addToMap(SourceFiles, PLoc.getFilename(), ID_FILE); addAttribute("endfile", PLoc.getFilename()); addAttribute("endline", PLoc.getLine()); addAttribute("endcol", PLoc.getColumn()); } else if (PLoc.getLine() != PStartLoc.getLine()) { addAttribute("endline", PLoc.getLine()); addAttribute("endcol", PLoc.getColumn()); } else { addAttribute("endcol", PLoc.getColumn()); } } } }
static void insertIOFunc(void) { TreeNode *func; TreeNode *typeSpec; TreeNode *param; TreeNode *compStmt; func = newDeclNode(FuncK); typeSpec = newTypeNode(FuncK); typeSpec->attr.type = INT; func->type = Integer; compStmt = newStmtNode(CompK); compStmt->child[0] = NULL; // no local var compStmt->child[1] = NULL; // no stmt func->lineno = 0; func->attr.name = "input"; func->child[0] = typeSpec; func->child[1] = NULL; // no param func->child[2] = compStmt; st_insert("input", -1, addLocation(), func); func = newDeclNode(FuncK); typeSpec = newTypeNode(FuncK); typeSpec->attr.type = VOID; func->type = Void; param = newParamNode(NonArrParamK); param->attr.name = "arg"; param->child[0] = newTypeNode(FuncK); param->child[0]->attr.type = INT; compStmt = newStmtNode(CompK); compStmt->child[0] = NULL; // no local var compStmt->child[1] = NULL; // no stmt func->lineno = 0; func->attr.name = "output"; func->child[0] = typeSpec; func->child[1] = param; func->child[2] = compStmt; st_insert("output", -1, addLocation(), func); }
void GlobStore::storeAll(int ix) { if (!timeModuleBox->count()) return; if (ix >= (widgetList.count() - 1)) { addLocation(); } emit store(ix); }
void Fishery::load(const VariantMap& stream) { Srvc::load( stream ); VariantMap locations = stream.get( "locations" ).toMap(); foreach( it, locations ) { addLocation( it->second.toTilePos() ); }
void locationListTest(void) { initLocationList(&locationList, (Location(*)[]) &locationListArray, LOCATION_LIST_ARRAY_TEST); Location* locationA; Location* locationB; Location* locationC; Location* locationD; Location* locationE; Location* tmpLocation; // Location* tmpLocation2; // Emtpy Test bool isEmpty = isEmptyLocationList(&locationList); TEST_ASSERT_TRUE(isEmpty); locationA = addLocation(&locationList, "A", 20, 20); locationB = addLocation(&locationList, "B", 10, 30); locationC = addLocation(&locationList, "C", -1, 2); locationD = addLocation(&locationList, "D", -100, 200); locationE = addLocation(&locationList, "E", -10, -50); isEmpty = isEmptyLocationList(&locationList); TEST_ASSERT_FALSE(isEmpty); // getLocationCount unsigned locationCount = getLocationCount(&locationList); TEST_ASSERT_EQUAL(5, locationCount); // findLocationByName tmpLocation = findLocationByName(&locationList, "C"); TEST_ASSERT_EQUAL(locationC, tmpLocation); // locationEquals bool actual = locationEquals(locationA, locationA); TEST_ASSERT_TRUE(actual); actual = locationEquals(locationA, locationC); TEST_ASSERT_FALSE(actual); // getNearestLocation tmpLocation = getNearestLocation(&locationList, -120, 180); TEST_ASSERT_EQUAL(locationD, tmpLocation); }
void ParStore::tempToList(int ix) { if (ix >= list.size()) { list.append(temp); addLocation(); } else { list.replace(ix, temp); } currentRequest = ix; setDispState(ix, 1); }
/* * update_blk - update block info, rehash if pointers are different, * update location info if needed */ static void update_blk(void* p, void* np, size_t size, const char* file, int line) { BlkHdr* bh; if (p != np) { BlkHdr* bh_prev = 0; unsigned long h = hash_ptr(p); /* * remove the old entry from the hash table */ for (bh = bhTab[h]; bh; bh = bh->next) { if (p == bh->buf) { if (0 == bh_prev) bhTab[h] = bh->next; else bh_prev->next = bh->next; /* * put it back in the hash table at hash(np) */ h = hash_ptr(np); bh->next = bhTab[h]; bhTab[h] = bh; break; } bh_prev = bh; } } else bh = find_blk(p); /* * invalid ptr? */ assert(0 != bh); byteCount -= bh->size; byteCount += size; bh->buf = np; bh->size = size; /* * update location info */ if (bh->location->file != file || bh->location->line != line) { if (--bh->location->count == 0) freeLocation(bh->location); if ((bh->location = findLocation(file, line)) == 0) { if ((bh->location = addLocation(file, line)) == 0) noMemFn(); } assert(0 != bh->location); ++bh->location->count; } }
//! if any of the EquivSets end up mapping to the UnknownLoc //! then all EquivSets must be merged void EquivSets::mapAllToUnknown() { // iterate over all mem ref handles we know about // and map them all to the zeroth equiv set OA_ptr<MemRefIterator> memrefIter = getMemRefIter(); for ( ; memrefIter->isValid(); (*memrefIter)++ ) { MemRefHandle memref = memrefIter->current(); mMemRefToSets[memref].clear(); mapMemRefToEquivSet(memref, 0); // clear out the mappings of procedures and equiv sets to locs mProcNSetToLocs.clear(); // for the procedure that the memref occurs within // add the unknown location for the zeroth equiv set OA_ptr<UnknownLoc> unknown; unknown = new UnknownLoc(); addLocation(unknown, mMemRefToProc[memref], 0); } }
int BookInfo::updateNewData( const BookInfo *other) { qDebug() << Q_FUNC_INFO; int updateType = UPDATE_NONE; if(this == other) return updateType; dirty = true; if (title != other->title) { title = other->title; updateType |= UPDATE_METADATA; } if (isbn != other->isbn) { isbn = other->isbn; updateType |= UPDATE_METADATA; } if (author != other->author) { author = other->author; updateType |= UPDATE_METADATA; } if (thumbnail != other->thumbnail) { thumbnail = other->thumbnail; updateType |= UPDATE_METADATA; } if (coverUrl != other->coverUrl) { coverUrl = other->coverUrl; updateType |= UPDATE_METADATA; } if (publishTime != other->publishTime) { publishTime = other->publishTime; updateType |= UPDATE_METADATA; } if (pageCount != other->pageCount) { pageCount = other->pageCount; updateType |= UPDATE_READING_METADATA; } publisher = other->publisher; synopsis = other->synopsis; fileSize = other->fileSize; syncDate = other->syncDate; storePrice = other->storePrice; format = other->format; language = other->language; if (m_type != other->m_type) { m_type = other->m_type; updateType |= UPDATE_TYPE; } if (size != other->size) { size = other->size; updateType |= UPDATE_METADATA; } if(isDRMFile != other->isDRMFile) isDRMFile = other->isDRMFile; qDebug() << Q_FUNC_INFO << "Colección antigua:" << m_collections << "Nuevas colecciones:" << other->m_collections; m_collections = other->m_collections; m_cssFileList = other->m_cssFileList; if(other->getLocationListCount() > 0) { QList<const BookLocation*>::iterator it = other->getLocationList()->begin(); QList<const BookLocation*>::iterator itEnd = other->getLocationList()->end(); for(; it != itEnd; ++it) { BookLocation* location = new BookLocation(*(*it)); addLocation(location->bookmark, location); location = NULL; delete location; } } return updateType; }
inline void addBookmark(const Location &location) { bookmarkActions << addLocation(location, BookmarksMenu); }
GlobStore::GlobStore(QWidget *parent) : QWidget(parent) { int l1; midiControl = new MidiControl(this); midiControl->ID = -2; midiControl->parentDockID = -2; activeStore = 0; currentRequest = 0; switchAtBeat = 0; storeSignalMapper = new QSignalMapper(this); connect(storeSignalMapper, SIGNAL(mapped(int)), this, SLOT(storeAll(int))); timeModeBox = new QComboBox; timeModeBox->addItem(tr("End of")); timeModeBox->addItem(tr("After")); connect(timeModeBox, SIGNAL(activated(int)), this, SLOT(updateTimeModeBox(int))); switchAtBeatBox = new QComboBox; for (l1 = 0; l1 < 16; l1++) { switchAtBeatBox->addItem(QString::number(l1 + 1)+" beats"); } switchAtBeatBox->hide(); connect(switchAtBeatBox, SIGNAL(activated(int)), this, SLOT(updateSwitchAtBeat(int))); timeModuleBox = new QComboBox; timeModuleBox->setCurrentIndex(0); connect(timeModuleBox, SIGNAL(activated(int)), this, SLOT(updateTimeModule(int))); QWidget *indicatorBox = new QWidget; QHBoxLayout *indicatorLayout = new QHBoxLayout; indicator = new Indicator(20, ' '); indicatorBox->setMinimumHeight(30); indicatorBox->setMinimumWidth(30); indicatorLayout->addWidget(indicator); indicatorLayout->setMargin(2); indicatorLayout->setSpacing(1); indicatorBox->setLayout(indicatorLayout); QHBoxLayout *timeModeLayout = new QHBoxLayout; timeModeLayout->addWidget(timeModeBox); timeModeLayout->addWidget(timeModuleBox); timeModeLayout->addWidget(switchAtBeatBox); timeModeLayout->addWidget(indicatorBox); timeModeLayout->setSpacing(0); timeModeLayout->addStretch(); QHBoxLayout *upperRowLayout = new QHBoxLayout; upperRowLayout->addLayout(timeModeLayout); upperRowLayout->addStretch(); QAction* removeStoreAction = new QAction(tr("&Remove"), this); QToolButton *removeStoreButton = new QToolButton; removeStoreButton->setDefaultAction(removeStoreAction); removeStoreButton->setFixedSize(60, 20); removeStoreButton->setArrowType (Qt::ArrowType(1)); connect(removeStoreAction, SIGNAL(triggered()), this, SLOT(removeLocation())); QToolButton *toolButton = new QToolButton; toolButton->setText("Global"); toolButton->setMinimumSize(QSize(56,32)); midiControl->addMidiLearnMenu("GlobRestore", toolButton, 0); QFrame *topRow = new QFrame; QVBoxLayout *topRowLayout = new QVBoxLayout; topRowLayout->addWidget(toolButton); topRowLayout->addStretch(); topRowLayout->setSpacing(0); topRowLayout->setMargin(0); topRow->setFrameStyle(QFrame::StyledPanel); topRow->setMinimumSize(QSize(48,48));; topRow->setLayout(topRowLayout); QVBoxLayout *buttonLayout = new QVBoxLayout; buttonLayout->addWidget(topRow); QVBoxLayout *columnLayout = new QVBoxLayout; columnLayout->addLayout(buttonLayout); columnLayout->addWidget(removeStoreButton); columnLayout->addStretch(1); indivButtonLayout = new QHBoxLayout; indivButtonLayout->setSpacing(0); indivButtonLayout->setMargin(0); indivButtonLayout->addLayout(columnLayout); indivButtonLayout->setSizeConstraint(QLayout::SetFixedSize); QHBoxLayout *secondRowLayout = new QHBoxLayout; secondRowLayout->addLayout(indivButtonLayout); secondRowLayout->addStretch(1); QVBoxLayout *centLayout = new QVBoxLayout; centLayout->addLayout(upperRowLayout); centLayout->addLayout(secondRowLayout); centLayout->addStretch(1); addLocation(); setLayout(centLayout); schedRestoreVal = 0; schedRestore = false; dispReqIx = 0; dispReqSelected = 0; needsGUIUpdate = false; modified = false; }
/* Procedure insertNode inserts * identifiers stored in t into * the symbol table */ static void insertNode( TreeNode * t) { switch (t->nodekind) { case StmtK: switch (t->kind.stmt) { case CompK: if (preserveLastScope) { preserveLastScope = FALSE; } else { Scope scope = sc_create(funcName); sc_push(scope); } t->attr.scope = sc_top(); break; default: break; } break; case ExpK: switch (t->kind.exp) { case IdK: case ArrIdK: case CallK: if (st_lookup(t->attr.name) == -1) /* not yet in table, error */ symbolError(t, "undelcared symbol"); else /* already in table, so ignore location, add line number of use only */ st_add_lineno(t->attr.name,t->lineno); break; default: break; } break; case DeclK: switch (t->kind.decl) { case FuncK: funcName = t->attr.name; if (st_lookup_top(funcName) >= 0) { /* already in table, so it's an error */ symbolError(t,"function already declared"); break; } st_insert(funcName,t->lineno,addLocation(),t); sc_push(sc_create(funcName)); preserveLastScope = TRUE; switch (t->child[0]->attr.type) { case INT: t->type = Integer; break; case VOID: default: t->type = Void; break; } break; case VarK: case ArrVarK: { char *name; if (t->child[0]->attr.type == VOID) { symbolError(t,"variable should have non-void type"); break; } if (t->kind.decl == VarK) { name = t->attr.name; t->type = Integer; } else { name = t->attr.arr.name; t->type = IntegerArray; } if (st_lookup_top(name) < 0) st_insert(name,t->lineno,addLocation(),t); else symbolError(t,"symbol already declared for current scope"); } break; default: break; } break; case ParamK: if (t->child[0]->attr.type == VOID) symbolError(t->child[0],"void type parameter is not allowed"); if (st_lookup(t->attr.name) == -1) { st_insert(t->attr.name,t->lineno,addLocation(),t); if (t->kind.param == NonArrParamK) t->type = Integer; else symbolError(t,"symbol already declared for current scope"); } break; default: break; } }
/* * fda_malloc - allocate size chunk of memory and create debug * records for it. */ void* fda_malloc(size_t size, const char* file, int line) { void* p; size_t blk_size; Location* location; assert(0 < size); assert(0 != file); assert(sizeof(void*) == sizeof(size_t)); /* * memory limiter do not allocate more than byteLimit */ if ((size + byteCount) > byteLimit) return 0; /* * Make sure that there is enough room for prefix/postfix * and we get an aligned buffer */ blk_size = BASE_SIZE(size); if ((p = malloc(blk_size)) == 0) { lowMemFn(); if ((p = malloc(blk_size)) == 0) noMemFn(); } /* * don't allow malloc to fail */ assert(0 != p); /* * shred the memory and set bounds markers */ SHRED_MEM(p, blk_size); *((size_t*) p) = DEADBEEF; *((size_t*) (BYTE_PTR(p) + blk_size - S_SIZE)) = DEADBEEF; /* * find the location or create a new one */ if (0 == (location = findLocation(file, line))) { if (0 == (location = addLocation(file, line))) { free(p); noMemFn(); } } /* * don't allow noMemFn to return */ assert(0 != location); if (!make_blk(BYTE_PTR(p) + S_SIZE, size, location)) { if (0 == location->count) freeLocation(location); free(p); p = 0; noMemFn(); } /* * don't allow noMemFn to return */ assert(0 != p); return (BYTE_PTR(p) + S_SIZE); }
ParStore::ParStore(GlobStore *p_globStore, const QString &name, QAction *p_muteOutAction, QAction *p_deferChangesAction, QWidget* parent): QWidget(parent), globStore(p_globStore) { // when temp.empty is true, restoring from that set is ignored temp.empty = false; temp.muteOut = false; temp.res = 1; temp.size = 0; temp.loopMode = 0; temp.waveForm = 0; temp.portOut = 0; temp.channelOut = 0; temp.chIn = 0; temp.wave.clear(); temp.muteMask.clear(); /* LFO Modules */ temp.ccnumber = -1; temp.ccnumberIn = 0; temp.freq = 0; temp.ampl = 0; temp.offs = 0; /* Seq Modules */ temp.loopMarker = 0; temp.notelen = 0; temp.vel = 0; temp.transp = 0; temp.dispVertical = 0; /* Arp Modules */ temp.indexIn0 = 0; temp.indexIn1 = 0; temp.rangeIn0 = 0; temp.rangeIn1 = 0; temp.attack = 0; temp.release = 0; temp.repeatMode = 0; temp.rndTick = 0; temp.rndLen = 0; temp.rndVel = 0; temp.pattern = ""; list.clear(); ndc = new Indicator(14, name.at(0), this); topButton = new QToolButton(this); topButton->setFont(QFont("Helvetica", 8)); topButton->setText(name); topButton->setMinimumSize(QSize(75, 10)); muteOutAction = p_muteOutAction; muteOut = new QToolButton(this); muteOut->setDefaultAction(muteOutAction); muteOut->setFont(QFont("Helvetica", 8)); muteOut->setMinimumSize(QSize(10, 10)); deferChangesAction = p_deferChangesAction; deferChanges = new QToolButton(this); deferChanges->setDefaultAction(deferChangesAction); deferChanges->setFont(QFont("Helvetica", 8)); deferChanges->setMinimumSize(QSize(10, 10)); QHBoxLayout *muteRowLayout = new QHBoxLayout; muteRowLayout->addStretch(); muteRowLayout->addWidget(muteOut); muteRowLayout->addWidget(deferChanges); muteRowLayout->setMargin(0); muteRowLayout->setSpacing(0); QVBoxLayout *controlLayout = new QVBoxLayout; controlLayout->addWidget(topButton); controlLayout->addLayout(muteRowLayout); controlLayout->setMargin(0); controlLayout->setSpacing(0); QWidget *indicatorBox = new QWidget(this); QHBoxLayout *indicatorLayout = new QHBoxLayout; indicatorBox->setMinimumHeight(20); indicatorBox->setMinimumWidth(25); indicatorLayout->addWidget(ndc); indicatorLayout->setMargin(2); indicatorLayout->setSpacing(1); indicatorBox->setLayout(indicatorLayout); QFrame *topRow = new QFrame(this); QHBoxLayout *topRowLayout = new QHBoxLayout; topRowLayout->addWidget(indicatorBox); topRowLayout->addLayout(controlLayout); topRowLayout->setSpacing(0); topRowLayout->setMargin(0); topRow->setMinimumSize(QSize(48,46));; topRow->setFrameStyle(QFrame::StyledPanel); topRow->setLayout(topRowLayout); QVBoxLayout *buttonLayout = new QVBoxLayout(); buttonLayout->addWidget(topRow); locContextMenu = new QMenu(this); QAction *storeHereAction = new QAction(tr("&Store here"), this); storeHereAction->setProperty("index", list.count()); storeHereAction->setIcon(QIcon(filesave_xpm)); locContextMenu->addAction(storeHereAction); connect(storeHereAction, SIGNAL(triggered()), this, SLOT(mapStoreSignal())); QAction *onlyPatternAction = new QAction(tr("&Act on pattern only"), this); onlyPatternAction->setProperty("index", list.count()); onlyPatternAction->setCheckable(true); locContextMenu->addAction(onlyPatternAction); connect(onlyPatternAction, SIGNAL(toggled(bool)), this, SLOT(updateOnlyPattern(bool))); jumpToIndexMenu = new QMenu(tr("When finished"), this); jumpToGroup = new QActionGroup(this); connect(jumpToGroup, SIGNAL(triggered(QAction *)) , this, SLOT(mapJumpToGroup(QAction *))); jumpToIndexMenu->addAction(new QAction(tr("Stay here"), this)); jumpToIndexMenu->actions().last()->setProperty("index", -2); jumpToIndexMenu->actions().last()->setActionGroup(jumpToGroup); jumpToIndexMenu->actions().last()->setCheckable(true); jumpToIndexMenu->actions().last()->setChecked(true); jumpToIndexMenu->addAction(new QAction(tr("Jump back"), this)); jumpToIndexMenu->actions().last()->setProperty("index", -1); jumpToIndexMenu->actions().last()->setActionGroup(jumpToGroup); jumpToIndexMenu->actions().last()->setCheckable(true); jumpToIndexMenu->addSeparator()->setText(tr("Jump to:")); locContextMenu->addMenu(jumpToIndexMenu); for (int l1 = 0; l1 < list.size() - 1; l1++) addLocation(); QVBoxLayout *columnLayout = new QVBoxLayout; columnLayout->addLayout(buttonLayout); columnLayout->addStretch(); columnLayout->setMargin(0); columnLayout->setSpacing(0); setLayout(columnLayout); globStore->indivButtonLayout->addWidget(this); restoreRequest = -1; oldRestoreRequest = 0; restoreRunOnce = false; activeStore = 0; currentRequest = 0; dispReqIx = 0; dispReqSelected = 0; needsGUIUpdate = false; }