diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-08-26 15:11:47 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-08-26 15:11:47 (GMT) |
commit | 0a22a276cfff2155cbaf4939d75c257dfdb46932 (patch) | |
tree | efd057b2bfee89557636819433bc7ecf932153cd /src/uscxml/Interpreter.cpp | |
parent | f3e7f0bb9866edb30682b1e1b72db7c4f6946378 (diff) | |
download | uscxml-0a22a276cfff2155cbaf4939d75c257dfdb46932.zip uscxml-0a22a276cfff2155cbaf4939d75c257dfdb46932.tar.gz uscxml-0a22a276cfff2155cbaf4939d75c257dfdb46932.tar.bz2 |
Identify InterpreterIssues at runtime
Diffstat (limited to 'src/uscxml/Interpreter.cpp')
-rw-r--r-- | src/uscxml/Interpreter.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index b87efed..aa4475c 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -768,6 +768,17 @@ InterpreterState InterpreterImpl::step(int waitForMS) { microstep(enabledTransitions); setInterpreterState(USCXML_MICROSTEPPED); + + // check whether we run in cycles + FlatStateIdentifier flat(_configuration, _alreadyEntered, _historyValue); + if (_microstepConfigurations.find(flat.getStateId()) != _microstepConfigurations.end()) { + USCXML_MONITOR_CALLBACK2(reportIssue, + InterpreterIssue("Reentering during microstep " + flat.getFlatActive() + " - possible endless loop", + Arabica::DOM::Node<std::string>(), + InterpreterIssue::USCXML_ISSUE_WARNING)); + } + _microstepConfigurations.insert(flat.getStateId()); + return _state; } _stable = true; @@ -800,6 +811,7 @@ InterpreterState InterpreterImpl::step(int waitForMS) { } else { _stable = true; + _microstepConfigurations.clear(); } if (_state != USCXML_MACROSTEPPED && _state != USCXML_IDLE) @@ -953,6 +965,8 @@ void InterpreterImpl::stabilize() { assert(initialTransitions.size() > 0); enterStates(initialTransitions); } + + std::set<std::string> configurationsSeen; do { // process microsteps for enabled transitions until there are no more left |