mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 21:21:33 +00:00
pork: it's got it all, ffi, state machine tokenizer, and better IDE support
This commit is contained in:
@ -1,7 +1,23 @@
|
||||
import std ffi.malloc
|
||||
import std ffi.struct
|
||||
|
||||
export let timeval = ffiStructDefine(
|
||||
"long", "seconds",
|
||||
"unsigned int", "microseconds"
|
||||
)
|
||||
|
||||
export let timezone = ffiStructDefine(
|
||||
"int", "minutes_greenwich",
|
||||
"int", "dst_time"
|
||||
)
|
||||
|
||||
func gettimeofday(value, tz)
|
||||
native ffi "c" "int gettimeofday(struct timeval*, struct timezone*)"
|
||||
|
||||
export func main() {
|
||||
let pointer = malloc(8192)
|
||||
println(pointer)
|
||||
free(pointer)
|
||||
let time = ffiStructAllocate(timeval)
|
||||
let zone = ffiStructAllocate(timezone)
|
||||
let result = gettimeofday(time, zone)
|
||||
let seconds = ffiStructValue(timeval, "seconds", time)
|
||||
println("Result:", result)
|
||||
println("Seconds:", seconds)
|
||||
}
|
||||
|
@ -60,6 +60,9 @@ export func SDL_GetModState()
|
||||
|
||||
export let SDL_RENDERER_PRESENTVSYNC = 4
|
||||
|
||||
export func SDL_PollEvent(event)
|
||||
native ffi "SDL2" "int SDL_PollEvent(struct SDL_Event*)"
|
||||
|
||||
export func SDL_CreateRenderer(window, index, flags)
|
||||
native ffi "SDL2" "void* SDL_CreateRenderer(void*, int, unsigned int)"
|
||||
|
||||
|
Reference in New Issue
Block a user