diff options
| author | gingerBill <bill@gingerbill.org> | 2024-03-18 21:51:13 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-03-18 21:51:13 +0000 |
| commit | 14dc0e3ca797d4d5f97ac7d25d84a80581c87242 (patch) | |
| tree | d367273056678429a41d70ff2873bad23c09965b | |
| parent | 64e0092cca9ce802e67b9d718f44581430b8198e (diff) | |
Update `_stderr_write` for orca
| -rw-r--r-- | base/runtime/os_specific_orca.odin | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/base/runtime/os_specific_orca.odin b/base/runtime/os_specific_orca.odin index 95de7c03e..4ac36131f 100644 --- a/base/runtime/os_specific_orca.odin +++ b/base/runtime/os_specific_orca.odin @@ -2,13 +2,26 @@ //+private package runtime -// TODO -// foreign import -// fd_write :: proc "contextless" () -import "core:sys/wasm/wasi" +@(private="file") +log_level :: enum i32 { + ERROR, + WARNING, + INFO, +} + +@(private="file", default_calling_convention="c") +foreign { + oc_log_ext :: proc( + level: log_level, + function: cstring, + file: cstring, + line: i32, + fmt: cstring, + #c_vararg args: ..any, + ) --- +} _stderr_write :: proc "contextless" (data: []byte) -> (int, _OS_Errno) { - data := (wasi.ciovec_t)(data) - n, err := wasi.fd_write(1, {data}) - return int(n), _OS_Errno(err) + oc_log_ext(.ERROR, "", "", 0, "%.*s", i32(len(data)), raw_data(data)) + return len(data), 0 } |