diff options
Diffstat (limited to 'src/uscxml/plugins/datamodel')
50 files changed, 4658 insertions, 0 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.cpp new file mode 100644 index 0000000..39c8dab --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.cpp @@ -0,0 +1,76 @@ +#include "JSCArrayBuffer.h" + +namespace Arabica { +namespace DOM { + +JSClassRef JSCArrayBuffer::Tmpl; + +JSStaticValue JSCArrayBuffer::staticValues[] = { + { "byteLength", byteLengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCArrayBuffer::staticFunctions[] = { + { "slice", sliceCallback, kJSPropertyAttributeDontDelete }, + { "isView", isViewCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCArrayBuffer::byteLengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getByteLength()); +} + +JSValueRef JSCArrayBuffer::sliceCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in slice"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj); + + long localBegin = (long)JSValueToNumber(ctx, arguments[0], exception); + long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception); + + uscxml::ArrayBuffer* retVal = new uscxml::ArrayBuffer(privData->nativeObj->slice(localBegin, localEnd)); + JSClassRef retClass = JSCArrayBuffer::getTmpl(); + + struct JSCArrayBuffer::JSCArrayBufferPrivate* retPrivData = new JSCArrayBuffer::JSCArrayBufferPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCArrayBuffer::isViewCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in isView"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj); + + void* localValue = JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)); + + bool retVal = privData->nativeObj->isView(localValue); + + JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal); + return jscRetVal; +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.h new file mode 100644 index 0000000..e3e7a14 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.h @@ -0,0 +1,71 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCArrayBuffer_h +#define JSCArrayBuffer_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCArrayBuffer { +public: + struct JSCArrayBufferPrivate { + JSCDOM* dom; + uscxml::ArrayBuffer* nativeObj; + }; + + JSC_DESTRUCTOR(JSCArrayBufferPrivate); + + static JSValueRef sliceCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef isViewCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef byteLengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // JSCArrayBuffer_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.cpp new file mode 100644 index 0000000..f599aff --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.cpp @@ -0,0 +1,53 @@ +#include "JSCArrayBuffer.h" +#include "JSCArrayBufferView.h" + +namespace Arabica { +namespace DOM { + +JSClassRef JSCArrayBufferView::Tmpl; + +JSStaticValue JSCArrayBufferView::staticValues[] = { + { "buffer", bufferAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "byteOffset", byteOffsetAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "byteLength", byteLengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCArrayBufferView::staticFunctions[] = { + { 0, 0, 0 } +}; + +JSValueRef JSCArrayBufferView::bufferAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCArrayBufferViewPrivate* privData = (struct JSCArrayBufferViewPrivate*)JSObjectGetPrivate(object); + + if (!privData->nativeObj->getBuffer()) return JSValueMakeUndefined(ctx); + uscxml::ArrayBuffer* arabicaRet = new uscxml::ArrayBuffer(privData->nativeObj->getBuffer()); + + JSClassRef arbaicaRetClass = JSCArrayBuffer::getTmpl(); + + struct JSCArrayBuffer::JSCArrayBufferPrivate* retPrivData = new JSCArrayBuffer::JSCArrayBufferPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = arabicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); + return arbaicaRetObj; +} + + +JSValueRef JSCArrayBufferView::byteOffsetAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCArrayBufferViewPrivate* privData = (struct JSCArrayBufferViewPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getByteOffset()); +} + + +JSValueRef JSCArrayBufferView::byteLengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCArrayBufferViewPrivate* privData = (struct JSCArrayBufferViewPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getByteLength()); +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.h new file mode 100644 index 0000000..ab683c2 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.h @@ -0,0 +1,71 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCArrayBufferView_h +#define JSCArrayBufferView_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCArrayBufferView { +public: + struct JSCArrayBufferViewPrivate { + JSCDOM* dom; + uscxml::ArrayBufferView* nativeObj; + }; + + JSC_DESTRUCTOR(JSCArrayBufferViewPrivate); + + + static JSValueRef bufferAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef byteOffsetAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef byteLengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // JSCArrayBufferView_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.cpp new file mode 100644 index 0000000..5e6ee80 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.cpp @@ -0,0 +1,374 @@ +#include "JSCDataView.h" + +namespace Arabica { +namespace DOM { + +JSClassRef JSCDataView::Tmpl; + +JSStaticValue JSCDataView::staticValues[] = { + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCDataView::staticFunctions[] = { + { "getInt8", getInt8Callback, kJSPropertyAttributeDontDelete }, + { "getUint8", getUint8Callback, kJSPropertyAttributeDontDelete }, + { "getInt16", getInt16Callback, kJSPropertyAttributeDontDelete }, + { "getUint16", getUint16Callback, kJSPropertyAttributeDontDelete }, + { "getInt32", getInt32Callback, kJSPropertyAttributeDontDelete }, + { "getUint32", getUint32Callback, kJSPropertyAttributeDontDelete }, + { "getFloat32", getFloat32Callback, kJSPropertyAttributeDontDelete }, + { "getFloat64", getFloat64Callback, kJSPropertyAttributeDontDelete }, + { "setInt8", setInt8Callback, kJSPropertyAttributeDontDelete }, + { "setUint8", setUint8Callback, kJSPropertyAttributeDontDelete }, + { "setInt16", setInt16Callback, kJSPropertyAttributeDontDelete }, + { "setUint16", setUint16Callback, kJSPropertyAttributeDontDelete }, + { "setInt32", setInt32Callback, kJSPropertyAttributeDontDelete }, + { "setUint32", setUint32Callback, kJSPropertyAttributeDontDelete }, + { "setFloat32", setFloat32Callback, kJSPropertyAttributeDontDelete }, + { "setFloat64", setFloat64Callback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; +JSValueRef JSCDataView::getInt8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in getInt8"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + char retVal = privData->nativeObj->getInt8(localByteOffset); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCDataView::getUint8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in getUint8"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + char retVal = privData->nativeObj->getUint8(localByteOffset); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCDataView::getInt16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in getInt16"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + bool localLittleEndian = JSValueToBoolean(ctx, arguments[1]); + + short retVal = privData->nativeObj->getInt16(localByteOffset, localLittleEndian); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCDataView::getUint16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in getUint16"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + bool localLittleEndian = JSValueToBoolean(ctx, arguments[1]); + + unsigned short retVal = privData->nativeObj->getUint16(localByteOffset, localLittleEndian); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCDataView::getInt32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in getInt32"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + bool localLittleEndian = JSValueToBoolean(ctx, arguments[1]); + + long retVal = privData->nativeObj->getInt32(localByteOffset, localLittleEndian); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCDataView::getUint32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in getUint32"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + bool localLittleEndian = JSValueToBoolean(ctx, arguments[1]); + + unsigned long retVal = privData->nativeObj->getUint32(localByteOffset, localLittleEndian); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCDataView::getFloat32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in getFloat32"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + bool localLittleEndian = JSValueToBoolean(ctx, arguments[1]); + + float retVal = privData->nativeObj->getFloat32(localByteOffset, localLittleEndian); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCDataView::getFloat64Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in getFloat64"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + bool localLittleEndian = JSValueToBoolean(ctx, arguments[1]); + + double retVal = privData->nativeObj->getFloat64(localByteOffset, localLittleEndian); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCDataView::setInt8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in setInt8"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + char localValue = (char)JSValueToNumber(ctx, arguments[1], exception); + + privData->nativeObj->setInt8(localByteOffset, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCDataView::setUint8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in setUint8"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + unsigned char localValue = (char)JSValueToNumber(ctx, arguments[1], exception); + + privData->nativeObj->setUint8(localByteOffset, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCDataView::setInt16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 3) { + std::string errorMsg = "Wrong number of arguments in setInt16"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + short localValue = (short)JSValueToNumber(ctx, arguments[1], exception); + bool localLittleEndian = JSValueToBoolean(ctx, arguments[2]); + + privData->nativeObj->setInt16(localByteOffset, localValue, localLittleEndian); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCDataView::setUint16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 3) { + std::string errorMsg = "Wrong number of arguments in setUint16"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + unsigned short localValue = (unsigned short)JSValueToNumber(ctx, arguments[1], exception); + bool localLittleEndian = JSValueToBoolean(ctx, arguments[2]); + + privData->nativeObj->setUint16(localByteOffset, localValue, localLittleEndian); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCDataView::setInt32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 3) { + std::string errorMsg = "Wrong number of arguments in setInt32"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + long localValue = (long)JSValueToNumber(ctx, arguments[1], exception); + bool localLittleEndian = JSValueToBoolean(ctx, arguments[2]); + + privData->nativeObj->setInt32(localByteOffset, localValue, localLittleEndian); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCDataView::setUint32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 3) { + std::string errorMsg = "Wrong number of arguments in setUint32"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + unsigned long localValue = (unsigned long)JSValueToNumber(ctx, arguments[1], exception); + bool localLittleEndian = JSValueToBoolean(ctx, arguments[2]); + + privData->nativeObj->setUint32(localByteOffset, localValue, localLittleEndian); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCDataView::setFloat32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 3) { + std::string errorMsg = "Wrong number of arguments in setFloat32"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + float localValue = (float)JSValueToNumber(ctx, arguments[1], exception); + bool localLittleEndian = JSValueToBoolean(ctx, arguments[2]); + + privData->nativeObj->setFloat32(localByteOffset, localValue, localLittleEndian); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCDataView::setFloat64Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 3) { + std::string errorMsg = "Wrong number of arguments in setFloat64"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + double localValue = (double)JSValueToNumber(ctx, arguments[1], exception); + bool localLittleEndian = JSValueToBoolean(ctx, arguments[2]); + + privData->nativeObj->setFloat64(localByteOffset, localValue, localLittleEndian); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.h new file mode 100644 index 0000000..4d37120 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.h @@ -0,0 +1,84 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCDataView_h +#define JSCDataView_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCDataView { +public: + struct JSCDataViewPrivate { + JSCDOM* dom; + uscxml::DataView* nativeObj; + }; + + JSC_DESTRUCTOR(JSCDataViewPrivate); + + static JSValueRef getInt8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getUint8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getInt16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getUint16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getInt32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getUint32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getFloat32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getFloat64Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setInt8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setUint8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setInt16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setUint16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setInt32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setUint32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setFloat32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setFloat64Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // JSCDataView_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.cpp new file mode 100644 index 0000000..f22ba32 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.cpp @@ -0,0 +1,105 @@ +#include "JSCFloat32Array.h" + +namespace Arabica { +namespace DOM { + +JSClassRef JSCFloat32Array::Tmpl; + +JSStaticValue JSCFloat32Array::staticValues[] = { + { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCFloat32Array::staticFunctions[] = { + { "get", getCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCFloat32Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCFloat32ArrayPrivate* privData = (struct JSCFloat32ArrayPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getLength()); +} + +JSValueRef JSCFloat32Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) { + return JSValueMakeNumber(ctx, 4); +} + +JSValueRef JSCFloat32Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in get"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCFloat32ArrayPrivate* privData = (struct JSCFloat32ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + float retVal = privData->nativeObj->get(localIndex); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCFloat32Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in set"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCFloat32ArrayPrivate* privData = (struct JSCFloat32ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + float localValue = (float)JSValueToNumber(ctx, arguments[1], exception); + + privData->nativeObj->set(localIndex, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCFloat32Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in subarray"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCFloat32ArrayPrivate* privData = (struct JSCFloat32ArrayPrivate*)JSObjectGetPrivate(thisObj); + + long localStart = (long)JSValueToNumber(ctx, arguments[0], exception); + long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception); + + uscxml::Float32Array* retVal = new uscxml::Float32Array(privData->nativeObj->subarray(localStart, localEnd)); + JSClassRef retClass = JSCFloat32Array::getTmpl(); + + struct JSCFloat32Array::JSCFloat32ArrayPrivate* retPrivData = new JSCFloat32Array::JSCFloat32ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.h new file mode 100644 index 0000000..21d4c59 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.h @@ -0,0 +1,73 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCFloat32Array_h +#define JSCFloat32Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCFloat32Array { +public: + struct JSCFloat32ArrayPrivate { + JSCDOM* dom; + uscxml::Float32Array* nativeObj; + }; + + JSC_DESTRUCTOR(JSCFloat32ArrayPrivate); + + static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // JSCFloat32Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.cpp new file mode 100644 index 0000000..06ca510 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.cpp @@ -0,0 +1,105 @@ +#include "JSCFloat64Array.h" + +namespace Arabica { +namespace DOM { + +JSClassRef JSCFloat64Array::Tmpl; + +JSStaticValue JSCFloat64Array::staticValues[] = { + { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCFloat64Array::staticFunctions[] = { + { "get", getCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCFloat64Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCFloat64ArrayPrivate* privData = (struct JSCFloat64ArrayPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getLength()); +} + +JSValueRef JSCFloat64Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) { + return JSValueMakeNumber(ctx, 8); +} + +JSValueRef JSCFloat64Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in get"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCFloat64ArrayPrivate* privData = (struct JSCFloat64ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + double retVal = privData->nativeObj->get(localIndex); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCFloat64Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in set"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCFloat64ArrayPrivate* privData = (struct JSCFloat64ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + double localValue = (double)JSValueToNumber(ctx, arguments[1], exception); + + privData->nativeObj->set(localIndex, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCFloat64Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in subarray"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCFloat64ArrayPrivate* privData = (struct JSCFloat64ArrayPrivate*)JSObjectGetPrivate(thisObj); + + long localStart = (long)JSValueToNumber(ctx, arguments[0], exception); + long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception); + + uscxml::Float64Array* retVal = new uscxml::Float64Array(privData->nativeObj->subarray(localStart, localEnd)); + JSClassRef retClass = JSCFloat64Array::getTmpl(); + + struct JSCFloat64Array::JSCFloat64ArrayPrivate* retPrivData = new JSCFloat64Array::JSCFloat64ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.h new file mode 100644 index 0000000..f21962d --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.h @@ -0,0 +1,73 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCFloat64Array_h +#define JSCFloat64Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCFloat64Array { +public: + struct JSCFloat64ArrayPrivate { + JSCDOM* dom; + uscxml::Float64Array* nativeObj; + }; + + JSC_DESTRUCTOR(JSCFloat64ArrayPrivate); + + static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // JSCFloat64Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.cpp new file mode 100644 index 0000000..2844b75 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.cpp @@ -0,0 +1,105 @@ +#include "JSCInt16Array.h" + +namespace Arabica { +namespace DOM { + +JSClassRef JSCInt16Array::Tmpl; + +JSStaticValue JSCInt16Array::staticValues[] = { + { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCInt16Array::staticFunctions[] = { + { "get", getCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCInt16Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCInt16ArrayPrivate* privData = (struct JSCInt16ArrayPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getLength()); +} + +JSValueRef JSCInt16Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) { + return JSValueMakeNumber(ctx, 2); +} + +JSValueRef JSCInt16Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in get"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCInt16ArrayPrivate* privData = (struct JSCInt16ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + short retVal = privData->nativeObj->get(localIndex); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCInt16Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in set"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCInt16ArrayPrivate* privData = (struct JSCInt16ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + short localValue = (short)JSValueToNumber(ctx, arguments[1], exception); + + privData->nativeObj->set(localIndex, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCInt16Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in subarray"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCInt16ArrayPrivate* privData = (struct JSCInt16ArrayPrivate*)JSObjectGetPrivate(thisObj); + + long localStart = (long)JSValueToNumber(ctx, arguments[0], exception); + long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception); + + uscxml::Int16Array* retVal = new uscxml::Int16Array(privData->nativeObj->subarray(localStart, localEnd)); + JSClassRef retClass = JSCInt16Array::getTmpl(); + + struct JSCInt16Array::JSCInt16ArrayPrivate* retPrivData = new JSCInt16Array::JSCInt16ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.h new file mode 100644 index 0000000..7510336 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.h @@ -0,0 +1,73 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCInt16Array_h +#define JSCInt16Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCInt16Array { +public: + struct JSCInt16ArrayPrivate { + JSCDOM* dom; + uscxml::Int16Array* nativeObj; + }; + + JSC_DESTRUCTOR(JSCInt16ArrayPrivate); + + static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // JSCInt16Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp new file mode 100644 index 0000000..09d8f76 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp @@ -0,0 +1,105 @@ +#include "JSCInt32Array.h" + +namespace Arabica { +namespace DOM { + +JSClassRef JSCInt32Array::Tmpl; + +JSStaticValue JSCInt32Array::staticValues[] = { + { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCInt32Array::staticFunctions[] = { + { "get", getCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCInt32Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCInt32ArrayPrivate* privData = (struct JSCInt32ArrayPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getLength()); +} + +JSValueRef JSCInt32Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) { + return JSValueMakeNumber(ctx, 4); +} + +JSValueRef JSCInt32Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in get"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCInt32ArrayPrivate* privData = (struct JSCInt32ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + long retVal = privData->nativeObj->get(localIndex); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCInt32Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in set"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCInt32ArrayPrivate* privData = (struct JSCInt32ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + long localValue = (long)JSValueToNumber(ctx, arguments[1], exception); + + privData->nativeObj->set(localIndex, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCInt32Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in subarray"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCInt32ArrayPrivate* privData = (struct JSCInt32ArrayPrivate*)JSObjectGetPrivate(thisObj); + + long localStart = (long)JSValueToNumber(ctx, arguments[0], exception); + long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception); + + uscxml::Int32Array* retVal = new uscxml::Int32Array(privData->nativeObj->subarray(localStart, localEnd)); + JSClassRef retClass = JSCInt32Array::getTmpl(); + + struct JSCInt32Array::JSCInt32ArrayPrivate* retPrivData = new JSCInt32Array::JSCInt32ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.h new file mode 100644 index 0000000..901eb3c --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.h @@ -0,0 +1,73 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCInt32Array_h +#define JSCInt32Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCInt32Array { +public: + struct JSCInt32ArrayPrivate { + JSCDOM* dom; + uscxml::Int32Array* nativeObj; + }; + + JSC_DESTRUCTOR(JSCInt32ArrayPrivate); + + static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // JSCInt32Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.cpp new file mode 100644 index 0000000..509481e --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.cpp @@ -0,0 +1,105 @@ +#include "JSCInt8Array.h" + +namespace Arabica { +namespace DOM { + +JSClassRef JSCInt8Array::Tmpl; + +JSStaticValue JSCInt8Array::staticValues[] = { + { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCInt8Array::staticFunctions[] = { + { "get", getCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCInt8Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCInt8ArrayPrivate* privData = (struct JSCInt8ArrayPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getLength()); +} + +JSValueRef JSCInt8Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) { + return JSValueMakeNumber(ctx, 1); +} + +JSValueRef JSCInt8Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in get"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCInt8ArrayPrivate* privData = (struct JSCInt8ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + char retVal = privData->nativeObj->get(localIndex); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCInt8Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in set"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCInt8ArrayPrivate* privData = (struct JSCInt8ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + char localValue = (char)JSValueToNumber(ctx, arguments[1], exception); + + privData->nativeObj->set(localIndex, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCInt8Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in subarray"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCInt8ArrayPrivate* privData = (struct JSCInt8ArrayPrivate*)JSObjectGetPrivate(thisObj); + + long localStart = (long)JSValueToNumber(ctx, arguments[0], exception); + long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception); + + uscxml::Int8Array* retVal = new uscxml::Int8Array(privData->nativeObj->subarray(localStart, localEnd)); + JSClassRef retClass = JSCInt8Array::getTmpl(); + + struct JSCInt8Array::JSCInt8ArrayPrivate* retPrivData = new JSCInt8Array::JSCInt8ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.h new file mode 100644 index 0000000..a693f2a --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.h @@ -0,0 +1,73 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCInt8Array_h +#define JSCInt8Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCInt8Array { +public: + struct JSCInt8ArrayPrivate { + JSCDOM* dom; + uscxml::Int8Array* nativeObj; + }; + + JSC_DESTRUCTOR(JSCInt8ArrayPrivate); + + static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // JSCInt8Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.cpp new file mode 100644 index 0000000..88e71d6 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.cpp @@ -0,0 +1,105 @@ +#include "JSCUint16Array.h" + +namespace Arabica { +namespace DOM { + +JSClassRef JSCUint16Array::Tmpl; + +JSStaticValue JSCUint16Array::staticValues[] = { + { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCUint16Array::staticFunctions[] = { + { "get", getCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCUint16Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCUint16ArrayPrivate* privData = (struct JSCUint16ArrayPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getLength()); +} + +JSValueRef JSCUint16Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) { + return JSValueMakeNumber(ctx, 2); +} + +JSValueRef JSCUint16Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in get"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCUint16ArrayPrivate* privData = (struct JSCUint16ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + unsigned short retVal = privData->nativeObj->get(localIndex); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCUint16Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in set"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCUint16ArrayPrivate* privData = (struct JSCUint16ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + unsigned short localValue = (unsigned short)JSValueToNumber(ctx, arguments[1], exception); + + privData->nativeObj->set(localIndex, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCUint16Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in subarray"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCUint16ArrayPrivate* privData = (struct JSCUint16ArrayPrivate*)JSObjectGetPrivate(thisObj); + + long localStart = (long)JSValueToNumber(ctx, arguments[0], exception); + long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception); + + uscxml::Uint16Array* retVal = new uscxml::Uint16Array(privData->nativeObj->subarray(localStart, localEnd)); + JSClassRef retClass = JSCUint16Array::getTmpl(); + + struct JSCUint16Array::JSCUint16ArrayPrivate* retPrivData = new JSCUint16Array::JSCUint16ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.h new file mode 100644 index 0000000..dfc6cc8 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.h @@ -0,0 +1,73 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCUint16Array_h +#define JSCUint16Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCUint16Array { +public: + struct JSCUint16ArrayPrivate { + JSCDOM* dom; + uscxml::Uint16Array* nativeObj; + }; + + JSC_DESTRUCTOR(JSCUint16ArrayPrivate); + + static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // JSCUint16Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.cpp new file mode 100644 index 0000000..9887423 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.cpp @@ -0,0 +1,105 @@ +#include "JSCUint32Array.h" + +namespace Arabica { +namespace DOM { + +JSClassRef JSCUint32Array::Tmpl; + +JSStaticValue JSCUint32Array::staticValues[] = { + { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCUint32Array::staticFunctions[] = { + { "get", getCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCUint32Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCUint32ArrayPrivate* privData = (struct JSCUint32ArrayPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getLength()); +} + +JSValueRef JSCUint32Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) { + return JSValueMakeNumber(ctx, 4); +} + +JSValueRef JSCUint32Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in get"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCUint32ArrayPrivate* privData = (struct JSCUint32ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + unsigned long retVal = privData->nativeObj->get(localIndex); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCUint32Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in set"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCUint32ArrayPrivate* privData = (struct JSCUint32ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + unsigned long localValue = (unsigned long)JSValueToNumber(ctx, arguments[1], exception); + + privData->nativeObj->set(localIndex, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCUint32Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in subarray"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCUint32ArrayPrivate* privData = (struct JSCUint32ArrayPrivate*)JSObjectGetPrivate(thisObj); + + long localStart = (long)JSValueToNumber(ctx, arguments[0], exception); + long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception); + + uscxml::Uint32Array* retVal = new uscxml::Uint32Array(privData->nativeObj->subarray(localStart, localEnd)); + JSClassRef retClass = JSCUint32Array::getTmpl(); + + struct JSCUint32Array::JSCUint32ArrayPrivate* retPrivData = new JSCUint32Array::JSCUint32ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.h new file mode 100644 index 0000000..0fac7fc --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.h @@ -0,0 +1,73 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCUint32Array_h +#define JSCUint32Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCUint32Array { +public: + struct JSCUint32ArrayPrivate { + JSCDOM* dom; + uscxml::Uint32Array* nativeObj; + }; + + JSC_DESTRUCTOR(JSCUint32ArrayPrivate); + + static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // JSCUint32Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.cpp new file mode 100644 index 0000000..62c49af --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.cpp @@ -0,0 +1,105 @@ +#include "JSCUint8Array.h" + +namespace Arabica { +namespace DOM { + +JSClassRef JSCUint8Array::Tmpl; + +JSStaticValue JSCUint8Array::staticValues[] = { + { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCUint8Array::staticFunctions[] = { + { "get", getCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCUint8Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCUint8ArrayPrivate* privData = (struct JSCUint8ArrayPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getLength()); +} + +JSValueRef JSCUint8Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) { + return JSValueMakeNumber(ctx, 1); +} + +JSValueRef JSCUint8Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in get"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCUint8ArrayPrivate* privData = (struct JSCUint8ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + char retVal = privData->nativeObj->get(localIndex); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCUint8Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in set"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCUint8ArrayPrivate* privData = (struct JSCUint8ArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + unsigned char localValue = (char)JSValueToNumber(ctx, arguments[1], exception); + + privData->nativeObj->set(localIndex, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCUint8Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in subarray"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCUint8ArrayPrivate* privData = (struct JSCUint8ArrayPrivate*)JSObjectGetPrivate(thisObj); + + long localStart = (long)JSValueToNumber(ctx, arguments[0], exception); + long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception); + + uscxml::Uint8Array* retVal = new uscxml::Uint8Array(privData->nativeObj->subarray(localStart, localEnd)); + JSClassRef retClass = JSCUint8Array::getTmpl(); + + struct JSCUint8Array::JSCUint8ArrayPrivate* retPrivData = new JSCUint8Array::JSCUint8ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.h new file mode 100644 index 0000000..d45cee3 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.h @@ -0,0 +1,73 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCUint8Array_h +#define JSCUint8Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCUint8Array { +public: + struct JSCUint8ArrayPrivate { + JSCDOM* dom; + uscxml::Uint8Array* nativeObj; + }; + + JSC_DESTRUCTOR(JSCUint8ArrayPrivate); + + static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // JSCUint8Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.cpp new file mode 100644 index 0000000..85222dc --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.cpp @@ -0,0 +1,105 @@ +#include "JSCUint8ClampedArray.h" + +namespace Arabica { +namespace DOM { + +JSClassRef JSCUint8ClampedArray::Tmpl; + +JSStaticValue JSCUint8ClampedArray::staticValues[] = { + { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCUint8ClampedArray::staticFunctions[] = { + { "get", getCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "set", setCallback, kJSPropertyAttributeDontDelete }, + { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCUint8ClampedArray::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCUint8ClampedArrayPrivate* privData = (struct JSCUint8ClampedArrayPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getLength()); +} + +JSValueRef JSCUint8ClampedArray::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) { + return JSValueMakeNumber(ctx, 1); +} + +JSValueRef JSCUint8ClampedArray::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in get"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCUint8ClampedArrayPrivate* privData = (struct JSCUint8ClampedArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + char retVal = privData->nativeObj->get(localIndex); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCUint8ClampedArray::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in set"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCUint8ClampedArrayPrivate* privData = (struct JSCUint8ClampedArrayPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + unsigned char localValue = (char)JSValueToNumber(ctx, arguments[1], exception); + + privData->nativeObj->set(localIndex, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCUint8ClampedArray::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in subarray"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCUint8ClampedArrayPrivate* privData = (struct JSCUint8ClampedArrayPrivate*)JSObjectGetPrivate(thisObj); + + long localStart = (long)JSValueToNumber(ctx, arguments[0], exception); + long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception); + + uscxml::Uint8ClampedArray* retVal = new uscxml::Uint8ClampedArray(privData->nativeObj->subarray(localStart, localEnd)); + JSClassRef retClass = JSCUint8ClampedArray::getTmpl(); + + struct JSCUint8ClampedArray::JSCUint8ClampedArrayPrivate* retPrivData = new JSCUint8ClampedArray::JSCUint8ClampedArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.h new file mode 100644 index 0000000..76cd77b --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.h @@ -0,0 +1,73 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCUint8ClampedArray_h +#define JSCUint8ClampedArray_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCUint8ClampedArray { +public: + struct JSCUint8ClampedArrayPrivate { + JSCDOM* dom; + uscxml::Uint8ClampedArray* nativeObj; + }; + + JSC_DESTRUCTOR(JSCUint8ClampedArrayPrivate); + + static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // JSCUint8ClampedArray_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/TypedArray.cpp b/src/uscxml/plugins/datamodel/ecmascript/TypedArray.cpp new file mode 100644 index 0000000..d6e2ada --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/TypedArray.cpp @@ -0,0 +1,89 @@ +#include "TypedArray.h" +#include <iostream> + +namespace uscxml { + +unsigned long ArrayBuffer::getByteLength() {} +ArrayBuffer ArrayBuffer::slice(long begin, long end) {} +bool ArrayBuffer::isView(void*) {} +ArrayBuffer::operator bool() {} + +ArrayBuffer ArrayBufferView::getBuffer() {} +unsigned long ArrayBufferView::getByteOffset() {} +unsigned long ArrayBufferView::getByteLength() {} + +ArrayBuffer DataView::getBuffer() {} +unsigned long DataView::getByteOffset() {} +unsigned long DataView::getByteLength() {} +char DataView::getInt8(unsigned long) {} +unsigned char DataView::getUint8(unsigned long) {} +short DataView::getInt16(unsigned long, bool) {} +unsigned short DataView::getUint16(unsigned long, bool) {} +long DataView::getInt32(unsigned long, bool) {} +unsigned long DataView::getUint32(unsigned long, bool) {} +float DataView::getFloat32(unsigned long, bool) {} +double DataView::getFloat64(unsigned long, bool) {} +void DataView::setInt8(long, char) {} +void DataView::setUint8(long, unsigned char) {} +void DataView::setInt16(long, short, bool) {} +void DataView::setUint16(long, unsigned short, bool) {} +void DataView::setInt32(long, long, bool) {} +void DataView::setUint32(long, unsigned long, bool) {} +void DataView::setFloat32(long, float, bool) {} +void DataView::setFloat64(long, double, bool) {} + +Uint8Array::Uint8Array(Uint8Array* other) {} +unsigned char Uint8Array::get(unsigned long) {} +void Uint8Array::set(unsigned long, char) {} +Uint8Array* Uint8Array::subarray(long, long) {} +unsigned long Uint8Array::getLength() {} + +Uint8ClampedArray::Uint8ClampedArray(Uint8ClampedArray* other) {} +unsigned char Uint8ClampedArray::get(unsigned long) {} +void Uint8ClampedArray::set(unsigned long, char) {} +Uint8ClampedArray* Uint8ClampedArray::subarray(long, long) {} +unsigned long Uint8ClampedArray::getLength() {} + +Int8Array::Int8Array(Int8Array* other) {} +char Int8Array::get(unsigned long) {} +void Int8Array::set(unsigned long, char) {} +Int8Array* Int8Array::subarray(long, long) {} +unsigned long Int8Array::getLength() {} + +Int16Array::Int16Array(Int16Array* other) {} +short Int16Array::get(unsigned long) {} +void Int16Array::set(unsigned long, short) {} +Int16Array* Int16Array::subarray(long, long) {} +unsigned long Int16Array::getLength() {} + +Uint16Array::Uint16Array(Uint16Array* other) {} +unsigned short Uint16Array::get(unsigned long) {} +void Uint16Array::set(unsigned long, unsigned short) {} +Uint16Array* Uint16Array::subarray(long, long) {} +unsigned long Uint16Array::getLength() {} + +Int32Array::Int32Array(Int32Array* other) {} +long Int32Array::get(unsigned long) {} +void Int32Array::set(unsigned long, long) {} +Int32Array* Int32Array::subarray(long, long) {} +unsigned long Int32Array::getLength() {} + +Uint32Array::Uint32Array(Uint32Array* other) {} +unsigned long Uint32Array::get(unsigned long) {} +void Uint32Array::set(unsigned long, unsigned long) {} +Uint32Array* Uint32Array::subarray(long, long) {} +unsigned long Uint32Array::getLength() {} + +Float32Array::Float32Array(Float32Array* other) {} +float Float32Array::get(unsigned long) {} +void Float32Array::set(unsigned long, float) {} +Float32Array* Float32Array::subarray(long, long) {} +unsigned long Float32Array::getLength() {} + +Float64Array::Float64Array(Float64Array* other) {} +double Float64Array::get(unsigned long) {} +void Float64Array::set(unsigned long, double) {} +Float64Array* Float64Array::subarray(long, long) {} +unsigned long Float64Array::getLength() {} + +}
\ No newline at end of file diff --git a/src/uscxml/plugins/datamodel/ecmascript/TypedArray.h b/src/uscxml/plugins/datamodel/ecmascript/TypedArray.h new file mode 100644 index 0000000..0d3b786 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/TypedArray.h @@ -0,0 +1,149 @@ +#ifndef TYPEDARRAY_H_99815BLY +#define TYPEDARRAY_H_99815BLY + +#include <string> +#include <map> + +namespace uscxml { + +class ArrayBuffer { +public: + unsigned long getByteLength(); + ArrayBuffer slice(long begin, long end); + static bool isView(void*); + operator bool(); +}; + +class ArrayBufferView { +public: + ArrayBuffer getBuffer(); + unsigned long getByteOffset(); + unsigned long getByteLength(); + +}; + +class DataView { +public: + ArrayBuffer getBuffer(); + unsigned long getByteOffset(); + unsigned long getByteLength(); + + char getInt8(unsigned long); + unsigned char getUint8(unsigned long); + short getInt16(unsigned long, bool); + unsigned short getUint16(unsigned long, bool); + long getInt32(unsigned long, bool); + unsigned long getUint32(unsigned long, bool); + float getFloat32(unsigned long, bool); + double getFloat64(unsigned long, bool); + + void setInt8(long, char); + void setUint8(long, unsigned char); + void setInt16(long, short, bool); + void setUint16(long, unsigned short, bool); + void setInt32(long, long, bool); + void setUint32(long, unsigned long, bool); + void setFloat32(long, float, bool); + void setFloat64(long, double, bool); + +}; + +class JSArray { +public: + virtual unsigned long getLength() = 0; +protected: + std::string _data; +}; + +class Uint8Array : public JSArray { +public: + virtual ~Uint8Array() {} + Uint8Array(Uint8Array* other); + unsigned char get(unsigned long); + void set(unsigned long, char); + Uint8Array* subarray(long, long); + unsigned long getLength(); +}; + +class Uint8ClampedArray : public JSArray { +public: + virtual ~Uint8ClampedArray() {} + Uint8ClampedArray(Uint8ClampedArray* other); + unsigned char get(unsigned long); + void set(unsigned long, char); + Uint8ClampedArray* subarray(long, long); + unsigned long getLength(); +}; + +class Int8Array : public JSArray { +public: + virtual ~Int8Array() {} + Int8Array(Int8Array* other); + char get(unsigned long); + void set(unsigned long, char); + Int8Array* subarray(long, long); + unsigned long getLength(); +}; + +class Int16Array : public JSArray { +public: + virtual ~Int16Array() {} + Int16Array(Int16Array* other); + short get(unsigned long); + void set(unsigned long, short); + Int16Array* subarray(long, long); + unsigned long getLength(); +}; + +class Uint16Array : public JSArray { +public: + virtual ~Uint16Array() {} + Uint16Array(Uint16Array* other); + unsigned short get(unsigned long); + void set(unsigned long, unsigned short); + Uint16Array* subarray(long, long); + unsigned long getLength(); +}; + +class Int32Array : public JSArray { +public: + virtual ~Int32Array() {} + Int32Array(Int32Array* other); + long get(unsigned long); + void set(unsigned long, long); + Int32Array* subarray(long, long); + unsigned long getLength(); +}; + +class Uint32Array : public JSArray { +public: + virtual ~Uint32Array() {} + Uint32Array(Uint32Array* other); + unsigned long get(unsigned long); + void set(unsigned long, unsigned long); + Uint32Array* subarray(long, long); + unsigned long getLength(); +}; + +class Float32Array : public JSArray { +public: + virtual ~Float32Array() {} + Float32Array(Float32Array* other); + float get(unsigned long); + void set(unsigned long, float); + Float32Array* subarray(long, long); + unsigned long getLength(); +}; + +class Float64Array : public JSArray { +public: + virtual ~Float64Array() {} + Float64Array(Float64Array* other); + double get(unsigned long); + void set(unsigned long, double); + Float64Array* subarray(long, long); + unsigned long getLength(); +}; +} + +#endif /* end of include guard: TYPEDARRAY_H_99815BLY */ diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.cpp new file mode 100644 index 0000000..d4146fe --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.cpp @@ -0,0 +1,57 @@ +#include "V8ArrayBuffer.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8ArrayBuffer::Tmpl; + + +v8::Handle<v8::Value> V8ArrayBuffer::byteLengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8ArrayBufferPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->getByteLength()); +} +v8::Handle<v8::Value> V8ArrayBuffer::sliceCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in slice"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8ArrayBufferPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferPrivate >(self->GetInternalField(0)); + long localBegin = args[0]->ToNumber()->Int32Value(); + long localEnd = args[1]->ToNumber()->Int32Value(); + + uscxml::ArrayBuffer* retVal = new uscxml::ArrayBuffer(privData->nativeObj->slice(localBegin, localEnd)); + v8::Handle<v8::Function> retCtor = V8ArrayBuffer::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); + + struct V8ArrayBuffer::V8ArrayBufferPrivate* retPrivData = new V8ArrayBuffer::V8ArrayBufferPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + + retObj.MakeWeak(0, V8ArrayBuffer::jsDestructor); + return retObj; + +} + +v8::Handle<v8::Value> V8ArrayBuffer::isViewCallback(const v8::Arguments& args) { + if (args.Length() < 1) + throw V8Exception("Wrong number of arguments in isView"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8ArrayBufferPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferPrivate >(self->GetInternalField(0)); + void* localValue = v8::External::Unwrap(args[0]->ToObject()->GetInternalField(0)); + + bool retVal = privData->nativeObj->isView(localValue); + + return v8::Boolean::New(retVal); +} + +bool V8ArrayBuffer::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.h new file mode 100644 index 0000000..3399575 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.h @@ -0,0 +1,82 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8ArrayBuffer_h +#define V8ArrayBuffer_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include "string" +#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8ArrayBuffer { +public: + struct V8ArrayBufferPrivate { + V8DOM* dom; + uscxml::ArrayBuffer* nativeObj; + }; + + V8_DESTRUCTOR(V8ArrayBufferPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + static v8::Handle<v8::Value> sliceCallback(const v8::Arguments&); + static v8::Handle<v8::Value> isViewCallback(const v8::Arguments&); + + static v8::Handle<v8::Value> byteLengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + + 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("ArrayBuffer")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + (void)prototype; // surpress unused warnings + + instance->SetInternalFieldCount(1); + + instance->SetAccessor(v8::String::NewSymbol("byteLength"), V8ArrayBuffer::byteLengthAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + + prototype->Set(v8::String::NewSymbol("slice"), + v8::FunctionTemplate::New(V8ArrayBuffer::sliceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("isView"), + v8::FunctionTemplate::New(V8ArrayBuffer::isViewCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + + + Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // V8ArrayBuffer_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.cpp new file mode 100644 index 0000000..ff0b744 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.cpp @@ -0,0 +1,48 @@ +#include "V8ArrayBuffer.h" +#include "V8ArrayBufferView.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8ArrayBufferView::Tmpl; + + +v8::Handle<v8::Value> V8ArrayBufferView::bufferAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8ArrayBufferViewPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferViewPrivate >(self->GetInternalField(0)); + + if (!privData->nativeObj->getBuffer()) return v8::Undefined(); + uscxml::ArrayBuffer* arbaicaRet = new uscxml::ArrayBuffer(privData->nativeObj->getBuffer()); + + v8::Handle<v8::Function> arbaicaRetCtor = V8ArrayBuffer::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); + + struct V8ArrayBuffer::V8ArrayBufferPrivate* retPrivData = new V8ArrayBuffer::V8ArrayBufferPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = arbaicaRet; + + arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + arbaicaRetObj.MakeWeak(0, V8ArrayBuffer::jsDestructor); + return arbaicaRetObj; + +} + +v8::Handle<v8::Value> V8ArrayBufferView::byteOffsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8ArrayBufferViewPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferViewPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->getByteOffset()); +} + +v8::Handle<v8::Value> V8ArrayBufferView::byteLengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8ArrayBufferViewPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferViewPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->getByteLength()); +} +bool V8ArrayBufferView::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.h new file mode 100644 index 0000000..1f4a75c --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.h @@ -0,0 +1,82 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8ArrayBufferView_h +#define V8ArrayBufferView_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include "string" +#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8ArrayBufferView { +public: + struct V8ArrayBufferViewPrivate { + V8DOM* dom; + uscxml::ArrayBufferView* nativeObj; + }; + + V8_DESTRUCTOR(V8ArrayBufferViewPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + + static v8::Handle<v8::Value> bufferAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> byteOffsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> byteLengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + + 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("ArrayBufferView")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + (void)prototype; // surpress unused warnings + + instance->SetInternalFieldCount(1); + + instance->SetAccessor(v8::String::NewSymbol("buffer"), V8ArrayBufferView::bufferAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + instance->SetAccessor(v8::String::NewSymbol("byteOffset"), V8ArrayBufferView::byteOffsetAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + instance->SetAccessor(v8::String::NewSymbol("byteLength"), V8ArrayBufferView::byteLengthAttrGetter, 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 // V8ArrayBufferView_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.cpp new file mode 100644 index 0000000..4a756ee --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.cpp @@ -0,0 +1,241 @@ +#include "V8DataView.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8DataView::Tmpl; + +v8::Handle<v8::Value> V8DataView::getInt8Callback(const v8::Arguments& args) { + if (args.Length() < 1) + throw V8Exception("Wrong number of arguments in getInt8"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + + char retVal = privData->nativeObj->getInt8(localByteOffset); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8DataView::getUint8Callback(const v8::Arguments& args) { + if (args.Length() < 1) + throw V8Exception("Wrong number of arguments in getUint8"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + + char retVal = privData->nativeObj->getUint8(localByteOffset); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8DataView::getInt16Callback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in getInt16"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + bool localLittleEndian = args[1]->ToBoolean()->BooleanValue(); + + short retVal = privData->nativeObj->getInt16(localByteOffset, localLittleEndian); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8DataView::getUint16Callback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in getUint16"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + bool localLittleEndian = args[1]->ToBoolean()->BooleanValue(); + + unsigned short retVal = privData->nativeObj->getUint16(localByteOffset, localLittleEndian); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8DataView::getInt32Callback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in getInt32"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + bool localLittleEndian = args[1]->ToBoolean()->BooleanValue(); + + long retVal = privData->nativeObj->getInt32(localByteOffset, localLittleEndian); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8DataView::getUint32Callback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in getUint32"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + bool localLittleEndian = args[1]->ToBoolean()->BooleanValue(); + + unsigned long retVal = privData->nativeObj->getUint32(localByteOffset, localLittleEndian); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8DataView::getFloat32Callback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in getFloat32"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + bool localLittleEndian = args[1]->ToBoolean()->BooleanValue(); + + float retVal = privData->nativeObj->getFloat32(localByteOffset, localLittleEndian); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8DataView::getFloat64Callback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in getFloat64"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + bool localLittleEndian = args[1]->ToBoolean()->BooleanValue(); + + double retVal = privData->nativeObj->getFloat64(localByteOffset, localLittleEndian); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8DataView::setInt8Callback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in setInt8"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + char localValue = args[1]->ToNumber()->Int32Value(); + + privData->nativeObj->setInt8(localByteOffset, localValue); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8DataView::setUint8Callback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in setUint8"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + unsigned char localValue = args[1]->ToNumber()->Uint32Value(); + + privData->nativeObj->setUint8(localByteOffset, localValue); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8DataView::setInt16Callback(const v8::Arguments& args) { + if (args.Length() < 3) + throw V8Exception("Wrong number of arguments in setInt16"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + short localValue = args[1]->ToNumber()->Int32Value(); + bool localLittleEndian = args[2]->ToBoolean()->BooleanValue(); + + privData->nativeObj->setInt16(localByteOffset, localValue, localLittleEndian); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8DataView::setUint16Callback(const v8::Arguments& args) { + if (args.Length() < 3) + throw V8Exception("Wrong number of arguments in setUint16"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + unsigned short localValue = args[1]->ToNumber()->Uint32Value(); + bool localLittleEndian = args[2]->ToBoolean()->BooleanValue(); + + privData->nativeObj->setUint16(localByteOffset, localValue, localLittleEndian); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8DataView::setInt32Callback(const v8::Arguments& args) { + if (args.Length() < 3) + throw V8Exception("Wrong number of arguments in setInt32"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + long localValue = args[1]->ToNumber()->Int32Value(); + bool localLittleEndian = args[2]->ToBoolean()->BooleanValue(); + + privData->nativeObj->setInt32(localByteOffset, localValue, localLittleEndian); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8DataView::setUint32Callback(const v8::Arguments& args) { + if (args.Length() < 3) + throw V8Exception("Wrong number of arguments in setUint32"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + unsigned long localValue = args[1]->ToNumber()->Uint32Value(); + bool localLittleEndian = args[2]->ToBoolean()->BooleanValue(); + + privData->nativeObj->setUint32(localByteOffset, localValue, localLittleEndian); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8DataView::setFloat32Callback(const v8::Arguments& args) { + if (args.Length() < 3) + throw V8Exception("Wrong number of arguments in setFloat32"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + float localValue = args[1]->ToNumber()->Value(); + bool localLittleEndian = args[2]->ToBoolean()->BooleanValue(); + + privData->nativeObj->setFloat32(localByteOffset, localValue, localLittleEndian); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8DataView::setFloat64Callback(const v8::Arguments& args) { + if (args.Length() < 3) + throw V8Exception("Wrong number of arguments in setFloat64"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0)); + unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value(); + double localValue = args[1]->ToNumber()->Value(); + bool localLittleEndian = args[2]->ToBoolean()->BooleanValue(); + + privData->nativeObj->setFloat64(localByteOffset, localValue, localLittleEndian); + + return v8::Undefined(); +} + +bool V8DataView::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.h new file mode 100644 index 0000000..476ff87 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.h @@ -0,0 +1,121 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8DataView_h +#define V8DataView_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include "string" +#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8DataView { +public: + struct V8DataViewPrivate { + V8DOM* dom; + uscxml::DataView* nativeObj; + }; + + V8_DESTRUCTOR(V8DataViewPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + static v8::Handle<v8::Value> getInt8Callback(const v8::Arguments&); + static v8::Handle<v8::Value> getUint8Callback(const v8::Arguments&); + static v8::Handle<v8::Value> getInt16Callback(const v8::Arguments&); + static v8::Handle<v8::Value> getUint16Callback(const v8::Arguments&); + static v8::Handle<v8::Value> getInt32Callback(const v8::Arguments&); + static v8::Handle<v8::Value> getUint32Callback(const v8::Arguments&); + static v8::Handle<v8::Value> getFloat32Callback(const v8::Arguments&); + static v8::Handle<v8::Value> getFloat64Callback(const v8::Arguments&); + static v8::Handle<v8::Value> setInt8Callback(const v8::Arguments&); + static v8::Handle<v8::Value> setUint8Callback(const v8::Arguments&); + static v8::Handle<v8::Value> setInt16Callback(const v8::Arguments&); + static v8::Handle<v8::Value> setUint16Callback(const v8::Arguments&); + static v8::Handle<v8::Value> setInt32Callback(const v8::Arguments&); + static v8::Handle<v8::Value> setUint32Callback(const v8::Arguments&); + static v8::Handle<v8::Value> setFloat32Callback(const v8::Arguments&); + static v8::Handle<v8::Value> setFloat64Callback(const v8::Arguments&); + + + 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("DataView")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + (void)prototype; // surpress unused warnings + + instance->SetInternalFieldCount(1); + + + prototype->Set(v8::String::NewSymbol("getInt8"), + v8::FunctionTemplate::New(V8DataView::getInt8Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("getUint8"), + v8::FunctionTemplate::New(V8DataView::getUint8Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("getInt16"), + v8::FunctionTemplate::New(V8DataView::getInt16Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("getUint16"), + v8::FunctionTemplate::New(V8DataView::getUint16Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("getInt32"), + v8::FunctionTemplate::New(V8DataView::getInt32Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("getUint32"), + v8::FunctionTemplate::New(V8DataView::getUint32Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("getFloat32"), + v8::FunctionTemplate::New(V8DataView::getFloat32Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("getFloat64"), + v8::FunctionTemplate::New(V8DataView::getFloat64Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("setInt8"), + v8::FunctionTemplate::New(V8DataView::setInt8Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("setUint8"), + v8::FunctionTemplate::New(V8DataView::setUint8Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("setInt16"), + v8::FunctionTemplate::New(V8DataView::setInt16Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("setUint16"), + v8::FunctionTemplate::New(V8DataView::setUint16Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("setInt32"), + v8::FunctionTemplate::New(V8DataView::setInt32Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("setUint32"), + v8::FunctionTemplate::New(V8DataView::setUint32Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("setFloat32"), + v8::FunctionTemplate::New(V8DataView::setFloat32Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("setFloat64"), + v8::FunctionTemplate::New(V8DataView::setFloat64Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + + + Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // V8DataView_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.cpp new file mode 100644 index 0000000..6d3fa47 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.cpp @@ -0,0 +1,71 @@ +#include "V8Float32Array.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8Float32Array::Tmpl; + + +v8::Handle<v8::Value> V8Float32Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8Float32ArrayPrivate* privData = V8DOM::toClassPtr<V8Float32ArrayPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->getLength()); +} +v8::Handle<v8::Value> V8Float32Array::getCallback(const v8::Arguments& args) { + if (args.Length() < 1) + throw V8Exception("Wrong number of arguments in get"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Float32ArrayPrivate* privData = V8DOM::toClassPtr<V8Float32ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + + float retVal = privData->nativeObj->get(localIndex); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8Float32Array::setCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in set"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Float32ArrayPrivate* privData = V8DOM::toClassPtr<V8Float32ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + float localValue = args[1]->ToNumber()->Value(); + + privData->nativeObj->set(localIndex, localValue); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8Float32Array::subarrayCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in subarray"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Float32ArrayPrivate* privData = V8DOM::toClassPtr<V8Float32ArrayPrivate >(self->GetInternalField(0)); + long localStart = args[0]->ToNumber()->Int32Value(); + long localEnd = args[1]->ToNumber()->Int32Value(); + + uscxml::Float32Array* retVal = new uscxml::Float32Array(privData->nativeObj->subarray(localStart, localEnd)); + v8::Handle<v8::Function> retCtor = V8Float32Array::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); + + struct V8Float32Array::V8Float32ArrayPrivate* retPrivData = new V8Float32Array::V8Float32ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + + retObj.MakeWeak(0, V8Float32Array::jsDestructor); + return retObj; + +} + +bool V8Float32Array::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.h new file mode 100644 index 0000000..ffb5fa7 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.h @@ -0,0 +1,91 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8Float32Array_h +#define V8Float32Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include "string" +#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8Float32Array { +public: + struct V8Float32ArrayPrivate { + V8DOM* dom; + uscxml::Float32Array* nativeObj; + }; + + V8_DESTRUCTOR(V8Float32ArrayPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + static v8::Handle<v8::Value> getCallback(const v8::Arguments&); + static v8::Handle<v8::Value> setCallback(const v8::Arguments&); + static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&); + + static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + + 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("Float32Array")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + (void)prototype; // surpress unused warnings + + instance->SetInternalFieldCount(1); + + instance->SetAccessor(v8::String::NewSymbol("length"), V8Float32Array::lengthAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + + prototype->Set(v8::String::NewSymbol("get"), + v8::FunctionTemplate::New(V8Float32Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Float32Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Float32Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Float32Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("subarray"), + v8::FunctionTemplate::New(V8Float32Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + + tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + + Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // V8Float32Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.cpp new file mode 100644 index 0000000..3dc69d0 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.cpp @@ -0,0 +1,71 @@ +#include "V8Float64Array.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8Float64Array::Tmpl; + + +v8::Handle<v8::Value> V8Float64Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8Float64ArrayPrivate* privData = V8DOM::toClassPtr<V8Float64ArrayPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->getLength()); +} +v8::Handle<v8::Value> V8Float64Array::getCallback(const v8::Arguments& args) { + if (args.Length() < 1) + throw V8Exception("Wrong number of arguments in get"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Float64ArrayPrivate* privData = V8DOM::toClassPtr<V8Float64ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + + double retVal = privData->nativeObj->get(localIndex); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8Float64Array::setCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in set"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Float64ArrayPrivate* privData = V8DOM::toClassPtr<V8Float64ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + double localValue = args[1]->ToNumber()->Value(); + + privData->nativeObj->set(localIndex, localValue); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8Float64Array::subarrayCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in subarray"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Float64ArrayPrivate* privData = V8DOM::toClassPtr<V8Float64ArrayPrivate >(self->GetInternalField(0)); + long localStart = args[0]->ToNumber()->Int32Value(); + long localEnd = args[1]->ToNumber()->Int32Value(); + + uscxml::Float64Array* retVal = new uscxml::Float64Array(privData->nativeObj->subarray(localStart, localEnd)); + v8::Handle<v8::Function> retCtor = V8Float64Array::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); + + struct V8Float64Array::V8Float64ArrayPrivate* retPrivData = new V8Float64Array::V8Float64ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + + retObj.MakeWeak(0, V8Float64Array::jsDestructor); + return retObj; + +} + +bool V8Float64Array::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.h new file mode 100644 index 0000000..8537a09 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.h @@ -0,0 +1,91 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8Float64Array_h +#define V8Float64Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include "string" +#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8Float64Array { +public: + struct V8Float64ArrayPrivate { + V8DOM* dom; + uscxml::Float64Array* nativeObj; + }; + + V8_DESTRUCTOR(V8Float64ArrayPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + static v8::Handle<v8::Value> getCallback(const v8::Arguments&); + static v8::Handle<v8::Value> setCallback(const v8::Arguments&); + static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&); + + static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + + 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("Float64Array")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + (void)prototype; // surpress unused warnings + + instance->SetInternalFieldCount(1); + + instance->SetAccessor(v8::String::NewSymbol("length"), V8Float64Array::lengthAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + + prototype->Set(v8::String::NewSymbol("get"), + v8::FunctionTemplate::New(V8Float64Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Float64Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Float64Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Float64Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("subarray"), + v8::FunctionTemplate::New(V8Float64Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + + tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + + Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // V8Float64Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.cpp new file mode 100644 index 0000000..ba268da --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.cpp @@ -0,0 +1,71 @@ +#include "V8Int16Array.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8Int16Array::Tmpl; + + +v8::Handle<v8::Value> V8Int16Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8Int16ArrayPrivate* privData = V8DOM::toClassPtr<V8Int16ArrayPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->getLength()); +} +v8::Handle<v8::Value> V8Int16Array::getCallback(const v8::Arguments& args) { + if (args.Length() < 1) + throw V8Exception("Wrong number of arguments in get"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Int16ArrayPrivate* privData = V8DOM::toClassPtr<V8Int16ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + + short retVal = privData->nativeObj->get(localIndex); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8Int16Array::setCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in set"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Int16ArrayPrivate* privData = V8DOM::toClassPtr<V8Int16ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + short localValue = args[1]->ToNumber()->Int32Value(); + + privData->nativeObj->set(localIndex, localValue); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8Int16Array::subarrayCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in subarray"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Int16ArrayPrivate* privData = V8DOM::toClassPtr<V8Int16ArrayPrivate >(self->GetInternalField(0)); + long localStart = args[0]->ToNumber()->Int32Value(); + long localEnd = args[1]->ToNumber()->Int32Value(); + + uscxml::Int16Array* retVal = new uscxml::Int16Array(privData->nativeObj->subarray(localStart, localEnd)); + v8::Handle<v8::Function> retCtor = V8Int16Array::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); + + struct V8Int16Array::V8Int16ArrayPrivate* retPrivData = new V8Int16Array::V8Int16ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + + retObj.MakeWeak(0, V8Int16Array::jsDestructor); + return retObj; + +} + +bool V8Int16Array::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.h new file mode 100644 index 0000000..e221cdd --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.h @@ -0,0 +1,91 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8Int16Array_h +#define V8Int16Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include "string" +#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8Int16Array { +public: + struct V8Int16ArrayPrivate { + V8DOM* dom; + uscxml::Int16Array* nativeObj; + }; + + V8_DESTRUCTOR(V8Int16ArrayPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + static v8::Handle<v8::Value> getCallback(const v8::Arguments&); + static v8::Handle<v8::Value> setCallback(const v8::Arguments&); + static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&); + + static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + + 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("Int16Array")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + (void)prototype; // surpress unused warnings + + instance->SetInternalFieldCount(1); + + instance->SetAccessor(v8::String::NewSymbol("length"), V8Int16Array::lengthAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + + prototype->Set(v8::String::NewSymbol("get"), + v8::FunctionTemplate::New(V8Int16Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Int16Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Int16Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Int16Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("subarray"), + v8::FunctionTemplate::New(V8Int16Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + + tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + + Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // V8Int16Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.cpp new file mode 100644 index 0000000..5d00d46 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.cpp @@ -0,0 +1,71 @@ +#include "V8Int32Array.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8Int32Array::Tmpl; + + +v8::Handle<v8::Value> V8Int32Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8Int32ArrayPrivate* privData = V8DOM::toClassPtr<V8Int32ArrayPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->getLength()); +} +v8::Handle<v8::Value> V8Int32Array::getCallback(const v8::Arguments& args) { + if (args.Length() < 1) + throw V8Exception("Wrong number of arguments in get"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Int32ArrayPrivate* privData = V8DOM::toClassPtr<V8Int32ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + + long retVal = privData->nativeObj->get(localIndex); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8Int32Array::setCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in set"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Int32ArrayPrivate* privData = V8DOM::toClassPtr<V8Int32ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + long localValue = args[1]->ToNumber()->Int32Value(); + + privData->nativeObj->set(localIndex, localValue); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8Int32Array::subarrayCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in subarray"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Int32ArrayPrivate* privData = V8DOM::toClassPtr<V8Int32ArrayPrivate >(self->GetInternalField(0)); + long localStart = args[0]->ToNumber()->Int32Value(); + long localEnd = args[1]->ToNumber()->Int32Value(); + + uscxml::Int32Array* retVal = new uscxml::Int32Array(privData->nativeObj->subarray(localStart, localEnd)); + v8::Handle<v8::Function> retCtor = V8Int32Array::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); + + struct V8Int32Array::V8Int32ArrayPrivate* retPrivData = new V8Int32Array::V8Int32ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + + retObj.MakeWeak(0, V8Int32Array::jsDestructor); + return retObj; + +} + +bool V8Int32Array::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.h new file mode 100644 index 0000000..892b666 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.h @@ -0,0 +1,91 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8Int32Array_h +#define V8Int32Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include "string" +#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8Int32Array { +public: + struct V8Int32ArrayPrivate { + V8DOM* dom; + uscxml::Int32Array* nativeObj; + }; + + V8_DESTRUCTOR(V8Int32ArrayPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + static v8::Handle<v8::Value> getCallback(const v8::Arguments&); + static v8::Handle<v8::Value> setCallback(const v8::Arguments&); + static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&); + + static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + + 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("Int32Array")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + (void)prototype; // surpress unused warnings + + instance->SetInternalFieldCount(1); + + instance->SetAccessor(v8::String::NewSymbol("length"), V8Int32Array::lengthAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + + prototype->Set(v8::String::NewSymbol("get"), + v8::FunctionTemplate::New(V8Int32Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Int32Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Int32Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Int32Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("subarray"), + v8::FunctionTemplate::New(V8Int32Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + + tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + + Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // V8Int32Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.cpp new file mode 100644 index 0000000..fd64a8c --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.cpp @@ -0,0 +1,71 @@ +#include "V8Int8Array.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8Int8Array::Tmpl; + + +v8::Handle<v8::Value> V8Int8Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8Int8ArrayPrivate* privData = V8DOM::toClassPtr<V8Int8ArrayPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->getLength()); +} +v8::Handle<v8::Value> V8Int8Array::getCallback(const v8::Arguments& args) { + if (args.Length() < 1) + throw V8Exception("Wrong number of arguments in get"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Int8ArrayPrivate* privData = V8DOM::toClassPtr<V8Int8ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + + char retVal = privData->nativeObj->get(localIndex); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8Int8Array::setCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in set"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Int8ArrayPrivate* privData = V8DOM::toClassPtr<V8Int8ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + char localValue = args[1]->ToNumber()->Int32Value(); + + privData->nativeObj->set(localIndex, localValue); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8Int8Array::subarrayCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in subarray"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Int8ArrayPrivate* privData = V8DOM::toClassPtr<V8Int8ArrayPrivate >(self->GetInternalField(0)); + long localStart = args[0]->ToNumber()->Int32Value(); + long localEnd = args[1]->ToNumber()->Int32Value(); + + uscxml::Int8Array* retVal = new uscxml::Int8Array(privData->nativeObj->subarray(localStart, localEnd)); + v8::Handle<v8::Function> retCtor = V8Int8Array::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); + + struct V8Int8Array::V8Int8ArrayPrivate* retPrivData = new V8Int8Array::V8Int8ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + + retObj.MakeWeak(0, V8Int8Array::jsDestructor); + return retObj; + +} + +bool V8Int8Array::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h new file mode 100644 index 0000000..bcfcc3c --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h @@ -0,0 +1,91 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8Int8Array_h +#define V8Int8Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include "string" +#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8Int8Array { +public: + struct V8Int8ArrayPrivate { + V8DOM* dom; + uscxml::Int8Array* nativeObj; + }; + + V8_DESTRUCTOR(V8Int8ArrayPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + static v8::Handle<v8::Value> getCallback(const v8::Arguments&); + static v8::Handle<v8::Value> setCallback(const v8::Arguments&); + static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&); + + static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + + 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("Int8Array")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + (void)prototype; // surpress unused warnings + + instance->SetInternalFieldCount(1); + + instance->SetAccessor(v8::String::NewSymbol("length"), V8Int8Array::lengthAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + + prototype->Set(v8::String::NewSymbol("get"), + v8::FunctionTemplate::New(V8Int8Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Int8Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Int8Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Int8Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("subarray"), + v8::FunctionTemplate::New(V8Int8Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + + tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + + Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // V8Int8Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.cpp new file mode 100644 index 0000000..c1d94d7 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.cpp @@ -0,0 +1,71 @@ +#include "V8Uint16Array.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8Uint16Array::Tmpl; + + +v8::Handle<v8::Value> V8Uint16Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8Uint16ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint16ArrayPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->getLength()); +} +v8::Handle<v8::Value> V8Uint16Array::getCallback(const v8::Arguments& args) { + if (args.Length() < 1) + throw V8Exception("Wrong number of arguments in get"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Uint16ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint16ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + + unsigned short retVal = privData->nativeObj->get(localIndex); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8Uint16Array::setCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in set"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Uint16ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint16ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + unsigned short localValue = args[1]->ToNumber()->Uint32Value(); + + privData->nativeObj->set(localIndex, localValue); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8Uint16Array::subarrayCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in subarray"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Uint16ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint16ArrayPrivate >(self->GetInternalField(0)); + long localStart = args[0]->ToNumber()->Int32Value(); + long localEnd = args[1]->ToNumber()->Int32Value(); + + uscxml::Uint16Array* retVal = new uscxml::Uint16Array(privData->nativeObj->subarray(localStart, localEnd)); + v8::Handle<v8::Function> retCtor = V8Uint16Array::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); + + struct V8Uint16Array::V8Uint16ArrayPrivate* retPrivData = new V8Uint16Array::V8Uint16ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + + retObj.MakeWeak(0, V8Uint16Array::jsDestructor); + return retObj; + +} + +bool V8Uint16Array::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.h new file mode 100644 index 0000000..e4d237d --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.h @@ -0,0 +1,91 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8Uint16Array_h +#define V8Uint16Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include "string" +#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8Uint16Array { +public: + struct V8Uint16ArrayPrivate { + V8DOM* dom; + uscxml::Uint16Array* nativeObj; + }; + + V8_DESTRUCTOR(V8Uint16ArrayPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + static v8::Handle<v8::Value> getCallback(const v8::Arguments&); + static v8::Handle<v8::Value> setCallback(const v8::Arguments&); + static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&); + + static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + + 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("Uint16Array")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + (void)prototype; // surpress unused warnings + + instance->SetInternalFieldCount(1); + + instance->SetAccessor(v8::String::NewSymbol("length"), V8Uint16Array::lengthAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + + prototype->Set(v8::String::NewSymbol("get"), + v8::FunctionTemplate::New(V8Uint16Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Uint16Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Uint16Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Uint16Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("subarray"), + v8::FunctionTemplate::New(V8Uint16Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + + tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + + Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // V8Uint16Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.cpp new file mode 100644 index 0000000..54b05aa --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.cpp @@ -0,0 +1,71 @@ +#include "V8Uint32Array.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8Uint32Array::Tmpl; + + +v8::Handle<v8::Value> V8Uint32Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8Uint32ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint32ArrayPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->getLength()); +} +v8::Handle<v8::Value> V8Uint32Array::getCallback(const v8::Arguments& args) { + if (args.Length() < 1) + throw V8Exception("Wrong number of arguments in get"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Uint32ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint32ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + + unsigned long retVal = privData->nativeObj->get(localIndex); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8Uint32Array::setCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in set"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Uint32ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint32ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + unsigned long localValue = args[1]->ToNumber()->Uint32Value(); + + privData->nativeObj->set(localIndex, localValue); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8Uint32Array::subarrayCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in subarray"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Uint32ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint32ArrayPrivate >(self->GetInternalField(0)); + long localStart = args[0]->ToNumber()->Int32Value(); + long localEnd = args[1]->ToNumber()->Int32Value(); + + uscxml::Uint32Array* retVal = new uscxml::Uint32Array(privData->nativeObj->subarray(localStart, localEnd)); + v8::Handle<v8::Function> retCtor = V8Uint32Array::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); + + struct V8Uint32Array::V8Uint32ArrayPrivate* retPrivData = new V8Uint32Array::V8Uint32ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + + retObj.MakeWeak(0, V8Uint32Array::jsDestructor); + return retObj; + +} + +bool V8Uint32Array::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.h new file mode 100644 index 0000000..09098aa --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.h @@ -0,0 +1,91 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8Uint32Array_h +#define V8Uint32Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include "string" +#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8Uint32Array { +public: + struct V8Uint32ArrayPrivate { + V8DOM* dom; + uscxml::Uint32Array* nativeObj; + }; + + V8_DESTRUCTOR(V8Uint32ArrayPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + static v8::Handle<v8::Value> getCallback(const v8::Arguments&); + static v8::Handle<v8::Value> setCallback(const v8::Arguments&); + static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&); + + static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + + 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("Uint32Array")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + (void)prototype; // surpress unused warnings + + instance->SetInternalFieldCount(1); + + instance->SetAccessor(v8::String::NewSymbol("length"), V8Uint32Array::lengthAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + + prototype->Set(v8::String::NewSymbol("get"), + v8::FunctionTemplate::New(V8Uint32Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Uint32Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Uint32Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Uint32Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("subarray"), + v8::FunctionTemplate::New(V8Uint32Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + + tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + + Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // V8Uint32Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.cpp new file mode 100644 index 0000000..cc13bf0 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.cpp @@ -0,0 +1,71 @@ +#include "V8Uint8Array.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8Uint8Array::Tmpl; + + +v8::Handle<v8::Value> V8Uint8Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8Uint8ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ArrayPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->getLength()); +} +v8::Handle<v8::Value> V8Uint8Array::getCallback(const v8::Arguments& args) { + if (args.Length() < 1) + throw V8Exception("Wrong number of arguments in get"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Uint8ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + + char retVal = privData->nativeObj->get(localIndex); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8Uint8Array::setCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in set"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Uint8ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + unsigned char localValue = args[1]->ToNumber()->Uint32Value(); + + privData->nativeObj->set(localIndex, localValue); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8Uint8Array::subarrayCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in subarray"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Uint8ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ArrayPrivate >(self->GetInternalField(0)); + long localStart = args[0]->ToNumber()->Int32Value(); + long localEnd = args[1]->ToNumber()->Int32Value(); + + uscxml::Uint8Array* retVal = new uscxml::Uint8Array(privData->nativeObj->subarray(localStart, localEnd)); + v8::Handle<v8::Function> retCtor = V8Uint8Array::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); + + struct V8Uint8Array::V8Uint8ArrayPrivate* retPrivData = new V8Uint8Array::V8Uint8ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + + retObj.MakeWeak(0, V8Uint8Array::jsDestructor); + return retObj; + +} + +bool V8Uint8Array::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.h new file mode 100644 index 0000000..e59d8a6 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.h @@ -0,0 +1,91 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8Uint8Array_h +#define V8Uint8Array_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include "string" +#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8Uint8Array { +public: + struct V8Uint8ArrayPrivate { + V8DOM* dom; + uscxml::Uint8Array* nativeObj; + }; + + V8_DESTRUCTOR(V8Uint8ArrayPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + static v8::Handle<v8::Value> getCallback(const v8::Arguments&); + static v8::Handle<v8::Value> setCallback(const v8::Arguments&); + static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&); + + static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + + 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("Uint8Array")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + (void)prototype; // surpress unused warnings + + instance->SetInternalFieldCount(1); + + instance->SetAccessor(v8::String::NewSymbol("length"), V8Uint8Array::lengthAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + + prototype->Set(v8::String::NewSymbol("get"), + v8::FunctionTemplate::New(V8Uint8Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Uint8Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Uint8Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Uint8Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("subarray"), + v8::FunctionTemplate::New(V8Uint8Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + + tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + + Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // V8Uint8Array_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.cpp new file mode 100644 index 0000000..64c8d95 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.cpp @@ -0,0 +1,71 @@ +#include "V8Uint8ClampedArray.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8Uint8ClampedArray::Tmpl; + + +v8::Handle<v8::Value> V8Uint8ClampedArray::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8Uint8ClampedArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ClampedArrayPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->getLength()); +} +v8::Handle<v8::Value> V8Uint8ClampedArray::getCallback(const v8::Arguments& args) { + if (args.Length() < 1) + throw V8Exception("Wrong number of arguments in get"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Uint8ClampedArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ClampedArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + + char retVal = privData->nativeObj->get(localIndex); + + return v8::Number::New(retVal); +} + +v8::Handle<v8::Value> V8Uint8ClampedArray::setCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in set"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Uint8ClampedArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ClampedArrayPrivate >(self->GetInternalField(0)); + unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); + unsigned char localValue = args[1]->ToNumber()->Uint32Value(); + + privData->nativeObj->set(localIndex, localValue); + + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8Uint8ClampedArray::subarrayCallback(const v8::Arguments& args) { + if (args.Length() < 2) + throw V8Exception("Wrong number of arguments in subarray"); + + v8::Local<v8::Object> self = args.Holder(); + struct V8Uint8ClampedArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ClampedArrayPrivate >(self->GetInternalField(0)); + long localStart = args[0]->ToNumber()->Int32Value(); + long localEnd = args[1]->ToNumber()->Int32Value(); + + uscxml::Uint8ClampedArray* retVal = new uscxml::Uint8ClampedArray(privData->nativeObj->subarray(localStart, localEnd)); + v8::Handle<v8::Function> retCtor = V8Uint8ClampedArray::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); + + struct V8Uint8ClampedArray::V8Uint8ClampedArrayPrivate* retPrivData = new V8Uint8ClampedArray::V8Uint8ClampedArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + + retObj.MakeWeak(0, V8Uint8ClampedArray::jsDestructor); + return retObj; + +} + +bool V8Uint8ClampedArray::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.h new file mode 100644 index 0000000..37f9482 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.h @@ -0,0 +1,91 @@ +/* + This file is part of the Wrapper open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8Uint8ClampedArray_h +#define V8Uint8ClampedArray_h + +#include <string> +#include "../../TypedArray.h" +#include "DOM/Node.hpp" +#include "string" +#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8Uint8ClampedArray { +public: + struct V8Uint8ClampedArrayPrivate { + V8DOM* dom; + uscxml::Uint8ClampedArray* nativeObj; + }; + + V8_DESTRUCTOR(V8Uint8ClampedArrayPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + static v8::Handle<v8::Value> getCallback(const v8::Arguments&); + static v8::Handle<v8::Value> setCallback(const v8::Arguments&); + static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&); + + static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + + 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("Uint8ClampedArray")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + (void)prototype; // surpress unused warnings + + instance->SetInternalFieldCount(1); + + instance->SetAccessor(v8::String::NewSymbol("length"), V8Uint8ClampedArray::lengthAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + + prototype->Set(v8::String::NewSymbol("get"), + v8::FunctionTemplate::New(V8Uint8ClampedArray::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Uint8ClampedArray::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Uint8ClampedArray::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("set"), + v8::FunctionTemplate::New(V8Uint8ClampedArray::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + prototype->Set(v8::String::NewSymbol("subarray"), + v8::FunctionTemplate::New(V8Uint8ClampedArray::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); + + tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + + Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // V8Uint8ClampedArray_h |