fixed: wasi compilation
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 21 Apr 2023 03:08:56 +0000 (22:08 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 21 Apr 2023 03:08:56 +0000 (22:08 -0500)
core/runtime/platform/wasi/platform.onyx
core/runtime/platform/wasi/wasi_fs.onyx

index ac8a8597ef45ee6f99b446a45e8011605c497b69..a1651cfa78068c4cc575930429b2a3cb396cd42f 100644 (file)
@@ -7,7 +7,6 @@ use core
 use wasi
 use runtime
 
-use core
 use wasi {
     IOVec, SubscriptionTagged, Subscription, Event, Size,
     poll_oneoff, fd_write, fd_datasync, fd_read,
@@ -18,6 +17,9 @@ use runtime {
     __runtime_initialize,
     Multi_Threading_Enabled,
 }
+use core {
+    __flush_stdio
+}
 
 
 // Platform supports
index c2dfe65abbf758c7d4cdec0de38923178b7812bf..954b25528abc41ed43b52546cfc68f24a1608886 100644 (file)
@@ -1,11 +1,9 @@
 package runtime.platform
 
 use runtime
-use core
+use core {package, *}
 use wasi
 
-use core
-
 #if runtime.runtime != .Wasi {
     #error "The file system library is currently only available on the WASI runtime, and should only be included if that is the chosen runtime."
 }
@@ -311,7 +309,7 @@ __dir_read :: (dir: DirectoryData, out_entry: &os.DirectoryEntry) -> bool {
     out_entry.identifier = ~~dirent.d_ino;
     out_entry.name_length = dirent.d_namlen;
     memory.set(~~&out_entry.name_data, 0, 256);
-    memory.copy(~~&out_entry.name_data, ~~(dirent + 1), math.min(dirent.d_namlen, sizeof typeof out_entry.name_data));
+    memory.copy(~~&out_entry.name_data, ~~(cast([&] wasi.DirEnt, dirent) + 1), math.min(dirent.d_namlen, sizeof typeof out_entry.name_data));
 
     dir.last_cookie = dirent.d_next;
     return true;