diff options
author | Stefan Radomski <github@mintwerk.de> | 2016-06-23 11:06:59 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2016-06-23 11:06:59 (GMT) |
commit | 64298f234d4751d094ef91833830337417404e82 (patch) | |
tree | 93a2ec8a1674353a6125787267699d326967bc4f /apps/uscxml-browser.cpp | |
parent | 0e0be07906a720ae54e4572d6ac0cb657424550d (diff) | |
download | uscxml-64298f234d4751d094ef91833830337417404e82.zip uscxml-64298f234d4751d094ef91833830337417404e82.tar.gz uscxml-64298f234d4751d094ef91833830337417404e82.tar.bz2 |
Smaller bug-fixes and refactorings
Diffstat (limited to 'apps/uscxml-browser.cpp')
-rw-r--r-- | apps/uscxml-browser.cpp | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/apps/uscxml-browser.cpp b/apps/uscxml-browser.cpp index a57b79b..5f48842 100644 --- a/apps/uscxml-browser.cpp +++ b/apps/uscxml-browser.cpp @@ -1,6 +1,8 @@ #include "uscxml/config.h" #include "uscxml/Interpreter.h" +#include "uscxml/InterpreterOptions.h" #include "uscxml/debug/InterpreterIssue.h" +#include "uscxml/debug/DebuggerServlet.h" #include "uscxml/interpreter/InterpreterMonitor.h" #include "uscxml/util/DOM.h" @@ -87,22 +89,37 @@ int main(int argc, char** argv) { } } + if (options.withDebugger) { + DebuggerServlet* debugger; + debugger = new DebuggerServlet(); + debugger->copyToInvokers(true); + HTTPServer::getInstance()->registerServlet("/debug", debugger); + for (auto interpreter : interpreters) { + interpreter.addMonitor(debugger); + } + } + // run interpreters - try { - std::list<Interpreter>::iterator interpreterIter = interpreters.begin(); - while (interpreters.size() > 0) { - while(interpreterIter != interpreters.end()) { - InterpreterState state = interpreterIter->step(); - if (state == USCXML_FINISHED) { - interpreterIter = interpreters.erase(interpreterIter); - } else { - interpreterIter++; + if (interpreters.size() > 0) { + try { + std::list<Interpreter>::iterator interpreterIter = interpreters.begin(); + while (interpreters.size() > 0) { + while(interpreterIter != interpreters.end()) { + InterpreterState state = interpreterIter->step(); + if (state == USCXML_FINISHED) { + interpreterIter = interpreters.erase(interpreterIter); + } else { + interpreterIter++; + } } + interpreterIter = interpreters.begin(); } - interpreterIter = interpreters.begin(); + } catch (Event e) { + std::cout << e << std::endl; } - } catch (Event e) { - std::cout << e << std::endl; - } + } else if (options.withDebugger) { + while(true) + std::this_thread::sleep_for(std::chrono::seconds(1)); + } return EXIT_SUCCESS; }
\ No newline at end of file |