JS Introduce typed arrays

This commit is contained in:
Sergey Mashkov
2015-05-07 21:26:03 +03:00
committed by Sergey Mashkov
parent a6bed4f623
commit 6366f966b7
11 changed files with 593 additions and 74 deletions
-12
View File
@@ -19,18 +19,6 @@ package org.w3c.dom
import java.util.AbstractList
import kotlin.js.splitWithRegex
native
public val window: Window = noImpl
native
public val document: Document = noImpl
native
public val localStorage: Storage = noImpl
native
public val sessionStorage: Storage = noImpl
private class HTMLCollectionListView(val collection: HTMLCollection) : AbstractList<HTMLElement>() {
override fun size(): Int = collection.length
@@ -97,7 +97,7 @@ native public trait WebGLRenderingContext {
fun bindFramebuffer(target: Int, framebuffer: WebGLFramebuffer?): Unit = noImpl
fun bindRenderbuffer(target: Int, renderbuffer: WebGLRenderbuffer?): Unit = noImpl
fun bindTexture(target: Int, texture: WebGLTexture?): Unit = noImpl
fun blendColor(red: dynamic, green: dynamic, blue: dynamic, alpha: dynamic): Unit = noImpl
fun blendColor(red: Float, green: Float, blue: Float, alpha: Float): Unit = noImpl
fun blendEquation(mode: Int): Unit = noImpl
fun blendEquationSeparate(modeRGB: Int, modeAlpha: Int): Unit = noImpl
fun blendFunc(sfactor: Int, dfactor: Int): Unit = noImpl
@@ -107,8 +107,8 @@ native public trait WebGLRenderingContext {
fun bufferSubData(target: Int, offset: Long, data: dynamic): Unit = noImpl
fun checkFramebufferStatus(target: Int): Int = noImpl
fun clear(mask: Int): Unit = noImpl
fun clearColor(red: dynamic, green: dynamic, blue: dynamic, alpha: dynamic): Unit = noImpl
fun clearDepth(depth: dynamic): Unit = noImpl
fun clearColor(red: Float, green: Float, blue: Float, alpha: Float): Unit = noImpl
fun clearDepth(depth: Float): Unit = noImpl
fun clearStencil(s: Int): Unit = noImpl
fun colorMask(red: Boolean, green: Boolean, blue: Boolean, alpha: Boolean): Unit = noImpl
fun compileShader(shader: WebGLShader?): Unit = noImpl
@@ -131,7 +131,7 @@ native public trait WebGLRenderingContext {
fun deleteTexture(texture: WebGLTexture?): Unit = noImpl
fun depthFunc(func: Int): Unit = noImpl
fun depthMask(flag: Boolean): Unit = noImpl
fun depthRange(zNear: dynamic, zFar: dynamic): Unit = noImpl
fun depthRange(zNear: Float, zFar: Float): Unit = noImpl
fun detachShader(program: WebGLProgram?, shader: WebGLShader?): Unit = noImpl
fun disable(cap: Int): Unit = noImpl
fun disableVertexAttribArray(index: Int): Unit = noImpl
@@ -173,13 +173,13 @@ native public trait WebGLRenderingContext {
fun isRenderbuffer(renderbuffer: WebGLRenderbuffer?): Boolean = noImpl
fun isShader(shader: WebGLShader?): Boolean = noImpl
fun isTexture(texture: WebGLTexture?): Boolean = noImpl
fun lineWidth(width: dynamic): Unit = noImpl
fun lineWidth(width: Float): Unit = noImpl
fun linkProgram(program: WebGLProgram?): Unit = noImpl
fun pixelStorei(pname: Int, param: Int): Unit = noImpl
fun polygonOffset(factor: dynamic, units: dynamic): Unit = noImpl
fun polygonOffset(factor: Float, units: Float): Unit = noImpl
fun readPixels(x: Int, y: Int, width: Int, height: Int, format: Int, type: Int, pixels: dynamic): Unit = noImpl
fun renderbufferStorage(target: Int, internalformat: Int, width: Int, height: Int): Unit = noImpl
fun sampleCoverage(value: dynamic, invert: Boolean): Unit = noImpl
fun sampleCoverage(value: Float, invert: Boolean): Unit = noImpl
fun scissor(x: Int, y: Int, width: Int, height: Int): Unit = noImpl
fun shaderSource(shader: WebGLShader?, source: String): Unit = noImpl
fun stencilFunc(func: Int, ref: Int, mask: Int): Unit = noImpl
@@ -190,53 +190,53 @@ native public trait WebGLRenderingContext {
fun stencilOpSeparate(face: Int, fail: Int, zfail: Int, zpass: Int): Unit = noImpl
fun texImage2D(target: Int, level: Int, internalformat: Int, width: Int, height: Int, border: Int, format: Int, type: Int, pixels: dynamic): Unit = noImpl
fun texImage2D(target: Int, level: Int, internalformat: Int, format: Int, type: Int, source: dynamic): Unit = noImpl
fun texParameterf(target: Int, pname: Int, param: dynamic): Unit = noImpl
fun texParameterf(target: Int, pname: Int, param: Float): Unit = noImpl
fun texParameteri(target: Int, pname: Int, param: Int): Unit = noImpl
fun texSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, width: Int, height: Int, format: Int, type: Int, pixels: dynamic): Unit = noImpl
fun texSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, format: Int, type: Int, source: dynamic): Unit = noImpl
fun uniform1f(location: WebGLUniformLocation?, x: dynamic): Unit = noImpl
fun uniform1fv(location: WebGLUniformLocation?, v: dynamic): Unit = noImpl
fun uniform1f(location: WebGLUniformLocation?, x: Float): Unit = noImpl
fun uniform1fv(location: WebGLUniformLocation?, v: Float32Array): Unit = noImpl
fun uniform1fv(location: WebGLUniformLocation?, v: Any): Unit = noImpl
fun uniform1i(location: WebGLUniformLocation?, x: Int): Unit = noImpl
fun uniform1iv(location: WebGLUniformLocation?, v: dynamic): Unit = noImpl
fun uniform1iv(location: WebGLUniformLocation?, v: Int32Array): Unit = noImpl
fun uniform1iv(location: WebGLUniformLocation?, v: Any): Unit = noImpl
fun uniform2f(location: WebGLUniformLocation?, x: dynamic, y: dynamic): Unit = noImpl
fun uniform2fv(location: WebGLUniformLocation?, v: dynamic): Unit = noImpl
fun uniform2f(location: WebGLUniformLocation?, x: Float, y: Float): Unit = noImpl
fun uniform2fv(location: WebGLUniformLocation?, v: Float32Array): Unit = noImpl
fun uniform2fv(location: WebGLUniformLocation?, v: Any): Unit = noImpl
fun uniform2i(location: WebGLUniformLocation?, x: Int, y: Int): Unit = noImpl
fun uniform2iv(location: WebGLUniformLocation?, v: dynamic): Unit = noImpl
fun uniform2iv(location: WebGLUniformLocation?, v: Int32Array): Unit = noImpl
fun uniform2iv(location: WebGLUniformLocation?, v: Any): Unit = noImpl
fun uniform3f(location: WebGLUniformLocation?, x: dynamic, y: dynamic, z: dynamic): Unit = noImpl
fun uniform3fv(location: WebGLUniformLocation?, v: dynamic): Unit = noImpl
fun uniform3f(location: WebGLUniformLocation?, x: Float, y: Float, z: Float): Unit = noImpl
fun uniform3fv(location: WebGLUniformLocation?, v: Float32Array): Unit = noImpl
fun uniform3fv(location: WebGLUniformLocation?, v: Any): Unit = noImpl
fun uniform3i(location: WebGLUniformLocation?, x: Int, y: Int, z: Int): Unit = noImpl
fun uniform3iv(location: WebGLUniformLocation?, v: dynamic): Unit = noImpl
fun uniform3iv(location: WebGLUniformLocation?, v: Int32Array): Unit = noImpl
fun uniform3iv(location: WebGLUniformLocation?, v: Any): Unit = noImpl
fun uniform4f(location: WebGLUniformLocation?, x: dynamic, y: dynamic, z: dynamic, w: dynamic): Unit = noImpl
fun uniform4fv(location: WebGLUniformLocation?, v: dynamic): Unit = noImpl
fun uniform4f(location: WebGLUniformLocation?, x: Float, y: Float, z: Float, w: Float): Unit = noImpl
fun uniform4fv(location: WebGLUniformLocation?, v: Float32Array): Unit = noImpl
fun uniform4fv(location: WebGLUniformLocation?, v: Any): Unit = noImpl
fun uniform4i(location: WebGLUniformLocation?, x: Int, y: Int, z: Int, w: Int): Unit = noImpl
fun uniform4iv(location: WebGLUniformLocation?, v: dynamic): Unit = noImpl
fun uniform4iv(location: WebGLUniformLocation?, v: Int32Array): Unit = noImpl
fun uniform4iv(location: WebGLUniformLocation?, v: Any): Unit = noImpl
fun uniformMatrix2fv(location: WebGLUniformLocation?, transpose: Boolean, value: dynamic): Unit = noImpl
fun uniformMatrix2fv(location: WebGLUniformLocation?, transpose: Boolean, value: Float32Array): Unit = noImpl
fun uniformMatrix2fv(location: WebGLUniformLocation?, transpose: Boolean, value: Any): Unit = noImpl
fun uniformMatrix3fv(location: WebGLUniformLocation?, transpose: Boolean, value: dynamic): Unit = noImpl
fun uniformMatrix3fv(location: WebGLUniformLocation?, transpose: Boolean, value: Float32Array): Unit = noImpl
fun uniformMatrix3fv(location: WebGLUniformLocation?, transpose: Boolean, value: Any): Unit = noImpl
fun uniformMatrix4fv(location: WebGLUniformLocation?, transpose: Boolean, value: dynamic): Unit = noImpl
fun uniformMatrix4fv(location: WebGLUniformLocation?, transpose: Boolean, value: Float32Array): Unit = noImpl
fun uniformMatrix4fv(location: WebGLUniformLocation?, transpose: Boolean, value: Any): Unit = noImpl
fun useProgram(program: WebGLProgram?): Unit = noImpl
fun validateProgram(program: WebGLProgram?): Unit = noImpl
fun vertexAttrib1f(indx: Int, x: dynamic): Unit = noImpl
fun vertexAttrib1fv(indx: Int, values: dynamic): Unit = noImpl
fun vertexAttrib1f(indx: Int, x: Float): Unit = noImpl
fun vertexAttrib1fv(indx: Int, values: Float32Array): Unit = noImpl
fun vertexAttrib1fv(indx: Int, values: Any): Unit = noImpl
fun vertexAttrib2f(indx: Int, x: dynamic, y: dynamic): Unit = noImpl
fun vertexAttrib2fv(indx: Int, values: dynamic): Unit = noImpl
fun vertexAttrib2f(indx: Int, x: Float, y: Float): Unit = noImpl
fun vertexAttrib2fv(indx: Int, values: Float32Array): Unit = noImpl
fun vertexAttrib2fv(indx: Int, values: Any): Unit = noImpl
fun vertexAttrib3f(indx: Int, x: dynamic, y: dynamic, z: dynamic): Unit = noImpl
fun vertexAttrib3fv(indx: Int, values: dynamic): Unit = noImpl
fun vertexAttrib3f(indx: Int, x: Float, y: Float, z: Float): Unit = noImpl
fun vertexAttrib3fv(indx: Int, values: Float32Array): Unit = noImpl
fun vertexAttrib3fv(indx: Int, values: Any): Unit = noImpl
fun vertexAttrib4f(indx: Int, x: dynamic, y: dynamic, z: dynamic, w: dynamic): Unit = noImpl
fun vertexAttrib4fv(indx: Int, values: dynamic): Unit = noImpl
fun vertexAttrib4f(indx: Int, x: Float, y: Float, z: Float, w: Float): Unit = noImpl
fun vertexAttrib4fv(indx: Int, values: Float32Array): Unit = noImpl
fun vertexAttrib4fv(indx: Int, values: Any): Unit = noImpl
fun vertexAttribPointer(indx: Int, size: Int, type: Int, normalized: Boolean, stride: Int, offset: Long): Unit = noImpl
fun viewport(x: Int, y: Int, width: Int, height: Int): Unit = noImpl
@@ -552,3 +552,254 @@ native public open class WebGLContextEventInit : EventInit() {
var statusMessage: String
}
native public open class ArrayBuffer(length: Int) {
var byteLength: Int
get() = noImpl
set(value) = noImpl
fun slice(begin: Int, end: Int = noImpl): ArrayBuffer = noImpl
}
native public open class Int8Array(length: Int) {
var length: Int
get() = noImpl
set(value) = noImpl
var buffer: ArrayBuffer
get() = noImpl
set(value) = noImpl
var byteOffset: Int
get() = noImpl
set(value) = noImpl
var byteLength: Int
get() = noImpl
set(value) = noImpl
fun get(index: Int): Byte = noImpl
fun set(index: Int, value: Byte): Unit = noImpl
fun set(array: Int8Array, offset: Int = noImpl): Unit = noImpl
fun set(array: dynamic, offset: Int = noImpl): Unit = noImpl
fun subarray(start: Int, end: Int): Int8Array = noImpl
companion object {
val BYTES_PER_ELEMENT: Int = 1
}
}
native public open class Uint8Array(length: Int) {
var length: Int
get() = noImpl
set(value) = noImpl
var buffer: ArrayBuffer
get() = noImpl
set(value) = noImpl
var byteOffset: Int
get() = noImpl
set(value) = noImpl
var byteLength: Int
get() = noImpl
set(value) = noImpl
fun get(index: Int): Byte = noImpl
fun set(index: Int, value: Byte): Unit = noImpl
fun set(array: Uint8Array, offset: Int = noImpl): Unit = noImpl
fun set(array: dynamic, offset: Int = noImpl): Unit = noImpl
fun subarray(start: Int, end: Int): Uint8Array = noImpl
companion object {
val BYTES_PER_ELEMENT: Int = 1
}
}
native public open class Uint8ClampedArray(length: Int) {
var length: Int
get() = noImpl
set(value) = noImpl
var buffer: ArrayBuffer
get() = noImpl
set(value) = noImpl
var byteOffset: Int
get() = noImpl
set(value) = noImpl
var byteLength: Int
get() = noImpl
set(value) = noImpl
fun get(index: Int): Byte = noImpl
fun set(index: Int, value: Byte): Unit = noImpl
fun set(array: Uint8ClampedArray, offset: Int = noImpl): Unit = noImpl
fun set(array: dynamic, offset: Int = noImpl): Unit = noImpl
fun subarray(start: Int, end: Int): Uint8ClampedArray = noImpl
companion object {
val BYTES_PER_ELEMENT: Int = 1
}
}
native public open class Int16Array(length: Int) {
var length: Int
get() = noImpl
set(value) = noImpl
var buffer: ArrayBuffer
get() = noImpl
set(value) = noImpl
var byteOffset: Int
get() = noImpl
set(value) = noImpl
var byteLength: Int
get() = noImpl
set(value) = noImpl
fun get(index: Int): Short = noImpl
fun set(index: Int, value: Short): Unit = noImpl
fun set(array: Int16Array, offset: Int = noImpl): Unit = noImpl
fun set(array: dynamic, offset: Int = noImpl): Unit = noImpl
fun subarray(start: Int, end: Int): Int16Array = noImpl
companion object {
val BYTES_PER_ELEMENT: Int = 2
}
}
native public open class Uint16Array(length: Int) {
var length: Int
get() = noImpl
set(value) = noImpl
var buffer: ArrayBuffer
get() = noImpl
set(value) = noImpl
var byteOffset: Int
get() = noImpl
set(value) = noImpl
var byteLength: Int
get() = noImpl
set(value) = noImpl
fun get(index: Int): Short = noImpl
fun set(index: Int, value: Short): Unit = noImpl
fun set(array: Uint16Array, offset: Int = noImpl): Unit = noImpl
fun set(array: dynamic, offset: Int = noImpl): Unit = noImpl
fun subarray(start: Int, end: Int): Uint16Array = noImpl
companion object {
val BYTES_PER_ELEMENT: Int = 2
}
}
native public open class Int32Array(length: Int) {
var length: Int
get() = noImpl
set(value) = noImpl
var buffer: ArrayBuffer
get() = noImpl
set(value) = noImpl
var byteOffset: Int
get() = noImpl
set(value) = noImpl
var byteLength: Int
get() = noImpl
set(value) = noImpl
fun get(index: Int): Int = noImpl
fun set(index: Int, value: Int): Unit = noImpl
fun set(array: Int32Array, offset: Int = noImpl): Unit = noImpl
fun set(array: dynamic, offset: Int = noImpl): Unit = noImpl
fun subarray(start: Int, end: Int): Int32Array = noImpl
companion object {
val BYTES_PER_ELEMENT: Int = 4
}
}
native public open class Uint32Array(length: Int) {
var length: Int
get() = noImpl
set(value) = noImpl
var buffer: ArrayBuffer
get() = noImpl
set(value) = noImpl
var byteOffset: Int
get() = noImpl
set(value) = noImpl
var byteLength: Int
get() = noImpl
set(value) = noImpl
fun get(index: Int): Int = noImpl
fun set(index: Int, value: Int): Unit = noImpl
fun set(array: Uint32Array, offset: Int = noImpl): Unit = noImpl
fun set(array: dynamic, offset: Int = noImpl): Unit = noImpl
fun subarray(start: Int, end: Int): Uint32Array = noImpl
companion object {
val BYTES_PER_ELEMENT: Int = 4
}
}
native public open class Float32Array(length: Int) {
var length: Int
get() = noImpl
set(value) = noImpl
var buffer: ArrayBuffer
get() = noImpl
set(value) = noImpl
var byteOffset: Int
get() = noImpl
set(value) = noImpl
var byteLength: Int
get() = noImpl
set(value) = noImpl
fun get(index: Int): Float = noImpl
fun set(index: Int, value: Float): Unit = noImpl
fun set(array: Float32Array, offset: Int = noImpl): Unit = noImpl
fun set(array: dynamic, offset: Int = noImpl): Unit = noImpl
fun subarray(start: Int, end: Int): Float32Array = noImpl
companion object {
val BYTES_PER_ELEMENT: Int = 4
}
}
native public open class Float64Array(length: Int) {
var length: Int
get() = noImpl
set(value) = noImpl
var buffer: ArrayBuffer
get() = noImpl
set(value) = noImpl
var byteOffset: Int
get() = noImpl
set(value) = noImpl
var byteLength: Int
get() = noImpl
set(value) = noImpl
fun get(index: Int): Double = noImpl
fun set(index: Int, value: Double): Unit = noImpl
fun set(array: Float64Array, offset: Int = noImpl): Unit = noImpl
fun set(array: dynamic, offset: Int = noImpl): Unit = noImpl
fun subarray(start: Int, end: Int): Float64Array = noImpl
companion object {
val BYTES_PER_ELEMENT: Int = 8
}
}
native public open class DataView(buffer: ArrayBuffer, byteOffset: Int = noImpl, byteLength: Int = noImpl) {
var buffer: ArrayBuffer
get() = noImpl
set(value) = noImpl
var byteOffset: Int
get() = noImpl
set(value) = noImpl
var byteLength: Int
get() = noImpl
set(value) = noImpl
fun getInt8(byteOffset: Int): Byte = noImpl
fun getUint8(byteOffset: Int): Byte = noImpl
fun getInt16(byteOffset: Int, littleEndian: Boolean = noImpl): Short = noImpl
fun getUint16(byteOffset: Int, littleEndian: Boolean = noImpl): Short = noImpl
fun getInt32(byteOffset: Int, littleEndian: Boolean = noImpl): Int = noImpl
fun getUint32(byteOffset: Int, littleEndian: Boolean = noImpl): Int = noImpl
fun getFloat32(byteOffset: Int, littleEndian: Boolean = noImpl): Float = noImpl
fun getFloat64(byteOffset: Int, littleEndian: Boolean = noImpl): Double = noImpl
fun setInt8(byteOffset: Int, value: Byte): Unit = noImpl
fun setUint8(byteOffset: Int, value: Byte): Unit = noImpl
fun setInt16(byteOffset: Int, value: Short, littleEndian: Boolean = noImpl): Unit = noImpl
fun setUint16(byteOffset: Int, value: Short, littleEndian: Boolean = noImpl): Unit = noImpl
fun setInt32(byteOffset: Int, value: Int, littleEndian: Boolean = noImpl): Unit = noImpl
fun setUint32(byteOffset: Int, value: Int, littleEndian: Boolean = noImpl): Unit = noImpl
fun setFloat32(byteOffset: Int, value: Float, littleEndian: Boolean = noImpl): Unit = noImpl
fun setFloat64(byteOffset: Int, value: Double, littleEndian: Boolean = noImpl): Unit = noImpl
}
+9 -2
View File
@@ -2907,7 +2907,7 @@ native public open class ImageData(sw: Int, sh: Int) {
var height: Int
get() = noImpl
set(value) = noImpl
var data: dynamic
var data: Uint8ClampedArray
get() = noImpl
set(value) = noImpl
}
@@ -3731,7 +3731,8 @@ native public open class WebSocket(url: String, protocols: dynamic = noImpl) : E
fun close(code: Short = noImpl, reason: String = noImpl): Unit = noImpl
fun send(data: String): Unit = noImpl
fun send(data: Blob): Unit = noImpl
fun send(data: dynamic): Unit = noImpl
fun send(data: ArrayBuffer): Unit = noImpl
fun send(data: ArrayBufferView): Unit = noImpl
companion object {
val CONNECTING: Short = 0
@@ -4854,6 +4855,12 @@ native public marker trait UnionElementOrMouseEvent {
native public marker trait UnionElementOrProcessingInstruction {
}
native public marker trait ArrayBufferView {
}
native public marker trait Transferable {
}
native public marker trait RenderingContext {
}
@@ -98,7 +98,7 @@ native public open class FileReader : EventTarget {
}
native public open class FileReaderSync {
fun readAsArrayBuffer(blob: Blob): dynamic = noImpl
fun readAsArrayBuffer(blob: Blob): ArrayBuffer = noImpl
fun readAsText(blob: Blob, label: String = noImpl): String = noImpl
fun readAsDataURL(blob: Blob): String = noImpl
}
+2 -4
View File
@@ -100,14 +100,12 @@ native public open class XMLHttpRequest : XMLHttpRequestEventTarget {
}
native public open class FormData(form: HTMLFormElement = noImpl) {
fun append(name: String, value: Blob, filename: String = noImpl): Unit = noImpl
fun append(name: String, value: String): Unit = noImpl
fun append(name: String, value: dynamic): Unit = noImpl
fun delete(name: String): Unit = noImpl
fun get(name: String): dynamic = noImpl
fun getAll(name: String): Any = noImpl
fun has(name: String): Boolean = noImpl
fun set(name: String, value: Blob, filename: String = noImpl): Unit = noImpl
fun set(name: String, value: String): Unit = noImpl
fun set(name: String, value: dynamic): Unit = noImpl
}
native public open class ProgressEvent(type: String, eventInitDict: ProgressEventInit = noImpl) : Event(type, eventInitDict) {
+3 -1
View File
@@ -17,13 +17,15 @@
package kotlin.js.dom.html5
native
deprecated("Use declaration from kotlin.browser")
public val localStorage: org.w3c.dom.Storage = noImpl
native
deprecated("Use declaration from kotlin.browser")
public val sessionStorage: org.w3c.dom.Storage = noImpl
native
deprecated("Use org.w3c.dom")
deprecated("Use declarations from org.w3c.dom")
public trait Storage {
public val length: Int
get() = noImpl