mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Changed js panics to unimplemented where sensible
This commit is contained in:
+40
-40
@@ -10,38 +10,38 @@ is_path_separator :: proc(c: byte) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open :: proc(path: string, mode: int = O_RDONLY, perm: int = 0) -> (Handle, Errno) {
|
open :: proc(path: string, mode: int = O_RDONLY, perm: int = 0) -> (Handle, Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
close :: proc(fd: Handle) -> Errno {
|
close :: proc(fd: Handle) -> Errno {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
flush :: proc(fd: Handle) -> (err: Errno) {
|
flush :: proc(fd: Handle) -> (err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
write :: proc(fd: Handle, data: []byte) -> (int, Errno) {
|
write :: proc(fd: Handle, data: []byte) -> (int, Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private="file")
|
@(private="file")
|
||||||
read_console :: proc(handle: Handle, b: []byte) -> (n: int, err: Errno) {
|
read_console :: proc(handle: Handle, b: []byte) -> (n: int, err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
read :: proc(fd: Handle, data: []byte) -> (int, Errno) {
|
read :: proc(fd: Handle, data: []byte) -> (int, Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
seek :: proc(fd: Handle, offset: i64, whence: int) -> (i64, Errno) {
|
seek :: proc(fd: Handle, offset: i64, whence: int) -> (i64, Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
file_size :: proc(fd: Handle) -> (i64, Errno) {
|
file_size :: proc(fd: Handle) -> (i64, Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -50,18 +50,18 @@ MAX_RW :: 1<<30
|
|||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
pread :: proc(fd: Handle, data: []byte, offset: i64) -> (int, Errno) {
|
pread :: proc(fd: Handle, data: []byte, offset: i64) -> (int, Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
@(private)
|
@(private)
|
||||||
pwrite :: proc(fd: Handle, data: []byte, offset: i64) -> (int, Errno) {
|
pwrite :: proc(fd: Handle, data: []byte, offset: i64) -> (int, Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
read_at :: proc(fd: Handle, data: []byte, offset: i64) -> (n: int, err: Errno) {
|
read_at :: proc(fd: Handle, data: []byte, offset: i64) -> (n: int, err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
write_at :: proc(fd: Handle, data: []byte, offset: i64) -> (n: int, err: Errno) {
|
write_at :: proc(fd: Handle, data: []byte, offset: i64) -> (n: int, err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -74,96 +74,96 @@ write_at :: proc(fd: Handle, data: []byte, offset: i64) -> (n: int, err: Errno)
|
|||||||
|
|
||||||
get_std_handle :: proc "contextless" (h: uint) -> Handle {
|
get_std_handle :: proc "contextless" (h: uint) -> Handle {
|
||||||
context = runtime.default_context()
|
context = runtime.default_context()
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exists :: proc(path: string) -> bool {
|
exists :: proc(path: string) -> bool {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
is_file :: proc(path: string) -> bool {
|
is_file :: proc(path: string) -> bool {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
is_dir :: proc(path: string) -> bool {
|
is_dir :: proc(path: string) -> bool {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE(tetra): GetCurrentDirectory is not thread safe with SetCurrentDirectory and GetFullPathName
|
// NOTE(tetra): GetCurrentDirectory is not thread safe with SetCurrentDirectory and GetFullPathName
|
||||||
//@private cwd_lock := win32.SRWLOCK{} // zero is initialized
|
//@private cwd_lock := win32.SRWLOCK{} // zero is initialized
|
||||||
|
|
||||||
get_current_directory :: proc(allocator := context.allocator) -> string {
|
get_current_directory :: proc(allocator := context.allocator) -> string {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
set_current_directory :: proc(path: string) -> (err: Errno) {
|
set_current_directory :: proc(path: string) -> (err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
change_directory :: proc(path: string) -> (err: Errno) {
|
change_directory :: proc(path: string) -> (err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
make_directory :: proc(path: string, mode: u32 = 0) -> (err: Errno) {
|
make_directory :: proc(path: string, mode: u32 = 0) -> (err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
remove_directory :: proc(path: string) -> (err: Errno) {
|
remove_directory :: proc(path: string) -> (err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
is_abs :: proc(path: string) -> bool {
|
is_abs :: proc(path: string) -> bool {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
fix_long_path :: proc(path: string) -> string {
|
fix_long_path :: proc(path: string) -> string {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
link :: proc(old_name, new_name: string) -> (err: Errno) {
|
link :: proc(old_name, new_name: string) -> (err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink :: proc(path: string) -> (err: Errno) {
|
unlink :: proc(path: string) -> (err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rename :: proc(old_path, new_path: string) -> (err: Errno) {
|
rename :: proc(old_path, new_path: string) -> (err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ftruncate :: proc(fd: Handle, length: i64) -> (err: Errno) {
|
ftruncate :: proc(fd: Handle, length: i64) -> (err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
truncate :: proc(path: string, length: i64) -> (err: Errno) {
|
truncate :: proc(path: string, length: i64) -> (err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
remove :: proc(name: string) -> Errno {
|
remove :: proc(name: string) -> Errno {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pipe :: proc() -> (r, w: Handle, err: Errno) {
|
pipe :: proc() -> (r, w: Handle, err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
read_dir :: proc(fd: Handle, n: int, allocator := context.allocator) -> (fi: []File_Info, err: Errno) {
|
read_dir :: proc(fd: Handle, n: int, allocator := context.allocator) -> (fi: []File_Info, err: Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle :: distinct uintptr
|
Handle :: distinct uintptr
|
||||||
@@ -229,44 +229,44 @@ args := _alloc_command_line_arguments()
|
|||||||
|
|
||||||
|
|
||||||
last_write_time :: proc(fd: Handle) -> (File_Time, Errno) {
|
last_write_time :: proc(fd: Handle) -> (File_Time, Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
last_write_time_by_name :: proc(name: string) -> (File_Time, Errno) {
|
last_write_time_by_name :: proc(name: string) -> (File_Time, Errno) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
heap_alloc :: proc(size: int, zero_memory := true) -> rawptr {
|
heap_alloc :: proc(size: int, zero_memory := true) -> rawptr {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
heap_resize :: proc(ptr: rawptr, new_size: int) -> rawptr {
|
heap_resize :: proc(ptr: rawptr, new_size: int) -> rawptr {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
heap_free :: proc(ptr: rawptr) {
|
heap_free :: proc(ptr: rawptr) {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
get_page_size :: proc() -> int {
|
get_page_size :: proc() -> int {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
_processor_core_count :: proc() -> int {
|
_processor_core_count :: proc() -> int {
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
exit :: proc "contextless" (code: int) -> ! {
|
exit :: proc "contextless" (code: int) -> ! {
|
||||||
context = runtime.default_context()
|
context = runtime.default_context()
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
current_thread_id :: proc "contextless" () -> int {
|
current_thread_id :: proc "contextless" () -> int {
|
||||||
context = runtime.default_context()
|
context = runtime.default_context()
|
||||||
panic("core:os procedure not supported on JS target")
|
unimplemented("core:os procedure not supported on JS target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,34 +22,34 @@ _thread_priority_map := [Thread_Priority]i32{
|
|||||||
}
|
}
|
||||||
|
|
||||||
_create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal) -> ^Thread {
|
_create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal) -> ^Thread {
|
||||||
panic("core:thread procedure not supported on js target")
|
unimplemented("core:thread procedure not supported on js target")
|
||||||
}
|
}
|
||||||
|
|
||||||
_start :: proc(t: ^Thread) {
|
_start :: proc(t: ^Thread) {
|
||||||
panic("core:thread procedure not supported on js target")
|
unimplemented("core:thread procedure not supported on js target")
|
||||||
}
|
}
|
||||||
|
|
||||||
_is_done :: proc(t: ^Thread) -> bool {
|
_is_done :: proc(t: ^Thread) -> bool {
|
||||||
panic("core:thread procedure not supported on js target")
|
unimplemented("core:thread procedure not supported on js target")
|
||||||
}
|
}
|
||||||
|
|
||||||
_join :: proc(t: ^Thread) {
|
_join :: proc(t: ^Thread) {
|
||||||
panic("core:thread procedure not supported on js target")
|
unimplemented("core:thread procedure not supported on js target")
|
||||||
}
|
}
|
||||||
|
|
||||||
_join_multiple :: proc(threads: ..^Thread) {
|
_join_multiple :: proc(threads: ..^Thread) {
|
||||||
panic("core:thread procedure not supported on js target")
|
unimplemented("core:thread procedure not supported on js target")
|
||||||
}
|
}
|
||||||
|
|
||||||
_destroy :: proc(thread: ^Thread) {
|
_destroy :: proc(thread: ^Thread) {
|
||||||
panic("core:thread procedure not supported on js target")
|
unimplemented("core:thread procedure not supported on js target")
|
||||||
}
|
}
|
||||||
|
|
||||||
_terminate :: proc(using thread : ^Thread, exit_code: int) {
|
_terminate :: proc(using thread : ^Thread, exit_code: int) {
|
||||||
panic("core:thread procedure not supported on js target")
|
unimplemented("core:thread procedure not supported on js target")
|
||||||
}
|
}
|
||||||
|
|
||||||
_yield :: proc() {
|
_yield :: proc() {
|
||||||
panic("core:thread procedure not supported on js target")
|
unimplemented("core:thread procedure not supported on js target")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user