Move runtime os specific freestanding stuff to a separate file

This commit is contained in:
gingerBill
2020-09-15 12:36:37 +01:00
parent b94dde2817
commit 6f1e774a42
2 changed files with 40 additions and 40 deletions
+1 -22
View File
@@ -1,26 +1,6 @@
//+build !freestanding
package runtime package runtime
when ODIN_OS == "freestanding" {
_OS_Errno :: distinct int;
_OS_Handle :: distinct uintptr;
os_stdout :: proc "contextless" () -> _OS_Handle {
return 1;
}
os_stderr :: proc "contextless" () -> _OS_Handle {
return 2;
}
// TODO(bill): reimplement `os.write`
os_write :: proc(fd: _OS_Handle, data: []byte) -> (int, _OS_Errno) {
return 0, -1;
}
current_thread_id :: proc "contextless" () -> int {
return 0;
}
} else {
import "core:os" import "core:os"
_OS_Errno :: distinct int; _OS_Errno :: distinct int;
@@ -42,4 +22,3 @@ when ODIN_OS == "freestanding" {
current_thread_id :: proc "contextless" () -> int { current_thread_id :: proc "contextless" () -> int {
return os.current_thread_id(); return os.current_thread_id();
} }
}
@@ -0,0 +1,21 @@
//+build freestanding
package runtime
_OS_Errno :: distinct int;
_OS_Handle :: distinct uintptr;
os_stdout :: proc "contextless" () -> _OS_Handle {
return 1;
}
os_stderr :: proc "contextless" () -> _OS_Handle {
return 2;
}
// TODO(bill): reimplement `os.write`
os_write :: proc(fd: _OS_Handle, data: []byte) -> (int, _OS_Errno) {
return 0, -1;
}
current_thread_id :: proc "contextless" () -> int {
return 0;
}