#include "compiler.ih"

int Compiler::nFiles()
{
    size_t count = 0;

    while (true)
    {
        count += count_if(d_fileIter, d_end,
            [&](Element const &element)
            {
                return element.type == SRC;
            }
        );

        if (++d_current == d_map.end())
            break;

        setFileIterators();
    }

    if (count == 0)
    {
        log() << "No sources to compile\n";
        return 0;
    }

    d_current = d_map.begin();
    setFileIterators();

    if (g_options.debug())
        log() << "Compiler::compile: about to start the compilation of " <<
                 count << " source files\n";
    else
        log() << "compiling...\n";
      
    return count;
}



