diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-12-18 21:50:14 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-12-18 21:50:14 +0000 |
| commit | e370337f97f80b99ff01031b7006e06d6433d475 (patch) | |
| tree | b6bbf7c6165fb8776813b94729ce9b412c7e32ba /core/sys | |
| parent | 5217eb55b4d0b53828d9ba4599a249216c813d42 (diff) | |
var/const decl; remove `:` from parameter lists
Diffstat (limited to 'core/sys')
| -rw-r--r-- | core/sys/windows.odin | 300 |
1 files changed, 150 insertions, 150 deletions
diff --git a/core/sys/windows.odin b/core/sys/windows.odin index a4e4d1b04..782494cbb 100644 --- a/core/sys/windows.odin +++ b/core/sys/windows.odin @@ -16,39 +16,39 @@ type LPARAM int; type LRESULT int; type ATOM i16; type BOOL i32; -type WNDPROC proc(hwnd: HWND, msg: u32, wparam: WPARAM, lparam: LPARAM) -> LRESULT; +type WNDPROC proc(hwnd HWND, msg u32, wparam WPARAM, lparam LPARAM) -> LRESULT; -INVALID_HANDLE_VALUE :: (-1 as int) as HANDLE; +const INVALID_HANDLE_VALUE = (-1 as int) as HANDLE; -CS_VREDRAW :: 0x0001; -CS_HREDRAW :: 0x0002; -CS_OWNDC :: 0x0020; -CW_USEDEFAULT :: -0x80000000; +const CS_VREDRAW = 0x0001; +const CS_HREDRAW = 0x0002; +const CS_OWNDC = 0x0020; +const CW_USEDEFAULT = -0x80000000; -WS_OVERLAPPED :: 0; -WS_MAXIMIZEBOX :: 0x00010000; -WS_MINIMIZEBOX :: 0x00020000; -WS_THICKFRAME :: 0x00040000; -WS_SYSMENU :: 0x00080000; -WS_CAPTION :: 0x00C00000; -WS_VISIBLE :: 0x10000000; -WS_OVERLAPPEDWINDOW :: WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX; +const WS_OVERLAPPED = 0; +const WS_MAXIMIZEBOX = 0x00010000; +const WS_MINIMIZEBOX = 0x00020000; +const WS_THICKFRAME = 0x00040000; +const WS_SYSMENU = 0x00080000; +const WS_CAPTION = 0x00C00000; +const WS_VISIBLE = 0x10000000; +const WS_OVERLAPPEDWINDOW = WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX; -WM_DESTROY :: 0x0002; -WM_CLOSE :: 0x0010; -WM_QUIT :: 0x0012; -WM_KEYDOWN :: 0x0100; -WM_KEYUP :: 0x0101; +const WM_DESTROY = 0x0002; +const WM_CLOSE = 0x0010; +const WM_QUIT = 0x0012; +const WM_KEYDOWN = 0x0100; +const WM_KEYUP = 0x0101; -PM_REMOVE :: 1; +const PM_REMOVE = 1; -COLOR_BACKGROUND :: 1 as HBRUSH; -BLACK_BRUSH :: 4; +const COLOR_BACKGROUND = 1 as HBRUSH; +const BLACK_BRUSH = 4; -SM_CXSCREEN :: 0; -SM_CYSCREEN :: 1; +const SM_CXSCREEN = 0; +const SM_CYSCREEN = 1; -SW_SHOW :: 5; +const SW_SHOW = 5; type POINT struct #ordered { x, y: i32; @@ -110,101 +110,101 @@ type WIN32_FILE_ATTRIBUTE_DATA struct #ordered { } type GET_FILEEX_INFO_LEVELS i32; -GetFileExInfoStandard :: 0 as GET_FILEEX_INFO_LEVELS; -GetFileExMaxInfoLevel :: 1 as GET_FILEEX_INFO_LEVELS; +const GetFileExInfoStandard = 0 as GET_FILEEX_INFO_LEVELS; +const GetFileExMaxInfoLevel = 1 as GET_FILEEX_INFO_LEVELS; proc GetLastError () -> i32 #foreign #dll_import -proc ExitProcess (exit_code: u32) #foreign #dll_import +proc ExitProcess (exit_code u32) #foreign #dll_import proc GetDesktopWindow() -> HWND #foreign #dll_import -proc GetCursorPos (p: ^POINT) -> i32 #foreign #dll_import -proc ScreenToClient (h: HWND, p: ^POINT) -> i32 #foreign #dll_import -proc GetModuleHandleA(module_name: ^u8) -> HINSTANCE #foreign #dll_import -proc GetStockObject (fn_object: i32) -> HGDIOBJ #foreign #dll_import -proc PostQuitMessage (exit_code: i32) #foreign #dll_import -proc SetWindowTextA (hwnd: HWND, c_string: ^u8) -> BOOL #foreign #dll_import +proc GetCursorPos (p ^POINT) -> i32 #foreign #dll_import +proc ScreenToClient (h HWND, p ^POINT) -> i32 #foreign #dll_import +proc GetModuleHandleA(module_name ^u8) -> HINSTANCE #foreign #dll_import +proc GetStockObject (fn_object i32) -> HGDIOBJ #foreign #dll_import +proc PostQuitMessage (exit_code i32) #foreign #dll_import +proc SetWindowTextA (hwnd HWND, c_string ^u8) -> BOOL #foreign #dll_import -proc QueryPerformanceFrequency(result: ^i64) -> i32 #foreign #dll_import -proc QueryPerformanceCounter (result: ^i64) -> i32 #foreign #dll_import +proc QueryPerformanceFrequency(result ^i64) -> i32 #foreign #dll_import +proc QueryPerformanceCounter (result ^i64) -> i32 #foreign #dll_import -proc Sleep(ms: i32) -> i32 #foreign #dll_import +proc Sleep(ms i32) -> i32 #foreign #dll_import -proc OutputDebugStringA(c_str: ^u8) #foreign #dll_import +proc OutputDebugStringA(c_str ^u8) #foreign #dll_import -proc RegisterClassExA(wc: ^WNDCLASSEXA) -> ATOM #foreign #dll_import -proc CreateWindowExA (ex_style: u32, - class_name, title: ^u8, - style: u32, - x, y, w, h: i32, - parent: HWND, menu: HMENU, instance: HINSTANCE, - param: rawptr) -> HWND #foreign #dll_import +proc RegisterClassExA(wc ^WNDCLASSEXA) -> ATOM #foreign #dll_import +proc CreateWindowExA (ex_style u32, + class_name, title ^u8, + style u32, + x, y, w, h i32, + parent HWND, menu HMENU, instance HINSTANCE, + param rawptr) -> HWND #foreign #dll_import -proc ShowWindow (hwnd: HWND, cmd_show: i32) -> BOOL #foreign #dll_import -proc TranslateMessage(msg: ^MSG) -> BOOL #foreign #dll_import -proc DispatchMessageA(msg: ^MSG) -> LRESULT #foreign #dll_import -proc UpdateWindow (hwnd: HWND) -> BOOL #foreign #dll_import -proc PeekMessageA (msg: ^MSG, hwnd: HWND, - msg_filter_min, msg_filter_max, remove_msg: u32) -> BOOL #foreign #dll_import +proc ShowWindow (hwnd HWND, cmd_show i32) -> BOOL #foreign #dll_import +proc TranslateMessage(msg ^MSG) -> BOOL #foreign #dll_import +proc DispatchMessageA(msg ^MSG) -> LRESULT #foreign #dll_import +proc UpdateWindow (hwnd HWND) -> BOOL #foreign #dll_import +proc PeekMessageA (msg ^MSG, hwnd HWND, + msg_filter_min, msg_filter_max, remove_msg u32) -> BOOL #foreign #dll_import -proc DefWindowProcA (hwnd: HWND, msg: u32, wparam: WPARAM, lparam: LPARAM) -> LRESULT #foreign #dll_import +proc DefWindowProcA (hwnd HWND, msg u32, wparam WPARAM, lparam LPARAM) -> LRESULT #foreign #dll_import -proc AdjustWindowRect(rect: ^RECT, style: u32, menu: BOOL) -> BOOL #foreign #dll_import +proc AdjustWindowRect(rect ^RECT, style u32, menu BOOL) -> BOOL #foreign #dll_import proc GetActiveWindow () -> HWND #foreign #dll_import proc GetQueryPerformanceFrequency() -> i64 { - r: i64; + var r i64; QueryPerformanceFrequency(^r); return r; } proc GetCommandLineA() -> ^u8 #foreign #dll_import -proc GetSystemMetrics(index: i32) -> i32 #foreign #dll_import +proc GetSystemMetrics(index i32) -> i32 #foreign #dll_import proc GetCurrentThreadId() -> u32 #foreign #dll_import // File Stuff -proc CloseHandle (h: HANDLE) -> i32 #foreign #dll_import -proc GetStdHandle(h: i32) -> HANDLE #foreign #dll_import -proc CreateFileA (filename: ^u8, desired_access, share_mode: u32, - security: rawptr, - creation, flags_and_attribs: u32, template_file: HANDLE) -> HANDLE #foreign #dll_import -proc ReadFile (h: HANDLE, buf: rawptr, to_read: u32, bytes_read: ^i32, overlapped: rawptr) -> BOOL #foreign #dll_import -proc WriteFile (h: HANDLE, buf: rawptr, len: i32, written_result: ^i32, overlapped: rawptr) -> i32 #foreign #dll_import +proc CloseHandle (h HANDLE) -> i32 #foreign #dll_import +proc GetStdHandle(h i32) -> HANDLE #foreign #dll_import +proc CreateFileA (filename ^u8, desired_access, share_mode u32, + security rawptr, + creation, flags_and_attribs u32, template_file HANDLE) -> HANDLE #foreign #dll_import +proc ReadFile (h HANDLE, buf rawptr, to_read u32, bytes_read ^i32, overlapped rawptr) -> BOOL #foreign #dll_import +proc WriteFile (h HANDLE, buf rawptr, len i32, written_result ^i32, overlapped rawptr) -> i32 #foreign #dll_import -proc GetFileSizeEx (file_handle: HANDLE, file_size: ^i64) -> BOOL #foreign #dll_import -proc GetFileAttributesExA (filename: ^u8, info_level_id: GET_FILEEX_INFO_LEVELS, file_info: rawptr) -> BOOL #foreign #dll_import -proc GetFileInformationByHandle(file_handle: HANDLE, file_info: ^BY_HANDLE_FILE_INFORMATION) -> BOOL #foreign #dll_import +proc GetFileSizeEx (file_handle HANDLE, file_size ^i64) -> BOOL #foreign #dll_import +proc GetFileAttributesExA (filename ^u8, info_level_id GET_FILEEX_INFO_LEVELS, file_info rawptr) -> BOOL #foreign #dll_import +proc GetFileInformationByHandle(file_handle HANDLE, file_info ^BY_HANDLE_FILE_INFORMATION) -> BOOL #foreign #dll_import -FILE_SHARE_READ :: 0x00000001; -FILE_SHARE_WRITE :: 0x00000002; -FILE_SHARE_DELETE :: 0x00000004; -FILE_GENERIC_ALL :: 0x10000000; -FILE_GENERIC_EXECUTE :: 0x20000000; -FILE_GENERIC_WRITE :: 0x40000000; -FILE_GENERIC_READ :: 0x80000000; +const FILE_SHARE_READ = 0x00000001; +const FILE_SHARE_WRITE = 0x00000002; +const FILE_SHARE_DELETE = 0x00000004; +const FILE_GENERIC_ALL = 0x10000000; +const FILE_GENERIC_EXECUTE = 0x20000000; +const FILE_GENERIC_WRITE = 0x40000000; +const FILE_GENERIC_READ = 0x80000000; -STD_INPUT_HANDLE :: -10; -STD_OUTPUT_HANDLE :: -11; -STD_ERROR_HANDLE :: -12; +const STD_INPUT_HANDLE = -10; +const STD_OUTPUT_HANDLE = -11; +const STD_ERROR_HANDLE = -12; -CREATE_NEW :: 1; -CREATE_ALWAYS :: 2; -OPEN_EXISTING :: 3; -OPEN_ALWAYS :: 4; -TRUNCATE_EXISTING :: 5; +const CREATE_NEW = 1; +const CREATE_ALWAYS = 2; +const OPEN_EXISTING = 3; +const OPEN_ALWAYS = 4; +const TRUNCATE_EXISTING = 5; -proc HeapAlloc (h: HANDLE, flags: u32, bytes: int) -> rawptr #foreign #dll_import -proc HeapReAlloc (h: HANDLE, flags: u32, memory: rawptr, bytes: int) -> rawptr #foreign #dll_import -proc HeapFree (h: HANDLE, flags: u32, memory: rawptr) -> BOOL #foreign #dll_import +proc HeapAlloc (h HANDLE, flags u32, bytes int) -> rawptr #foreign #dll_import +proc HeapReAlloc (h HANDLE, flags u32, memory rawptr, bytes int) -> rawptr #foreign #dll_import +proc HeapFree (h HANDLE, flags u32, memory rawptr) -> BOOL #foreign #dll_import proc GetProcessHeap() -> HANDLE #foreign #dll_import -HEAP_ZERO_MEMORY :: 0x00000008; +const HEAP_ZERO_MEMORY = 0x00000008; // Synchronization @@ -214,24 +214,24 @@ type SECURITY_ATTRIBUTES struct #ordered { inherit_handle: BOOL; } -INFINITE :: 0xffffffff; +const INFINITE = 0xffffffff; -proc CreateSemaphoreA (attributes: ^SECURITY_ATTRIBUTES, initial_count, maximum_count: i32, name: ^byte) -> HANDLE #foreign #dll_import -proc ReleaseSemaphore (semaphore: HANDLE, release_count: i32, previous_count: ^i32) -> BOOL #foreign #dll_import -proc WaitForSingleObject(handle: HANDLE, milliseconds: u32) -> u32 #foreign #dll_import +proc CreateSemaphoreA (attributes ^SECURITY_ATTRIBUTES, initial_count, maximum_count i32, name ^byte) -> HANDLE #foreign #dll_import +proc ReleaseSemaphore (semaphore HANDLE, release_count i32, previous_count ^i32) -> BOOL #foreign #dll_import +proc WaitForSingleObject(handle HANDLE, milliseconds u32) -> u32 #foreign #dll_import -proc InterlockedCompareExchange(dst: ^i32, exchange, comparand: i32) -> i32 #foreign -proc InterlockedExchange (dst: ^i32, desired: i32) -> i32 #foreign -proc InterlockedExchangeAdd (dst: ^i32, desired: i32) -> i32 #foreign -proc InterlockedAnd (dst: ^i32, desired: i32) -> i32 #foreign -proc InterlockedOr (dst: ^i32, desired: i32) -> i32 #foreign +proc InterlockedCompareExchange(dst ^i32, exchange, comparand i32) -> i32 #foreign +proc InterlockedExchange (dst ^i32, desired i32) -> i32 #foreign +proc InterlockedExchangeAdd (dst ^i32, desired i32) -> i32 #foreign +proc InterlockedAnd (dst ^i32, desired i32) -> i32 #foreign +proc InterlockedOr (dst ^i32, desired i32) -> i32 #foreign -proc InterlockedCompareExchange64(dst: ^i64, exchange, comparand: i64) -> i64 #foreign -proc InterlockedExchange64 (dst: ^i64, desired: i64) -> i64 #foreign -proc InterlockedExchangeAdd64 (dst: ^i64, desired: i64) -> i64 #foreign -proc InterlockedAnd64 (dst: ^i64, desired: i64) -> i64 #foreign -proc InterlockedOr64 (dst: ^i64, desired: i64) -> i64 #foreign +proc InterlockedCompareExchange64(dst ^i64, exchange, comparand i64) -> i64 #foreign +proc InterlockedExchange64 (dst ^i64, desired i64) -> i64 #foreign +proc InterlockedExchangeAdd64 (dst ^i64, desired i64) -> i64 #foreign +proc InterlockedAnd64 (dst ^i64, desired i64) -> i64 #foreign +proc InterlockedOr64 (dst ^i64, desired i64) -> i64 #foreign proc _mm_pause () #foreign proc ReadWriteBarrier() #foreign @@ -262,54 +262,54 @@ type RGBQUAD struct #ordered { blue, green, red, reserved: byte; } -BI_RGB :: 0; -DIB_RGB_COLORS :: 0x00; -SRCCOPY :: 0x00cc0020 as u32; +const BI_RGB = 0; +const DIB_RGB_COLORS = 0x00; +const SRCCOPY = 0x00cc0020 as u32; -proc StretchDIBits(hdc: HDC, - x_dst, y_dst, width_dst, height_dst: i32, - x_src, y_src, width_src, header_src: i32, - bits: rawptr, bits_info: ^BITMAPINFO, - usage: u32, - rop: u32) -> i32 #foreign #dll_import +proc StretchDIBits(hdc HDC, + x_dst, y_dst, width_dst, height_dst i32, + x_src, y_src, width_src, header_src i32, + bits rawptr, bits_info ^BITMAPINFO, + usage u32, + rop u32) -> i32 #foreign #dll_import -proc LoadLibraryA (c_str: ^u8) -> HMODULE #foreign -proc FreeLibrary (h: HMODULE) #foreign -proc GetProcAddress(h: HMODULE, c_str: ^u8) -> PROC #foreign +proc LoadLibraryA (c_str ^u8) -> HMODULE #foreign +proc FreeLibrary (h HMODULE) #foreign +proc GetProcAddress(h HMODULE, c_str ^u8) -> PROC #foreign -proc GetClientRect(hwnd: HWND, rect: ^RECT) -> BOOL #foreign +proc GetClientRect(hwnd HWND, rect ^RECT) -> BOOL #foreign // Windows OpenGL -PFD_TYPE_RGBA :: 0; -PFD_TYPE_COLORINDEX :: 1; -PFD_MAIN_PLANE :: 0; -PFD_OVERLAY_PLANE :: 1; -PFD_UNDERLAY_PLANE :: -1; -PFD_DOUBLEBUFFER :: 1; -PFD_STEREO :: 2; -PFD_DRAW_TO_WINDOW :: 4; -PFD_DRAW_TO_BITMAP :: 8; -PFD_SUPPORT_GDI :: 16; -PFD_SUPPORT_OPENGL :: 32; -PFD_GENERIC_FORMAT :: 64; -PFD_NEED_PALETTE :: 128; -PFD_NEED_SYSTEM_PALETTE :: 0x00000100; -PFD_SWAP_EXCHANGE :: 0x00000200; -PFD_SWAP_COPY :: 0x00000400; -PFD_SWAP_LAYER_BUFFERS :: 0x00000800; -PFD_GENERIC_ACCELERATED :: 0x00001000; -PFD_DEPTH_DONTCARE :: 0x20000000; -PFD_DOUBLEBUFFER_DONTCARE :: 0x40000000; -PFD_STEREO_DONTCARE :: 0x80000000; +const PFD_TYPE_RGBA = 0; +const PFD_TYPE_COLORINDEX = 1; +const PFD_MAIN_PLANE = 0; +const PFD_OVERLAY_PLANE = 1; +const PFD_UNDERLAY_PLANE = -1; +const PFD_DOUBLEBUFFER = 1; +const PFD_STEREO = 2; +const PFD_DRAW_TO_WINDOW = 4; +const PFD_DRAW_TO_BITMAP = 8; +const PFD_SUPPORT_GDI = 16; +const PFD_SUPPORT_OPENGL = 32; +const PFD_GENERIC_FORMAT = 64; +const PFD_NEED_PALETTE = 128; +const PFD_NEED_SYSTEM_PALETTE = 0x00000100; +const PFD_SWAP_EXCHANGE = 0x00000200; +const PFD_SWAP_COPY = 0x00000400; +const PFD_SWAP_LAYER_BUFFERS = 0x00000800; +const PFD_GENERIC_ACCELERATED = 0x00001000; +const PFD_DEPTH_DONTCARE = 0x20000000; +const PFD_DOUBLEBUFFER_DONTCARE = 0x40000000; +const PFD_STEREO_DONTCARE = 0x80000000; type HGLRC HANDLE; type PROC proc(); -type wglCreateContextAttribsARBType proc(hdc: HDC, hshareContext: rawptr, attribList: ^i32) -> HGLRC; +type wglCreateContextAttribsARBType proc(hdc HDC, hshareContext rawptr, attribList ^i32) -> HGLRC; type PIXELFORMATDESCRIPTOR struct #ordered { @@ -343,29 +343,29 @@ type PIXELFORMATDESCRIPTOR struct #ordered { damage_mask: u32; } -proc GetDC (h: HANDLE) -> HDC #foreign -proc SetPixelFormat (hdc: HDC, pixel_format: i32, pfd: ^PIXELFORMATDESCRIPTOR ) -> BOOL #foreign #dll_import -proc ChoosePixelFormat(hdc: HDC, pfd: ^PIXELFORMATDESCRIPTOR) -> i32 #foreign #dll_import -proc SwapBuffers (hdc: HDC) -> BOOL #foreign #dll_import -proc ReleaseDC (wnd: HWND, hdc: HDC) -> i32 #foreign #dll_import +proc GetDC (h HANDLE) -> HDC #foreign +proc SetPixelFormat (hdc HDC, pixel_format i32, pfd ^PIXELFORMATDESCRIPTOR ) -> BOOL #foreign #dll_import +proc ChoosePixelFormat(hdc HDC, pfd ^PIXELFORMATDESCRIPTOR) -> i32 #foreign #dll_import +proc SwapBuffers (hdc HDC) -> BOOL #foreign #dll_import +proc ReleaseDC (wnd HWND, hdc HDC) -> i32 #foreign #dll_import -WGL_CONTEXT_MAJOR_VERSION_ARB :: 0x2091; -WGL_CONTEXT_MINOR_VERSION_ARB :: 0x2092; -WGL_CONTEXT_PROFILE_MASK_ARB :: 0x9126; -WGL_CONTEXT_CORE_PROFILE_BIT_ARB :: 0x0001; -WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB :: 0x0002; +const WGL_CONTEXT_MAJOR_VERSION_ARB = 0x2091; +const WGL_CONTEXT_MINOR_VERSION_ARB = 0x2092; +const WGL_CONTEXT_PROFILE_MASK_ARB = 0x9126; +const WGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x0001; +const WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x0002; -proc wglCreateContext (hdc: HDC) -> HGLRC #foreign #dll_import -proc wglMakeCurrent (hdc: HDC, hglrc: HGLRC) -> BOOL #foreign #dll_import -proc wglGetProcAddress(c_str: ^u8) -> PROC #foreign #dll_import -proc wglDeleteContext (hglrc: HGLRC) -> BOOL #foreign #dll_import +proc wglCreateContext (hdc HDC) -> HGLRC #foreign #dll_import +proc wglMakeCurrent (hdc HDC, hglrc HGLRC) -> BOOL #foreign #dll_import +proc wglGetProcAddress(c_str ^u8) -> PROC #foreign #dll_import +proc wglDeleteContext (hglrc HGLRC) -> BOOL #foreign #dll_import -proc GetKeyState (v_key: i32) -> i16 #foreign #dll_import -proc GetAsyncKeyState(v_key: i32) -> i16 #foreign #dll_import +proc GetKeyState (v_key i32) -> i16 #foreign #dll_import +proc GetAsyncKeyState(v_key i32) -> i16 #foreign #dll_import -proc is_key_down(key: Key_Code) -> bool { +proc is_key_down(key Key_Code) -> bool { return GetAsyncKeyState(key as i32) < 0; } |