void Engine::push(char c) { if (!checkState()) return; if (state == sStart) { executeInstructionOnStack("Copy"); // No tr if (!checkState()) { setError("Failed to copy some data"); // No tr return; } dStack.top()->clear(); if (!dStack.top()->push(c, false)) { delete dStack.pop(); return; } dStack.top()->clear(); changeState(sAppend); } else { if (!Qtopia::mousePreferred() && !iStack.isEmpty() && *iStack.top() == "EvaluateLine") // No tr hardReset(); changeResetState(drSoft); if (!dStack.top()->push(c, false)) { return; } } dStack.top()->push(c); emit(stackChanged()); }
int main(int argc, char **argv) { initialize(); initialize_TIMER0(); clear_array(); PORTC = 0; USART_send_string("Currently outputing color: \n"); while(1){ for(unsigned int i = 0; i < 8; ++i){ PORTE = i; switch (state){ case RED: //PORTE = 1; update_row(224,0,0); checkState(); break; case GREEN: update_row(0,7,0); checkState(); break; case YELLOW: led_off(); update_row(yellowRow,0,0); update_row(yellowRow,0,0); update_row(yellowRow,yellowRow,0); update_row(yellowRow,0,0); update_row(yellowRow,0,0); led_off(); checkState(); break; } } } }
void Resource::fileLoaded(FS::IFile& file, bool success) { m_is_waiting_for_load = false; if (m_desired_state != State::READY) return; ASSERT(m_current_state != State::READY); ASSERT(m_empty_dep_count == 1); if (!success) { g_log_error.log("Core") << "Could not open " << getPath().c_str(); --m_empty_dep_count; ++m_failed_dep_count; checkState(); m_is_waiting_for_load = false; return; } if (!load(file)) { ++m_failed_dep_count; } --m_empty_dep_count; checkState(); m_is_waiting_for_load = false; }
void Engine::memoryRecall() { if (!checkState()) return; if (state == sAppend) delete dStack.pop(); if ( mem ) { dStack.push(mem); //memory may have different data type if (currentType != mem->getType()) { wantedType = currentType; currentType = mem->getType(); executeInstructionOnStack("Convert"); currentType = wantedType; } executeInstructionOnStack("Copy"); // No tr if (!checkState()) return; mem = dStack.pop(); } else executeInstructionOnStack("Factory"); // No tr changeState(sAppend); emit(stackChanged()); }
bool KbdKeeper::setup() { connect(&m_layout, SIGNAL(keyboardChanged()), SLOT(keyboardChanged())); connect(&m_layout, SIGNAL(layoutChanged(uint)), SLOT(layoutChanged(uint))); connect(&m_layout, SIGNAL(checkState()), SLOT(checkState())); return true; }
void CLabel::mousePressEvent(QMouseEvent *ev){ if( checkState() == Qt::Checked ){ setChecked(Qt::Unchecked); } else { setChecked(Qt::Checked); } emit clicked(); emit clicked(checkState() == Qt::Checked); QLabel::mousePressEvent(ev); }
void tag_lvitem::set_on(bool b) { treeWidget()->blockSignals(true); if ((checkState(0)==Qt::Unchecked && b==true) || (checkState(0)==Qt::Checked && b==false)) { DBG_PRINTF(5, "set_on changes state"); setCheckState(0, b ? Qt::Checked : Qt::Unchecked); last_known_state = (b ? Qt::Checked : Qt::Unchecked); colorize(); } treeWidget()->blockSignals(false); }
//------------------------------------------------------------------------ bool XmlRepresentationHelper::startEndCell () { if (!checkState (kInCell)) return false; StringWriter writer (stream); String string; string.printf ("<%s/>", CELL_TAG); writer.write (string); writer.write (ENDLINE_A); if (!checkState (kInPage)) return false; return true; }
/*! \brief Destructs the VtkPropRenderer. */ mitk::VtkPropRenderer::~VtkPropRenderer() { // Workaround for GLDisplayList Bug { m_MapperID=0; checkState(); } if (m_LightKit != NULL) m_LightKit->Delete(); if (m_VtkRenderer!=NULL) { m_CameraController = NULL; m_VtkRenderer->Delete(); m_VtkRenderer = NULL; } else m_CameraController = NULL; if (m_WorldPointPicker != NULL) m_WorldPointPicker->Delete(); if (m_PointPicker != NULL) m_PointPicker->Delete(); if (m_CellPicker != NULL) m_CellPicker->Delete(); if (m_TextRenderer != NULL) m_TextRenderer->Delete(); }
// Memory void Engine::memorySave() { if (!checkState()) return; //save previous data on stack executeInstructionOnStack("Copy"); // No tr if (mem) { dStack.push(mem); executeInstructionOnStack("Add"); // No tr } if (state != sError) mem = dStack.pop(); executeInstructionOnStack("Factory"); // No tr if (mem->getFormattedOutput() != dStack.top()->getFormattedOutput()) { if (memMark) memMark->show(); } else { delete mem; mem = 0; if (memMark) memMark->hide(); } delete dStack.pop(); qApp->processEvents(); }
PairAlign::PairAlign(MSAEditor* _msa) : msa(_msa), pairwiseAlignmentWidgetsSettings(_msa->getPairwiseAlignmentWidgetsSettings()), distanceCalcTask(NULL), settingsWidget(NULL), showHideSequenceWidget(NULL), showHideSettingsWidget(NULL), showHideOutputWidget(NULL), saveController(NULL), savableTab(this, GObjectViewUtils::findViewByName(_msa->getName())), showSequenceWidget(_msa->getPairwiseAlignmentWidgetsSettings()->showSequenceWidget), showAlgorithmWidget(_msa->getPairwiseAlignmentWidgetsSettings()->showAlgorithmWidget), showOutputWidget(_msa->getPairwiseAlignmentWidgetsSettings()->showOutputWidget), firstSequenceSelectionOn(false), secondSequenceSelectionOn(false), sequencesChanged(true), sequenceNamesIsOk(false), alphabetIsOk(false) { SAFE_POINT(NULL != msa, "MSA Editor is NULL.", ); SAFE_POINT(NULL != pairwiseAlignmentWidgetsSettings, "pairwiseAlignmentWidgetsSettings is NULL.", ); setupUi(this); firstSeqSelectorWC = new SequenceSelectorWidgetController(msa); firstSeqSelectorWC->setObjectName("firstSeqSelectorWC"); secondSeqSelectorWC = new SequenceSelectorWidgetController(msa); secondSeqSelectorWC->setObjectName("secondSeqSelectorWC"); firstSequenceLayout->addWidget(firstSeqSelectorWC); secondSequenceLayout->addWidget(secondSeqSelectorWC); initLayout(); initSaveController(); connectSignals(); initParameters(); U2WidgetStateStorage::restoreWidgetState(savableTab); checkState(); }
void FutureBucket::makeLive(Application& app) { checkState(); assert(!isLive()); assert(hasHashes()); auto& bm = app.getBucketManager(); if (hasOutputHash()) { setLiveOutput(bm.getBucketByHash(hexToBin256(getOutputHash()))); } else { assert(mState == FB_HASH_INPUTS); mInputCurrBucket = bm.getBucketByHash(hexToBin256(mInputCurrBucketHash)); mInputSnapBucket = bm.getBucketByHash(hexToBin256(mInputSnapBucketHash)); assert(mInputShadowBuckets.empty()); for (auto const& h : mInputShadowBucketHashes) { auto b = bm.getBucketByHash(hexToBin256(h)); assert(b); CLOG(DEBUG, "Bucket") << "Reconstituting shadow " << h; mInputShadowBuckets.push_back(b); } mState = FB_LIVE_INPUTS; startMerge(app); assert(isLive()); } }
FlagsComboBox::FlagsComboBox(QWidget *parent): QComboBox(parent) { setModel(new QStandardItemModel(this)); setEditable(false); setItemDelegate(new QStyledItemDelegate(this)); auto item = new QStandardItem; item->setFlags(Qt::ItemIsEnabled); standardItemModel()->appendRow(item); connect(view(), &QListView::pressed, this, [this](const QModelIndex &index) { auto item = standardItemModel()->itemFromIndex(index); if(!(item->flags() & Qt::ItemIsUserCheckable)) return; if(item->checkState() == Qt::Checked) item->setCheckState(Qt::Unchecked); else item->setCheckState(Qt::Checked); }); connect(standardItemModel(), &QStandardItemModel::dataChanged, this, [this]() { updateText(); emit flagsChanged(flags()); }); }
void socket::postSend() { if (!checkState()) return; if (_sendQueue.size() == 0) return; _sendBuf.clear(); while ((_sendQueue.size() > 0) && (_sendBuf.size() + _sendQueue.front()->size() < IO_BUFFER_SIZE)) { auto& buf = _sendQueue.front(); msg_size_t size = 0; size += buf->size() &0xFFFF; _sendBuf.append((uint8_t*)&size, sizeof(msg_size_t)); _sendBuf.append(buf->data(), buf->size()); _sendQueue.pop_front(); } if (0 == _sendBuf.size()) { NET_LOG.console("Temp to send to [%s] 0 bytes message.", get_remoteaddress().c_str()); return; } _isSending = true; asio::async_write( _socket, asio::buffer(_sendBuf.data(), _sendBuf.size()), std::bind(&socket::handleSend, shared_from_this(), std::placeholders::_1, std::placeholders::_2)); }
void ResourceSkin::checkState(const MapStateInfo& _states) { for (MapStateInfo::const_iterator iter = _states.begin(); iter != _states.end(); ++iter) { checkState(iter->first); } }
void GLFrameBuffer::pushColorAttachment( GLenum iformat ) { if( num_color_attachments == GL_MAX_COLOR_ATTACHMENTS-1 ) { printf( "ERROR: Trying to attach a new color attachment to fbo but hit max color attachments!\n" ); return; } bind(); glGenTextures( 1, &texture_id[num_color_attachments] ); glActiveTexture( GL_TEXTURE0 ); glBindTexture( GL_TEXTURE_2D, texture_id[num_color_attachments] ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D( GL_TEXTURE_2D, 0, iformat, res[0], res[1], 0, //GL_RGB, GL_UNSIGNED_BYTE, 0 ); GL_RGB, GL_FLOAT, 0 ); glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+num_color_attachments, GL_TEXTURE_2D, texture_id[num_color_attachments], 0 ); num_color_attachments++; checkState(); }
Node<Status, T> createLeaf( const typename NodeTypes<Status, T>::ValueList& originalValueList, int depthRemaining, const State& collectedState) { typedef typename NodeTypes<Status, T>::ValuePtr ValuePtr; typedef typename NodeTypes<Status, T>::ValueList ValueList; ValueList valueList; if (checker_) { boost::remove_copy_if( originalValueList, std::back_inserter(valueList), [this, &collectedState](const ValuePtr& value) { State state(collectedState); for (Point p: value->first.state()) { state.addStone(p); } return !checkState(*checker_, value->first.table(), state); }); } else { valueList = originalValueList; } advanceProgress(valueList.size(), depthRemaining); return LeafNode<Status, T>(std::move(valueList)); }
// You may have to modify this to suit your needs bool PS2Emu::handshake() { unsigned char data = 0x00; // tell host we are ready to connect devWrite(0xAA); // wait for response while (checkState(dat, LOW, 5000)) { devRead(&data); devWrite(0xFA); switch(data) { case 0x00: // second bit of 0xED or 0xF3 break; case 0xED: // set/reset LEDs break; case 0xF2: // ID devWrite(0xAB); devWrite(0x83); break; case 0xF3: // set/reset typematic delay break; case 0xF4: // keyboard is enabled, break loop return true; } } return false; }
// spin, modifying the state to different values void MyInfo::modifyThreadFunc( robot_interaction::LockedRobotState* locked_state, int* counter, double offset) { bool go = true; while(go) { double val = offset; for (int loops = 0 ; loops < 100 ; ++loops) { val += 0.0001; locked_state->modifyState(boost::bind(&MyInfo::modifyFunc, this, _1, val)); } cnt_lock_.lock(); go = !quit_; ++*counter; cnt_lock_.unlock(); checkState(*locked_state); val += 0.000001; } }
// spin, setting the state to different values void MyInfo::setThreadFunc( robot_interaction::LockedRobotState* locked_state, int* counter, double offset) { bool go = true; while(go) { double val = offset; for (int loops = 0 ; loops < 100 ; ++loops) { val += 0.0001; robot_state::RobotState cp1(*locked_state->getState()); cp1.setVariablePosition(JOINT_A, val + 0.00001); cp1.setVariablePosition(JOINT_C, val + 0.00002); cp1.setVariablePosition(JOINT_F, val + 0.00003); locked_state->setState(cp1); } cnt_lock_.lock(); go = !quit_; ++*counter; cnt_lock_.unlock(); checkState(*locked_state); val += 0.000001; } }
Slice Encrypt::start() { checkState(State::INITIAL, State::PROGRESS, "Start already called"); updateAad(version_); updateAad(entity_); return buffer_(0, VERSION_SIZE + config_.ivLength); }
void MessageFilterDialog::existingFilterSelectionChanged(QListBoxItem * item) { if (item) { // get the current filter number from the listbox item m_currentFilterNum = ((MessageFilterListBoxText*)item)->data(); // get the specified filter m_currentFilter = m_filters->filter(m_currentFilterNum); // set the GroupBox's label m_filterGroup->setTitle(m_currentFilter->name() + " &Filter"); // setup all the filter values m_name->setText(m_currentFilter->name()); m_pattern->setText(m_currentFilter->regexp().pattern()); // select all the message types uint64_t messageTypes = m_currentFilter->types(); uint32_t messageType; for (QListBoxItem* currentLBT = m_messageTypes->firstItem(); currentLBT; currentLBT = currentLBT->next()) { messageType = ((MessageFilterListBoxText*)currentLBT)->data(); m_messageTypes->setSelected(currentLBT, ((uint64_t(1) << messageType) & messageTypes) != 0); } } else // no item selected, clear all filter setup clearFilter(); // check the current state checkState(); }
void LedgerDelta::modEntry(EntryFrame::pointer entry) { checkState(); auto k = entry->getKey(); auto mod_it = mMod.find(k); if (mod_it != mMod.end()) { // collapse mod mod_it->second = entry; } else { auto new_it = mNew.find(k); if (new_it != mNew.end()) { // new + mod = new (with latest value) new_it->second = entry; } else { assert(mDelete.find(k) == mDelete.end()); // delete + mod is illegal mMod[k] = entry; } } }
void CheckBox::setChecked(bool checked) { this->blockSignals(true); setTristate(false); QCheckBox::setChecked(checked); itsPreviousCheckState = checkState(); this->blockSignals(false); }
void ResourceSkin::addInfo(const SubWidgetBinding& _bind) { checkState(_bind.mStates); mBasis.push_back(SubWidgetInfo(_bind.mType, _bind.mOffset, _bind.mAlign)); checkBasis(); fillState(_bind.mStates, mBasis.size() - 1); }
void QgsLegendGroup::updateCheckState() { std::list<QgsLegendLayerFile*> llfiles = legendLayerFiles(); if ( llfiles.size() < 1 ) { return; } std::list<QgsLegendLayerFile*>::iterator iter = llfiles.begin(); Qt::CheckState theState = ( *iter )->checkState( 0 ); for ( ; iter != llfiles.end(); ++iter ) { if ( theState != ( *iter )->checkState( 0 ) ) { theState = Qt::PartiallyChecked; break; } } if ( theState != checkState( 0 ) ) { treeWidget()->blockSignals( true ); setCheckState( 0, theState ); treeWidget()->blockSignals( false ); } }
void Player::update(float dt) { stateQueue.update(dt); checkKey(); checkState(); if(moving) { move_x += 0.3; if(move_x > 5.0) move_x = 5.0; } else { move_x -= 0.3; if(move_x <= 0.0) move_x = 0.0; } float mx = 0.0; if(orientState == PLAYER_LEFT) { mx = move_x * -1; } else { mx = move_x; } asPlayer.transform->translateFor(mx,0,0); }
void Engine::delChar() { if (!checkState()) return; if (state == sStart) { if (iStack.isEmpty()) return; if (*iStack.top() != "Open brace impl") // No tr changeState(sAppend); delete iStack.pop(); } else if (state == sAppend) { if(dStack.top()->del()) { if (dStack.count() == 1) { hardReset(); } else if (dStack.count() > 1) { delete dStack.pop(); if (iStack.count() >= 1) { if (*iStack.top() == "EvaluateLine" || *iStack.top() != "Open brace impl") { changeState(sAppend); } else { changeState(sStart); } delete iStack.pop(); } else { changeState(sStart); } } } } emit(stackChanged()); }
/**************************************************************************** Desc: See if any F_INDEX structures need indexing in the background. ****************************************************************************/ RCODE F_Db::startBackgroundIndexing( void) { RCODE rc = NE_SFLM_OK; FLMBOOL bStartedTrans = FALSE; FLMUINT uiIndexNum; F_INDEX * pIndex; if (RC_BAD( rc = checkState( __FILE__, __LINE__))) { goto Exit; } if (m_eTransType != SFLM_NO_TRANS) { if (!okToCommitTrans()) { rc = RC_SET( NE_SFLM_ABORT_TRANS); goto Exit; } } else { // Need to have at least a read transaction going. if (RC_BAD( rc = beginTrans( SFLM_READ_TRANS))) { goto Exit; } bStartedTrans = TRUE; } for (uiIndexNum = 1, pIndex = m_pDict->m_pIndexTbl; uiIndexNum <= m_pDict->m_uiHighestIndexNum; uiIndexNum++, pIndex++) { // Restart any indexes that are off-line but not suspended if ((pIndex->uiFlags & (IXD_OFFLINE | IXD_SUSPENDED)) == IXD_OFFLINE) { flmAssert( flmBackgroundIndexGet( m_pDatabase, uiIndexNum, FALSE) == NULL); if (RC_BAD( rc = startIndexBuild( uiIndexNum))) { goto Exit; } } } Exit: if (bStartedTrans) { (void)abortTrans(); } return( rc); }
int _stateTestHelper(struct gameState* state, struct gameState* cpy, int i){ int j; int retVal = abs(checkState(cpy, state)); switch (retVal){ case 8: state->numActions = cpy->numActions; return 8; case 11: for(j = 0; j < MAX_HAND; j++){ state->hand[i][j] = cpy->hand[i][j]; } return 11; case 12: state->handCount[i] = cpy->handCount[i]; return 12; case 13: for(j = 0; j < MAX_DECK; j++){ state->discard[i][j] = cpy->discard[i][j]; } return 13; case 14: state->discardCount[i] = cpy->discardCount[i]; return 14; case 15: for(j = 0; j < MAX_DECK; j++){ state->playedCards[j] = cpy->playedCards[j]; } return 15; case 16: state->playedCardCount = cpy->playedCardCount; return 16; case 17: state->deckCount[i] = cpy->deckCount[i]; return 17; case 18: for(j = 0; j < MAX_DECK; j++){ state->deck[i][j] = cpy->deck[i][j]; } return 18; default: if(retVal){ return retVal; } else { return 0; } } }