summaryrefslogtreecommitdiffstats
path: root/src/uscxml
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-02 18:42:17 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-02 18:42:17 (GMT)
commitf627a8a8b139a42568f67dc18679d92806e0ff4e (patch)
tree0ef345134ce775c6fca5ec35d2b6eecddbf3450e /src/uscxml
parentf19be97dea6fd8da994392d6fa7de5b3f0d9bf3e (diff)
downloaduscxml-f627a8a8b139a42568f67dc18679d92806e0ff4e.zip
uscxml-f627a8a8b139a42568f67dc18679d92806e0ff4e.tar.gz
uscxml-f627a8a8b139a42568f67dc18679d92806e0ff4e.tar.bz2
More bug-fixes for W3C tests
Diffstat (limited to 'src/uscxml')
-rw-r--r--src/uscxml/Factory.cpp4
-rw-r--r--src/uscxml/Factory.h7
-rw-r--r--src/uscxml/Interpreter.cpp51
-rw-r--r--src/uscxml/Interpreter.h8
-rw-r--r--src/uscxml/Message.h2
-rw-r--r--src/uscxml/interpreter/InterpreterDraft6.cpp13
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp59
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h13
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp.old59
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp.old24
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h.old87
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp.old23
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h.old161
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp.old60
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h.old41
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp7
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h4
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEventCustom.cpp27
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp.old30
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h.old75
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp2
-rw-r--r--src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp8
-rw-r--r--src/uscxml/server/InterpreterServlet.cpp18
-rw-r--r--src/uscxml/server/InterpreterServlet.h18
24 files changed, 171 insertions, 630 deletions
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp
index 46974f2..41a3b5a 100644
--- a/src/uscxml/Factory.cpp
+++ b/src/uscxml/Factory.cpp
@@ -169,6 +169,10 @@ Factory::Factory() {
registerIOProcessor(ioProcessor);
}
{
+ InterpreterServlet* ioProcessor = new InterpreterServlet();
+ registerIOProcessor(ioProcessor);
+ }
+ {
FetchElement* element = new FetchElement();
registerExecutableContent(element);
}
diff --git a/src/uscxml/Factory.h b/src/uscxml/Factory.h
index e257e45..65dc5fd 100644
--- a/src/uscxml/Factory.h
+++ b/src/uscxml/Factory.h
@@ -183,6 +183,7 @@ public:
protected:
boost::shared_ptr<IOProcessorImpl> _impl;
+ friend class Interpreter;
};
class InvokerImpl : public IOProcessorImpl {
@@ -234,8 +235,6 @@ public:
virtual void setEvent(const Event& event) = 0;
virtual Data getStringAsData(const std::string& content) = 0;
- virtual void registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor) = 0;
-
// foreach
virtual uint32_t getLength(const std::string& expr) = 0;
virtual void pushContext() = 0;
@@ -296,10 +295,6 @@ public:
return _impl->popContext();
}
- virtual void registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor) {
- _impl->registerIOProcessor(name, ioprocessor);
- }
-
virtual void eval(const std::string& expr) {
return _impl->eval(expr);
}
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 366b6d6..6caeb76 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -209,8 +209,8 @@ Interpreter::~Interpreter() {
}
if (_sendQueue)
delete _sendQueue;
- if (_httpServlet)
- delete _httpServlet;
+// if (_httpServlet)
+// delete _httpServlet;
}
void Interpreter::start() {
@@ -269,8 +269,8 @@ void Interpreter::init() {
normalize(_scxml);
- if (_capabilities & CAN_GENERIC_HTTP)
- _httpServlet = new InterpreterServlet(this);
+// if (_capabilities & CAN_GENERIC_HTTP)
+// _httpServlet = new InterpreterServlet(this);
_sendQueue = new DelayedEventQueue();
_sendQueue->start();
@@ -464,9 +464,11 @@ void Interpreter::processContentElement(const Arabica::DOM::Node<std::string>& c
LOG(ERROR) << "content element does not specify any content.";
}
}
-
+
void Interpreter::send(const Arabica::DOM::Node<std::string>& element) {
SendRequest sendReq;
+ // test 331
+ sendReq.Event::type = Event::EXTERNAL;
try {
// event
if (HAS_ATTR(element, "eventexpr") && _dataModel) {
@@ -516,7 +518,7 @@ void Interpreter::send(const Arabica::DOM::Node<std::string>& element) {
* details. The SCXML processor may generate all other ids in any format,
* as long as they are unique.
*/
-
+
/**
*
* If 'idlocation' is present, the SCXML Processor must generate an id when
@@ -666,8 +668,8 @@ void Interpreter::delayedSend(void* userdata, std::string eventName) {
LOG(ERROR) << "Can not send to invoked component '" << invokeId << "', no such invokeId" << std::endl;
}
} else if (sendReq.target.length() == 0 &&
- (sendReq.type.length() == 0 ||
- boost::equals(sendReq.type, "http://www.w3.org/TR/scxml/#SCXMLEventProcessor"))) {
+ (sendReq.type.length() == 0 ||
+ boost::equals(sendReq.type, "http://www.w3.org/TR/scxml/#SCXMLEventProcessor"))) {
/**
* If neither the 'target' nor the 'targetexpr' attribute is specified, the
* SCXML Processor must add the event will be added to the external event
@@ -675,7 +677,9 @@ void Interpreter::delayedSend(void* userdata, std::string eventName) {
*/
INSTANCE->_externalQueue.push(sendReq);
} else {
- IOProcessor ioProc = INSTANCE->getIOProcessor(sendReq.type);
+ IOProcessor ioProc;
+ if (sendReq.type.length() > 0)
+ IOProcessor ioProc = INSTANCE->getIOProcessor(sendReq.type);
if (ioProc) {
try {
ioProc.send(sendReq);
@@ -683,7 +687,11 @@ void Interpreter::delayedSend(void* userdata, std::string eventName) {
LOG(ERROR) << "Exception caught while sending event to ioprocessor " << sendReq.type;
}
} else {
- INSTANCE->_internalQueue.push_back(Event("error.execution"));
+ Event exceptionEvent;
+ exceptionEvent.name = "error.execution";
+ exceptionEvent.type = Event::PLATFORM;
+ exceptionEvent.sendid = sendReq.sendid;
+ INSTANCE->_internalQueue.push_back(exceptionEvent);
}
}
assert(INSTANCE->_sendIds.find(sendReq.sendid) != INSTANCE->_sendIds.end());
@@ -692,7 +700,7 @@ void Interpreter::delayedSend(void* userdata, std::string eventName) {
void Interpreter::invoke(const Arabica::DOM::Node<std::string>& element) {
InvokeRequest invokeReq;
-
+ invokeReq.Event::type = Event::EXTERNAL;
try {
// type
if (HAS_ATTR(element, "typeexpr") && _dataModel) {
@@ -1052,9 +1060,9 @@ void Interpreter::executeContent(const Arabica::DOM::Node<std::string>& content,
if (_dataModel && HAS_ATTR(content, "location") && HAS_ATTR(content, "expr")) {
try {
if (!_dataModel.isDeclared(ATTR(content, "location"))) {
- // test 286
+ // test 286, 331
LOG(ERROR) << "Assigning to undeclared location '" << ATTR(content, "location") << "' not allowed." << std::endl;
- Event e("error.execution");
+ Event e("error.execution", Event::PLATFORM);
_internalQueue.push_back(e);
throw e;
return;
@@ -1234,7 +1242,7 @@ bool Interpreter::hasAncestorElement(const Arabica::DOM::Node<std::string>& node
Arabica::DOM::Node<std::string> parent = node.getParentNode();
while(parent) {
if (parent.getNodeType() == Node_base::ELEMENT_NODE &&
- boost::iequals(TAGNAME(parent), tagName)) {
+ boost::iequals(TAGNAME(parent), tagName)) {
return true;
}
parent = parent.getParentNode();
@@ -1556,14 +1564,13 @@ bool Interpreter::isPseudoState(const Arabica::DOM::Node<std::string>& state) {
}
bool Interpreter::isTransitionTarget(const Arabica::DOM::Node<std::string>& elem) {
- return (isState(elem) || boost::iequals(LOCALNAME(elem), "history")); // TODO: history is a state
+ return (isState(elem) || boost::iequals(LOCALNAME(elem), "history"));
}
bool Interpreter::isAtomic(const Arabica::DOM::Node<std::string>& state) {
if (boost::iequals("final", LOCALNAME(state)))
return true;
- // I will assume that parallel states are not meant to be atomic.
if (boost::iequals("parallel", LOCALNAME(state)))
return false;
@@ -1613,11 +1620,20 @@ void Interpreter::setupIOProcessors() {
ioProcIter++;
continue;
}
+ if (boost::iequals(ioProcIter->first, "http") && !(_capabilities & CAN_GENERIC_HTTP)) {
+ ioProcIter++;
+ continue;
+ }
_ioProcessors[ioProcIter->first] = Factory::createIOProcessor(ioProcIter->first, this);
_ioProcessors[ioProcIter->first].setType(ioProcIter->first);
_ioProcessors[ioProcIter->first].setInterpreter(this);
+ if (boost::iequals(ioProcIter->first, "http")) {
+ // this is somewhat ugly
+ _httpServlet = static_cast<InterpreterServlet*>(_ioProcessors[ioProcIter->first]._impl.get());
+ }
+
// register aliases
std::set<std::string> names = _ioProcessors[ioProcIter->first].getNames();
std::set<std::string>::iterator nameIter = names.begin();
@@ -1626,7 +1642,7 @@ void Interpreter::setupIOProcessors() {
_ioProcessors[*nameIter] = _ioProcessors[ioProcIter->first];
nameIter++;
}
-
+#if 0
if (_dataModel) {
try {
_dataModel.registerIOProcessor(ioProcIter->first, _ioProcessors[ioProcIter->first]);
@@ -1636,6 +1652,7 @@ void Interpreter::setupIOProcessors() {
} else {
LOG(INFO) << "Not registering " << ioProcIter->first << " at _ioprocessors in datamodel, no datamodel specified";
}
+#endif
ioProcIter++;
}
}
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index b48080a..0eac6fb 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -200,6 +200,10 @@ public:
return _sessionId;
}
+ const std::map<std::string, IOProcessor>& getIOProcessors() {
+ return _ioProcessors;
+ }
+
bool runOnMainThread(int fps, bool blocking = true);
static bool isMember(const Arabica::DOM::Node<std::string>& node, const Arabica::XPath::NodeSet<std::string>& set);
@@ -263,7 +267,7 @@ protected:
Arabica::XPath::NodeSet<std::string> _statesToInvoke;
std::vector<std::string> _userDefinedStartConfiguration;
InvokeRequest _invokeReq;
-
+
DataModel _dataModel;
std::map<std::string, Arabica::XPath::NodeSet<std::string> > _historyValue;
@@ -283,7 +287,7 @@ protected:
void executeContent(const Arabica::XPath::NodeSet<std::string>& content, bool rethrow = false);
void processContentElement(const Arabica::DOM::Node<std::string>& element, Arabica::DOM::Document<std::string>& dom, std::string& text);
-
+
void send(const Arabica::DOM::Node<std::string>& element);
void invoke(const Arabica::DOM::Node<std::string>& element);
void cancelInvoke(const Arabica::DOM::Node<std::string>& element);
diff --git a/src/uscxml/Message.h b/src/uscxml/Message.h
index eed9836..cb7196a 100644
--- a/src/uscxml/Message.h
+++ b/src/uscxml/Message.h
@@ -95,7 +95,7 @@ public:
};
Event() : type(INTERNAL) {}
- Event(const std::string& name) : name(name), type(INTERNAL) {}
+ Event(const std::string& name, Type type = INTERNAL) : name(name), type(type) {}
Event(const Arabica::DOM::Node<std::string>& xmlString) : type(INTERNAL) {};
bool operator< (const Event& other) const {
return this < &other;
diff --git a/src/uscxml/interpreter/InterpreterDraft6.cpp b/src/uscxml/interpreter/InterpreterDraft6.cpp
index b53ba4e..82785e8 100644
--- a/src/uscxml/interpreter/InterpreterDraft6.cpp
+++ b/src/uscxml/interpreter/InterpreterDraft6.cpp
@@ -33,11 +33,6 @@ void InterpreterDraft6::interpret() {
if (_dataModel) {
_dataModel.assign("_x.args", _cmdLineOptions);
- if (_httpServlet) {
- Data data;
- data.compound["location"] = Data(_httpServlet->getURL(), Data::VERBATIM);
- _dataModel.assign("_ioprocessors['http']", data);
- }
}
setupIOProcessors();
@@ -127,7 +122,7 @@ void InterpreterDraft6::initializeData(const Arabica::DOM::Node<std::string>& da
LOG(ERROR) << "Cannot initialize data when no datamodel is given!";
return;
}
-
+
if (!HAS_ATTR(data, "id")) {
LOG(ERROR) << "Data element has no id!";
return;
@@ -185,7 +180,7 @@ void InterpreterDraft6::initializeData(const Arabica::DOM::Node<std::string>& da
} catch (Event e) {
LOG(ERROR) << "Syntax error in data element:" << std::endl << e << std::endl;
- }
+ }
}
void InterpreterDraft6::mainEventLoop() {
@@ -337,7 +332,7 @@ void InterpreterDraft6::mainEventLoop() {
if (!enabledTransitions.empty())
microstep(enabledTransitions);
}
-
+
EXIT_INTERPRETER:
monIter = _monitors.begin();
while(monIter != _monitors.end()) {
@@ -359,7 +354,7 @@ EXIT_INTERPRETER:
sendIter++;
}
}
-
+
monIter = _monitors.begin();
while(monIter != _monitors.end()) {
try {
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
index affd641..c24e3ec 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
@@ -57,9 +57,19 @@ boost::shared_ptr<DataModelImpl> V8DataModel::create(Interpreter* interpreter) {
docObj->SetInternalField(0, Arabica::DOM::V8DOM::toExternal(privData));
context->Global()->Set(v8::String::New("document"), docObj);
- context->Global()->Set(v8::String::New("_sessionid"), v8::String::New(interpreter->getSessionId().c_str()), v8::ReadOnly);
- context->Global()->Set(v8::String::New("_name"), v8::String::New(interpreter->getName().c_str()), v8::ReadOnly);
- context->Global()->Set(v8::String::New("_ioprocessors"), v8::Object::New(), v8::ReadOnly);
+
+ context->Global()->SetAccessor(v8::String::New("_sessionid"),
+ V8DataModel::getAttribute,
+ V8DataModel::setWithException,
+ v8::String::New(interpreter->getSessionId().c_str()));
+ context->Global()->SetAccessor(v8::String::New("_name"),
+ V8DataModel::getAttribute,
+ V8DataModel::setWithException,
+ v8::String::New(interpreter->getName().c_str()));
+ context->Global()->SetAccessor(v8::String::New("_ioprocessors"),
+ V8DataModel::getIOProcessors,
+ V8DataModel::setWithException,
+ v8::External::New(reinterpret_cast<void*>(dm.get())));
dm->_contexts.push_back(context);
@@ -70,13 +80,31 @@ boost::shared_ptr<DataModelImpl> V8DataModel::create(Interpreter* interpreter) {
return dm;
}
-void V8DataModel::registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor) {
- v8::Locker locker;
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(_contexts.front());
- v8::Handle<v8::Object> global = _contexts.front()->Global();
- v8::Handle<v8::Object> ioProcessors = global->Get(v8::String::New("_ioprocessors"))->ToObject();
- ioProcessors->Set(v8::String::New(name.c_str()),getDataAsValue(ioprocessor.getDataModelVariables()));
+v8::Handle<v8::Value> V8DataModel::getAttribute(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ return info.Data();
+}
+
+void V8DataModel::setWithException(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::String::AsciiValue data(property);
+ std::string msg = "Cannot set " + std::string(*data);
+ v8::ThrowException(v8::Exception::ReferenceError(v8::String::New(msg.c_str())));
+}
+
+v8::Handle<v8::Value> V8DataModel::getIOProcessors(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ V8DataModel* dataModel = Arabica::DOM::V8DOM::toClassPtr<V8DataModel>(info.Data());
+
+ if (dataModel->_ioProcessors.IsEmpty()) {
+ dataModel->_ioProcessors = v8::Persistent<v8::Object>::New(v8::Object::New());
+ //v8::Handle<v8::Object> ioProcessorObj = v8::Object::New();
+ std::map<std::string, IOProcessor> ioProcessors = dataModel->_interpreter->getIOProcessors();
+ std::map<std::string, IOProcessor>::const_iterator ioProcIter = ioProcessors.begin();
+ while(ioProcIter != ioProcessors.end()) {
+ dataModel->_ioProcessors->Set(v8::String::New(ioProcIter->first.c_str()),
+ dataModel->getDataAsValue(ioProcIter->second.getDataModelVariables()));
+ ioProcIter++;
+ }
+ }
+ return dataModel->_ioProcessors;
}
V8DataModel::~V8DataModel() {
@@ -281,10 +309,10 @@ void V8DataModel::eval(const std::string& expr) {
bool V8DataModel::isDeclared(const std::string& expr) {
/**
- * Undeclared variables can be checked by trying to access them and catching
+ * Undeclared variables can be checked by trying to access them and catching
* a reference error.
*/
-
+
v8::Locker locker;
v8::HandleScope handleScope;
v8::Context::Scope contextScope(_contexts.back());
@@ -292,14 +320,14 @@ bool V8DataModel::isDeclared(const std::string& expr) {
v8::TryCatch tryCatch;
v8::Handle<v8::String> source = v8::String::New(expr.c_str());
v8::Handle<v8::Script> script = v8::Script::Compile(source);
-
+
v8::Handle<v8::Value> result;
if (!script.IsEmpty())
result = script->Run();
-
+
if (result.IsEmpty())
return false;
-
+
return true;
}
@@ -374,6 +402,7 @@ void V8DataModel::throwExceptionEvent(const v8::TryCatch& tryCatch) {
assert(tryCatch.HasCaught());
Event exceptionEvent;
exceptionEvent.name = "error.execution";
+ exceptionEvent.type = Event::PLATFORM;
std::string exceptionString(*v8::String::AsciiValue(tryCatch.Exception()));
exceptionEvent.data.compound["exception"] = Data(exceptionString, Data::VERBATIM);;
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
index 441297d..6348cbc 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
@@ -33,10 +33,8 @@ public:
virtual void initialize();
virtual void setEvent(const Event& event);
- 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();
@@ -48,7 +46,7 @@ public:
virtual Data getStringAsData(const std::string& content);
virtual Data getValueAsData(const v8::Handle<v8::Value>& value);
virtual bool isDeclared(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);
@@ -61,8 +59,13 @@ protected:
Arabica::DOM::V8DOM* _dom;
+ v8::Persistent<v8::Object> _ioProcessors;
+ static v8::Handle<v8::Value> getIOProcessors(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> getAttribute(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void setWithException(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+
v8::Handle<v8::Value> evalAsValue(const std::string& expr);
- virtual v8::Handle<v8::Value> getDataAsValue(const Data& data);
+ v8::Handle<v8::Value> getDataAsValue(const Data& data);
void throwExceptionEvent(const v8::TryCatch& tryCatch);
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp.old
deleted file mode 100644
index 31372ed..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp.old
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "V8Document.h"
-#include "V8Element.h"
-#include "V8XPathResult.h"
-
-namespace uscxml {
-
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
-
-v8::Persistent<v8::FunctionTemplate> V8Document::Tmpl;
-
-v8::Handle<v8::Value> V8Document::createElementCallback(const v8::Arguments& args) {
- ASSERT_ARGS1(args, IsString);
- v8::String::AsciiValue tagName(args[0]);
-
- v8::Local<v8::Object> self = args.Holder();
- Document<std::string>* doc = V8DOM::toClassPtr<Document<std::string> >(self->GetInternalField(0));
- V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
-
- Element<std::string>* element = new Element<std::string>(doc->createElement(*tagName));
-
- v8::Handle<v8::Function> elemCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> elemObj = v8::Persistent<v8::Object>::New(elemCtor->NewInstance());
-
- elemObj->SetInternalField(0, V8DOM::toExternal(element));
- elemObj->SetInternalField(1, self->GetInternalField(1));
-
- elemObj.MakeWeak(0, V8Element::jsDestructor);
- return elemObj;
-}
-
-v8::Handle<v8::Value> V8Document::evaluateCallback(const v8::Arguments& args) {
- ASSERT_ARGS1(args, IsString);
- v8::String::AsciiValue xpathExpr(args[0]);
-
- v8::Local<v8::Object> self = args.Holder();
- Document<std::string>* doc = V8DOM::toClassPtr<Document<std::string> >(self->GetInternalField(0));
- V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
-
- Node<std::string>* context;
- if (args.Length() > 1) {
- context = V8DOM::toClassPtr<Node<std::string> >(args[1]->ToObject()->GetInternalField(0));
- } else {
- context = doc;
- }
-
- XPathValue<std::string>* xpathValue = new XPathValue<std::string>(dom->xpath->evaluate(*xpathExpr, *context));
-
- v8::Handle<v8::Function> xpathResultCtor = V8XPathResult::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> xpathResultObj = v8::Persistent<v8::Object>::New(xpathResultCtor->NewInstance());
-
- xpathResultObj->SetInternalField(0, V8DOM::toExternal(xpathValue));
- xpathResultObj->SetInternalField(1, self->GetInternalField(1));
-
- xpathResultObj.MakeWeak(0, V8XPathResult::jsDestructor);
- return xpathResultObj;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp.old
deleted file mode 100644
index 14b2eae..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp.old
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "V8Element.h"
-#include <DOM/Element.hpp>
-
-namespace uscxml {
-
-using namespace Arabica::DOM;
-
-v8::Persistent<v8::FunctionTemplate> V8Element::Tmpl;
-
-v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) {
- ASSERT_ARGS2(args, IsString, IsString);
- v8::String::AsciiValue key(args[0]);
- v8::String::AsciiValue value(args[1]);
-
- v8::Local<v8::Object> self = args.Holder();
- Element<std::string>* elem = V8DOM::toClassPtr<Element<std::string> >(self->GetInternalField(0));
- V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
-
- elem->setAttribute(*key, *value);
-
- return v8::Undefined();
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h.old
deleted file mode 100644
index f610108..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h.old
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef V8ELEMENT_H_B55C09NB
-#define V8ELEMENT_H_B55C09NB
-
-#include "V8DOM.h"
-#include "V8Node.h"
-
-namespace uscxml {
-
- class V8Element {
- public:
- static v8::Handle<v8::Value> tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
-
- static v8::Handle<v8::Value> getAttributeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> setAttributeCallback(const v8::Arguments& args);
- static v8::Handle<v8::Value> removeAttributeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getAttributeNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> setAttributeNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> removeAttributeNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> setAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> removeAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getAttributeNodeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> setAttributeNodeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> hasAttributeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> hasAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
-
- V8_DESTRUCTOR(Arabica::DOM::Element<std::string>);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Element"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(2);
-
- instance->SetAccessor(v8::String::NewSymbol("tagName"), V8Element::tagNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("getAttribute"),
- v8::FunctionTemplate::New(V8Element::getAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttribute"),
- v8::FunctionTemplate::New(V8Element::setAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttribute"),
- v8::FunctionTemplate::New(V8Element::removeAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNode"),
- v8::FunctionTemplate::New(V8Element::getAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNode"),
- v8::FunctionTemplate::New(V8Element::setAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttributeNode"),
- v8::FunctionTemplate::New(V8Element::removeAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
- v8::FunctionTemplate::New(V8Element::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNS"),
- v8::FunctionTemplate::New(V8Element::getAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNS"),
- v8::FunctionTemplate::New(V8Element::setAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttributeNS"),
- v8::FunctionTemplate::New(V8Element::removeAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
- v8::FunctionTemplate::New(V8Element::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNodeNS"),
- v8::FunctionTemplate::New(V8Element::getAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNodeNS"),
- v8::FunctionTemplate::New(V8Element::setAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttribute"),
- v8::FunctionTemplate::New(V8Element::hasAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttributeNS"),
- v8::FunctionTemplate::New(V8Element::hasAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
- };
-
-}
-
-
-#endif /* end of include guard: V8ELEMENT_H_B55C09NB */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp.old
deleted file mode 100644
index 97a8c1a..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp.old
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "V8Node.h"
-#include <DOM/Node.hpp>
-
-namespace uscxml {
-
-using namespace Arabica::DOM;
-
-v8::Persistent<v8::FunctionTemplate> V8Node::Tmpl;
-
-v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) {
- assert(args.Length() == 1);
- assert(args[0]->IsObject());
-
- v8::Local<v8::Object> self = args.Holder();
-
- Node<std::string>* node = V8DOM::toClassPtr<Node<std::string> >(self->GetInternalField(0));
- Node<std::string>* childToAppend = V8DOM::toClassPtr<Node<std::string> >(args[0]->ToObject()->GetInternalField(0));
- node->appendChild(*childToAppend);
-
- return v8::Undefined();
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h.old
deleted file mode 100644
index 7048ab5..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h.old
+++ /dev/null
@@ -1,161 +0,0 @@
-#ifndef V8NODE_H_9VGQMJNI
-#define V8NODE_H_9VGQMJNI
-
-#include "V8DOM.h"
-
-namespace uscxml {
-
- class V8Node {
- public:
- static v8::Handle<v8::Value> nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> attributesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> baseURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> textContentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> parentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
-
- static void nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { }
- static void prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { }
- static void textContentAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { }
-
- static v8::Handle<v8::Value> insertBeforeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> replaceChildCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> removeChildCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> appendChildCallback(const v8::Arguments& args);
- static v8::Handle<v8::Value> hasChildNodesCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> cloneNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> normalizeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> isSupportedCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> hasAttributesCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> lookupPrefixCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> isDefaultNamespaceCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> lookupNamespaceURICallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
-
- V8_DESTRUCTOR(Arabica::DOM::Node<std::string>);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Node"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(2);
-
- instance->SetAccessor(v8::String::NewSymbol("nodeName"), V8Node::nodeNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nodeValue"), V8Node::nodeValueAttrGetter, V8Node::nodeValueAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nodeType"), V8Node::nodeTypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("parentNode"), V8Node::parentNodeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("childNodes"), V8Node::childNodesAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("firstChild"), V8Node::firstChildAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("lastChild"), V8Node::lastChildAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("previousSibling"), V8Node::previousSiblingAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nextSibling"), V8Node::nextSiblingAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("attributes"), V8Node::attributesAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("ownerDocument"), V8Node::ownerDocumentAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("namespaceURI"), V8Node::namespaceURIAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("prefix"), V8Node::prefixAttrGetter, V8Node::prefixAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("localName"), V8Node::localNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("baseURI"), V8Node::baseURIAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("textContent"), V8Node::textContentAttrGetter, V8Node::textContentAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("parentElement"), V8Node::parentElementAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("insertBefore"),
- v8::FunctionTemplate::New(V8Node::insertBeforeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("replaceChild"),
- v8::FunctionTemplate::New(V8Node::replaceChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeChild"),
- v8::FunctionTemplate::New(V8Node::removeChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("appendChild"),
- v8::FunctionTemplate::New(V8Node::appendChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasChildNodes"),
- v8::FunctionTemplate::New(V8Node::hasChildNodesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("cloneNode"),
- v8::FunctionTemplate::New(V8Node::cloneNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("normalize"),
- v8::FunctionTemplate::New(V8Node::normalizeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("isSupported"),
- v8::FunctionTemplate::New(V8Node::isSupportedCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttributes"),
- v8::FunctionTemplate::New(V8Node::hasAttributesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("lookupPrefix"),
- v8::FunctionTemplate::New(V8Node::lookupPrefixCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("isDefaultNamespace"),
- v8::FunctionTemplate::New(V8Node::isDefaultNamespaceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("lookupNamespaceURI"),
- v8::FunctionTemplate::New(V8Node::lookupNamespaceURICallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("addEventListener"),
- v8::FunctionTemplate::New(V8Node::addEventListenerCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeEventListener"),
- v8::FunctionTemplate::New(V8Node::removeEventListenerCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ELEMENT_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ELEMENT_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ATTRIBUTE_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ATTRIBUTE_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::TEXT_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::TEXT_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::CDATA_SECTION_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::CDATA_SECTION_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ENTITY_REFERENCE_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ENTITY_REFERENCE_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ENTITY_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ENTITY_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::PROCESSING_INSTRUCTION_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::PROCESSING_INSTRUCTION_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::COMMENT_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::COMMENT_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_TYPE_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_TYPE_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_FRAGMENT_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_FRAGMENT_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::NOTATION_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::NOTATION_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("MAX_TYPE"), v8::Integer::New(Arabica::DOM::Node_base::MAX_TYPE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("MAX_TYPE"), v8::Integer::New(Arabica::DOM::Node_base::MAX_TYPE), v8::ReadOnly);
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
- };
-
-}
-
-
-#endif /* end of include guard: V8NODE_H_9VGQMJNI */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp.old
deleted file mode 100644
index cadcf7f..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp.old
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "V8NodeSet.h"
-#include "V8Element.h"
-#include "V8Node.h"
-#include <DOM/Node.hpp>
-
-namespace uscxml {
-
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
-
-v8::Persistent<v8::FunctionTemplate> V8NodeSet::Tmpl;
-
-
-v8::Handle<v8::Value> V8NodeSet::indexGetter(uint32_t index, const v8::AccessorInfo &info) {
- v8::Local<v8::Object> self = info.Holder();
-
- NodeSet<std::string>* nodeSet = V8DOM::toClassPtr<NodeSet<std::string> >(self->GetInternalField(0));
- V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
-
- if (nodeSet->size() >= index) {
- switch((*nodeSet)[index].getNodeType()) {
- case Node_base::ELEMENT_NODE: {
- v8::Handle<v8::Function> elementCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> elementObj = v8::Persistent<v8::Object>::New(elementCtor->NewInstance());
-
- Element<std::string>* element = new Element<std::string>((*nodeSet)[index]);
-
- elementObj->SetInternalField(0, V8DOM::toExternal(element));
- elementObj->SetInternalField(1, self->GetInternalField(1));
- elementObj.MakeWeak(0, V8Element::jsDestructor);
- return elementObj;
- }
- default: {
- v8::Handle<v8::Function> nodeCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> nodeObj = v8::Persistent<v8::Object>::New(nodeCtor->NewInstance());
-
- Node<std::string>* node = new Node<std::string>((*nodeSet)[index]);
-
- nodeObj->SetInternalField(0, V8DOM::toExternal(node));
- nodeObj->SetInternalField(1, self->GetInternalField(1));
- nodeObj.MakeWeak(0, V8Node::jsDestructor);
- return nodeObj;
-
- }
- }
- }
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8NodeSet::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
-
- V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
- NodeSet<std::string>* nodeSet = V8DOM::toClassPtr<NodeSet<std::string> >(self->GetInternalField(1));
-
- return v8::Integer::New(nodeSet->size());
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h.old
deleted file mode 100644
index cb95a5d..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h.old
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef V8NODESET_HPP_WKKXJ1RD
-#define V8NODESET_HPP_WKKXJ1RD
-
-#include "V8DOM.h"
-
-namespace uscxml {
-
- class V8NodeSet {
- public:
- static v8::Handle<v8::Value> indexGetter(uint32_t index, const v8::AccessorInfo &info);
- static v8::Handle<v8::Value> indexSetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- V8_DESTRUCTOR(Arabica::XPath::NodeSet<std::string>);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("NodeSet"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- // v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(2);
-
- instance->SetIndexedPropertyHandler(V8NodeSet::indexGetter, V8NodeSet::indexSetter);
-
- instance->SetAccessor(v8::String::NewSymbol("length"), V8NodeSet::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
- };
-
-}
-
-#endif /* end of include guard: V8NODESET_HPP_WKKXJ1RD */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
index ed6133a..fec2a94 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
@@ -7,13 +7,6 @@ namespace DOM {
v8::Persistent<v8::FunctionTemplate> V8SCXMLEvent::Tmpl;
-v8::Handle<v8::Value> V8SCXMLEvent::typeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->type);
-}
-
v8::Handle<v8::Value> V8SCXMLEvent::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
v8::Local<v8::Object> self = info.Holder();
struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
index 62495cf..f17856a 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
@@ -41,7 +41,7 @@ public:
static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> typeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> typeCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
static v8::Handle<v8::Value> originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
static v8::Handle<v8::Value> origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
@@ -62,7 +62,7 @@ public:
instance->SetInternalFieldCount(1);
- instance->SetAccessor(v8::String::NewSymbol("type"), V8SCXMLEvent::typeAttrGetter, 0,
+ instance->SetAccessor(v8::String::NewSymbol("type"), V8SCXMLEvent::typeCustomAttrGetter, 0,
v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
instance->SetAccessor(v8::String::NewSymbol("name"), V8SCXMLEvent::nameAttrGetter, 0,
v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEventCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEventCustom.cpp
new file mode 100644
index 0000000..05644b0
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEventCustom.cpp
@@ -0,0 +1,27 @@
+#include "V8SCXMLEvent.h"
+
+namespace Arabica {
+namespace DOM {
+
+v8::Handle<v8::Value> V8SCXMLEvent::typeCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8SCXMLEvent::V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEvent::V8SCXMLEventPrivate >(self->GetInternalField(0));
+
+ switch (privData->nativeObj->type) {
+ case uscxml::Event::INTERNAL:
+ return v8::String::New("internal");
+ break;
+ case uscxml::Event::EXTERNAL:
+ return v8::String::New("external");
+ break;
+ case uscxml::Event::PLATFORM:
+ return v8::String::New("platform");
+ break;
+ default:
+ break;
+ }
+ return v8::String::New("unknown");
+}
+
+}
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp.old
deleted file mode 100644
index 04bfcbe..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp.old
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "V8XPathResult.h"
-#include "V8NodeSet.h"
-
-namespace uscxml {
-
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
-
-v8::Persistent<v8::FunctionTemplate> V8XPathResult::Tmpl;
-
-v8::Handle<v8::Value> V8XPathResult::asNodeSetCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- XPathValue<std::string>* xpathValue = V8DOM::toClassPtr<XPathValue<std::string> >(self->GetInternalField(0));
- V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
-
- v8::Handle<v8::Function> nodeSetCtor = V8NodeSet::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> nodeSetObj = v8::Persistent<v8::Object>::New(nodeSetCtor->NewInstance());
-
- Arabica::XPath::NodeSet<std::string>* nodeSet = new Arabica::XPath::NodeSet<std::string>(xpathValue->asNodeSet());
-
- nodeSetObj->SetInternalField(0, V8DOM::toExternal(nodeSet));
- nodeSetObj->SetInternalField(1, self->GetInternalField(1));
-
- nodeSetObj.MakeWeak(0, V8NodeSet::jsDestructor);
- return nodeSetObj;
-
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h.old
deleted file mode 100644
index ce5e2d5..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h.old
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef V8XPATHRESULT_HPP_AYZD0IRH
-#define V8XPATHRESULT_HPP_AYZD0IRH
-
-#include "V8DOM.h"
-
-namespace uscxml {
- class V8XPathResult {
- public:
- static v8::Handle<v8::Value> resultTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> singleNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> invalidIteratorStateAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> snapshotLengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
-
- static v8::Handle<v8::Value> iterateNextCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> snapshotItemCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
-
- static v8::Handle<v8::Value> asNodeSetCallback(const v8::Arguments& args);
- static v8::Handle<v8::Value> asBoolCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> asStringCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> asNumberCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
-
- V8_DESTRUCTOR(Arabica::XPath::XPathValue<std::string>);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("XPathResult"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(2);
-
- instance->SetAccessor(v8::String::NewSymbol("resultType"), V8XPathResult::resultTypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("numberValue"), V8XPathResult::numberValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("stringValue"), V8XPathResult::stringValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("booleanValue"), V8XPathResult::booleanValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("singleNode"), V8XPathResult::singleNodeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("invalidIteratorState"), V8XPathResult::invalidIteratorStateAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("snapshotLength"), V8XPathResult::snapshotLengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("iterateNext"),
- v8::FunctionTemplate::New(V8XPathResult::iterateNextCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("snapshotItem"),
- v8::FunctionTemplate::New(V8XPathResult::snapshotItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asNodeSet"),
- v8::FunctionTemplate::New(V8XPathResult::asNodeSetCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asBool"),
- v8::FunctionTemplate::New(V8XPathResult::asBoolCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asString"),
- v8::FunctionTemplate::New(V8XPathResult::asStringCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asNumber"),
- v8::FunctionTemplate::New(V8XPathResult::asNumberCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
- };
-}
-
-
-#endif /* end of include guard: V8XPATHRESULT_HPP_AYZD0IRH */
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
index c9d2237..75d6da9 100644
--- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
@@ -143,7 +143,7 @@ void SWIDataModel::assign(const std::string& location, const std::string& expr)
}
bool SWIDataModel::isDefined(const std::string& expr) {
- return true;
+ return true;
}
} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
index 292b79e..7ad528d 100644
--- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
+++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
@@ -15,7 +15,7 @@ bool connect(pluma::Host& host) {
}
#endif
- USCXMLInvoker::USCXMLInvoker() : _cancelled(false) {
+USCXMLInvoker::USCXMLInvoker() : _cancelled(false) {
}
@@ -54,7 +54,7 @@ void USCXMLInvoker::invoke(const InvokeRequest& req) {
if (_invokedInterpreter) {
DataModel dataModel(_invokedInterpreter->getDataModel());
if (dataModel) {
-
+
}
_invokedInterpreter->setParentQueue(this);
// transfer namespace prefixes
@@ -68,10 +68,10 @@ void USCXMLInvoker::invoke(const InvokeRequest& req) {
}
_invokedInterpreter->_xmlNSPrefix = _parentInterpreter->_xmlNSPrefix;
_invokedInterpreter->_sessionId = req.invokeid;
-
+
/// test240 assumes that invoke request params will carry over to the datamodel
_invokedInterpreter->setInvokeRequest(req);
-
+
_invokedInterpreter->start();
}
}
diff --git a/src/uscxml/server/InterpreterServlet.cpp b/src/uscxml/server/InterpreterServlet.cpp
index e537275..99b81b2 100644
--- a/src/uscxml/server/InterpreterServlet.cpp
+++ b/src/uscxml/server/InterpreterServlet.cpp
@@ -1,5 +1,6 @@
#include "InterpreterServlet.h"
#include "uscxml/Interpreter.h"
+#include <glog/logging.h>
namespace uscxml {
@@ -17,6 +18,12 @@ InterpreterServlet::InterpreterServlet(Interpreter* interpreter) {
_path = path.str();
}
+boost::shared_ptr<IOProcessorImpl> InterpreterServlet::create(Interpreter* interpreter) {
+ // we instantiate directly in Interpreter
+ boost::shared_ptr<IOProcessorImpl> io = boost::shared_ptr<InterpreterServlet>(new InterpreterServlet(interpreter));
+ return io;
+}
+
void InterpreterServlet::httpRecvRequest(const HTTPServer::Request& req) {
tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
@@ -31,4 +38,15 @@ void InterpreterServlet::httpRecvRequest(const HTTPServer::Request& req) {
_interpreter->receive(event);
}
+Data InterpreterServlet::getDataModelVariables() {
+ Data data;
+ assert(_url.length() > 0);
+ data.compound["location"] = Data(_url, Data::VERBATIM);
+ return data;
+}
+
+void InterpreterServlet::send(const SendRequest& req) {
+ LOG(ERROR) << "send not supported by http iorprocessor, use the fetch element";
+}
+
} \ No newline at end of file
diff --git a/src/uscxml/server/InterpreterServlet.h b/src/uscxml/server/InterpreterServlet.h
index 72f2f67..18e1d28 100644
--- a/src/uscxml/server/InterpreterServlet.h
+++ b/src/uscxml/server/InterpreterServlet.h
@@ -2,15 +2,30 @@
#define INTERPRETERSERVLET_H_XQLWNMH4
#include "HTTPServer.h"
+#include "uscxml/Factory.h"
namespace uscxml {
class Interpreter;
-class InterpreterServlet : public HTTPServlet {
+class InterpreterServlet : public HTTPServlet, public IOProcessorImpl {
public:
+ InterpreterServlet() {};
InterpreterServlet(Interpreter* interpreter);
virtual ~InterpreterServlet() {}
+
+ virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter);
+
+ virtual std::set<std::string> getNames() {
+ std::set<std::string> names;
+ names.insert("http");
+ names.insert("http://www.w3.org/TR/scxml/#HTTPEventProcessor");
+ return names;
+ }
+
+ Data getDataModelVariables();
+ virtual void send(const SendRequest& req);
+
virtual void httpRecvRequest(const HTTPServer::Request& req);
std::string getPath() {
@@ -26,6 +41,7 @@ public:
return false;
}
+
std::map<std::string, HTTPServer::Request>& getRequests() {
return _requests;
}