diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-05-15 19:55:13 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-05-15 19:55:13 (GMT) |
commit | f9a620340ddce2a17fd775d1e210268cac13377b (patch) | |
tree | 58d8dad794e5a34237c2738fe77c151d0810624f /src/uscxml/plugins | |
parent | 49127140ed2ad91bfcf532b3d2265582cb80b0db (diff) | |
download | uscxml-f9a620340ddce2a17fd775d1e210268cac13377b.zip uscxml-f9a620340ddce2a17fd775d1e210268cac13377b.tar.gz uscxml-f9a620340ddce2a17fd775d1e210268cac13377b.tar.bz2 |
Introduced interpreter.step()
Diffstat (limited to 'src/uscxml/plugins')
6 files changed, 12 insertions, 11 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp index 3130d42..a064394 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp @@ -230,7 +230,7 @@ void JSCDataModel::setEvent(const Event& event) { handleException(exception); } else { JSStringRef propName = JSStringCreateWithUTF8CString("data"); - JSStringRef contentStr = JSStringCreateWithUTF8CString(Interpreter::spaceNormalize(event.content).c_str()); + JSStringRef contentStr = JSStringCreateWithUTF8CString(InterpreterImpl::spaceNormalize(event.content).c_str()); JSObjectSetProperty(_ctx, eventObj, propName, JSValueMakeString(_ctx, contentStr), 0, &exception); JSStringRelease(propName); JSStringRelease(contentStr); @@ -566,7 +566,7 @@ void JSCDataModel::assign(const Element<std::string>& assignElem, try { evalAsValue(key + " = " + content); } catch (...) { - evalAsValue(key + " = " + "\"" + Interpreter::spaceNormalize(content) + "\""); + evalAsValue(key + " = " + "\"" + InterpreterImpl::spaceNormalize(content) + "\""); } } else { JSObjectSetProperty(_ctx, JSContextGetGlobalObject(_ctx), JSStringCreateWithUTF8CString(key.c_str()), JSValueMakeUndefined(_ctx), 0, &exception); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp index bddea83..ec9557e 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp @@ -236,7 +236,7 @@ void V8DataModel::setEvent(const Event& event) { if (json) { eventObj->Set(v8::String::New("data"), getDataAsValue(json)); } else { - eventObj->Set(v8::String::New("data"), v8::String::New(Interpreter::spaceNormalize(event.content).c_str())); + eventObj->Set(v8::String::New("data"), v8::String::New(InterpreterImpl::spaceNormalize(event.content).c_str())); } } else { // _event.data is KVP @@ -603,7 +603,7 @@ void V8DataModel::assign(const Element<std::string>& assignElem, try { evalAsValue(key + " = " + content); } catch (...) { - evalAsValue(key + " = " + "\"" + Interpreter::spaceNormalize(content) + "\""); + evalAsValue(key + " = " + "\"" + InterpreterImpl::spaceNormalize(content) + "\""); } } else { global->Set(v8::String::New(key.c_str()), v8::Undefined()); diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp index 0ad6030..4cbe8f5 100644 --- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp @@ -275,7 +275,7 @@ void SWIDataModel::setEvent(const Event& event) { dataInitStr << "load_xml_file('" << domUrl.asLocalFile(".pl") << "', XML), copy_term(XML,DATA), assert(event(data(DATA)))"; PlCall(dataInitStr.str().c_str()); } else if (event.content.size() > 0) { - PlCall("assert", PlCompound("event", PlCompound("data", PlString(Interpreter::spaceNormalize(event.content).c_str())))); + PlCall("assert", PlCompound("event", PlCompound("data", PlString(InterpreterImpl::spaceNormalize(event.content).c_str())))); } else if (event.data) { assertFromData(event.data, "event(data(", 2); } diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp index bf32bf9..4d9854b 100644 --- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp +++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp @@ -195,7 +195,7 @@ void XPathDataModel::setEvent(const Event& event) { } if (event.content.size() > 0) { - Text<std::string> textNode = _doc.createTextNode(Interpreter::spaceNormalize(event.content).c_str()); + Text<std::string> textNode = _doc.createTextNode(InterpreterImpl::spaceNormalize(event.content).c_str()); eventDataElem.appendChild(textNode); } if (event.dom) { @@ -501,7 +501,7 @@ void XPathDataModel::assign(const Element<std::string>& assignElem, } assign(key, nodeSet, assignElem); } else if (content.length() > 0) { - Text<std::string> textNode = _doc.createTextNode(Interpreter::spaceNormalize(content)); + Text<std::string> textNode = _doc.createTextNode(InterpreterImpl::spaceNormalize(content)); nodeSet.push_back(textNode); assign(key, nodeSet, assignElem); } else if (HAS_ATTR(assignElem, "expr")) { diff --git a/src/uscxml/plugins/element/respond/RespondElement.cpp b/src/uscxml/plugins/element/respond/RespondElement.cpp index f415b19..4fe0d2e 100644 --- a/src/uscxml/plugins/element/respond/RespondElement.cpp +++ b/src/uscxml/plugins/element/respond/RespondElement.cpp @@ -78,7 +78,7 @@ void RespondElement::enterElement(const Arabica::DOM::Node<std::string>& node) { httpReply.status = strTo<int>(statusStr);; // extract the content - Arabica::XPath::NodeSet<std::string> contents = Interpreter::filterChildElements(_interpreter->getXMLPrefixForNS(getNamespace()) + "content", node); + Arabica::XPath::NodeSet<std::string> contents = InterpreterImpl::filterChildElements(_interpreter->getXMLPrefixForNS(getNamespace()) + "content", node); if (contents.size() > 0) { if (HAS_ATTR(contents[0], "expr")) { // -- content is evaluated string from datamodel ------ if (_interpreter->getDataModel()) { @@ -141,7 +141,7 @@ void RespondElement::enterElement(const Arabica::DOM::Node<std::string>& node) { } // process headers - Arabica::XPath::NodeSet<std::string> headers = Interpreter::filterChildElements(_interpreter->getXMLPrefixForNS(getNamespace()) + "header", node); + Arabica::XPath::NodeSet<std::string> headers = InterpreterImpl::filterChildElements(_interpreter->getXMLPrefixForNS(getNamespace()) + "header", node); for (int i = 0; i < headers.size(); i++) { std::string name; if (HAS_ATTR(headers[i], "name")) { diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp index d89d8ac..f232e52 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp @@ -43,7 +43,8 @@ USCXMLInvoker::~USCXMLInvoker() { _cancelled = true; Event event; event.name = "unblock.and.die"; - _invokedInterpreter.receive(event); + if (_invokedInterpreter) + _invokedInterpreter.receive(event); }; boost::shared_ptr<InvokerImpl> USCXMLInvoker::create(InterpreterImpl* interpreter) { @@ -84,6 +85,7 @@ void USCXMLInvoker::invoke(const InvokeRequest& req) { if (_invokedInterpreter) { DataModel dataModel(_invokedInterpreter.getImpl()->getDataModel()); _invokedInterpreter.getImpl()->setParentQueue(&_parentQueue); + // transfer namespace prefixes _invokedInterpreter.setNameSpaceInfo(_parentInterpreter->getNameSpaceInfo()); _invokedInterpreter.getImpl()->_sessionId = req.invokeid; @@ -92,7 +94,6 @@ void USCXMLInvoker::invoke(const InvokeRequest& req) { _invokedInterpreter.getImpl()->setInvokeRequest(req); _invokedInterpreter.start(); -// tthread::this_thread::sleep_for(tthread::chrono::seconds(1)); } else { /// test 530 _parentInterpreter->receive(Event("done.invoke." + _invokeId, Event::PLATFORM)); |