예제 #1
0
// tests one by one touching each runtime modifiable source file
// returns the number of errors - 0 if all passed.
int RuntimeObjectSystem::TestBuildAllRuntimeSourceFiles(  ITestBuildNotifier* callback, bool bTestFileTracking )
{
    if( m_pCompilerLogger ) { m_pCompilerLogger->LogInfo("TestBuildAllRuntimeSourceFiles Starting\n"); }
   
    ITestBuildNotifier* failCallbackLocal = callback;
    if( !failCallbackLocal )
    {
        failCallbackLocal = this;
    }

    int numErrors = 0;

    size_t numFilesToBuild = 0;
    for( unsigned short proj = 0; proj < m_Projects.size( ); ++proj )
    {
        numFilesToBuild += m_Projects[ proj ].m_RuntimeFileList.size( );
    }

    if( 0 == numFilesToBuild )
    {
        failCallbackLocal->TestBuildCallback( NULL, TESTBUILDRRESULT_NO_FILES_TO_BUILD );
    }
    
    for( unsigned short proj = 0; proj < m_Projects.size(); ++proj )
    {
        TFileList filesToTest = m_Projects[ proj ].m_RuntimeFileList; // m_RuntimeFileList could change if file content changes (new includes or source dependencies) so make copy to ensure iterators valid.
        for( TFileList::iterator it = filesToTest.begin(); it != filesToTest.end(); ++it )
        {
            const Path& file = *it;
            if( file.Extension() != ".h" ) // exclude headers, use TestBuildAllRuntimeHeaders
            {
                int fileErrors = TestBuildFile( m_pCompilerLogger, this, file, failCallbackLocal, bTestFileTracking );
                if( fileErrors < 0 )
                {
                    // this means exit, and the number of errors is -ve so remove, unless -0xD1E is the response (for no error die)
                    if( fileErrors != -0xD1E )
                    {
                        numErrors -= fileErrors;
                    }
                    return numErrors;
                }
                numErrors += fileErrors;
            }
        }
    }

    if( 0 == numErrors )
    {
        if( m_pCompilerLogger ) { m_pCompilerLogger->LogInfo("All Tests Passed\n"); }
    }
    else
    {
        if( m_pCompilerLogger ) { m_pCompilerLogger->LogError("Tests Failed: %d\n", numErrors); }
    }
    return numErrors;
}
FileMonitor::TFileList::iterator FileMonitor::GetWatchedFileEntry( const FileSystemUtils::Path& file, TFileList& fileList )
{
    TFileList::iterator fileIt = fileList.begin();
    TFileList::iterator fileItEnd = fileList.end();
    while (fileIt != fileItEnd && !ArePathsEqual(fileIt->file, file))
    {
        fileIt++;
    }

    return fileIt;
}
예제 #3
0
void CCRUDProcessor::ProcessFiles(TFileList &fileList, const char *pSourceDir, const char *pDestDir, bool bRecursive, CCRUDResults &results)
{
	OutputResult("Processing File List..");

	TFileList::iterator curFile = fileList.begin();

	TDateTime timeBegin;
	timeBegin = timeBegin.CurrentDateTime();

	results.m_iFilesFound = 0;
	results.m_iFilesCopied = 0;

    int nTopLevel = fileList.size();

	ResetEvent(m_hStopEvent);
	while ((WaitForSingleObject(m_hStopEvent, 0) == WAIT_TIMEOUT) &&
			(curFile != fileList.end()))
	{
		// Count this file
		++results.m_iFilesFound;

		// Get the source file name
		string curFileName(pSourceDir);
		curFileName += '\\';
		curFileName += *curFile;
		CleanPath(curFileName.begin());

		// Look for new files in this file
        bool bSearchInFile = bRecursive || nTopLevel;
		if (!bSearchInFile || SearchForNewFiles(fileList, curFileName.begin()))
		{
			// Get the destination file name
			string destFileName(pDestDir);
			destFileName += '\\';
			destFileName += *curFile;
			CleanPath(destFileName.begin());

			// Copy it if it needs to be updated
			if (MaybeCopyFile(curFileName.begin(), destFileName.begin()))
				++results.m_iFilesCopied;
		}

        if (nTopLevel)
            --nTopLevel;

		// Go to the next file in the list
		++curFile;

		// Breathe
		Application->ProcessMessages();
	}

	results.m_ProcessingTime = timeBegin.CurrentDateTime() - timeBegin;
}
예제 #4
0
bool AddFileToList(TFileList &fileList, const char *pName)
{
	for (TFileList::iterator curFile = fileList.begin(); curFile != fileList.end(); ++curFile)
    {
    	if (stricmp(curFile->begin(), pName) == 0)
        	return false;
	}

	// Ok, add it to the end..
	fileList.push_back(pName);

	return true;
}
예제 #5
0
void CApplication::initLocales()
{
	boost::locale::generator gen;
	string path = getBasePath().normalize().string() + "/messages";
	gen.add_messages_path(path);

	TExtensionList extensions = boost::assign::list_of (".mo");
	TFileList translations = CFile::find(boost::filesystem::path(path), extensions, TExcludeList(), -1, false);

	vector<string> domains;
	for (TFileList::const_iterator iter = translations.begin(); iter != translations.end(); ++iter) {
		domains.push_back(boost::filesystem::basename(*iter));
	}

	std::unique(domains.begin(), domains.end());
	for (vector<string>::const_iterator iter = domains.begin(); iter != domains.end(); ++iter) {
		gen.add_messages_domain(*iter);
	}

	for (vector<string>::const_iterator iter = _languages.begin(); iter != _languages.end(); ++iter) {
		_locales[*iter] = gen(*iter + ".UTF-8");
	}
}
예제 #6
0
//*************************************************************************
void BeatDetectorApp::setup()
{	


	// Set up window
	setWindowSize(480, 480);
	
	// Set up OpenGL
	gl::enableAlphaBlending();
	//glBlendFunc(GL_SRC_ALPHA, GL_ONE);
	//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);
	//glEnable(GL_LINE_SMOOTH);
	//glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
	
	if(write_frames)
	{
		setFrameRate(30);
	}
	else
	{
		setFrameRate(60);
	}
	
	// Set line color
	gl::color(Color(1, 1, 1));
	
	// Load and play audio
	//mAudioSource = audio::load(loadResource(RES_SAMPLE));
	//mTrack = audio::Output::addTrack(mAudioSource, false);
	///mTrack->enablePcmBuffering(true);
	//mTrack->play();
	
	// Set init flag
	mFftInit = false;
	
	std::string dir = getHomeDirectory() + "music\\4vis";
	if(exists(dir))
	{
		if(is_directory(dir))
		{
			copy(directory_iterator(dir), directory_iterator(), back_inserter(m_FileList));
		}
	}
	
	for(TFileList::iterator it = m_FileList.begin(); it != m_FileList.end();)
	{
		//std::string str = it->path().native();
		std::string str = it->path().generic_string();
//#ifdef WIN32
//		if(str.rfind(".wav") != -1)
//#else
		if(str.rfind(".mp3") != -1 || str.rfind(".m4a") != -1)
//#endif
		{
			++it;
		}
		else
		{
			it = m_FileList.erase(it);
		}
	}
	
	NextFile();
	
	if(write_frames)
	{
		COpenALSampleManager::StaticInit();
		p_sample = COpenALSampleManager::CreateSample(m_CurrentFile);
	}
}