diff --git a/core/math/linalg/extended.odin b/core/math/linalg/extended.odin index f6da366ba..b78697cbd 100644 --- a/core/math/linalg/extended.odin +++ b/core/math/linalg/extended.odin @@ -531,7 +531,7 @@ not_equal :: proc{not_equal_single, not_equal_array} any :: proc(x: $A/[$N]bool) -> (out: bool) { for e in x { - if x { + if e { return true } } diff --git a/core/reflect/reflect.odin b/core/reflect/reflect.odin index 8aab77399..0312ffd95 100644 --- a/core/reflect/reflect.odin +++ b/core/reflect/reflect.odin @@ -123,46 +123,17 @@ backing_type_kind :: proc(T: typeid) -> Type_Kind { } -type_info_base :: proc(info: ^Type_Info) -> ^Type_Info { - if info == nil { return nil } - - base := info - loop: for { - #partial switch i in base.variant { - case Type_Info_Named: base = i.base - case: break loop - } - } - return base -} - - -type_info_core :: proc(info: ^Type_Info) -> ^Type_Info { - if info == nil { return nil } - - base := info - loop: for { - #partial switch i in base.variant { - case Type_Info_Named: base = i.base - case Type_Info_Enum: base = i.base - case: break loop - } - } - return base -} +type_info_base :: runtime.type_info_base +type_info_core :: runtime.type_info_core type_info_base_without_enum :: type_info_core -typeid_base :: proc(id: typeid) -> typeid { - ti := type_info_of(id) - ti = type_info_base(ti) - return ti.id +when !ODIN_DISALLOW_RTTI { + typeid_base :: runtime.typeid_base + typeid_core :: runtime.typeid_core + typeid_base_without_enum :: typeid_core } -typeid_core :: proc(id: typeid) -> typeid { - ti := type_info_base_without_enum(type_info_of(id)) - return ti.id -} -typeid_base_without_enum :: typeid_core + any_base :: proc(v: any) -> any { v := v diff --git a/core/runtime/core_builtin.odin b/core/runtime/core_builtin.odin index 6792734d2..cbcb162a8 100644 --- a/core/runtime/core_builtin.odin +++ b/core/runtime/core_builtin.odin @@ -615,7 +615,7 @@ shrink_dynamic_array :: proc(array: ^$T/[dynamic]$E, new_cap := -1, loc := #call old_size := a.cap * size_of(E) new_size := new_cap * size_of(E) - new_data, err := mem_resize(a.data, old_size, new_size, align_of(E), allocator, loc) + new_data, err := mem_resize(a.data, old_size, new_size, align_of(E), a.allocator, loc) if err != nil { return } diff --git a/core/slice/map.odin b/core/slice/map.odin index 22f0db9b9..50d6dbd37 100644 --- a/core/slice/map.odin +++ b/core/slice/map.odin @@ -37,7 +37,7 @@ Map_Entry_Info :: struct($Key, $Value: typeid) { } -map_entries :: proc(m: $M/map[$K]$V, allocator := context.allocator) -> (entries: []Map_Entry(K, V), err: runtime.Allocator) { +map_entries :: proc(m: $M/map[$K]$V, allocator := context.allocator) -> (entries: []Map_Entry(K, V), err: runtime.Allocator_Error) { entries = make(type_of(entries), len(m), allocator) or_return i := 0 for key, value in m { diff --git a/core/sys/windows/types.odin b/core/sys/windows/types.odin index 9a2a21070..210c39aaa 100644 --- a/core/sys/windows/types.odin +++ b/core/sys/windows/types.odin @@ -1554,6 +1554,25 @@ WA_INACTIVE :: 0 WA_ACTIVE :: 1 WA_CLICKACTIVE :: 2 +// Struct pointed to by WM_GETMINMAXINFO lParam +MINMAXINFO :: struct { + ptReserved: POINT, + ptMaxSize: POINT, + ptMaxPosition: POINT, + ptMinTrackSize: POINT, + ptMaxTrackSize: POINT, +} +PMINMAXINFO :: ^MINMAXINFO +LPMINMAXINFO :: PMINMAXINFO + +MONITORINFO :: struct { + cbSize: DWORD, + rcMonitor: RECT, + rcWork: RECT, + dwFlags: DWORD, +} +LPMONITORINFO :: ^MONITORINFO + // SetWindowsHook() codes WH_MIN :: -1 WH_MSGFILTER :: -1 diff --git a/core/sys/windows/user32.odin b/core/sys/windows/user32.odin index 9a30e6454..61f2a3dac 100644 --- a/core/sys/windows/user32.odin +++ b/core/sys/windows/user32.odin @@ -100,6 +100,7 @@ foreign user32 { AdjustWindowRectExForDpi :: proc(lpRect: LPRECT, dwStyle: DWORD, bMenu: BOOL, dwExStyle: DWORD, dpi: UINT) -> BOOL --- SystemParametersInfoW :: proc(uiAction, uiParam: UINT, pvParam: PVOID, fWinIni: UINT) -> BOOL --- + GetMonitorInfoW :: proc(hMonitor: HMONITOR, lpmi: LPMONITORINFO) -> BOOL --- GetWindowDC :: proc(hWnd: HWND) -> HDC --- GetDC :: proc(hWnd: HWND) -> HDC --- diff --git a/tools/odinfmt/main.odin b/tools/odinfmt/main.odin index 48e3b7212..9b9cbac0b 100644 --- a/tools/odinfmt/main.odin +++ b/tools/odinfmt/main.odin @@ -55,7 +55,7 @@ format_file :: proc(filepath: string) -> (string, bool) { files: [dynamic]string; -walk_files :: proc(info: os.File_Info, in_err: os.Errno) -> (err: os.Errno, skip_dir: bool) { +walk_files :: proc(info: os.File_Info, in_err: os.Errno, user_data: rawptr) -> (err: os.Errno, skip_dir: bool) { if info.is_dir { return 0, false; } @@ -111,7 +111,7 @@ main :: proc() { } } } else if os.is_dir(path) { - filepath.walk(path, walk_files); + filepath.walk(path, walk_files, nil); for file in files {