This commit is contained in:
Krzosa Karol
2023-03-28 21:43:28 +02:00
parent 5495f96b3b
commit 622a5bd487
9 changed files with 35 additions and 42 deletions

View File

@@ -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;

View File

@@ -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));

View File

@@ -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

View File

@@ -1,4 +1,4 @@
#link "kernel32.lib"
#link "kernel32"
DWORD :: U32
LPCSTR :: *char

View File

@@ -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

View File

@@ -1,5 +1,5 @@
#import "KERNEL32.core"
#link "winmm.lib"
#link "winmm"
MMRESULT :: UINT
TIMERR_NOERROR :: 0

View File

@@ -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 }

View File

@@ -192,3 +192,5 @@ os_time() {
F64 result = time / 1000000.0; // Microseconds to seconds
return result;
}
bool os_enable_console_colors() { return true; }

View File

@@ -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;
}