__file_read :: (handle: FileData.Handle, output_buffer: [] u8, bytes_read: ^u64) -> io.Error ---
__file_write :: (handle: FileData.Handle, input_buffer: [] u8, bytes_wrote: ^u64) -> io.Error ---
__file_flush :: (handle: FileData.Handle) -> io.Error ---
+ __file_size :: (handle: FileData.Handle) -> u32 ---
__dir_open :: (path: str, dir: ^DirectoryData) -> bool ---
__dir_close :: (dir: DirectoryData) -> void ---
},
size = (use fs: ^os.File) -> i32 {
+ return __file_size(data.handle);
},
};
return NULL;
}
+ONYX_DEF(__file_size, (WASM_I64), (WASM_I32)) {
+ i64 fd = params->data[0].of.i64;
+ bh_file file = { (bh_file_descriptor) fd };
+ results->data[0] = WASM_I32_VAL(bh_file_size(&file));
+ return NULL;
+}
+
ONYX_DEF(__file_get_standard, (WASM_I32, WASM_I32), (WASM_I32)) {
bh_file_standard standard = (bh_file_standard) params->data[0].of.i32;
ONYX_FUNC(__file_read)
ONYX_FUNC(__file_write)
ONYX_FUNC(__file_flush)
+ ONYX_FUNC(__file_size)
ONYX_FUNC(__file_get_standard)
ONYX_FUNC(__dir_open)