diff options
author | Stefan Radomski <sradomski@mintwerk.de> | 2016-02-24 10:50:32 (GMT) |
---|---|---|
committer | Stefan Radomski <sradomski@mintwerk.de> | 2016-02-24 10:50:32 (GMT) |
commit | cf19f11b8d2bd6d9566c7528fbed40af06928abf (patch) | |
tree | a373b8e934fa78a1bf9db8afca2e9854437e45da /src/uscxml/interpreter | |
parent | 7212d5a3dbbd2845d09df96b2c345132c8a24931 (diff) | |
download | uscxml-cf19f11b8d2bd6d9566c7528fbed40af06928abf.zip uscxml-cf19f11b8d2bd6d9566c7528fbed40af06928abf.tar.gz uscxml-cf19f11b8d2bd6d9566c7528fbed40af06928abf.tar.bz2 |
Some more refactoring and VHDL transformation
Diffstat (limited to 'src/uscxml/interpreter')
-rw-r--r-- | src/uscxml/interpreter/InterpreterDraft6.cpp | 94 | ||||
-rw-r--r-- | src/uscxml/interpreter/InterpreterRC.cpp | 68 |
2 files changed, 81 insertions, 81 deletions
diff --git a/src/uscxml/interpreter/InterpreterDraft6.cpp b/src/uscxml/interpreter/InterpreterDraft6.cpp index a8bf97b..6084641 100644 --- a/src/uscxml/interpreter/InterpreterDraft6.cpp +++ b/src/uscxml/interpreter/InterpreterDraft6.cpp @@ -119,10 +119,10 @@ bool InterpreterDraft6::isWithinParallel(const Element<std::string>& transition) Node<std::string> InterpreterDraft6::findLCPA(const Arabica::XPath::NodeSet<std::string>& states) { Arabica::XPath::NodeSet<std::string> ancestors = getProperAncestors(states[0], Node<std::string>()); Node<std::string> ancestor; - for (int i = 0; i < ancestors.size(); i++) { + for (size_t i = 0; i < ancestors.size(); i++) { if (!isParallel(Element<std::string>(ancestors[i]))) continue; - for (int j = 0; j < states.size(); j++) { + for (size_t j = 0; j < states.size(); j++) { if (!isDescendant(states[j], ancestors[i]) && (states[j] != ancestors[i])) goto NEXT_ANCESTOR; } @@ -141,13 +141,13 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e #if VERBOSE std::cout << _name << ": Enabled exit transitions: " << std::endl; - for (int i = 0; i < enabledTransitions.size(); i++) { + for (size_t i = 0; i < enabledTransitions.size(); i++) { std::cout << enabledTransitions[i] << std::endl; } std::cout << std::endl; #endif - for (int i = 0; i < enabledTransitions.size(); i++) { + for (size_t i = 0; i < enabledTransitions.size(); i++) { Element<std::string> t = ((Element<std::string>)enabledTransitions[i]); if (!isTargetless(t)) { Node<std::string> ancestor; @@ -156,7 +156,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e NodeSet<std::string> tStates = getTargetStates(t); bool isInternal = (HAS_ATTR(t, "type") && iequals(ATTR(t, "type"), "internal")); // external is default bool allDescendants = true; - for (int j = 0; j < tStates.size(); j++) { + for (size_t j = 0; j < tStates.size(); j++) { if (!isDescendant(tStates[j], source)) { allDescendants = false; break; @@ -170,7 +170,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e tmpStates.insert(tmpStates.end(), tStates.begin(), tStates.end()); #if 0 std::cout << _name << ": tmpStates: "; - for (int i = 0; i < tmpStates.size(); i++) { + for (size_t i = 0; i < tmpStates.size(); i++) { std::cout << ATTR(tmpStates[i], "id") << ", "; } std::cout << std::endl; @@ -180,7 +180,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e #if 0 std::cout << _name << ": Ancestor: " << ATTR(ancestor, "id") << std::endl;; #endif - for (int j = 0; j < _configuration.size(); j++) { + for (size_t j = 0; j < _configuration.size(); j++) { if (isDescendant(_configuration[j], ancestor)) statesToExit.push_back(_configuration[j]); } @@ -188,7 +188,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e } // remove statesToExit from _statesToInvoke std::list<Node<std::string> > tmp; - for (int i = 0; i < _statesToInvoke.size(); i++) { + for (size_t i = 0; i < _statesToInvoke.size(); i++) { if (!isMember(_statesToInvoke[i], statesToExit)) { tmp.push_back(_statesToInvoke[i]); } @@ -201,19 +201,19 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e #if 0 std::cout << _name << ": States to exit: "; - for (int i = 0; i < statesToExit.size(); i++) { + for (size_t i = 0; i < statesToExit.size(); i++) { std::cout << LOCALNAME(statesToExit[i]) << ":" << ATTR(statesToExit[i], "id") << ", "; } std::cout << std::endl; #endif - for (int i = 0; i < statesToExit.size(); i++) { + for (size_t i = 0; i < statesToExit.size(); i++) { NodeSet<std::string> histories = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "history", statesToExit[i]); - for (int j = 0; j < histories.size(); j++) { + for (size_t j = 0; j < histories.size(); j++) { Element<std::string> historyElem = (Element<std::string>)histories[j]; std::string historyType = (historyElem.hasAttribute("type") ? historyElem.getAttribute("type") : "shallow"); NodeSet<std::string> historyNodes; - for (int k = 0; k < _configuration.size(); k++) { + for (size_t k = 0; k < _configuration.size(); k++) { if (iequals(historyType, "deep")) { if (isAtomic(Element<std::string>(_configuration[k])) && isDescendant(_configuration[k], statesToExit[i])) historyNodes.push_back(_configuration[k]); @@ -225,7 +225,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e _historyValue[historyElem.getAttribute("id")] = historyNodes; #if VERBOSE std::cout << _name << ": History node " << ATTR(historyElem, "id") << " contains: "; - for (int i = 0; i < historyNodes.size(); i++) { + for (size_t i = 0; i < historyNodes.size(); i++) { std::cout << ATTR_CAST(historyNodes[i], "id") << ", "; } std::cout << std::endl; @@ -234,11 +234,11 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e } } - for (int i = 0; i < statesToExit.size(); i++) { + for (size_t i = 0; i < statesToExit.size(); i++) { USCXML_MONITOR_CALLBACK3(beforeExitingState, Element<std::string>(statesToExit[i]), (i + 1 < statesToExit.size())) NodeSet<std::string> onExits = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onExit", statesToExit[i]); - for (int j = 0; j < onExits.size(); j++) { + for (size_t j = 0; j < onExits.size(); j++) { Element<std::string> onExitElem = (Element<std::string>)onExits[j]; executeContent(onExitElem); } @@ -246,7 +246,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e USCXML_MONITOR_CALLBACK3(afterExitingState, Element<std::string>(statesToExit[i]), (i + 1 < statesToExit.size())) NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", statesToExit[i]); - for (int j = 0; j < invokes.size(); j++) { + for (size_t j = 0; j < invokes.size(); j++) { Element<std::string> invokeElem = (Element<std::string>)invokes[j]; if (HAS_ATTR(invokeElem, "persist") && stringIsTrue(ATTR(invokeElem, "persist"))) { // extension for flattened SCXML documents, we will need an explicit uninvoke element @@ -257,7 +257,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e // remove statesToExit[i] from _configuration - test409 tmp.clear(); - for (int j = 0; j < _configuration.size(); j++) { + for (size_t j = 0; j < _configuration.size(); j++) { if (_configuration[j] != statesToExit[i]) { tmp.push_back(_configuration[j]); } @@ -275,13 +275,13 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& #if VERBOSE std::cout << _name << ": Enabled enter transitions: " << std::endl; - for (int i = 0; i < enabledTransitions.size(); i++) { + for (size_t i = 0; i < enabledTransitions.size(); i++) { std::cout << "\t" << enabledTransitions[i] << std::endl; } std::cout << std::endl; #endif - for (int i = 0; i < enabledTransitions.size(); i++) { + for (size_t i = 0; i < enabledTransitions.size(); i++) { Element<std::string> transition = ((Element<std::string>)enabledTransitions[i]); if (!isTargetless(transition)) { std::string transitionType = (iequals(transition.getAttribute("type"), "internal") ? "internal" : "external"); @@ -289,7 +289,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& #if VERBOSE std::cout << _name << ": Target States: "; - for (int i = 0; i < tStates.size(); i++) { + for (size_t i = 0; i < tStates.size(); i++) { std::cout << ATTR_CAST(tStates[i], "id") << ", "; } std::cout << std::endl; @@ -303,7 +303,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& assert(source); bool allDescendants = true; - for (int j = 0; j < tStates.size(); j++) { + for (size_t j = 0; j < tStates.size(); j++) { if (!isDescendant(tStates[j], source)) { allDescendants = false; break; @@ -325,36 +325,36 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& std::cout << _name << ": Ancestor: " << ATTR_CAST(ancestor, "id") << std::endl; #endif - for (int j = 0; j < tStates.size(); j++) { + for (size_t j = 0; j < tStates.size(); j++) { addStatesToEnter(Element<std::string>(tStates[j]), statesToEnter, statesForDefaultEntry, defaultHistoryContent); } #if VERBOSE std::cout << _name << ": States to enter: "; - for (int i = 0; i < statesToEnter.size(); i++) { + for (size_t i = 0; i < statesToEnter.size(); i++) { std::cout << LOCALNAME(statesToEnter[i]) << ":" << ATTR_CAST(statesToEnter[i], "id") << ", "; } std::cout << std::endl; #endif - for (int j = 0; j < tStates.size(); j++) { + for (size_t j = 0; j < tStates.size(); j++) { NodeSet<std::string> ancestors = getProperAncestors(tStates[j], ancestor); #if VERBOSE std::cout << _name << ": Proper Ancestors of " << ATTR_CAST(tStates[j], "id") << " and " << ATTR_CAST(ancestor, "id") << ": "; - for (int i = 0; i < ancestors.size(); i++) { + for (size_t i = 0; i < ancestors.size(); i++) { std::cout << ATTR_CAST(ancestors[i], "id") << ", "; } std::cout << std::endl; #endif - for (int k = 0; k < ancestors.size(); k++) { + for (size_t k = 0; k < ancestors.size(); k++) { statesToEnter.push_back(ancestors[k]); if(isParallel(Element<std::string>(ancestors[k]))) { NodeSet<std::string> childs = getChildStates(ancestors[k]); - for (int l = 0; l < childs.size(); l++) { + for (size_t l = 0; l < childs.size(); l++) { bool someIsDescendant = false; - for (int m = 0; m < statesToEnter.size(); m++) { + for (size_t m = 0; m < statesToEnter.size(); m++) { if (isDescendant(statesToEnter[m], childs[l])) { someIsDescendant = true; break; @@ -373,13 +373,13 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& #if VERBOSE std::cout << _name << ": States to enter: "; - for (int i = 0; i < statesToEnter.size(); i++) { + for (size_t i = 0; i < statesToEnter.size(); i++) { std::cout << ATTR_CAST(statesToEnter[i], "id") << ", "; } std::cout << std::endl; #endif - for (int i = 0; i < statesToEnter.size(); i++) { + for (size_t i = 0; i < statesToEnter.size(); i++) { Element<std::string> stateElem = (Element<std::string>)statesToEnter[i]; // extension for flattened interpreters @@ -397,7 +397,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& // extension for flattened SCXML documents, we will need an explicit uninvoke element NodeSet<std::string> uninvokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "uninvoke", statesToEnter[i]); - for (int j = 0; j < uninvokes.size(); j++) { + for (size_t j = 0; j < uninvokes.size(); j++) { Element<std::string> uninvokeElem = (Element<std::string>)uninvokes[j]; cancelInvoke(uninvokeElem); } @@ -409,7 +409,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& NodeSet<std::string> dataModelElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "datamodel", stateElem); if(dataModelElems.size() > 0 && _dataModel) { Arabica::XPath::NodeSet<std::string> dataElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "data", dataModelElems[0]); - for (int j = 0; j < dataElems.size(); j++) { + for (size_t j = 0; j < dataElems.size(); j++) { if (dataElems[j].getNodeType() == Node_base::ELEMENT_NODE) initializeData(Element<std::string>(dataElems[j])); } @@ -425,7 +425,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& if (isMember(stateElem, statesForDefaultEntry)) { // execute initial transition content for compound states Arabica::XPath::NodeSet<std::string> transitions = _xpath.evaluate("" + _nsInfo.xpathPrefix + "initial/" + _nsInfo.xpathPrefix + "transition", stateElem).asNodeSet(); - for (int j = 0; j < transitions.size(); j++) { + for (size_t j = 0; j < transitions.size(); j++) { executeContent(Element<std::string>(transitions[j])); } } @@ -435,7 +435,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& if (isMember(stateElem, defaultHistoryContent)) { // execute history transition Arabica::XPath::NodeSet<std::string> transitions = _xpath.evaluate("" + _nsInfo.xpathPrefix + "history/" + _nsInfo.xpathPrefix + "transition", stateElem).asNodeSet(); - for (int j = 0; j < transitions.size(); j++) { + for (size_t j = 0; j < transitions.size(); j++) { executeContent(transitions[j]); } } @@ -459,7 +459,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& Arabica::XPath::NodeSet<std::string> childs = getChildStates(grandParent); bool inFinalState = true; - for (int j = 0; j < childs.size(); j++) { + for (size_t j = 0; j < childs.size(); j++) { if (!isInFinalState(Element<std::string>(childs[j]))) { inFinalState = false; break; @@ -471,7 +471,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& } } } - for (int i = 0; i < _configuration.size(); i++) { + for (size_t i = 0; i < _configuration.size(); i++) { Element<std::string> stateElem = (Element<std::string>)_configuration[i]; if (isFinal(stateElem) && parentIsScxmlState(stateElem)) { _topLevelFinalReached = true; @@ -494,39 +494,39 @@ void InterpreterDraft6::addStatesToEnter(const Element<std::string>& state, #if VERBOSE std::cout << "History State " << ATTR(state, "id") << ": "; - for (int i = 0; i < historyValue.size(); i++) { + for (size_t i = 0; i < historyValue.size(); i++) { std::cout << ATTR_CAST(historyValue[i], "id") << ", "; } std::cout << std::endl; #endif - for (int i = 0; i < historyValue.size(); i++) { + for (size_t i = 0; i < historyValue.size(); i++) { addStatesToEnter(Element<std::string>(historyValue[i]), statesToEnter, statesForDefaultEntry, defaultHistoryContent); NodeSet<std::string> ancestors = getProperAncestors(historyValue[i], state); #if VERBOSE std::cout << "Proper Ancestors: "; - for (int i = 0; i < ancestors.size(); i++) { - std::cout << ATTR_CAST(ancestors[i], "id") << ", "; + for (size_t j = 0; j < ancestors.size(); j++) { + std::cout << ATTR_CAST(ancestors[j], "id") << ", "; } std::cout << std::endl; #endif - for (int j = 0; j < ancestors.size(); j++) { + for (size_t j = 0; j < ancestors.size(); j++) { statesToEnter.push_back(ancestors[j]); } } } else { defaultHistoryContent.push_back(getParentState(state)); NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", state); - for (int i = 0; i < transitions.size(); i++) { + for (size_t i = 0; i < transitions.size(); i++) { NodeSet<std::string> targets = getTargetStates(Element<std::string>(transitions[i])); - for (int j = 0; j < targets.size(); j++) { + for (size_t j = 0; j < targets.size(); j++) { addStatesToEnter(Element<std::string>(targets[j]), statesToEnter, statesForDefaultEntry, defaultHistoryContent); // Modifications from chris nuernberger NodeSet<std::string> ancestors = getProperAncestors(targets[j], state); - for (int k = 0; k < ancestors.size(); k++) { + for (size_t k = 0; k < ancestors.size(); k++) { statesToEnter.push_back(ancestors[k]); } } @@ -538,7 +538,7 @@ void InterpreterDraft6::addStatesToEnter(const Element<std::string>& state, statesForDefaultEntry.push_back(state); NodeSet<std::string> tStates = getInitialStates(state); - for (int i = 0; i < tStates.size(); i++) { + for (size_t i = 0; i < tStates.size(); i++) { addStatesToEnter(Element<std::string>(tStates[i]), statesToEnter, statesForDefaultEntry, defaultHistoryContent); } @@ -547,7 +547,7 @@ void InterpreterDraft6::addStatesToEnter(const Element<std::string>& state, } else if(isParallel(state)) { NodeSet<std::string> childStates = getChildStates(state); - for (int i = 0; i < childStates.size(); i++) { + for (size_t i = 0; i < childStates.size(); i++) { addStatesToEnter(Element<std::string>(childStates[i]), statesToEnter, statesForDefaultEntry, defaultHistoryContent); } } @@ -562,7 +562,7 @@ void InterpreterDraft6::handleDOMEvent(Arabica::DOM::Events::Event<std::string>& return; Node<std::string> target = Arabica::DOM::Node<std::string>(event.getTarget()); NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", target, true); - for (int i = 0; i < transitions.size(); i++) { + for (size_t i = 0; i < transitions.size(); i++) { const Element<std::string> transElem = Element<std::string>(transitions[i]); if (_transWithinParallel.find(transElem) != _transWithinParallel.end()) _transWithinParallel.erase(transElem); diff --git a/src/uscxml/interpreter/InterpreterRC.cpp b/src/uscxml/interpreter/InterpreterRC.cpp index d959e3d..b594c18 100644 --- a/src/uscxml/interpreter/InterpreterRC.cpp +++ b/src/uscxml/interpreter/InterpreterRC.cpp @@ -39,7 +39,7 @@ using namespace Arabica::DOM; size_t padding = 0; std::string getPadding() { std::string pad = ""; - for (int i = 0; i < padding; i++) { + for (size_t i = 0; i < padding; i++) { pad += " "; } return pad; @@ -68,7 +68,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterRC::removeConflictingTransitions if (!t1Preempted) { // remove transitionsToRemove from DOMUtils::filteredTransitions std::list<Node<std::string> > tmp; - for (int i = 0; i < filteredTransitions.size(); i++) { + for (size_t i = 0; i < filteredTransitions.size(); i++) { if (!isMember(filteredTransitions[i], transitionsToRemove)) { tmp.push_back(filteredTransitions[i]); } @@ -98,7 +98,7 @@ void InterpreterRC::exitStates(const Arabica::XPath::NodeSet<std::string>& enabl #if VERBOSE_STATE_SELECTION std::cout << "exitStates: "; - for (int i = 0; i < statesToExit.size(); i++) { + for (size_t i = 0; i < statesToExit.size(); i++) { std::cout << ATTR_CAST(statesToExit[i], "id") << " "; } std::cout << std::endl; @@ -106,7 +106,7 @@ void InterpreterRC::exitStates(const Arabica::XPath::NodeSet<std::string>& enabl // remove statesToExit from _statesToInvoke std::list<Node<std::string> > tmp; - for (int i = 0; i < _statesToInvoke.size(); i++) { + for (size_t i = 0; i < _statesToInvoke.size(); i++) { if (!isMember(_statesToInvoke[i], statesToExit)) { tmp.push_back(_statesToInvoke[i]); } @@ -118,13 +118,13 @@ void InterpreterRC::exitStates(const Arabica::XPath::NodeSet<std::string>& enabl statesToExit.sort(); - for (int i = 0; i < statesToExit.size(); i++) { + for (size_t i = 0; i < statesToExit.size(); i++) { NodeSet<std::string> histories = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "history", statesToExit[i]); - for (int j = 0; j < histories.size(); j++) { + for (size_t j = 0; j < histories.size(); j++) { Element<std::string> historyElem = (Element<std::string>)histories[j]; std::string historyType = (historyElem.hasAttribute("type") ? historyElem.getAttribute("type") : "shallow"); NodeSet<std::string> historyNodes; - for (int k = 0; k < _configuration.size(); k++) { + for (size_t k = 0; k < _configuration.size(); k++) { if (iequals(historyType, "deep")) { if (isAtomic(Element<std::string>(_configuration[k])) && isDescendant(_configuration[k], statesToExit[i])) historyNodes.push_back(_configuration[k]); @@ -137,11 +137,11 @@ void InterpreterRC::exitStates(const Arabica::XPath::NodeSet<std::string>& enabl } } - for (int i = 0; i < statesToExit.size(); i++) { + for (size_t i = 0; i < statesToExit.size(); i++) { USCXML_MONITOR_CALLBACK3(beforeExitingState, Element<std::string>(statesToExit[i]), (i + 1 < statesToExit.size())) NodeSet<std::string> onExits = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onExit", statesToExit[i]); - for (int j = 0; j < onExits.size(); j++) { + for (size_t j = 0; j < onExits.size(); j++) { Element<std::string> onExitElem = (Element<std::string>)onExits[j]; executeContent(onExitElem); } @@ -149,7 +149,7 @@ void InterpreterRC::exitStates(const Arabica::XPath::NodeSet<std::string>& enabl USCXML_MONITOR_CALLBACK3(afterExitingState, Element<std::string>(statesToExit[i]), (i + 1 < statesToExit.size())) NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", statesToExit[i]); - for (int j = 0; j < invokes.size(); j++) { + for (size_t j = 0; j < invokes.size(); j++) { Element<std::string> invokeElem = (Element<std::string>)invokes[j]; if (HAS_ATTR(invokeElem, "persist") && stringIsTrue(ATTR(invokeElem, "persist"))) { } else { @@ -159,7 +159,7 @@ void InterpreterRC::exitStates(const Arabica::XPath::NodeSet<std::string>& enabl // remove statesToExit[i] from _configuration - test409 tmp.clear(); - for (int j = 0; j < _configuration.size(); j++) { + for (size_t j = 0; j < _configuration.size(); j++) { if (_configuration[j] != statesToExit[i]) { tmp.push_back(_configuration[j]); } @@ -199,7 +199,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterRC::computeExitSet(const Arabica } #if VERBOSE std::cout << "computeExitSet: "; - for (int i = 0; i < statesToExit.size(); i++) { + for (size_t i = 0; i < statesToExit.size(); i++) { std::cout << ATTR_CAST(statesToExit[i], "id") << " "; } std::cout << std::endl; @@ -220,7 +220,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterRC::computeExitSet(const Arabica #if 0 std::cerr << "Exit set for transition '" << transition << "': " << std::endl; - for (int i = 0; i < exitSet.size(); i++) { + for (size_t i = 0; i < exitSet.size(); i++) { std::cerr << ATTR_CAST(exitSet[i], "id") << std::endl << "----" << std::endl; } std::cerr << std::endl; @@ -239,13 +239,13 @@ void InterpreterRC::enterStates(const Arabica::XPath::NodeSet<std::string>& enab #if VERBOSE_STATE_SELECTION std::cout << "enterStates: "; - for (int i = 0; i < statesToEnter.size(); i++) { + for (size_t i = 0; i < statesToEnter.size(); i++) { std::cout << ATTR_CAST(statesToEnter[i], "id") << " "; } std::cout << std::endl; #endif - for (int i = 0; i < statesToEnter.size(); i++) { + for (size_t i = 0; i < statesToEnter.size(); i++) { Element<std::string> s = (Element<std::string>)statesToEnter[i]; USCXML_MONITOR_CALLBACK3(beforeEnteringState, s, i + 1 < statesToEnter.size()) @@ -257,7 +257,7 @@ void InterpreterRC::enterStates(const Arabica::XPath::NodeSet<std::string>& enab NodeSet<std::string> dataModelElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "datamodel", s); if(dataModelElems.size() > 0 && _dataModel) { Arabica::XPath::NodeSet<std::string> dataElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "data", dataModelElems[0]); - for (int j = 0; j < dataElems.size(); j++) { + for (size_t j = 0; j < dataElems.size(); j++) { if (dataElems[j].getNodeType() == Node_base::ELEMENT_NODE) initializeData(Element<std::string>(dataElems[j])); } @@ -290,7 +290,7 @@ void InterpreterRC::enterStates(const Arabica::XPath::NodeSet<std::string>& enab // extension for flattened SCXML documents, we will need an explicit uninvoke element NodeSet<std::string> uninvokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "uninvoke", s); - for (int j = 0; j < uninvokes.size(); j++) { + for (size_t j = 0; j < uninvokes.size(); j++) { Element<std::string> uninvokeElem = (Element<std::string>)uninvokes[j]; cancelInvoke(uninvokeElem); } @@ -322,7 +322,7 @@ void InterpreterRC::enterStates(const Arabica::XPath::NodeSet<std::string>& enab if (isParallel(grandParent)) { Arabica::XPath::NodeSet<std::string> childs = getChildStates(grandParent); bool inFinalState = true; - for (int j = 0; j < childs.size(); j++) { + for (size_t j = 0; j < childs.size(); j++) { if (!isInFinalState(Element<std::string>(childs[j]))) { inFinalState = false; break; @@ -353,23 +353,23 @@ void InterpreterRC::computeEntrySet(const Arabica::XPath::NodeSet<std::string>& std::map<std::string, Arabica::DOM::Node<std::string> >& defaultHistoryContent) { // add all descendants in a dedicated first step - for (int i = 0; i < transitions.size(); i++) { + for (size_t i = 0; i < transitions.size(); i++) { Element<std::string> t(transitions[i]); NodeSet<std::string> targets = getTargetStates(t); - for (int j = 0; j < targets.size(); j++) { + for (size_t j = 0; j < targets.size(); j++) { Element<std::string> s = Element<std::string>(targets[j]); addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry, defaultHistoryContent); } } // only now add the ancestors - for (int i = 0; i < transitions.size(); i++) { + for (size_t i = 0; i < transitions.size(); i++) { Element<std::string> t(transitions[i]); Element<std::string> ancestor = Element<std::string>(getTransitionDomain(t)); NodeSet<std::string> effectiveTargetStates = getEffectiveTargetStates(t); - for (int j = 0; j < effectiveTargetStates.size(); j++) { + for (size_t j = 0; j < effectiveTargetStates.size(); j++) { Element<std::string> s = Element<std::string>(effectiveTargetStates[j]); addAncestorStatesToEnter(s, ancestor, statesToEnter, statesForDefaultEntry, defaultHistoryContent); } @@ -402,7 +402,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterRC::getEffectiveTargetStates(con targets = getTargetStates(transition); } - for (int j = 0; j < targets.size(); j++) { + for (size_t j = 0; j < targets.size(); j++) { Element<std::string> s = Element<std::string>(targets[j]); if (isHistory(s)) { if (_historyValue.find(ATTR(s, "id")) != _historyValue.end()) { @@ -482,7 +482,7 @@ void InterpreterRC::addDescendantStatesToEnter(const Arabica::DOM::Element<std:: std::string stateId = ATTR(state, "id"); if (_historyValue.find(stateId) != _historyValue.end()) { const Arabica::XPath::NodeSet<std::string>& historyValue = _historyValue[stateId]; - for (int i = 0; i < historyValue.size(); i++) { + for (size_t i = 0; i < historyValue.size(); i++) { const Element<std::string>& s = Element<std::string>(historyValue[i]); addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent); addAncestorStatesToEnter(s, getParentState(s), statesToEnter, statesForDefaultEntry, defaultHistoryContent); @@ -496,9 +496,9 @@ void InterpreterRC::addDescendantStatesToEnter(const Arabica::DOM::Element<std:: defaultHistoryContent[ATTR_CAST(getParentState(state), "id")] = transitions[0]; } - for (int i = 0; i < transitions.size(); i++) { + for (size_t i = 0; i < transitions.size(); i++) { NodeSet<std::string> targets = getTargetStates(Element<std::string>(transitions[i])); - for (int j = 0; j < targets.size(); j++) { + for (size_t j = 0; j < targets.size(); j++) { const Element<std::string>& s = Element<std::string>(targets[i]); addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent); addAncestorStatesToEnter(s, getParentState(s), statesToEnter, statesForDefaultEntry, defaultHistoryContent); @@ -532,12 +532,12 @@ void InterpreterRC::addDescendantStatesToEnter(const Arabica::DOM::Element<std:: // test 579 - initial leads to history still fails NodeSet<std::string> targets = getEffectiveTargetStates(Element<std::string>(state)); - for (int i = 0; i < targets.size(); i++) { + for (size_t i = 0; i < targets.size(); i++) { const Element<std::string>& s = Element<std::string>(targets[i]); addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry, defaultHistoryContent); } - for (int i = 0; i < targets.size(); i++) { + for (size_t i = 0; i < targets.size(); i++) { const Element<std::string>& s = Element<std::string>(targets[i]); addAncestorStatesToEnter(s, state, statesToEnter, statesForDefaultEntry, defaultHistoryContent); } @@ -545,10 +545,10 @@ void InterpreterRC::addDescendantStatesToEnter(const Arabica::DOM::Element<std:: } else if(isParallel(state)) { NodeSet<std::string> childStates = getChildStates(state); - for (int i = 0; i < childStates.size(); i++) { + for (size_t i = 0; i < childStates.size(); i++) { const Element<std::string>& child = Element<std::string>(childStates[i]); - for (int j = 0; j < statesToEnter.size(); j++) { + for (size_t j = 0; j < statesToEnter.size(); j++) { const Node<std::string>& s = statesToEnter[j]; if (isDescendant(s, child)) { goto BREAK_LOOP; @@ -585,7 +585,7 @@ void InterpreterRC::addAncestorStatesToEnter(const Arabica::DOM::Element<std::st #endif NodeSet<std::string> ancestors = getProperAncestors(state, ancestor); - for (int i = 0; i < ancestors.size(); i++) { + for (size_t i = 0; i < ancestors.size(); i++) { const Node<std::string>& anc = ancestors[i]; #if VERBOSE_STATE_SELECTION std::cout << getPadding() << "adding: " << ATTR_CAST(anc, "id") << std::endl; @@ -595,9 +595,9 @@ void InterpreterRC::addAncestorStatesToEnter(const Arabica::DOM::Element<std::st if (isParallel(Element<std::string>(anc))) { NodeSet<std::string> childStates = getChildStates(anc); - for (int j = 0; j < childStates.size(); j++) { + for (size_t j = 0; j < childStates.size(); j++) { const Element<std::string>& child = Element<std::string>(childStates[j]); - for (int k = 0; k < statesToEnter.size(); k++) { + for (size_t k = 0; k < statesToEnter.size(); k++) { const Node<std::string>& s = statesToEnter[k]; if (isDescendant(s, child)) { goto BREAK_LOOP; @@ -631,7 +631,7 @@ Arabica::DOM::Node<std::string> InterpreterRC::getTransitionDomain(const Arabica Node<std::string> source = getSourceState(transition); if (iequals(transitionType, "internal") && isCompound(Element<std::string>(source))) { - for (int i = 0; i < tStates.size(); i++) { + for (size_t i = 0; i < tStates.size(); i++) { const Node<std::string>& s = tStates[i]; if (!isDescendant(s, source)) goto BREAK_LOOP; |