diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-01 19:18:36 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-01 19:18:36 (GMT) |
commit | fd0778237785840ec754f98e847a524590cbf61c (patch) | |
tree | ebf4609be11843f9657810515d47faa3873c2db8 /src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp | |
parent | 99d2c52f1068b2dd4bd16b8c1c8231beeb94a649 (diff) | |
download | uscxml-fd0778237785840ec754f98e847a524590cbf61c.zip uscxml-fd0778237785840ec754f98e847a524590cbf61c.tar.gz uscxml-fd0778237785840ec754f98e847a524590cbf61c.tar.bz2 |
More work on TypedArrays
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp')
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp index c714735..173a0ed 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp @@ -8,6 +8,18 @@ #include "dom/JSCCDATASection.h" #include "dom/JSCSCXMLEvent.h" +#include "dom/JSCArrayBuffer.h" +#include "dom/JSCInt8Array.h" +#include "dom/JSCUint8Array.h" +#include "dom/JSCUint8ClampedArray.h" +#include "dom/JSCInt16Array.h" +#include "dom/JSCUint16Array.h" +#include "dom/JSCInt32Array.h" +#include "dom/JSCUint32Array.h" +#include "dom/JSCFloat32Array.h" +#include "dom/JSCFloat64Array.h" +#include "dom/JSCDataView.h" + #include "uscxml/Message.h" #include <glog/logging.h> @@ -22,6 +34,12 @@ privData->nativeObj = new type<std::string>(node); \ JSObjectRef retObj = JSObjectMake(_ctx, JSC##type::getTmpl(), privData);\ return retObj; +#define JSC_ADD_GLOBAL_OBJECT(name, constructor)\ +JSStringRef name##Name = JSStringCreateWithUTF8CString(#name);\ +JSObjectRef name = JSObjectMake(dm->_ctx, constructor, NULL);\ +JSObjectSetProperty(dm->_ctx, JSContextGetGlobalObject(dm->_ctx), name##Name, name, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL);\ +JSStringRelease(name##Name); + namespace uscxml { using namespace Arabica::XPath; @@ -127,6 +145,18 @@ boost::shared_ptr<DataModelImpl> JSCDataModel::create(InterpreterImpl* interpret JSStringRelease(sessionIdName); JSStringRelease(sessionId); + JSC_ADD_GLOBAL_OBJECT(ArrayBuffer, JSCArrayBuffer::getTmpl()); + JSC_ADD_GLOBAL_OBJECT(Int8Array, JSCInt8Array::getTmpl()); + JSC_ADD_GLOBAL_OBJECT(Uint8Array, JSCUint8Array::getTmpl()); + JSC_ADD_GLOBAL_OBJECT(Uint8ClampedArray, JSCUint8ClampedArray::getTmpl()); + JSC_ADD_GLOBAL_OBJECT(Int16Array, JSCInt16Array::getTmpl()); + JSC_ADD_GLOBAL_OBJECT(Uint16Array, JSCUint16Array::getTmpl()); + JSC_ADD_GLOBAL_OBJECT(Int32Array, JSCInt32Array::getTmpl()); + JSC_ADD_GLOBAL_OBJECT(Uint32Array, JSCUint32Array::getTmpl()); + JSC_ADD_GLOBAL_OBJECT(Float32Array, JSCFloat32Array::getTmpl()); + JSC_ADD_GLOBAL_OBJECT(Float64Array, JSCFloat64Array::getTmpl()); + JSC_ADD_GLOBAL_OBJECT(DataView, JSCDataView::getTmpl()); + JSCDocument::JSCDocumentPrivate* privData = new JSCDocument::JSCDocumentPrivate(); if (interpreter) { privData->nativeObj = new Document<std::string>(interpreter->getDocument()); |