diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-02 12:38:13 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-02 12:38:13 (GMT) |
commit | a874a181add7b292e52140f8c753f663a4cb5a87 (patch) | |
tree | 1b8958ba2abceef58901b3f90f1f05b44321deab /src/uscxml/plugins/datamodel/ecmascript/v8 | |
parent | 9caba3540b4d64a5277040f43bdaabde7ba227a0 (diff) | |
download | uscxml-a874a181add7b292e52140f8c753f663a4cb5a87.zip uscxml-a874a181add7b292e52140f8c753f663a4cb5a87.tar.gz uscxml-a874a181add7b292e52140f8c753f663a4cb5a87.tar.bz2 |
Optional 2nd argument for TypedArray.subarray and more tests
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript/v8')
9 files changed, 153 insertions, 0 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.cpp index 1fe74e6..2e314b4 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.cpp @@ -185,6 +185,23 @@ v8::Handle<v8::Value> V8Float32Array::subarrayCallback(const v8::Arguments& args retObj.MakeWeak(0, V8Float32Array::jsDestructor); return retObj; + } else if (args.Length() == 1 && + args[0]->IsInt32()) { + long localStart = args[0]->ToNumber()->Int32Value(); + + uscxml::Float32Array* retVal = new uscxml::Float32Array(privData->nativeObj->subarray(localStart)); + 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; + } throw V8Exception("Parameter mismatch while calling subarray"); return v8::Undefined(); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.cpp index 92d468d..a08fdc9 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.cpp @@ -185,6 +185,23 @@ v8::Handle<v8::Value> V8Float64Array::subarrayCallback(const v8::Arguments& args retObj.MakeWeak(0, V8Float64Array::jsDestructor); return retObj; + } else if (args.Length() == 1 && + args[0]->IsInt32()) { + long localStart = args[0]->ToNumber()->Int32Value(); + + uscxml::Float64Array* retVal = new uscxml::Float64Array(privData->nativeObj->subarray(localStart)); + 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; + } throw V8Exception("Parameter mismatch while calling subarray"); return v8::Undefined(); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.cpp index d8f63f2..44eebb7 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.cpp @@ -185,6 +185,23 @@ v8::Handle<v8::Value> V8Int16Array::subarrayCallback(const v8::Arguments& args) retObj.MakeWeak(0, V8Int16Array::jsDestructor); return retObj; + } else if (args.Length() == 1 && + args[0]->IsInt32()) { + long localStart = args[0]->ToNumber()->Int32Value(); + + uscxml::Int16Array* retVal = new uscxml::Int16Array(privData->nativeObj->subarray(localStart)); + 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; + } throw V8Exception("Parameter mismatch while calling subarray"); return v8::Undefined(); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.cpp index 5c2d130..7eeaef0 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.cpp @@ -185,6 +185,23 @@ v8::Handle<v8::Value> V8Int32Array::subarrayCallback(const v8::Arguments& args) retObj.MakeWeak(0, V8Int32Array::jsDestructor); return retObj; + } else if (args.Length() == 1 && + args[0]->IsInt32()) { + long localStart = args[0]->ToNumber()->Int32Value(); + + uscxml::Int32Array* retVal = new uscxml::Int32Array(privData->nativeObj->subarray(localStart)); + 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; + } throw V8Exception("Parameter mismatch while calling subarray"); return v8::Undefined(); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.cpp index d78be76..f9b5fdb 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.cpp @@ -185,6 +185,23 @@ v8::Handle<v8::Value> V8Int8Array::subarrayCallback(const v8::Arguments& args) { retObj.MakeWeak(0, V8Int8Array::jsDestructor); return retObj; + } else if (args.Length() == 1 && + args[0]->IsInt32()) { + long localStart = args[0]->ToNumber()->Int32Value(); + + uscxml::Int8Array* retVal = new uscxml::Int8Array(privData->nativeObj->subarray(localStart)); + 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; + } throw V8Exception("Parameter mismatch while calling subarray"); return v8::Undefined(); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.cpp index 4c84081..f39c4ac 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.cpp @@ -185,6 +185,23 @@ v8::Handle<v8::Value> V8Uint16Array::subarrayCallback(const v8::Arguments& args) retObj.MakeWeak(0, V8Uint16Array::jsDestructor); return retObj; + } else if (args.Length() == 1 && + args[0]->IsInt32()) { + long localStart = args[0]->ToNumber()->Int32Value(); + + uscxml::Uint16Array* retVal = new uscxml::Uint16Array(privData->nativeObj->subarray(localStart)); + 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; + } throw V8Exception("Parameter mismatch while calling subarray"); return v8::Undefined(); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.cpp index da3fdc2..4054d5e 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.cpp @@ -185,6 +185,23 @@ v8::Handle<v8::Value> V8Uint32Array::subarrayCallback(const v8::Arguments& args) retObj.MakeWeak(0, V8Uint32Array::jsDestructor); return retObj; + } else if (args.Length() == 1 && + args[0]->IsInt32()) { + long localStart = args[0]->ToNumber()->Int32Value(); + + uscxml::Uint32Array* retVal = new uscxml::Uint32Array(privData->nativeObj->subarray(localStart)); + 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; + } throw V8Exception("Parameter mismatch while calling subarray"); return v8::Undefined(); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.cpp index b2eafe5..9d387b6 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.cpp @@ -185,6 +185,23 @@ v8::Handle<v8::Value> V8Uint8Array::subarrayCallback(const v8::Arguments& args) retObj.MakeWeak(0, V8Uint8Array::jsDestructor); return retObj; + } else if (args.Length() == 1 && + args[0]->IsInt32()) { + long localStart = args[0]->ToNumber()->Int32Value(); + + uscxml::Uint8Array* retVal = new uscxml::Uint8Array(privData->nativeObj->subarray(localStart)); + 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; + } throw V8Exception("Parameter mismatch while calling subarray"); return v8::Undefined(); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.cpp index 206b755..be470fa 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.cpp @@ -185,6 +185,23 @@ v8::Handle<v8::Value> V8Uint8ClampedArray::subarrayCallback(const v8::Arguments& retObj.MakeWeak(0, V8Uint8ClampedArray::jsDestructor); return retObj; + } else if (args.Length() == 1 && + args[0]->IsInt32()) { + long localStart = args[0]->ToNumber()->Int32Value(); + + uscxml::Uint8ClampedArray* retVal = new uscxml::Uint8ClampedArray(privData->nativeObj->subarray(localStart)); + 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; + } throw V8Exception("Parameter mismatch while calling subarray"); return v8::Undefined(); |