Commit c3016ded authored by Victor Yacovlev's avatar Victor Yacovlev

Run program from main thread within RunPlugin

parent 23896f07
......@@ -221,16 +221,16 @@ int Plugin::checkTaskFromConsole(const int taskID)
Shared::RunInterface::RunnableProgram program;
program.executableData = outData;
program.executableFileName = "";
runner->loadProgram(program);
for(int i=0;i<task.fields.count();i++)
{
runner->loadProgram(program);
QString testMessage = tr("++++++ ") +task.name+tr(" field no: ")+QString::number(i);
std::cout << testMessage.toLocal8Bit().data();
std::cout << std::endl;
field_no=i;
selectNext(&task);
runner->runTesting();
runner->runProgramInCurrentThread(true);
}
return 0; //QVariant valueStackTopItem()
......
......@@ -122,6 +122,17 @@ void Run::runContinuous()
start();
}
void Run::runInCurrentThread()
{
stoppingFlag_ = false;
breakHitFlag_ = false;
ignoreLineChangeFlag_ = false;
_runMode = Shared::RunInterface::RM_ToEnd;
vm->setDebugOff(true);
vm->setNextCallToEnd();
run();
}
void Run::debuggerReset()
{
......
......@@ -90,6 +90,7 @@ public slots:
void runToEnd();
void runBlind();
void runContinuous();
void runInCurrentThread();
bool noticeOnLineChanged(int lineNo, uint32_t colStart, uint32_t colEnd);
bool noticeOnFunctionReturn();
......
......@@ -649,6 +649,21 @@ void KumirRunPlugin::setStdOutTextStream(QTextStream *stream)
}
}
void KumirRunPlugin::runProgramInCurrentThread(bool useTestingEntryPoint)
{
if (useTestingEntryPoint) {
pRun_->setEntryPointToTest();
}
else {
pRun_->setEntryPointToMain();
}
pRun_->vm->setConsoleInputBuffer(simulatedInputBuffer_? simulatedInputBuffer_ : defaultInputBuffer_);
pRun_->vm->setConsoleOutputBuffer(simulatedOutputBuffer_? simulatedOutputBuffer_ : defaultOutputBuffer_);
pRun_->reset();
pRun_->runInCurrentThread();
checkForErrorInConsole();
}
QList<ExtensionSystem::CommandLineParameter>
KumirRunPlugin::acceptableCommandLineParameters() const
{
......
......@@ -67,6 +67,7 @@ public:
void setStdOutTextStream(QTextStream *);
public slots:
void runProgramInCurrentThread(bool useTestingEntryPoint = false);
void runBlind();
void runContinuous();
void runStepOver();
......
......@@ -44,6 +44,9 @@ public:
virtual void runStepInto() = 0;
virtual void runToEnd() = 0;
virtual void runTesting() = 0;
virtual void runProgramInCurrentThread(bool useTestingEntryPoint = false) = 0;
virtual bool isTestingRun() const = 0;
virtual void terminate() = 0;
virtual bool hasMoreInstructions() const = 0;
......@@ -73,6 +76,7 @@ public:
};
}
Q_DECLARE_METATYPE(Shared::RunInterface::StopReason)
Q_DECLARE_INTERFACE(Shared::RunInterface, "kumir2.run")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment