コード例 #1
0
ファイル: IRWriter.cpp プロジェクト: orcc/jade
map<string, Procedure*>* IRWriter::writeProcedures(map<string, Procedure*>* procs){
    map<string, Procedure*>::iterator it;
    map<string, Procedure*>* newProcs = new map<string, Procedure*>();


    //Creation of procedure must be done in two times because function can call other functions
    for (it = procs->begin(); it != procs->end(); ++it){
        Procedure* proc = (*it).second;
        Function* newFunction = NULL;

        //Write declaration of the function
        if (proc->isExternal()){
            newFunction = writer->addFunctionProtosExternal(proc->getFunction());
        }else{
            newFunction = writer->addFunctionProtosInternal(proc->getFunction());
        }

        //Create a new procedure
        Procedure* newProc = new Procedure(proc->getName(), proc->getExternal(), newFunction);
        newProcs->insert(pair<string, Procedure*>(proc->getName(), newProc));
    }

    //Link body of the procedure
    for (it = procs->begin(); it != procs->end(); ++it){
        Procedure* proc = (*it).second;
        writer->linkProcedureBody(proc->getFunction());
    }

    return newProcs;
}
コード例 #2
0
ファイル: Decoder.cpp プロジェクト: orcc/jade
list<Procedure*> Decoder::getExternalProcs(){
    list<Procedure*> externs;

    // Look across all instances for external procedures
    map<std::string, Instance*>* instances = configuration->getInstances();
    for (map<std::string, Instance*>::iterator it = instances->begin(); it != instances->end(); it++){
        Instance* instance = it->second;

        // Look accross all procs for external property
        map<string, Procedure*>::iterator itProc;
        map<string, Procedure*>* procs = instance->getProcs();

        for (itProc = procs->begin(); itProc != procs->end(); itProc++){
            Procedure* proc = itProc->second;

            if (proc->isExternal()){
                externs.push_back(proc);
            }

        }
    }

    return externs;
}