summaryrefslogtreecommitdiffstats
path: root/src/uscxml
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-03 01:10:03 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-03 01:10:03 (GMT)
commitb542369263782dc8b85893e218119ed070efa7b3 (patch)
tree0a18012a0af991755ceab98a457b46b79c14129f /src/uscxml
parent193a01614dc3290eec51745a91be65c166c3763b (diff)
downloaduscxml-b542369263782dc8b85893e218119ed070efa7b3.zip
uscxml-b542369263782dc8b85893e218119ed070efa7b3.tar.gz
uscxml-b542369263782dc8b85893e218119ed070efa7b3.tar.bz2
Got ready for cmake3 and some minor fixes
Diffstat (limited to 'src/uscxml')
-rw-r--r--src/uscxml/Factory.cpp2
-rw-r--r--src/uscxml/Interpreter.cpp25
-rw-r--r--src/uscxml/Interpreter.h2
-rw-r--r--src/uscxml/interpreter/InterpreterDraft6.cpp6
-rw-r--r--src/uscxml/messages/SendRequest.h2
-rw-r--r--src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp2
6 files changed, 20 insertions, 19 deletions
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp
index 22482e6..0f3e8c9 100644
--- a/src/uscxml/Factory.cpp
+++ b/src/uscxml/Factory.cpp
@@ -672,7 +672,7 @@ void EventHandlerImpl::returnEvent(Event& event, bool external) {
event.origin = "#_" + _invokeId;
if (event.origintype.length() == 0)
event.origintype = _type;
-
+
if (external) {
_interpreter->receive(event);
} else {
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 47a6182..5b0db2d 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -97,15 +97,15 @@
#define VALID_FROM_FINISHED(newState) ( \
newState == USCXML_DESTROYED || \
newState == USCXML_INSTANTIATED \
-)
+)
/// macro to catch exceptions in executeContent
#define CATCH_AND_DISTRIBUTE(msg) \
catch (Event e) {\
- LOG(ERROR) << msg << std::endl << e << std::endl;\
if (rethrow) {\
throw(e);\
} else {\
+ LOG(ERROR) << msg << std::endl << e << std::endl;\
e.name = "error.execution";\
e.data.compound["cause"] = uscxml::Data(msg, uscxml::Data::VERBATIM); \
e.eventType = Event::PLATFORM;\
@@ -116,10 +116,10 @@ catch (Event e) {\
#define CATCH_AND_DISTRIBUTE2(msg, node) \
catch (Event e) {\
std::string xpathPos = DOMUtils::xPathForNode(node); \
- LOG(ERROR) << msg << " " << xpathPos << ":" << std::endl << e << std::endl;\
if (rethrow) {\
throw(e);\
} else {\
+ LOG(ERROR) << msg << " " << xpathPos << ":" << std::endl << e << std::endl;\
e.name = "error.execution";\
e.data.compound["cause"] = uscxml::Data(msg, uscxml::Data::VERBATIM); \
e.data.compound["xpath"] = uscxml::Data(xpathPos, uscxml::Data::VERBATIM); \
@@ -684,7 +684,7 @@ void InterpreterImpl::reset() {
_topLevelFinalReached = false;
_isInitialized = false;
_stable = false;
-
+
setInterpreterState(USCXML_INSTANTIATED);
}
@@ -1162,15 +1162,16 @@ void InterpreterImpl::send(const Arabica::DOM::Node<std::string>& element) {
try {
// namelist
if (HAS_ATTR(element, "namelist")) {
- if (_dataModel) {
- std::list<std::string> names = tokenizeIdRefs(ATTR(element, "namelist"));
- for (std::list<std::string>::const_iterator nameIter = names.begin(); nameIter != names.end(); nameIter++) {
- Data namelistValue = _dataModel.getStringAsData(*nameIter);
- sendReq.namelist[*nameIter] = namelistValue;
- sendReq.data.compound[*nameIter] = namelistValue;
+ std::list<std::string> names = tokenizeIdRefs(ATTR(element, "namelist"));
+ for (std::list<std::string>::const_iterator nameIter = names.begin(); nameIter != names.end(); nameIter++) {
+ if (!_dataModel.isDeclared(*nameIter)) {
+ LOG(ERROR) << "Error in send element " << DOMUtils::xPathForNode(element) << " namelist:" << std::endl << "'" << *nameIter << "' is not declared" << std::endl;
+ ERROR_EXECUTION2(err, "Location expression '" + *nameIter + "' in namelist is invalid", element);
+ return;
}
- } else {
- LOG(ERROR) << "Namelist attribute at send requires datamodel to be defined";
+ Data namelistValue = _dataModel.getStringAsData(*nameIter);
+ sendReq.namelist[*nameIter] = namelistValue;
+ sendReq.data.compound[*nameIter] = namelistValue;
}
}
} catch (Event e) {
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index cf281b5..2ad1039 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -51,7 +51,7 @@
e.name = "error.platform"; \
e.data.compound["cause"] = Data(msg, Data::VERBATIM); \
throw e; \
-
+
#define USCXML_MONITOR_CATCH(callback) \
catch (Event e) { \
diff --git a/src/uscxml/interpreter/InterpreterDraft6.cpp b/src/uscxml/interpreter/InterpreterDraft6.cpp
index 048adf9..fdbd21b 100644
--- a/src/uscxml/interpreter/InterpreterDraft6.cpp
+++ b/src/uscxml/interpreter/InterpreterDraft6.cpp
@@ -151,7 +151,7 @@ InterpreterState InterpreterDraft6::step(int waitForMS = 0) {
}
_stable = true;
}
-
+
// test415
if (_topLevelFinalReached)
goto EXIT_INTERPRETER;
@@ -185,7 +185,7 @@ InterpreterState InterpreterDraft6::step(int waitForMS = 0) {
if (_state != USCXML_MACROSTEPPED && _state != USCXML_IDLE)
USCXML_MONITOR_CALLBACK(onStableConfiguration)
- setInterpreterState(USCXML_MACROSTEPPED);
+ setInterpreterState(USCXML_MACROSTEPPED);
if (_topLevelFinalReached)
goto EXIT_INTERPRETER;
@@ -232,7 +232,7 @@ InterpreterState InterpreterDraft6::step(int waitForMS = 0) {
_currEvent = _externalQueue.pop();
_currEvent.eventType = Event::EXTERNAL; // make sure it is set to external
_stable = false;
-
+
if (_topLevelFinalReached)
goto EXIT_INTERPRETER;
diff --git a/src/uscxml/messages/SendRequest.h b/src/uscxml/messages/SendRequest.h
index 6bc3d91..f43b856 100644
--- a/src/uscxml/messages/SendRequest.h
+++ b/src/uscxml/messages/SendRequest.h
@@ -26,7 +26,7 @@ namespace uscxml {
class USCXML_API SendRequest : public Event {
public:
- SendRequest() {}
+ SendRequest() : delayMs(0) {}
SendRequest(Event event) : Event(event) {}
std::string getTarget() {
diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
index 5800f98..3b28547 100644
--- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
@@ -663,7 +663,7 @@ void XPathDataModel::assign(const NodeSet<std::string>& key,
// addattribute: Add an attribute with the name specified by 'attr'
// and value specified by 'expr' to the node specified by 'location'.
if (!HAS_ATTR(assignElem, "attr"))
- ERROR_EXECUTION_THROW("Assign element is missing 'attr'")
+ ERROR_EXECUTION_THROW("Assign element is missing 'attr'");
element.setAttribute(ATTR(assignElem, "attr"), value);
} else {
/// test 547