void MyFrame::OnLastFiles( wxCommandEvent &event ) { if (!Discard()) return; if (!m_filename.empty()) AddToHistory( m_filename ); size_t index = event.GetId() - ID_LAST_1; if( index < m_history.GetCount() ) { m_filename = m_history[index]; m_text->Clear(); m_text->LoadFile( m_filename ); #if wxUSE_STATUSBAR SetStatusText( m_filename ); #endif // wxUSE_STATUSBAR } else { wxMessageBox( _T("This entry is empty. It should be filled once you will start opening."), _T("Empty entry"), wxOK | wxICON_INFORMATION, this ); } }
C2CAN::~C2CAN() { Discard(); WSACleanup(); DeleteCriticalSection(&m_SemEndThrd); DeleteCriticalSection(&m_SemTxFrames); DeleteCriticalSection(&m_SemRxFrames); }
void ContinuityEditor::ContEditCurrent(wxCommandEvent&) { // which value did we choose int newSelection = mContinuityChoices->GetSelection(); // if the current field is modified, then do something if (mUserInput->IsModified()) { // give the user a chance to save, discard, or cancle the action int userchoice = wxMessageBox(wxT("Continuity modified. Save changes or cancel?"), wxT("Save changes?"), wxYES_NO|wxCANCEL); if (userchoice == wxYES) { Save(); } if (userchoice == wxNO) { Discard(); } if (userchoice == wxCANCEL) { mContinuityChoices->SetSelection(mCurrentContinuityChoice); return; } } SetCurrent(newSelection); }
void ContinuityEditor::OnCloseWindow(wxCommandEvent& event) { // if the current field is modified, then do something if (mUserInput->IsModified()) { // give the user a chance to save, discard, or cancle the action int userchoice = wxMessageBox(wxT("Continuity modified. Save changes or cancel?"), wxT("Save changes?"), wxYES_NO|wxCANCEL); if (userchoice == wxYES) { Save(); } if (userchoice == wxNO) { Discard(); } if (userchoice == wxCANCEL) { wxString message = wxT("Close cancelled."); wxMessageBox(message, message); return; } } FlushText(); Close(); }
void MyFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) ) { // Save changes? if (!Discard()) return; // Add current to history if (!m_filename.empty()) AddToHistory( m_filename ); // Write .ini file wxConfig *conf = (wxConfig*) wxConfig::Get(); int max = HISTORY_ENTRIES; if (m_history.GetCount() < (size_t)max) max = m_history.GetCount(); conf->Write( _T("/History/Count"), max ); for (int i = 0; i < max; i++) { wxString tmp; tmp.Printf( _T("/History/File%d"), (int)i ); conf->Write( tmp, m_history[(size_t)i] ); } // Flush and delete config delete wxConfig::Set( NULL ); // Finally destroy window and quit Destroy(); }
int Active(int laststep)//1 = yes,activa all the remaining functional nodes 0 = no, active one by one { int i, j, flag = 0, activeCount = 0; for (i = 0;i <= maxlength;i++) { for (j = 1;j <= (int)pow(2, i);j++) { if (pos[0][i][j] > 1) { flag = 1; if (pos[0][i][j] == 2) Split(i, j); else if (pos[0][i][j] == 3) Extend(i, j); else if (pos[0][i][j] == 4) Discard(i, j); } } if (flag == 1) { activeCount++; flag = 0; if (laststep == 0) return activeCount; } } return activeCount; }
void UJavascriptAssetEditorToolkit::Commit() { Discard(); IJavascriptEditorModule::Get().AddExtension(this); bRegistered = true; }
void WorkPage::Init() { connect(ui->confirmButton, SIGNAL(clicked()), this, SLOT(Confirm())); connect(ui->discardButton, SIGNAL(clicked()), this, SLOT(Discard())); connect(ui->disconnectButton, SIGNAL(clicked()), this, SIGNAL(Disconnect())); }
void UJavascriptUICommands::Commit() { Discard(); // IJavascriptEditorModule::Get().AddExtension(this); bRegistered = true; }
void CModelPool::ClearPool( BOOL b_complete) { POOL_IT _I = Pool.begin(); POOL_IT _E = Pool.end(); for (;_I!=_E;_I++) { Discard (_I->second, b_complete) ; } Pool.clear (); }
void UJavascriptAssetEditorToolkit::Commit() { #if WITH_EDITOR Discard(); IJavascriptEditorModule::Get().AddExtension(this); bRegistered = true; #endif }
// -------------------------------------------------------------------------- // // Function // Name: BackupStoreRefCountDatabase::~BackupStoreRefCountDatabase // Purpose: Destructor // Created: 2003/08/28 // // -------------------------------------------------------------------------- BackupStoreRefCountDatabase::~BackupStoreRefCountDatabase() { if (mIsTemporaryFile) { THROW_EXCEPTION_MESSAGE(CommonException, Internal, "BackupStoreRefCountDatabase destroyed without " "explicit commit or discard"); Discard(); } }
NS_IMETHODIMP RasterImage::RequestDiscard() { if (mDiscardable && // Enabled at creation time... mLockCount == 0 && // ...not temporarily disabled... CanDiscard()) { Discard(); } return NS_OK; }
void DSessionShare::ServerTerminated(void) { TDblQueIter<TMessageSlot> outstandingIter(iOutstandingQ); TMessageSlot* item; while((item=outstandingIter++)) { item->Release(); if(item->iStatus) iClient->RequestComplete(item->iStatus,KErrServerTerminated); } Discard(); }
bool CCodeChainCtx::RunEvalString (const CString &sString, bool bPlain, CString *retsResult) // RunString // // If sString starts with '=' or if bPlain is TRUE, then we evaluate sString as an // expression. If success (no error) we return TRUE. Otherwise, we return FALSE and // the error is in retsResult. { char *pPos = sString.GetPointer(); if (bPlain || *pPos == '=') { ICCItem *pExp = Link(sString, (bPlain ? 0 : 1), NULL); ICCItem *pResult = Run(pExp); // LATER:Event Discard(pExp); if (pResult->IsError()) { *retsResult = pResult->GetStringValue(); Discard(pResult); return false; } // Note: We use GetStringValue instead of Unlink because we don't // want to preserve CC semantics (e.g., we don't need strings to // be quoted). *retsResult = pResult->GetStringValue(); Discard(pResult); return true; } else { *retsResult = strCEscapeCodes(sString); return true; } }
CacheHandle CacheMgr::NewObject(void *pv, word cb, word wfHints) { // Apply limits if asked if (m_cbLimit != 0) { while (m_cbTotalSize + cb > m_cbLimit) { if (!MakeSpace(m_cbTotalSize + cb - m_cbLimit)) return NULL; } } // Free up an entry if we need to if (m_pceFree == NULL) { // No free slots available. Discard the oldest entry for reuse. for (CacheEntry *pceT = m_pceFirst->pcePrev; pceT != NULL; pceT = pceT->pcePrev) { // If we loop back to m_pceFirst, then all CacheEntries are locked. No way! Assert(pceT != m_pceFirst); if ((pceT->wUniqueLock & kwLockMask) == 0) { Discard(pceT); break; } } } CacheEntry *pce = m_pceFree->pcePrev; Assert(pce != NULL); if (pce == NULL) return NULL; // Alloc the object pce->hmem = gmmgr.AllocHandle(cb, wfHints); Assert(pce->hmem != NULL); if (pce->hmem == NULL) return NULL; pce->cbSize = cb; // Write in data if (pv != NULL) gmmgr.WriteHandle(pce->hmem, 0, pv, cb); // Take off free list, put at start of the alloced list RemoveFromFreeList(pce); Add(pce); m_cbTotalSize += cb; return MakeHandle(pce); }
void MyFrame::OnOpen( wxCommandEvent& WXUNUSED(event) ) { #if wxUSE_FILEDLG if (!Discard()) return; wxFileDialog dialog( this, _T("Open text"), wxEmptyString, wxEmptyString, _T("Text file (*.txt)|*.txt|Any file (*)|*"), wxFD_OPEN|wxFD_FILE_MUST_EXIST ); if (dialog.ShowModal() == wxID_OK) { m_text->Clear(); #ifdef __WXX11__ // requires wxUSE_UNIV_TEXTCTRL to be set to 0 #if 0 wxFileName fname( dialog.GetPath() ); if ((fname.GetExt() == _T("cpp")) || (fname.GetExt() == _T("c")) || (fname.GetExt() == _T("h")) || (fname.GetExt() == _T("cxx")) || (fname.GetExt() == _T("hxx"))) { m_text->SetLanguage( wxSOURCE_LANG_CPP ); } else if (fname.GetExt() == _T("py")) { m_text->SetLanguage( wxSOURCE_LANG_PYTHON ); } else if ((fname.GetExt() == _T("pl")) || (fname.GetExt() == _T("pm"))) { m_text->SetLanguage( wxSOURCE_LANG_PYTHON ); } else { m_text->SetLanguage( wxSOURCE_LANG_NONE ); } #endif #endif m_filename = dialog.GetPath(); m_text->LoadFile( m_filename ); #if wxUSE_STATUSBAR SetStatusText( m_filename ); #endif // wxUSE_STATUSBAR } #endif // wxUSE_FILEDLG }
void CacheMgr::Exit() { // Free cache entries while (m_pceFirst != NULL) Discard(m_pceFirst); m_pceFirst = NULL; // Free CacheEntry list delete m_pceList; m_pceList = NULL; m_pceFree = NULL; }
void DSessionShare::Close(void) { TDblQueIter<TMessageSlot> outstandingIter(iOutstandingQ); TMessageSlot* item; while((item=outstandingIter++)) { if(item->iDelivery.iNext!=&(item->iDelivery)) { item->iDelivery.Deque(); item->Release(); } } if(iOutstandingQ.IsEmpty()) Discard(); }
CListenSocket::~CListenSocket() { shutdown = true; Discard(); Close(); #ifdef __DEBUG__ // No new sockets should have been opened by now for (SocketSet::iterator it = socket_list.begin(); it != socket_list.end(); it++) { wxASSERT((*it)->OnDestroy()); } #endif KillAllSockets(); }
void MyFrame::OnNew( wxCommandEvent& WXUNUSED(event) ) { if (!Discard()) return; m_text->Clear(); if (!m_filename.empty()) AddToHistory( m_filename ); m_filename = wxEmptyString; #if wxUSE_STATUSBAR SetStatusText( wxEmptyString ); #endif // wxUSE_STATUSBAR }
void DrCohortProcess::NotifyVertexCompletion() { DrLogI("Enter with m_numberOfVerticesLeftToComplete %d", m_numberOfVerticesLeftToComplete); DrAssert(m_numberOfVerticesLeftToComplete > 0); --m_numberOfVerticesLeftToComplete; if (m_numberOfVerticesLeftToComplete > 0) { DrLogI("Still have %d vertices to complete", m_numberOfVerticesLeftToComplete); return; } bool scheduleTermination = false; if (m_process.IsEmpty() == false) { DrLockBoxKey<DrProcess> process(m_process); if (process->GetInfo()->m_state->m_state <= DPS_Running) { /* the process hasn't exited yet even though all the vertices are done. It will probably exit soon of its own accord, but in case it doesn't we'll schedule a message that will terminate it after a while */ DrLogI("Process %s has not exited, scheduling termination", process->GetName().GetChars()); scheduleTermination = true; } else { /* The process completed and we're done with it, call Terminate to clean up */ DrLogI("Process %s completed, calling Terminate to clean up", process->GetName().GetChars()); DrAssert(process->GetInfo()->m_state->m_process != DrNull); process->Terminate(); } } if (scheduleTermination) { /* The listener for the state message (DrProcess::ReceiveMessage(DrProcessState message)) will call Terminate to clean up in response to this message. */ DrPStateMessageRef message = DrNew DrPStateMessage(m_process, DPS_Failed); m_messagePump->EnQueueDelayed(m_timeout, message); } DrLogI("Notifying cohort of vertex completion"); m_parent->NotifyProcessComplete(m_version); DrLogI("Discarding cohort process"); Discard(); }
bool NotUnaryOperator(const ast_type_traits::DynTypedNode &DynNode, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder, ArrayRef<DynTypedMatcher> InnerMatchers) { if (InnerMatchers.size() != 1) return false; // The 'unless' matcher will always discard the result: // If the inner matcher doesn't match, unless returns true, // but the inner matcher cannot have bound anything. // If the inner matcher matches, the result is false, and // any possible binding will be discarded. // We still need to hand in all the bound nodes up to this // point so the inner matcher can depend on bound nodes, // and we need to actively discard the bound nodes, otherwise // the inner matcher will reset the bound nodes if it doesn't // match, but this would be inversed by 'unless'. BoundNodesTreeBuilder Discard(*Builder); return !InnerMatchers[0].matches(DynNode, Finder, &Discard); }
bool CacheMgr::MakeSpace(dword cb) { if (m_pceFirst == NULL) return false; CacheEntry *pceT = m_pceFirst->pcePrev; while (pceT != m_pceFirst) { if ((pceT->wUniqueLock & kwLockMask) != 0) { pceT = pceT->pcePrev; continue; } CacheEntry *pcePrev = pceT->pcePrev; Discard(pceT); word cbLargestFree; gmmgr.GetFreeSize(&cbLargestFree); if (cbLargestFree >= cb) return true; pceT = pcePrev; } return false; }
void CModelPool::DeleteInternal (dxRender_Visual* &V, BOOL bDiscard) { VERIFY (!g_bRendering); if (!V) return; V->Depart (); if (bDiscard||bForceDiscard){ Discard (V, TRUE); }else{ // REGISTRY_IT it = Registry.find (V); if (it!=Registry.end()) { // Registry entry found - move it to pool Pool.insert (mk_pair(it->second,V)); } else { // Registry entry not-found - just special type of visual / particles / etc. xr_delete (V); } } V = NULL; }
void Player::Sort() { Card temp; const int numcards = GetNumCards(); Card* CardArr = new Card[GetNumCards()]; for (int i = GetNumCards() - 1; GetNumCards(); i--) { Discard(i, CardArr[i]); } for (int i = 0; i < numcards; i++) { for (int j = 1; j < numcards; j++) { if (CardArr[j].GetSuit() < CardArr[j - 1].GetSuit()) { temp = CardArr[j]; CardArr[j] = CardArr[j - 1]; CardArr[j - 1] = temp; } } } for (int i = 0; i < numcards; i++) { for (int j = 1; j < numcards; j++) { if (CardArr[j].GetFace() < CardArr[j - 1].GetFace()) { if (CardArr[j].GetSuit() == CardArr[j - 1].GetSuit()) { temp = CardArr[j]; CardArr[j] = CardArr[j - 1]; CardArr[j - 1] = temp; } } } } for (int i = 0; i < numcards; i++) { AddCard(CardArr[i]); } delete[] CardArr; }
wxTempFile::~wxTempFile() { if ( IsOpened() ) Discard(); }
void ContinuityEditor::OnDiscard(wxCommandEvent&) { Discard(); }
void UJavascriptAssetEditorToolkit::BeginDestroy() { Super::BeginDestroy(); Discard(); }
// This is called by the Webserver to send output data to a client. If keepConnectionAlive is set to false, // the current connection will be terminated once everything has been sent. void NetworkTransaction::Commit(bool keepConnectionAlive) { // If the connection has been terminated (e.g. RST received while writing upload data), discard this transaction if (!IsConnected() || status == released) { Discard(); return; } // Free buffer holding the incoming data and prepare some values for the sending process FreePbuf(); cs->persistConnection = keepConnectionAlive; if (sendBuffer == nullptr) { sendBuffer = sendStack->Pop(); } status = sending; // Unlink the item(s) from the list of ready transactions if (keepConnectionAlive) { // Our connection is still of interest, remove only this transaction from the list NetworkTransaction *previous = nullptr; for(NetworkTransaction *item = reprap.GetNetwork().readyTransactions; item != nullptr; item = item->next) { if (item == this) { if (previous == nullptr) { reprap.GetNetwork().readyTransactions = next; } else { previous->next = next; } break; } previous = item; } } else { // We will close this connection soon, stop receiving data from this PCB tcp_recv(cs->pcb, nullptr); // Also remove all ready transactions pointing to our ConnectionState NetworkTransaction *previous = nullptr, *item = reprap.GetNetwork().readyTransactions; while (item != nullptr) { if (item->cs == cs) { if (item == this) { // Only unlink this item if (previous == nullptr) { reprap.GetNetwork().readyTransactions = next; } else { previous->next = next; } item = next; } else { // Remove all others item->Discard(); item = (previous == nullptr) ? reprap.GetNetwork().readyTransactions : previous->next; } } else { previous = item; item = item->next; } } } // Enqueue this transaction, so it's sent in the right order NetworkTransaction *mySendingTransaction = cs->sendingTransaction; if (mySendingTransaction == nullptr) { cs->sendingTransaction = this; reprap.GetNetwork().AppendTransaction(&reprap.GetNetwork().writingTransactions, this); } else { while (mySendingTransaction->nextWrite != nullptr) { mySendingTransaction = mySendingTransaction->nextWrite; } mySendingTransaction->nextWrite = this; } }