mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Merge remote-tracking branch 'remotes/Odin-GitHub/master' into compiler-improvements-2022-12
This commit is contained in:
@@ -531,7 +531,7 @@ not_equal :: proc{not_equal_single, not_equal_array}
|
|||||||
|
|
||||||
any :: proc(x: $A/[$N]bool) -> (out: bool) {
|
any :: proc(x: $A/[$N]bool) -> (out: bool) {
|
||||||
for e in x {
|
for e in x {
|
||||||
if x {
|
if e {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,46 +123,17 @@ backing_type_kind :: proc(T: typeid) -> Type_Kind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type_info_base :: proc(info: ^Type_Info) -> ^Type_Info {
|
type_info_base :: runtime.type_info_base
|
||||||
if info == nil { return nil }
|
type_info_core :: runtime.type_info_core
|
||||||
|
|
||||||
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_without_enum :: type_info_core
|
type_info_base_without_enum :: type_info_core
|
||||||
|
|
||||||
|
|
||||||
typeid_base :: proc(id: typeid) -> typeid {
|
when !ODIN_DISALLOW_RTTI {
|
||||||
ti := type_info_of(id)
|
typeid_base :: runtime.typeid_base
|
||||||
ti = type_info_base(ti)
|
typeid_core :: runtime.typeid_core
|
||||||
return ti.id
|
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 {
|
any_base :: proc(v: any) -> any {
|
||||||
v := v
|
v := v
|
||||||
|
|||||||
@@ -615,7 +615,7 @@ shrink_dynamic_array :: proc(array: ^$T/[dynamic]$E, new_cap := -1, loc := #call
|
|||||||
old_size := a.cap * size_of(E)
|
old_size := a.cap * size_of(E)
|
||||||
new_size := new_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 {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -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
|
entries = make(type_of(entries), len(m), allocator) or_return
|
||||||
i := 0
|
i := 0
|
||||||
for key, value in m {
|
for key, value in m {
|
||||||
|
|||||||
@@ -1554,6 +1554,25 @@ WA_INACTIVE :: 0
|
|||||||
WA_ACTIVE :: 1
|
WA_ACTIVE :: 1
|
||||||
WA_CLICKACTIVE :: 2
|
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
|
// SetWindowsHook() codes
|
||||||
WH_MIN :: -1
|
WH_MIN :: -1
|
||||||
WH_MSGFILTER :: -1
|
WH_MSGFILTER :: -1
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ foreign user32 {
|
|||||||
AdjustWindowRectExForDpi :: proc(lpRect: LPRECT, dwStyle: DWORD, bMenu: BOOL, dwExStyle: DWORD, dpi: UINT) -> BOOL ---
|
AdjustWindowRectExForDpi :: proc(lpRect: LPRECT, dwStyle: DWORD, bMenu: BOOL, dwExStyle: DWORD, dpi: UINT) -> BOOL ---
|
||||||
|
|
||||||
SystemParametersInfoW :: proc(uiAction, uiParam: UINT, pvParam: PVOID, fWinIni: UINT) -> BOOL ---
|
SystemParametersInfoW :: proc(uiAction, uiParam: UINT, pvParam: PVOID, fWinIni: UINT) -> BOOL ---
|
||||||
|
GetMonitorInfoW :: proc(hMonitor: HMONITOR, lpmi: LPMONITORINFO) -> BOOL ---
|
||||||
|
|
||||||
GetWindowDC :: proc(hWnd: HWND) -> HDC ---
|
GetWindowDC :: proc(hWnd: HWND) -> HDC ---
|
||||||
GetDC :: proc(hWnd: HWND) -> HDC ---
|
GetDC :: proc(hWnd: HWND) -> HDC ---
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ format_file :: proc(filepath: string) -> (string, bool) {
|
|||||||
|
|
||||||
files: [dynamic]string;
|
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 {
|
if info.is_dir {
|
||||||
return 0, false;
|
return 0, false;
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ main :: proc() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if os.is_dir(path) {
|
} else if os.is_dir(path) {
|
||||||
filepath.walk(path, walk_files);
|
filepath.walk(path, walk_files, nil);
|
||||||
|
|
||||||
for file in files {
|
for file in files {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user