Exemple #1
0
// WriteSolutionConfigs
//------------------------------------------------------------------------------
void SLNGenerator::WriteSolutionFolderListings( const Array< SLNSolutionFolder > & folders,
        Array< AString > & solutionFolderPaths )
{
    // Create every intermediate path
    const SLNSolutionFolder * const foldersEnd = folders.End();
    for( const SLNSolutionFolder * it = folders.Begin() ; it != foldersEnd ; ++it )
    {
        if ( solutionFolderPaths.Find( it->m_Path ) == nullptr )
        {
            solutionFolderPaths.Append( it->m_Path );
        }

        const char * pathEnd = it->m_Path.Find( NATIVE_SLASH );
        while ( pathEnd )
        {
            AStackString<> solutionFolderPath( it->m_Path.Get(), pathEnd );
            if ( solutionFolderPaths.Find( solutionFolderPath ) == nullptr )
            {
                solutionFolderPaths.Append( solutionFolderPath );
            }

            pathEnd = it->m_Path.Find( NATIVE_SLASH, pathEnd + 1 );
        }
    }

    solutionFolderPaths.Sort();

    // Solution Folders Listings

    const AString * const solutionFolderPathsEnd = solutionFolderPaths.End();
    for( const AString * it = solutionFolderPaths.Begin() ; it != solutionFolderPathsEnd ; ++it )
    {
        // parse solution folder name
        const char * solutionFolderName = it->FindLast( NATIVE_SLASH );
        solutionFolderName = solutionFolderName ? solutionFolderName + 1 : it->Get();

        // generate a guid for the solution folder
        AStackString<> solutionFolderGuid;
        VSProjectGenerator::FormatDeterministicProjectGUID( solutionFolderGuid, *it );

        // Guid must be uppercase (like visual)
        solutionFolderGuid.ToUpper();

        Write( "Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"%s\", \"%s\", \"%s\"\r\n",
               solutionFolderName, solutionFolderName, solutionFolderGuid.Get() );

        Write( "EndProject\r\n" );
    }
}
void GradientsMergeMosaicInterface::__TargetImages_NodeActivated( TreeBox& sender, TreeBox::Node& node, int col )
{
   int index = sender.ChildIndex( &node );
   if ( index < 0 || size_type( index ) >= instance.targetFrames.Length() )
      throw Error( "GradientsMergeMosaicInterface: *Warning* Corrupted interface structures" );

   GradientsMergeMosaicInstance::ImageItem& item = instance.targetFrames[index];

   switch ( col )
   {
   case 0:
      // Activate the item's index number: ignore.
      break;
   case 1:
      // Activate the item's checkmark: toggle item's enabled state.
      item.enabled = !item.enabled;
      UpdateTargetImageItem( index );
      break;
   case 2:
      {
         // Activate the item's path: open the image.
         Array<ImageWindow> w = ImageWindow::Open( item.path );
         for ( Array<ImageWindow>::iterator i = w.Begin(); i != w.End(); ++i )
            i->Show();
      }
      break;
   }
}
Exemple #3
0
void Renderer::OcclusionCull(const Scene * scene, const Array<SceneObject*> & scene_objects) {
    if (!scene->GetOcclusionCulling()) {
        return;
    }

    for (auto it = scene_objects.Begin(); it != scene_objects.End(); ++it) {
        RenderData* render_data = (*it)->GetRenderData();
        if (render_data == nullptr) {
            continue;
        }

        if (render_data->GetMaterial() == nullptr) {
            continue;
        }

        //If a query was issued on an earlier or same frame and if results are
        //available, then update the same. If results are unavailable, do nothing
        if (!(*it)->IsQueryIssued()) {
            continue;
        }

        GLuint query_result = GL_FALSE;
        GLuint *query = (*it)->GetOcclusionArray();
        glGetQueryObjectuiv(query[0], GL_QUERY_RESULT_AVAILABLE, &query_result);

        if (query_result) {
            GLuint pixel_count;
            glGetQueryObjectuiv(query[0], GL_QUERY_RESULT, &pixel_count);
            bool visibility = ((pixel_count & GL_TRUE) == GL_TRUE);

            (*it)->SetVisible(visibility);
            (*it)->SetQueryIssued(false);
        }
    }
}
Exemple #4
0
// GetObjectListNodes
//------------------------------------------------------------------------------
bool Function::GetObjectListNodes( const BFFIterator & iter,
                                   const Array< AString > & objectLists,
                                   const char * inputVarName,
                                   Dependencies & nodes ) const
{
    NodeGraph & ng = FBuild::Get().GetDependencyGraph();

	const AString * const  end = objectLists.End();
	for ( const AString * it = objectLists.Begin(); it != end; ++it )
	{
		const AString & objectList = *it;

		// get node for the dir we depend on
		Node * node = ng.FindNode( objectList );
		if ( node == nullptr )
		{
            Error::Error_1104_TargetNotDefined( iter, this, inputVarName, objectList );
            return false;
        }
		else if ( node->GetType() != Node::OBJECT_LIST_NODE )
		{
			Error::Error_1102_UnexpectedType( iter, this, inputVarName, node->GetName(), node->GetType(), Node::OBJECT_LIST_NODE );
			return false;
		}

		nodes.Append( Dependency( node ) );
	}
	return true;
}
Exemple #5
0
// GetImportLibName
//------------------------------------------------------------------------------
void LinkerNode::GetImportLibName( const AString & args, AString & importLibName ) const
{
    // split to individual tokens
    Array< AString > tokens;
    args.Tokenize( tokens );

    const AString * const end = tokens.End();
    for ( const AString * it = tokens.Begin(); it != end; ++it )
    {
        if ( LinkerNode::IsStartOfLinkerArg_MSVC( *it, "IMPLIB:" ) )
        {
            const char * impStart = it->Get() + 8;
            const char * impEnd = it->GetEnd();

            // if token is exactly /IMPLIB: then value is next token
            if ( impStart == impEnd )
            {
                ++it;
                // handle missing next value
                if ( it == end )
                {
                    return; // we just pretend it doesn't exist and let the linker complain
                }

                impStart = it->Get();
                impEnd = it->GetEnd();
            }

            Args::StripQuotes( impStart, impEnd, importLibName );
        }
    }
}
Exemple #6
0
    void ResourceManager::Destroy()
    {
        ProcessRequests();

#if defined( CARBON_DEBUG )
        if ( resourceTable.Count() )
        {
            Array< Resource *, FrameAllocator > unreleased;
            resourceTable.Dump( unreleased );

            Char res_msg[512];

            CARBON_TRACE( "====================================================\n" );
            CARBON_TRACE( "# Some resources are leaking\n\n" );

            Array< Resource * >::Iterator it = unreleased.Begin();
            Array< Resource * >::ConstIterator end = unreleased.End();
            for ( ; it != end; ++it )
            {
                Resource * res = *it;

                StringUtils::FormatString( res_msg, sizeof(res_msg), "# %s | ref count : %d\n", res->GetName(), res->GetRefCount() );
                CARBON_TRACE( res_msg );
            }

            CARBON_TRACE( "\n====================================================\n" );
        }
#endif
        CARBON_ASSERT( resourceTable.Count() == 0 );
    }
void HDRCompositionInterface::__InputImages_NodeActivated( TreeBox& sender, TreeBox::Node& node, int col )
{
   int index = sender.ChildIndex( &node );
   if ( index < 0 || size_type( index ) >= instance.images.Length() )
      throw Error( "HDRCompositionInterface: *Warning* Corrupted interface structures" );

   HDRCompositionInstance::ImageItem& item = instance.images[index];

   switch ( col )
   {
   case 0:
      break;
   case 1:
      item.enabled = !item.enabled;
      UpdateInputImagesItem( index );
      break;
   case 2:
      {
         Array<ImageWindow> w = ImageWindow::Open( item.path );
         for ( Array<ImageWindow>::iterator i = w.Begin(); i != w.End(); ++i )
            i->Show();
      }
      break;
   }
}
Exemple #8
0
// WriteNestedProjects
//------------------------------------------------------------------------------
void SLNGenerator::WriteNestedProjects( const Array< AString > & solutionProjectsToFolder,
                                        const Array< AString > & solutionFolderPaths )
{
    if ( solutionProjectsToFolder.GetSize() == 0 &&
            solutionFolderPaths.GetSize() == 0 )
    {
        return; // skip global section
    }

    Write( "\tGlobalSection(NestedProjects) = preSolution\r\n" );

    // Write every project to solution folder relationships
    const AString * const solutionProjectsToFolderEnd = solutionProjectsToFolder.End();
    for( const AString * it = solutionProjectsToFolder.Begin() ; it != solutionProjectsToFolderEnd ; ++it )
    {
        Write( it->Get() );
    }

    // Write every intermediate path
    const AString * const solutionFolderPathsEnd = solutionFolderPaths.End();
    for( const AString * it = solutionFolderPaths.Begin() ; it != solutionFolderPathsEnd ; ++it )
    {
        // parse solution folder parent path
        AStackString<> solutionFolderParentGuid;
        const char * lastSlash = it->FindLast( NATIVE_SLASH );
        if ( lastSlash )
        {
            AStackString<> solutionFolderParentPath( it->Get(), lastSlash );
            VSProjectGenerator::FormatDeterministicProjectGUID( solutionFolderParentGuid, solutionFolderParentPath );
        }

        if ( solutionFolderParentGuid.GetLength() > 0 )
        {
            // generate a guid for the solution folder
            AStackString<> solutionFolderGuid;
            VSProjectGenerator::FormatDeterministicProjectGUID( solutionFolderGuid, *it );

            solutionFolderGuid.ToUpper();
            solutionFolderParentGuid.ToUpper();

            // write parent solution folder relationship
            Write( "\t\t%s = %s\r\n", solutionFolderGuid.Get(), solutionFolderParentGuid.Get() );
        }
    }

    Write( "\tEndGlobalSection\r\n" );
}
Exemple #9
0
void ExternalProcess::SetEnvironment( const StringList& environment )
{
   Array<const char16_type*> vars;
   for ( StringList::const_iterator i = environment.Begin(); i != environment.End(); ++i )
      vars.Add( i->c_str() );
   if ( (*API->ExternalProcess->SetExternalProcessEnvironment)( handle, vars.Begin(), vars.Length() ) == api_false )
      throw APIFunctionError( "SetExternalProcessEnvironment" );
}
Exemple #10
0
void ExternalProcess::Start( const String& program, const StringList& arguments )
{
   Array<const char16_type*> argv;
   for ( StringList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
      argv.Add( i->c_str() );
   if ( (*API->ExternalProcess->StartExternalProcess)( handle, program.c_str(), argv.Begin(), argv.Length() ) == api_false )
      throw APIFunctionError( "StartExternalProcess" );
}
Exemple #11
0
// FormatName
//------------------------------------------------------------------------------
/*static*/ void DirectoryListNode::FormatName( const AString & path,
											   const Array< AString > * patterns,
											   bool recursive,
											   const Array< AString > & excludePaths,
                                               const Array< AString > & excludeFiles,
											   AString & result )
{
	ASSERT( path.EndsWith( NATIVE_SLASH ) );
	AStackString<> patternString;
	if ( patterns )
	{
		const size_t numPatterns = patterns->GetSize();
		for ( size_t i=0; i<numPatterns; ++i )
		{
			if ( i > 0 )
			{
				patternString += '<';
			}
			patternString += (*patterns)[ i ];
		}
	}
	result.Format( "%s|%s|%s|", path.Get(),
								  patternString.Get(),
								  recursive ? "true" : "false" );

	const AString * const end = excludePaths.End();
	for ( const AString * it = excludePaths.Begin(); it!=end; ++it )
	{
		const AString & excludePath = *it;
		ASSERT( excludePath.EndsWith( NATIVE_SLASH ) );
		result += excludePath;
		result += '<';
	}

    if ( !excludeFiles.IsEmpty() )
    {
        result += '|';
        const AString * const endFiles = excludeFiles.End();
        for ( const AString * itFiles = excludeFiles.Begin(); itFiles != endFiles; ++itFiles )
        {
            const AString & excludedFile = *itFiles;
            result += excludedFile;
            result += '<';
        }
    }
}
// AddFiles
//------------------------------------------------------------------------------
void VSProjectGenerator::AddFiles( const Array< AString > & files, bool filterByExtension )
{
	const AString * const fEnd = files.End();
	for ( const AString * fIt = files.Begin(); fIt!=fEnd; ++fIt )
	{
		AddFile( *fIt, filterByExtension );
	}
}
// AddFiles
//------------------------------------------------------------------------------
void VSProjectGenerator::AddFiles( const Array< AString > & files )
{
    const AString * const fEnd = files.End();
    for ( const AString * fIt = files.Begin(); fIt!=fEnd; ++fIt )
    {
        AddFile( *fIt );
    }
}
Exemple #14
0
// GetDirectoryNodeList
//------------------------------------------------------------------------------
bool Function::GetDirectoryListNodeList( const BFFIterator & iter,
										 const Array< AString > & paths,
										 const Array< AString > & excludePaths,
                                         const Array< AString > & filesToExclude,
										 bool recurse,
										 const Array< AString > * patterns,
										 const char * inputVarName,
										 Dependencies & nodes ) const
{
	NodeGraph & ng = FBuild::Get().GetDependencyGraph();

	// Handle special case of excluded files beginning with ../
	// Since they can be used seinsibly by matching just the end
	// of a path, assume they are relative to the working dir.
	// TODO:C Move this during bff parsing when everything is using reflection
	Array< AString > filesToExcludeCleaned( filesToExclude.GetSize(), true );
	for ( const AString& file : filesToExclude )
	{
		if ( file.BeginsWith( ".." ) )
		{
			AStackString<> fullPath;
			NodeGraph::CleanPath( file, fullPath );
			filesToExcludeCleaned.Append( fullPath );
		}
		else
		{
			filesToExcludeCleaned.Append( file );
		}
	}

	const AString * const  end = paths.End();
	for ( const AString * it = paths.Begin(); it != end; ++it )
	{
		const AString & path = *it;

		// get node for the dir we depend on
		AStackString<> name;
		DirectoryListNode::FormatName( path, patterns, recurse, excludePaths, filesToExcludeCleaned, name );
		Node * node = ng.FindNode( name );
		if ( node == nullptr )
		{
			node = ng.CreateDirectoryListNode( name,
											   path,
											   patterns,
											   recurse,
											   excludePaths, 
                                               filesToExcludeCleaned );
		}
		else if ( node->GetType() != Node::DIRECTORY_LIST_NODE )
		{
			Error::Error_1102_UnexpectedType( iter, this, inputVarName, node->GetName(), node->GetType(), Node::DIRECTORY_LIST_NODE );
			return false;
		}

		nodes.Append( Dependency( node ) );
	}
	return true;
}
Exemple #15
0
int ExternalProcess::ExecuteProgram( const String& program, const StringList& arguments )
{
   Array<const char16_type*> argv;
   for ( StringList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
      argv.Add( i->c_str() );
   int retVal = (*API->ExternalProcess->ExecuteProgram)( program.c_str(), argv.Begin(), argv.Length() );
   if ( retVal < -1 )
      ExternalProcessPrivate::Throw( ExternalProcessContext::FailedToStart );
   return retVal;
}
Exemple #16
0
// CleanFileNames
//------------------------------------------------------------------------------
void Function::CleanFileNames( Array< AString > & fileNames ) const
{
    // cleanup slashes (keep path relative)
	AString * const end = fileNames.End();
	for ( AString * it = fileNames.Begin(); it != end; ++it )
	{
		// normalize slashes
		PathUtils::FixupFilePath( *it );
	}
}
Exemple #17
0
ExternalProcess::pid_type ExternalProcess::StartProgram( const String& program, const StringList& arguments, const String& workingDirectory )
{
   Array<const char16_type*> argv;
   for ( StringList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
      argv.Add( i->c_str() );
   uint64 pid = 0;
   api_bool ok = (*API->ExternalProcess->StartProgram)( program.c_str(), argv.Begin(), argv.Length(), workingDirectory.c_str(), &pid );
   if ( ok == api_false || pid == 0 )
      ExternalProcessPrivate::Throw( ExternalProcessContext::FailedToStart );
   return pid_type( pid );
}
Exemple #18
0
REGISTER_TESTS_END

// Test
//------------------------------------------------------------------------------
void TestDistributed::TestHelper( const char * target, uint32_t numRemoteWorkers, bool shouldFail, bool allowRace ) const
{
	FBuildOptions options;
	options.m_ConfigFile = "Data/TestDistributed/fbuild.bff";
	options.m_AllowDistributed = true;
	options.m_NumWorkerThreads = 0;
	options.m_NoLocalConsumptionOfRemoteJobs = true; // ensure all jobs happen on the remote worker
	options.m_AllowLocalRace = allowRace;
	//options.m_ShowProgress = true;
	//options.m_ShowInfo = true;
	//options.m_ShowSummary = true;
	FBuild fBuild( options );

	JobQueueRemote jqr( numRemoteWorkers );

	// start a client to emulate the other end
	Server s;
	s.Listen( Protocol::PROTOCOL_PORT );

	TEST_ASSERT( fBuild.Initialize() );

	// clean up anything left over from previous runs
	Array< AString > files;
	FileIO::GetFiles( AStackString<>( "../../../../ftmp/Test/Distributed" ), AStackString<>( "*.*" ), true, &files );
	const AString * iter = files.Begin();
	const AString * const end = files.End();
	for ( ; iter != end; ++iter )
	{
		FileIO::FileDelete( iter->Get() );
	}

	if ( !shouldFail )
	{
		TEST_ASSERT( FileIO::FileExists( target ) == false );
	}

	bool pass = fBuild.Build( AStackString<>( target ) );
	if ( !shouldFail )
	{
		TEST_ASSERT( pass );
	}

	// make sure all output files are as expected
	if ( !shouldFail )
	{
		TEST_ASSERT( FileIO::FileExists( target ) );
	}
}
Exemple #19
0
//------------------------------------------------------------------------------
/*static*/ void Function::CleanFilePaths( Array< AString > & files )
{
	AStackString< 512 > tmp;

	AString * const end = files.End();
	for ( AString * it = files.Begin(); it != end; ++it )
	{
		// make full path, clean slashes etc
		NodeGraph::CleanPath( *it, tmp );

		// replace original
		*it = tmp;
	}
}
Exemple #20
0
bool FileFormatInstance::QueryOptions( Array<ImageOptions>& options, Array<const void*>& formatOptions )
{
   uint32 n = uint32( options.Length() );

   Array<api_image_options> o( (size_type)n );
   for ( uint32 i = 0; i < n; ++i )
      PCLImageOptionsToAPI( o[i], options[i] );

   if ( (*API->FileFormat->QueryImageFileOptions)( handle, o.Begin(), formatOptions.Begin(), n ) == api_false )
      return false;

   for ( uint32 i = 0; i < n; ++i )
      APIImageOptionsToPCL( options[i], o[i] );
   return true;
}
Exemple #21
0
// WriteProjectConfigurationPlatforms
//------------------------------------------------------------------------------
void SLNGenerator::WriteProjectConfigurationPlatforms(  const AString & solutionBuildProjectGuid,
        const Array< SolutionConfig > & solutionConfigs,
        const Array< AString > & projectGuids )
{
    Write( "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n" );

    // Solution Configuration Mappings to Projects
    const AString * const projectGuidsEnd = projectGuids.End();
    for( const AString * it = projectGuids.Begin() ; it != projectGuidsEnd ; ++it )
    {
        // only one project active in the solution build
        const bool projectIsActive = ( solutionBuildProjectGuid == *it );

        const SolutionConfig * const solutionConfigsEnd = solutionConfigs.End();
        for( const SolutionConfig * it2 = solutionConfigs.Begin() ; it2 != solutionConfigsEnd ; ++it2 )
        {
            Write(  "\t\t%s.%s|%s.ActiveCfg = %s|%s\r\n",
                    it->Get(),
                    it2->m_Config.Get(), it2->m_SolutionPlatform.Get(),
                    it2->m_Config.Get(), it2->m_Platform.Get() );

            if ( projectIsActive )
            {
                Write(  "\t\t%s.%s|%s.Build.0 = %s|%s\r\n",
                        it->Get(),
                        it2->m_Config.Get(), it2->m_SolutionPlatform.Get(),
                        it2->m_Config.Get(), it2->m_Platform.Get() );
            }
        }
    }

    Write( "\tEndGlobalSection\r\n" );
    Write( "\tGlobalSection(SolutionProperties) = preSolution\r\n" );
    Write( "\t\tHideSolutionNode = FALSE\r\n" );
    Write( "\tEndGlobalSection\r\n" );
}
Exemple #22
0
// WriteSolutionConfigurationPlatforms
//------------------------------------------------------------------------------
void SLNGenerator::WriteSolutionConfigurationPlatforms( const Array< SolutionConfig > & solutionConfigs )
{
    Write( "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n" );

    // Solution Configurations
    const SolutionConfig * const end = solutionConfigs.End();
    for( const SolutionConfig * it = solutionConfigs.Begin() ; it != end ; ++it )
    {
        Write(  "\t\t%s|%s = %s|%s\r\n",
                it->m_Config.Get(), it->m_SolutionPlatform.Get(),
                it->m_Config.Get(), it->m_SolutionPlatform.Get() );
    }

    Write( "\tEndGlobalSection\r\n" );
}
Exemple #23
0
// GetFileNodes
//------------------------------------------------------------------------------
bool Function::GetFileNodes( const BFFIterator & iter,
                             const Array< AString > & files,
                             const char * inputVarName,
                             Dependencies & nodes ) const
{
	const AString * const  end = files.End();
	for ( const AString * it = files.Begin(); it != end; ++it )
	{
		const AString & file = *it;
		if (!GetFileNode( iter, file, inputVarName, nodes ))
		{
			return false; // GetFileNode will have emitted an error
		}
	}
	return true;
}
Exemple #24
0
    void ProgramCache::LoadProgramFromBinaries( Program& program )
    {
        PathString binFileName = m_cachePath;
        binFileName += "/";
        binFileName += program.m_name;
        binFileName += ".bin";

        if ( FileSystem::Exists( binFileName ) )
        {
            PathString searchStr = m_dataPath;
            searchStr += "/";
            searchStr += program.m_name;
            searchStr += ".*";

            Array< PathString > shaderFileNames;
            FileSystem::Find( searchStr.ConstPtr(), shaderFileNames );

            U64 binLastWriteTime = FileSystem::GetLastWriteTime( binFileName );

            Bool binIsUpToDate = true;

            Array< PathString >::ConstIterator it = shaderFileNames.Begin();
            Array< PathString >::ConstIterator end = shaderFileNames.End();
            for ( ; it != end; ++it )
            {
                const PathString& shaderFileName = *it;

                if ( binLastWriteTime < FileSystem::GetLastWriteTime( shaderFileName ) )
                {
                    binIsUpToDate = false;
                    break;
                }
            }

            if ( binIsUpToDate )
            {
                SizeT size;
                void * buffer;
                if ( FileSystem::Load( binFileName, buffer, size ) )
                {
                    program.m_handle = RenderDevice::CreateProgramBinary( buffer, size ); 
                    UnknownAllocator::Deallocate( buffer );
                }
            }
        }
    }
Exemple #25
0
// CleanFolderPaths
//------------------------------------------------------------------------------
/*static*/ void Function::CleanFolderPaths( Array< AString > & folders )
{
	AStackString< 512 > tmp;

	AString * const end = folders.End();
	for ( AString * it = folders.Begin(); it != end; ++it )
	{
		// make full path, clean slashes etc
		NodeGraph::CleanPath( *it, tmp );

		// ensure path is slash-terminated
		PathUtils::EnsureTrailingSlash( tmp );

		// replace original
		*it = tmp;
	}
}
Exemple #26
0
void BaseSession::Recv(Array& raw_data)
{
	if (IsClosed())
		return;
	stream_ibuffer_.Insert(stream_ibuffer_.End(), raw_data.Begin(), raw_data.Size());

	for (;;)
	{
		if (stream_ibuffer_.Size() < 2)
			return;
		uint16_t len = *reinterpret_cast<uint16_t *>(stream_ibuffer_.Begin());
		if (stream_ibuffer_.Size() < 2 + len)
			return;
		Array proto(static_cast<char *>(stream_ibuffer_.Begin())+2, len);
		OnAfterRecv(proto);
		stream_ibuffer_.Erase(stream_ibuffer_.Begin(), 2+len);
	}
}
// GetExtraOutputPaths
//------------------------------------------------------------------------------
void FunctionObjectList::GetExtraOutputPaths( const AString & args, AString & pdbPath, AString & asmPath ) const
{
    // split to individual tokens
    Array< AString > tokens;
    args.Tokenize( tokens );

    const AString * const end = tokens.End();
    for ( const AString * it = tokens.Begin(); it != end; ++it )
    {
        if ( ObjectNode::IsStartOfCompilerArg_MSVC( *it, "Fd" ) )
        {
            GetExtraOutputPath( it, end, "Fd", pdbPath );
            continue;
        }

        if ( ObjectNode::IsStartOfCompilerArg_MSVC( *it, "Fa" ) )
        {
            GetExtraOutputPath( it, end, "Fa", asmPath );
            continue;
        }
    }
}
Exemple #28
0
// GetDirectoryNodeList
//------------------------------------------------------------------------------
bool Function::GetDirectoryListNodeList( const BFFIterator & iter,
										 const Array< AString > & paths,
										 const Array< AString > & excludePaths,
                                         const Array< AString > & filesToExclude,
										 bool recurse,
										 const AString & pattern,
										 const char * inputVarName,
										 Dependencies & nodes ) const
{
	NodeGraph & ng = FBuild::Get().GetDependencyGraph();

	const AString * const  end = paths.End();
	for ( const AString * it = paths.Begin(); it != end; ++it )
	{
		const AString & path = *it;

		// get node for the dir we depend on
		AStackString<> name;
		DirectoryListNode::FormatName( path, pattern, recurse, excludePaths, filesToExclude, name );
		Node * node = ng.FindNode( name );
		if ( node == nullptr )
		{
			node = ng.CreateDirectoryListNode( name,
											   path,
											   pattern,
											   recurse,
											   excludePaths, 
                                               filesToExclude );
		}
		else if ( node->GetType() != Node::DIRECTORY_LIST_NODE )
		{
			Error::Error_1102_UnexpectedType( iter, this, inputVarName, node->GetName(), node->GetType(), Node::DIRECTORY_LIST_NODE );
			return false;
		}

		nodes.Append( Dependency( node ) );
	}
	return true;
}
Exemple #29
0
// CONSTRUCTOR
//------------------------------------------------------------------------------
DirectoryListNode::DirectoryListNode( const AString & name,
									  const AString & path,
									  const Array< AString > * patterns,
								      bool recursive,
									  const Array< AString > & excludePaths,
                                      const Array< AString > & filesToExclude )
: Node( name, Node::DIRECTORY_LIST_NODE, Node::FLAG_NONE )
	, m_Path( path )
	, m_Patterns()
	, m_ExcludePaths( excludePaths )
    , m_FilesToExclude( filesToExclude )
	, m_Recursive( recursive )
	, m_Files( 4096, true )
{
	if ( patterns )
	{
		m_Patterns = *patterns;
	}

	// ensure name is correctly formatted
	//   path|[patterns]|recursive|[excludePath]
	ASSERT( name.BeginsWith( path ) );
	ASSERT( name[ path.GetLength() ] == '|' );
	ASSERT( m_Patterns.IsEmpty() || ( name.Find( m_Patterns[ 0 ].Get() ) == name.Get() + path.GetLength() + 1 ) );
	ASSERT( ( recursive && name.Find( "|true|" ) ) || 
			( !recursive && name.Find( "|false|" ) ) );

	// paths must have trailing slash
	ASSERT( path.EndsWith( NATIVE_SLASH ) );

	// make sure exclusion path has trailing slash if provided
	#ifdef DEBUG
		const AString * const end = excludePaths.End();
		for ( const AString * it=excludePaths.Begin(); it != end; ++it )
		{
			ASSERT( ( *it ).EndsWith( NATIVE_SLASH ) );
		}
	#endif
}
Exemple #30
0
void Writer::Visit(const Array& array) {
   if (array.Empty())
      m_ostr << "[]";
   else
   {
      m_ostr << '[' << std::endl;
      ++m_nTabDepth;

      Array::const_iterator it(array.Begin()),
                            itEnd(array.End());
      while (it != itEnd) {
         m_ostr << std::string(m_nTabDepth, '\t');
         it->Accept(*this); 

         if (++it != itEnd)
            m_ostr << ',';
         m_ostr << std::endl;
      }

      --m_nTabDepth;
      m_ostr << std::string(m_nTabDepth, '\t') << ']';
   }
}