return true;
}
-file_get_size :: proc (file: File) -> i64 {
- //size: i64 = 0l;
- //prev: i64;
-
- //if fd_seek(file.fd, 0l, Whence.Cur, ^prev) != Errno.Success do return -1l;
- //if fd_seek(file.fd, 0l, Whence.End, ^size) != Errno.Success do return -1l;
- //if fd_seek(file.fd, prev, Whence.Set, ^prev) != Errno.Success do return -1l;
-
+file_get_size :: proc (file: File) -> u64 {
fs: FileStat;
- if fd_filestat_get(file.fd, ^fs) != Errno.Success do return -1l;
+ if fd_filestat_get(file.fd, ^fs) != Errno.Success do return 0l;
return fs.size;
}
len += 1;
}
}
+
+ case #char "p" {
+ n : rawptr;
+ if !vararg_get(va, ^n) do return;
+
+ ibuf : [128] u8;
+ istr := i64_to_string(~~n, 16l, Buffer.{ ~~ibuf, 128 });
+
+ for a: istr {
+ buffer[len] = a;
+ len += 1;
+ }
+ }
}
state = 0;
str.count -= 1;
}
+string_discard_chars :: proc (str: ^string, char_count := 1) {
+ str.data += char_count;
+ str.count -= char_count;
+}
+
// Goes up to but not including the closest newline or EOF
string_read_line :: proc (str: ^string, out: ^string) {
out.data = str.data;
out.count = 0;
- for i: 0 .. str.count {
- if str.data[i] == #char "\n" do break;
+ for ch: *str {
+ if ch == #char "\n" do break;
out.count += 1;
}
[ ] Add threading intrinsics
- This will actually be fairly easy since I think all that is needed is
to implement the intrinsics.
+ - ^^^ This is a false statement. I also need to have 'thread local variables' for
+ stack pointers and separate stack allocation in the linear memory for each
+ of the threads.
[X] Type parameterized structs
WIL(WI_LOCAL_GET, ptr_local);
WIL(WI_LOCAL_GET, end_ptr_local);
- WI(WI_I32_GE_S);
+ WI(WI_I32_GE_U);
WID(WI_COND_JUMP, 0x02);
if (!for_node->by_pointer) {
WIL(WI_LOCAL_GET, ptr_local);
WIL(WI_LOCAL_GET, end_ptr_local);
- WI(WI_I32_GE_S);
+ WI(WI_I32_GE_U);
WID(WI_COND_JUMP, 0x02);
if (!for_node->by_pointer) {