Skip to content

Commit

Permalink
IDL2K better dictionary support: generate interfaces with builder fun…
Browse files Browse the repository at this point in the history
…ction

suppress inline warning, replace Long with Int
(cherry picked from commit 342f35f)
  • Loading branch information
Sergey Mashkov committed Jun 17, 2015
1 parent 0806e94 commit bb56a2a
Show file tree
Hide file tree
Showing 12 changed files with 466 additions and 414 deletions.
38 changes: 20 additions & 18 deletions js/js.libraries/src/generated/org.khronos.webgl.kt
Expand Up @@ -31,17 +31,18 @@ native public interface WebGLContextAttributes {
var failIfMajorPerformanceCaveat: Boolean
}

suppress("NOTHING_TO_INLINE")
inline fun WebGLContextAttributes(alpha: Boolean = true, depth: Boolean = true, stencil: Boolean = false, antialias: Boolean = true, premultipliedAlpha: Boolean = true, preserveDrawingBuffer: Boolean = false, preferLowPowerToHighPerformance: Boolean = false, failIfMajorPerformanceCaveat: Boolean = false): WebGLContextAttributes {
val o = js("({})") as WebGLContextAttributes
val o = js("({})")

o.`alpha` = alpha
o.`depth` = depth
o.`stencil` = stencil
o.`antialias` = antialias
o.`premultipliedAlpha` = premultipliedAlpha
o.`preserveDrawingBuffer` = preserveDrawingBuffer
o.`preferLowPowerToHighPerformance` = preferLowPowerToHighPerformance
o.`failIfMajorPerformanceCaveat` = failIfMajorPerformanceCaveat
o["alpha"] = alpha
o["depth"] = depth
o["stencil"] = stencil
o["antialias"] = antialias
o["premultipliedAlpha"] = premultipliedAlpha
o["preserveDrawingBuffer"] = preserveDrawingBuffer
o["preferLowPowerToHighPerformance"] = preferLowPowerToHighPerformance
o["failIfMajorPerformanceCaveat"] = failIfMajorPerformanceCaveat

return o
}
Expand Down Expand Up @@ -111,9 +112,9 @@ native public interface WebGLRenderingContext : RenderingContext {
fun blendEquationSeparate(modeRGB: Int, modeAlpha: Int): Unit = noImpl
fun blendFunc(sfactor: Int, dfactor: Int): Unit = noImpl
fun blendFuncSeparate(srcRGB: Int, dstRGB: Int, srcAlpha: Int, dstAlpha: Int): Unit = noImpl
fun bufferData(target: Int, size: Long, usage: Int): Unit = noImpl
fun bufferData(target: Int, size: Int, usage: Int): Unit = noImpl
fun bufferData(target: Int, data: dynamic, usage: Int): Unit = noImpl
fun bufferSubData(target: Int, offset: Long, data: dynamic): Unit = noImpl
fun bufferSubData(target: Int, offset: Int, data: dynamic): Unit = noImpl
fun checkFramebufferStatus(target: Int): Int = noImpl
fun clear(mask: Int): Unit = noImpl
fun clearColor(red: Float, green: Float, blue: Float, alpha: Float): Unit = noImpl
Expand Down Expand Up @@ -145,7 +146,7 @@ native public interface WebGLRenderingContext : RenderingContext {
fun disable(cap: Int): Unit = noImpl
fun disableVertexAttribArray(index: Int): Unit = noImpl
fun drawArrays(mode: Int, first: Int, count: Int): Unit = noImpl
fun drawElements(mode: Int, count: Int, type: Int, offset: Long): Unit = noImpl
fun drawElements(mode: Int, count: Int, type: Int, offset: Int): Unit = noImpl
fun enable(cap: Int): Unit = noImpl
fun enableVertexAttribArray(index: Int): Unit = noImpl
fun finish(): Unit = noImpl
Expand Down Expand Up @@ -173,7 +174,7 @@ native public interface WebGLRenderingContext : RenderingContext {
fun getUniform(program: WebGLProgram?, location: WebGLUniformLocation?): Any? = noImpl
fun getUniformLocation(program: WebGLProgram?, name: String): WebGLUniformLocation? = noImpl
fun getVertexAttrib(index: Int, pname: Int): Any? = noImpl
fun getVertexAttribOffset(index: Int, pname: Int): Long = noImpl
fun getVertexAttribOffset(index: Int, pname: Int): Int = noImpl
fun hint(target: Int, mode: Int): Unit = noImpl
fun isBuffer(buffer: WebGLBuffer?): Boolean = noImpl
fun isEnabled(cap: Int): Boolean = noImpl
Expand Down Expand Up @@ -247,7 +248,7 @@ native public interface WebGLRenderingContext : RenderingContext {
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: Array<Float>): Unit = noImpl
fun vertexAttribPointer(indx: Int, size: Int, type: Int, normalized: Boolean, stride: Int, offset: Long): Unit = noImpl
fun vertexAttribPointer(indx: Int, size: Int, type: Int, normalized: Boolean, stride: Int, offset: Int): Unit = noImpl
fun viewport(x: Int, y: Int, width: Int, height: Int): Unit = noImpl

companion object {
Expand Down Expand Up @@ -560,12 +561,13 @@ native public interface WebGLContextEventInit : EventInit {
var statusMessage: String
}

suppress("NOTHING_TO_INLINE")
inline fun WebGLContextEventInit(statusMessage: String, bubbles: Boolean = false, cancelable: Boolean = false): WebGLContextEventInit {
val o = js("({})") as WebGLContextEventInit
val o = js("({})")

o.`statusMessage` = statusMessage
o.`bubbles` = bubbles
o.`cancelable` = cancelable
o["statusMessage"] = statusMessage
o["bubbles"] = bubbles
o["cancelable"] = cancelable

return o
}
Expand Down
255 changes: 131 additions & 124 deletions js/js.libraries/src/generated/org.w3c.dom.events.kt
Expand Up @@ -126,13 +126,14 @@ native public interface UIEventInit : EventInit {
var detail: Int
}

suppress("NOTHING_TO_INLINE")
inline fun UIEventInit(view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): UIEventInit {
val o = js("({})") as UIEventInit
val o = js("({})")

o.`view` = view
o.`detail` = detail
o.`bubbles` = bubbles
o.`cancelable` = cancelable
o["view"] = view
o["detail"] = detail
o["bubbles"] = bubbles
o["cancelable"] = cancelable

return o
}
Expand All @@ -147,14 +148,15 @@ native public interface FocusEventInit : UIEventInit {
var relatedTarget: EventTarget?
}

suppress("NOTHING_TO_INLINE")
inline fun FocusEventInit(relatedTarget: EventTarget? = null, view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): FocusEventInit {
val o = js("({})") as FocusEventInit
val o = js("({})")

o.`relatedTarget` = relatedTarget
o.`view` = view
o.`detail` = detail
o.`bubbles` = bubbles
o.`cancelable` = cancelable
o["relatedTarget"] = relatedTarget
o["view"] = view
o["detail"] = detail
o["bubbles"] = bubbles
o["cancelable"] = cancelable

return o
}
Expand All @@ -169,35 +171,36 @@ native public interface MouseEventInit : EventModifierInit {
var relatedTarget: EventTarget?
}

suppress("NOTHING_TO_INLINE")
inline fun MouseEventInit(screenX: Int = 0, screenY: Int = 0, clientX: Int = 0, clientY: Int = 0, button: Short = 0, buttons: Short = 0, relatedTarget: EventTarget? = null, ctrlKey: Boolean = false, shiftKey: Boolean = false, altKey: Boolean = false, metaKey: Boolean = false, modifierAltGraph: Boolean = false, modifierCapsLock: Boolean = false, modifierFn: Boolean = false, modifierFnLock: Boolean = false, modifierHyper: Boolean = false, modifierNumLock: Boolean = false, modifierOS: Boolean = false, modifierScrollLock: Boolean = false, modifierSuper: Boolean = false, modifierSymbol: Boolean = false, modifierSymbolLock: Boolean = false, view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): MouseEventInit {
val o = js("({})") as MouseEventInit

o.`screenX` = screenX
o.`screenY` = screenY
o.`clientX` = clientX
o.`clientY` = clientY
o.`button` = button
o.`buttons` = buttons
o.`relatedTarget` = relatedTarget
o.`ctrlKey` = ctrlKey
o.`shiftKey` = shiftKey
o.`altKey` = altKey
o.`metaKey` = metaKey
o.`modifierAltGraph` = modifierAltGraph
o.`modifierCapsLock` = modifierCapsLock
o.`modifierFn` = modifierFn
o.`modifierFnLock` = modifierFnLock
o.`modifierHyper` = modifierHyper
o.`modifierNumLock` = modifierNumLock
o.`modifierOS` = modifierOS
o.`modifierScrollLock` = modifierScrollLock
o.`modifierSuper` = modifierSuper
o.`modifierSymbol` = modifierSymbol
o.`modifierSymbolLock` = modifierSymbolLock
o.`view` = view
o.`detail` = detail
o.`bubbles` = bubbles
o.`cancelable` = cancelable
val o = js("({})")

o["screenX"] = screenX
o["screenY"] = screenY
o["clientX"] = clientX
o["clientY"] = clientY
o["button"] = button
o["buttons"] = buttons
o["relatedTarget"] = relatedTarget
o["ctrlKey"] = ctrlKey
o["shiftKey"] = shiftKey
o["altKey"] = altKey
o["metaKey"] = metaKey
o["modifierAltGraph"] = modifierAltGraph
o["modifierCapsLock"] = modifierCapsLock
o["modifierFn"] = modifierFn
o["modifierFnLock"] = modifierFnLock
o["modifierHyper"] = modifierHyper
o["modifierNumLock"] = modifierNumLock
o["modifierOS"] = modifierOS
o["modifierScrollLock"] = modifierScrollLock
o["modifierSuper"] = modifierSuper
o["modifierSymbol"] = modifierSymbol
o["modifierSymbolLock"] = modifierSymbolLock
o["view"] = view
o["detail"] = detail
o["bubbles"] = bubbles
o["cancelable"] = cancelable

return o
}
Expand All @@ -220,28 +223,29 @@ native public interface EventModifierInit : UIEventInit {
var modifierSymbolLock: Boolean
}

suppress("NOTHING_TO_INLINE")
inline fun EventModifierInit(ctrlKey: Boolean = false, shiftKey: Boolean = false, altKey: Boolean = false, metaKey: Boolean = false, modifierAltGraph: Boolean = false, modifierCapsLock: Boolean = false, modifierFn: Boolean = false, modifierFnLock: Boolean = false, modifierHyper: Boolean = false, modifierNumLock: Boolean = false, modifierOS: Boolean = false, modifierScrollLock: Boolean = false, modifierSuper: Boolean = false, modifierSymbol: Boolean = false, modifierSymbolLock: Boolean = false, view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): EventModifierInit {
val o = js("({})") as EventModifierInit

o.`ctrlKey` = ctrlKey
o.`shiftKey` = shiftKey
o.`altKey` = altKey
o.`metaKey` = metaKey
o.`modifierAltGraph` = modifierAltGraph
o.`modifierCapsLock` = modifierCapsLock
o.`modifierFn` = modifierFn
o.`modifierFnLock` = modifierFnLock
o.`modifierHyper` = modifierHyper
o.`modifierNumLock` = modifierNumLock
o.`modifierOS` = modifierOS
o.`modifierScrollLock` = modifierScrollLock
o.`modifierSuper` = modifierSuper
o.`modifierSymbol` = modifierSymbol
o.`modifierSymbolLock` = modifierSymbolLock
o.`view` = view
o.`detail` = detail
o.`bubbles` = bubbles
o.`cancelable` = cancelable
val o = js("({})")

o["ctrlKey"] = ctrlKey
o["shiftKey"] = shiftKey
o["altKey"] = altKey
o["metaKey"] = metaKey
o["modifierAltGraph"] = modifierAltGraph
o["modifierCapsLock"] = modifierCapsLock
o["modifierFn"] = modifierFn
o["modifierFnLock"] = modifierFnLock
o["modifierHyper"] = modifierHyper
o["modifierNumLock"] = modifierNumLock
o["modifierOS"] = modifierOS
o["modifierScrollLock"] = modifierScrollLock
o["modifierSuper"] = modifierSuper
o["modifierSymbol"] = modifierSymbol
o["modifierSymbolLock"] = modifierSymbolLock
o["view"] = view
o["detail"] = detail
o["bubbles"] = bubbles
o["cancelable"] = cancelable

return o
}
Expand Down Expand Up @@ -271,39 +275,40 @@ native public interface WheelEventInit : MouseEventInit {
var deltaMode: Int
}

suppress("NOTHING_TO_INLINE")
inline fun WheelEventInit(deltaX: Double = 0.0, deltaY: Double = 0.0, deltaZ: Double = 0.0, deltaMode: Int = 0, screenX: Int = 0, screenY: Int = 0, clientX: Int = 0, clientY: Int = 0, button: Short = 0, buttons: Short = 0, relatedTarget: EventTarget? = null, ctrlKey: Boolean = false, shiftKey: Boolean = false, altKey: Boolean = false, metaKey: Boolean = false, modifierAltGraph: Boolean = false, modifierCapsLock: Boolean = false, modifierFn: Boolean = false, modifierFnLock: Boolean = false, modifierHyper: Boolean = false, modifierNumLock: Boolean = false, modifierOS: Boolean = false, modifierScrollLock: Boolean = false, modifierSuper: Boolean = false, modifierSymbol: Boolean = false, modifierSymbolLock: Boolean = false, view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): WheelEventInit {
val o = js("({})") as WheelEventInit

o.`deltaX` = deltaX
o.`deltaY` = deltaY
o.`deltaZ` = deltaZ
o.`deltaMode` = deltaMode
o.`screenX` = screenX
o.`screenY` = screenY
o.`clientX` = clientX
o.`clientY` = clientY
o.`button` = button
o.`buttons` = buttons
o.`relatedTarget` = relatedTarget
o.`ctrlKey` = ctrlKey
o.`shiftKey` = shiftKey
o.`altKey` = altKey
o.`metaKey` = metaKey
o.`modifierAltGraph` = modifierAltGraph
o.`modifierCapsLock` = modifierCapsLock
o.`modifierFn` = modifierFn
o.`modifierFnLock` = modifierFnLock
o.`modifierHyper` = modifierHyper
o.`modifierNumLock` = modifierNumLock
o.`modifierOS` = modifierOS
o.`modifierScrollLock` = modifierScrollLock
o.`modifierSuper` = modifierSuper
o.`modifierSymbol` = modifierSymbol
o.`modifierSymbolLock` = modifierSymbolLock
o.`view` = view
o.`detail` = detail
o.`bubbles` = bubbles
o.`cancelable` = cancelable
val o = js("({})")

o["deltaX"] = deltaX
o["deltaY"] = deltaY
o["deltaZ"] = deltaZ
o["deltaMode"] = deltaMode
o["screenX"] = screenX
o["screenY"] = screenY
o["clientX"] = clientX
o["clientY"] = clientY
o["button"] = button
o["buttons"] = buttons
o["relatedTarget"] = relatedTarget
o["ctrlKey"] = ctrlKey
o["shiftKey"] = shiftKey
o["altKey"] = altKey
o["metaKey"] = metaKey
o["modifierAltGraph"] = modifierAltGraph
o["modifierCapsLock"] = modifierCapsLock
o["modifierFn"] = modifierFn
o["modifierFnLock"] = modifierFnLock
o["modifierHyper"] = modifierHyper
o["modifierNumLock"] = modifierNumLock
o["modifierOS"] = modifierOS
o["modifierScrollLock"] = modifierScrollLock
o["modifierSuper"] = modifierSuper
o["modifierSymbol"] = modifierSymbol
o["modifierSymbolLock"] = modifierSymbolLock
o["view"] = view
o["detail"] = detail
o["bubbles"] = bubbles
o["cancelable"] = cancelable

return o
}
Expand Down Expand Up @@ -352,33 +357,34 @@ native public interface KeyboardEventInit : EventModifierInit {
var isComposing: Boolean
}

suppress("NOTHING_TO_INLINE")
inline fun KeyboardEventInit(key: String = "", code: String = "", location: Int = 0, repeat: Boolean = false, isComposing: Boolean = false, ctrlKey: Boolean = false, shiftKey: Boolean = false, altKey: Boolean = false, metaKey: Boolean = false, modifierAltGraph: Boolean = false, modifierCapsLock: Boolean = false, modifierFn: Boolean = false, modifierFnLock: Boolean = false, modifierHyper: Boolean = false, modifierNumLock: Boolean = false, modifierOS: Boolean = false, modifierScrollLock: Boolean = false, modifierSuper: Boolean = false, modifierSymbol: Boolean = false, modifierSymbolLock: Boolean = false, view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): KeyboardEventInit {
val o = js("({})") as KeyboardEventInit

o.`key` = key
o.`code` = code
o.`location` = location
o.`repeat` = repeat
o.`isComposing` = isComposing
o.`ctrlKey` = ctrlKey
o.`shiftKey` = shiftKey
o.`altKey` = altKey
o.`metaKey` = metaKey
o.`modifierAltGraph` = modifierAltGraph
o.`modifierCapsLock` = modifierCapsLock
o.`modifierFn` = modifierFn
o.`modifierFnLock` = modifierFnLock
o.`modifierHyper` = modifierHyper
o.`modifierNumLock` = modifierNumLock
o.`modifierOS` = modifierOS
o.`modifierScrollLock` = modifierScrollLock
o.`modifierSuper` = modifierSuper
o.`modifierSymbol` = modifierSymbol
o.`modifierSymbolLock` = modifierSymbolLock
o.`view` = view
o.`detail` = detail
o.`bubbles` = bubbles
o.`cancelable` = cancelable
val o = js("({})")

o["key"] = key
o["code"] = code
o["location"] = location
o["repeat"] = repeat
o["isComposing"] = isComposing
o["ctrlKey"] = ctrlKey
o["shiftKey"] = shiftKey
o["altKey"] = altKey
o["metaKey"] = metaKey
o["modifierAltGraph"] = modifierAltGraph
o["modifierCapsLock"] = modifierCapsLock
o["modifierFn"] = modifierFn
o["modifierFnLock"] = modifierFnLock
o["modifierHyper"] = modifierHyper
o["modifierNumLock"] = modifierNumLock
o["modifierOS"] = modifierOS
o["modifierScrollLock"] = modifierScrollLock
o["modifierSuper"] = modifierSuper
o["modifierSymbol"] = modifierSymbol
o["modifierSymbolLock"] = modifierSymbolLock
o["view"] = view
o["detail"] = detail
o["bubbles"] = bubbles
o["cancelable"] = cancelable

return o
}
Expand All @@ -393,14 +399,15 @@ native public interface CompositionEventInit : UIEventInit {
var data: String
}

suppress("NOTHING_TO_INLINE")
inline fun CompositionEventInit(data: String = "", view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): CompositionEventInit {
val o = js("({})") as CompositionEventInit
val o = js("({})")

o.`data` = data
o.`view` = view
o.`detail` = detail
o.`bubbles` = bubbles
o.`cancelable` = cancelable
o["data"] = data
o["view"] = view
o["detail"] = detail
o["bubbles"] = bubbles
o["cancelable"] = cancelable

return o
}
Expand Down

0 comments on commit bb56a2a

Please sign in to comment.