Esempio n. 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"]);

}
Esempio n. 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));
    }