summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins
diff options
context:
space:
mode:
authorStefan Radomski <sradomski@mintwerk.de>2016-01-10 02:39:24 (GMT)
committerStefan Radomski <sradomski@mintwerk.de>2016-01-10 02:39:24 (GMT)
commitc699a4057a65a9a09f78310d8e12588f2dc072cd (patch)
tree4525cd9418975a954e9a1c32faa6d5d8821fe499 /src/uscxml/plugins
parent9f4d810400550d1b98ab944cd96f937720eb6b0d (diff)
downloaduscxml-c699a4057a65a9a09f78310d8e12588f2dc072cd.zip
uscxml-c699a4057a65a9a09f78310d8e12588f2dc072cd.tar.gz
uscxml-c699a4057a65a9a09f78310d8e12588f2dc072cd.tar.bz2
Builds with MSVC again
Diffstat (limited to 'src/uscxml/plugins')
-rw-r--r--src/uscxml/plugins/DataModel.h36
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp29
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp1
-rw-r--r--src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp1
4 files changed, 33 insertions, 34 deletions
diff --git a/src/uscxml/plugins/DataModel.h b/src/uscxml/plugins/DataModel.h
index 097fcfd..74277c8 100644
--- a/src/uscxml/plugins/DataModel.h
+++ b/src/uscxml/plugins/DataModel.h
@@ -26,6 +26,9 @@
#ifdef BUILD_PROFILING
#include "uscxml/concurrency/Timer.h"
+#define TIME_BLOCK Measurement msm(&timer);
+#else
+#define TIME_BLOCK (0);
#endif
#include <list>
@@ -107,10 +110,6 @@ public:
return "";
}
-#ifdef BUILD_PROFILING
- Timer timer;
-#endif
-
protected:
InterpreterInfo* _interpreter;
};
@@ -141,96 +140,123 @@ public:
}
virtual std::list<std::string> getNames() {
- return _impl->getNames();
+ TIME_BLOCK
+ return _impl->getNames();
}
virtual bool validate(const std::string& location, const std::string& schema) {
+ TIME_BLOCK
return _impl->validate(location, schema);
}
virtual bool isLocation(const std::string& expr) {
+ TIME_BLOCK
return _impl->isLocation(expr);
}
virtual bool isValidSyntax(const std::string& expr) {
+ TIME_BLOCK
return _impl->isValidSyntax(expr);
}
virtual void setEvent(const Event& event) {
+ TIME_BLOCK
return _impl->setEvent(event);
}
virtual Data getStringAsData(const std::string& content) {
+ TIME_BLOCK
return _impl->getStringAsData(content);
}
virtual void pushContext() {
+ TIME_BLOCK
return _impl->pushContext();
}
virtual void popContext() {
+ TIME_BLOCK
return _impl->popContext();
}
virtual void eval(const Arabica::DOM::Element<std::string>& scriptElem,
const std::string& expr) {
+ TIME_BLOCK
return _impl->eval(scriptElem, expr);
}
virtual std::string evalAsString(const std::string& expr) {
+ TIME_BLOCK
return _impl->evalAsString(expr);
}
virtual bool evalAsBool(const std::string& expr) {
+ TIME_BLOCK
return _impl->evalAsBool(expr);
}
virtual bool evalAsBool(const Arabica::DOM::Element<std::string>& scriptNode,
const std::string& expr) {
+ TIME_BLOCK
return _impl->evalAsBool(scriptNode, expr);
}
virtual uint32_t getLength(const std::string& expr) {
+ TIME_BLOCK
return _impl->getLength(expr);
}
virtual void setForeach(const std::string& item,
const std::string& array,
const std::string& index,
uint32_t iteration) {
+ TIME_BLOCK
return _impl->setForeach(item, array, index, iteration);
}
virtual void assign(const Arabica::DOM::Element<std::string>& assignElem,
const Arabica::DOM::Node<std::string>& node,
const std::string& content) {
+ TIME_BLOCK
return _impl->assign(assignElem, node, content);
}
virtual void assign(const std::string& location, const Data& data) {
+ TIME_BLOCK
return _impl->assign(location, data);
}
virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
const Arabica::DOM::Node<std::string>& node,
const std::string& content) {
+ TIME_BLOCK
return _impl->init(dataElem, node, content);
}
virtual void init(const std::string& location, const Data& data) {
+ TIME_BLOCK
return _impl->init(location, data);
}
virtual bool isDeclared(const std::string& expr) {
+ TIME_BLOCK
return _impl->isDeclared(expr);
}
size_t replaceExpressions(std::string& content) {
+ TIME_BLOCK
return _impl->replaceExpressions(content);
}
std::string andExpressions(std::list<std::string> expressions) {
+ TIME_BLOCK
return _impl->andExpressions(expressions);
}
virtual void setInterpreter(InterpreterInfo* interpreter) {
+ TIME_BLOCK
_impl->setInterpreter(interpreter);
}
virtual void addExtension(DataModelExtension* ext) {
+ TIME_BLOCK
_impl->addExtension(ext);
}
+#ifdef BUILD_PROFILING
+ Timer timer;
+#endif
+
protected:
boost::shared_ptr<DataModelImpl> _impl;
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
index 9a71ab0..40b6cc2 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
@@ -44,12 +44,6 @@
#include "uscxml/DOMUtils.h"
#include <glog/logging.h>
-#ifdef BUILD_PROFILING
-#define TIME_BLOCK Measurement msm(&timer);
-#else
-#define TIME_BLOCK (0);
-#endif
-
#ifdef BUILD_AS_PLUGINS
#include <Pluma/Connector.hpp>
#endif
@@ -93,7 +87,6 @@ JSCDataModel::~JSCDataModel() {
}
void JSCDataModel::addExtension(DataModelExtension* ext) {
- TIME_BLOCK
if (_extensions.find(ext) != _extensions.end())
return;
@@ -199,7 +192,6 @@ JSClassDefinition JSCDataModel::jsInvokersClassDef = { 0, 0, "invokers", 0, 0, 0
boost::shared_ptr<DataModelImpl> JSCDataModel::create(InterpreterInfo* interpreter) {
boost::shared_ptr<JSCDataModel> dm = boost::shared_ptr<JSCDataModel>(new JSCDataModel());
- TIME_BLOCK
dm->_ctx = JSGlobalContextCreate(NULL);
dm->_interpreter = interpreter;
@@ -284,7 +276,6 @@ void JSCDataModel::popContext() {
}
void JSCDataModel::setEvent(const Event& event) {
- TIME_BLOCK
JSCSCXMLEvent::JSCSCXMLEventPrivate* privData = new JSCSCXMLEvent::JSCSCXMLEventPrivate();
privData->nativeObj = new Event(event);
privData->dom = _dom;
@@ -367,14 +358,12 @@ void JSCDataModel::setEvent(const Event& event) {
}
Data JSCDataModel::getStringAsData(const std::string& content) {
- TIME_BLOCK
JSValueRef result = evalAsValue(content);
Data data = getValueAsData(result);
return data;
}
JSValueRef JSCDataModel::getDataAsValue(const Data& data) {
- TIME_BLOCK
JSValueRef exception = NULL;
if (data.node) {
@@ -440,7 +429,6 @@ JSValueRef JSCDataModel::getDataAsValue(const Data& data) {
}
Data JSCDataModel::getValueAsData(const JSValueRef value) {
- TIME_BLOCK
Data data;
JSValueRef exception = NULL;
switch(JSValueGetType(_ctx, value)) {
@@ -529,12 +517,10 @@ Data JSCDataModel::getValueAsData(const JSValueRef value) {
}
bool JSCDataModel::validate(const std::string& location, const std::string& schema) {
- TIME_BLOCK
return true;
}
uint32_t JSCDataModel::getLength(const std::string& expr) {
- TIME_BLOCK
JSValueRef result;
result = evalAsValue("(" + expr + ").length");
@@ -555,7 +541,6 @@ void JSCDataModel::setForeach(const std::string& item,
const std::string& array,
const std::string& index,
uint32_t iteration) {
- TIME_BLOCK
if (!isDeclared(item)) {
assign(item, Data());
}
@@ -572,13 +557,11 @@ void JSCDataModel::setForeach(const std::string& item,
}
bool JSCDataModel::isLocation(const std::string& expr) {
- TIME_BLOCK
// location needs to be LHS and ++ is only valid for LHS
return isValidSyntax(expr + "++");
}
bool JSCDataModel::isValidSyntax(const std::string& expr) {
- TIME_BLOCK
JSStringRef scriptJS = JSStringCreateWithUTF8CString(expr.c_str());
JSValueRef exception = NULL;
bool valid = JSCheckScriptSyntax(_ctx, scriptJS, NULL, 0, &exception);
@@ -591,7 +574,6 @@ bool JSCDataModel::isValidSyntax(const std::string& expr) {
}
bool JSCDataModel::isDeclared(const std::string& expr) {
- TIME_BLOCK
JSStringRef scriptJS = JSStringCreateWithUTF8CString(expr.c_str());
JSValueRef exception = NULL;
JSValueRef result = JSEvaluateScript(_ctx, scriptJS, NULL, NULL, 0, &exception);
@@ -605,18 +587,15 @@ bool JSCDataModel::isDeclared(const std::string& expr) {
void JSCDataModel::eval(const Element<std::string>& scriptElem,
const std::string& expr) {
- TIME_BLOCK
evalAsValue(expr);
}
bool JSCDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr) {
- TIME_BLOCK
JSValueRef result = evalAsValue(expr);
return JSValueToBoolean(_ctx, result);
}
std::string JSCDataModel::evalAsString(const std::string& expr) {
- TIME_BLOCK
JSValueRef result = evalAsValue(expr);
JSValueRef exception = NULL;
@@ -635,7 +614,6 @@ std::string JSCDataModel::evalAsString(const std::string& expr) {
}
JSValueRef JSCDataModel::evalAsValue(const std::string& expr, bool dontThrow) {
- TIME_BLOCK
JSStringRef scriptJS = JSStringCreateWithUTF8CString(expr.c_str());
JSValueRef exception = NULL;
JSValueRef result = JSEvaluateScript(_ctx, scriptJS, NULL, NULL, 0, &exception);
@@ -650,7 +628,6 @@ JSValueRef JSCDataModel::evalAsValue(const std::string& expr, bool dontThrow) {
void JSCDataModel::assign(const Element<std::string>& assignElem,
const Node<std::string>& node,
const std::string& content) {
- TIME_BLOCK
std::string key;
JSValueRef exception = NULL;
if (HAS_ATTR(assignElem, "id")) {
@@ -693,7 +670,6 @@ void JSCDataModel::assign(const Element<std::string>& assignElem,
}
JSValueRef JSCDataModel::getNodeAsValue(const Node<std::string>& node) {
- TIME_BLOCK
switch (node.getNodeType()) {
case Node_base::ELEMENT_NODE: {
TO_JSC_DOMVALUE(Element);
@@ -714,7 +690,6 @@ JSValueRef JSCDataModel::getNodeAsValue(const Node<std::string>& node) {
}
void JSCDataModel::assign(const std::string& location, const Data& data) {
- TIME_BLOCK
std::stringstream ssJSON;
ssJSON << data;
evalAsValue(location + " = " + ssJSON.str());
@@ -723,7 +698,6 @@ void JSCDataModel::assign(const std::string& location, const Data& data) {
void JSCDataModel::init(const Element<std::string>& dataElem,
const Node<std::string>& node,
const std::string& content) {
- TIME_BLOCK
try {
assign(dataElem, node, content);
} catch (Event e) {
@@ -740,7 +714,6 @@ void JSCDataModel::init(const Element<std::string>& dataElem,
}
void JSCDataModel::init(const std::string& location, const Data& data) {
- TIME_BLOCK
try {
assign(location, data);
} catch (Event e) {
@@ -751,8 +724,6 @@ void JSCDataModel::init(const std::string& location, const Data& data) {
}
std::string JSCDataModel::andExpressions(std::list<std::string> expressions) {
- TIME_BLOCK
-
if (expressions.size() == 0)
return "";
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
index 19d109a..b1fb141 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
@@ -34,6 +34,7 @@
#include <boost/algorithm/string.hpp>
#ifdef _WIN32
+#define NOMINMAX
#include <winsock2.h>
#include <windows.h>
#endif
diff --git a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp
index 9ba3e63..6905e22 100644
--- a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp
@@ -20,6 +20,7 @@
#include <boost/algorithm/string.hpp>
#ifdef _WIN32
+#define NOMINMAX
#include <winsock2.h>
#include <windows.h>
#endif