summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-08-26 09:39:34 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-08-26 09:39:34 (GMT)
commitf3e7f0bb9866edb30682b1e1b72db7c4f6946378 (patch)
treefe6054055af641af9c2c4c7382b823130be0e3cd
parentcb13bcc0939c3dad37871701401fa1c041904ec0 (diff)
downloaduscxml-f3e7f0bb9866edb30682b1e1b72db7c4f6946378.zip
uscxml-f3e7f0bb9866edb30682b1e1b72db7c4f6946378.tar.gz
uscxml-f3e7f0bb9866edb30682b1e1b72db7c4f6946378.tar.bz2
conditionalized debugging std::couts
-rw-r--r--src/uscxml/Interpreter.cpp14
-rw-r--r--src/uscxml/interpreter/InterpreterRC.cpp32
2 files changed, 29 insertions, 17 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index eface5e..b87efed 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -745,7 +745,7 @@ InterpreterState InterpreterImpl::step(int waitForMS) {
// goto initial configuration
NodeSet<std::string> initialTransitions = getDocumentInitialTransitions();
assert(initialTransitions.size() > 0);
-#if 1
+#if VERBOSE
std::cout << _name << ": initialTransitions: " << std::endl;
for (int i = 0; i < initialTransitions.size(); i++) {
std::cout << initialTransitions[i] << std::endl;
@@ -1042,7 +1042,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterImpl::selectEventlessTransitions
}
states.to_document_order();
-#if 0
+#if VERBOSE
std::cout << "Atomic States: ";
for (int i = 0; i < atomicStates.size(); i++) {
std::cout << ATTR(atomicStates[i], "id") << ", ";
@@ -1072,7 +1072,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterImpl::selectEventlessTransitions
index++;
}
-#if 0
+#if VERBOSE
std::cout << "Enabled eventless transitions: " << std::endl;
for (int i = 0; i < enabledTransitions.size(); i++) {
std::cout << enabledTransitions[i] << std::endl << "----" << std::endl;
@@ -2231,7 +2231,7 @@ void InterpreterImpl::executeContent(const Arabica::DOM::Element<std::string>& c
} else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "if")) {
// --- IF / ELSEIF / ELSE --------------
Arabica::DOM::Element<std::string> ifElem = (Arabica::DOM::Element<std::string>)content;
-#if 0
+#if VERBOSE
if (HAS_ATTR(ifElem, "cond"))
std::cout << ATTR(ifElem, "cond") << std::endl;
#endif
@@ -2550,7 +2550,7 @@ Arabica::DOM::Node<std::string> InterpreterImpl::getAncestorElement(const Arabic
*/
Arabica::DOM::Node<std::string> InterpreterImpl::findLCCA(const Arabica::XPath::NodeSet<std::string>& states) {
-#if 0
+#if VERBOSE
std::cout << "findLCCA: ";
for (int i = 0; i < states.size(); i++) {
std::cout << ATTR(states[i], "id") << " - " << TAGNAME(states[i]) << ", ";
@@ -2565,7 +2565,7 @@ Arabica::DOM::Node<std::string> InterpreterImpl::findLCCA(const Arabica::XPath::
if (!isCompound(Element<std::string>(ancestors[i])))
continue;
for (int j = 0; j < states.size(); j++) {
-#if 0
+#if VERBOSE
std::cout << "Checking " << TAGNAME(states[j]) << " and " << TAGNAME(ancestors[i]) << std::endl;
#endif
if (!isDescendant(states[j], ancestors[i]) && (states[j] != ancestors[i]))
@@ -2581,7 +2581,7 @@ NEXT_ANCESTOR:
if (!ancestor)
ancestor = _scxml;
assert(ancestor);
-#if 0
+#if VERBOSE
std::cout << " -> " << ATTR(ancestor, "id") << " " << ancestor.getLocalName() << std::endl;
#endif
return ancestor;
diff --git a/src/uscxml/interpreter/InterpreterRC.cpp b/src/uscxml/interpreter/InterpreterRC.cpp
index 6aea740..d91eadb 100644
--- a/src/uscxml/interpreter/InterpreterRC.cpp
+++ b/src/uscxml/interpreter/InterpreterRC.cpp
@@ -26,6 +26,8 @@
#include "uscxml/UUID.h"
#include "uscxml/DOMUtils.h"
+#define VERBOSE 0
+
namespace uscxml {
using namespace Arabica::XPath;
@@ -170,7 +172,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterRC::computeExitSet(const Arabica
}
}
}
-#if 0
+#if VERBOSE
std::cout << "computeExitSet: ";
for (int i = 0; i < statesToExit.size(); i++) {
std::cout << ATTR(statesToExit[i], "id") << " ";
@@ -272,7 +274,7 @@ void InterpreterRC::computeEntrySet(const Arabica::XPath::NodeSet<std::string>&
NodeSet<std::string> targets = getTargetStates(t);
-#if 1
+#if VERBOSE
std::cout << "computeEntrySet: ";
for (int i = 0; i < targets.size(); i++) {
std::cout << ATTR_CAST(targets[i], "id") << " ";
@@ -291,7 +293,7 @@ void InterpreterRC::computeEntrySet(const Arabica::XPath::NodeSet<std::string>&
addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent);
}
-#if 1
+#if VERBOSE
std::cout << "after addDescendantStatesToEnter: ";
for (int i = 0; i < statesToEnter.size(); i++) {
std::cout << ATTR_CAST(statesToEnter[i], "id") << " ";
@@ -307,7 +309,7 @@ void InterpreterRC::computeEntrySet(const Arabica::XPath::NodeSet<std::string>&
addAncestorStatesToEnter(s, ancestor, statesToEnter, statesForDefaultEntry, defaultHistoryContent);
}
-#if 1
+#if VERBOSE
std::cout << "after addAncestorStatesToEnter: ";
for (int i = 0; i < statesToEnter.size(); i++) {
std::cout << ATTR_CAST(statesToEnter[i], "id") << " ";
@@ -327,13 +329,15 @@ void InterpreterRC::computeEntrySet(const Arabica::XPath::NodeSet<std::string>&
NodeSet<std::string> targets = getTargetStates(t);
for (int j = 0; j < targets.size(); j++) {
if (!isMember(targets[j], statesToEnter)) {
+#if VERBOSE
std::cout << "adding: " << ATTR_CAST(anc, "id") << std::endl;
+#endif
statesToEnter.push_back(targets[j]);
}
}
}
-#if 1
+#if VERBOSE
std::cout << "before addDescendantStatesToEnter: ";
for (int i = 0; i < statesToEnter.size(); i++) {
std::cout << ATTR_CAST(statesToEnter[i], "id") << " ";
@@ -347,7 +351,7 @@ void InterpreterRC::computeEntrySet(const Arabica::XPath::NodeSet<std::string>&
addDescendantStatesToEnter(tmp[i],statesToEnter,statesForDefaultEntry, defaultHistoryContent);
}
-#if 1
+#if VERBOSE
std::cout << "after addDescendantStatesToEnter: ";
for (int i = 0; i < statesToEnter.size(); i++) {
std::cout << ATTR_CAST(statesToEnter[i], "id") << " ";
@@ -365,7 +369,7 @@ void InterpreterRC::computeEntrySet(const Arabica::XPath::NodeSet<std::string>&
}
}
-#if 1
+#if VERBOSE
std::cout << "after addAncestorStatesToEnter: ";
for (int i = 0; i < statesToEnter.size(); i++) {
std::cout << ATTR_CAST(statesToEnter[i], "id") << " ";
@@ -413,9 +417,11 @@ void InterpreterRC::addDescendantStatesToEnter(const Arabica::DOM::Element<std::
Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry,
std::map<std::string, Arabica::DOM::Node<std::string> > defaultHistoryContent) {
+#if VERBOSE
std::cout << getPadding() << "addDescendantStatesToEnter: " << ATTR(state, "id") << std::endl;
padding++;
-
+#endif
+
if (isHistory(state)) {
std::string stateId = ATTR(state, "id");
@@ -446,7 +452,9 @@ void InterpreterRC::addDescendantStatesToEnter(const Arabica::DOM::Element<std::
} else {
if (!isMember(state, statesToEnter)) { // adding an existing element invalidates old reference
+#if VERBOSE
std::cout << getPadding() << "adding: " << ATTR_CAST(state, "id") << std::endl;
+#endif
statesToEnter.push_back(state);
}
@@ -492,13 +500,17 @@ void InterpreterRC::addAncestorStatesToEnter(const Arabica::DOM::Element<std::st
Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry,
std::map<std::string, Arabica::DOM::Node<std::string> > defaultHistoryContent) {
+#if VERBOSE
std::cout << getPadding() << "addAncestorStatesToEnter: " << ATTR(state, "id") << " - " << ATTR(ancestor, "id") << std::endl;
padding++;
-
+#endif
+
NodeSet<std::string> ancestors = getProperAncestors(state, ancestor);
for (int i = 0; i < ancestors.size(); i++) {
const Node<std::string>& anc = ancestors[i];
+#if VERBOSE
std::cout << getPadding() << "adding: " << ATTR_CAST(anc, "id") << std::endl;
+#endif
statesToEnter.push_back(anc);
if (isParallel(Element<std::string>(anc))) {
NodeSet<std::string> childStates = getChildStates(anc);
@@ -550,7 +562,7 @@ BREAK_LOOP:
NodeSet<std::string> tStates = getTargetStates(transition);
Node<std::string> source = getSourceState(transition);
-#if 0
+#if VERBOSE
std::cout << "getTransitionDomain: " << std::endl << transition << std::endl;
#endif