Example #1
0
void DialogIDE::start(void) {

    QString src = editor->toPlainText();

    mapSRC.clear();
    mapPP.clear();
    mapASM.clear();
    mapLM.clear();

    mapSRC["test"] = src.toAscii();

    Clcpp *lcpp = new Clcpp(&mapSRC,&mapPP,this->modelCB->currentText());
    lcpp->run();
    outputpp->setPlainText(mapPP["test"]);

    Clcc *lcc = new Clcc(&mapPP,&mapASM);
 //   connect(lcc,SIGNAL(outputSignal(QString,QString)),this,SLOT(output(QString,QString)));
    lcc->run();

    outputstd->setPlainText(mapASM["output"]);
    outputasm->setPlainText(mapASM["test.asm"]);

    Cpasm * pasm = new Cpasm(&mapASM,&mapLM);
    pasm->parsefile("BAS",mapASM["test.asm"]);
    pasm->savefile("BAS");
    pasm->savefile("BIN");

    outputlm->setPlainText(mapLM["BAS"]);
    outputstd->appendPlainText("\r\r\r"+mapLM["output"]);

}
Example #2
0
/*!
 \brief lance le processus de compilation adéquate en fonction de l'extension du fichier

*/
void WindowIDE::compile(void) {
#ifndef Q_OS_ANDROID
    mapSRC.clear();
    mapPP.clear();
    mapASM.clear();
    mapLM.clear();

    save();

    CEditorWidget *locEditorWidget = ((CEditorWidget*)ui->tabWidget->currentWidget());

    QString source = "#include <internal.h>\r\n"+locEditorWidget->m_editControl->editor()->text();
    QString sourcefname=locEditorWidget->m_editControl->editor()->fileName();
    QFileInfo fInfo(sourcefname);

    if (locEditorWidget->m_editControl->editor()->languageDefinition()->language()=="C++") {
        mapSRC[sourcefname] = source.toAscii();
        Clcpp *lcpp = new Clcpp(&mapSRC,&mapPP,ui->targetComboBox->currentText());
        lcpp->pStdLibs->LoadLibs();
        lcpp->run();
        //createEditorTab(fInfo.baseName()+".pp",mapPP[sourcefname]);
        //createOutputTab("PP Compiler :"+fInfo.fileName(),mapPP["output"]);
#if 1
        Clcc *lcc = new Clcc(&mapPP,&mapASM);
        lcc->run();
        createEditorTab(fInfo.baseName()+".log",mapASM["LOG"]);

        createEditorTab(fInfo.baseName()+".asm",mapASM[fInfo.baseName()+".asm"]);

        createOutputTab("C Compiler :"+fInfo.fileName(),mapASM["output"]);
#endif
    }

    if (locEditorWidget->m_editControl->editor()->languageDefinition()->language()=="ASM") {
        CEditorWidget *currentWidget = locEditorWidget;

        mapSRC[sourcefname] = source.toAscii();
        Cpasm * pasm = new Cpasm(&mapSRC,&mapLM);
        pasm->run("BAS",mapSRC[sourcefname]);
        pasm->savefile("BAS");
        pasm->savefile("BIN");
        pasm->savefile("HEX");

        createEditorTab(fInfo.baseName()+".bas",mapLM["BAS"]);

        createOutputTab("ASM Compiler :"+fInfo.fileName(),mapLM["output"]);

        currentWidget = ((CEditorWidget*)ui->tabWidget->currentWidget());
        QHexPanel *hexpanel = new QHexPanel();


        currentWidget->m_editControl
                ->addPanel(hexpanel, QCodeEdit::South, true);
        hexpanel->startadr = mapLM["_ORG"].trimmed().toLong();
        hexpanel->hexeditor->setData(mapLM["BIN"],hexpanel->startadr);
        hexpanel->hexeditor->setCursorPosition(0,BINEditor::BinEditor::MoveAnchor);
        connect(this,SIGNAL(newEmulatedPocket(CPObject*)),hexpanel,SLOT(newPocket(CPObject*)));
        connect(this,SIGNAL(removeEmulatedPocket(CPObject*)),hexpanel,SLOT(removePocket(CPObject*)));
        connect(hexpanel,SIGNAL(installTo(CpcXXXX*,qint32,QByteArray)),this,SLOT(installTo(CpcXXXX*,qint32,QByteArray)));




//        MSG_ERROR("*"+mapLM["_ORG"]+"*");
//        MSG_ERROR(QString("%1").arg(hexpanel->startadr));
    }
Example #3
0
QList<QCodeNode *> WindowIDE::completionScan(QEditor *e) {

#ifndef Q_OS_ANDROID

    QMap<QString,QByteArray> mapSRC;
    QMap<QString,QByteArray> mapPP;
    QMap<QString,QByteArray> mapASM;
    //CEditorWidget *locEditorWidget = ((CEditorWidget*)ui->tabWidget->currentWidget());

    QString source = "#include <internal.h>\r\n"+e->text();
    QString sourcefname=e->fileName();
    QFileInfo fInfo(sourcefname);

    if (e->languageDefinition()->language()=="C++") {
        mapSRC[sourcefname] = source.toAscii();
        Clcpp *lcpp = new Clcpp(&mapSRC,&mapPP,ui->targetComboBox->currentText(),false);
        lcpp->pStdLibs->LoadLibs();
        lcpp->run();
        this->doxygenlist = lcpp->getDoxygenList();
        //createEditorTab(fInfo.baseName()+".xml",mapPP["DOxygen"]);
        //createOutputTab("PP Compiler :"+fInfo.fileName(),mapPP["output"]);
        Clcc *lcc = new Clcc(&mapPP,&mapASM,false);
        lcc->FirstScan(mapPP[sourcefname]);
        //lcc->run();

        // recuperer var et proc
        //lcc->varlist

        //lcc->proclist
        lcc->printvarlist("variables");
        lcc->printproclist("procedures");

        this->varlist.clear();
        this->proclist.clear();

        this->varlist = lcc->varlist;
        this->proclist = lcc->proclist;


        QList<QCodeNode *> nodes;

        QCodeNode *n = new QCodeNode();

        for (int i=0;i<varlist.size();i++) {
            Cvar v = varlist.at(i);
            QCodeNode *vn = new QCodeNode();
            vn->roles = "v@"+v.varname+"@"+v.typ;
            vn->attach(n);
        }

        //    fct->roles = QByteArray("f@")
        //                + name
        //                + "@"
        //                + retval
        //                + "@"
        //                + QByteArray::number(visibility)
        //                + "@"
        //                ;

        for (int i=0;i<proclist.size();i++) {
            Cproc p = proclist.at(i);
            QCodeNode *pn = new QCodeNode();
            //name
            pn->roles = "f@"+p.ProcName+"@";
            //return
            if (p.hasreturn) {
                if (p.ReturnIsWord) pn->roles+="word";
                else pn->roles+="byte";
            }
            //visibility + template
            pn->roles+="@@@";
            //arguments
            if (p.ParCnt > 0) pn->roles+=p.Params+"@";

            pn->attach(n);
        }
        nodes.append(n);

        ui->vartextEdit->setText(mapASM["variables"]);
        ui->proctextEdit->setText(mapASM["procedures"]);

        return nodes;
    }
#endif
}