Reorganize runtime package

This commit is contained in:
gingerBill committed 2018-05-27 21:22:25 +01:00
1 parent a5763d6fee
commit 5c52ffe24e
21 files changed
+908 -856

No files matched your search

+5 -3
View File
@@ -1,6 +1,6 @@
package os
import "core:mem"
import "core:raw"
write_string :: proc(fd: Handle, str: string) -> (int, Errno) {
return write(fd, cast([]byte)str);
@@ -56,9 +56,11 @@ write_entire_file :: proc(name: string, data: []byte, truncate := true) -> (succ
}
write_ptr :: proc(fd: Handle, data: rawptr, len: int) -> (int, Errno) {
return write(fd, mem.slice_ptr(cast(^byte)data, len));
s := transmute([]byte)raw.Slice{data, len};
return write(fd, s);
}
read_ptr :: proc(fd: Handle, data: rawptr, len: int) -> (int, Errno) {
return read(fd, mem.slice_ptr(cast(^byte)data, len));
s := transmute([]byte)raw.Slice{data, len};
return read(fd, s);
}