static Declarator_t f_ArgAbstractDeclarator( void ) { Declarator_t Declarator; Save(); if(( Declarator = f_AbstractDeclarator())) { if( token( 0 ) == '=' ) { step( 1 ); Declarator->Expr = f_AssignmentExpression(); } switch( token( 0 )) { case ',': case ')': case SN_ELLIPSIS: return Declarator; default: f_DeclaratorDestroy( Declarator ); Restore(); /* 21.02.97 rigo */ return 0; } } Restore(); /* 21.02.97 rigo */ return 0; }
LRESULT CView::OnTrayIcon(WPARAM wParam, LPARAM lParam) { // For a NOTIFYICONDATA with uVersion= 0, wParam and lParam have the following values: // The wParam parameter contains the identifier of the taskbar icon in which the event occurred. // The lParam parameter holds the mouse or keyboard message associated with the event. if (wParam != IDW_MAIN) return 0L; if (lParam == WM_LBUTTONUP) { Restore(); } else if (lParam == WM_RBUTTONUP) { CMenu TopMenu(IDM_MINIMIZED); CMenu* pSubMenu = TopMenu.GetSubMenu(0); SetForegroundWindow(); CPoint pt = GetCursorPos(); UINT uSelected = pSubMenu->TrackPopupMenu(TPM_RETURNCMD | TPM_NONOTIFY, pt.x, pt.y, this, NULL); switch (uSelected) { case IDM_MIN_RESTORE: Restore(); break; case IDM_MIN_ABOUT: OnAbout(); break; case IDM_MIN_EXIT: Destroy(); break; } } return 0; }
void TopWindow::Reject() { for(Ctrl *q = GetFirstChild(); q; q = q->GetNext()) q->Reject(); if(!backup.IsEmpty()) Restore(); }
void DirectxState::Initialize() { if(initialized) return; Restore(); initialized = true; }
/***************************************************************************\ Clears the specified surface. \***************************************************************************/ void IMR_DirectXInterface::Clear_Surface(LPDIRECTDRAWSURFACE4 Surface) { HRESULT ddflag; RECT Area; DDSURFACEDESC2 DDSurfaceDesc; char *Mem; // Make sure the surface exists: if (!Surface) return; // Lock the surface: DDSurfaceDesc.dwSize = sizeof(DDSurfaceDesc); ddflag = Surface->Lock(&Area, &DDSurfaceDesc, DDLOCK_WAIT, NULL); if (ddflag == DDERR_SURFACELOST) { Restore(Surface); ddflag = Surface->Lock(NULL, &DDSurfaceDesc, DDLOCK_WAIT, NULL); } if (ddflag != DD_OK) return; Mem = (char *)DDSurfaceDesc.lpSurface; // Clear the surface: if (Mem) memset(Mem, 0, DDSurfaceDesc.dwSize); // And unlock the surface: Surface->Unlock(NULL); }
GC::~GC() { Restore(); if (handle && needDelete) { DeleteDC(handle); } }
TError TContainerHolder::Restore(TScopedLock &holder_lock, const std::string &name, const kv::TNode &node) { if (name == ROOT_CONTAINER || name == PORTO_ROOT_CONTAINER) return TError::Success(); L_ACT() << "Restore container " << name << " (" << node.ShortDebugString() << ")" << std::endl; auto parent = GetParent(name); if (!parent) return TError(EError::InvalidValue, "invalid parent container"); int id = 0; TError error = RestoreId(node, id); if (error) return error; if (!id) return TError(EError::Unknown, "Couldn't restore container id"); auto c = std::make_shared<TContainer>(shared_from_this(), Storage, name, parent, id); error = c->Restore(holder_lock, node); if (error) { L_ERR() << "Can't restore container " << name << ": " << error << std::endl; return error; } Containers[name] = c; Statistics->Created++; return TError::Success(); }
void OpenGLState::Initialize() { if (initialized) return; initialized = true; Restore(); }
int RecDelete(KeyType k,BTNode *p) /*查找并删除关键字k*/ { int i; int found; if (p==NULL) return 0; else { if ((found=SearchNode(k,p,i))==1) /*查找关键字k*/ { if (p->ptr[i-1]!=NULL) /*若为非叶子结点*/ { Successor(p,i); /*由其后继代替它*/ RecDelete(p->key[i],p->ptr[i]); /*p->key[i]在叶子结点中*/ } else Remove(p,i); /*从*p结点中位置i处删除关键字*/ } else found=RecDelete(k,p->ptr[i]); /*沿孩子结点递归查找并删除关键字k*/ if (p->ptr[i]!=NULL) if (p->ptr[i]->keynum<Min) /*删除后关键字个数小于MIN*/ Restore(p,i); return found; } }
void MY_UI::Controls::Window::Maximize(){ if(!Internal_Window.Maximizeable) return; auto skin = MY_UI::Internal::WidgetSkin; if(Internal_Window.Maximized){// the window is in a maximized state.. this function should restore the window TitleBar->Maximize_Button->ClearImages(); TitleBar->Maximize_Button->Set_UnPressed_Texture(skin->Maximize_Window_Button);// take a copy of the UI skin for the texture TitleBar->Maximize_Button->Set_Pressed_Texture(skin->Maximize_Window_Button_Pressed);// take a copy of the UI skin for the texture Restore(); Internal_Window.Maximized = false; }else {// window is being maximized.. save old settings so it can be restored if(Internal_Window.Minimized){ // if maximizing from a minimized state, make sure to set minimized to false and set the texture correctly Internal_Window.Minimized = false; TitleBar->Minimize_Button->ClearImages(); TitleBar->Minimize_Button->Set_UnPressed_Texture(skin->Minimize_Window_Button);// take a copy of the UI skin for the texture TitleBar->Minimize_Button->Set_Pressed_Texture(skin->Minimize_Window_Button_Pressed);// take a copy of the UI skin for the texture } else { Internal_Window.Old_Size = GetSize(); Internal_Window.Old_Pos = GetPos(); } SetPos(0, 0); Utilities::Point p = Internal_Widget.Parent->GetSize();// get the parents size so the maximized window can be sized correctly SetSize(p.x, p.y); TitleBar->Maximize_Button->ClearImages(); TitleBar->Maximize_Button->Set_UnPressed_Texture(skin->Restore_Window_Button);// take a copy of the UI skin for the texture TitleBar->Maximize_Button->Set_Pressed_Texture(skin->Restore_Window_Button_Pressed);// take a copy of the UI skin for the texture Internal_Window.Maximized = true; } }
////////////////////////////////////////////////////////////////////// // Descripcion: // - Reproduce el sonido almacenado (o asociado) en el buffer secundario. // Parametros: // - dwFlags: Modo de reproduccion. Por defecto reproduce una // sola vez el sonido y acaba. Si recibe DSBPLAY_LOOPING se // reproducira el sonido continuamente. // Devuelve: // - true: Si la operacion se realiza con exito. // - false: Existe algun problema. // Notas: ////////////////////////////////////////////////////////////////////// bool DXDSWAVSound::Play(const dword dwFlags) { // SOLO si hay buffer secundario DXASSERT(m_lpDSBuffer != NULL); DWORD dwStatus; // Estado del buffer secundario // Inicializaciones dwStatus = m_lpDSBuffer->GetStatus(&dwStatus); // ¿Se ha perdido el buffer? if (dwStatus & DSBSTATUS_BUFFERLOST) { // Si; se llama al metodo Restore para recuperarlo Restore(); } // Se pone en marcha el sonido m_CodeResult = m_lpDSBuffer->Play(0, 0, dwFlags); if (FAILED(m_CodeResult)) { // Hay problemas DXDSError::DXDSErrorToString(m_CodeResult, m_sLastCode); return false; } // Todo correcto return true; }
void Solver<Dtype>::Solve(const char* resume_file) { LOG(INFO) << "Solving " << net_->name(); LOG(INFO) << "Learning Rate Policy: " << param_.lr_policy(); if (resume_file) { LOG(INFO) << "Restoring previous solver status from " << resume_file; Restore(resume_file); } // For a network that is trained by the solver, no bottom or top vecs // should be given, and we will just provide dummy vecs. Step(param_.max_iter() - iter_); // If we haven't already, save a snapshot after optimization, unless // overridden by setting snapshot_after_train := false if (param_.snapshot_after_train() && (!param_.snapshot() || iter_ % param_.snapshot() != 0)) { Snapshot(); } // After the optimization is done, run an additional train and test pass to // display the train and test loss/outputs if appropriate (based on the // display and test_interval settings, respectively). Unlike in the rest of // training, for the train net we only run a forward pass as we've already // updated the parameters "max_iter" times -- this final pass is only done to // display the loss, which is computed in the forward pass. if (param_.display() && iter_ % param_.display() == 0) { Dtype loss; net_->ForwardPrefilled(&loss); LOG(INFO) << "Iteration " << iter_ << ", loss = " << loss; } if (param_.test_interval() && iter_ % param_.test_interval() == 0) { TestAll(); } LOG(INFO) << "Optimization Done."; }
//Also resets the data in the animation.// WSL::Components::Algorithimic::SubBase::AllAnimationData WSL::Components::Algorithimic::Animation::GatherData() { WSL::Components::Algorithimic::SubBase::AllAnimationData temp; temp = Exchange( temp ); Restore(); return temp; }
CScreenOrientation::CScreenOrientation(const LPCTSTR szPath) : mLKFilePath(szPath), mOSFilePath(szPath) { if(!mOSFilePath.empty() && (*mOSFilePath.rbegin()) != L'\\') { mOSFilePath += _T(DIRSEP); } mOSFilePath += TEXT(LKD_CONF); mOSFilePath += TEXT(DIRSEP ".OSScreen"); // if we have OS saved state, previous don't shutdown correctly // so don't save current state. if(GetSavedSetting(mOSFilePath.c_str()) == invalid) { if(!Save(mOSFilePath.c_str())) { // TODO : Log Error; } } if(!mLKFilePath.empty() && (*mLKFilePath.rbegin()) != L'\\') { mLKFilePath += _T(DIRSEP); } mLKFilePath += TEXT(LKD_CONF); mLKFilePath += TEXT(DIRSEP ".LKScreen"); if(!Restore(mLKFilePath.c_str())) { // TODO : Log Error; } }
extern Enum_t f_Enum( void ) { Enum_t Enum; Save(); niveau++; if( token( 0 ) != SN_ENUM ) { niveau--; Restore(); return 0; } Enum = f_EnumCreate(); step( 1 ); if( token( 0 ) != LBRACE ) /* SN_IDENTIFIER or SN_NEW or ... */ { Enum->Name = f_NameCreate( ident( 0 )); step( 1 ); } if( token( 0 ) == LBRACE ) { // step( 1 ); //- MTP (bugfix -- skipped 1st enum) Enum->ListEnumerator = f_EnumeratorList(); f_StepTo( RBRACE, 0 ); step( 1 ); } niveau--; return Enum; }
bool CDialogVolumes::_ChangeVolumeWarningOK() { bool bOK = true; if(_CurrentVolumeModified()) { wxMessageDialog dlg( this, _T("Warning: The current " Volume_string " has been modified.\n\n" "Do you wish to save your modifications."), _T("Warning"), wxYES_NO | wxYES_DEFAULT | wxCANCEL | wxICON_EXCLAMATION ); int n = dlg.ShowModal(); if(n == wxID_OK || n == wxID_YES) { if(!_SaveCurrent()) { bOK = false; m_pChoice->SetStringSelection(m_sSelection); } } else if(n == wxID_CANCEL) { bOK = false; } else if(n == wxID_NO) { Restore(); } } return bOK; }
static Boolean_t expression_statement( void ) { Save(); if( f_expression()) { if( token( 0 ) == ';' ) { step( 1 ); } else { #ifdef CORVEX printf( "expected ';' at end of expression statement: %s:%d.%d\n" , filename_g , f_lineno( 0 ) , f_charno( 0 ) ); #endif } return True; } Restore(); return False; }
wxString wxRedirectableFd::Release() { Restore(); wxString name = m_name; m_name.clear(); return name; }
void wxTopLevelWindowMotif::Maximize( bool maximize ) { Show( true ); if( maximize ) Restore(); }
//----------------------------------------------------------------------------- // Name: GetMouse // // Desc: //----------------------------------------------------------------------------- VOID CInput::GetMouse( BOOL *l, BOOL *r, FLOAT *x, FLOAT *y ) { *l = *r = FALSE; *x = *y = 0.0f; if( !m_bMouseInitialized ) return; DIMOUSESTATE od; HRESULT hr; if( FAILED( hr = m_pDIMDev->GetDeviceState( sizeof(DIMOUSESTATE), &od ) ) ) { switch( hr ) { case DIERR_INPUTLOST: Restore(); break; } return; } *x = od.lX; *y = od.lY; *l = od.rgbButtons[0]; *r = od.rgbButtons[1]; }
//----------------------------------------------------------------------------- // Name: KeyDown // // Desc: //----------------------------------------------------------------------------- BOOL CInput::KeyDown( UCHAR key ) { char buffer[256]; HRESULT hr; if( !m_bKeyboardInitialized ) return FALSE; // Retrieve the keyboard data. hr = m_pDIKDev->GetDeviceState( sizeof(buffer), (LPVOID)&buffer ); if( FAILED( hr ) ) { switch( hr ) { case DIERR_INPUTLOST: // Device was lost, attempt to reacquire it. Restore(); break; } return FALSE; } // Check if the key wanted is down. if( buffer[key] & 0x80 ) return TRUE; return FALSE; }
int RecDelete(KeyType k,BTNode *p) //查找并删除关键字k { int i; int found; if (p==NULL) return 0; else { if ((found=SearchNode(k,p,i))==1) //查找关键字k { if (p->ptr[i-1]!=NULL) //若为非叶子结点 { Successor(p,i); //由其后继代替它 RecDelete(p->key[i],p->ptr[i]); //p->key[i]在叶子结点中 } else Remove(p,i); //从*p结点中位置i处删除关键字 } else found=RecDelete(k,p->ptr[i]); //沿孩子结点递归查找并删除关键字k if (p->ptr[i]!=NULL) if (p->ptr[i]->keynum<Min) //删除后关键字个数小于MIN Restore(p,i); return found; } }
static Enumerator_t f_Enumerator( void ) { Enumerator_t Enumerator; Save(); niveau++; if( token( 0 ) == SN_IDENTIFIER ) { Enumerator = f_EnumeratorCreate(); Enumerator->Name = f_NameCreate( ident( 0 )); step( 1 ); if( token( 0 ) == '=' ) { step( 1 ); Enumerator->Expr = f_ConstantExpression(); } niveau--; return Enumerator; } else { Restore(); niveau--; return 0; } }
bool Solver::Solve(const char* resume_file) { LOG(INFO) << "Solving " << net_->name(); LOG(INFO) << "Learning Rate Policy: " << param_.lr_policy(); // Initialize to false every time we start solving. requested_early_exit_ = false; if (resume_file != nullptr) { LOG(INFO) << "Restoring previous solver status from " << resume_file; Restore(resume_file); } callback_soft_barrier(); if (Caffe::restored_iter() != -1) { iter_ = Caffe::restored_iter(); iterations_restored_ = iter_; // for correct benchmarking iterations_last_ = -1; } // For a network that is trained by the solver, no bottom or top vecs // should be given, and we will just provide dummy vecs. int start_iter = iter_; Step(param_.max_iter() - iter_); // If we haven't already, save a snapshot after optimization, unless // overridden by setting snapshot_after_train := false if (param_.snapshot_after_train() && (!param_.snapshot() || iter_ % param_.snapshot() != 0)) { if (Caffe::root_solver()) { Snapshot(); } } Caffe::set_restored_iter(-1); iterations_restored_ = 0; iterations_last_ = 0; if (requested_early_exit_) { LOG(INFO) << "Optimization stopped early."; return true; } // After the optimization is done, run an additional train and test pass to // display the train and test loss/outputs if appropriate (based on the // display and test_interval settings, respectively). Unlike in the rest of // training, for the train net we only run a forward pass as we've already // updated the parameters "max_iter" times -- this final pass is only done to // display the loss, which is computed in the forward pass. if (this->display()) { int average_loss = this->param_.average_loss(); float loss; net_->Forward(&loss); UpdateSmoothedLoss(loss, start_iter, average_loss); LOG_IF(INFO, Caffe::root_solver()) << "Iteration " << iter_ << ", loss = " << smoothed_loss_; } if (param_.test_interval() && iter_ % param_.test_interval() == 0) { bool use_multi_gpu_testing = Caffe::solver_count() > 1; TestAll(0, use_multi_gpu_testing); callback_soft_barrier(); } return false; }
void CXTPDockingPaneTabbedContainer::OnCaptionButtonClick(CXTPDockingPaneCaptionButton* pButton) { CXTPDockingPane* pSelectedPane = m_pSelectedPane; CXTPDockingPaneManager* pManager = GetDockingPaneManager(); switch (pButton->GetID()) { case XTP_IDS_DOCKINGPANE_CLOSE: if (pManager->m_bCloseGroupOnButtonClick) { POSITION pos = m_lstPanes.GetTailPosition(); while (pos) { CXTPDockingPane* pPane = (CXTPDockingPane*)m_lstPanes.GetPrev(pos); ClosePane(pPane); } } else if (pSelectedPane) { ClosePane(pSelectedPane); } break; case XTP_IDS_DOCKINGPANE_AUTOHIDE: if (!IsHidden()) { if (!pManager->NotifyAction(xtpPaneActionUnpinning, pSelectedPane)) { GetDockingSite()->SetFocus(); NormalizeDockingSize(); pSelectedPane->Hide(); pManager->NotifyAction(xtpPaneActionUnpinned, pSelectedPane); } } else { GetDockingPaneManager()->ToggleDocking(pManager->m_bHideGroupOnButtonClick ? (CXTPDockingPaneBase*)this : (CXTPDockingPaneBase*)pSelectedPane); } break; case XTP_IDS_DOCKINGPANE_MAXIMIZE: Maximize(); break; case XTP_IDS_DOCKINGPANE_RESTORE: Restore(); break; } }
//***************************************************************************** // //***************************************************************************** bool Translate_Read(u32 idx, const char * dir) { /// Always unload previous language file if available Translate_Unload(); if( idx > gLanguage.size() ) return false; const char * ext( ".lng" ); char line[1024]; IO::Filename path; char *string; FILE *stream; u32 count = 0; u32 hash = 0; u32 len = 0; // Build path where we'll load the translation file(s) strcpy(path, dir); strcat(path, gLanguage[ idx ].c_str()); strcat(path, ext); stream = fopen(path,"r"); if( stream == NULL ) { return false; } while( fgets(line, 1023, stream) ) { // Strip spaces from end of lines Tidy(line); // Handle comments if (line[0] == '/') continue; string = strchr(line,','); if( string != NULL ) { string++; len = strlen( string ); sscanf( line,"%08x", &hash ); if( count < ARRAYSIZE(text) ) { // Write translated string and hash to array text[count].hash = hash; Translate_Dump( string, hash == TRANSLATE_DUMP_VALUE ); text[count].translated = (char*)malloc_volatile(len+1); // Leave space for terminator strcpy( text[count].translated, Restore( string, len ) ); count++; } } } fclose(stream); return true; }
void Display_Title(void) //プログラムタイトル表示を関数化 040928 { Cls(); Setcolor(CYAN,BLACK); printf(" Weight Bearing Control Program\n"); printf(" Copyright All Reserved by Fujie Lab. 2005\n\n"); Restore(); }
void SpriteCursor::SetSprite(const Surface & sf) { if(visible) Restore(); Save(Background::x, Background::y, sf.w(), sf.h()); sprite = &sf; }
void SpriteCursor::Hide(void) { if(!visible) return; Restore(); visible = false; }
ScreenSaverX11::~ScreenSaverX11() { /* Ensure DPMS gets left as it was found. */ if (d->DeactivatedDPMS()) Restore(); delete d; }