mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 21:10:30 +00:00
Implement new sys/unix package
This commit is contained in:
6
examples/all/all_linux.odin
Normal file
6
examples/all/all_linux.odin
Normal file
@@ -0,0 +1,6 @@
|
||||
//+build linux
|
||||
package all
|
||||
|
||||
import linux "core:sys/linux"
|
||||
|
||||
_ :: linux
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user