summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/datamodel
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-31 23:58:37 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-31 23:58:37 (GMT)
commitc912952fb5e8072770262c64932c1d8cf2027cf0 (patch)
treed21ae1340c96f9fe1105f9cdaa62d84342f58cd9 /src/uscxml/plugins/datamodel
parentf64620e28a55dbddaeeefef2e7b8a6a433f21c82 (diff)
downloaduscxml-c912952fb5e8072770262c64932c1d8cf2027cf0.zip
uscxml-c912952fb5e8072770262c64932c1d8cf2027cf0.tar.gz
uscxml-c912952fb5e8072770262c64932c1d8cf2027cf0.tar.bz2
Various bug-fixes for W3C test conformance and stack traces with exceptions and segfaults
Diffstat (limited to 'src/uscxml/plugins/datamodel')
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp8
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h5
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp4
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h1
4 files changed, 16 insertions, 2 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
index 4072862..0663db4 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
@@ -285,6 +285,14 @@ void V8DataModel::eval(const std::string& expr) {
evalAsValue(expr);
}
+bool V8DataModel::isDefined(const std::string& expr) {
+ v8::Locker locker;
+ v8::HandleScope handleScope;
+ v8::Context::Scope contextScope(_contexts.back());
+ v8::Handle<v8::Value> result = evalAsValue(expr);
+ return !result->IsUndefined();
+}
+
bool V8DataModel::evalAsBool(const std::string& expr) {
v8::Locker locker;
v8::HandleScope handleScope;
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
index 6d4ca63..a9db5ca 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
@@ -38,7 +38,7 @@ public:
virtual void registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor);
virtual bool validate(const std::string& location, const std::string& schema);
-
+
virtual uint32_t getLength(const std::string& expr);
virtual void pushContext();
virtual void popContext();
@@ -49,7 +49,8 @@ public:
virtual Data getStringAsData(const std::string& content);
virtual Data getValueAsData(const v8::Handle<v8::Value>& value);
-
+ virtual bool isDefined(const std::string& expr);
+
virtual std::string evalAsString(const std::string& expr);
virtual bool evalAsBool(const std::string& expr);
virtual double evalAsNumber(const std::string& expr);
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
index fe881dc..c9d2237 100644
--- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
@@ -142,4 +142,8 @@ void SWIDataModel::assign(const std::string& location, const std::string& expr)
eval(expr);
}
+bool SWIDataModel::isDefined(const std::string& expr) {
+ return true;
+}
+
} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h
index 63300dd..52d1e34 100644
--- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h
+++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h
@@ -39,6 +39,7 @@ public:
virtual void eval(const std::string& expr);
virtual void assign(const std::string& location, const std::string& expr);
virtual void assign(const std::string& location, const Data& data);
+ virtual bool isDefined(const std::string& expr);
virtual Data getStringAsData(const std::string& content);