diff --git a/base_data_structures.cpp b/base_data_structures.cpp index b7ae3c6..e6193dd 100644 --- a/base_data_structures.cpp +++ b/base_data_structures.cpp @@ -301,9 +301,6 @@ intern_string(Intern_Table *t, String string) { //----------------------------------------------------------------------------- // Array List -// @todo(krzosa): If even one item got removed from block -// @! Make List api more convenient list.add -// the block should go on free list //----------------------------------------------------------------------------- const int LIST_DEFAULT_BLOCK_SIZE = 32; const int LIST_DEFAULT_ALLOCATION_MUL = 2; diff --git a/core_typechecking.cpp b/core_typechecking.cpp index 093eebe..e09b4a9 100644 --- a/core_typechecking.cpp +++ b/core_typechecking.cpp @@ -1556,9 +1556,6 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str } else { - // if (node->name->pos->string == "CreateFileW"_s) { - // __debugbreak(); - // } Operand name = resolve_expr(node->name, inherit_flag(flags, AST_CANT_BE_NULL), 0, field_access_scope); if (name.type->kind != TYPE_LAMBDA) { compiler_error(node->pos, "Calling %Q which is not a [Lambda]", typestring(name.type)); diff --git a/modules/GDI32.core b/modules/GDI32.core index caad1b2..1b3aada 100644 --- a/modules/GDI32.core +++ b/modules/GDI32.core @@ -1,5 +1,5 @@ #import "KERNEL32.core" -#link "gdi32.lib" +#link "gdi32" RBGQUAD :: struct;; rgbBlue: BYTE; rgbGreen: BYTE; rgbRed: BYTE; rgbReserved: BYTE BITMAPINFOHEADER :: struct;; biSize: DWORD; biWidth: LONG; biHeight: LONG; biPlanes: WORD; biBitCount: WORD; biCompression: DWORD; biSizeImage: DWORD; biXPelsPerMeter: LONG; biYPelsPerMeter: LONG; biClrUsed: DWORD; biClrImportant: DWORD BITMAPINFO :: struct;; bmiHeader: BITMAPINFOHEADER; bmiColors: [1]RBGQUAD diff --git a/modules/KERNEL32.core b/modules/KERNEL32.core index 30669a5..72060cb 100644 --- a/modules/KERNEL32.core +++ b/modules/KERNEL32.core @@ -1,4 +1,4 @@ -#link "kernel32.lib" +#link "kernel32" DWORD :: U32 LPCSTR :: *char diff --git a/modules/USER32.core b/modules/USER32.core index 24b60f3..53010bc 100644 --- a/modules/USER32.core +++ b/modules/USER32.core @@ -1,5 +1,5 @@ #import "KERNEL32.core" -#link "user32.lib" +#link "user32" WNDPROC :: (hwnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM): LRESULT WNDCLASSW :: struct;; style: UINT; lpfnWndProc: WNDPROC; cbClsExtra: int; cbWndExtra: int; hInstance: HINSTANCE; hIcon: HICON; hCursor: HCURSOR; hbrBackground: HBRUSH; lpszMenuName: LPCWSTR; lpszClassName: LPCWSTR MSG :: struct;; hwnd: HWND; message: UINT; wParam: WPARAM; lParam: LPARAM; time: DWORD; pt: POINT; lPrivate: DWORD diff --git a/modules/WINMM.core b/modules/WINMM.core index 36d03fc..a73fb14 100644 --- a/modules/WINMM.core +++ b/modules/WINMM.core @@ -1,5 +1,5 @@ #import "KERNEL32.core" -#link "winmm.lib" +#link "winmm" MMRESULT :: UINT TIMERR_NOERROR :: 0 diff --git a/modules/win32_multimedia.core b/modules/win32_multimedia.core index bb6671e..1b45da3 100644 --- a/modules/win32_multimedia.core +++ b/modules/win32_multimedia.core @@ -77,11 +77,11 @@ GetWindowPos :: (window: HWND): Vec2I AdjustWindowRect :: (window: HWND, style: DWORD, rect: *RECT): void FALSE :: 0 - if window == 0 - dpi := GetDpiForWindow(window) - AdjustWindowRectExForDpi(rect, style, FALSE, 0, dpi) - else - AdjustWindowRectEx(rect, style, FALSE, 0) + // if window == 0 + // dpi := GetDpiForWindow(window) + // AdjustWindowRectExForDpi(rect, style, FALSE, 0, dpi) + // else + AdjustWindowRectEx(rect, style, FALSE, 0) SetWindowSize :: (window: HWND, style: DWORD, size: Vec2I): void rect := RECT{ 0, 0, size.x->LONG, size.y->LONG } diff --git a/os_linux.cpp b/os_linux.cpp index 44e1017..68a0aad 100644 --- a/os_linux.cpp +++ b/os_linux.cpp @@ -192,3 +192,5 @@ os_time() { F64 result = time / 1000000.0; // Microseconds to seconds return result; } + +bool os_enable_console_colors() { return true; } \ No newline at end of file diff --git a/os_windows.cpp b/os_windows.cpp index efccf63..9f6412a 100644 --- a/os_windows.cpp +++ b/os_windows.cpp @@ -57,33 +57,6 @@ os_decommit_pos(OS_Memory *m, size_t pos) { return false; } -CORE_Static void -test_os_memory() { - assert(align_down(4096, 4096) == 4096); - assert(align_down(4095, 4096) == 0); - - OS_Memory memory = os_reserve(9000); - assert(memory.reserve == 4096 * 3 && memory.data && memory.commit == 0); - os_commit(&memory, 100); - assert(memory.commit == 4096); - os_commit(&memory, 100); - assert(memory.commit == 4096 * 2); - os_commit(&memory, 9000); - assert(memory.commit == 4096 * 3); - os_commit(&memory, 9000); - assert(memory.commit == 4096 * 3); - - os_decommit_pos(&memory, 4096); - assert(memory.commit == 4096); - os_decommit_pos(&memory, 4096); - assert(memory.commit == 4096); - os_decommit_pos(&memory, 0); - assert(memory.commit == 0); - - os_release(&memory); - assert(memory.data == 0); -} - //----------------------------------------------------------------------------- // Time //----------------------------------------------------------------------------- @@ -241,3 +214,27 @@ os_list_dir(Arena *scratch, Allocator *a, String dir, U32 flags = LIST_NO_FLAGS) return result; } + +bool os_enable_console_colors() { + // Set output mode to handle virtual terminal sequences + HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); + if (hOut != INVALID_HANDLE_VALUE) { + DWORD dwMode = 0; + if (GetConsoleMode(hOut, &dwMode)) { + dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; + if (SetConsoleMode(hOut, dwMode)) { + return true; + } + else { + printf("Failed to enable colored terminal output C\n"); + } + } + else { + printf("Failed to enable colored terminal output B\n"); + } + } + else { + printf("Failed to enable colored terminal output A\n"); + } + return false; +} \ No newline at end of file