mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 21:21:33 +00:00
implement native type compilation
This commit is contained in:
@ -8,6 +8,7 @@ import gay.pizza.pork.evaluator.*
|
||||
import gay.pizza.pork.execution.ArgumentList
|
||||
import gay.pizza.pork.execution.NativeFunction
|
||||
import gay.pizza.pork.execution.NativeProvider
|
||||
import gay.pizza.pork.execution.NativeType
|
||||
import gay.pizza.pork.execution.None
|
||||
import kotlin.io.path.Path
|
||||
import kotlin.io.path.absolutePathString
|
||||
@ -231,6 +232,11 @@ class FfiNativeProvider : ExpandedNativeProvider, NativeProvider {
|
||||
callable.call(arguments, CallStack())
|
||||
}
|
||||
}
|
||||
|
||||
override fun provideNativeType(definitions: List<String>): NativeType {
|
||||
throw RuntimeException("Unknown native type")
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun typeConversion(type: FfiType): Type = when (type) {
|
||||
FfiPrimitiveType.UnsignedByte -> Type.UINT8
|
||||
|
@ -6,6 +6,7 @@ import gay.pizza.pork.evaluator.SlabContext
|
||||
import gay.pizza.pork.evaluator.ExpandedNativeProvider
|
||||
import gay.pizza.pork.execution.NativeFunction
|
||||
import gay.pizza.pork.execution.NativeProvider
|
||||
import gay.pizza.pork.execution.NativeType
|
||||
import gay.pizza.pork.execution.None
|
||||
import java.lang.invoke.MethodHandles
|
||||
import java.lang.invoke.MethodType
|
||||
@ -68,4 +69,8 @@ class JavaNativeProvider : ExpandedNativeProvider, NativeProvider {
|
||||
override fun provideNativeFunction(definitions: List<String>): NativeFunction {
|
||||
throw RuntimeException("Invalid Native Function Usage")
|
||||
}
|
||||
|
||||
override fun provideNativeType(definitions: List<String>): NativeType {
|
||||
throw RuntimeException("Invalid Native Type Usage")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user