Example #1
0
void ppInclude::pushFile(const std::string &name)
{
    // gotta do the test first to get the error correct if it isn't there
    std::fstream in(name.c_str(), std::ios::in);
    if (in == NULL)
    {
        Errors::Error(std::string("Could not open ") + name + " for input");
    }
    else
    {
        in.close();
        if (current)
        {
            files.push_front(current);
            current = NULL;
        }
        current = new ppFile(fullname, trigraphs, extendedComment, name, define, *ctx, unsignedchar, c89, asmpp);
        //if (current)
            if (!current->Open())
            {
                Errors::Error(std::string("Could not open ") + name + " for input");
                popFile();
            }
    }
}
Example #2
0
bool ppInclude::GetLine(std::string &line, int &lineno)
{
    while (current)
    {
        if (current->GetLine(line))
        {
            if (current && files.size() == 0)
                lineno = GetLineNo();
            else
                lineno = INT_MIN;
            if (asmpp)
                StripAsmComment(line);
            return true;
        }
        current->CheckErrors();
        if (inProc.size())
        {
            Errors::Error(std::string("File ended with ") + inProc + " in progress");
            inProc = "";
        }
        popFile();
    }
    return false;
        
}
int main(int argc, char* argv[]) {
    srand(time(NULL));
    if (argc < 3) {
        std::cerr << "Two arguments required [ n loci_file ]" << std::endl;
        return 1;
    }
    LocusVec locuses = parseFile(argv[2]);
    Population population = genPopulation(locuses, atoi(argv[1]));
    PopulationFile popFile(locuses, population);

    return 0;
}
Example #4
0
ppInclude::~ppInclude()
{
    while (current)
        popFile();
}