This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package abendigo.mem.jna; | |
import com.sun.jna.Native; | |
/** | |
* This direct-mapped JNA utility offers access to the <em>user32</em> module on <em>Windows</em>. | |
* | |
* @author Thomas G. P. Nappo (Jire) | |
* @author Jonathan Beaudoin (Jonatino) | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group 'vero' | |
version '0.1' | |
apply plugin: 'java' | |
apply plugin: 'kotlin' | |
sourceCompatibility = 1.8 | |
repositories { | |
mavenCentral() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <T : PointerType> ptrTypeToPtr(objects: Array<T>): Pointer { | |
val memory = Memory(Pointer.SIZE * objects.size.toLong()) | |
var offset = 0L | |
for (obj in objects) { | |
memory.setPointer(Pointer.SIZE * offset, obj.pointer) | |
offset++ | |
} | |
return memory | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val TYPE_TO_BYTES = mapOf(Boolean::class.java to 1, Byte::class.java to 1, | |
Short::class.java to 2, Int::class.java to 4, Long::class.java to 8, | |
Float::class.java to 4, Double::class.java to 8) | |
inline fun <reified T: Any> read(address: Long): T { | |
val type = T::class | |
if (Int::class.java == type.java) | |
println("Nice! :)") | |
else if (Int::class == type) // would be nicer if this was possible | |
println("Nicer!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group 'org.abendigo' | |
version '1.0b' | |
apply plugin: 'java' | |
apply plugin: 'kotlin' | |
repositories { | |
mavenCentral() | |
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"C:\Program Files\Java\jdk1.8.0_65\bin\java" -XX:+UseG1GC -javaagent:quasar.jar=vdc -Dco.paralleluniverse.fibers.verifyInstrumentation=true -Didea.launcher.port=7537 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_65\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_65\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ACMEExample : KTON({ | |
"foo_code"..404 | |
"foo_rbody" { | |
"query" { | |
"info" { | |
"acme_no".."444444" | |
"road_runner".."123" | |
} | |
"error".."no_lunch" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args: Array<String>) { | |
val test = kton { | |
"1"..1 | |
"2" { | |
"3"..3 | |
"4" { | |
"5"..5 | |
} | |
} | |
"6" { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
operator fun <O> (KTON.() -> O).unaryPlus() { | |
arrays.add(kton(this)) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.jire.kton | |
import java.util.* | |
/** | |
* Represents an instance of KTON (Kotlin object notation). | |
* | |
* @author Thomas Nappo | |
*/ | |
class KTON(private var arrCursor: Int = -1) { |