summaryrefslogtreecommitdiffstats
path: root/src/uscxml
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml')
-rw-r--r--src/uscxml/CMakeLists.txt1
-rw-r--r--src/uscxml/debug/DebuggerServlet.cpp2
-rw-r--r--src/uscxml/interpreter/BasicContentExecutor.cpp38
-rw-r--r--src/uscxml/interpreter/BasicContentExecutor.h2
-rw-r--r--src/uscxml/interpreter/ContentExecutor.cpp4
-rw-r--r--src/uscxml/interpreter/ContentExecutor.h2
-rw-r--r--src/uscxml/interpreter/ContentExecutorImpl.h2
-rw-r--r--src/uscxml/interpreter/InterpreterImpl.cpp10
-rw-r--r--src/uscxml/interpreter/InterpreterImpl.h8
-rw-r--r--src/uscxml/messages/Data.cpp4
-rw-r--r--src/uscxml/messages/Event.cpp1
-rw-r--r--src/uscxml/plugins/Factory.cpp8
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/null/NullDataModel.cpp1
-rw-r--r--src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp2
-rw-r--r--src/uscxml/transform/ChartToVHDL.cpp4
-rw-r--r--src/uscxml/util/DOM.h2
17 files changed, 51 insertions, 41 deletions
diff --git a/src/uscxml/CMakeLists.txt b/src/uscxml/CMakeLists.txt
index e1881e4..5c8f582 100644
--- a/src/uscxml/CMakeLists.txt
+++ b/src/uscxml/CMakeLists.txt
@@ -56,6 +56,7 @@ list (APPEND USCXML_FILES ${USCXML_SERVER})
file(GLOB USCXML_CORE
${CMAKE_SOURCE_DIR}/contrib/src/jsmn/jsmn.c
${CMAKE_SOURCE_DIR}/contrib/src/evws/evws.c
+ # ${CMAKE_SOURCE_DIR}/contrib/src/uriparser/src/*.c
*.cpp
*.h
)
diff --git a/src/uscxml/debug/DebuggerServlet.cpp b/src/uscxml/debug/DebuggerServlet.cpp
index c3d0f9f..1d2df6e 100644
--- a/src/uscxml/debug/DebuggerServlet.cpp
+++ b/src/uscxml/debug/DebuggerServlet.cpp
@@ -20,6 +20,8 @@
#include "uscxml/debug/DebuggerServlet.h"
#include "uscxml/debug/DebugSession.h"
#include "uscxml/util/UUID.h"
+
+#include <xercesc/dom/DOMDocument.hpp>
#include <boost/algorithm/string.hpp>
namespace uscxml {
diff --git a/src/uscxml/interpreter/BasicContentExecutor.cpp b/src/uscxml/interpreter/BasicContentExecutor.cpp
index a801f35..17dd611 100644
--- a/src/uscxml/interpreter/BasicContentExecutor.cpp
+++ b/src/uscxml/interpreter/BasicContentExecutor.cpp
@@ -235,7 +235,7 @@ void BasicContentExecutor::processIf(XERCESC_NS::DOMElement* content) {
// current block is true
if (blockIsTrue) {
// we do now that the prefix of content is correct
- process(childElem, XML_PREFIX(content));
+ process(childElem);
}
}
}
@@ -266,7 +266,7 @@ void BasicContentExecutor::processForeach(XERCESC_NS::DOMElement* content) {
_callbacks->setForeach(item, array, index, iteration);
for (auto childElem = content->getFirstElementChild(); childElem; childElem = childElem->getNextElementSibling()) {
- process(childElem, XML_PREFIX(content));
+ process(childElem);
}
}
}
@@ -289,18 +289,18 @@ void BasicContentExecutor::processScript(XERCESC_NS::DOMElement* content) {
}
-void BasicContentExecutor::process(XERCESC_NS::DOMElement* block, const X& xmlPrefix) {
+void BasicContentExecutor::process(XERCESC_NS::DOMElement* block) {
std::string tagName = TAGNAME(block);
+ std::string xmlPrefix = XML_PREFIX(block);
-
- if (iequals(tagName, xmlPrefix.str() + "onentry") ||
- iequals(tagName, xmlPrefix.str() + "onexit") ||
- iequals(tagName, xmlPrefix.str() + "transition")) {
+ if (iequals(tagName, xmlPrefix + "onentry") ||
+ iequals(tagName, xmlPrefix + "onexit") ||
+ iequals(tagName, xmlPrefix + "transition")) {
try {
for (auto childElem = block->getFirstElementChild(); childElem; childElem = childElem->getNextElementSibling()) {
// process any child eleents
- process(childElem, xmlPrefix);
+ process(childElem);
}
} catch (Event e) {
// there has been an error in an executable content block
@@ -310,18 +310,18 @@ void BasicContentExecutor::process(XERCESC_NS::DOMElement* block, const X& xmlPr
return;
}
- if (iequals(tagName, xmlPrefix.str() + "finalize")) {
+ if (iequals(tagName, xmlPrefix + "finalize")) {
std::list<DOMNode*> childElems = DOMUtils::filterChildType(DOMNode::ELEMENT_NODE, block, false);
if(childElems.size() > 0) {
for(auto elemIter = childElems.begin(); elemIter != childElems.end(); elemIter++) {
- process(static_cast<DOMElement*>(*elemIter), xmlPrefix);
+ process(static_cast<DOMElement*>(*elemIter));
}
} else {
// issue 67 - empty finalize element
DOMNode* parent = block->getParentNode();
if (parent && parent->getNodeType() == DOMNode::ELEMENT_NODE) {
DOMElement* invokeElem = static_cast<DOMElement*>(parent);
- if (iequals(X(invokeElem->getTagName()).str(), xmlPrefix.str() + "invoke")) {
+ if (iequals(X(invokeElem->getTagName()).str(), xmlPrefix + "invoke")) {
// we are the empth finalize element of an invoke
// Specification 6.5.2: http://www.w3.org/TR/scxml/#N110EF
@@ -347,21 +347,21 @@ void BasicContentExecutor::process(XERCESC_NS::DOMElement* block, const X& xmlPr
USCXML_MONITOR_CALLBACK1(_callbacks->getMonitors(), beforeExecutingContent, block);
if (false) {
- } else if (iequals(tagName, xmlPrefix.str() + "raise")) {
+ } else if (iequals(tagName, xmlPrefix + "raise")) {
processRaise(block);
- } else if (iequals(tagName, xmlPrefix.str() + "send")) {
+ } else if (iequals(tagName, xmlPrefix + "send")) {
processSend(block);
- } else if (iequals(tagName, xmlPrefix.str() + "cancel")) {
+ } else if (iequals(tagName, xmlPrefix + "cancel")) {
processCancel(block);
- } else if (iequals(tagName, xmlPrefix.str() + "if")) {
+ } else if (iequals(tagName, xmlPrefix + "if")) {
processIf(block);
- } else if (iequals(tagName, xmlPrefix.str() + "assign")) {
+ } else if (iequals(tagName, xmlPrefix + "assign")) {
processAssign(block);
- } else if (iequals(tagName, xmlPrefix.str() + "foreach")) {
+ } else if (iequals(tagName, xmlPrefix + "foreach")) {
processForeach(block);
- } else if (iequals(tagName, xmlPrefix.str() + "log")) {
+ } else if (iequals(tagName, xmlPrefix + "log")) {
processLog(block);
- } else if (iequals(tagName, xmlPrefix.str() + "script")) {
+ } else if (iequals(tagName, xmlPrefix + "script")) {
processScript(block);
} else {
LOG(_callbacks->getLogger(), USCXML_ERROR) << tagName;
diff --git a/src/uscxml/interpreter/BasicContentExecutor.h b/src/uscxml/interpreter/BasicContentExecutor.h
index 032da6f..9019b23 100644
--- a/src/uscxml/interpreter/BasicContentExecutor.h
+++ b/src/uscxml/interpreter/BasicContentExecutor.h
@@ -46,7 +46,7 @@ public:
void processLog(XERCESC_NS::DOMElement* content);
void processScript(XERCESC_NS::DOMElement* content);
- virtual void process(XERCESC_NS::DOMElement* block, const X& xmlPrefix);
+ virtual void process(XERCESC_NS::DOMElement* block);
virtual void invoke(XERCESC_NS::DOMElement* invoke);
virtual void uninvoke(XERCESC_NS::DOMElement* invoke);
diff --git a/src/uscxml/interpreter/ContentExecutor.cpp b/src/uscxml/interpreter/ContentExecutor.cpp
index de142a1..4aa6eb4 100644
--- a/src/uscxml/interpreter/ContentExecutor.cpp
+++ b/src/uscxml/interpreter/ContentExecutor.cpp
@@ -23,8 +23,8 @@
namespace uscxml {
-void ContentExecutor::process(XERCESC_NS::DOMElement* block, const X& xmlPrefix) {
- _impl->process(block, xmlPrefix);
+void ContentExecutor::process(XERCESC_NS::DOMElement* block) {
+ _impl->process(block);
}
void ContentExecutor::invoke(XERCESC_NS::DOMElement* invoke) {
diff --git a/src/uscxml/interpreter/ContentExecutor.h b/src/uscxml/interpreter/ContentExecutor.h
index 7a0b125..78fdf94 100644
--- a/src/uscxml/interpreter/ContentExecutor.h
+++ b/src/uscxml/interpreter/ContentExecutor.h
@@ -43,7 +43,7 @@ class USCXML_API ContentExecutor {
public:
PIMPL_OPERATORS(ContentExecutor);
- virtual void process(XERCESC_NS::DOMElement* block, const X& xmlPrefix);
+ virtual void process(XERCESC_NS::DOMElement* block);
virtual void invoke(XERCESC_NS::DOMElement* invoke);
virtual void uninvoke(XERCESC_NS::DOMElement* invoke);
virtual Data elementAsData(XERCESC_NS::DOMElement* element, bool asExpression = false);
diff --git a/src/uscxml/interpreter/ContentExecutorImpl.h b/src/uscxml/interpreter/ContentExecutorImpl.h
index e8c89f9..5f0acfe 100644
--- a/src/uscxml/interpreter/ContentExecutorImpl.h
+++ b/src/uscxml/interpreter/ContentExecutorImpl.h
@@ -89,7 +89,7 @@ public:
virtual std::shared_ptr<ContentExecutorImpl> create(ContentExecutorCallbacks* callbacks) = 0;
- virtual void process(XERCESC_NS::DOMElement* block, const X& xmlPrefix) = 0;
+ virtual void process(XERCESC_NS::DOMElement* block) = 0;
virtual void invoke(XERCESC_NS::DOMElement* invoke) = 0;
virtual void uninvoke(XERCESC_NS::DOMElement* invoke) = 0;
diff --git a/src/uscxml/interpreter/InterpreterImpl.cpp b/src/uscxml/interpreter/InterpreterImpl.cpp
index 1693462..ac6aa41 100644
--- a/src/uscxml/interpreter/InterpreterImpl.cpp
+++ b/src/uscxml/interpreter/InterpreterImpl.cpp
@@ -87,7 +87,7 @@ InterpreterImpl::~InterpreterImpl() {
// make sure we deallocate all user-data in the DOM,
// this is neccesary if we were aborted early
- std::list<DOMElement*> invokes = DOMUtils::filterChildElements(_xmlPrefix.str() + "invoke", _scxml, true);
+ std::list<DOMElement*> invokes = DOMUtils::filterChildElements(_xmlPrefix + "invoke", _scxml, true);
for (auto invoke : invokes) {
char* invokeId = (char*)invoke->getUserData(X("invokeid"));
if (invokeId != NULL) {
@@ -284,9 +284,9 @@ SCXML_STOP_SEARCH:
_scxml = dynamic_cast<XERCESC_NS::DOMElement*>(scxmls->item(0));
- _xmlPrefix = _scxml->getPrefix();
- _xmlNS = _scxml->getNamespaceURI();
- if (_xmlPrefix) {
+ _xmlPrefix = X(_scxml->getPrefix()).str();
+ _xmlNS = X(_scxml->getNamespaceURI()).str();
+ if (_xmlPrefix.size() > 0) {
_xmlPrefix = std::string(_xmlPrefix) + ":";
}
if (HAS_ATTR(_scxml, kXMLCharName)) {
@@ -467,7 +467,7 @@ Event InterpreterImpl::dequeueExternal(size_t blockMs) {
if (_currEvent.invokeid.size() > 0 &&
_invokers.find(_currEvent.invokeid) != _invokers.end() &&
_invokers[_currEvent.invokeid].getFinalize() != NULL) {
- _execContent.process(_invokers[_currEvent.invokeid].getFinalize(), _xmlPrefix);
+ _execContent.process(_invokers[_currEvent.invokeid].getFinalize());
}
for (auto invIter = _invokers.begin(); invIter != _invokers.end(); invIter++) {
diff --git a/src/uscxml/interpreter/InterpreterImpl.h b/src/uscxml/interpreter/InterpreterImpl.h
index 5b73939..8e8b810 100644
--- a/src/uscxml/interpreter/InterpreterImpl.h
+++ b/src/uscxml/interpreter/InterpreterImpl.h
@@ -37,7 +37,7 @@
#include "uscxml/interpreter/ContentExecutorImpl.h"
#include "uscxml/interpreter/EventQueue.h"
#include "uscxml/interpreter/EventQueueImpl.h"
-#include "uscxml/util/DOM.h"
+//#include "uscxml/util/DOM.h"
namespace uscxml {
@@ -109,7 +109,7 @@ public:
}
virtual void process(XERCESC_NS::DOMElement* block) {
- _execContent.process(block, _xmlPrefix);
+ _execContent.process(block);
}
virtual bool isMatched(const Event& event, const std::string& eventDesc);
@@ -290,8 +290,8 @@ protected:
friend class DebugSession;
friend class Debugger;
- X _xmlPrefix;
- X _xmlNS;
+ std::string _xmlPrefix;
+ std::string _xmlNS;
Factory* _factory;
URL _baseURL;
diff --git a/src/uscxml/messages/Data.cpp b/src/uscxml/messages/Data.cpp
index 8853b19..51e1191 100644
--- a/src/uscxml/messages/Data.cpp
+++ b/src/uscxml/messages/Data.cpp
@@ -22,7 +22,9 @@
#include <boost/algorithm/string.hpp>
+#ifndef NO_XERCESC
#include "uscxml/util/DOM.h"
+#endif
#include "uscxml/interpreter/Logging.h"
@@ -262,6 +264,7 @@ std::string Data::toJSON(const Data& data) {
} else {
os << data.atom;
}
+#ifndef NO_XERCESC
} else if (data.node) {
std::ostringstream xmlSerSS;
xmlSerSS << *data.node;
@@ -270,6 +273,7 @@ std::string Data::toJSON(const Data& data) {
// boost::replace_all(xmlSer, "\n", "\\n");
// boost::replace_all(xmlSer, "\t", "\\t");
os << "\"" << jsonEscape(xmlSer) << "\"";
+#endif
} else {
if (data.type == Data::VERBATIM) {
os << "\"\""; // empty string
diff --git a/src/uscxml/messages/Event.cpp b/src/uscxml/messages/Event.cpp
index f667e92..f657ddb 100644
--- a/src/uscxml/messages/Event.cpp
+++ b/src/uscxml/messages/Event.cpp
@@ -18,7 +18,6 @@
*/
#include "uscxml/messages/Event.h"
-#include "uscxml/util/DOM.h"
namespace uscxml {
diff --git a/src/uscxml/plugins/Factory.cpp b/src/uscxml/plugins/Factory.cpp
index 5b767b6..6ca599c 100644
--- a/src/uscxml/plugins/Factory.cpp
+++ b/src/uscxml/plugins/Factory.cpp
@@ -33,10 +33,11 @@
#include "uscxml/plugins/InvokerImpl.h"
#include "uscxml/plugins/DataModelImpl.h"
+#if 0
#include <xercesc/dom/DOM.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "uscxml/util/DOM.h"
-
+#endif
// see http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system
@@ -538,13 +539,14 @@ size_t DataModelImpl::replaceExpressions(std::string& content) {
Factory* Factory::getInstance() {
- // this needs to be here as some plugins use xercesc
+#if 0
+ // this needs to be here as some plugins use xercesc, now in X::X in DOM.h
try {
::xercesc_3_1::XMLPlatformUtils::Initialize();
} catch (const XERCESC_NS::XMLException& toCatch) {
ERROR_PLATFORM_THROW("Cannot initialize XercesC: " + X(toCatch.getMessage()).str());
}
-
+#endif
if (_instance == NULL) {
_instance = new Factory(Factory::_defaultPluginPath);
}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
index 9eaa8c5..684604f 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
@@ -27,7 +27,6 @@
#include "uscxml/util/String.h"
#include "V8DataModel.h"
-//#include "V8SCXMLEvent.h"
#include "uscxml/messages/Event.h"
#include "uscxml/util/DOM.h"
diff --git a/src/uscxml/plugins/datamodel/null/NullDataModel.cpp b/src/uscxml/plugins/datamodel/null/NullDataModel.cpp
index efa77fa..cf608f5 100644
--- a/src/uscxml/plugins/datamodel/null/NullDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/null/NullDataModel.cpp
@@ -21,7 +21,6 @@
#include "uscxml/Common.h"
#include "NullDataModel.h"
-#include "uscxml/util/DOM.h"
#ifdef BUILD_AS_PLUGINS
#include <Pluma/Connector.hpp>
diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
index d3bc5bf..783727a 100644
--- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
+++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
@@ -18,6 +18,8 @@
*/
#include "USCXMLInvoker.h"
+#include "uscxml/util/DOM.h"
+
#ifdef BUILD_AS_PLUGINS
#include <Pluma/Connector.hpp>
diff --git a/src/uscxml/transform/ChartToVHDL.cpp b/src/uscxml/transform/ChartToVHDL.cpp
index 810d823..47ebf1c 100644
--- a/src/uscxml/transform/ChartToVHDL.cpp
+++ b/src/uscxml/transform/ChartToVHDL.cpp
@@ -1523,6 +1523,8 @@ void ChartToVHDL::writeOptimalTransitionSetSelection(std::ostream &stream) {
}
}
+ LOGD(USCXML_WARN) << ATTR(transition, X("postFixOrder"));
+
VBranch *tree = (VASSIGN,
VLINE("in_optimal_transition_set_" + ATTR(transition, X("postFixOrder")) + "_sig"),
(VAND,
@@ -1536,7 +1538,7 @@ void ChartToVHDL::writeOptimalTransitionSetSelection(std::ostream &stream) {
"_i"))
: (VNOP, VLINE("'1'")),
- VLINE("state_active_" + ATTR(transition, kXMLCharSource) + "_sig"),
+ VLINE("state_active_" + ATTR(transition, X("source")) + "_sig"),
nameMatchers,
(VNOT, conflicters)));
diff --git a/src/uscxml/util/DOM.h b/src/uscxml/util/DOM.h
index b26abc3..74133e8 100644
--- a/src/uscxml/util/DOM.h
+++ b/src/uscxml/util/DOM.h
@@ -201,7 +201,7 @@ public :
return _localForm;
}
- operator XMLCh* () const {
+ operator XMLCh* () const {
assert(_unicodeForm != NULL); // constructor with XMLCh
return _unicodeForm;
}