mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-30 19:30:06 +00:00
wasi: make the demo run on wasi and run it in CI
This commit is contained in:
@@ -6,6 +6,8 @@ import "base:runtime"
|
||||
Handle :: distinct i32
|
||||
Errno :: distinct i32
|
||||
|
||||
INVALID_HANDLE :: -1
|
||||
|
||||
ERROR_NONE :: Errno(wasi.errno_t.SUCCESS)
|
||||
|
||||
O_RDONLY :: 0x00000
|
||||
@@ -26,6 +28,16 @@ stdout: Handle = 1
|
||||
stderr: Handle = 2
|
||||
current_dir: Handle = 3
|
||||
|
||||
args := _alloc_command_line_arguments()
|
||||
|
||||
_alloc_command_line_arguments :: proc() -> (args: []string) {
|
||||
args = make([]string, len(runtime.args__))
|
||||
for &arg, i in args {
|
||||
arg = string(runtime.args__[i])
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
write :: proc(fd: Handle, data: []byte) -> (int, Errno) {
|
||||
iovs := wasi.ciovec_t(data)
|
||||
n, err := wasi.fd_write(wasi.fd_t(fd), {iovs})
|
||||
|
||||
Reference in New Issue
Block a user