Removed manualy created wasm32 interop stubs.

This commit is contained in:
Alexander Gorshenev
2017-10-30 13:43:24 +03:00
committed by alexander-gorshenev
parent 7e157c9d0d
commit 103d397200
2 changed files with 0 additions and 225 deletions
@@ -1,71 +0,0 @@
konan.libraries.push ({ // This one will be auto generated.
knjs_addDocumentToArena: function(arena) {
// Should be resolved by jsinterop.
return toArena(arena, document);
},
knjs_setInterval: function (arena, func, interval) {
setInterval(konan_dependencies.env.Konan_js_wrapLambda(arena, func), interval);
},
knjs_getElementById: function (arena, obj, id, idLength, resultArena) {
var name = toUTF16String(id, idLength);
var result = kotlinObject(arena, obj).getElementById(name);
return toArena(resultArena, result);
},
knjs_getContext: function (arena, obj, context, contextLength, resultArena) {
var name = toUTF16String(context, contextLength);
var result = kotlinObject(arena, obj).getContext(name);
return toArena(resultArena, result);
},
knjs_getBoundingClientRect: function (arena, obj, resultArena) {
var result = kotlinObject(arena, obj).getBoundingClientRect();
return toArena(resultArena, result);
},
knjs_moveTo: function(arena, obj, x, y) {
kotlinObject(arena, obj).moveTo(x, y);
},
knjs_lineTo: function(arena, obj, x, y) {
kotlinObject(arena, obj).lineTo(x, y);
},
knjs_fillRect: function(arena, obj, x1, y1, width, height) {
kotlinObject(arena, obj).fillRect(x1, y1, width, height);
},
knjs_fillText: function(arena, obj, textPtr, textLength, x, y, maxWidth) {
kotlinObject(arena, obj).fillText(toUTF16String(textPtr, textLength), x, y, maxWidth);
},
knjs_fill: function(arena, obj) {
kotlinObject(arena, obj).fill();
},
knjs_closePath: function(arena, obj) {
kotlinObject(arena, obj).closePath();
},
knjs_setLineWidth: function(arena, obj, value) {
kotlinObject(arena, obj).lineWidth = value;
},
knjs_setFillStyle: function(arena, obj, value_ptr, value_length) {
var value = toUTF16String(value_ptr, value_length);
kotlinObject(arena, obj).fillStyle = value;
},
knjs_beginPath: function(arena, obj) {
kotlinObject(arena, obj).beginPath();
},
knjs_stroke: function(arena, obj) {
kotlinObject(arena, obj).stroke();
},
knjs_fetch: function(arena, urlPtr, urlLength, resultArena) {
var url = toUTF16String(urlPtr, urlLength);
var result = fetch(url);
return toArena(resultArena, result);
},
knjs_then: function(arena, obj, func, resultArena) {
var value = konan_dependencies.env.Konan_js_wrapLambda(arena, func);
var result = kotlinObject(arena, obj).then(value);
var index = toArena(resultArena, result);
return index;
},
knjs_json: function(arena, obj, resultArena) {
var object = kotlinObject(arena, obj);
result = object.json();
return toArena(resultArena, result);
}
});
@@ -1,154 +0,0 @@
package html5.minimal
// This file will be auto-generated.
import kotlinx.wasm.jsinterop.*
@SymbolName("knjs_addDocumentToArena")
external public fun addDocumentToArena(arena: Arena): Int
@SymbolName("knjs_getElementById")
external public fun knjs_getElementById(arena: Int, obj: Int, idPtr: Int, idLen: Int, resultArena: Int): Int;
@SymbolName("knjs_getContext")
external public fun knjs_getContext(arena: Int, obj: Int, idPtr: Int, idLen: Int, resultArena: Int): Int;
@SymbolName("knjs_getBoundingClientRect")
external public fun knjs_getBoundingClientRect(arena: Int, obj: Int, resultArena: Int): Int;
@SymbolName("knjs_beginPath")
external public fun knjs_beginPath(arena: Int, obj: Int);
@SymbolName("knjs_stroke")
external public fun knjs_stroke(arena: Int, obj: Int);
@SymbolName("knjs_moveTo")
external public fun knjs_moveTo(arena: Int, obj: Int, x: Int, y: Int): Int;
@SymbolName("knjs_lineTo")
external public fun knjs_lineTo(arena: Int, obj: Int, x: Int, y: Int): Int;
@SymbolName("knjs_fillRect")
external public fun knjs_fillRect(arena: Int, obj: Int, x1: Int, y1: Int, width: Int, height: Int)
@SymbolName("knjs_fillText")
external public fun knjs_fillText(arena: Int, obj: Int, textPtr: Int, textWidth: Int, x: Int, y: Int, maxWidth: Int)
@SymbolName("knjs_fill")
external public fun knjs_fill(arena: Int, obj: Int)
@SymbolName("knjs_closePath")
external public fun knjs_closePath(arena: Int, obj: Int)
@SymbolName("knjs_setLineWidth")
external public fun knjs_setLineWidth(thisArena: Int, thisIndex: Int, value: Int)
@SymbolName("knjs_setFillStyle")
external public fun knjs_setFillStyle(thisArena: Int, thisIndex: Int, valuePtr: Int, valueLength: Int)
@SymbolName("knjs_setInterval")
external public fun knjs_setInterval(arenaIndex: Int, functionIndex: Int, interval: Int);
@SymbolName("knjs_fetch")
external public fun knjs_fetch(arena: Int, urlPtr: Int, urlLen: Int, resultArena: Int): Int;
@SymbolName("knjs_then")
external public fun knjs_then(thisArena: Int, thisIndex: Int, functionIndex: Int, resultArena: Int): Int
@SymbolName("knjs_json")
external public fun knjs_json(thisArena: Int, thisIndex: Int, resultArena: Int): Int
open class Document(arena: Int, index: Int): JsValue(arena, index) {
constructor(value: JsValue): this(value.arena, value.index)
fun getElementById(id: String): JsValue {
val resultIndex = knjs_getElementById(this.arena, this.index, stringPointer(id), stringLengthBytes(id), ArenaManager.currentArena)
return JsValue(ArenaManager.currentArena, resultIndex)
}
}
open class DOMRect(arena: Int, index: Int): JsValue(arena, index) {
}
open class Canvas(arena: Int, index: Int): JsValue(arena, index) {
fun getContext(context: String): Context {
val resultIndex = knjs_getContext(this.arena, this.index, stringPointer(context), stringLengthBytes(context), ArenaManager.currentArena)
return Context(ArenaManager.currentArena, resultIndex)
}
fun getBoundingClientRect(): DOMRect {
return DOMRect(ArenaManager.currentArena, knjs_getBoundingClientRect(this.arena, this.index, ArenaManager.currentArena))
}
}
// TODO: this is awful.
val JsValue.asCanvas: Canvas
get() {
return Canvas(this.arena, this.index)
}
open class Context(arena: Int, index: Int): JsValue(arena, index) {
fun lineTo(x: Int, y: Int) {
knjs_lineTo(this.arena, this.index, x, y)
}
fun moveTo(x: Int, y: Int) {
knjs_moveTo(this.arena, this.index, x, y)
}
fun beginPath() {
knjs_beginPath(this.arena, this.index);
}
fun stroke() {
knjs_stroke(this.arena, this.index);
}
fun fillRect(x: Int, y: Int, width: Int, height: Int) {
knjs_fillRect(this.arena, this.index, x, y, width, height)
}
fun fillText(text: String, x: Int, y: Int, maxWidth: Int) {
knjs_fillText(this.arena, this.index, stringPointer(text), stringLengthBytes(text), x, y, maxWidth)
}
fun fill() {
knjs_fill(this.arena, this.index)
}
fun closePath() {
knjs_closePath(this.arena, this.index)
}
var lineWidth: Int
get() = TODO("implement me")
set(value: Int) {
knjs_setLineWidth(this.arena, this.index, value)
}
var fillStyle: String
get() = TODO("implement me")
set(value: String) {
knjs_setFillStyle(this.arena, this.index, stringPointer(value), stringLengthBytes(value))
}
}
class Response(arena: Int, index: Int): JsValue(arena, index) {
constructor(value: JsValue): this(value.arena, value.index)
fun json(): JsValue {
return JsValue(ArenaManager.currentArena, knjs_json(this.arena, this.index, ArenaManager.currentArena))
}
}
class Html5() {
val document = Document(ArenaManager.currentArena, addDocumentToArena(ArenaManager.currentArena))
fun fetch(url: String): Promise {
return Promise (ArenaManager.currentArena, knjs_fetch(ArenaManager.currentArena, stringPointer(url), stringLengthBytes(url), ArenaManager.currentArena))
}
fun setInterval(lambda: KtFunction<Unit>, interval: Int) {
knjs_setInterval(ArenaManager.globalArena, wrapFunction(lambda), interval);
}
// TODO: The arguments are flipped to have lambda within the last position.
fun setInterval(interval: Int, lambda: KtFunction<Unit>)
= setInterval(lambda, interval)
}
open class Promise (arena: Int, index: Int): JsValue(arena, index) {
fun <R> then(lambda: KtFunction<R>): Promise {
return Promise(ArenaManager.currentArena, knjs_then(arena, index, wrapFunction<R>(lambda), ArenaManager.currentArena))
}
}