//-------------------------------------------------------------------// // RunInstalledVersion() // //-------------------------------------------------------------------// // This function is called if an EXE was run other than the one in // the install path. It will set up to run the installed version. // After returning from this function, the caller should quickly // exit the currently running program. // // This function can update the installed version of the program with // the one currently running, if bUpdate is true. // // This is not a straightforward task, because we cannot copy // ourselves while we are running - Windows has the file exclusively // locked. // // Instead, we fire off a hidden batch file. The batch file polls // for a successful copy of this executable over the installed // version. It will have to keep trying up until the point where // this executable exits. So once we call this function, we want // to exit the app as quickly as possible, so the whole machine // does not grind to a halt. Note that the batch file's process is // manhandled by this function to minimize its impact. // // An article in MSDN ( MSJ, Win Q & A, Deleting an executable ) has // a comprehensive discussion of the problem of operating on the // file of a running executable. The concept and original code were // taken from there. //-------------------------------------------------------------------// void BaseApp::RunInstalledVersion( bool bUpdate ) { // Delete the shared memory, so the installed version can create it // properly on its own. CleanUp(); // We want to get the short filename for the installation directory. // Make sure we create it first, or GetShortFilename() returns a blank string!! VERIFY( MakeDir( m_strRegistryPath ) ); CString strRegistryFilename = AddTrailingBackslash( GetShortFilename( m_strRegistryPath ) ) + m_strExeName; if ( !bUpdate ) { ShellExecute( NULL, _T("open"), LPCTSTR( m_strExeName ), LPCTSTR( pCommandLine->m_strFileName ), // pointer to string that specifies executable-file parameters. LPCTSTR( m_strRegistryPath ), // pointer to string that specifies default directory. SW_SHOW // whether file is shown when opened. ); } else { // Get the current filename. Convert it to a short name, // so the batch file works. CString strCurrentFilename = GetShortFilename( GetProgramFilename() ); // We now replace the installed version of the EXE using // a batch file. // We need to do some prepping. // We need to make sure the installed file is deleted before we // call the batch file. It polls for existance of the file, and // we don't want it to find it until we successfully copied it. // We could let the batch file do this, but minimizing the batch // file's requirements helps us minimize its impact. Besides, // this may not succeed. Typically, this fails if the executable is // already running. If so, the user is prolly farting around. We just exit. bool bInstallIsDeleted = !bFileExists( strRegistryFilename ); if ( !bInstallIsDeleted ) bInstallIsDeleted = ( DeleteFile( strRegistryFilename ) != FALSE ); if ( bInstallIsDeleted ) { // Create a temporary batch file. // We create it in c:\. // TO DO // Consider using %TEMP%. #define BATCH_FILE_NAME _T("c:\\Temp.bat") #define BATCH_FILE_PATH _T("c:\\") HANDLE hfile; STARTUPINFO si; PROCESS_INFORMATION pi; hfile = CreateFile( BATCH_FILE_NAME, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL ); if ( hfile != INVALID_HANDLE_VALUE ) { // Construct the lines for the batch file. CString strBatFile; // This fills the batch file in one fell swoop. Unfortunately, the batch file // ends up getting truncated somewhere in this mess. /* strBatFile.Format( _T(":Repeat" ) _T("\r\n") // Set up the loop point. _T("copy \"%s\" \"%s\"" ) _T("\r\n") // Attempt to copy this file to install file. _T("if not exist \"%s\" goto Repeat" ) _T("\r\n") // If it did not yet succeed, loop. _T("Start \"%s\"" ) _T("\r\n") // Run the install file. _T("del \"%s\"" ) _T("\r\n"), // Delete the batch file. // Command: LPCTSTR( strCurrentFilename ), // copy from LPCTSTR( strRegistryFilename ), // copy to LPCTSTR( strRegistryFilename ), // if not exist LPCTSTR( strRegistryFilename ), // Start BATCH_FILE_NAME // del ); */ // We'll do the batch file one line at a time. // NOTE: When we use "Start" to fire up the program here, Win2000 gags. I believe we // can nix the "Start" prefix and just run the proggie directly. TEST ON 9x! CString strBatLine; strBatLine.Format( _T(":Repeat" ) ); strBatFile += strBatLine + _T("\r\n"); // Set up the loop point. strBatLine.Format( _T("copy \"%s\" \"%s\"" ), LPCTSTR( strCurrentFilename ), LPCTSTR( strRegistryFilename ) ); strBatFile += strBatLine + _T("\r\n"); // Attempt to copy this file to install file. strBatLine.Format( _T("if not exist \"%s\" goto Repeat" ), LPCTSTR( strRegistryFilename ) ); strBatFile += strBatLine + _T("\r\n"); // If it did not yet succeed, loop. strBatLine.Format( _T("\"%s\"" ), LPCTSTR( strRegistryFilename ) ); strBatFile += strBatLine + _T("\r\n"); // Run the install file. // #pragma _DEBUGCODE("Newer version not getting copied over if old is RUNNING...") strBatLine.Format( _T("del \"%s\"" ), BATCH_FILE_NAME ); strBatFile += strBatLine + _T("\r\n"); // Delete the batch file. strBatLine.Format( _T("exit" ), BATCH_FILE_NAME ); strBatFile += strBatLine + _T("\r\n"); // Exit - this prolly won't work, since we just deleted the batch file! :> DWORD dwNumberOfBytesWritten = strBatFile.GetLength(); // Write the batch file and close it. WriteFile( hfile, LPCTSTR( strBatFile ), strBatFile.GetLength(), &dwNumberOfBytesWritten, NULL ); CloseHandle(hfile); ASSERT( dwNumberOfBytesWritten == (DWORD) strBatFile.GetLength() ); // Get ready to spawn the batch file we just created. ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); // We want its console window to be invisible to the user. si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; // #pragma _DEBUGCODE("Newer version not getting copied over if old is RUNNING...") // For debugging purposes, show the window. // si.wShowWindow = SW_SHOW; // Spawn the batch file with low-priority. if ( CreateProcess( NULL, BATCH_FILE_NAME, NULL, NULL, FALSE, IDLE_PRIORITY_CLASS, // CREATE_SUSPENDED | IDLE_PRIORITY_CLASS, NULL, NULL, // LPCTSTR( m_strRegistryPath ), &si, &pi ) ) { // Lower the batch file's priority even more. // I removed this, because I was worried it might not ever // run. For example, I have been running a background process // that sucks up ALL idle time. /* SetThreadPriority( pi.hThread, THREAD_PRIORITY_IDLE ); */ // Raise our priority so that we terminate as quickly as possible. ::SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL ); SetPriorityClass( GetCurrentProcess(), HIGH_PRIORITY_CLASS ); // Allow the batch file to run and clean up our handles. CloseHandle( pi.hProcess ); ::ResumeThread( pi.hThread ); // We want to terminate right away now so that we can be deleted. CloseHandle( pi.hThread ); } } } } }
CWayPointManager::~CWayPointManager() { CleanUp(); }
cSkinnedMesh::~cSkinnedMesh() { CleanUp(); }
CParticleSettingsManager::~CParticleSettingsManager() { CleanUp(); }
CException::~CException() { CleanUp(); };
p4dn::Error::~Error( void ) { CleanUp(); }
void BacklashTool::DecMeasurementStep(const PHD_Point& currentCamLoc) { double decDelta = 0.; double amt = 0; // double fakeDeltas []= {0, -5, -2, 2, 4, 5, 5, 5, 5 }; PHD_Point currMountLocation; try { if (m_scope->TransformCameraCoordinatesToMountCoordinates(currentCamLoc, currMountLocation)) throw ERROR_INFO("BLT: CamToMount xForm failed"); if (m_bltState != BLT_STATE_INITIALIZE) { decDelta = currMountLocation.Y - m_markerPoint.Y; m_cumClearingDistance += decDelta; // use signed value //if (m_bltState == BLT_STATE_CLEAR_NORTH) // DEBUG ONLY // decDelta = fakeDeltas[wxMin(m_stepCount, 7)]; } switch (m_bltState) { case BLT_STATE_INITIALIZE: m_stepCount = 0; m_markerPoint = currMountLocation; m_startingPoint = currMountLocation; // Compute pulse size for clearing backlash - just use the last known guide rate m_pulseWidth = BACKLASH_EXPECTED_DISTANCE * 1.25 / m_lastDecGuideRate; // px/px_per_ms, bump it to sidestep near misses m_acceptedMoves = 0; m_lastClearRslt = 0; m_cumClearingDistance = 0; m_backlashExemption = false; m_Rslt = MEASUREMENT_VALID; // Get this state machine in synch with the guider state machine - let it drive us, starting with backlash clearing step m_bltState = BLT_STATE_CLEAR_NORTH; m_scope->SetGuidingEnabled(true); pFrame->pGuider->EnableMeasurementMode(true); // Measurement results now come to us break; case BLT_STATE_CLEAR_NORTH: // Want to see the mount moving north for 3 consecutive moves of >= expected distance pixels if (m_stepCount == 0) { // Get things moving with the first clearing pulse Debug.AddLine(wxString::Format("BLT starting North backlash clearing using pulse width of %d," " looking for moves >= %d px", m_pulseWidth, BACKLASH_EXPECTED_DISTANCE)); pFrame->ScheduleCalibrationMove(m_scope, NORTH, m_pulseWidth); m_stepCount = 1; m_lastStatus = wxString::Format("Clearing North backlash, step %d", m_stepCount); break; } if (fabs(decDelta) >= BACKLASH_EXPECTED_DISTANCE) { if (m_acceptedMoves == 0 || (m_lastClearRslt * decDelta) > 0) // Just starting or still moving in same direction { m_acceptedMoves++; Debug.AddLine(wxString::Format("BLT accepted clearing move of %0.2f", decDelta)); } else { m_acceptedMoves = 0; // Reset on a direction reversal Debug.AddLine(wxString::Format("BLT rejected clearing move of %0.2f, direction reversal", decDelta)); } } else Debug.AddLine(wxString::Format("BLT backlash clearing move of %0.2f px was not large enough", decDelta)); if (m_acceptedMoves < BACKLASH_MIN_COUNT) // More work to do { if (m_stepCount < MAX_CLEARING_STEPS) { if (fabs(m_cumClearingDistance) > BACKLASH_EXEMPTION_DISTANCE) { // We moved the mount a substantial distance north but the individual moves were too small - probably a bad calibration, // so let the user proceed with backlash measurement before we push the star too far Debug.AddLine(wxString::Format("BLT: Cum backlash of %0.2f px is at least half of expected, continue with backlash measurement", m_cumClearingDistance)); m_backlashExemption = true; } else { if (!OutOfRoom(pCamera->FullSize, currentCamLoc.X, currentCamLoc.Y, pFrame->pGuider->GetMaxMovePixels())) { pFrame->ScheduleCalibrationMove(m_scope, NORTH, m_pulseWidth); m_stepCount++; m_markerPoint = currMountLocation; m_lastClearRslt = decDelta; m_lastStatus = wxString::Format("Clearing North backlash, step %d (up to limit of %d)", m_stepCount, MAX_CLEARING_STEPS); Debug.AddLine(wxString::Format("BLT: %s, LastDecDelta = %0.2f px", m_lastStatus, decDelta)); break; } } } else { m_lastStatus = _("Could not clear North backlash - test failed"); m_Rslt = MEASUREMENT_INVALID; throw ERROR_INFO("BLT: Could not clear N backlash"); } } if (m_acceptedMoves >= BACKLASH_MIN_COUNT || m_backlashExemption || OutOfRoom(pCamera->FullSize, currentCamLoc.X, currentCamLoc.Y, pFrame->pGuider->GetMaxMovePixels())) // Ok to go ahead with actual backlash measurement { m_markerPoint = currMountLocation; // Marker point at start of big Dec move North m_bltState = BLT_STATE_STEP_NORTH; double totalBacklashCleared = m_stepCount * m_pulseWidth; // Want to move the mount North at >=500 ms, regardless of image scale. But reduce pulse width if it would exceed 80% of the tracking rectangle - // need to leave some room for seeing deflections and dec drift m_pulseWidth = wxMax((int)NORTH_PULSE_SIZE, m_scope->GetCalibrationDuration()); m_pulseWidth = wxMin(m_pulseWidth, (int)floor(0.7 * (double)pFrame->pGuider->GetMaxMovePixels() / m_lastDecGuideRate)); m_stepCount = 0; // Move 50% more than the backlash we cleared or >=8 secs, whichever is greater. We want to leave plenty of room // for giving South moves time to clear backlash and actually get moving m_northPulseCount = wxMax((MAX_NORTH_PULSES + m_pulseWidth - 1) / m_pulseWidth, totalBacklashCleared * 1.5 / m_pulseWidth); // Up to 8 secs Debug.AddLine(wxString::Format("BLT: Starting North moves at Dec=%0.2f", currMountLocation.Y)); // falling through to start moving North } case BLT_STATE_STEP_NORTH: if (m_stepCount < m_northPulseCount && !OutOfRoom(pCamera->FullSize, currentCamLoc.X, currentCamLoc.Y, pFrame->pGuider->GetMaxMovePixels())) { m_lastStatus = wxString::Format("Moving North for %d ms, step %d / %d", m_pulseWidth, m_stepCount + 1, m_northPulseCount); Debug.AddLine(wxString::Format("BLT: %s, DecLoc = %0.2f", m_lastStatus, currMountLocation.Y)); m_northBLSteps.push_back(currMountLocation.Y); pFrame->ScheduleCalibrationMove(m_scope, NORTH, m_pulseWidth); m_stepCount++; break; } else { // Either got finished or ran out of room Debug.AddLine(wxString::Format("BLT: North pulses ended at Dec location %0.2f, DecDelta=%0.2f px", currMountLocation.Y, decDelta)); m_northBLSteps.push_back(currMountLocation.Y); if (m_stepCount < m_northPulseCount) { if (m_stepCount < 0.5 * m_northPulseCount) { pFrame->Alert(_("Star too close to edge for accurate measurement of backlash")); m_Rslt = MEASUREMENT_INVALID; } Debug.AddLine("BLT: North pulses truncated, too close to frame edge"); } m_northRate = fabs(decDelta / (m_stepCount * m_pulseWidth)); m_northPulseCount = m_stepCount; m_stepCount = 0; m_bltState = BLT_STATE_STEP_SOUTH; // falling through to moving back South } case BLT_STATE_STEP_SOUTH: if (m_stepCount < m_northPulseCount) { m_lastStatus = wxString::Format("Moving South for %d ms, step %d / %d", m_pulseWidth, m_stepCount + 1, m_northPulseCount); Debug.AddLine(wxString::Format("BLT: %s, DecLoc = %0.2f", m_lastStatus, currMountLocation.Y)); m_southBLSteps.push_back(currMountLocation.Y); pFrame->ScheduleCalibrationMove(m_scope, SOUTH, m_pulseWidth); m_stepCount++; break; } // Now see where we ended up - fall through to testing this correction Debug.AddLine(wxString::Format("BLT: South pulses ended at Dec location %0.2f", currMountLocation.Y)); m_southBLSteps.push_back(currMountLocation.Y); m_endSouth = currMountLocation; m_bltState = BLT_STATE_TEST_CORRECTION; m_stepCount = 0; // fall through case BLT_STATE_TEST_CORRECTION: if (m_stepCount == 0) { // decDelta contains the nominal backlash amount m_backlashResultPx = fabs(decDelta); m_backlashResultMs = (int)(m_backlashResultPx / m_northRate); // our north rate is probably better than the calibration rate if (m_Rslt == MEASUREMENT_VALID) { if (m_backlashResultMs >= 0.8 * m_northPulseCount * m_pulseWidth) m_Rslt = MEASUREMENT_IMPAIRED; // May not have moved far enough north for accurate measurement } Debug.AddLine(wxString::Format("BLT: Backlash amount is %0.2f px, %d ms", m_backlashResultPx, m_backlashResultMs)); // Don't try this refinement if the clearing pulse will cause us to lose the star if (m_backlashResultPx < pFrame->pGuider->GetMaxMovePixels()) { m_lastStatus = wxString::Format(_("Issuing test backlash correction of %d ms"), m_backlashResultMs); Debug.AddLine(m_lastStatus); // This should put us back roughly to where we issued the big North pulse unless the backlash is very large pFrame->ScheduleCalibrationMove(m_scope, SOUTH, m_backlashResultMs); m_stepCount++; } else { int maxFrameMove = (int)floor((double)pFrame->pGuider->GetMaxMovePixels() / m_northRate); Debug.AddLine(wxString::Format("BLT: Clearing pulse is very large, issuing max S move of %d", maxFrameMove)); pFrame->ScheduleCalibrationMove(m_scope, SOUTH, maxFrameMove); // One more pulse to cycle the state machine m_bltState = BLT_STATE_RESTORE; } break; } // See how close we came, maybe fine-tune a bit Debug.AddLine(wxString::Format("BLT: Trial backlash pulse resulted in net DecDelta = %0.2f px, Dec Location %0.2f", decDelta, currMountLocation.Y)); if (fabs(decDelta) > TRIAL_TOLERANCE) { double pulse_delta = fabs(currMountLocation.Y - m_endSouth.Y); if ((m_endSouth.Y - m_markerPoint.Y) * decDelta < 0) // Sign change, went too far { m_backlashResultMs *= m_backlashResultPx / pulse_delta; Debug.AddLine(wxString::Format("BLT: Trial backlash resulted in overshoot - adjusting pulse size by %0.2f", m_backlashResultPx / pulse_delta)); } else { double corr_factor = (m_backlashResultPx / pulse_delta - 1.0) * 0.5 + 1.0; // apply 50% of the correction to avoid over-shoot //m_backlashResultMs *= corr_factor; Debug.AddLine(wxString::Format("BLT: Trial backlash resulted in under-correction - under-shot by %0.2f", corr_factor)); } } else Debug.AddLine("BLT: Initial backlash pulse resulted in final delta of < 2 px"); m_bltState = BLT_STATE_RESTORE; m_stepCount = 0; // fall through case BLT_STATE_RESTORE: // We could be a considerable distance from where we started, so get back close to the starting point without losing the star if (m_stepCount == 0) { Debug.AddLine(wxString::Format("BLT: Starting Dec position at %0.2f, Ending Dec position at %0.2f", m_markerPoint.Y, currMountLocation.Y)); amt = fabs(currMountLocation.Y - m_startingPoint.Y); if (amt > pFrame->pGuider->GetMaxMovePixels()) { m_restoreCount = (int)floor((amt / m_northRate) / m_pulseWidth); Debug.AddLine(wxString::Format("BLT: Final restore distance is %0.1f px, approx %d steps", amt, m_restoreCount)); m_stepCount = 0; } else m_bltState = BLT_STATE_WRAPUP; } if (m_stepCount < m_restoreCount) { pFrame->ScheduleCalibrationMove(m_scope, SOUTH, m_pulseWidth); m_stepCount++; m_lastStatus = _("Restoring star position"); Debug.AddLine("BLT: Issuing restore pulse count %d of %d ms", m_stepCount, m_pulseWidth); break; } m_bltState = BLT_STATE_WRAPUP; // fall through case BLT_STATE_WRAPUP: m_lastStatus = _("Measurement complete"); CleanUp(); m_bltState = BLT_STATE_COMPLETED; break; case BLT_STATE_COMPLETED: break; case BLT_STATE_ABORTED: m_lastStatus = _("Measurement halted"); Debug.AddLine("BLT: measurement process halted by user"); CleanUp(); break; } // end of switch on state } catch (const wxString& msg) { Debug.AddLine(wxString::Format("BLT: Exception thrown in logical state %d", (int)m_bltState)); m_bltState = BLT_STATE_ABORTED; m_lastStatus = _("Measurement encountered an error: " + msg); Debug.AddLine("BLT: " + m_lastStatus); CleanUp(); } }
MaleFirstNameDataFileRecordTestCases::~MaleFirstNameDataFileRecordTestCases() { CleanUp( &dfr1 ); }
void ShellCommand::OnProcessTerminated(wxCommandEvent& e) { ProcessEventData *ped = (ProcessEventData*)e.GetClientData(); delete ped; CleanUp(); }
virtual void Cancel() { CleanUp(); //our object has been destructed at this point }
int main (int argc, const char * argv[]) { /* Init stack pointers, capitilization shows priority and letter describes direction */ EStack = (TStack *)malloc(sizeof(TStack)); eStack = (TStack *)malloc(sizeof(TStack)); WStack = (TStack *)malloc(sizeof(TStack)); wStack = (TStack *)malloc(sizeof(TStack)); EStack->Head = NULL; eStack->Head = NULL; WStack->Head = NULL; wStack->Head = NULL; EStack->Count = 0; eStack->Count = 0; WStack->Count = 0; wStack->Count = 0; EStack->StackUse = 0; eStack->StackUse = 0; WStack->StackUse = 0; wStack->StackUse = 0; /* init parameters */ inFileName = argv[1]; NumTrains = atoi(argv[2]); TrainsFinished = 0;TrackInUse = 0; LastDirection = (char*)malloc(sizeof(char)*4); strcpy(LastDirection, "East"); if (inFileName == NULL || NumTrains == 0) { printf("Usage : ./mts [inputfile] [number of trains]\n"); return 1; } /* init stack mutexes */ pthread_mutex_init (&eStack->Mutex, NULL);pthread_mutex_init (&wStack->Mutex, NULL);pthread_mutex_init (&WStack->Mutex, NULL); pthread_mutex_init (&EStack->Mutex, NULL);pthread_cond_init (&EStack->Cv, NULL);pthread_cond_init (&eStack->Cv, NULL); pthread_cond_init (&WStack->Cv, NULL);pthread_cond_init (&wStack->Cv, NULL);pthread_mutex_init (&TrackMutex, NULL); pthread_cond_init (&TrackState, NULL); ReadFile(); /* Read the file, and setup the Loading array */ int i = 0; for (LoadingCurrent = LoadingThreads; i < NumTrains; LoadingCurrent++) { pthread_mutex_init(&LoadingCurrent->TMutex, NULL); pthread_cond_init(&LoadingCurrent->TState, NULL); pthread_create(&LoadingCurrent->tid, NULL, train, (void *)LoadingCurrent); i++; } /* Main scheduling loop, wait until all trains are finished. */ while (TrainsFinished < NumTrains) { if (TrackInUse) { pthread_cond_wait(&TrackState, &TrackMutex); pthread_mutex_unlock(&TrackMutex); if (TrainsFinished == NumTrains) break; } if (EStack->Count || WStack->Count) { /* EStack or WStack is not NULL */ if (EStack->Count && WStack->Count) { if (strcmp(LastDirection, "East") == 0) { /* if the last direction was east, send west */ pthread_mutex_lock(&TrackMutex); pthread_cond_signal(&WStack->Current->TState); } else { pthread_mutex_lock(&TrackMutex); pthread_cond_signal(&EStack->Current->TState); } } else if (EStack->Count) { /* If EStack is not NULL */ pthread_mutex_lock(&TrackMutex); pthread_cond_signal(&EStack->Current->TState); } else if (WStack->Count) { /* If WStack is not NULL */ pthread_mutex_lock(&TrackMutex); pthread_cond_signal(&WStack->Current->TState); } } else if (wStack->Count || eStack->Count) { /* eStack or wStack != NULL */ if (eStack->Count && wStack->Count) { if (strcmp(LastDirection, "East") == 0) { /* if the last direction was east, send west */ pthread_mutex_lock(&TrackMutex); pthread_cond_signal(&wStack->Current->TState); } else { pthread_mutex_lock(&TrackMutex); pthread_cond_signal(&eStack->Current->TState); } } else if (eStack->Count) { /* if the low pri east stack is not NULL */ pthread_mutex_lock(&TrackMutex); pthread_cond_signal(&eStack->Current->TState); } else if (wStack->Count) { /* if the low pri west stack is not NULL */ pthread_mutex_lock(&TrackMutex); pthread_cond_signal(&wStack->Current->TState); } } pthread_mutex_unlock(&TrackMutex); } CleanUp(); pthread_exit(NULL); }
int __cdecl main(int argc, char *argv[]) { HANDLE hFile = NULL; DWORD dwBytesWritten; const char* hugeStringTest = "1234567890123456789012345678901234567890"; const char* szWritableFile = "writeable.txt"; int i =0; if (0 != PAL_Initialize(argc,argv)) { return FAIL; } /* create the test file */ hFile = CreateFile(szWritableFile, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if(hFile == INVALID_HANDLE_VALUE) { Fail("WriteFile: ERROR -> Unable to create file \"%s\".\n", szWritableFile); } /* write 4000 000 chars to the file.*/ for (i=0; i<100000;i++) { if( WriteFile(hFile, /* HANDLE handle to file */ hugeStringTest, /* data buffer */ strlen(hugeStringTest), /* number of bytes to write */ &dwBytesWritten, /* number of bytes written */ NULL) /* overlapped buffer */ ==0) { Trace("WriteFile: ERROR -> Unable to write to file error: %ld \n", GetLastError()); CleanUp(hFile,szWritableFile); Fail(""); } } if(!FlushFileBuffers(hFile)) { Trace("WriteFile: ERROR -> Call to FlushFileBuffers failed" "error %ld \n",GetLastError()); CleanUp(hFile,szWritableFile); Fail(""); } /* test if the size changed properly. */ if(GetFileSize(hFile,NULL) != 4000000) { Trace("WriteFile: ERROR -> file size did not change properly" " after writing 4000 000 chars to it ( size= %u )\n", GetFileSize(hFile,NULL)); CleanUp(hFile,szWritableFile); Fail(""); } if (!CleanUp(hFile,szWritableFile)) { Fail(""); } PAL_Terminate(); return PASS; }
/** * Schliesst das Fenster. * * @author FloSoft */ void VideoSDL::DestroyScreen(void) { // Fenster schliessen CleanUp(); Initialize(); }
//-------------------------------------------------------------------// // ~BaseApp() // //-------------------------------------------------------------------// BaseApp::~BaseApp() { CleanUp(); }
ResultSet::~ResultSet() { CleanUp(); }
void ShellCommand::Stop() { //kill the build process CleanUp(); }
PreparedResultSet::PreparedResultSet(MYSQL_STMT* stmt, MYSQL_RES *result, uint64 rowCount, uint32 fieldCount) : m_rowCount(rowCount), m_rowPosition(0), m_fieldCount(fieldCount), m_rBind(NULL), m_stmt(stmt), m_res(result), m_isNull(NULL), m_length(NULL) { if (!m_res) return; if (m_stmt->bind_result_done) { delete[] m_stmt->bind->length; delete[] m_stmt->bind->is_null; } m_rBind = new MYSQL_BIND[m_fieldCount]; m_isNull = new my_bool[m_fieldCount]; m_length = new unsigned long[m_fieldCount]; memset(m_isNull, 0, sizeof(my_bool) * m_fieldCount); memset(m_rBind, 0, sizeof(MYSQL_BIND) * m_fieldCount); memset(m_length, 0, sizeof(unsigned long) * m_fieldCount); //- This is where we store the (entire) resultset if (mysql_stmt_store_result(m_stmt)) { TC_LOG_WARN("sql.sql", "%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); delete[] m_rBind; delete[] m_isNull; delete[] m_length; return; } //- This is where we prepare the buffer based on metadata uint32 i = 0; MYSQL_FIELD* field = mysql_fetch_field(m_res); while (field) { size_t size = Field::SizeForType(field); m_rBind[i].buffer_type = field->type; m_rBind[i].buffer = malloc(size); memset(m_rBind[i].buffer, 0, size); m_rBind[i].buffer_length = size; m_rBind[i].length = &m_length[i]; m_rBind[i].is_null = &m_isNull[i]; m_rBind[i].error = NULL; m_rBind[i].is_unsigned = field->flags & UNSIGNED_FLAG; ++i; field = mysql_fetch_field(m_res); } //- This is where we bind the bind the buffer to the statement if (mysql_stmt_bind_result(m_stmt, m_rBind)) { TC_LOG_WARN("sql.sql", "%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); delete[] m_rBind; delete[] m_isNull; delete[] m_length; return; } m_rowCount = mysql_stmt_num_rows(m_stmt); m_rows.resize(uint32(m_rowCount)); while (_NextRow()) { m_rows[uint32(m_rowPosition)] = new Field[m_fieldCount]; for (uint64 fIndex = 0; fIndex < m_fieldCount; ++fIndex) { if (!*m_rBind[fIndex].is_null) m_rows[uint32(m_rowPosition)][fIndex].SetByteValue(m_rBind[fIndex].buffer, m_rBind[fIndex].buffer_length, m_rBind[fIndex].buffer_type, *m_rBind[fIndex].length); else switch (m_rBind[fIndex].buffer_type) { case MYSQL_TYPE_TINY_BLOB: case MYSQL_TYPE_MEDIUM_BLOB: case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_BLOB: case MYSQL_TYPE_STRING: case MYSQL_TYPE_VAR_STRING: m_rows[uint32(m_rowPosition)][fIndex].SetByteValue("", m_rBind[fIndex].buffer_length, m_rBind[fIndex].buffer_type, *m_rBind[fIndex].length); break; default: m_rows[uint32(m_rowPosition)][fIndex].SetByteValue(nullptr, m_rBind[fIndex].buffer_length, m_rBind[fIndex].buffer_type, *m_rBind[fIndex].length); } } m_rowPosition++; } m_rowPosition = 0; /// All data is buffered, let go of mysql c api structures CleanUp(); }
/* ================ idEntityFx::Stop ================ */ void idEntityFx::Stop( void ) { CleanUp(); started = -1; }
void p4dn::Error::Dispose() { System::GC::SuppressFinalize(this); _Disposed = true; CleanUp(); }
/* ================ idEntityFx::~idEntityFx ================ */ idEntityFx::~idEntityFx() { CleanUp(); fxEffect = NULL; }
/** * Destruktor der DriverWrapper Klasse. * * @author FloSoft */ VideoDriverWrapper::~VideoDriverWrapper() { CleanUp(); }
Device::~Device() { CleanUp(); }
CLangBarItemButton::~CLangBarItemButton() { DllRelease(); CleanUp(); }
CALSound::~CALSound() { CleanUp(); }
void CException::SetMessage(LPCTSTR pmessage) { CleanUp(); CopyString(pmessage); }
int main (int argc, char *argv[]) { payguide::time_start=time(NULL); int Ppid=CheckIfPayguideAlreadyUp(); if (Ppid==0) { if (MakeLockFile()!=0) { std::cout << "Error while creating lock file. Can't write /tmp/payguide.lock" << std::endl; LogWrite(LOGMSG_CRITICAL, "Error while creating lock file. Can't write /tmp/payguide.lock"); } } else { char msg[512]; snprintf(msg, 511,"Error: payguide already running as process %i. Balling out.", Ppid); std::cout << msg << std::endl; LogWrite(LOGMSG_CRITICAL, msg); exit(0); } PayguideInit(); WorkInit(); bool work_init_already=true; bonbon::BonbonInit(); PerlInit(argv[0], payguide::perl_module.c_str()); payguide::data_conventor.Init(); for (EVER) { std::cout << "Running xml paycheck..." << std::endl; const char *main_config_file="/etc/payguide.cfg"; paycheck::CPaycheckCore paycheck_core; paycheck_core.LoadConfig(main_config_file); paycheck::CServer server_code; bonbon::CJobManager in_manager; std::vector <paycheck::CSocket *> connections_store; paycheck::CPaycheckThreadParam params(&in_manager, &connections_store, &paycheck_core); bonbon::CThread xml_server1(server_code, params); payguide::xml_paycheck_core=&paycheck_core; payguide::quit=false; if (!work_init_already) WorkInit(); int sleep_count=0; timespec req; req.tv_sec=0; req.tv_nsec=50000000; payguide::working=true; LogWrite(LOGMSG_SYSTEM, "Payguide server started sucessful and ready for a work"); /* Ok, lets rock */ SPay *new_pay=NULL; sem_wait(&payguide::shutdown_lock); bool working_state=payguide::working; sem_post(&payguide::shutdown_lock); printf("TESTING printf(): if you see that in log - world gone mad\n"); std::cout << "TESTING std::cout: if you see that in log - world gone mad" << std::endl; while (working_state) { sem_wait(&payguide::shutdown_lock); working_state=payguide::working; sem_post(&payguide::shutdown_lock); /* Get next pay from DB */ if (new_pay==NULL) { new_pay=paycheck_core.XMLGetNextPay(); if (new_pay==NULL) { new_pay=PCGetNextPay(); if (new_pay==NULL) { //printf("get new pay from DB\n"); if (sleep_count==1) new_pay=DBGetNextPay(); } else if (new_pay->test==NO_TEST) { LogWrite(LOGMSG_CRITICAL, "Payguide received from BIN PAYCHECK (payd) must be marked as testing. Shutdown."); char tmp[1024]; snprintf(tmp, 1024, "Pay params: id/session=[%lli] terminal=[%lli] operator=%i", new_pay->id, new_pay->terminal_id, new_pay->provider_id); LogWrite(LOGMSG_CRITICAL, tmp); exit(-1); } } else if (new_pay->test==NO_TEST) { LogWrite(LOGMSG_CRITICAL, "Payguide received from XML PAYCHECK must be marked as testing. Shutdown."); char tmp[1024]; snprintf(tmp, 1024, "Pay params: id/session=[%lli] terminal=[%lli] operator=%i", new_pay->id, new_pay->terminal_id, new_pay->provider_id); LogWrite(LOGMSG_CRITICAL, tmp); exit(-1); } } if (new_pay!=NULL) { // char logmsg[101]; snprintf(logmsg, 100,"Working on pay %lli", new_pay->id); SendLogMessages(0, logmsg); sem_wait(&payguide::free_workers_lock); //printf("lock catched\n"); /* If were is no free worker - find one or create new. */ if (payguide::free_worker==NULL) SetFreeWorker(NULL); /* If it's ok - init free worker with a new pay */ if (payguide::free_worker!=NULL) { LaunchNewPay(new_pay); new_pay=NULL; sem_post(&payguide::free_workers_lock); } /* We can't create a new worker - threads limit hit. */ else { //LogWrite(LOGMSG_WARNING, "Threads limit hit. Payguide server is overloaded."); sem_post(&payguide::free_workers_lock); if (sleep_count==20) { ReloadConfigIfImportant(); ManagerEx(); sleep_count=0; } nanosleep(&req, NULL);sleep_count++; StatisticTick(0.2); } } /* No new pays, sleep (nojobs_sleep_time) sec*/ else { /* Manage inactive workers */ if (sleep_count==20) { ReloadConfigIfImportant(); ManagerEx(); sleep_count=0; } // sleep(SLEEP_TIME); sleep_count=20; nanosleep(&req, NULL);sleep_count++; StatisticTick(0.2); } } /* Waiting for all workers, or even cancel all pays if force_quit is 1 ... */ LogWrite(LOGMSG_SYSTEM, "Waiting for all active pays to end - for safe exit - you had to specify right timeouts in your modules."); WaitForAllPaysToFinish(force_quit); /* If it's not reboot - exit */ sem_wait(&payguide::shutdown_lock); bool quit_state=payguide::quit; sem_post(&payguide::shutdown_lock); if (quit_state) { LogWrite(LOGMSG_SYSTEM, "Payguide server shutdown normally."); LogWrite(LOGMSG_SYSTEM, "Bye-bye!"); /* Stop connection with MySQL database */ DBShutdown(); /* Stop control server. */ //CtlServerStop(); mysql_library_end(); if (ossl_lock!=NULL) delete [] ossl_lock; if (pc_init_result==0) PCShutdown(); /* CleanUp will be automatically called by atexit() function */ if (RemoveLockFile()!=0) { std::cout << "Can't remove /tmp/payguide.lock. File doesn't exist or maybe you should delete it manually." << std::endl; LogWrite(LOGMSG_CRITICAL, "Can't remove /tmp/payguide.lock. File doesn't exist or maybe you should delete it manually."); } OperatorsShutdown(); EVP_cleanup(); payguide::data_conventor.Clean(); PerlShutdown(); printf("destroying queue\n"); in_manager.Destroy(); printf("done\n"); exit (0); } /* Stop connection with MySQL database */ DBShutdown(); printf("destroying queue\n"); in_manager.Destroy(); printf("done\n"); server_code.Kill(); LogWrite(LOGMSG_SYSTEM, "Rebooting..."); work_init_already=false; CleanUp(); } return 0; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow) { int ret = 0; const char *m_Err = _LANG_ERRORWRITINGTEMP; int cl_flags = 0; char *realcmds; char seekchar=' '; char *cmdline; InitCommonControls(); SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS); #if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT) { extern HRESULT g_hres; g_hres=OleInitialize(NULL); } #endif // load shfolder.dll before any script code is executed to avoid // weird situations where SetOutPath or even the extraction of // shfolder.dll will cause unexpected behavior. // // this also prevents the following: // // SetOutPath "C:\Program Files\NSIS" # maybe read from reg // File shfolder.dll // Delete $PROGRAMFILES\shfolder.dll # can't be deleted, as the // # new shfolder.dll is used // # to find its own path. g_SHGetFolderPath = myGetProcAddress(MGA_SHGetFolderPathA); { // workaround for bug #1008632 // http://sourceforge.net/tracker/index.php?func=detail&aid=1008632&group_id=22049&atid=373085 // // without this, SHGetSpecialFolderLocation doesn't always recognize // some special folders, like the desktop folder for all users, on // Windows 9x. unlike SHGetSpecialFolderPath, which is not available // on all versions of Windows, SHGetSpecialFolderLocation doesn't try // too hard to make sure the caller gets what he asked for. so we give // it a little push in the right direction by doing part of the work // for it. // // part of what SHGetFileInfo does, is to convert a path into an idl. // to do this conversion, it first needs to initialize the list of // special idls, which are exactly the idls we use to get the paths // of special folders (CSIDL_*). SHFILEINFO shfi; SHGetFileInfo("", 0, &shfi, sizeof(SHFILEINFO), 0); } mystrcpy(g_caption,_LANG_GENERIC_ERROR); mystrcpy(state_command_line, GetCommandLine()); #ifdef NSIS_CONFIG_VISIBLE_SUPPORT g_hInstance = GetModuleHandle(NULL); #endif//NSIS_CONFIG_VISIBLE_SUPPORT cmdline = state_command_line; if (*cmdline == '\"') seekchar = *cmdline++; cmdline=findchar(cmdline, seekchar); cmdline=CharNext(cmdline); realcmds=cmdline; while (*cmdline) { // skip over any spaces while (*cmdline == ' ') cmdline++; // get char we should look for to get the next parm seekchar = ' '; if (cmdline[0] == '\"') { cmdline++; seekchar = '\"'; } // is it a switch? if (cmdline[0] == '/') { cmdline++; // this only works with spaces because they have just one bit on #define END_OF_ARG(c) (((c)|' ')==' ') #if defined(NSIS_CONFIG_VISIBLE_SUPPORT) && defined(NSIS_CONFIG_SILENT_SUPPORT) if (cmdline[0] == 'S' && END_OF_ARG(cmdline[1])) cl_flags |= FH_FLAGS_SILENT; #endif//NSIS_CONFIG_SILENT_SUPPORT && NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_CRC_SUPPORT if (*(LPDWORD)cmdline == CHAR4_TO_DWORD('N','C','R','C') && END_OF_ARG(cmdline[4])) cl_flags |= FH_FLAGS_NO_CRC; #endif//NSIS_CONFIG_CRC_SUPPORT if (*(LPDWORD)(cmdline-2) == CHAR4_TO_DWORD(' ', '/', 'D','=')) { *(LPDWORD)(cmdline-2)=0; // keep this from being passed to uninstaller if necessary mystrcpy(state_install_directory,cmdline+2); break; // /D= must always be last } } // skip over our parm cmdline = findchar(cmdline, seekchar); // skip the quote if (*cmdline == '\"') cmdline++; } GetTempPath(NSIS_MAX_STRLEN, state_temp_dir); if (!ValidateTempDir()) { GetWindowsDirectory(state_temp_dir, NSIS_MAX_STRLEN - 5); // leave space for \Temp mystrcat(state_temp_dir, "\\Temp"); if (!ValidateTempDir()) { goto end; } } DeleteFile(state_language); m_Err = loadHeaders(cl_flags); if (m_Err) goto end; #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT if (g_is_uninstaller) { char *p = findchar(state_command_line, 0); // state_command_line has state_install_directory right after it in memory, so reading // a bit over state_command_line won't do any harm while (p >= state_command_line && *(LPDWORD)p != CHAR4_TO_DWORD(' ', '_', '?', '=')) p--; m_Err = _LANG_UNINSTINITERROR; if (p >= state_command_line) { *p=0; // terminate before "_?=" p+=4; // skip over " _?=" if (is_valid_instpath(p)) { mystrcpy(state_install_directory, p); mystrcpy(state_output_directory, p); m_Err = 0; } else { goto end; } } else { int x; mystrcat(state_temp_dir,"~nsu.tmp"); // check if already running from uninstaller temp dir // this prevents recursive uninstaller calls if (!lstrcmpi(state_temp_dir,state_exe_directory)) goto end; CreateDirectory(state_temp_dir,NULL); SetCurrentDirectory(state_temp_dir); if (!state_install_directory[0]) mystrcpy(state_install_directory,state_exe_directory); mystrcpy(g_usrvars[0], realcmds); *(LPWORD)g_usrvars[1] = CHAR2_TO_WORD('A',0); for (x = 0; x < 26; x ++) { static char buf2[NSIS_MAX_STRLEN]; GetNSISString(buf2,g_header->str_uninstchild); // $TEMP\$1u_.exe DeleteFile(buf2); // clean up after all the other ones if they are there if (m_Err) // not done yet { // copy file if (CopyFile(state_exe_path,buf2,TRUE)) { HANDLE hProc; #ifdef NSIS_SUPPORT_MOVEONREBOOT MoveFileOnReboot(buf2,NULL); #endif GetNSISString(buf2,g_header->str_uninstcmd); // '"$TEMP\$1u_.exe" $0 _?=$INSTDIR\' hProc=myCreateProcess(buf2); if (hProc) { CloseHandle(hProc); // success m_Err = 0; } } } g_usrvars[1][0]++; } #ifdef NSIS_SUPPORT_MOVEONREBOOT MoveFileOnReboot(state_temp_dir,NULL); #endif goto end; } } #endif//NSIS_CONFIG_UNINSTALL_SUPPORT g_exec_flags.errlvl = -1; ret = ui_doinstall(); #ifdef NSIS_CONFIG_LOG #if !defined(NSIS_CONFIG_LOG_ODS) && !defined(NSIS_CONFIG_LOG_STDOUT) log_write(1); #endif//!NSIS_CONFIG_LOG_ODS && !NSIS_CONFIG_LOG_STDOUT #endif//NSIS_CONFIG_LOG end: CleanUp(); #if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT) OleUninitialize(); #endif if (m_Err) { my_MessageBox(m_Err, MB_OK | MB_ICONSTOP | (IDOK << 21)); ExitProcess(2); return 0; } #ifdef NSIS_SUPPORT_REBOOT if (g_exec_flags.reboot_called) { BOOL (WINAPI *OPT)(HANDLE, DWORD,PHANDLE); BOOL (WINAPI *LPV)(LPCTSTR,LPCTSTR,PLUID); BOOL (WINAPI *ATP)(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD); OPT=myGetProcAddress(MGA_OpenProcessToken); LPV=myGetProcAddress(MGA_LookupPrivilegeValueA); ATP=myGetProcAddress(MGA_AdjustTokenPrivileges); if (OPT && LPV && ATP) { HANDLE hToken; TOKEN_PRIVILEGES tkp; if (OPT(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) { LPV(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); tkp.PrivilegeCount = 1; tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; ATP(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); } } if (!ExitWindowsEx(EWX_REBOOT,0)) ExecuteCallbackFunction(CB_ONREBOOTFAILED); } #endif//NSIS_SUPPORT_REBOOT if (g_exec_flags.errlvl != -1) ret = g_exec_flags.errlvl; ExitProcess(ret); return 0; }
void MoviePlayFini(void) { CleanUp(); }
RefinerResultCode CBMARefinerTrial::DoTrial(AlignmentUtility* au, ostream* detailsStream, TFProgressCallback callback) { bool writeDetails = (detailsStream || m_verbose); bool madeChange = true; unsigned int nCycles = m_cycles.size(); TScoreType finalScore = REFINER_INVALID_SCORE; RefinerResultCode cycleResult = eRefinerResultOK; RowScorer rowScorer; BlockMultipleAlignment::UngappedAlignedBlockList alignedBlocks; BlockMultipleAlignment::UngappedAlignedBlockList::iterator blockIt; vector<unsigned int> blockWidths; vector<TScoreType> originalBlockScores, finalBlockScores; CleanUp(); if (!CreateCycles()) { return eRefinerResultTrialInitializationError; } if (writeDetails) { //TERSE_INFO_MESSAGE_CL( about to compute block scores in DoTrial\n"); rowScorer.ComputeBlockScores(*au, originalBlockScores); //TERSE_INFO_MESSAGE_CL( after computed block scores in DoTrial\n"); if (au->GetBlockMultipleAlignment()) { au->GetBlockMultipleAlignment()->GetUngappedAlignedBlocks(&alignedBlocks); for (blockIt = alignedBlocks.begin(); blockIt != alignedBlocks.end(); ++blockIt) { blockWidths.push_back((*blockIt)->m_width); } } } //TERSE_INFO_MESSAGE_CL(art cycles loop in DoTrial\n"); CBMARefinerCycle::ResetCycleId(); for (unsigned int i = 0; i < nCycles; ++i) { // Stop the trial if no change in previous cycle or some error condition if (!m_cycles[i] || !au || cycleResult != eRefinerResultOK || !madeChange) { if (!m_cycles[i] || (!au && cycleResult == eRefinerResultOK)) { cycleResult = eRefinerResultTrialExecutionError; } break; } cycleResult = m_cycles[i]->DoCycle(au, detailsStream, callback); if (au && cycleResult == eRefinerResultOK) { finalScore = m_cycles[i]->GetFinalScore(); madeChange = m_cycles[i]->MadeChange(); // If saving intermediate alignments, we own it; otherwise, just use // the pointer to signal a successfully completed cycle (we don't own // the object pointed to by 'au'). if (m_saveIntermediateAlignments) { TRACE_MESSAGE_CL("Cycle " << i+1 << " saving intermediate alignments. Score = " << finalScore << "; made change = " << madeChange << "\n"); m_trialResults.insert(RefinedAlignmentsVT(finalScore, RefinerAU(i, au->Clone()))); } else { m_trialResults.insert(RefinedAlignmentsVT(finalScore, RefinerAU(i, au))); TRACE_MESSAGE_CL("Cycle " << i+1 << " not saving intermediate alignments. Score = " << finalScore << "; made change = " << madeChange << "\n"); } } else { WARNING_MESSAGE_CL("Cycle " << i+1 << " reports a problem (code " << (int) cycleResult << "); assigning cycle an invalid final score and terminating trial.\n"); finalScore = REFINER_INVALID_SCORE; m_trialResults.insert(RefinedAlignmentsVT(finalScore, RefinerAU(i, NULL))); } } // end cycles loop // Block scores (summed over rows) for entire trial // ** if block number changes this needs to be fixed!!!! ** if (writeDetails && finalScore != REFINER_INVALID_SCORE) { IOS_BASE::fmtflags initFlags = (detailsStream) ? detailsStream->flags() : cout.flags(); rowScorer.ComputeBlockScores(*au, finalBlockScores); TERSE_INFO_MESSAGE_CL("Block scores summed over all rows (block number, initial block size, trial start, trial end): "); for (unsigned int bnum = 0; bnum < originalBlockScores.size(); ++bnum) { if (detailsStream) detailsStream->setf(IOS_BASE::left, IOS_BASE::adjustfield); TERSE_INFO_MESSAGE_CL(" BLOCK " << setw(4) << bnum+1 << " size " << setw(4) << blockWidths[bnum] << " " << " " << setw(7) << originalBlockScores[bnum] << " " << setw(7) << finalBlockScores[bnum]); // if (detailsStream) detailsStream->setf(IOS_BASE::right, IOS_BASE::adjustfield); // TERSE_INFO_MESSAGE_CL(" " << setw(7) << originalBlockScores[bnum] << " " << setw(7) << finalBlockScores[bnum]); } TERSE_INFO_MESSAGE_CL(""); if (detailsStream) detailsStream->setf(initFlags, IOS_BASE::adjustfield); } return cycleResult; }
Field::~Field() { CleanUp(); }