From f876b69779204e92e1909736e3eb9b164783e26a Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Sat, 18 Jun 2022 09:21:33 +0200 Subject: [PATCH] Change precedence of casts --- main.cpp | 2 ++ parsing.cpp | 2 +- programs/main.kl | 10 +++++++--- programs/os_windows.kl | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 176730a..c6178e0 100644 --- a/main.cpp +++ b/main.cpp @@ -44,8 +44,10 @@ want to export all the symbols, we can namespace them optionally. [ ] - #test construct that would gather all tests and run them on start of program or something [ ] - Error message when file not found [ ] - Foreign import that would link library +[ ] - Builtin dynamic arrays [ ] - Better error messages when type difference [ ] - Kilobyte, Megabyte, Gigabyte +[ ] - Cast from array to pointer? [ ] - Mixing loads and imports leads to code duplication, is that what we want??? [ ] - Fix field access, cant cast, cant index [ ] - Add parent_scope to Ast_Type, Add name to Ast_Type? diff --git a/parsing.cpp b/parsing.cpp index ad499f1..9bf9003 100644 --- a/parsing.cpp +++ b/parsing.cpp @@ -463,7 +463,7 @@ binding_power(Binding binding, Token_Kind kind){ case TK_Dot: return {31,30}; case TK_Arrow: - return {29,28}; + return {20,19}; default: return {}; } Postfix: switch(kind){ diff --git a/programs/main.kl b/programs/main.kl index beb8d76..8b37c25 100644 --- a/programs/main.kl +++ b/programs/main.kl @@ -50,6 +50,12 @@ window_procedure :: (hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM): LRE else;; return DefWindowProcW(hwnd, msg, wparam, lparam) _gcvt :: #foreign (value: F64, digits: int, buffer: *char): *char +print_float :: (value: F64) + buff: [100]char + _gcvt(value, 10, &buff[0]) + OutputDebugStringA("\n") + OutputDebugStringA(&buff[0]) + WinMain :: (hInstance: HINSTANCE, hPrevInstance: HINSTANCE, lpCmdLine: LPSTR, nShowCmd: int): int if good_scheduling := false, timeBeginPeriod(1) == TIMERR_NOERROR good_scheduling = true @@ -99,9 +105,7 @@ WinMain :: (hInstance: HINSTANCE, hPrevInstance: HINSTANCE, lpCmdLine: LPSTR, nS frame_time := time() - frame_start_time - _gcvt(frame_time, 10, buff) - OutputDebugStringA("\n") - OutputDebugStringA(buff) + print_float(frame_time) if frame_time < requested_time_per_frame if good_scheduling time_to_sleep := (requested_time_per_frame - frame_time) * 1000 diff --git a/programs/os_windows.kl b/programs/os_windows.kl index 258e8d8..f5810da 100644 --- a/programs/os_windows.kl +++ b/programs/os_windows.kl @@ -47,7 +47,7 @@ release :: (m: *Memory) print :: (string: String16) handle := GetStdHandle(STD_OUTPUT_HANDLE) - WriteConsoleW(handle, (string.str)->*void, string.len->DWORD, 0, 0) + WriteConsoleW(handle, string.str->*void, string.len->DWORD, 0, 0) performance_frequency: F64 time :: (): F64