Factor
This commit is contained in:
@@ -301,9 +301,6 @@ intern_string(Intern_Table *t, String string) {
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Array List
|
// 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_BLOCK_SIZE = 32;
|
||||||
const int LIST_DEFAULT_ALLOCATION_MUL = 2;
|
const int LIST_DEFAULT_ALLOCATION_MUL = 2;
|
||||||
|
|||||||
@@ -1556,9 +1556,6 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
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);
|
Operand name = resolve_expr(node->name, inherit_flag(flags, AST_CANT_BE_NULL), 0, field_access_scope);
|
||||||
if (name.type->kind != TYPE_LAMBDA) {
|
if (name.type->kind != TYPE_LAMBDA) {
|
||||||
compiler_error(node->pos, "Calling %Q which is not a [Lambda]", typestring(name.type));
|
compiler_error(node->pos, "Calling %Q which is not a [Lambda]", typestring(name.type));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import "KERNEL32.core"
|
#import "KERNEL32.core"
|
||||||
#link "gdi32.lib"
|
#link "gdi32"
|
||||||
RBGQUAD :: struct;; rgbBlue: BYTE; rgbGreen: BYTE; rgbRed: BYTE; rgbReserved: BYTE
|
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
|
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
|
BITMAPINFO :: struct;; bmiHeader: BITMAPINFOHEADER; bmiColors: [1]RBGQUAD
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#link "kernel32.lib"
|
#link "kernel32"
|
||||||
|
|
||||||
DWORD :: U32
|
DWORD :: U32
|
||||||
LPCSTR :: *char
|
LPCSTR :: *char
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import "KERNEL32.core"
|
#import "KERNEL32.core"
|
||||||
#link "user32.lib"
|
#link "user32"
|
||||||
WNDPROC :: (hwnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM): LRESULT
|
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
|
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
|
MSG :: struct;; hwnd: HWND; message: UINT; wParam: WPARAM; lParam: LPARAM; time: DWORD; pt: POINT; lPrivate: DWORD
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import "KERNEL32.core"
|
#import "KERNEL32.core"
|
||||||
#link "winmm.lib"
|
#link "winmm"
|
||||||
|
|
||||||
MMRESULT :: UINT
|
MMRESULT :: UINT
|
||||||
TIMERR_NOERROR :: 0
|
TIMERR_NOERROR :: 0
|
||||||
|
|||||||
@@ -77,11 +77,11 @@ GetWindowPos :: (window: HWND): Vec2I
|
|||||||
|
|
||||||
AdjustWindowRect :: (window: HWND, style: DWORD, rect: *RECT): void
|
AdjustWindowRect :: (window: HWND, style: DWORD, rect: *RECT): void
|
||||||
FALSE :: 0
|
FALSE :: 0
|
||||||
if window == 0
|
// if window == 0
|
||||||
dpi := GetDpiForWindow(window)
|
// dpi := GetDpiForWindow(window)
|
||||||
AdjustWindowRectExForDpi(rect, style, FALSE, 0, dpi)
|
// AdjustWindowRectExForDpi(rect, style, FALSE, 0, dpi)
|
||||||
else
|
// else
|
||||||
AdjustWindowRectEx(rect, style, FALSE, 0)
|
AdjustWindowRectEx(rect, style, FALSE, 0)
|
||||||
|
|
||||||
SetWindowSize :: (window: HWND, style: DWORD, size: Vec2I): void
|
SetWindowSize :: (window: HWND, style: DWORD, size: Vec2I): void
|
||||||
rect := RECT{ 0, 0, size.x->LONG, size.y->LONG }
|
rect := RECT{ 0, 0, size.x->LONG, size.y->LONG }
|
||||||
|
|||||||
@@ -192,3 +192,5 @@ os_time() {
|
|||||||
F64 result = time / 1000000.0; // Microseconds to seconds
|
F64 result = time / 1000000.0; // Microseconds to seconds
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool os_enable_console_colors() { return true; }
|
||||||
@@ -57,33 +57,6 @@ os_decommit_pos(OS_Memory *m, size_t pos) {
|
|||||||
return false;
|
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
|
// Time
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -241,3 +214,27 @@ os_list_dir(Arena *scratch, Allocator *a, String dir, U32 flags = LIST_NO_FLAGS)
|
|||||||
|
|
||||||
return result;
|
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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user