Implement new sys/unix package

This commit is contained in:
flysand7
2023-10-18 01:57:26 +11:00
parent 8e4bdcfb98
commit 4d65b1ab9c
25 changed files with 6683 additions and 755 deletions

View File

@@ -0,0 +1,6 @@
//+build linux
package all
import linux "core:sys/linux"
_ :: linux

View File

@@ -39,10 +39,13 @@ import TTF "vendor:sdl2/ttf"
import vk "vendor:vulkan"
import NS "vendor:darwin/Foundation"
import MTL "vendor:darwin/Metal"
import MTK "vendor:darwin/MetalKit"
import CA "vendor:darwin/QuartzCore"
// NOTE(flysand): Since conditional imports are disabled for now I'll have to just disable these
// when ODIN_OS == "darwin" {
// import NS "vendor:darwin/Foundation"
// import MTL "vendor:darwin/Metal"
// import MTK "vendor:darwin/MetalKit"
// import CA "vendor:darwin/QuartzCore"
// }
// NOTE(bill): only one can be checked at a time
import lua_5_4 "vendor:lua/5.4"
@@ -91,10 +94,10 @@ _ :: TTF
_ :: vk
_ :: NS
_ :: MTL
_ :: MTK
_ :: CA
// _ :: NS
// _ :: MTL
// _ :: MTK
// _ :: CA
_ :: lua_5_4

View File

@@ -1,30 +0,0 @@
package main
import "core:intrinsics"
SUS_exit :: uintptr(60)
SUS_write ::uintptr(1)
STDOUT_FILENO :: int(1)
sus_write :: proc "contextless" (fd: int, buf: cstring, size: uint) -> int {
return int(intrinsics.syscall(
SUS_write,
cast(uintptr) fd,
cast(uintptr) cast(rawptr) buf,
cast(uintptr) size
))
}
@(link_name = "sussy_baka")
sus_exit :: proc "contextless" (code: $T)->! {
intrinsics.syscall(SUS_exit, uintptr(code))
unreachable()
}
sus :: proc {sus_write, sus_exit}
@(link_name="_start", export) _start :: proc "c" ()->! {
str :: cstring("Hello, world!\n")
sus_write(STDOUT_FILENO, str, uint(14));
sus_exit(0)
}