void CLoadDialog::OnOK() 
{
	UpdateData( TRUE );

	m_nFlags = DetermineFlags();

	// Create list of filenames, if possible
	CButton *radioByDate = static_cast< CButton * >( GetDlgItem( IDC_LOADBYDATE ) );
	if ( radioByDate && radioByDate->GetCheck() == 1 )
	{
		m_FileNames.RemoveAll();

		// Use dates to determine filename, otherwise, clicking the "choose files button probably
		//  created a list for us

		char const *starttime = m_strStartDate;
		char const *endtime = m_strEndDate;

		int m1, d1, y1;
		int m2, d2, y2;

		if ( SuckTimeFromString( starttime, &m1, &d1, &y1 ) &&
			SuckTimeFromString( endtime, &m2, &d2, &y2 ) )
		{
			struct tm t1;
			struct tm t2;
			
			if ( ComposeDate( &t1, m1, d1, y1 ) &&
				ComposeDate( &t2, m2, d2, y2 ) )
			{
				time_t start = mktime( &t1 );
				time_t end = mktime( &t2 );
				
				if ( start > end )
				{
					time_t temp = start;
					start = end;
					end = temp;
				}
				
				if ( difftime( end, start ) < FIVE_YEARS )
				{
					// Create file list
					m_FileNames.RemoveAll();
					
					for ( time_t t = start; 
					t <= (time_t)( end + FSECONDS_PER_DAY ) || m_pStatus->IsInSameDay( t, end ) ; 
					t += (int)FSECONDS_PER_DAY )
					{
						char const *fname = m_pStatus->FileNameForTime( t );
						ASSERT( fname );
						int i = m_FileNames.AddToTail();
						ASSERT( m_FileNames.IsValidIndex( i ) );
						FilenameList *entry = &m_FileNames[ i ];
						strncpy( entry->fn, fname, sizeof( entry->fn ) );
						entry->fn[ sizeof( entry->fn ) - 1 ] = 0;
					}
					
					char sz[ 512 ];
					sprintf( sz, "(%i) files in list.", GetNumFiles() );
					
					m_staticNumFiles.SetWindowText( sz );
					
				}
			}
		}
	}

	CDialog::OnOK();
}
Esempio n. 2
0
// Initialize
//------------------------------------------------------------------------------
bool LinkerNode::Initialize( NodeGraph & nodeGraph, const BFFIterator & iter, const Function * function )
{
    // .PreBuildDependencies
    if ( !InitializePreBuildDependencies( nodeGraph, iter, function, m_PreBuildDependencyNames ) )
    {
        return false; // InitializePreBuildDependencies will have emitted an error
    }

    // Get linker exe
    Node * linkerExeNode = nullptr;
    if ( !function->GetFileNode( nodeGraph, iter, linkerExeNode, ".Linker" ) ) // TODO:B Use m_Linker property
    {
        return false; // GetFileNode will have emitted an error
    }

    m_Flags = DetermineFlags( m_LinkerType, m_Linker, m_LinkerOptions );

    // Check for Import Library override
    if ( ( m_Flags & LinkerNode::LINK_FLAG_MSVC ) != 0 )
    {
        GetImportLibName( m_LinkerOptions, m_ImportLibName );
    }

    // Check input/output args for Linker
    {
        bool hasInputToken = ( m_LinkerOptions.Find( "%1" ) || m_LinkerOptions.Find( "\"%1\"" ) );
        if ( hasInputToken == false )
        {
            Error::Error_1106_MissingRequiredToken( iter, function, ".LinkerOptions", "%1" );
            return false;
        }
        bool hasOutputToken = ( m_LinkerOptions.Find( "%2" ) || m_LinkerOptions.Find( "\"%2\"" ) );
        if ( hasOutputToken == false )
        {
            Error::Error_1106_MissingRequiredToken( iter, function, ".LinkerOptions", "%2" );
            return false;
        }
    }

    // Standard library dependencies
    Dependencies libraries( 64, true );
    for ( const AString & library : m_Libraries )
    {
        if ( DependOnNode( nodeGraph, iter, function, library, libraries ) == false )
        {
            return false; // DependOnNode will have emitted an error
        }
    }

    // Assembly Resources
    Dependencies assemblyResources( 32, true );
    if ( !function->GetNodeList( nodeGraph, iter, ".LinkerAssemblyResources", assemblyResources, false ) ) // TODO:B Use m_LinkerAssemblyResources directly
    {
        return false; // GetNodeList will have emitted error
    }

    // get inputs not passed through 'LibraryNodes' (i.e. directly specified on the cmd line)
    Dependencies otherLibraryNodes( 64, true );
    if ( ( m_Flags & ( LinkerNode::LINK_FLAG_MSVC | LinkerNode::LINK_FLAG_GCC | LinkerNode::LINK_FLAG_SNC | LinkerNode::LINK_FLAG_ORBIS_LD | LinkerNode::LINK_FLAG_GREENHILLS_ELXR | LinkerNode::LINK_FLAG_CODEWARRIOR_LD ) ) != 0 )
    {
        const bool msvcStyle = ( ( m_Flags & LinkerNode::LINK_FLAG_MSVC ) == LinkerNode::LINK_FLAG_MSVC );
        if ( !GetOtherLibraries( nodeGraph, iter, function, m_LinkerOptions, otherLibraryNodes, msvcStyle ) )
        {
            return false; // will have emitted error
        }
    }

    // Handle LinkerStampExe
    Node * linkerStampExeNode = nullptr;
    if ( m_LinkerStampExe.IsEmpty() == false )
    {
        if ( !function->GetFileNode( nodeGraph, iter, linkerStampExeNode, ".LinkerStampExe" ) ) // TODO: Use m_LinkerStampExe property
        {
            return false; // GetFileNode will have emitted an error
        }
    }

    // Store all dependencies
    m_StaticDependencies.SetCapacity( 1 + // for .Linker
                                      libraries.GetSize() +
                                      assemblyResources.GetSize() +
                                      otherLibraryNodes.GetSize() +
                                      ( linkerStampExeNode ? 1 : 0 ) );
    m_StaticDependencies.Append( Dependency( linkerExeNode ) );
    m_StaticDependencies.Append( libraries );
    m_AssemblyResourcesStartIndex = (uint32_t)m_StaticDependencies.GetSize();
    m_StaticDependencies.Append( assemblyResources );
    m_AssemblyResourcesNum = (uint32_t)assemblyResources.GetSize();
    m_StaticDependencies.Append( otherLibraryNodes );
    if ( linkerStampExeNode )
    {
        m_StaticDependencies.Append( Dependency( linkerStampExeNode ) );
    }

    return true;
}