diff options
author | Stefan Radomski <sradomski@mintwerk.de> | 2015-12-04 08:00:18 (GMT) |
---|---|---|
committer | Stefan Radomski <sradomski@mintwerk.de> | 2015-12-04 08:00:18 (GMT) |
commit | b8ba0e7c31f397a66f9d509ff20a85b33619475a (patch) | |
tree | 9a5adb4f891cdc29eb80f597510e0cef8ee0a47f /src/uscxml/plugins | |
parent | 57ba362eae6e8209cf560555fd4cc4bb76dbe2a1 (diff) | |
download | uscxml-b8ba0e7c31f397a66f9d509ff20a85b33619475a.zip uscxml-b8ba0e7c31f397a66f9d509ff20a85b33619475a.tar.gz uscxml-b8ba0e7c31f397a66f9d509ff20a85b33619475a.tar.bz2 |
All changes up to my dissertation
Diffstat (limited to 'src/uscxml/plugins')
7 files changed, 46 insertions, 25 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp index 3c0b84b..dc0e281 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp @@ -556,7 +556,7 @@ void JSCDataModel::setForeach(const std::string& item, } bool JSCDataModel::isLocation(const std::string& expr) { - // location needs to be RHS and ++ is only valid for RHS + // location needs to be LHS and ++ is only valid for LHS return isValidSyntax(expr + "++"); } diff --git a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp index 2621c66..2ca2bb3 100644 --- a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp +++ b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp @@ -458,9 +458,9 @@ Data PromelaDataModel::evaluateExpr(void* ast) { case PML_CMPND: return getVariable(node); case PML_STRING: { -// std::string stripped = node->value.substr(1, node->value.size() - 2); -// return Data(stripped, Data::VERBATIM); - return Data(node->value, Data::INTERPRETED); + std::string stripped = node->value.substr(1, node->value.size() - 2); + return Data(stripped, Data::VERBATIM); +// return Data(node->value, Data::INTERPRETED); } case PML_PLUS: return dataToInt(evaluateExpr(*opIter++)) + dataToInt(evaluateExpr(*opIter++)); diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp index 06461aa..8822579 100644 --- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp +++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp @@ -793,7 +793,7 @@ NodeSetVariableResolver::resolveVariable(const std::string& namepaceUri, const std::string& name) const { std::map<std::string, NodeSet<std::string> >::const_iterator n = _variables.find(name); if(n == _variables.end()) { - ERROR_EXECUTION_THROW("No varable named '" + name + "'"); + ERROR_EXECUTION_THROW("No variable named '" + name + "'"); } #if VERBOSE std::cout << std::endl << "Getting " << name << ":" << std::endl; diff --git a/src/uscxml/plugins/element/fetch/FetchElement.cpp b/src/uscxml/plugins/element/fetch/FetchElement.cpp index c042802..595c913 100644 --- a/src/uscxml/plugins/element/fetch/FetchElement.cpp +++ b/src/uscxml/plugins/element/fetch/FetchElement.cpp @@ -81,15 +81,15 @@ void FetchElement::downloadFailed(const URL& url, int errorCode) { } void FetchElement::enterElement(const Arabica::DOM::Element<std::string>& node) { - if (!HAS_ATTR(node, "target") && !HAS_ATTR(node, "targetexpr")) { - LOG(ERROR) << "Fetch element requires target or targetexpr"; + if (!HAS_ATTR(node, "src") && !HAS_ATTR(node, "srcexpr")) { + LOG(ERROR) << "Fetch element requires src or srcexpr"; return; } - if (HAS_ATTR(node, "targetexpr") && !_interpreter->getDataModel()) { - LOG(ERROR) << "Fetch element with targetexpr requires datamodel"; + if (HAS_ATTR(node, "srcexpr") && !_interpreter->getDataModel()) { + LOG(ERROR) << "Fetch element with srcexpr requires datamodel"; return; } - _target = (HAS_ATTR(node, "target") ? ATTR(node, "target") : _interpreter->getDataModel().evalAsString(ATTR(node, "targetexpr"))); + _source = (HAS_ATTR(node, "src") ? ATTR(node, "src") : _interpreter->getDataModel().evalAsString(ATTR(node, "srcexpr"))); if (!HAS_ATTR(node, "callback") && !HAS_ATTR(node, "callbackexpr")) { LOG(ERROR) << "Fetch element requires callback or callbackexpr"; @@ -110,10 +110,10 @@ void FetchElement::enterElement(const Arabica::DOM::Element<std::string>& node) return; } - _targetUrl = URL(_target); + _targetUrl = URL(_source); if (!_targetUrl.isAbsolute()) { if (!_targetUrl.toAbsolute(_interpreter->getBaseURL(node))) { - LOG(ERROR) << "Cannot transform " << _target << " into absolute URL"; + LOG(ERROR) << "Cannot transform " << _source << " into absolute URL"; return; } } diff --git a/src/uscxml/plugins/element/fetch/FetchElement.h b/src/uscxml/plugins/element/fetch/FetchElement.h index e3e5008..3b7628a 100644 --- a/src/uscxml/plugins/element/fetch/FetchElement.h +++ b/src/uscxml/plugins/element/fetch/FetchElement.h @@ -53,7 +53,7 @@ public: protected: URL _targetUrl; - std::string _target; + std::string _source; std::string _callback; std::string _type; }; diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp index 79b1829..d3aa35f 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp @@ -64,7 +64,8 @@ Data USCXMLInvoker::getDataModelVariables() { } void USCXMLInvoker::send(const SendRequest& req) { - _invokedInterpreter.receive(req); + if (_invokedInterpreter) + _invokedInterpreter.receive(req); } void USCXMLInvoker::cancel(const std::string sendId) { @@ -96,6 +97,15 @@ void USCXMLInvoker::invoke(const InvokeRequest& req) { DataModel dataModel(_invokedInterpreter.getImpl()->getDataModel()); _invokedInterpreter.getImpl()->setParentQueue(&_parentQueue); + // copy monitors + std::set<InterpreterMonitor*>::const_iterator monIter = _interpreter->_monitors.begin(); + while(monIter != _interpreter->_monitors.end()) { + if ((*monIter)->copyToInvokers()) { + _invokedInterpreter.getImpl()->_monitors.insert(*monIter); + } + monIter++; + } + // transfer namespace prefixes _invokedInterpreter.setNameSpaceInfo(_parentInterpreter->getNameSpaceInfo()); _invokedInterpreter.getImpl()->_sessionId = req.invokeid; diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp index cf7c8e7..19d109a 100644 --- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp +++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp @@ -123,21 +123,22 @@ bool BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) { * raises. */ - // this will call the const subscript operator -// if (req.data.at("content").hasKey("_scxmleventname")) { -// reqEvent.name = req.data.at("content").at("_scxmleventname").atom; -// } -// if (req.data.at("content").hasKey("content")) { -// reqEvent.content = req.data.at("content").at("content").atom; -// } - + { // if we sent ourself an event it will end up here + // this will call the const subscript operator + if (req.data.at("content").hasKey("_scxmleventname")) { + reqEvent.name = req.data.at("content").at("_scxmleventname").atom; + } + if (req.data.at("content").hasKey("content")) { + reqEvent.content = req.data.at("content").at("content").atom; + } + } + + // if we used wget, it will end up here - unify? if (req.data.hasKey("content")) { const Data& data = req.data["content"]; for(std::map<std::string, Data>::const_iterator compIter = data.compound.begin(); compIter!= data.compound.end(); compIter++) { - if (compIter->first == "_scxmleventname") { - reqEvent.name = compIter->second.atom; - } else if (compIter->first == "content") { + if (compIter->first == "content") { reqEvent.content = compIter->second.atom; } else { reqEvent.data[compIter->first] = compIter->second; @@ -145,6 +146,16 @@ bool BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) { } } + if (req.data.hasKey("header")) { + const Data& data = req.data["header"]; + for(std::map<std::string, Data>::const_iterator compIter = data.compound.begin(); + compIter!= data.compound.end(); compIter++) { + if (compIter->first == "_scxmleventname") { + reqEvent.name = compIter->second.atom; + } + } + } + // check whether we can parse it as XML if (reqEvent.content.length() > 0) { NameSpacingParser parser = NameSpacingParser::fromXML(reqEvent.content); |