summaryrefslogtreecommitdiffstats
path: root/src/uscxml/transform
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-08-08 18:49:30 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-08-08 18:49:30 (GMT)
commitb95a9c2d23c4bfba84dfac8683c47153d598e09f (patch)
tree827a4c4f707c9ee3688997a20868ea4b86b65861 /src/uscxml/transform
parent799ca6d265d7a362526d66e7f615f914695b867e (diff)
downloaduscxml-b95a9c2d23c4bfba84dfac8683c47153d598e09f.zip
uscxml-b95a9c2d23c4bfba84dfac8683c47153d598e09f.tar.gz
uscxml-b95a9c2d23c4bfba84dfac8683c47153d598e09f.tar.bz2
Be more explicit as to why a configuration is invalid
Diffstat (limited to 'src/uscxml/transform')
-rw-r--r--src/uscxml/transform/ChartToFSM.cpp28
-rw-r--r--src/uscxml/transform/ChartToFSM.h3
2 files changed, 22 insertions, 9 deletions
diff --git a/src/uscxml/transform/ChartToFSM.cpp b/src/uscxml/transform/ChartToFSM.cpp
index 073805f..0aac811 100644
--- a/src/uscxml/transform/ChartToFSM.cpp
+++ b/src/uscxml/transform/ChartToFSM.cpp
@@ -206,7 +206,7 @@ InterpreterState FlatteningInterpreter::interpret() {
GlobalState::gIndex = 0;
_start = new GlobalState(_configuration, _alreadyEntered, _historyValue, _nsInfo.xmlNSPrefix);
_globalConf[_start->stateId] = _start;
- _globalConf[_start->stateId]->index = GlobalState::gIndex++;
+ _globalConf[_start->stateId]->index = toStr(GlobalState::gIndex++);
NodeSet<std::string> initialTransitions;
@@ -473,7 +473,7 @@ void FlatteningInterpreter::explode() {
}
_globalConf[globalState->stateId] = globalState;
- _globalConf[globalState->stateId]->index = GlobalState::gIndex++;
+ _globalConf[globalState->stateId]->index = toStr(GlobalState::gIndex++);
assert(isLegalConfiguration(configuration));
if(_globalConf[globalState->stateId]->isFinal)
@@ -568,7 +568,10 @@ void FlatteningInterpreter::explode() {
if (tthread::chrono::system_clock::now() - _lastTimeStamp > 1000) {
_lastTimeStamp = tthread::chrono::system_clock::now();
// std::cout << globalState->stateId << " [" << nrElements << "]: " << std::endl;
- std::cout << _perfTotal << " [" << _perfProcessed << "/sec]" << std::endl;
+ std::cout << "States: " << _globalConf.size() << " - ";
+ std::cout << "Tested: " << _perfTotal << " [" << _perfProcessed << "/sec] - ";
+ std::cout << "Current Complexity: 2**" << nrElements << " = " << pow(2.0, static_cast<double>(nrElements));
+ std::cout << std::endl;
_perfProcessed = 0;
}
@@ -667,10 +670,16 @@ NEXT_DEPTH:
_currGlobalTransition = *transListIter;
microstep((*transListIter)->transitions);
if (!isLegalConfiguration(_configuration)) {
- std::cout << "invalid configuration from " << globalState->stateId << std::endl;
+ FlatStateIdentifier fromState(configuration, alreadyEntered, historyValue);
+ FlatStateIdentifier toState(_configuration, _alreadyEntered, _historyValue);
+ std::cerr << "invalid configuration after transition " << std::endl
+ << "from \t" << fromState.getStateId() << std::endl
+ << "to \t" << toState.getStateId() << std::endl
+ << "via ------" << std::endl;
for (int i = 0; i < (*transListIter)->transitions.size(); i++) {
- std::cout << (*transListIter)->transitions[i] << std::endl;
+ std::cerr << (*transListIter)->transitions[i] << std::endl;
}
+ std::cerr << "----------" << std::endl;
assert(false);
}
explode();
@@ -752,13 +761,12 @@ Node<std::string> FlatteningInterpreter::globalStateToNode(GlobalState* globalSt
Element<std::string> state = _flatDoc.createElementNS(_nsInfo.nsURL, "state");
_nsInfo.setPrefix(state);
+ state.setAttribute("ref", globalState->index);
state.setAttribute("id", globalState->stateId);
if (globalState->isFinal)
state.setAttribute("final", "true");
-// state.setAttribute("index", toStr(globalState->index));
-
std::list<GlobalTransition*> transitionList;
for (std::map<std::string, GlobalTransition*>::iterator outIter = globalState->outgoing.begin();
outIter != globalState->outgoing.end();
@@ -769,10 +777,13 @@ Node<std::string> FlatteningInterpreter::globalStateToNode(GlobalState* globalSt
transitionList = sortTransitions(transitionList);
// std::cout << "/////////////////" << std::endl;
+ size_t index = 0;
for (std::list<GlobalTransition*>::iterator outIter = transitionList.begin();
outIter != transitionList.end();
outIter++) {
+ (*outIter)->index = globalState->index + ":" + toStr(index);
state.appendChild(globalTransitionToNode(*outIter));
+ index++;
}
// std::cout << "/////////////////" << std::endl;
@@ -786,6 +797,8 @@ Node<std::string> FlatteningInterpreter::globalTransitionToNode(GlobalTransition
Element<std::string> transition = _flatDoc.createElementNS(_nsInfo.nsURL, "transition");
_nsInfo.setPrefix(transition);
+// transition.setAttribute("ref", globalTransition->index);
+
if (!globalTransition->isEventless) {
transition.setAttribute("event", globalTransition->eventDesc);
}
@@ -822,7 +835,6 @@ Node<std::string> FlatteningInterpreter::globalTransitionToNode(GlobalTransition
transition.setAttribute("prioPerLevel", nrSS.str());
#endif
- transition.setAttribute("id", globalTransition->transitionId);
// std::cout << " firstPerLevel:" << feSS.str() << " " << globalTransition->transitionId << std::endl;
// std::cout << "event: " << globalTransition->eventDesc << " firstPerLevel:" << feSS.str() << " numberPerLevel:" << nrSS.str() << " prioPerLevel:" << prSS.str() << " " << globalTransition->transitionId << std::endl;
diff --git a/src/uscxml/transform/ChartToFSM.h b/src/uscxml/transform/ChartToFSM.h
index 5ee5c8e..64b3640 100644
--- a/src/uscxml/transform/ChartToFSM.h
+++ b/src/uscxml/transform/ChartToFSM.h
@@ -51,7 +51,7 @@ public:
static int gIndex;
- int index;
+ std::string index;
bool isFinal;
};
@@ -99,6 +99,7 @@ public:
std::string source;
std::string destination;
+ std::string index;
protected:
std::list<std::string> getCommonEvents(const Arabica::XPath::NodeSet<std::string>& transitions);
};