mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 22:58:46 +00:00
var/const decl; remove : from parameter lists
This commit is contained in:
+13
-13
@@ -13,7 +13,7 @@ type File struct {
|
||||
last_write_time: File_Time;
|
||||
}
|
||||
|
||||
proc open(name: string) -> (File, bool) {
|
||||
proc open(name string) -> (File, bool) {
|
||||
using win32;
|
||||
buf: [300]byte;
|
||||
copy(buf[:], name as []byte);
|
||||
@@ -24,7 +24,7 @@ proc open(name: string) -> (File, bool) {
|
||||
return f, success;
|
||||
}
|
||||
|
||||
proc create(name: string) -> (File, bool) {
|
||||
proc create(name string) -> (File, bool) {
|
||||
using win32;
|
||||
buf: [300]byte;
|
||||
copy(buf[:], name as []byte);
|
||||
@@ -35,16 +35,16 @@ proc create(name: string) -> (File, bool) {
|
||||
return f, success;
|
||||
}
|
||||
|
||||
proc close(using f: ^File) {
|
||||
proc close(using f ^File) {
|
||||
win32.CloseHandle(handle.p as win32.HANDLE);
|
||||
}
|
||||
|
||||
proc write(using f: ^File, buf: []byte) -> bool {
|
||||
proc write(using f ^File, buf []byte) -> bool {
|
||||
bytes_written: i32;
|
||||
return win32.WriteFile(handle.p as win32.HANDLE, buf.data, buf.count as i32, ^bytes_written, nil) != 0;
|
||||
}
|
||||
|
||||
proc file_has_changed(f: ^File) -> bool {
|
||||
proc file_has_changed(f ^File) -> bool {
|
||||
last_write_time := last_write_time(f);
|
||||
if f.last_write_time != last_write_time {
|
||||
f.last_write_time = last_write_time;
|
||||
@@ -55,7 +55,7 @@ proc file_has_changed(f: ^File) -> bool {
|
||||
|
||||
|
||||
|
||||
proc last_write_time(f: ^File) -> File_Time {
|
||||
proc last_write_time(f ^File) -> File_Time {
|
||||
file_info: win32.BY_HANDLE_FILE_INFORMATION;
|
||||
win32.GetFileInformationByHandle(f.handle.p as win32.HANDLE, ^file_info);
|
||||
l := file_info.last_write_time.low_date_time as File_Time;
|
||||
@@ -63,7 +63,7 @@ proc last_write_time(f: ^File) -> File_Time {
|
||||
return l | h << 32;
|
||||
}
|
||||
|
||||
proc last_write_time_by_name(name: string) -> File_Time {
|
||||
proc last_write_time_by_name(name string) -> File_Time {
|
||||
last_write_time: win32.FILETIME;
|
||||
data: win32.WIN32_FILE_ATTRIBUTE_DATA;
|
||||
buf: [1024]byte;
|
||||
@@ -103,7 +103,7 @@ stderr := ^__std_files[File_Standard.ERROR];
|
||||
|
||||
|
||||
|
||||
proc read_entire_file(name: string) -> ([]byte, bool) {
|
||||
proc read_entire_file(name string) -> ([]byte, bool) {
|
||||
buf: [300]byte;
|
||||
copy(buf[:], name as []byte);
|
||||
|
||||
@@ -130,7 +130,7 @@ proc read_entire_file(name: string) -> ([]byte, bool) {
|
||||
for total_read < length {
|
||||
remaining := length - total_read;
|
||||
to_read: u32;
|
||||
MAX :: 1<<32-1;
|
||||
const MAX = 1<<32-1;
|
||||
if remaining <= MAX {
|
||||
to_read = remaining as u32;
|
||||
} else {
|
||||
@@ -151,18 +151,18 @@ proc read_entire_file(name: string) -> ([]byte, bool) {
|
||||
|
||||
|
||||
|
||||
proc heap_alloc(size: int) -> rawptr {
|
||||
proc heap_alloc(size int) -> rawptr {
|
||||
return win32.HeapAlloc(win32.GetProcessHeap(), win32.HEAP_ZERO_MEMORY, size);
|
||||
}
|
||||
proc heap_resize(ptr: rawptr, new_size: int) -> rawptr {
|
||||
proc heap_resize(ptr rawptr, new_size int) -> rawptr {
|
||||
return win32.HeapReAlloc(win32.GetProcessHeap(), win32.HEAP_ZERO_MEMORY, ptr, new_size);
|
||||
}
|
||||
proc heap_free(ptr: rawptr) {
|
||||
proc heap_free(ptr rawptr) {
|
||||
win32.HeapFree(win32.GetProcessHeap(), 0, ptr);
|
||||
}
|
||||
|
||||
|
||||
proc exit(code: int) {
|
||||
proc exit(code int) {
|
||||
win32.ExitProcess(code as u32);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user