Merge branch 'master' into tiocgwinsz_time

This commit is contained in:
Raph
2025-06-20 16:50:00 -01:00
committed by GitHub
592 changed files with 70971 additions and 11986 deletions
+46 -47
View File
@@ -82,7 +82,6 @@ Application_setActivationPolicy :: proc "c" (self: ^Application, activationPolic
// NOTE: this is technically deprecated but still actively used (Sokol, glfw, SDL, etc.)
// and has no clear alternative although `activate` is what Apple tells you to use,
// that does not work the same way.
// @(deprecated="Use NSApplication method activate instead.")
@(objc_type=Application, objc_name="activateIgnoringOtherApps")
Application_activateIgnoringOtherApps :: proc "c" (self: ^Application, ignoreOtherApps: BOOL) {
msgSend(nil, self, "activateIgnoringOtherApps:", ignoreOtherApps)
@@ -99,7 +98,7 @@ Application_setTitle :: proc "c" (self: ^Application, title: ^String) {
}
@(objc_type=Application, objc_name="mainMenu")
Window_mainMenu :: proc "c" (self: ^Application) -> ^Menu {
Application_mainMenu :: proc "c" (self: ^Application) -> ^Menu {
return msgSend(^Menu, self, "mainMenu")
}
@@ -256,7 +255,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
return nil
}
if template.applicationWillFinishLaunching != nil {
applicationWillFinishLaunching :: proc "c" (self: id, notification: ^Notification) {
applicationWillFinishLaunching :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillFinishLaunching(notification)
@@ -264,7 +263,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillFinishLaunching:"), auto_cast applicationWillFinishLaunching, "v@:@")
}
if template.applicationDidFinishLaunching != nil {
applicationDidFinishLaunching :: proc "c" (self: id, notification: ^Notification) {
applicationDidFinishLaunching :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidFinishLaunching(notification)
@@ -272,7 +271,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidFinishLaunching:"), auto_cast applicationDidFinishLaunching, "v@:@")
}
if template.applicationWillBecomeActive != nil {
applicationWillBecomeActive :: proc "c" (self: id, notification: ^Notification) {
applicationWillBecomeActive :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillBecomeActive(notification)
@@ -280,7 +279,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillBecomeActive:"), auto_cast applicationWillBecomeActive, "v@:@")
}
if template.applicationDidBecomeActive != nil {
applicationDidBecomeActive :: proc "c" (self: id, notification: ^Notification) {
applicationDidBecomeActive :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidBecomeActive(notification)
@@ -288,7 +287,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidBecomeActive:"), auto_cast applicationDidBecomeActive, "v@:@")
}
if template.applicationWillResignActive != nil {
applicationWillResignActive :: proc "c" (self: id, notification: ^Notification) {
applicationWillResignActive :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillResignActive(notification)
@@ -296,7 +295,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillResignActive:"), auto_cast applicationWillResignActive, "v@:@")
}
if template.applicationDidResignActive != nil {
applicationDidResignActive :: proc "c" (self: id, notification: ^Notification) {
applicationDidResignActive :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidResignActive(notification)
@@ -304,7 +303,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidResignActive:"), auto_cast applicationDidResignActive, "v@:@")
}
if template.applicationShouldTerminate != nil {
applicationShouldTerminate :: proc "c" (self: id, sender: ^Application) -> ApplicationTerminateReply {
applicationShouldTerminate :: proc "c" (self: id, cmd: SEL, sender: ^Application) -> ApplicationTerminateReply {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationShouldTerminate(sender)
@@ -312,7 +311,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationShouldTerminate:"), auto_cast applicationShouldTerminate, _UINTEGER_ENCODING+"@:@")
}
if template.applicationShouldTerminateAfterLastWindowClosed != nil {
applicationShouldTerminateAfterLastWindowClosed :: proc "c" (self: id, sender: ^Application) -> BOOL {
applicationShouldTerminateAfterLastWindowClosed :: proc "c" (self: id, cmd: SEL, sender: ^Application) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationShouldTerminateAfterLastWindowClosed(sender)
@@ -320,7 +319,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationShouldTerminateAfterLastWindowClosed:"), auto_cast applicationShouldTerminateAfterLastWindowClosed, "B@:@")
}
if template.applicationWillTerminate != nil {
applicationWillTerminate :: proc "c" (self: id, notification: ^Notification) {
applicationWillTerminate :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillTerminate(notification)
@@ -328,7 +327,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillTerminate:"), auto_cast applicationWillTerminate, "v@:@")
}
if template.applicationWillHide != nil {
applicationWillHide :: proc "c" (self: id, notification: ^Notification) {
applicationWillHide :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillHide(notification)
@@ -336,7 +335,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillHide:"), auto_cast applicationWillHide, "v@:@")
}
if template.applicationDidHide != nil {
applicationDidHide :: proc "c" (self: id, notification: ^Notification) {
applicationDidHide :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidHide(notification)
@@ -344,7 +343,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidHide:"), auto_cast applicationDidHide, "v@:@")
}
if template.applicationWillUnhide != nil {
applicationWillUnhide :: proc "c" (self: id, notification: ^Notification) {
applicationWillUnhide :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillUnhide(notification)
@@ -352,7 +351,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillUnhide:"), auto_cast applicationWillUnhide, "v@:@")
}
if template.applicationDidUnhide != nil {
applicationDidUnhide :: proc "c" (self: id, notification: ^Notification) {
applicationDidUnhide :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidUnhide(notification)
@@ -360,7 +359,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidUnhide:"), auto_cast applicationDidUnhide, "v@:@")
}
if template.applicationWillUpdate != nil {
applicationWillUpdate :: proc "c" (self: id, notification: ^Notification) {
applicationWillUpdate :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillUpdate(notification)
@@ -368,7 +367,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillUpdate:"), auto_cast applicationWillUpdate, "v@:@")
}
if template.applicationDidUpdate != nil {
applicationDidUpdate :: proc "c" (self: id, notification: ^Notification) {
applicationDidUpdate :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidUpdate(notification)
@@ -376,7 +375,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidUpdate:"), auto_cast applicationDidUpdate, "v@:@")
}
if template.applicationShouldHandleReopenHasVisibleWindows != nil {
applicationShouldHandleReopenHasVisibleWindows :: proc "c" (self: id, sender: ^Application, flag: BOOL) -> BOOL {
applicationShouldHandleReopenHasVisibleWindows :: proc "c" (self: id, cmd: SEL, sender: ^Application, flag: BOOL) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationShouldHandleReopenHasVisibleWindows(sender, flag)
@@ -384,7 +383,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationShouldHandleReopen:hasVisibleWindows:"), auto_cast applicationShouldHandleReopenHasVisibleWindows, "B@:@B")
}
if template.applicationDockMenu != nil {
applicationDockMenu :: proc "c" (self: id, sender: ^Application) -> ^Menu {
applicationDockMenu :: proc "c" (self: id, cmd: SEL, sender: ^Application) -> ^Menu {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationDockMenu(sender)
@@ -392,7 +391,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDockMenu:"), auto_cast applicationDockMenu, "@@:@")
}
if template.applicationShouldAutomaticallyLocalizeKeyEquivalents != nil {
applicationShouldAutomaticallyLocalizeKeyEquivalents :: proc "c" (self: id, application: ^Application) -> BOOL {
applicationShouldAutomaticallyLocalizeKeyEquivalents :: proc "c" (self: id, cmd: SEL, application: ^Application) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationShouldAutomaticallyLocalizeKeyEquivalents(application)
@@ -400,7 +399,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationShouldAutomaticallyLocalizeKeyEquivalents:"), auto_cast applicationShouldAutomaticallyLocalizeKeyEquivalents, "B@:@")
}
if template.applicationWillPresentError != nil {
applicationWillPresentError :: proc "c" (self: id, application: ^Application, error: ^Error) -> ^Error {
applicationWillPresentError :: proc "c" (self: id, cmd: SEL, application: ^Application, error: ^Error) -> ^Error {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationWillPresentError(application, error)
@@ -408,7 +407,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:willPresentError:"), auto_cast applicationWillPresentError, "@@:@@")
}
if template.applicationDidChangeScreenParameters != nil {
applicationDidChangeScreenParameters :: proc "c" (self: id, notification: ^Notification) {
applicationDidChangeScreenParameters :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidChangeScreenParameters(notification)
@@ -416,7 +415,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidChangeScreenParameters:"), auto_cast applicationDidChangeScreenParameters, "v@:@")
}
if template.applicationWillContinueUserActivityWithType != nil {
applicationWillContinueUserActivityWithType :: proc "c" (self: id, application: ^Application, userActivityType: ^String) -> BOOL {
applicationWillContinueUserActivityWithType :: proc "c" (self: id, cmd: SEL, application: ^Application, userActivityType: ^String) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationWillContinueUserActivityWithType(application, userActivityType)
@@ -424,7 +423,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:willContinueUserActivityWithType:"), auto_cast applicationWillContinueUserActivityWithType, "B@:@@")
}
if template.applicationContinueUserActivityRestorationHandler != nil {
applicationContinueUserActivityRestorationHandler :: proc "c" (self: id, application: ^Application, userActivity: ^UserActivity, restorationHandler: ^Block) -> BOOL {
applicationContinueUserActivityRestorationHandler :: proc "c" (self: id, cmd: SEL, application: ^Application, userActivity: ^UserActivity, restorationHandler: ^Block) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationContinueUserActivityRestorationHandler(application, userActivity, restorationHandler)
@@ -432,7 +431,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:continueUserActivity:restorationHandler:"), auto_cast applicationContinueUserActivityRestorationHandler, "B@:@@?")
}
if template.applicationDidFailToContinueUserActivityWithTypeError != nil {
applicationDidFailToContinueUserActivityWithTypeError :: proc "c" (self: id, application: ^Application, userActivityType: ^String, error: ^Error) {
applicationDidFailToContinueUserActivityWithTypeError :: proc "c" (self: id, cmd: SEL, application: ^Application, userActivityType: ^String, error: ^Error) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidFailToContinueUserActivityWithTypeError(application, userActivityType, error)
@@ -440,7 +439,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:didFailToContinueUserActivityWithType:error:"), auto_cast applicationDidFailToContinueUserActivityWithTypeError, "v@:@@@")
}
if template.applicationDidUpdateUserActivity != nil {
applicationDidUpdateUserActivity :: proc "c" (self: id, application: ^Application, userActivity: ^UserActivity) {
applicationDidUpdateUserActivity :: proc "c" (self: id, cmd: SEL, application: ^Application, userActivity: ^UserActivity) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidUpdateUserActivity(application, userActivity)
@@ -448,7 +447,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:didUpdateUserActivity:"), auto_cast applicationDidUpdateUserActivity, "v@:@@")
}
if template.applicationDidRegisterForRemoteNotificationsWithDeviceToken != nil {
applicationDidRegisterForRemoteNotificationsWithDeviceToken :: proc "c" (self: id, application: ^Application, deviceToken: ^Data) {
applicationDidRegisterForRemoteNotificationsWithDeviceToken :: proc "c" (self: id, cmd: SEL, application: ^Application, deviceToken: ^Data) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidRegisterForRemoteNotificationsWithDeviceToken(application, deviceToken)
@@ -456,7 +455,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:didRegisterForRemoteNotificationsWithDeviceToken:"), auto_cast applicationDidRegisterForRemoteNotificationsWithDeviceToken, "v@:@@")
}
if template.applicationDidFailToRegisterForRemoteNotificationsWithError != nil {
applicationDidFailToRegisterForRemoteNotificationsWithError :: proc "c" (self: id, application: ^Application, error: ^Error) {
applicationDidFailToRegisterForRemoteNotificationsWithError :: proc "c" (self: id, cmd: SEL, application: ^Application, error: ^Error) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidFailToRegisterForRemoteNotificationsWithError(application, error)
@@ -464,7 +463,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:didFailToRegisterForRemoteNotificationsWithError:"), auto_cast applicationDidFailToRegisterForRemoteNotificationsWithError, "v@:@@")
}
if template.applicationDidReceiveRemoteNotification != nil {
applicationDidReceiveRemoteNotification :: proc "c" (self: id, application: ^Application, userInfo: ^Dictionary) {
applicationDidReceiveRemoteNotification :: proc "c" (self: id, cmd: SEL, application: ^Application, userInfo: ^Dictionary) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidReceiveRemoteNotification(application, userInfo)
@@ -472,7 +471,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:didReceiveRemoteNotification:"), auto_cast applicationDidReceiveRemoteNotification, "v@:@@")
}
// if template.applicationUserDidAcceptCloudKitShareWithMetadata != nil {
// applicationUserDidAcceptCloudKitShareWithMetadata :: proc "c" (self: id, application: ^Application, metadata: ^CKShareMetadata) {
// applicationUserDidAcceptCloudKitShareWithMetadata :: proc "c" (self: id, cmd: SEL, application: ^Application, metadata: ^CKShareMetadata) {
// del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
// context = del._context
// del.applicationUserDidAcceptCloudKitShareWithMetadata(application, metadata)
@@ -480,7 +479,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
// class_addMethod(class, intrinsics.objc_find_selector("application:userDidAcceptCloudKitShareWithMetadata:"), auto_cast applicationUserDidAcceptCloudKitShareWithMetadata, "v@:@@")
// }
// if template.applicationHandlerForIntent != nil {
// applicationHandlerForIntent :: proc "c" (self: id, application: ^Application, intent: ^INIntent) -> id {
// applicationHandlerForIntent :: proc "c" (self: id, cmd: SEL, application: ^Application, intent: ^INIntent) -> id {
// del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
// context = del._context
// return del.applicationHandlerForIntent(application, intent)
@@ -488,7 +487,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
// class_addMethod(class, intrinsics.objc_find_selector("application:handlerForIntent:"), auto_cast applicationHandlerForIntent, "@@:@@")
// }
if template.applicationOpenURLs != nil {
applicationOpenURLs :: proc "c" (self: id, application: ^Application, urls: ^Array) {
applicationOpenURLs :: proc "c" (self: id, cmd: SEL, application: ^Application, urls: ^Array) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationOpenURLs(application, urls)
@@ -496,7 +495,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:openURLs:"), auto_cast applicationOpenURLs, "v@:@@")
}
if template.applicationOpenFile != nil {
applicationOpenFile :: proc "c" (self: id, sender: ^Application, filename: ^String) -> BOOL {
applicationOpenFile :: proc "c" (self: id, cmd: SEL, sender: ^Application, filename: ^String) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationOpenFile(sender, filename)
@@ -504,7 +503,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:openFile:"), auto_cast applicationOpenFile, "B@:@@")
}
if template.applicationOpenFileWithoutUI != nil {
applicationOpenFileWithoutUI :: proc "c" (self: id, sender: id, filename: ^String) -> BOOL {
applicationOpenFileWithoutUI :: proc "c" (self: id, cmd: SEL, sender: id, filename: ^String) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationOpenFileWithoutUI(sender, filename)
@@ -512,7 +511,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:openFileWithoutUI:"), auto_cast applicationOpenFileWithoutUI, "B@:@@")
}
if template.applicationOpenTempFile != nil {
applicationOpenTempFile :: proc "c" (self: id, sender: ^Application, filename: ^String) -> BOOL {
applicationOpenTempFile :: proc "c" (self: id, cmd: SEL, sender: ^Application, filename: ^String) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationOpenTempFile(sender, filename)
@@ -520,7 +519,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:openTempFile:"), auto_cast applicationOpenTempFile, "B@:@@")
}
if template.applicationOpenFiles != nil {
applicationOpenFiles :: proc "c" (self: id, sender: ^Application, filenames: ^Array) {
applicationOpenFiles :: proc "c" (self: id, cmd: SEL, sender: ^Application, filenames: ^Array) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationOpenFiles(sender, filenames)
@@ -528,7 +527,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:openFiles:"), auto_cast applicationOpenFiles, "v@:@@")
}
if template.applicationShouldOpenUntitledFile != nil {
applicationShouldOpenUntitledFile :: proc "c" (self: id, sender: ^Application) -> BOOL {
applicationShouldOpenUntitledFile :: proc "c" (self: id, cmd: SEL, sender: ^Application) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationShouldOpenUntitledFile(sender)
@@ -536,7 +535,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationShouldOpenUntitledFile:"), auto_cast applicationShouldOpenUntitledFile, "B@:@")
}
if template.applicationOpenUntitledFile != nil {
applicationOpenUntitledFile :: proc "c" (self: id, sender: ^Application) -> BOOL {
applicationOpenUntitledFile :: proc "c" (self: id, cmd: SEL, sender: ^Application) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationOpenUntitledFile(sender)
@@ -544,7 +543,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationOpenUntitledFile:"), auto_cast applicationOpenUntitledFile, "B@:@")
}
if template.applicationPrintFile != nil {
applicationPrintFile :: proc "c" (self: id, sender: ^Application, filename: ^String) -> BOOL {
applicationPrintFile :: proc "c" (self: id, cmd: SEL, sender: ^Application, filename: ^String) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationPrintFile(sender, filename)
@@ -552,7 +551,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:printFile:"), auto_cast applicationPrintFile, "B@:@@")
}
if template.applicationPrintFilesWithSettingsShowPrintPanels != nil {
applicationPrintFilesWithSettingsShowPrintPanels :: proc "c" (self: id, application: ^Application, fileNames: ^Array, printSettings: ^Dictionary, showPrintPanels: BOOL) -> ApplicationPrintReply {
applicationPrintFilesWithSettingsShowPrintPanels :: proc "c" (self: id, cmd: SEL, application: ^Application, fileNames: ^Array, printSettings: ^Dictionary, showPrintPanels: BOOL) -> ApplicationPrintReply {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationPrintFilesWithSettingsShowPrintPanels(application, fileNames, printSettings, showPrintPanels)
@@ -560,7 +559,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:printFiles:withSettings:showPrintPanels:"), auto_cast applicationPrintFilesWithSettingsShowPrintPanels, _UINTEGER_ENCODING+"@:@@@B")
}
if template.applicationSupportsSecureRestorableState != nil {
applicationSupportsSecureRestorableState :: proc "c" (self: id, app: ^Application) -> BOOL {
applicationSupportsSecureRestorableState :: proc "c" (self: id, cmd: SEL, app: ^Application) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationSupportsSecureRestorableState(app)
@@ -568,7 +567,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationSupportsSecureRestorableState:"), auto_cast applicationSupportsSecureRestorableState, "B@:@")
}
if template.applicationProtectedDataDidBecomeAvailable != nil {
applicationProtectedDataDidBecomeAvailable :: proc "c" (self: id, notification: ^Notification) {
applicationProtectedDataDidBecomeAvailable :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationProtectedDataDidBecomeAvailable(notification)
@@ -576,7 +575,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationProtectedDataDidBecomeAvailable:"), auto_cast applicationProtectedDataDidBecomeAvailable, "v@:@")
}
if template.applicationProtectedDataWillBecomeUnavailable != nil {
applicationProtectedDataWillBecomeUnavailable :: proc "c" (self: id, notification: ^Notification) {
applicationProtectedDataWillBecomeUnavailable :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationProtectedDataWillBecomeUnavailable(notification)
@@ -584,7 +583,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationProtectedDataWillBecomeUnavailable:"), auto_cast applicationProtectedDataWillBecomeUnavailable, "v@:@")
}
if template.applicationWillEncodeRestorableState != nil {
applicationWillEncodeRestorableState :: proc "c" (self: id, app: ^Application, coder: ^Coder) {
applicationWillEncodeRestorableState :: proc "c" (self: id, cmd: SEL, app: ^Application, coder: ^Coder) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillEncodeRestorableState(app, coder)
@@ -592,7 +591,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:willEncodeRestorableState:"), auto_cast applicationWillEncodeRestorableState, "v@:@@")
}
if template.applicationDidDecodeRestorableState != nil {
applicationDidDecodeRestorableState :: proc "c" (self: id, app: ^Application, coder: ^Coder) {
applicationDidDecodeRestorableState :: proc "c" (self: id, cmd: SEL, app: ^Application, coder: ^Coder) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidDecodeRestorableState(app, coder)
@@ -600,7 +599,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:didDecodeRestorableState:"), auto_cast applicationDidDecodeRestorableState, "v@:@@")
}
if template.applicationDidChangeOcclusionState != nil {
applicationDidChangeOcclusionState :: proc "c" (self: id, notification: ^Notification) {
applicationDidChangeOcclusionState :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidChangeOcclusionState(notification)
@@ -608,7 +607,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidChangeOcclusionState:"), auto_cast applicationDidChangeOcclusionState, "v@:@")
}
if template.applicationDelegateHandlesKey != nil {
applicationDelegateHandlesKey :: proc "c" (self: id, sender: ^Application, key: ^String) -> BOOL {
applicationDelegateHandlesKey :: proc "c" (self: id, cmd: SEL, sender: ^Application, key: ^String) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationDelegateHandlesKey(sender, key)
+46
View File
@@ -40,3 +40,49 @@ Array_objectAs :: proc "c" (self: ^Array, index: UInteger, $T: typeid) -> T wher
Array_count :: proc "c" (self: ^Array) -> UInteger {
return msgSend(UInteger, self, "count")
}
@(objc_class="NSMutableArray")
MutableArray :: struct {
using _: Copying(MutableArray),
}
@(objc_type=MutableArray, objc_name="alloc", objc_is_class_method=true)
MutableArray_alloc :: proc "c" () -> ^MutableArray {
return msgSend(^MutableArray, MutableArray, "alloc")
}
@(objc_type=MutableArray, objc_name="init")
MutableArray_init :: proc "c" (self: ^MutableArray) -> ^MutableArray {
return msgSend(^MutableArray, self, "init")
}
@(objc_type=MutableArray, objc_name="initWithObjects")
MutableArray_initWithObjects :: proc "c" (self: ^MutableArray, objects: [^]^Object, count: UInteger) -> ^MutableArray {
return msgSend(^MutableArray, self, "initWithObjects:count:", objects, count)
}
@(objc_type=MutableArray, objc_name="initWithCoder")
MutableArray_initWithCoder :: proc "c" (self: ^MutableArray, coder: ^Coder) -> ^MutableArray {
return msgSend(^MutableArray, self, "initWithCoder:", coder)
}
@(objc_type=MutableArray, objc_name="object")
MutableArray_object :: proc "c" (self: ^MutableArray, index: UInteger) -> ^Object {
return msgSend(^Object, self, "objectAtIndex:", index)
}
@(objc_type=MutableArray, objc_name="objectAs")
MutableArray_objectAs :: proc "c" (self: ^MutableArray, index: UInteger, $T: typeid) -> T where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
return (T)(MutableArray_object(self, index))
}
@(objc_type=MutableArray, objc_name="count")
MutableArray_count :: proc "c" (self: ^MutableArray) -> UInteger {
return msgSend(UInteger, self, "count")
}
@(objc_type=MutableArray, objc_name="exchangeObjectAtIndex")
MutableArray_exchangeObjectAtIndex :: proc "c" (self: ^MutableArray, idx1, idx2: UInteger) {
msgSend(nil, self, "exchangeObjectAtIndex:withObjectAtIndex:", idx1, idx2)
}
+2 -2
View File
@@ -15,7 +15,7 @@ Dictionary_dictionaryWithObject :: proc "c" (object: ^Object, forKey: ^Object) -
@(objc_type=Dictionary, objc_name="dictionaryWithObjects", objc_is_class_method=true)
Dictionary_dictionaryWithObjects :: proc "c" (objects: [^]^Object, forKeys: [^]^Object, count: UInteger) -> ^Dictionary {
return msgSend(^Dictionary, Dictionary, "dictionaryWithObjects:forKeys:count", objects, forKeys, count)
return msgSend(^Dictionary, Dictionary, "dictionaryWithObjects:forKeys:count:", objects, forKeys, count)
}
@@ -31,7 +31,7 @@ Dictionary_init :: proc "c" (self: ^Dictionary) -> ^Dictionary {
@(objc_type=Dictionary, objc_name="initWithObjects")
Dictionary_initWithObjects :: proc "c" (self: ^Dictionary, objects: [^]^Object, forKeys: [^]^Object, count: UInteger) -> ^Dictionary {
return msgSend(^Dictionary, self, "initWithObjects:forKeys:count", objects, forKeys, count)
return msgSend(^Dictionary, self, "initWithObjects:forKeys:count:", objects, forKeys, count)
}
@(objc_type=Dictionary, objc_name="objectForKey")
+532 -97
View File
@@ -2,127 +2,562 @@ package objc_Foundation
import "base:builtin"
import "base:intrinsics"
KeyEquivalentModifierFlag :: enum UInteger {
CapsLock = 16, // Set if Caps Lock key is pressed.
Shift = 17, // Set if Shift key is pressed.
Control = 18, // Set if Control key is pressed.
Option = 19, // Set if Option or Alternate key is pressed.
Command = 20, // Set if Command key is pressed.
NumericPad = 21, // Set if any key in the numeric keypad is pressed.
Help = 22, // Set if the Help key is pressed.
Function = 23, // Set if any function key is pressed.
}
KeyEquivalentModifierMask :: distinct bit_set[KeyEquivalentModifierFlag; UInteger]
// Used to retrieve only the device-independent modifier flags, allowing applications to mask off the device-dependent modifier flags, including event coalescing information.
KeyEventModifierFlagDeviceIndependentFlagsMask := transmute(KeyEquivalentModifierMask)_KeyEventModifierFlagDeviceIndependentFlagsMask
@(private) _KeyEventModifierFlagDeviceIndependentFlagsMask := UInteger(0xffff0000)
import "core:c"
MenuItemCallback :: proc "c" (unused: rawptr, name: SEL, sender: ^Object)
@(objc_class="NSMenuItem")
MenuItem :: struct {using _: Object}
@(objc_type=MenuItem, objc_name="alloc", objc_is_class_method=true)
MenuItem_alloc :: proc "c" () -> ^MenuItem {
return msgSend(^MenuItem, MenuItem, "alloc")
MenuSelectionMode :: enum c.long {
Automatic = 0,
SelectOne = 1,
SelectAny = 2,
}
@(objc_type=MenuItem, objc_name="registerActionCallback", objc_is_class_method=true)
MenuItem_registerActionCallback :: proc "c" (name: cstring, callback: MenuItemCallback) -> SEL {
s := string(name)
n := len(s)
sel: SEL
if n > 0 && s[n-1] != ':' {
col_name := intrinsics.alloca(n+2, 1)
builtin.copy(col_name[:n], s)
col_name[n] = ':'
col_name[n+1] = 0
sel = sel_registerName(cstring(col_name))
} else {
sel = sel_registerName(name)
}
if callback != nil {
class_addMethod(intrinsics.objc_find_class("NSObject"), sel, auto_cast callback, "v@:@")
}
return sel
MenuPresentationStyle :: enum c.long {
Regular = 0,
Palette = 1,
}
@(objc_type=MenuItem, objc_name="separatorItem", objc_is_class_method=true)
MenuItem_separatorItem :: proc "c" () -> ^MenuItem {
return msgSend(^MenuItem, MenuItem, "separatorItem")
UserInterfaceLayoutDirection :: enum c.long {
LeftToRight = 0,
RightToLeft = 1,
}
@(objc_type=MenuItem, objc_name="init")
MenuItem_init :: proc "c" (self: ^MenuItem) -> ^MenuItem {
return msgSend(^MenuItem, self, "init")
MenuPropertyItem :: enum c.ulong {
Title = 0,
AttributedTitle = 1,
KeyEquivalent = 2,
Image = 3,
Enabled = 4,
AccessibilityDescription = 5,
}
@(objc_type=MenuItem, objc_name="initWithTitle")
MenuItem_initWithTitle :: proc "c" (self: ^MenuItem, title: ^String, action: SEL, keyEquivalent: ^String) -> ^MenuItem {
return msgSend(^MenuItem, self, "initWithTitle:action:keyEquivalent:", title, action, keyEquivalent)
}
@(objc_type=MenuItem, objc_name="setKeyEquivalentModifierMask")
MenuItem_setKeyEquivalentModifierMask :: proc "c" (self: ^MenuItem, modifierMask: KeyEquivalentModifierMask) {
msgSend(nil, self, "setKeyEquivalentModifierMask:", modifierMask)
}
@(objc_type=MenuItem, objc_name="keyEquivalentModifierMask")
MenuItem_keyEquivalentModifierMask :: proc "c" (self: ^MenuItem) -> KeyEquivalentModifierMask {
return msgSend(KeyEquivalentModifierMask, self, "keyEquivalentModifierMask")
}
@(objc_type=MenuItem, objc_name="setSubmenu")
MenuItem_setSubmenu :: proc "c" (self: ^MenuItem, submenu: ^Menu) {
msgSend(nil, self, "setSubmenu:", submenu)
}
@(objc_type=MenuItem, objc_name="title")
MenuItem_title :: proc "c" (self: ^MenuItem) -> ^String {
return msgSend(^String, self, "title")
}
@(objc_type=MenuItem, objc_name="setTitle")
MenuItem_setTitle :: proc "c" (self: ^MenuItem, title: ^String) -> ^String {
return msgSend(^String, self, "title:", title)
}
MenuProperties :: distinct bit_set[MenuPropertyItem; c.ulong]
@(objc_class="NSMenu")
Menu :: struct {using _: Object}
@(objc_type=Menu, objc_name="alloc", objc_is_class_method=true)
Menu_alloc :: proc "c" () -> ^Menu {
return msgSend(^Menu, Menu, "alloc")
}
@(objc_type=Menu, objc_name="init")
Menu_init :: proc "c" (self: ^Menu) -> ^Menu {
return msgSend(^Menu, self, "init")
}
@(objc_type=Menu, objc_name="initWithTitle")
Menu_initWithTitle :: proc "c" (self: ^Menu, title: ^String) -> ^Menu {
Menu_initWithTitle :: #force_inline proc "c" (self: ^Menu, title: ^String) -> ^Menu {
return msgSend(^Menu, self, "initWithTitle:", title)
}
@(objc_type=Menu, objc_name="initWithCoder")
Menu_initWithCoder :: #force_inline proc "c" (self: ^Menu, coder: ^Coder) -> ^Menu {
return msgSend(^Menu, self, "initWithCoder:", coder)
}
@(objc_type=Menu, objc_name="popUpContextMenu_withEvent_forView", objc_is_class_method=true)
Menu_popUpContextMenu_withEvent_forView :: #force_inline proc "c" (menu: ^Menu, event: ^Event, view: ^View) {
msgSend(nil, Menu, "popUpContextMenu:withEvent:forView:", menu, event, view)
}
// @(objc_type=Menu, objc_name="popUpContextMenu_withEvent_forView_withFont", objc_is_class_method=true)
// Menu_popUpContextMenu_withEvent_forView_withFont :: #force_inline proc "c" (menu: ^Menu, event: ^Event, view: ^View, font: ^Font) {
// msgSend(nil, Menu, "popUpContextMenu:withEvent:forView:withFont:", menu, event, view, font)
// }
@(objc_type=Menu, objc_name="popUpMenuPositioningItem")
Menu_popUpMenuPositioningItem :: #force_inline proc "c" (self: ^Menu, item: ^MenuItem, location: Point, view: ^View) -> bool {
return msgSend(bool, self, "popUpMenuPositioningItem:atLocation:inView:", item, location, view)
}
@(objc_type=Menu, objc_name="setMenuBarVisible", objc_is_class_method=true)
Menu_setMenuBarVisible :: #force_inline proc "c" (visible: bool) {
msgSend(nil, Menu, "setMenuBarVisible:", visible)
}
@(objc_type=Menu, objc_name="menuBarVisible", objc_is_class_method=true)
Menu_menuBarVisible :: #force_inline proc "c" () -> bool {
return msgSend(bool, Menu, "menuBarVisible")
}
@(objc_type=Menu, objc_name="insertItem")
Menu_insertItem :: #force_inline proc "c" (self: ^Menu, newItem: ^MenuItem, index: Integer) {
msgSend(nil, self, "insertItem:atIndex:", newItem, index)
}
@(objc_type=Menu, objc_name="addItem")
Menu_addItem :: proc "c" (self: ^Menu, item: ^MenuItem) {
msgSend(nil, self, "addItem:", item)
Menu_addItem :: #force_inline proc "c" (self: ^Menu, newItem: ^MenuItem) {
msgSend(nil, self, "addItem:", newItem)
}
@(objc_type=Menu, objc_name="insertItemWithTitle")
Menu_insertItemWithTitle :: #force_inline proc "c" (self: ^Menu, string: ^String, selector: SEL, charCode: ^String, index: Integer) -> ^MenuItem {
return msgSend(^MenuItem, self, "insertItemWithTitle:action:keyEquivalent:atIndex:", string, selector, charCode, index)
}
@(objc_type=Menu, objc_name="addItemWithTitle")
Menu_addItemWithTitle :: proc "c" (self: ^Menu, title: ^String, selector: SEL, keyEquivalent: ^String) -> ^MenuItem {
return msgSend(^MenuItem, self, "addItemWithTitle:action:keyEquivalent:", title, selector, keyEquivalent)
Menu_addItemWithTitle :: #force_inline proc "c" (self: ^Menu, string: ^String, selector: SEL, charCode: ^String) -> ^MenuItem {
return msgSend(^MenuItem, self, "addItemWithTitle:action:keyEquivalent:", string, selector, charCode)
}
@(objc_type=Menu, objc_name="removeItemAtIndex")
Menu_removeItemAtIndex :: #force_inline proc "c" (self: ^Menu, index: Integer) {
msgSend(nil, self, "removeItemAtIndex:", index)
}
@(objc_type=Menu, objc_name="removeItem")
Menu_removeItem :: #force_inline proc "c" (self: ^Menu, item: ^MenuItem) {
msgSend(nil, self, "removeItem:", item)
}
@(objc_type=Menu, objc_name="setSubmenu")
Menu_setSubmenu :: #force_inline proc "c" (self: ^Menu, menu: ^Menu, item: ^MenuItem) {
msgSend(nil, self, "setSubmenu:forItem:", menu, item)
}
@(objc_type=Menu, objc_name="removeAllItems")
Menu_removeAllItems :: #force_inline proc "c" (self: ^Menu) {
msgSend(nil, self, "removeAllItems")
}
@(objc_type=Menu, objc_name="itemAtIndex")
Menu_itemAtIndex :: #force_inline proc "c" (self: ^Menu, index: Integer) -> ^MenuItem {
return msgSend(^MenuItem, self, "itemAtIndex:", index)
}
@(objc_type=Menu, objc_name="indexOfItem")
Menu_indexOfItem :: #force_inline proc "c" (self: ^Menu, item: ^MenuItem) -> Integer {
return msgSend(Integer, self, "indexOfItem:", item)
}
@(objc_type=Menu, objc_name="indexOfItemWithTitle")
Menu_indexOfItemWithTitle :: #force_inline proc "c" (self: ^Menu, title: ^String) -> Integer {
return msgSend(Integer, self, "indexOfItemWithTitle:", title)
}
@(objc_type=Menu, objc_name="indexOfItemWithTag")
Menu_indexOfItemWithTag :: #force_inline proc "c" (self: ^Menu, tag: Integer) -> Integer {
return msgSend(Integer, self, "indexOfItemWithTag:", tag)
}
@(objc_type=Menu, objc_name="indexOfItemWithRepresentedObject")
Menu_indexOfItemWithRepresentedObject :: #force_inline proc "c" (self: ^Menu, object: id) -> Integer {
return msgSend(Integer, self, "indexOfItemWithRepresentedObject:", object)
}
@(objc_type=Menu, objc_name="indexOfItemWithSubmenu")
Menu_indexOfItemWithSubmenu :: #force_inline proc "c" (self: ^Menu, submenu: ^Menu) -> Integer {
return msgSend(Integer, self, "indexOfItemWithSubmenu:", submenu)
}
@(objc_type=Menu, objc_name="indexOfItemWithTarget")
Menu_indexOfItemWithTarget :: #force_inline proc "c" (self: ^Menu, target: id, actionSelector: SEL) -> Integer {
return msgSend(Integer, self, "indexOfItemWithTarget:andAction:", target, actionSelector)
}
@(objc_type=Menu, objc_name="itemWithTitle")
Menu_itemWithTitle :: #force_inline proc "c" (self: ^Menu, title: ^String) -> ^MenuItem {
return msgSend(^MenuItem, self, "itemWithTitle:", title)
}
@(objc_type=Menu, objc_name="itemWithTag")
Menu_itemWithTag :: #force_inline proc "c" (self: ^Menu, tag: Integer) -> ^MenuItem {
return msgSend(^MenuItem, self, "itemWithTag:", tag)
}
@(objc_type=Menu, objc_name="update")
Menu_update :: #force_inline proc "c" (self: ^Menu) {
msgSend(nil, self, "update")
}
@(objc_type=Menu, objc_name="performKeyEquivalent")
Menu_performKeyEquivalent :: #force_inline proc "c" (self: ^Menu, event: ^Event) -> bool {
return msgSend(bool, self, "performKeyEquivalent:", event)
}
@(objc_type=Menu, objc_name="itemChanged")
Menu_itemChanged :: #force_inline proc "c" (self: ^Menu, item: ^MenuItem) {
msgSend(nil, self, "itemChanged:", item)
}
@(objc_type=Menu, objc_name="performActionForItemAtIndex")
Menu_performActionForItemAtIndex :: #force_inline proc "c" (self: ^Menu, index: Integer) {
msgSend(nil, self, "performActionForItemAtIndex:", index)
}
@(objc_type=Menu, objc_name="cancelTracking")
Menu_cancelTracking :: #force_inline proc "c" (self: ^Menu) {
msgSend(nil, self, "cancelTracking")
}
@(objc_type=Menu, objc_name="cancelTrackingWithoutAnimation")
Menu_cancelTrackingWithoutAnimation :: #force_inline proc "c" (self: ^Menu) {
msgSend(nil, self, "cancelTrackingWithoutAnimation")
}
@(objc_type=Menu, objc_name="title")
Menu_title :: #force_inline proc "c" (self: ^Menu) -> ^String {
return msgSend(^String, self, "title")
}
@(objc_type=Menu, objc_name="setTitle")
Menu_setTitle :: #force_inline proc "c" (self: ^Menu, title: ^String) {
msgSend(nil, self, "setTitle:", title)
}
@(objc_type=Menu, objc_name="supermenu")
Menu_supermenu :: #force_inline proc "c" (self: ^Menu) -> ^Menu {
return msgSend(^Menu, self, "supermenu")
}
@(objc_type=Menu, objc_name="setSupermenu")
Menu_setSupermenu :: #force_inline proc "c" (self: ^Menu, supermenu: ^Menu) {
msgSend(nil, self, "setSupermenu:", supermenu)
}
@(objc_type=Menu, objc_name="itemArray")
Menu_itemArray :: #force_inline proc "c" (self: ^Menu) -> ^Array {
return msgSend(^Array, self, "itemArray")
}
@(objc_type=Menu, objc_name="setItemArray")
Menu_setItemArray :: #force_inline proc "c" (self: ^Menu, itemArray: ^Array) {
msgSend(nil, self, "setItemArray:", itemArray)
}
@(objc_type=Menu, objc_name="numberOfItems")
Menu_numberOfItems :: #force_inline proc "c" (self: ^Menu) -> Integer {
return msgSend(Integer, self, "numberOfItems")
}
@(objc_type=Menu, objc_name="autoenablesItems")
Menu_autoenablesItems :: #force_inline proc "c" (self: ^Menu) -> bool {
return msgSend(bool, self, "autoenablesItems")
}
@(objc_type=Menu, objc_name="setAutoenablesItems")
Menu_setAutoenablesItems :: #force_inline proc "c" (self: ^Menu, autoenablesItems: bool) {
msgSend(nil, self, "setAutoenablesItems:", autoenablesItems)
}
@(objc_type=Menu, objc_name="delegate")
Menu_delegate :: #force_inline proc "c" (self: ^Menu) -> ^MenuDelegate {
return msgSend(^MenuDelegate, self, "delegate")
}
@(objc_type=Menu, objc_name="setDelegate")
Menu_setDelegate :: #force_inline proc "c" (self: ^Menu, delegate: ^MenuDelegate) {
msgSend(nil, self, "setDelegate:", delegate)
}
@(objc_type=Menu, objc_name="menuBarHeight")
Menu_menuBarHeight :: #force_inline proc "c" (self: ^Menu) -> Float {
return msgSend(Float, self, "menuBarHeight")
}
@(objc_type=Menu, objc_name="highlightedItem")
Menu_highlightedItem :: #force_inline proc "c" (self: ^Menu) -> ^MenuItem {
return msgSend(^MenuItem, self, "highlightedItem")
}
@(objc_type=Menu, objc_name="minimumWidth")
Menu_minimumWidth :: #force_inline proc "c" (self: ^Menu) -> Float {
return msgSend(Float, self, "minimumWidth")
}
@(objc_type=Menu, objc_name="setMinimumWidth")
Menu_setMinimumWidth :: #force_inline proc "c" (self: ^Menu, minimumWidth: Float) {
msgSend(nil, self, "setMinimumWidth:", minimumWidth)
}
@(objc_type=Menu, objc_name="size")
Menu_size :: #force_inline proc "c" (self: ^Menu) -> Size {
return msgSend(Size, self, "size")
}
// @(objc_type=Menu, objc_name="font")
// Menu_font :: #force_inline proc "c" (self: ^Menu) -> ^Font {
// return msgSend(^Font, self, "font")
// }
// @(objc_type=Menu, objc_name="setFont")
// Menu_setFont :: #force_inline proc "c" (self: ^Menu, font: ^Font) {
// msgSend(nil, self, "setFont:", font)
// }
@(objc_type=Menu, objc_name="allowsContextMenuPlugIns")
Menu_allowsContextMenuPlugIns :: #force_inline proc "c" (self: ^Menu) -> bool {
return msgSend(bool, self, "allowsContextMenuPlugIns")
}
@(objc_type=Menu, objc_name="setAllowsContextMenuPlugIns")
Menu_setAllowsContextMenuPlugIns :: #force_inline proc "c" (self: ^Menu, allowsContextMenuPlugIns: bool) {
msgSend(nil, self, "setAllowsContextMenuPlugIns:", allowsContextMenuPlugIns)
}
@(objc_type=Menu, objc_name="showsStateColumn")
Menu_showsStateColumn :: #force_inline proc "c" (self: ^Menu) -> bool {
return msgSend(bool, self, "showsStateColumn")
}
@(objc_type=Menu, objc_name="setShowsStateColumn")
Menu_setShowsStateColumn :: #force_inline proc "c" (self: ^Menu, showsStateColumn: bool) {
msgSend(nil, self, "setShowsStateColumn:", showsStateColumn)
}
@(objc_type=Menu, objc_name="userInterfaceLayoutDirection")
Menu_userInterfaceLayoutDirection :: #force_inline proc "c" (self: ^Menu) -> UserInterfaceLayoutDirection {
return msgSend(UserInterfaceLayoutDirection, self, "userInterfaceLayoutDirection")
}
@(objc_type=Menu, objc_name="setUserInterfaceLayoutDirection")
Menu_setUserInterfaceLayoutDirection :: #force_inline proc "c" (self: ^Menu, userInterfaceLayoutDirection: UserInterfaceLayoutDirection) {
msgSend(nil, self, "setUserInterfaceLayoutDirection:", userInterfaceLayoutDirection)
}
@(objc_type=Menu, objc_name="paletteMenuWithColors_titles_selectionHandler", objc_is_class_method=true)
Menu_paletteMenuWithColors_titles_selectionHandler :: #force_inline proc "c" (colors: ^Array, itemTitles: ^Array, onSelectionChange: proc "c" (_arg_0: ^Menu)) -> ^Menu {
return msgSend(^Menu, Menu, "paletteMenuWithColors:titles:selectionHandler:", colors, itemTitles, onSelectionChange)
}
// @(objc_type=Menu, objc_name="paletteMenuWithColors_titles_templateImage_selectionHandler", objc_is_class_method=true)
// Menu_paletteMenuWithColors_titles_templateImage_selectionHandler :: #force_inline proc "c" (colors: ^Array, itemTitles: ^Array, image: ^Image, onSelectionChange: proc "c" (_arg_0: ^Menu)) -> ^Menu {
// return msgSend(^Menu, Menu, "paletteMenuWithColors:titles:templateImage:selectionHandler:", colors, itemTitles, image, onSelectionChange)
// }
@(objc_type=Menu, objc_name="presentationStyle")
Menu_presentationStyle :: #force_inline proc "c" (self: ^Menu) -> MenuPresentationStyle {
return msgSend(MenuPresentationStyle, self, "presentationStyle")
}
@(objc_type=Menu, objc_name="setPresentationStyle")
Menu_setPresentationStyle :: #force_inline proc "c" (self: ^Menu, presentationStyle: MenuPresentationStyle) {
msgSend(nil, self, "setPresentationStyle:", presentationStyle)
}
@(objc_type=Menu, objc_name="selectionMode")
Menu_selectionMode :: #force_inline proc "c" (self: ^Menu) -> MenuSelectionMode {
return msgSend(MenuSelectionMode, self, "selectionMode")
}
@(objc_type=Menu, objc_name="setSelectionMode")
Menu_setSelectionMode :: #force_inline proc "c" (self: ^Menu, selectionMode: MenuSelectionMode) {
msgSend(nil, self, "setSelectionMode:", selectionMode)
}
@(objc_type=Menu, objc_name="selectedItems")
Menu_selectedItems :: #force_inline proc "c" (self: ^Menu) -> ^Array {
return msgSend(^Array, self, "selectedItems")
}
@(objc_type=Menu, objc_name="setSelectedItems")
Menu_setSelectedItems :: #force_inline proc "c" (self: ^Menu, selectedItems: ^Array) {
msgSend(nil, self, "setSelectedItems:", selectedItems)
}
@(objc_type=Menu, objc_name="submenuAction")
Menu_submenuAction :: #force_inline proc "c" (self: ^Menu, sender: id) {
msgSend(nil, self, "submenuAction:", sender)
}
@(objc_type=Menu, objc_name="propertiesToUpdate")
Menu_propertiesToUpdate :: #force_inline proc "c" (self: ^Menu) -> MenuProperties {
return msgSend(MenuProperties, self, "propertiesToUpdate")
}
@(objc_type=Menu, objc_name="setMenuRepresentation")
Menu_setMenuRepresentation :: #force_inline proc "c" (self: ^Menu, menuRep: id) {
msgSend(nil, self, "setMenuRepresentation:", menuRep)
}
@(objc_type=Menu, objc_name="menuRepresentation")
Menu_menuRepresentation :: #force_inline proc "c" (self: ^Menu) -> id {
return msgSend(id, self, "menuRepresentation")
}
@(objc_type=Menu, objc_name="setContextMenuRepresentation")
Menu_setContextMenuRepresentation :: #force_inline proc "c" (self: ^Menu, menuRep: id) {
msgSend(nil, self, "setContextMenuRepresentation:", menuRep)
}
@(objc_type=Menu, objc_name="contextMenuRepresentation")
Menu_contextMenuRepresentation :: #force_inline proc "c" (self: ^Menu) -> id {
return msgSend(id, self, "contextMenuRepresentation")
}
@(objc_type=Menu, objc_name="setTearOffMenuRepresentation")
Menu_setTearOffMenuRepresentation :: #force_inline proc "c" (self: ^Menu, menuRep: id) {
msgSend(nil, self, "setTearOffMenuRepresentation:", menuRep)
}
@(objc_type=Menu, objc_name="tearOffMenuRepresentation")
Menu_tearOffMenuRepresentation :: #force_inline proc "c" (self: ^Menu) -> id {
return msgSend(id, self, "tearOffMenuRepresentation")
}
@(objc_type=Menu, objc_name="menuZone", objc_is_class_method=true)
Menu_menuZone :: #force_inline proc "c" () -> ^Zone {
return msgSend(^Zone, Menu, "menuZone")
}
@(objc_type=Menu, objc_name="setMenuZone", objc_is_class_method=true)
Menu_setMenuZone :: #force_inline proc "c" (zone: ^Zone) {
msgSend(nil, Menu, "setMenuZone:", zone)
}
@(objc_type=Menu, objc_name="attachedMenu")
Menu_attachedMenu :: #force_inline proc "c" (self: ^Menu) -> ^Menu {
return msgSend(^Menu, self, "attachedMenu")
}
@(objc_type=Menu, objc_name="isAttached")
Menu_isAttached :: #force_inline proc "c" (self: ^Menu) -> bool {
return msgSend(bool, self, "isAttached")
}
@(objc_type=Menu, objc_name="sizeToFit")
Menu_sizeToFit :: #force_inline proc "c" (self: ^Menu) {
msgSend(nil, self, "sizeToFit")
}
@(objc_type=Menu, objc_name="locationForSubmenu")
Menu_locationForSubmenu :: #force_inline proc "c" (self: ^Menu, submenu: ^Menu) -> Point {
return msgSend(Point, self, "locationForSubmenu:", submenu)
}
@(objc_type=Menu, objc_name="helpRequested")
Menu_helpRequested :: #force_inline proc "c" (self: ^Menu, eventPtr: ^Event) {
msgSend(nil, self, "helpRequested:", eventPtr)
}
@(objc_type=Menu, objc_name="menuChangedMessagesEnabled")
Menu_menuChangedMessagesEnabled :: #force_inline proc "c" (self: ^Menu) -> bool {
return msgSend(bool, self, "menuChangedMessagesEnabled")
}
@(objc_type=Menu, objc_name="setMenuChangedMessagesEnabled")
Menu_setMenuChangedMessagesEnabled :: #force_inline proc "c" (self: ^Menu, menuChangedMessagesEnabled: bool) {
msgSend(nil, self, "setMenuChangedMessagesEnabled:", menuChangedMessagesEnabled)
}
@(objc_type=Menu, objc_name="isTornOff")
Menu_isTornOff :: #force_inline proc "c" (self: ^Menu) -> bool {
return msgSend(bool, self, "isTornOff")
}
@(objc_type=Menu, objc_name="load", objc_is_class_method=true)
Menu_load :: #force_inline proc "c" () {
msgSend(nil, Menu, "load")
}
@(objc_type=Menu, objc_name="initialize", objc_is_class_method=true)
Menu_initialize :: #force_inline proc "c" () {
msgSend(nil, Menu, "initialize")
}
@(objc_type=Menu, objc_name="new", objc_is_class_method=true)
Menu_new :: #force_inline proc "c" () -> ^Menu {
return msgSend(^Menu, Menu, "new")
}
@(objc_type=Menu, objc_name="allocWithZone", objc_is_class_method=true)
Menu_allocWithZone :: #force_inline proc "c" (zone: ^Zone) -> ^Menu {
return msgSend(^Menu, Menu, "allocWithZone:", zone)
}
@(objc_type=Menu, objc_name="alloc", objc_is_class_method=true)
Menu_alloc :: #force_inline proc "c" () -> ^Menu {
return msgSend(^Menu, Menu, "alloc")
}
@(objc_type=Menu, objc_name="copyWithZone", objc_is_class_method=true)
Menu_copyWithZone :: #force_inline proc "c" (zone: ^Zone) -> id {
return msgSend(id, Menu, "copyWithZone:", zone)
}
@(objc_type=Menu, objc_name="mutableCopyWithZone", objc_is_class_method=true)
Menu_mutableCopyWithZone :: #force_inline proc "c" (zone: ^Zone) -> id {
return msgSend(id, Menu, "mutableCopyWithZone:", zone)
}
@(objc_type=Menu, objc_name="instancesRespondToSelector", objc_is_class_method=true)
Menu_instancesRespondToSelector :: #force_inline proc "c" (aSelector: SEL) -> bool {
return msgSend(bool, Menu, "instancesRespondToSelector:", aSelector)
}
@(objc_type=Menu, objc_name="conformsToProtocol", objc_is_class_method=true)
Menu_conformsToProtocol :: #force_inline proc "c" (protocol: ^Protocol) -> bool {
return msgSend(bool, Menu, "conformsToProtocol:", protocol)
}
@(objc_type=Menu, objc_name="instanceMethodForSelector", objc_is_class_method=true)
Menu_instanceMethodForSelector :: #force_inline proc "c" (aSelector: SEL) -> IMP {
return msgSend(IMP, Menu, "instanceMethodForSelector:", aSelector)
}
// @(objc_type=Menu, objc_name="instanceMethodSignatureForSelector", objc_is_class_method=true)
// Menu_instanceMethodSignatureForSelector :: #force_inline proc "c" (aSelector: SEL) -> ^MethodSignature {
// return msgSend(^MethodSignature, Menu, "instanceMethodSignatureForSelector:", aSelector)
// }
@(objc_type=Menu, objc_name="isSubclassOfClass", objc_is_class_method=true)
Menu_isSubclassOfClass :: #force_inline proc "c" (aClass: Class) -> bool {
return msgSend(bool, Menu, "isSubclassOfClass:", aClass)
}
@(objc_type=Menu, objc_name="resolveClassMethod", objc_is_class_method=true)
Menu_resolveClassMethod :: #force_inline proc "c" (sel: SEL) -> bool {
return msgSend(bool, Menu, "resolveClassMethod:", sel)
}
@(objc_type=Menu, objc_name="resolveInstanceMethod", objc_is_class_method=true)
Menu_resolveInstanceMethod :: #force_inline proc "c" (sel: SEL) -> bool {
return msgSend(bool, Menu, "resolveInstanceMethod:", sel)
}
@(objc_type=Menu, objc_name="hash", objc_is_class_method=true)
Menu_hash :: #force_inline proc "c" () -> UInteger {
return msgSend(UInteger, Menu, "hash")
}
@(objc_type=Menu, objc_name="superclass", objc_is_class_method=true)
Menu_superclass :: #force_inline proc "c" () -> Class {
return msgSend(Class, Menu, "superclass")
}
@(objc_type=Menu, objc_name="class", objc_is_class_method=true)
Menu_class :: #force_inline proc "c" () -> Class {
return msgSend(Class, Menu, "class")
}
@(objc_type=Menu, objc_name="description", objc_is_class_method=true)
Menu_description :: #force_inline proc "c" () -> ^String {
return msgSend(^String, Menu, "description")
}
@(objc_type=Menu, objc_name="debugDescription", objc_is_class_method=true)
Menu_debugDescription :: #force_inline proc "c" () -> ^String {
return msgSend(^String, Menu, "debugDescription")
}
@(objc_type=Menu, objc_name="version", objc_is_class_method=true)
Menu_version :: #force_inline proc "c" () -> Integer {
return msgSend(Integer, Menu, "version")
}
@(objc_type=Menu, objc_name="setVersion", objc_is_class_method=true)
Menu_setVersion :: #force_inline proc "c" (aVersion: Integer) {
msgSend(nil, Menu, "setVersion:", aVersion)
}
@(objc_type=Menu, objc_name="poseAsClass", objc_is_class_method=true)
Menu_poseAsClass :: #force_inline proc "c" (aClass: Class) {
msgSend(nil, Menu, "poseAsClass:", aClass)
}
@(objc_type=Menu, objc_name="cancelPreviousPerformRequestsWithTarget_selector_object", objc_is_class_method=true)
Menu_cancelPreviousPerformRequestsWithTarget_selector_object :: #force_inline proc "c" (aTarget: id, aSelector: SEL, anArgument: id) {
msgSend(nil, Menu, "cancelPreviousPerformRequestsWithTarget:selector:object:", aTarget, aSelector, anArgument)
}
@(objc_type=Menu, objc_name="cancelPreviousPerformRequestsWithTarget_", objc_is_class_method=true)
Menu_cancelPreviousPerformRequestsWithTarget_ :: #force_inline proc "c" (aTarget: id) {
msgSend(nil, Menu, "cancelPreviousPerformRequestsWithTarget:", aTarget)
}
@(objc_type=Menu, objc_name="accessInstanceVariablesDirectly", objc_is_class_method=true)
Menu_accessInstanceVariablesDirectly :: #force_inline proc "c" () -> bool {
return msgSend(bool, Menu, "accessInstanceVariablesDirectly")
}
@(objc_type=Menu, objc_name="useStoredAccessor", objc_is_class_method=true)
Menu_useStoredAccessor :: #force_inline proc "c" () -> bool {
return msgSend(bool, Menu, "useStoredAccessor")
}
@(objc_type=Menu, objc_name="keyPathsForValuesAffectingValueForKey", objc_is_class_method=true)
Menu_keyPathsForValuesAffectingValueForKey :: #force_inline proc "c" (key: ^String) -> ^Set {
return msgSend(^Set, Menu, "keyPathsForValuesAffectingValueForKey:", key)
}
@(objc_type=Menu, objc_name="automaticallyNotifiesObserversForKey", objc_is_class_method=true)
Menu_automaticallyNotifiesObserversForKey :: #force_inline proc "c" (key: ^String) -> bool {
return msgSend(bool, Menu, "automaticallyNotifiesObserversForKey:", key)
}
@(objc_type=Menu, objc_name="setKeys", objc_is_class_method=true)
Menu_setKeys :: #force_inline proc "c" (keys: ^Array, dependentKey: ^String) {
msgSend(nil, Menu, "setKeys:triggerChangeNotificationsForDependentKey:", keys, dependentKey)
}
@(objc_type=Menu, objc_name="classFallbacksForKeyedArchiver", objc_is_class_method=true)
Menu_classFallbacksForKeyedArchiver :: #force_inline proc "c" () -> ^Array {
return msgSend(^Array, Menu, "classFallbacksForKeyedArchiver")
}
@(objc_type=Menu, objc_name="classForKeyedUnarchiver", objc_is_class_method=true)
Menu_classForKeyedUnarchiver :: #force_inline proc "c" () -> Class {
return msgSend(Class, Menu, "classForKeyedUnarchiver")
}
@(objc_type=Menu, objc_name="exposeBinding", objc_is_class_method=true)
Menu_exposeBinding :: #force_inline proc "c" (binding: ^String) {
msgSend(nil, Menu, "exposeBinding:", binding)
}
@(objc_type=Menu, objc_name="setDefaultPlaceholder", objc_is_class_method=true)
Menu_setDefaultPlaceholder :: #force_inline proc "c" (placeholder: id, marker: id, binding: ^String) {
msgSend(nil, Menu, "setDefaultPlaceholder:forMarker:withBinding:", placeholder, marker, binding)
}
@(objc_type=Menu, objc_name="defaultPlaceholderForMarker", objc_is_class_method=true)
Menu_defaultPlaceholderForMarker :: #force_inline proc "c" (marker: id, binding: ^String) -> id {
return msgSend(id, Menu, "defaultPlaceholderForMarker:withBinding:", marker, binding)
}
@(objc_type=Menu, objc_name="popUpContextMenu")
Menu_popUpContextMenu :: proc {
Menu_popUpContextMenu_withEvent_forView,
// Menu_popUpContextMenu_withEvent_forView_withFont,
}
@(objc_type=Menu, objc_name="itemArray")
Menu_itemArray :: proc "c" (self: ^Menu) -> ^Array {
return msgSend(^Array, self, "itemArray")
}
@(objc_type=Menu, objc_name="paletteMenuWithColors")
Menu_paletteMenuWithColors :: proc {
Menu_paletteMenuWithColors_titles_selectionHandler,
// Menu_paletteMenuWithColors_titles_templateImage_selectionHandler,
}
@(objc_type=Menu, objc_name="cancelPreviousPerformRequestsWithTarget")
Menu_cancelPreviousPerformRequestsWithTarget :: proc {
Menu_cancelPreviousPerformRequestsWithTarget_selector_object,
Menu_cancelPreviousPerformRequestsWithTarget_,
}
@(objc_class="NSMenuDelegate")
MenuDelegate :: struct {using _: Object, using _: ObjectProtocol}
@(objc_type=MenuDelegate, objc_name="menuNeedsUpdate")
MenuDelegate_menuNeedsUpdate :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu) {
msgSend(nil, self, "menuNeedsUpdate:", menu)
}
@(objc_type=MenuDelegate, objc_name="numberOfItemsInMenu")
MenuDelegate_numberOfItemsInMenu :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu) -> Integer {
return msgSend(Integer, self, "numberOfItemsInMenu:", menu)
}
@(objc_type=MenuDelegate, objc_name="menu_updateItem_atIndex_shouldCancel")
MenuDelegate_menu_updateItem_atIndex_shouldCancel :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu, item: ^MenuItem, index: Integer, shouldCancel: bool) -> bool {
return msgSend(bool, self, "menu:updateItem:atIndex:shouldCancel:", menu, item, index, shouldCancel)
}
@(objc_type=MenuDelegate, objc_name="menuHasKeyEquivalent")
MenuDelegate_menuHasKeyEquivalent :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu, event: ^Event, target: ^id, action: ^SEL) -> bool {
return msgSend(bool, self, "menuHasKeyEquivalent:forEvent:target:action:", menu, event, target, action)
}
@(objc_type=MenuDelegate, objc_name="menuWillOpen")
MenuDelegate_menuWillOpen :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu) {
msgSend(nil, self, "menuWillOpen:", menu)
}
@(objc_type=MenuDelegate, objc_name="menuDidClose")
MenuDelegate_menuDidClose :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu) {
msgSend(nil, self, "menuDidClose:", menu)
}
@(objc_type=MenuDelegate, objc_name="menu_willHighlightItem")
MenuDelegate_menu_willHighlightItem :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu, item: ^MenuItem) {
msgSend(nil, self, "menu:willHighlightItem:", menu, item)
}
@(objc_type=MenuDelegate, objc_name="confinementRectForMenu")
MenuDelegate_confinementRectForMenu :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu, screen: ^Screen) -> Rect {
return msgSend(Rect, self, "confinementRectForMenu:onScreen:", menu, screen)
}
@(objc_type=MenuDelegate, objc_name="menu")
MenuDelegate_menu :: proc {
MenuDelegate_menu_updateItem_atIndex_shouldCancel,
MenuDelegate_menu_willHighlightItem,
}
+460
View File
@@ -0,0 +1,460 @@
package objc_Foundation
import "base:builtin"
import "base:intrinsics"
KeyEquivalentModifierFlag :: EventModifierFlag
KeyEquivalentModifierMask :: EventModifierFlags
// Used to retrieve only the device-independent modifier flags, allowing applications to mask off the device-dependent modifier flags, including event coalescing information.
KeyEventModifierFlagDeviceIndependentFlagsMask := transmute(KeyEquivalentModifierMask)_KeyEventModifierFlagDeviceIndependentFlagsMask
@(private) _KeyEventModifierFlagDeviceIndependentFlagsMask := UInteger(0xffff0000)
MenuItemCallback :: proc "c" (unused: rawptr, name: SEL, sender: ^Object)
@(objc_class="NSMenuItem")
MenuItem :: struct {using _: Object}
@(objc_type=MenuItem, objc_name="registerActionCallback", objc_is_class_method=true)
MenuItem_registerActionCallback :: proc "c" (name: cstring, callback: MenuItemCallback) -> SEL {
s := string(name)
n := len(s)
sel: SEL
if n > 0 && s[n-1] != ':' {
col_name := intrinsics.alloca(n+2, 1)
builtin.copy(col_name[:n], s)
col_name[n] = ':'
col_name[n+1] = 0
sel = sel_registerName(cstring(col_name))
} else {
sel = sel_registerName(name)
}
if callback != nil {
class_addMethod(intrinsics.objc_find_class("NSObject"), sel, auto_cast callback, "v@:@")
}
return sel
}
@(objc_type=MenuItem, objc_name="init")
MenuItem_init :: proc "c" (self: ^MenuItem) -> ^MenuItem {
return msgSend(^MenuItem, self, "init")
}
@(objc_type=MenuItem, objc_name="separatorItem", objc_is_class_method=true)
MenuItem_separatorItem :: #force_inline proc "c" () -> ^MenuItem {
return msgSend(^MenuItem, MenuItem, "separatorItem")
}
@(objc_type=MenuItem, objc_name="sectionHeaderWithTitle", objc_is_class_method=true)
MenuItem_sectionHeaderWithTitle :: #force_inline proc "c" (title: ^String) -> ^MenuItem {
return msgSend(^MenuItem, MenuItem, "sectionHeaderWithTitle:", title)
}
@(objc_type=MenuItem, objc_name="initWithTitle")
MenuItem_initWithTitle :: #force_inline proc "c" (self: ^MenuItem, string: ^String, selector: SEL, charCode: ^String) -> ^MenuItem {
return msgSend(^MenuItem, self, "initWithTitle:action:keyEquivalent:", string, selector, charCode)
}
@(objc_type=MenuItem, objc_name="initWithCoder")
MenuItem_initWithCoder :: #force_inline proc "c" (self: ^MenuItem, coder: ^Coder) -> ^MenuItem {
return msgSend(^MenuItem, self, "initWithCoder:", coder)
}
@(objc_type=MenuItem, objc_name="usesUserKeyEquivalents", objc_is_class_method=true)
MenuItem_usesUserKeyEquivalents :: #force_inline proc "c" () -> bool {
return msgSend(bool, MenuItem, "usesUserKeyEquivalents")
}
@(objc_type=MenuItem, objc_name="setUsesUserKeyEquivalents", objc_is_class_method=true)
MenuItem_setUsesUserKeyEquivalents :: #force_inline proc "c" (usesUserKeyEquivalents: bool) {
msgSend(nil, MenuItem, "setUsesUserKeyEquivalents:", usesUserKeyEquivalents)
}
@(objc_type=MenuItem, objc_name="menu")
MenuItem_menu :: #force_inline proc "c" (self: ^MenuItem) -> ^Menu {
return msgSend(^Menu, self, "menu")
}
@(objc_type=MenuItem, objc_name="setMenu")
MenuItem_setMenu :: #force_inline proc "c" (self: ^MenuItem, menu: ^Menu) {
msgSend(nil, self, "setMenu:", menu)
}
@(objc_type=MenuItem, objc_name="hasSubmenu")
MenuItem_hasSubmenu :: #force_inline proc "c" (self: ^MenuItem) -> bool {
return msgSend(bool, self, "hasSubmenu")
}
@(objc_type=MenuItem, objc_name="submenu")
MenuItem_submenu :: #force_inline proc "c" (self: ^MenuItem) -> ^Menu {
return msgSend(^Menu, self, "submenu")
}
@(objc_type=MenuItem, objc_name="setSubmenu")
MenuItem_setSubmenu :: #force_inline proc "c" (self: ^MenuItem, submenu: ^Menu) {
msgSend(nil, self, "setSubmenu:", submenu)
}
@(objc_type=MenuItem, objc_name="parentItem")
MenuItem_parentItem :: #force_inline proc "c" (self: ^MenuItem) -> ^MenuItem {
return msgSend(^MenuItem, self, "parentItem")
}
@(objc_type=MenuItem, objc_name="title")
MenuItem_title :: #force_inline proc "c" (self: ^MenuItem) -> ^String {
return msgSend(^String, self, "title")
}
@(objc_type=MenuItem, objc_name="setTitle")
MenuItem_setTitle :: #force_inline proc "c" (self: ^MenuItem, title: ^String) {
msgSend(nil, self, "setTitle:", title)
}
// @(objc_type=MenuItem, objc_name="attributedTitle")
// MenuItem_attributedTitle :: #force_inline proc "c" (self: ^MenuItem) -> ^AttributedString {
// return msgSend(^AttributedString, self, "attributedTitle")
// }
// @(objc_type=MenuItem, objc_name="setAttributedTitle")
// MenuItem_setAttributedTitle :: #force_inline proc "c" (self: ^MenuItem, attributedTitle: ^AttributedString) {
// msgSend(nil, self, "setAttributedTitle:", attributedTitle)
// }
@(objc_type=MenuItem, objc_name="subtitle")
MenuItem_subtitle :: #force_inline proc "c" (self: ^MenuItem) -> ^String {
return msgSend(^String, self, "subtitle")
}
@(objc_type=MenuItem, objc_name="setSubtitle")
MenuItem_setSubtitle :: #force_inline proc "c" (self: ^MenuItem, subtitle: ^String) {
msgSend(nil, self, "setSubtitle:", subtitle)
}
@(objc_type=MenuItem, objc_name="isSeparatorItem")
MenuItem_isSeparatorItem :: #force_inline proc "c" (self: ^MenuItem) -> bool {
return msgSend(bool, self, "isSeparatorItem")
}
@(objc_type=MenuItem, objc_name="isSectionHeader")
MenuItem_isSectionHeader :: #force_inline proc "c" (self: ^MenuItem) -> bool {
return msgSend(bool, self, "isSectionHeader")
}
@(objc_type=MenuItem, objc_name="keyEquivalent")
MenuItem_keyEquivalent :: #force_inline proc "c" (self: ^MenuItem) -> ^String {
return msgSend(^String, self, "keyEquivalent")
}
@(objc_type=MenuItem, objc_name="setKeyEquivalent")
MenuItem_setKeyEquivalent :: #force_inline proc "c" (self: ^MenuItem, keyEquivalent: ^String) {
msgSend(nil, self, "setKeyEquivalent:", keyEquivalent)
}
@(objc_type=MenuItem, objc_name="keyEquivalentModifierMask")
MenuItem_keyEquivalentModifierMask :: #force_inline proc "c" (self: ^MenuItem) -> EventModifierFlags {
return msgSend(EventModifierFlags, self, "keyEquivalentModifierMask")
}
@(objc_type=MenuItem, objc_name="setKeyEquivalentModifierMask")
MenuItem_setKeyEquivalentModifierMask :: #force_inline proc "c" (self: ^MenuItem, keyEquivalentModifierMask: EventModifierFlags) {
msgSend(nil, self, "setKeyEquivalentModifierMask:", keyEquivalentModifierMask)
}
@(objc_type=MenuItem, objc_name="userKeyEquivalent")
MenuItem_userKeyEquivalent :: #force_inline proc "c" (self: ^MenuItem) -> ^String {
return msgSend(^String, self, "userKeyEquivalent")
}
@(objc_type=MenuItem, objc_name="allowsKeyEquivalentWhenHidden")
MenuItem_allowsKeyEquivalentWhenHidden :: #force_inline proc "c" (self: ^MenuItem) -> bool {
return msgSend(bool, self, "allowsKeyEquivalentWhenHidden")
}
@(objc_type=MenuItem, objc_name="setAllowsKeyEquivalentWhenHidden")
MenuItem_setAllowsKeyEquivalentWhenHidden :: #force_inline proc "c" (self: ^MenuItem, allowsKeyEquivalentWhenHidden: bool) {
msgSend(nil, self, "setAllowsKeyEquivalentWhenHidden:", allowsKeyEquivalentWhenHidden)
}
@(objc_type=MenuItem, objc_name="allowsAutomaticKeyEquivalentLocalization")
MenuItem_allowsAutomaticKeyEquivalentLocalization :: #force_inline proc "c" (self: ^MenuItem) -> bool {
return msgSend(bool, self, "allowsAutomaticKeyEquivalentLocalization")
}
@(objc_type=MenuItem, objc_name="setAllowsAutomaticKeyEquivalentLocalization")
MenuItem_setAllowsAutomaticKeyEquivalentLocalization :: #force_inline proc "c" (self: ^MenuItem, allowsAutomaticKeyEquivalentLocalization: bool) {
msgSend(nil, self, "setAllowsAutomaticKeyEquivalentLocalization:", allowsAutomaticKeyEquivalentLocalization)
}
@(objc_type=MenuItem, objc_name="allowsAutomaticKeyEquivalentMirroring")
MenuItem_allowsAutomaticKeyEquivalentMirroring :: #force_inline proc "c" (self: ^MenuItem) -> bool {
return msgSend(bool, self, "allowsAutomaticKeyEquivalentMirroring")
}
@(objc_type=MenuItem, objc_name="setAllowsAutomaticKeyEquivalentMirroring")
MenuItem_setAllowsAutomaticKeyEquivalentMirroring :: #force_inline proc "c" (self: ^MenuItem, allowsAutomaticKeyEquivalentMirroring: bool) {
msgSend(nil, self, "setAllowsAutomaticKeyEquivalentMirroring:", allowsAutomaticKeyEquivalentMirroring)
}
// @(objc_type=MenuItem, objc_name="image")
// MenuItem_image :: #force_inline proc "c" (self: ^MenuItem) -> ^Image {
// return msgSend(^Image, self, "image")
// }
// @(objc_type=MenuItem, objc_name="setImage")
// MenuItem_setImage :: #force_inline proc "c" (self: ^MenuItem, image: ^Image) {
// msgSend(nil, self, "setImage:", image)
// }
// @(objc_type=MenuItem, objc_name="state")
// MenuItem_state :: #force_inline proc "c" (self: ^MenuItem) -> ControlStateValue {
// return msgSend(ControlStateValue, self, "state")
// }
// @(objc_type=MenuItem, objc_name="setState")
// MenuItem_setState :: #force_inline proc "c" (self: ^MenuItem, state: ControlStateValue) {
// msgSend(nil, self, "setState:", state)
// }
// @(objc_type=MenuItem, objc_name="onStateImage")
// MenuItem_onStateImage :: #force_inline proc "c" (self: ^MenuItem) -> ^Image {
// return msgSend(^Image, self, "onStateImage")
// }
// @(objc_type=MenuItem, objc_name="setOnStateImage")
// MenuItem_setOnStateImage :: #force_inline proc "c" (self: ^MenuItem, onStateImage: ^Image) {
// msgSend(nil, self, "setOnStateImage:", onStateImage)
// }
// @(objc_type=MenuItem, objc_name="offStateImage")
// MenuItem_offStateImage :: #force_inline proc "c" (self: ^MenuItem) -> ^Image {
// return msgSend(^Image, self, "offStateImage")
// }
// @(objc_type=MenuItem, objc_name="setOffStateImage")
// MenuItem_setOffStateImage :: #force_inline proc "c" (self: ^MenuItem, offStateImage: ^Image) {
// msgSend(nil, self, "setOffStateImage:", offStateImage)
// }
// @(objc_type=MenuItem, objc_name="mixedStateImage")
// MenuItem_mixedStateImage :: #force_inline proc "c" (self: ^MenuItem) -> ^Image {
// return msgSend(^Image, self, "mixedStateImage")
// }
// @(objc_type=MenuItem, objc_name="setMixedStateImage")
// MenuItem_setMixedStateImage :: #force_inline proc "c" (self: ^MenuItem, mixedStateImage: ^Image) {
// msgSend(nil, self, "setMixedStateImage:", mixedStateImage)
// }
@(objc_type=MenuItem, objc_name="isEnabled")
MenuItem_isEnabled :: #force_inline proc "c" (self: ^MenuItem) -> bool {
return msgSend(bool, self, "isEnabled")
}
@(objc_type=MenuItem, objc_name="setEnabled")
MenuItem_setEnabled :: #force_inline proc "c" (self: ^MenuItem, enabled: bool) {
msgSend(nil, self, "setEnabled:", enabled)
}
@(objc_type=MenuItem, objc_name="isAlternate")
MenuItem_isAlternate :: #force_inline proc "c" (self: ^MenuItem) -> bool {
return msgSend(bool, self, "isAlternate")
}
@(objc_type=MenuItem, objc_name="setAlternate")
MenuItem_setAlternate :: #force_inline proc "c" (self: ^MenuItem, alternate: bool) {
msgSend(nil, self, "setAlternate:", alternate)
}
@(objc_type=MenuItem, objc_name="indentationLevel")
MenuItem_indentationLevel :: #force_inline proc "c" (self: ^MenuItem) -> Integer {
return msgSend(Integer, self, "indentationLevel")
}
@(objc_type=MenuItem, objc_name="setIndentationLevel")
MenuItem_setIndentationLevel :: #force_inline proc "c" (self: ^MenuItem, indentationLevel: Integer) {
msgSend(nil, self, "setIndentationLevel:", indentationLevel)
}
@(objc_type=MenuItem, objc_name="target")
MenuItem_target :: #force_inline proc "c" (self: ^MenuItem) -> id {
return msgSend(id, self, "target")
}
@(objc_type=MenuItem, objc_name="setTarget")
MenuItem_setTarget :: #force_inline proc "c" (self: ^MenuItem, target: id) {
msgSend(nil, self, "setTarget:", target)
}
@(objc_type=MenuItem, objc_name="action")
MenuItem_action :: #force_inline proc "c" (self: ^MenuItem) -> SEL {
return msgSend(SEL, self, "action")
}
@(objc_type=MenuItem, objc_name="setAction")
MenuItem_setAction :: #force_inline proc "c" (self: ^MenuItem, action: SEL) {
msgSend(nil, self, "setAction:", action)
}
@(objc_type=MenuItem, objc_name="tag")
MenuItem_tag :: #force_inline proc "c" (self: ^MenuItem) -> Integer {
return msgSend(Integer, self, "tag")
}
@(objc_type=MenuItem, objc_name="setTag")
MenuItem_setTag :: #force_inline proc "c" (self: ^MenuItem, tag: Integer) {
msgSend(nil, self, "setTag:", tag)
}
@(objc_type=MenuItem, objc_name="representedObject")
MenuItem_representedObject :: #force_inline proc "c" (self: ^MenuItem) -> id {
return msgSend(id, self, "representedObject")
}
@(objc_type=MenuItem, objc_name="setRepresentedObject")
MenuItem_setRepresentedObject :: #force_inline proc "c" (self: ^MenuItem, representedObject: id) {
msgSend(nil, self, "setRepresentedObject:", representedObject)
}
@(objc_type=MenuItem, objc_name="view")
MenuItem_view :: #force_inline proc "c" (self: ^MenuItem) -> ^View {
return msgSend(^View, self, "view")
}
@(objc_type=MenuItem, objc_name="setView")
MenuItem_setView :: #force_inline proc "c" (self: ^MenuItem, view: ^View) {
msgSend(nil, self, "setView:", view)
}
@(objc_type=MenuItem, objc_name="isHighlighted")
MenuItem_isHighlighted :: #force_inline proc "c" (self: ^MenuItem) -> bool {
return msgSend(bool, self, "isHighlighted")
}
@(objc_type=MenuItem, objc_name="isHidden")
MenuItem_isHidden :: #force_inline proc "c" (self: ^MenuItem) -> bool {
return msgSend(bool, self, "isHidden")
}
@(objc_type=MenuItem, objc_name="setHidden")
MenuItem_setHidden :: #force_inline proc "c" (self: ^MenuItem, hidden: bool) {
msgSend(nil, self, "setHidden:", hidden)
}
@(objc_type=MenuItem, objc_name="isHiddenOrHasHiddenAncestor")
MenuItem_isHiddenOrHasHiddenAncestor :: #force_inline proc "c" (self: ^MenuItem) -> bool {
return msgSend(bool, self, "isHiddenOrHasHiddenAncestor")
}
@(objc_type=MenuItem, objc_name="toolTip")
MenuItem_toolTip :: #force_inline proc "c" (self: ^MenuItem) -> ^String {
return msgSend(^String, self, "toolTip")
}
@(objc_type=MenuItem, objc_name="setToolTip")
MenuItem_setToolTip :: #force_inline proc "c" (self: ^MenuItem, toolTip: ^String) {
msgSend(nil, self, "setToolTip:", toolTip)
}
// @(objc_type=MenuItem, objc_name="badge")
// MenuItem_badge :: #force_inline proc "c" (self: ^MenuItem) -> ^MenuItemBadge {
// return msgSend(^MenuItemBadge, self, "badge")
// }
// @(objc_type=MenuItem, objc_name="setBadge")
// MenuItem_setBadge :: #force_inline proc "c" (self: ^MenuItem, badge: ^MenuItemBadge) {
// msgSend(nil, self, "setBadge:", badge)
// }
@(objc_type=MenuItem, objc_name="setMnemonicLocation")
MenuItem_setMnemonicLocation :: #force_inline proc "c" (self: ^MenuItem, location: UInteger) {
msgSend(nil, self, "setMnemonicLocation:", location)
}
@(objc_type=MenuItem, objc_name="mnemonicLocation")
MenuItem_mnemonicLocation :: #force_inline proc "c" (self: ^MenuItem) -> UInteger {
return msgSend(UInteger, self, "mnemonicLocation")
}
@(objc_type=MenuItem, objc_name="mnemonic")
MenuItem_mnemonic :: #force_inline proc "c" (self: ^MenuItem) -> ^String {
return msgSend(^String, self, "mnemonic")
}
@(objc_type=MenuItem, objc_name="setTitleWithMnemonic")
MenuItem_setTitleWithMnemonic :: #force_inline proc "c" (self: ^MenuItem, stringWithAmpersand: ^String) {
msgSend(nil, self, "setTitleWithMnemonic:", stringWithAmpersand)
}
@(objc_type=MenuItem, objc_name="load", objc_is_class_method=true)
MenuItem_load :: #force_inline proc "c" () {
msgSend(nil, MenuItem, "load")
}
@(objc_type=MenuItem, objc_name="initialize", objc_is_class_method=true)
MenuItem_initialize :: #force_inline proc "c" () {
msgSend(nil, MenuItem, "initialize")
}
@(objc_type=MenuItem, objc_name="new", objc_is_class_method=true)
MenuItem_new :: #force_inline proc "c" () -> ^MenuItem {
return msgSend(^MenuItem, MenuItem, "new")
}
@(objc_type=MenuItem, objc_name="allocWithZone", objc_is_class_method=true)
MenuItem_allocWithZone :: #force_inline proc "c" (zone: ^Zone) -> ^MenuItem {
return msgSend(^MenuItem, MenuItem, "allocWithZone:", zone)
}
@(objc_type=MenuItem, objc_name="alloc", objc_is_class_method=true)
MenuItem_alloc :: #force_inline proc "c" () -> ^MenuItem {
return msgSend(^MenuItem, MenuItem, "alloc")
}
@(objc_type=MenuItem, objc_name="copyWithZone", objc_is_class_method=true)
MenuItem_copyWithZone :: #force_inline proc "c" (zone: ^Zone) -> id {
return msgSend(id, MenuItem, "copyWithZone:", zone)
}
@(objc_type=MenuItem, objc_name="mutableCopyWithZone", objc_is_class_method=true)
MenuItem_mutableCopyWithZone :: #force_inline proc "c" (zone: ^Zone) -> id {
return msgSend(id, MenuItem, "mutableCopyWithZone:", zone)
}
@(objc_type=MenuItem, objc_name="instancesRespondToSelector", objc_is_class_method=true)
MenuItem_instancesRespondToSelector :: #force_inline proc "c" (aSelector: SEL) -> bool {
return msgSend(bool, MenuItem, "instancesRespondToSelector:", aSelector)
}
@(objc_type=MenuItem, objc_name="conformsToProtocol", objc_is_class_method=true)
MenuItem_conformsToProtocol :: #force_inline proc "c" (protocol: ^Protocol) -> bool {
return msgSend(bool, MenuItem, "conformsToProtocol:", protocol)
}
@(objc_type=MenuItem, objc_name="instanceMethodForSelector", objc_is_class_method=true)
MenuItem_instanceMethodForSelector :: #force_inline proc "c" (aSelector: SEL) -> IMP {
return msgSend(IMP, MenuItem, "instanceMethodForSelector:", aSelector)
}
// @(objc_type=MenuItem, objc_name="instanceMethodSignatureForSelector", objc_is_class_method=true)
// MenuItem_instanceMethodSignatureForSelector :: #force_inline proc "c" (aSelector: SEL) -> ^MethodSignature {
// return msgSend(^MethodSignature, MenuItem, "instanceMethodSignatureForSelector:", aSelector)
// }
@(objc_type=MenuItem, objc_name="isSubclassOfClass", objc_is_class_method=true)
MenuItem_isSubclassOfClass :: #force_inline proc "c" (aClass: Class) -> bool {
return msgSend(bool, MenuItem, "isSubclassOfClass:", aClass)
}
@(objc_type=MenuItem, objc_name="resolveClassMethod", objc_is_class_method=true)
MenuItem_resolveClassMethod :: #force_inline proc "c" (sel: SEL) -> bool {
return msgSend(bool, MenuItem, "resolveClassMethod:", sel)
}
@(objc_type=MenuItem, objc_name="resolveInstanceMethod", objc_is_class_method=true)
MenuItem_resolveInstanceMethod :: #force_inline proc "c" (sel: SEL) -> bool {
return msgSend(bool, MenuItem, "resolveInstanceMethod:", sel)
}
@(objc_type=MenuItem, objc_name="hash", objc_is_class_method=true)
MenuItem_hash :: #force_inline proc "c" () -> UInteger {
return msgSend(UInteger, MenuItem, "hash")
}
@(objc_type=MenuItem, objc_name="superclass", objc_is_class_method=true)
MenuItem_superclass :: #force_inline proc "c" () -> Class {
return msgSend(Class, MenuItem, "superclass")
}
@(objc_type=MenuItem, objc_name="class", objc_is_class_method=true)
MenuItem_class :: #force_inline proc "c" () -> Class {
return msgSend(Class, MenuItem, "class")
}
@(objc_type=MenuItem, objc_name="description", objc_is_class_method=true)
MenuItem_description :: #force_inline proc "c" () -> ^String {
return msgSend(^String, MenuItem, "description")
}
@(objc_type=MenuItem, objc_name="debugDescription", objc_is_class_method=true)
MenuItem_debugDescription :: #force_inline proc "c" () -> ^String {
return msgSend(^String, MenuItem, "debugDescription")
}
@(objc_type=MenuItem, objc_name="version", objc_is_class_method=true)
MenuItem_version :: #force_inline proc "c" () -> Integer {
return msgSend(Integer, MenuItem, "version")
}
@(objc_type=MenuItem, objc_name="setVersion", objc_is_class_method=true)
MenuItem_setVersion :: #force_inline proc "c" (aVersion: Integer) {
msgSend(nil, MenuItem, "setVersion:", aVersion)
}
@(objc_type=MenuItem, objc_name="poseAsClass", objc_is_class_method=true)
MenuItem_poseAsClass :: #force_inline proc "c" (aClass: Class) {
msgSend(nil, MenuItem, "poseAsClass:", aClass)
}
@(objc_type=MenuItem, objc_name="cancelPreviousPerformRequestsWithTarget_selector_object", objc_is_class_method=true)
MenuItem_cancelPreviousPerformRequestsWithTarget_selector_object :: #force_inline proc "c" (aTarget: id, aSelector: SEL, anArgument: id) {
msgSend(nil, MenuItem, "cancelPreviousPerformRequestsWithTarget:selector:object:", aTarget, aSelector, anArgument)
}
@(objc_type=MenuItem, objc_name="cancelPreviousPerformRequestsWithTarget_", objc_is_class_method=true)
MenuItem_cancelPreviousPerformRequestsWithTarget_ :: #force_inline proc "c" (aTarget: id) {
msgSend(nil, MenuItem, "cancelPreviousPerformRequestsWithTarget:", aTarget)
}
@(objc_type=MenuItem, objc_name="accessInstanceVariablesDirectly", objc_is_class_method=true)
MenuItem_accessInstanceVariablesDirectly :: #force_inline proc "c" () -> bool {
return msgSend(bool, MenuItem, "accessInstanceVariablesDirectly")
}
@(objc_type=MenuItem, objc_name="useStoredAccessor", objc_is_class_method=true)
MenuItem_useStoredAccessor :: #force_inline proc "c" () -> bool {
return msgSend(bool, MenuItem, "useStoredAccessor")
}
@(objc_type=MenuItem, objc_name="keyPathsForValuesAffectingValueForKey", objc_is_class_method=true)
MenuItem_keyPathsForValuesAffectingValueForKey :: #force_inline proc "c" (key: ^String) -> ^Set {
return msgSend(^Set, MenuItem, "keyPathsForValuesAffectingValueForKey:", key)
}
@(objc_type=MenuItem, objc_name="automaticallyNotifiesObserversForKey", objc_is_class_method=true)
MenuItem_automaticallyNotifiesObserversForKey :: #force_inline proc "c" (key: ^String) -> bool {
return msgSend(bool, MenuItem, "automaticallyNotifiesObserversForKey:", key)
}
@(objc_type=MenuItem, objc_name="setKeys", objc_is_class_method=true)
MenuItem_setKeys :: #force_inline proc "c" (keys: ^Array, dependentKey: ^String) {
msgSend(nil, MenuItem, "setKeys:triggerChangeNotificationsForDependentKey:", keys, dependentKey)
}
@(objc_type=MenuItem, objc_name="classFallbacksForKeyedArchiver", objc_is_class_method=true)
MenuItem_classFallbacksForKeyedArchiver :: #force_inline proc "c" () -> ^Array {
return msgSend(^Array, MenuItem, "classFallbacksForKeyedArchiver")
}
@(objc_type=MenuItem, objc_name="classForKeyedUnarchiver", objc_is_class_method=true)
MenuItem_classForKeyedUnarchiver :: #force_inline proc "c" () -> Class {
return msgSend(Class, MenuItem, "classForKeyedUnarchiver")
}
@(objc_type=MenuItem, objc_name="exposeBinding", objc_is_class_method=true)
MenuItem_exposeBinding :: #force_inline proc "c" (binding: ^String) {
msgSend(nil, MenuItem, "exposeBinding:", binding)
}
@(objc_type=MenuItem, objc_name="setDefaultPlaceholder", objc_is_class_method=true)
MenuItem_setDefaultPlaceholder :: #force_inline proc "c" (placeholder: id, marker: id, binding: ^String) {
msgSend(nil, MenuItem, "setDefaultPlaceholder:forMarker:withBinding:", placeholder, marker, binding)
}
@(objc_type=MenuItem, objc_name="defaultPlaceholderForMarker", objc_is_class_method=true)
MenuItem_defaultPlaceholderForMarker :: #force_inline proc "c" (marker: id, binding: ^String) -> id {
return msgSend(id, MenuItem, "defaultPlaceholderForMarker:withBinding:", marker, binding)
}
@(objc_type=MenuItem, objc_name="cancelPreviousPerformRequestsWithTarget")
MenuItem_cancelPreviousPerformRequestsWithTarget :: proc {
MenuItem_cancelPreviousPerformRequestsWithTarget_selector_object,
MenuItem_cancelPreviousPerformRequestsWithTarget_,
}
+52 -52
View File
@@ -146,7 +146,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
return nil
}
if template.windowWillPositionSheetUsingRect != nil {
windowWillPositionSheetUsingRect :: proc "c" (self: id, window: ^Window, sheet: ^Window, rect: Rect) -> Rect {
windowWillPositionSheetUsingRect :: proc "c" (self: id, cmd: SEL, window: ^Window, sheet: ^Window, rect: Rect) -> Rect {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillPositionSheetUsingRect(window, sheet, rect)
@@ -154,7 +154,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:willPositionSheet:usingRect:"), auto_cast windowWillPositionSheetUsingRect, _RECT_ENCODING+"@:@@"+_RECT_ENCODING)
}
if template.windowWillBeginSheet != nil {
windowWillBeginSheet :: proc "c" (self: id, notification: ^Notification) {
windowWillBeginSheet :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillBeginSheet(notification)
@@ -162,7 +162,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillBeginSheet:"), auto_cast windowWillBeginSheet, "v@:@")
}
if template.windowDidEndSheet != nil {
windowDidEndSheet :: proc "c" (self: id, notification: ^Notification) {
windowDidEndSheet :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidEndSheet(notification)
@@ -170,7 +170,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidEndSheet:"), auto_cast windowDidEndSheet, "v@:@")
}
if template.windowWillResizeToSize != nil {
windowWillResizeToSize :: proc "c" (self: id, sender: ^Window, frameSize: Size) -> Size {
windowWillResizeToSize :: proc "c" (self: id, cmd: SEL, sender: ^Window, frameSize: Size) -> Size {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillResizeToSize(sender, frameSize)
@@ -178,7 +178,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillResize:toSize:"), auto_cast windowWillResizeToSize, _SIZE_ENCODING+"@:@"+_SIZE_ENCODING)
}
if template.windowDidResize != nil {
windowDidResize :: proc "c" (self: id, notification: ^Notification) {
windowDidResize :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidResize(notification)
@@ -186,7 +186,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidResize:"), auto_cast windowDidResize, "v@:@")
}
if template.windowWillStartLiveResize != nil {
windowWillStartLiveResize :: proc "c" (self: id, notification: ^Notification) {
windowWillStartLiveResize :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillStartLiveResize(notification)
@@ -194,7 +194,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillStartLiveResize:"), auto_cast windowWillStartLiveResize, "v@:@")
}
if template.windowDidEndLiveResize != nil {
windowDidEndLiveResize :: proc "c" (self: id, notification: ^Notification) {
windowDidEndLiveResize :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidEndLiveResize(notification)
@@ -202,7 +202,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidEndLiveResize:"), auto_cast windowDidEndLiveResize, "v@:@")
}
if template.windowWillMiniaturize != nil {
windowWillMiniaturize :: proc "c" (self: id, notification: ^Notification) {
windowWillMiniaturize :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillMiniaturize(notification)
@@ -210,7 +210,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillMiniaturize:"), auto_cast windowWillMiniaturize, "v@:@")
}
if template.windowDidMiniaturize != nil {
windowDidMiniaturize :: proc "c" (self: id, notification: ^Notification) {
windowDidMiniaturize :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidMiniaturize(notification)
@@ -218,7 +218,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidMiniaturize:"), auto_cast windowDidMiniaturize, "v@:@")
}
if template.windowDidDeminiaturize != nil {
windowDidDeminiaturize :: proc "c" (self: id, notification: ^Notification) {
windowDidDeminiaturize :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidDeminiaturize(notification)
@@ -226,7 +226,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidDeminiaturize:"), auto_cast windowDidDeminiaturize, "v@:@")
}
if template.windowWillUseStandardFrameDefaultFrame != nil {
windowWillUseStandardFrameDefaultFrame :: proc(self: id, window: ^Window, newFrame: Rect) -> Rect {
windowWillUseStandardFrameDefaultFrame :: proc(self: id, cmd: SEL, window: ^Window, newFrame: Rect) -> Rect {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillUseStandardFrameDefaultFrame(window, newFrame)
@@ -234,7 +234,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillUseStandardFrame:defaultFrame:"), auto_cast windowWillUseStandardFrameDefaultFrame, _RECT_ENCODING+"@:@"+_RECT_ENCODING)
}
if template.windowShouldZoomToFrame != nil {
windowShouldZoomToFrame :: proc "c" (self: id, window: ^Window, newFrame: Rect) -> BOOL {
windowShouldZoomToFrame :: proc "c" (self: id, cmd: SEL, window: ^Window, newFrame: Rect) -> BOOL {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowShouldZoomToFrame(window, newFrame)
@@ -242,7 +242,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowShouldZoom:toFrame:"), auto_cast windowShouldZoomToFrame, "B@:@"+_RECT_ENCODING)
}
if template.windowWillUseFullScreenContentSize != nil {
windowWillUseFullScreenContentSize :: proc "c" (self: id, window: ^Window, proposedSize: Size) -> Size {
windowWillUseFullScreenContentSize :: proc "c" (self: id, cmd: SEL, window: ^Window, proposedSize: Size) -> Size {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillUseFullScreenContentSize(window, proposedSize)
@@ -250,7 +250,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:willUseFullScreenContentSize:"), auto_cast windowWillUseFullScreenContentSize, _SIZE_ENCODING+"@:@"+_SIZE_ENCODING)
}
if template.windowWillUseFullScreenPresentationOptions != nil {
windowWillUseFullScreenPresentationOptions :: proc(self: id, window: ^Window, proposedOptions: ApplicationPresentationOptions) -> ApplicationPresentationOptions {
windowWillUseFullScreenPresentationOptions :: proc(self: id, cmd: SEL, window: ^Window, proposedOptions: ApplicationPresentationOptions) -> ApplicationPresentationOptions {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillUseFullScreenPresentationOptions(window, proposedOptions)
@@ -258,7 +258,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:willUseFullScreenPresentationOptions:"), auto_cast windowWillUseFullScreenPresentationOptions, _UINTEGER_ENCODING+"@:@"+_UINTEGER_ENCODING)
}
if template.windowWillEnterFullScreen != nil {
windowWillEnterFullScreen :: proc "c" (self: id, notification: ^Notification) {
windowWillEnterFullScreen :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillEnterFullScreen(notification)
@@ -266,7 +266,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillEnterFullScreen:"), auto_cast windowWillEnterFullScreen, "v@:@")
}
if template.windowDidEnterFullScreen != nil {
windowDidEnterFullScreen :: proc "c" (self: id, notification: ^Notification) {
windowDidEnterFullScreen :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidEnterFullScreen(notification)
@@ -274,7 +274,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidEnterFullScreen:"), auto_cast windowDidEnterFullScreen, "v@:@")
}
if template.windowWillExitFullScreen != nil {
windowWillExitFullScreen :: proc "c" (self: id, notification: ^Notification) {
windowWillExitFullScreen :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillExitFullScreen(notification)
@@ -282,7 +282,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillExitFullScreen:"), auto_cast windowWillExitFullScreen, "v@:@")
}
if template.windowDidExitFullScreen != nil {
windowDidExitFullScreen :: proc "c" (self: id, notification: ^Notification) {
windowDidExitFullScreen :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidExitFullScreen(notification)
@@ -290,7 +290,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidExitFullScreen:"), auto_cast windowDidExitFullScreen, "v@:@")
}
if template.customWindowsToEnterFullScreenForWindow != nil {
customWindowsToEnterFullScreenForWindow :: proc "c" (self: id, window: ^Window) -> ^Array {
customWindowsToEnterFullScreenForWindow :: proc "c" (self: id, cmd: SEL, window: ^Window) -> ^Array {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.customWindowsToEnterFullScreenForWindow(window)
@@ -298,7 +298,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("customWindowsToEnterFullScreenForWindow:"), auto_cast customWindowsToEnterFullScreenForWindow, "@@:@")
}
if template.customWindowsToEnterFullScreenForWindowOnScreen != nil {
customWindowsToEnterFullScreenForWindowOnScreen :: proc(self: id, window: ^Window, screen: ^Screen) -> ^Array {
customWindowsToEnterFullScreenForWindowOnScreen :: proc(self: id, cmd: SEL, window: ^Window, screen: ^Screen) -> ^Array {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.customWindowsToEnterFullScreenForWindowOnScreen(window, screen)
@@ -306,7 +306,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("customWindowsToEnterFullScreenForWindow:onScreen:"), auto_cast customWindowsToEnterFullScreenForWindowOnScreen, "@@:@@")
}
if template.windowStartCustomAnimationToEnterFullScreenWithDuration != nil {
windowStartCustomAnimationToEnterFullScreenWithDuration :: proc "c" (self: id, window: ^Window, duration: TimeInterval) {
windowStartCustomAnimationToEnterFullScreenWithDuration :: proc "c" (self: id, cmd: SEL, window: ^Window, duration: TimeInterval) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowStartCustomAnimationToEnterFullScreenWithDuration(window, duration)
@@ -314,7 +314,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:startCustomAnimationToEnterFullScreenWithDuration:"), auto_cast windowStartCustomAnimationToEnterFullScreenWithDuration, "v@:@@")
}
if template.windowStartCustomAnimationToEnterFullScreenOnScreenWithDuration != nil {
windowStartCustomAnimationToEnterFullScreenOnScreenWithDuration :: proc(self: id, window: ^Window, screen: ^Screen, duration: TimeInterval) {
windowStartCustomAnimationToEnterFullScreenOnScreenWithDuration :: proc(self: id, cmd: SEL, window: ^Window, screen: ^Screen, duration: TimeInterval) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowStartCustomAnimationToEnterFullScreenOnScreenWithDuration(window, screen, duration)
@@ -322,7 +322,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:startCustomAnimationToEnterFullScreenOnScreen:withDuration:"), auto_cast windowStartCustomAnimationToEnterFullScreenOnScreenWithDuration, "v@:@@d")
}
if template.windowDidFailToEnterFullScreen != nil {
windowDidFailToEnterFullScreen :: proc "c" (self: id, window: ^Window) {
windowDidFailToEnterFullScreen :: proc "c" (self: id, cmd: SEL, window: ^Window) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidFailToEnterFullScreen(window)
@@ -330,7 +330,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidFailToEnterFullScreen:"), auto_cast windowDidFailToEnterFullScreen, "v@:@")
}
if template.customWindowsToExitFullScreenForWindow != nil {
customWindowsToExitFullScreenForWindow :: proc "c" (self: id, window: ^Window) -> ^Array {
customWindowsToExitFullScreenForWindow :: proc "c" (self: id, cmd: SEL, window: ^Window) -> ^Array {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.customWindowsToExitFullScreenForWindow(window)
@@ -338,7 +338,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("customWindowsToExitFullScreenForWindow:"), auto_cast customWindowsToExitFullScreenForWindow, "@@:@")
}
if template.windowStartCustomAnimationToExitFullScreenWithDuration != nil {
windowStartCustomAnimationToExitFullScreenWithDuration :: proc "c" (self: id, window: ^Window, duration: TimeInterval) {
windowStartCustomAnimationToExitFullScreenWithDuration :: proc "c" (self: id, cmd: SEL, window: ^Window, duration: TimeInterval) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowStartCustomAnimationToExitFullScreenWithDuration(window, duration)
@@ -346,7 +346,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:startCustomAnimationToExitFullScreenWithDuration:"), auto_cast windowStartCustomAnimationToExitFullScreenWithDuration, "v@:@d")
}
if template.windowDidFailToExitFullScreen != nil {
windowDidFailToExitFullScreen :: proc "c" (self: id, window: ^Window) {
windowDidFailToExitFullScreen :: proc "c" (self: id, cmd: SEL, window: ^Window) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidFailToExitFullScreen(window)
@@ -354,7 +354,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidFailToExitFullScreen:"), auto_cast windowDidFailToExitFullScreen, "v@:@")
}
if template.windowWillMove != nil {
windowWillMove :: proc "c" (self: id, notification: ^Notification) {
windowWillMove :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillMove(notification)
@@ -362,7 +362,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillMove:"), auto_cast windowWillMove, "v@:@")
}
if template.windowDidMove != nil {
windowDidMove :: proc "c" (self: id, notification: ^Notification) {
windowDidMove :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidMove(notification)
@@ -370,7 +370,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidMove:"), auto_cast windowDidMove, "v@:@")
}
if template.windowDidChangeScreen != nil {
windowDidChangeScreen :: proc "c" (self: id, notification: ^Notification) {
windowDidChangeScreen :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidChangeScreen(notification)
@@ -378,7 +378,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidChangeScreen:"), auto_cast windowDidChangeScreen, "v@:@")
}
if template.windowDidChangeScreenProfile != nil {
windowDidChangeScreenProfile :: proc "c" (self: id, notification: ^Notification) {
windowDidChangeScreenProfile :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidChangeScreenProfile(notification)
@@ -386,7 +386,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidChangeScreenProfile:"), auto_cast windowDidChangeScreenProfile, "v@:@")
}
if template.windowDidChangeBackingProperties != nil {
windowDidChangeBackingProperties :: proc "c" (self: id, notification: ^Notification) {
windowDidChangeBackingProperties :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidChangeBackingProperties(notification)
@@ -394,7 +394,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidChangeBackingProperties:"), auto_cast windowDidChangeBackingProperties, "v@:@")
}
if template.windowShouldClose != nil {
windowShouldClose :: proc "c" (self:id, sender: ^Window) -> BOOL {
windowShouldClose :: proc "c" (self:id, cmd: SEL, sender: ^Window) -> BOOL {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowShouldClose(sender)
@@ -402,7 +402,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowShouldClose:"), auto_cast windowShouldClose, "B@:@")
}
if template.windowWillClose != nil {
windowWillClose :: proc "c" (self:id, notification: ^Notification) {
windowWillClose :: proc "c" (self:id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillClose(notification)
@@ -410,7 +410,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillClose:"), auto_cast windowWillClose, "v@:@")
}
if template.windowDidBecomeKey != nil {
windowDidBecomeKey :: proc "c" (self: id, notification: ^Notification) {
windowDidBecomeKey :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidBecomeKey(notification)
@@ -418,7 +418,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidBecomeKey:"), auto_cast windowDidBecomeKey, "v@:@")
}
if template.windowDidResignKey != nil {
windowDidResignKey :: proc "c" (self: id, notification: ^Notification) {
windowDidResignKey :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidResignKey(notification)
@@ -426,7 +426,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidResignKey:"), auto_cast windowDidResignKey, "v@:@")
}
if template.windowDidBecomeMain != nil {
windowDidBecomeMain :: proc "c" (self: id, notification: ^Notification) {
windowDidBecomeMain :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidBecomeMain(notification)
@@ -434,7 +434,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidBecomeMain:"), auto_cast windowDidBecomeMain, "v@:@")
}
if template.windowDidResignMain != nil {
windowDidResignMain :: proc "c" (self: id, notification: ^Notification) {
windowDidResignMain :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidResignMain(notification)
@@ -442,7 +442,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidResignMain:"), auto_cast windowDidResignMain, "v@:@")
}
if template.windowWillReturnFieldEditorToObject != nil {
windowWillReturnFieldEditorToObject :: proc "c" (self:id, sender: ^Window, client: id) -> id {
windowWillReturnFieldEditorToObject :: proc "c" (self:id, cmd: SEL, sender: ^Window, client: id) -> id {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillReturnFieldEditorToObject(sender, client)
@@ -450,7 +450,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillReturnFieldEditor:toObject:"), auto_cast windowWillReturnFieldEditorToObject, "@@:@@")
}
if template.windowDidUpdate != nil {
windowDidUpdate :: proc "c" (self: id, notification: ^Notification) {
windowDidUpdate :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidUpdate(notification)
@@ -458,7 +458,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidUpdate:"), auto_cast windowDidUpdate, "v@:@")
}
if template.windowDidExpose != nil {
windowDidExpose :: proc "c" (self: id, notification: ^Notification) {
windowDidExpose :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidExpose(notification)
@@ -466,7 +466,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidExpose:"), auto_cast windowDidExpose, "v@:@")
}
if template.windowDidChangeOcclusionState != nil {
windowDidChangeOcclusionState :: proc "c" (self: id, notification: ^Notification) {
windowDidChangeOcclusionState :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidChangeOcclusionState(notification)
@@ -474,7 +474,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidChangeOcclusionState:"), auto_cast windowDidChangeOcclusionState, "v@:@")
}
if template.windowShouldDragDocumentWithEventFromWithPasteboard != nil {
windowShouldDragDocumentWithEventFromWithPasteboard :: proc "c" (self: id, window: ^Window, event: ^Event, dragImageLocation: Point, pasteboard: ^Pasteboard) -> BOOL {
windowShouldDragDocumentWithEventFromWithPasteboard :: proc "c" (self: id, cmd: SEL, window: ^Window, event: ^Event, dragImageLocation: Point, pasteboard: ^Pasteboard) -> BOOL {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowShouldDragDocumentWithEventFromWithPasteboard(window, event, dragImageLocation, pasteboard)
@@ -482,7 +482,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:shouldDragDocumentWithEvent:from:withPasteboard:"), auto_cast windowShouldDragDocumentWithEventFromWithPasteboard, "B@:@@"+_POINT_ENCODING+"@")
}
if template.windowWillReturnUndoManager != nil {
windowWillReturnUndoManager :: proc "c" (self: id, window: ^Window) -> ^UndoManager {
windowWillReturnUndoManager :: proc "c" (self: id, cmd: SEL, window: ^Window) -> ^UndoManager {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillReturnUndoManager(window)
@@ -490,7 +490,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillReturnUndoManager:"), auto_cast windowWillReturnUndoManager, "@@:@")
}
if template.windowShouldPopUpDocumentPathMenu != nil {
windowShouldPopUpDocumentPathMenu :: proc "c" (self: id, window: ^Window, menu: ^Menu) -> BOOL {
windowShouldPopUpDocumentPathMenu :: proc "c" (self: id, cmd: SEL, window: ^Window, menu: ^Menu) -> BOOL {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowShouldPopUpDocumentPathMenu(window, menu)
@@ -498,7 +498,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:shouldPopUpDocumentPathMenu:"), auto_cast windowShouldPopUpDocumentPathMenu, "B@:@@")
}
if template.windowWillEncodeRestorableState != nil {
windowWillEncodeRestorableState :: proc "c" (self: id, window: ^Window, state: ^Coder) {
windowWillEncodeRestorableState :: proc "c" (self: id, cmd: SEL, window: ^Window, state: ^Coder) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillEncodeRestorableState(window, state)
@@ -506,7 +506,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:willEncodeRestorableState:"), auto_cast windowWillEncodeRestorableState, "v@:@@")
}
if template.windowDidEncodeRestorableState != nil {
windowDidEncodeRestorableState :: proc "c" (self: id, window: ^Window, state: ^Coder) {
windowDidEncodeRestorableState :: proc "c" (self: id, cmd: SEL, window: ^Window, state: ^Coder) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidEncodeRestorableState(window, state)
@@ -514,7 +514,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:didDecodeRestorableState:"), auto_cast windowDidEncodeRestorableState, "v@:@@")
}
if template.windowWillResizeForVersionBrowserWithMaxPreferredSizeMaxAllowedSize != nil {
windowWillResizeForVersionBrowserWithMaxPreferredSizeMaxAllowedSize :: proc "c" (self: id, window: ^Window, maxPreferredFrameSize: Size, maxAllowedFrameSize: Size) -> Size {
windowWillResizeForVersionBrowserWithMaxPreferredSizeMaxAllowedSize :: proc "c" (self: id, cmd: SEL, window: ^Window, maxPreferredFrameSize: Size, maxAllowedFrameSize: Size) -> Size {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillResizeForVersionBrowserWithMaxPreferredSizeMaxAllowedSize(window, maxPreferredFrameSize, maxPreferredFrameSize)
@@ -522,7 +522,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:willResizeForVersionBrowserWithMaxPreferredSize:maxAllowedSize:"), auto_cast windowWillResizeForVersionBrowserWithMaxPreferredSizeMaxAllowedSize, _SIZE_ENCODING+"@:@"+_SIZE_ENCODING+_SIZE_ENCODING)
}
if template.windowWillEnterVersionBrowser != nil {
windowWillEnterVersionBrowser :: proc "c" (self: id, notification: ^Notification) {
windowWillEnterVersionBrowser :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillEnterVersionBrowser(notification)
@@ -530,7 +530,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillEnterVersionBrowser:"), auto_cast windowWillEnterVersionBrowser, "v@:@")
}
if template.windowDidEnterVersionBrowser != nil {
windowDidEnterVersionBrowser :: proc "c" (self: id, notification: ^Notification) {
windowDidEnterVersionBrowser :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidEnterVersionBrowser(notification)
@@ -538,7 +538,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidEnterVersionBrowser:"), auto_cast windowDidEnterVersionBrowser, "v@:@")
}
if template.windowWillExitVersionBrowser != nil {
windowWillExitVersionBrowser :: proc "c" (self: id, notification: ^Notification) {
windowWillExitVersionBrowser :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillExitVersionBrowser(notification)
@@ -546,7 +546,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillExitVersionBrowser:"), auto_cast windowWillExitVersionBrowser, "v@:@")
}
if template.windowDidExitVersionBrowser != nil {
windowDidExitVersionBrowser :: proc "c" (self: id, notification: ^Notification) {
windowDidExitVersionBrowser :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidExitVersionBrowser(notification)
@@ -780,4 +780,4 @@ Window_performWindowDragWithEvent :: proc "c" (self: ^Window, event: ^Event) {
@(objc_type=Window, objc_name="setToolbar")
Window_setToolbar :: proc "c" (self: ^Window, toolbar: ^Toolbar) {
msgSend(nil, self, "setToolbar:", toolbar)
}
}
+136
View File
@@ -0,0 +1,136 @@
package objc_Foundation
import "base:runtime"
import "base:intrinsics"
Subclasser_Proc :: proc(cls: Class, vtable: rawptr)
Object_VTable_Info :: struct {
vtable: rawptr,
size: uint,
impl: Subclasser_Proc,
}
Class_VTable_Info :: struct {
_context: runtime.Context,
super_vtable: rawptr,
protocol_vtable: rawptr,
}
@(require_results)
class_get_metaclass :: #force_inline proc "contextless" (cls: Class) -> Class {
return (^Class)(cls)^
}
@(require_results)
object_get_vtable_info :: proc "contextless" (obj: id) -> ^Class_VTable_Info {
return (^Class_VTable_Info)(object_getIndexedIvars(obj))
}
@(require_results)
make_subclasser :: #force_inline proc(vtable: ^$T, impl: proc(cls: Class, vt: ^T)) -> Object_VTable_Info {
return Object_VTable_Info{
vtable = vtable,
size = size_of(T),
impl = (Subclasser_Proc)(impl),
}
}
@(require_results)
register_subclass :: proc(
class_name: cstring,
superclass: Class,
superclass_overrides: Maybe(Object_VTable_Info) = nil,
protocol: Maybe(Object_VTable_Info) = nil,
_context: Maybe(runtime.Context) = nil,
) -> Class {
assert(superclass != nil)
super_size: uint
proto_size: uint
if superclass_overrides != nil {
// Align to 8-byte boundary
super_size = (superclass_overrides.?.size + 7)/8 * 8
}
if protocol != nil {
// Align to 8-byte boundary
proto_size = (protocol.?.size + 7)/8 * 8
}
cls := objc_lookUpClass(class_name)
if cls != nil {
return cls
}
extra_size := uint(size_of(Class_VTable_Info)) + 8 + super_size + proto_size
cls = objc_allocateClassPair(superclass, class_name, extra_size)
assert(cls != nil)
if s, ok := superclass_overrides.?; ok {
s.impl(cls, s.vtable)
}
if p, ok := protocol.?; ok {
p.impl(cls, p.vtable)
}
objc_registerClassPair(cls)
meta_cls := class_get_metaclass(cls)
meta_size := uint(class_getInstanceSize(meta_cls))
// Offsets are always aligned to 8-byte boundary
info_offset := (meta_size + 7) / 8 * 8
super_vtable_offset := (info_offset + size_of(Class_VTable_Info) + 7) / 8 * 8
ptoto_vtable_offset := super_vtable_offset + super_size
p_info := (^Class_VTable_Info)(([^]u8)(cls)[info_offset:])
p_super_vtable := ([^]u8)(cls)[super_vtable_offset:]
p_proto_vtable := ([^]u8)(cls)[ptoto_vtable_offset:]
intrinsics.mem_zero(p_info, size_of(Class_VTable_Info))
// Assign the context
p_info._context = _context.? or_else context
if s, ok := superclass_overrides.?; ok {
p_info.super_vtable = p_super_vtable
intrinsics.mem_copy(p_super_vtable, s.vtable, super_size)
}
if p, ok := protocol.?; ok {
p_info.protocol_vtable = p_proto_vtable
intrinsics.mem_copy(p_proto_vtable, p.vtable, p.size)
}
return cls
}
@(require_results)
class_get_vtable_info :: proc "contextless" (cls: Class) -> ^Class_VTable_Info {
meta_cls := class_get_metaclass(cls)
meta_size := uint(class_getInstanceSize(meta_cls))
// Align to 8-byte boundary
info_offset := (meta_size+7) / 8 * 8
p_cls := ([^]u8)(cls)[info_offset:]
ctx := (^Class_VTable_Info)(p_cls)
return ctx
}
@(require_results)
alloc_user_object :: proc "contextless" (cls: Class, _context: Maybe(runtime.Context) = nil) -> id {
info := class_get_vtable_info(cls)
obj := class_createInstance(cls, size_of(Class_VTable_Info))
obj_info := (^Class_VTable_Info)(object_getIndexedIvars(obj))
obj_info^ = info^
if _context != nil {
obj_info._context = _context.?
}
return obj
}
+67
View File
@@ -0,0 +1,67 @@
package darwin
import "core:sys/posix"
copyfile_state_t :: distinct rawptr
copyfile_flags :: bit_set[enum {
ACL,
STAT,
XATTR,
DATA,
RECURSIVE = 15,
CHECK,
EXCL,
NOFOLLOW_SRC,
NOFOLLOW_DST,
MOVE,
UNLINK,
PACK,
UNPACK,
CLONE,
CLONE_FORCE,
RUN_IN_PLACE,
DATA_SPARSE,
PRESERVE_DST_TRACKED,
VERBOSE = 30,
}; u32]
COPYFILE_SECURITY :: copyfile_flags{.STAT, .ACL}
COPYFILE_METADATA :: COPYFILE_SECURITY + copyfile_flags{.XATTR}
COPYFILE_ALL :: COPYFILE_METADATA + copyfile_flags{.DATA}
COPYFILE_NOFOLLOW :: copyfile_flags{.NOFOLLOW_SRC, .NOFOLLOW_DST}
copyfile_state_flag :: enum u32 {
SRC_FD = 1,
SRC_FILENAME,
DST_FD,
DST_FILENAME,
QUARANTINE,
STATUS_CB,
STATUS_CTX,
COPIED,
XATTRNAME,
WAS_CLONED,
SRC_BSIZE,
DST_BSIZE,
BSIZE,
FORBID_CROSS_MOUNT,
NOCPROTECT,
PRESERVE_SUID,
RECURSIVE_SRC_FTSENT,
FORBID_DST_EXISTING_SYMLINKS,
}
foreign system {
copyfile :: proc(from, to: cstring, state: copyfile_state_t, flags: copyfile_flags) -> i32 ---
fcopyfile :: proc(from, to: posix.FD, state: copyfile_state_t, flags: copyfile_flags) -> i32 ---
copyfile_state_alloc :: proc() -> copyfile_state_t ---
copyfile_state_free :: proc(state: copyfile_state_t) -> posix.result ---
copyfile_state_get :: proc(state: copyfile_state_t, flag: copyfile_state_flag, dst: rawptr) -> posix.result ---
copyfile_state_set :: proc(state: copyfile_state_t, flag: copyfile_state_flag, src: rawptr) -> posix.result ---
}
+1
View File
@@ -3,6 +3,7 @@ package darwin
import "core:c"
@(export)
foreign import system "system:System.framework"
Bool :: b8
-2
View File
@@ -1,7 +1,5 @@
package darwin
foreign import system "system:System.framework"
// #define OS_WAIT_ON_ADDR_AVAILABILITY \
// __API_AVAILABLE(macos(14.4), ios(17.4), tvos(17.4), watchos(10.4))
when ODIN_OS == .Darwin {
+4 -10
View File
@@ -19,16 +19,6 @@ X_OK :: c.int((1 << 0)) /* test for execute or search permission */
W_OK :: c.int((1 << 1)) /* test for write permission */
R_OK :: c.int((1 << 2)) /* test for read permission */
/* copyfile flags */
COPYFILE_ACL :: (1 << 0)
COPYFILE_STAT :: (1 << 1)
COPYFILE_XATTR :: (1 << 2)
COPYFILE_DATA :: (1 << 3)
COPYFILE_SECURITY :: (COPYFILE_STAT | COPYFILE_ACL)
COPYFILE_METADATA :: (COPYFILE_SECURITY | COPYFILE_XATTR)
COPYFILE_ALL :: (COPYFILE_METADATA | COPYFILE_DATA)
/* syslimits.h */
PATH_MAX :: 1024 /* max bytes in pathname */
@@ -290,6 +280,10 @@ syscall_lseek :: #force_inline proc "contextless" (fd: c.int, offset: i64, whenc
return cast(i64)intrinsics.syscall(unix_offset_syscall(.lseek), uintptr(fd), uintptr(offset), uintptr(whence))
}
syscall_ioctl :: #force_inline proc "contextless" (fd: c.int, request: u32, arg: rawptr) -> c.int {
return (cast(c.int)intrinsics.syscall(unix_offset_syscall(.ioctl), uintptr(fd), uintptr(request), uintptr(arg)))
}
syscall_gettid :: #force_inline proc "contextless" () -> u64 {
return cast(u64)intrinsics.syscall(unix_offset_syscall(.gettid))
}
+890 -890
View File
File diff suppressed because it is too large Load Diff
+19 -6
View File
@@ -21,6 +21,7 @@ SYS_close : uintptr : 6
SYS_getpid : uintptr : 20
SYS_recvfrom : uintptr : 29
SYS_accept : uintptr : 30
SYS_getpeername: uintptr : 31
SYS_getsockname: uintptr : 32
SYS_fcntl : uintptr : 92
SYS_fsync : uintptr : 95
@@ -202,26 +203,38 @@ accept_nil :: proc "contextless" (s: Fd) -> (Fd, Errno) {
accept :: proc { accept_T, accept_nil }
// Get socket name.
//
// The getsockname() system call appeared in 4.2BSD.
getsockname :: proc "contextless" (s: Fd, sockaddr: ^$T) -> Errno {
getsockname_or_peername :: proc "contextless" (s: Fd, sockaddr: ^$T, is_peer: bool) -> Errno {
// sockaddr must contain a valid pointer, or this will segfault because
// we're telling the syscall that there's memory available to write to.
addrlen: socklen_t = size_of(T)
result, ok := intrinsics.syscall_bsd(SYS_getsockname,
result, ok := intrinsics.syscall_bsd(
is_peer ? SYS_getpeername : SYS_getsockname,
cast(uintptr)s,
cast(uintptr)sockaddr,
cast(uintptr)&addrlen)
if !ok {
return cast(Errno)result
return cast(Errno)result
}
return nil
}
// Get name of connected peer
//
// The getpeername() system call appeared in 4.2BSD.
getpeername :: proc "contextless" (s: Fd, sockaddr: ^$T) -> Errno {
return getsockname_or_peername(s, sockaddr, true)
}
// Get socket name.
//
// The getsockname() system call appeared in 4.2BSD.
getsockname :: proc "contextless" (s: Fd, sockaddr: ^$T) -> Errno {
return getsockname_or_peername(s, sockaddr, false)
}
// Synchronize changes to a file.
//
// The fsync() system call appeared in 4.2BSD.
+10 -6
View File
@@ -40,9 +40,13 @@ CPU_Feature :: enum u64 {
}
CPU_Features :: distinct bit_set[CPU_Feature; u64]
cpu_features: Maybe(CPU_Features)
cpu_name: Maybe(string)
CPU :: struct {
name: Maybe(string),
features: Maybe(CPU_Features),
physical_cores: int,
logical_cores: int,
}
cpu: CPU
@(private)
cpu_name_buf: [128]byte
@@ -53,7 +57,7 @@ init_cpu_name :: proc "contextless" () {
when ODIN_OS == .Darwin {
if unix.sysctlbyname("machdep.cpu.brand_string", &cpu_name_buf) {
cpu_name = string(cstring(rawptr(&cpu_name_buf)))
cpu.name = string(cstring(rawptr(&cpu_name_buf)))
generic = false
}
}
@@ -61,10 +65,10 @@ init_cpu_name :: proc "contextless" () {
if generic {
when ODIN_ARCH == .arm64 {
copy(cpu_name_buf[:], "ARM64")
cpu_name = string(cpu_name_buf[:len("ARM64")])
cpu.name = string(cpu_name_buf[:len("ARM64")])
} else {
copy(cpu_name_buf[:], "ARM")
cpu_name = string(cpu_name_buf[:len("ARM")])
cpu.name = string(cpu_name_buf[:len("ARM")])
}
}
}
+12
View File
@@ -0,0 +1,12 @@
package sysinfo
import "core:sys/unix"
@(init, private)
init_cpu_core_count :: proc "contextless" () {
physical, logical: i64
unix.sysctlbyname("hw.physicalcpu", &physical)
unix.sysctlbyname("hw.logicalcpu", &logical)
cpu.physical_cores = int(physical)
cpu.logical_cores = int(logical)
}
+1 -1
View File
@@ -5,7 +5,7 @@ import "core:sys/unix"
@(init, private)
init_cpu_features :: proc "contextless" () {
@(static) features: CPU_Features
defer cpu_features = features
defer cpu.features = features
try_set :: proc "contextless" (name: cstring, feature: CPU_Feature) -> (ok: bool) {
support: b32
+18 -12
View File
@@ -3,12 +3,6 @@ package sysinfo
import "base:intrinsics"
// cpuid :: proc(ax, cx: u32) -> (eax, ebc, ecx, edx: u32) ---
cpuid :: intrinsics.x86_cpuid
// xgetbv :: proc(cx: u32) -> (eax, edx: u32) ---
xgetbv :: intrinsics.x86_xgetbv
CPU_Feature :: enum u64 {
aes, // AES hardware implementation (AES NI)
adx, // Multi-precision add-carry instruction extensions
@@ -23,6 +17,7 @@ CPU_Feature :: enum u64 {
popcnt, // Hamming weight instruction POPCNT.
rdrand, // RDRAND instruction (on-chip random number generator)
rdseed, // RDSEED instruction (on-chip random number generator)
sha, // SHA Extensions (SHA-1, SHA-224, SHA-256)
sse2, // Streaming SIMD extension 2 (always available on amd64)
sse3, // Streaming SIMD extension 3
ssse3, // Supplemental streaming SIMD extension 3
@@ -48,9 +43,13 @@ CPU_Feature :: enum u64 {
}
CPU_Features :: distinct bit_set[CPU_Feature; u64]
cpu_features: Maybe(CPU_Features)
cpu_name: Maybe(string)
CPU :: struct {
name: Maybe(string),
features: Maybe(CPU_Features),
physical_cores: int, // Initialized by cpu_<os>.odin
logical_cores: int, // Initialized by cpu_<os>.odin
}
cpu: CPU
@(init, private)
init_cpu_features :: proc "c" () {
@@ -87,7 +86,7 @@ init_cpu_features :: proc "c" () {
when ODIN_OS == .FreeBSD || ODIN_OS == .OpenBSD || ODIN_OS == .NetBSD {
// xgetbv is an illegal instruction under FreeBSD 13, OpenBSD 7.1 and NetBSD 10
// return before probing further
cpu_features = set
cpu.features = set
return
}
@@ -115,6 +114,7 @@ init_cpu_features :: proc "c" () {
_, ebx7, ecx7, edx7 := cpuid(7, 0)
try_set(&set, .bmi1, 3, ebx7)
try_set(&set, .sha, 29, ebx7)
if os_supports_avx {
try_set(&set, .avx2, 5, ebx7)
}
@@ -149,7 +149,7 @@ init_cpu_features :: proc "c" () {
try_set(&set, .rdseed, 18, ebx7)
try_set(&set, .adx, 19, ebx7)
cpu_features = set
cpu.features = set
}
@(private)
@@ -177,5 +177,11 @@ init_cpu_name :: proc "c" () {
for len(brand) > 0 && brand[len(brand) - 1] == 0 || brand[len(brand) - 1] == ' ' {
brand = brand[:len(brand) - 1]
}
cpu_name = brand
cpu.name = brand
}
// cpuid :: proc(ax, cx: u32) -> (eax, ebc, ecx, edx: u32) ---
cpuid :: intrinsics.x86_cpuid
// xgetbv :: proc(cx: u32) -> (eax, edx: u32) ---
xgetbv :: intrinsics.x86_xgetbv
+1 -1
View File
@@ -17,7 +17,7 @@ init_cpu_features :: proc() {
if rerr != .NONE || n == 0 { return }
features: CPU_Features
defer cpu_features = features
defer cpu.features = features
str := string(buf[:n])
for line in strings.split_lines_iterator(&str) {
+38
View File
@@ -0,0 +1,38 @@
#+build i386, amd64
#+build linux
package sysinfo
import "core:sys/linux"
import "core:strings"
import "core:strconv"
@(init, private)
init_cpu_core_count :: proc() {
fd, err := linux.open("/proc/cpuinfo", {})
if err != .NONE { return }
defer linux.close(fd)
// This is probably enough right?
buf: [4096]byte
n, rerr := linux.read(fd, buf[:])
if rerr != .NONE || n == 0 { return }
str := string(buf[:n])
for line in strings.split_lines_iterator(&str) {
key, _, value := strings.partition(line, ":")
key = strings.trim_space(key)
value = strings.trim_space(value)
if key == "cpu cores" {
if num_physical_cores, ok := strconv.parse_int(value); ok {
cpu.physical_cores = num_physical_cores
}
}
if key == "siblings" {
if num_logical_cores, ok := strconv.parse_int(value); ok {
cpu.logical_cores = num_logical_cores
}
}
}
}
+2 -2
View File
@@ -9,7 +9,7 @@ import "core:sys/linux"
@(init, private)
init_cpu_features :: proc() {
_features: CPU_Features
defer cpu_features = _features
defer cpu.features = _features
HWCAP_Bits :: enum u64 {
I = 'I' - 'A',
@@ -109,5 +109,5 @@ init_cpu_features :: proc() {
@(init, private)
init_cpu_name :: proc() {
cpu_name = "RISCV64"
cpu.name = "RISCV64"
}
+7 -3
View File
@@ -95,6 +95,10 @@ CPU_Feature :: enum u64 {
}
CPU_Features :: distinct bit_set[CPU_Feature; u64]
cpu_features: Maybe(CPU_Features)
cpu_name: Maybe(string)
CPU :: struct {
name: Maybe(string),
features: Maybe(CPU_Features),
physical_cores: int,
logical_cores: int,
}
cpu: CPU
+28
View File
@@ -0,0 +1,28 @@
package sysinfo
import sys "core:sys/windows"
import "base:intrinsics"
@(init, private)
init_cpu_core_count :: proc() {
infos: []sys.SYSTEM_LOGICAL_PROCESSOR_INFORMATION
defer delete(infos)
returned_length: sys.DWORD
// Query for the required buffer size.
if ok := sys.GetLogicalProcessorInformation(raw_data(infos), &returned_length); !ok {
infos = make([]sys.SYSTEM_LOGICAL_PROCESSOR_INFORMATION, returned_length / size_of(sys.SYSTEM_LOGICAL_PROCESSOR_INFORMATION))
}
// If it still doesn't work, return
if ok := sys.GetLogicalProcessorInformation(raw_data(infos), &returned_length); !ok {
return
}
for info in infos {
#partial switch info.Relationship {
case .RelationProcessorCore: cpu.physical_cores += 1
case .RelationNumaNode: cpu.logical_cores += int(intrinsics.count_ones(info.ProcessorMask))
}
}
}
+8 -6
View File
@@ -26,13 +26,15 @@ Example:
import si "core:sys/info"
main :: proc() {
fmt.printfln("Odin: %v", ODIN_VERSION)
fmt.printfln("OS: %v", si.os_version.as_string)
fmt.printfln("OS: %#v", si.os_version)
fmt.printfln("CPU: %v", si.cpu_name)
fmt.printfln("RAM: %#.1M", si.ram.total_ram)
fmt.printfln("Odin: %v", ODIN_VERSION)
fmt.printfln("OS: %v", si.os_version.as_string)
fmt.printfln("OS: %#v", si.os_version)
fmt.printfln("CPU: %v", si.cpu.name)
fmt.printfln("CPU: %v", si.cpu.name)
fmt.printfln("CPU cores: %vc/%vt", si.cpu.physical_cores, si.cpu.logical_cores)
fmt.printfln("RAM: %#.1M", si.ram.total_ram)
// fmt.printfln("Features: %v", si.cpu_features)
// fmt.printfln("Features: %v", si.cpu.features)
// fmt.printfln("MacOS version: %v", si.macos_version)
fmt.println()
+1
View File
@@ -34,6 +34,7 @@ init_platform :: proc() {
} else {
os_version.platform = .MacOS
switch version.majorVersion {
case 26: ws(&b, "macOS Tahoe")
case 15: ws(&b, "macOS Sequoia")
case 14: ws(&b, "macOS Sonoma")
case 13: ws(&b, "macOS Ventura")
+13 -6
View File
@@ -16,9 +16,13 @@ init_os_version :: proc () {
b := strings.builder_from_bytes(version_string_buf[:])
// Try to parse `/etc/os-release` for `PRETTY_NAME="Ubuntu 20.04.3 LTS`
{
pretty_parse: {
fd, errno := linux.open("/etc/os-release", {})
assert(errno == .NONE, "Failed to read /etc/os-release")
if errno != .NONE {
strings.write_string(&b, "Unknown Linux Distro")
break pretty_parse
}
defer {
cerrno := linux.close(fd)
assert(cerrno == .NONE, "Failed to close the file descriptor")
@@ -26,7 +30,10 @@ init_os_version :: proc () {
os_release_buf: [2048]u8
n, read_errno := linux.read(fd, os_release_buf[:])
assert(read_errno == .NONE, "Failed to read data from /etc/os-release")
if read_errno != .NONE {
strings.write_string(&b, "Unknown Linux Distro")
break pretty_parse
}
release := string(os_release_buf[:n])
// Search the line in the file until we find "PRETTY_NAME="
@@ -59,7 +66,7 @@ init_os_version :: proc () {
os_version.as_string = strings.to_string(b)
// Parse the Linux version out of the release string
{
version_loop: {
version_num, _, version_suffix := strings.partition(release_str, "-")
os_version.version = version_suffix
@@ -72,11 +79,11 @@ init_os_version :: proc () {
case 0: dst = &os_version.major
case 1: dst = &os_version.minor
case 2: dst = &os_version.patch
case: break
case: break version_loop
}
num, ok := strconv.parse_int(part)
if !ok { break }
if !ok { break version_loop }
dst^ = num
}
+1 -1
View File
@@ -1,6 +1,6 @@
package sysinfo
when !(ODIN_ARCH == .amd64 || ODIN_ARCH == .i386 || ODIN_ARCH == .arm32 || ODIN_ARCH == .arm64 || ODIN_ARCH == .riscv64) {
when !(ODIN_ARCH == .amd64 || ODIN_ARCH == .i386 || ODIN_ARCH == .arm32 || ODIN_ARCH == .arm64 || ODIN_ARCH == .riscv64 || ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32) {
#assert(false, "This package is unsupported on this architecture.")
}
+25 -17
View File
@@ -1,5 +1,10 @@
package linux
import "base:intrinsics"
@(private)
log2 :: intrinsics.constant_log2
/*
Represents an error returned by most of syscalls
@@ -574,7 +579,7 @@ Inotify_Event_Bits :: enum u32 {
/*
Bits for Mem_Protection bitfield
*/
Mem_Protection_Bits :: enum{
Mem_Protection_Bits :: enum {
READ = 0,
WRITE = 1,
EXEC = 2,
@@ -589,11 +594,13 @@ Mem_Protection_Bits :: enum{
/*
Bits for Map_Flags
See `constants.odin` for `MAP_SHARED_VALIDATE` and `MAP_HUGE_16KB`, et al.
*/
Map_Flags_Bits :: enum {
SHARED = 0,
PRIVATE = 1,
SHARED_VALIDATE = 2,
DROPPABLE = 3,
FIXED = 4,
ANONYMOUS = 5,
// platform-dependent section start
@@ -1839,22 +1846,23 @@ EPoll_Flags_Bits :: enum {
}
EPoll_Event_Kind :: enum u32 {
IN = 0x001,
PRI = 0x002,
OUT = 0x004,
RDNORM = 0x040,
RDBAND = 0x080,
WRNORM = 0x100,
WRBAND = 0x200,
MSG = 0x400,
ERR = 0x008,
HUP = 0x010,
RDHUP = 0x2000,
EXCLUSIVE = 1<<28,
WAKEUP = 1<<29,
ONESHOT = 1<<30,
ET = 1<<31,
IN = log2(0x001),
PRI = log2(0x002),
OUT = log2(0x004),
RDNORM = log2(0x040),
RDBAND = log2(0x080),
WRNORM = log2(0x100),
WRBAND = log2(0x200),
MSG = log2(0x400),
ERR = log2(0x008),
HUP = log2(0x010),
RDHUP = log2(0x2000),
EXCLUSIVE = log2(1<<28),
WAKEUP = log2(1<<29),
ONESHOT = log2(1<<30),
ET = log2(1<<31),
}
EPoll_Event_Set :: bit_set[EPoll_Event_Kind; u32]
EPoll_Ctl_Opcode :: enum i32 {
ADD = 1,
+19
View File
@@ -374,5 +374,24 @@ PTRACE_SECCOMP_GET_METADATA :: PTrace_Seccomp_Get_Metadata_Type(.SECCOMP_GET_M
PTRACE_GET_SYSCALL_INFO :: PTrace_Get_Syscall_Info_Type(.GET_SYSCALL_INFO)
PTRACE_GET_RSEQ_CONFIGURATION :: PTrace_Get_RSeq_Configuration_Type(.GET_RSEQ_CONFIGURATION)
MAP_SHARED_VALIDATE :: Map_Flags{.SHARED, .PRIVATE}
MAP_HUGE_SHIFT :: 26
MAP_HUGE_MASK :: 63
MAP_HUGE_16KB :: transmute(Map_Flags)(u32(14) << MAP_HUGE_SHIFT)
MAP_HUGE_64KB :: transmute(Map_Flags)(u32(16) << MAP_HUGE_SHIFT)
MAP_HUGE_512KB :: transmute(Map_Flags)(u32(19) << MAP_HUGE_SHIFT)
MAP_HUGE_1MB :: transmute(Map_Flags)(u32(20) << MAP_HUGE_SHIFT)
MAP_HUGE_2MB :: transmute(Map_Flags)(u32(21) << MAP_HUGE_SHIFT)
MAP_HUGE_8MB :: transmute(Map_Flags)(u32(23) << MAP_HUGE_SHIFT)
MAP_HUGE_16MB :: transmute(Map_Flags)(u32(24) << MAP_HUGE_SHIFT)
MAP_HUGE_32MB :: transmute(Map_Flags)(u32(25) << MAP_HUGE_SHIFT)
MAP_HUGE_256MB :: transmute(Map_Flags)(u32(28) << MAP_HUGE_SHIFT)
MAP_HUGE_512MB :: transmute(Map_Flags)(u32(29) << MAP_HUGE_SHIFT)
MAP_HUGE_1GB :: transmute(Map_Flags)(u32(30) << MAP_HUGE_SHIFT)
MAP_HUGE_2GB :: transmute(Map_Flags)(u32(31) << MAP_HUGE_SHIFT)
MAP_HUGE_16GB :: transmute(Map_Flags)(u32(34) << MAP_HUGE_SHIFT)
/* Get window size */
TIOCGWINSZ :: 0x5413
+2 -1
View File
@@ -1,3 +1,4 @@
#+build linux
#+no-instrumentation
package linux
@@ -1412,7 +1413,7 @@ umask :: proc "contextless" (mask: Mode) -> Mode {
Available since Linux 1.0.
*/
gettimeofday :: proc "contextless" (tv: ^Time_Val) -> (Errno) {
ret := syscall(SYS_gettimeofday, tv)
ret := syscall(SYS_gettimeofday, tv, rawptr(nil))
return Errno(-ret)
}
+4 -2
View File
@@ -288,7 +288,7 @@ Rename_Flags :: bit_set[Rename_Flags_Bits; u32]
/*
Directory entry record.
Recommended iterate these with `dirent_iterator()`,
Recommended to iterate these with `dirent_iterate_buf()`,
and obtain the name via `dirent_name()`.
*/
Dirent :: struct {
@@ -368,6 +368,8 @@ Mem_Protection :: bit_set[Mem_Protection_Bits; i32]
/*
Flags for mmap.
See `constants.odin` for `MAP_SHARED_VALIDATE` and `MAP_HUGE_16KB`, et al.
*/
Map_Flags :: bit_set[Map_Flags_Bits; i32]
@@ -1450,7 +1452,7 @@ EPoll_Data :: struct #raw_union {
}
EPoll_Event :: struct #packed {
events: EPoll_Event_Kind,
events: EPoll_Event_Set,
data: EPoll_Data,
}
+51 -19
View File
@@ -54,22 +54,45 @@ WCOREDUMP :: #force_inline proc "contextless" (s: u32) -> bool {
// TODO: sigaddset etc
/// Iterate the results of getdents
/// Only iterates as much data as loaded in the buffer
/// In case you need to iterate *all* files in a directory
/// consider using dirent_get_iterate
///
/// Example of using dirent_iterate_buf
/// // Get dirents into a buffer
/// buf: [128]u8
/// sys.getdents(dirfd, buf[:])
/// // Print the names of the files
/// for dir in sys.dirent_iterate_buf(buf[:], &offs) {
/// name := sys.dirent_name(dir)
/// fmt.println(name)
/// }
/// This function doesn't automatically make a request
/// for the buffer to be refilled
/*
Iterate the results of `getdents()`.
This procedure extracts a directory entry from `buf` at the offset `offs`.
`offs` will be modified to store an offset to the possible next directory entry
in `buf`. The procedure only iterates as much data as loaded in the buffer and
does not automatically make a request for the buffer to be refilled.
Inputs:
- buf: A byte buffer with data from `getdents()`
- offs: An offset to the next possible directory entry in `buf`
Returns:
- A pointer to a directory entry in `buf`, or `nil`
- A bool value denoting if a valid directory entry is returned
Example:
import "core:fmt"
import "core:sys/linux"
print_names :: proc(dirfd: linux.Fd) {
// Get dirents into a buffer.
buf: [128]u8
// Loop until there are no more entries.
for {
written, err := linux.getdents(dirfd, buf[:])
if err != .NONE || written == 0 {
break
}
// Print the names of the files.
offset : int
for dir in linux.dirent_iterate_buf(buf[:written], &offset) {
name := linux.dirent_name(dir)
fmt.println(name)
}
}
}
*/
dirent_iterate_buf :: proc "contextless" (buf: []u8, offs: ^int) -> (d: ^Dirent, cont: bool) {
// Stopped iterating when there's no space left
if offs^ >= len(buf) {
@@ -82,8 +105,17 @@ dirent_iterate_buf :: proc "contextless" (buf: []u8, offs: ^int) -> (d: ^Dirent,
return dirent, true
}
/// Obtain the name of dirent as a string
/// The lifetime of the string is bound to the lifetime of the provided dirent structure
/*
Obtain the name of dirent as a string.
The lifetime of the returned string is bound to the lifetime of the provided dirent structure.
Inputs:
- dirent: A directory entry
Returns:
- A name of the entry
*/
dirent_name :: proc "contextless" (dirent: ^Dirent) -> string #no_bounds_check {
str := ([^]u8)(&dirent.name)
// Dirents are aligned to 8 bytes, so there is guaranteed to be a null
@@ -93,10 +125,10 @@ dirent_name :: proc "contextless" (dirent: ^Dirent) -> string #no_bounds_check {
trunc := min(str_size, 8)
str_size -= trunc
for _ in 0..<trunc {
str_size += 1
if str[str_size] == 0 {
break
}
str_size += 1
}
return string(str[:str_size])
}
+4 -1
View File
@@ -8,7 +8,10 @@ when ODIN_OS == .Darwin {
} else when ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD {
foreign import lib "system:dl"
} else {
foreign import lib "system:c"
foreign import lib {
"system:c",
"system:dl",
}
}
// dlfcn.h - dynamic linking
+1 -1
View File
@@ -31,7 +31,7 @@ Unimplemented headers:
- iso646.h | Impossible
- math.h | See `core:c/libc`
- mqueue.h | Targets don't seem to have implemented it
- regex.h | See `core:regex`
- regex.h | See `core:text/regex`
- search.h | Not useful in Odin
- spawn.h | Use `fork`, `execve`, etc.
- stdarg.h | See `core:c/libc`
+11 -6
View File
@@ -50,7 +50,7 @@ foreign lib {
/*
Send a signal to a thread.
As with kill, if sig is 0, only validation (of the pthread_t given) is done and no signal is sent.
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_kill.html ]]
@@ -124,7 +124,7 @@ foreign lib {
sigignore :: proc(sig: Signal) -> result ---
/*
Removes sig from the signal mask of the calling process and suspend the calling process until
Removes sig from the signal mask of the calling process and suspend the calling process until
a signal is received.
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/sighold.html ]]
@@ -166,7 +166,7 @@ foreign lib {
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigpending.html ]]
*/
@(link_name=LSIGPENDING)
sigpending :: proc(set: ^sigset_t) -> result ---
sigpending :: proc(set: ^sigset_t) -> result ---
/*
Wait for one of the given signals.
@@ -333,7 +333,7 @@ SS_Flag_Bits :: enum c.int {
SS_Flags :: bit_set[SS_Flag_Bits; c.int]
Sig :: enum c.int {
// Resulting set is the union of the current set and the signal set and the complement of
// Resulting set is the union of the current set and the signal set and the complement of
// the signal set pointed to by the argument.
BLOCK = SIG_BLOCK,
// Resulting set is the intersection of the current set and the complement of the signal set
@@ -395,6 +395,7 @@ when ODIN_OS == .Darwin {
SIGXFSZ :: 25
SIGVTALRM :: 26
SIGPROF :: 27
SIGWINCH :: 28
SIGUSR1 :: 30
SIGUSR2 :: 31
@@ -535,6 +536,7 @@ when ODIN_OS == .Darwin {
SIGXFSZ :: 25
SIGVTALRM :: 26
SIGPROF :: 27
SIGWINCH :: 28
SIGUSR1 :: 30
SIGUSR2 :: 31
@@ -565,7 +567,7 @@ when ODIN_OS == .Darwin {
SS_ONSTACK :: 0x0001
SS_DISABLE :: 0x0004
when ODIN_ARCH == .amd64 || ODIN_ARCH == .arm32 {
when ODIN_ARCH == .arm64 || ODIN_ARCH == .arm32 {
MINSIGSTKSZ :: 1024 * 4
} else when ODIN_ARCH == .amd64 || ODIN_ARCH == .i386 {
MINSIGSTKSZ :: 512 * 4
@@ -699,6 +701,7 @@ when ODIN_OS == .Darwin {
SIGXFSZ :: 25
SIGVTALRM :: 26
SIGPROF :: 27
SIGWINCH :: 28
SIGUSR1 :: 30
SIGUSR2 :: 31
@@ -876,6 +879,7 @@ when ODIN_OS == .Darwin {
SIGXFSZ :: 25
SIGVTALRM :: 26
SIGPROF :: 27
SIGWINCH :: 28
SIGUSR1 :: 30
SIGUSR2 :: 31
@@ -1036,6 +1040,7 @@ when ODIN_OS == .Darwin {
SIGXFSZ :: 25
SIGVTALRM :: 26
SIGPROF :: 27
SIGWINCH :: 28
SIGPOLL :: 29
SIGSYS :: 31
@@ -1084,7 +1089,7 @@ when ODIN_OS == .Darwin {
@(private)
__SI_MAX_SIZE :: 128
when size_of(int) == 8 {
when size_of(int) == 8 {
@(private)
_pad0 :: struct {
_pad0: c.int,
+50 -14
View File
@@ -189,7 +189,7 @@ Key_Location :: enum u8 {
KEYBOARD_MAX_KEY_SIZE :: 32
KEYBOARD_MAX_CODE_SIZE :: 32
GAMEPAD_MAX_ID_SIZE :: 64
GAMEPAD_MAX_ID_SIZE :: 96
GAMEPAD_MAX_MAPPING_SIZE :: 64
GAMEPAD_MAX_BUTTONS :: 64
@@ -239,6 +239,12 @@ Gamepad_State :: struct {
_mapping_buf: [GAMEPAD_MAX_MAPPING_SIZE]byte `fmt:"-"`,
}
Pointer_Type :: enum u8 {
Mouse,
Pen,
Touch,
}
Event :: struct {
kind: Event_Kind,
target_kind: Event_Target_Kind,
@@ -275,6 +281,8 @@ Event :: struct {
repeat: bool,
char: rune,
_key_len: int `fmt:"-"`,
_code_len: int `fmt:"-"`,
_key_buf: [KEYBOARD_MAX_KEY_SIZE]byte `fmt:"-"`,
@@ -295,6 +303,21 @@ Event :: struct {
button: i16,
buttons: bit_set[0..<16; u16],
pointer: struct {
altitude_angle: f64,
azimuth_angle: f64,
persistent_device_id: int,
pointer_id: int,
width: int,
height: int,
pressure: f64,
tangential_pressure: f64,
tilt: [2]f64,
twist: f64,
pointer_type: Pointer_Type,
is_primary: bool,
},
},
gamepad: Gamepad_State,
@@ -323,13 +346,13 @@ add_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, call
return _add_event_listener(id, event_kind_string[kind], kind, user_data, callback, use_capture)
}
remove_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event)) -> bool {
remove_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
@(default_calling_convention="contextless")
foreign dom_lib {
@(link_name="remove_event_listener")
_remove_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc "odin" (Event)) -> bool ---
_remove_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc "odin" (Event), use_capture: bool) -> bool ---
}
return _remove_event_listener(id, event_kind_string[kind], user_data, callback)
return _remove_event_listener(id, event_kind_string[kind], user_data, callback, use_capture)
}
add_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
@@ -341,20 +364,26 @@ add_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback:
return _add_window_event_listener(event_kind_string[kind], kind, user_data, callback, use_capture)
}
remove_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event)) -> bool {
remove_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
@(default_calling_convention="contextless")
foreign dom_lib {
@(link_name="remove_window_event_listener")
_remove_window_event_listener :: proc(name: string, user_data: rawptr, callback: proc "odin" (Event)) -> bool ---
_remove_window_event_listener :: proc(name: string, user_data: rawptr, callback: proc "odin" (Event), use_capture: bool) -> bool ---
}
return _remove_window_event_listener(event_kind_string[kind], user_data, callback)
return _remove_window_event_listener(event_kind_string[kind], user_data, callback, use_capture)
}
remove_event_listener_from_event :: proc(e: Event) -> bool {
from_use_capture_false: bool
from_use_capture_true: bool
if e.id == "" {
return remove_window_event_listener(e.kind, e.user_data, e.callback)
from_use_capture_false = remove_window_event_listener(e.kind, e.user_data, e.callback, false)
from_use_capture_true = remove_window_event_listener(e.kind, e.user_data, e.callback, true)
} else {
from_use_capture_false = remove_event_listener(e.id, e.kind, e.user_data, e.callback, false)
from_use_capture_true = remove_event_listener(e.id, e.kind, e.user_data, e.callback, true)
}
return remove_event_listener(e.id, e.kind, e.user_data, e.callback)
return from_use_capture_false || from_use_capture_true
}
add_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
@@ -365,13 +394,13 @@ add_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, c
}
return _add_event_listener(id, name, .Custom, user_data, callback, use_capture)
}
remove_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event)) -> bool {
remove_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
@(default_calling_convention="contextless")
foreign dom_lib {
@(link_name="remove_event_listener")
_remove_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc "odin" (Event)) -> bool ---
_remove_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc "odin" (Event), use_capture: bool) -> bool ---
}
return _remove_event_listener(id, name, user_data, callback)
return _remove_event_listener(id, name, user_data, callback, use_capture)
}
get_gamepad_state :: proc "contextless" (index: int, s: ^Gamepad_State) -> bool {
@@ -384,7 +413,14 @@ get_gamepad_state :: proc "contextless" (index: int, s: ^Gamepad_State) -> bool
if s == nil {
return false
}
return _get_gamepad_state(index, s)
if !_get_gamepad_state(index, s) {
return false
}
s.id = string(s._id_buf[:s._id_len])
s.mapping = string(s._mapping_buf[:s._mapping_len])
return true
}
@@ -415,4 +451,4 @@ do_event_callback :: proc(user_data: rawptr, callback: proc(e: Event)) {
callback(event)
}
}
}
+4 -4
View File
@@ -263,7 +263,7 @@ add_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, call
panic("vendor:wasm/js not supported on non JS targets")
}
remove_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event)) -> bool {
remove_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
panic("vendor:wasm/js not supported on non JS targets")
}
@@ -271,7 +271,7 @@ add_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback:
panic("vendor:wasm/js not supported on non JS targets")
}
remove_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event)) -> bool {
remove_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
panic("vendor:wasm/js not supported on non JS targets")
}
@@ -282,6 +282,6 @@ remove_event_listener_from_event :: proc(e: Event) -> bool {
add_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
panic("vendor:wasm/js not supported on non JS targets")
}
remove_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event)) -> bool {
remove_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
panic("vendor:wasm/js not supported on non JS targets")
}
}
+2 -1
View File
@@ -9,4 +9,5 @@ foreign odin_env {
abort :: proc() -> ! ---
alert :: proc(msg: string) ---
evaluate :: proc(str: string) ---
}
open :: proc(url: string, name := "", specs := "") ---
}
+119 -34
View File
@@ -17,7 +17,7 @@ class WasmMemoryInterface {
constructor() {
this.memory = null;
this.exports = null;
this.listenerMap = {};
this.listenerMap = new Map();
// Size (in bytes) of the integer type, should be 4 on `js_wasm32` and 8 on `js_wasm64p32`
this.intSize = 4;
@@ -110,16 +110,12 @@ class WasmMemoryInterface {
}
loadCstring(ptr) {
return this.loadCstringDirect(this.loadPtr(ptr));
}
loadCstringDirect(start) {
if (start == 0) {
if (ptr == 0) {
return null;
}
let len = 0;
for (; this.mem.getUint8(start+len) != 0; len += 1) {}
return this.loadString(start, len);
for (; this.mem.getUint8(ptr+len) != 0; len += 1) {}
return this.loadString(ptr, len);
}
storeU8(addr, value) { this.mem.setUint8 (addr, value); }
@@ -402,6 +398,9 @@ class WebGLInterface {
BlendEquation: (mode) => {
this.ctx.blendEquation(mode);
},
BlendEquationSeparate: (modeRGB, modeAlpha) => {
this.ctx.blendEquationSeparate(modeRGB, modeAlpha);
},
BlendFunc: (sfactor, dfactor) => {
this.ctx.blendFunc(sfactor, dfactor);
},
@@ -633,6 +632,13 @@ class WebGLInterface {
GetParameter: (pname) => {
return this.ctx.getParameter(pname);
},
GetParameter4i: (pname, v0, v1, v2, v3) => {
const i4 = this.ctx.getParameter(pname);
this.mem.storeI32(v0, i4[0]);
this.mem.storeI32(v1, i4[1]);
this.mem.storeI32(v2, i4[2]);
this.mem.storeI32(v3, i4[3]);
},
GetProgramParameter: (program, pname) => {
return this.ctx.getProgramParameter(this.programs[program], pname)
},
@@ -1315,18 +1321,20 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
} else if (!line.includes("\n")) {
currentLine[isError] = currentLine[isError].concat(line);
} else {
let lines = line.split("\n");
let lines = line.trimEnd().split("\n");
let printLast = lines.length > 1 && line.endsWith("\n");
println(currentLine[isError].concat(lines[0]));
currentLine[isError] = "";
for (let i = 1; i < lines.length-1; i++) {
println(lines[i]);
}
let last = lines[lines.length-1];
if (printLast) {
println(last);
} else {
currentLine[isError] = last;
if (lines.length > 1) {
let last = lines[lines.length-1];
if (printLast) {
println(last);
} else {
currentLine[isError] = last;
}
}
}
@@ -1393,6 +1401,10 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
info.scrollTop = info.scrollHeight;
};
const listener_key = (id, name, data, callback, useCapture) => {
return `${id}-${name}-data:${data}-callback:${callback}-useCapture:${useCapture}`;
};
let webglContext = new WebGLInterface(wasmMemoryInterface);
const env = {};
@@ -1421,6 +1433,13 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
abort: () => { Module.abort() },
evaluate: (str_ptr, str_len) => { eval.call(null, wasmMemoryInterface.loadString(str_ptr, str_len)); },
open: (url_ptr, url_len, name_ptr, name_len, specs_ptr, specs_len) => {
const url = wasmMemoryInterface.loadString(url_ptr, url_len);
const name = wasmMemoryInterface.loadString(name_ptr, name_len);
const specs = wasmMemoryInterface.loadString(specs_ptr, specs_len);
window.open(url, name, specs);
},
// return a bigint to be converted to i64
time_now: () => BigInt(Date.now()),
tick_now: () => performance.now(),
@@ -1533,6 +1552,29 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
wmi.storeI16(off(2), e.button);
wmi.storeU16(off(2), e.buttons);
if (e instanceof PointerEvent) {
wmi.storeF64(off(8), e.altitudeAngle);
wmi.storeF64(off(8), e.azimuthAngle);
wmi.storeInt(off(W), e.persistentDeviceId);
wmi.storeInt(off(W), e.pointerId);
wmi.storeInt(off(W), e.width);
wmi.storeInt(off(W), e.height);
wmi.storeF64(off(8), e.pressure);
wmi.storeF64(off(8), e.tangentialPressure);
wmi.storeF64(off(8), e.tiltX);
wmi.storeF64(off(8), e.tiltY);
wmi.storeF64(off(8), e.twist);
if (e.pointerType == "pen") {
wmi.storeU8(off(1), 1);
} else if (e.pointerType == "touch") {
wmi.storeU8(off(1), 2);
} else {
wmi.storeU8(off(1), 0);
}
wmi.storeU8(off(1), !!e.isPrimary);
}
} else if (e instanceof KeyboardEvent) {
// Note: those strings are constructed
// on the native side from buffers that
@@ -1549,6 +1591,8 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
wmi.storeU8(off(1), !!e.repeat);
wmi.storeI32(off(4), e.charCode);
wmi.storeInt(off(W, W), e.key.length)
wmi.storeInt(off(W, W), e.code.length)
wmi.storeString(off(32, 1), e.key);
@@ -1588,10 +1632,24 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
}
}
wmi.storeInt(off(W, W), e.gamepad.id.length)
wmi.storeInt(off(W, W), e.gamepad.mapping.length)
wmi.storeString(off(64, 1), e.gamepad.id);
wmi.storeString(off(64, 1), e.gamepad.mapping);
let idLength = e.gamepad.id.length;
let id = e.gamepad.id;
if (idLength > 96) {
idLength = 96;
id = id.slice(0, 93) + '...';
}
let mappingLength = e.gamepad.mapping.length;
let mapping = e.gamepad.mapping;
if (mappingLength > 64) {
mappingLength = 61;
mapping = mapping.slice(0, 61) + '...';
}
wmi.storeInt(off(W, W), idLength);
wmi.storeInt(off(W, W), mappingLength);
wmi.storeString(off(96, 1), id);
wmi.storeString(off(64, 1), mapping);
}
},
@@ -1602,6 +1660,10 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
if (element == undefined) {
return false;
}
let key = listener_key(id, name, data, callback, !!use_capture);
if (wasmMemoryInterface.listenerMap.has(key)) {
return false;
}
let listener = (e) => {
let event_data = {};
@@ -1612,7 +1674,7 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
onEventReceived(event_data, data, callback);
};
wasmMemoryInterface.listenerMap[{data: data, callback: callback}] = listener;
wasmMemoryInterface.listenerMap.set(key, listener);
element.addEventListener(name, listener, !!use_capture);
return true;
},
@@ -1620,6 +1682,11 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
add_window_event_listener: (name_ptr, name_len, name_code, data, callback, use_capture) => {
let name = wasmMemoryInterface.loadString(name_ptr, name_len);
let element = window;
let key = listener_key('window', name, data, callback, !!use_capture);
if (wasmMemoryInterface.listenerMap.has(key)) {
return false;
}
let listener = (e) => {
let event_data = {};
event_data.id_ptr = 0;
@@ -1629,12 +1696,12 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
onEventReceived(event_data, data, callback);
};
wasmMemoryInterface.listenerMap[{data: data, callback: callback}] = listener;
wasmMemoryInterface.listenerMap.set(key, listener);
element.addEventListener(name, listener, !!use_capture);
return true;
},
remove_event_listener: (id_ptr, id_len, name_ptr, name_len, data, callback) => {
remove_event_listener: (id_ptr, id_len, name_ptr, name_len, data, callback, use_capture) => {
let id = wasmMemoryInterface.loadString(id_ptr, id_len);
let name = wasmMemoryInterface.loadString(name_ptr, name_len);
let element = getElement(id);
@@ -1642,24 +1709,28 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
return false;
}
let listener = wasmMemoryInterface.listenerMap[{data: data, callback: callback}];
if (listener == undefined) {
let key = listener_key(id, name, data, callback, !!use_capture);
let listener = wasmMemoryInterface.listenerMap.get(key);
if (listener === undefined) {
return false;
}
element.removeEventListener(name, listener);
wasmMemoryInterface.listenerMap.delete(key);
element.removeEventListener(name, listener, !!use_capture);
return true;
},
remove_window_event_listener: (name_ptr, name_len, data, callback) => {
remove_window_event_listener: (name_ptr, name_len, data, callback, use_capture) => {
let name = wasmMemoryInterface.loadString(name_ptr, name_len);
let element = window;
let key = {data: data, callback: callback};
let listener = wasmMemoryInterface.listenerMap[key];
if (!listener) {
let key = listener_key('window', name, data, callback, !!use_capture);
let listener = wasmMemoryInterface.listenerMap.get(key);
if (listener === undefined) {
return false;
}
wasmMemoryInterface.listenerMap[key] = undefined;
wasmMemoryInterface.listenerMap.delete(key);
element.removeEventListener(name, listener);
element.removeEventListener(name, listener, !!use_capture);
return true;
},
@@ -1756,10 +1827,24 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
}
}
wmi.storeInt(off(W, W), gamepad.id.length)
wmi.storeInt(off(W, W), gamepad.mapping.length)
wmi.storeString(off(64, 1), gamepad.id);
wmi.storeString(off(64, 1), gamepad.mapping);
let idLength = gamepad.id.length;
let id = gamepad.id;
if (idLength > 96) {
idLength = 96;
id = id.slice(0, 93) + '...';
}
let mappingLength = gamepad.mapping.length;
let mapping = gamepad.mapping;
if (mappingLength > 64) {
mappingLength = 61;
mapping = mapping.slice(0, 61) + '...';
}
wmi.storeInt(off(W, W), idLength);
wmi.storeInt(off(W, W), mappingLength);
wmi.storeString(off(96, 1), id);
wmi.storeString(off(64, 1), mapping);
return true;
}
+1 -1
View File
@@ -22,7 +22,7 @@ foreign gdi32 {
CreateDIBPatternBrush :: proc(h: HGLOBAL, iUsage: UINT) -> HBRUSH ---
CreateDIBitmap :: proc(hdc: HDC, pbmih: ^BITMAPINFOHEADER, flInit: DWORD, pjBits: VOID, pbmi: ^BITMAPINFO, iUsage: UINT) -> HBITMAP ---
CreateDIBSection :: proc(hdc: HDC, pbmi: ^BITMAPINFO, usage: UINT, ppvBits: VOID, hSection: HANDLE, offset: DWORD) -> HBITMAP ---
CreateDIBSection :: proc(hdc: HDC, pbmi: ^BITMAPINFO, usage: UINT, ppvBits: ^^VOID, hSection: HANDLE, offset: DWORD) -> HBITMAP ---
StretchDIBits :: proc(hdc: HDC, xDest, yDest, DestWidth, DestHeight, xSrc, ySrc, SrcWidth, SrcHeight: INT, lpBits: VOID, lpbmi: ^BITMAPINFO, iUsage: UINT, rop: DWORD) -> INT ---
StretchBlt :: proc(hdcDest: HDC, xDest, yDest, wDest, hDest: INT, hdcSrc: HDC, xSrc, ySrc, wSrc, hSrc: INT, rop: DWORD) -> BOOL ---
+8 -2
View File
@@ -168,6 +168,7 @@ foreign kernel32 {
ResumeThread :: proc(thread: HANDLE) -> DWORD ---
GetThreadPriority :: proc(thread: HANDLE) -> c_int ---
SetThreadPriority :: proc(thread: HANDLE, priority: c_int) -> BOOL ---
GetThreadDescription :: proc(hThread: HANDLE, ppszThreadDescription: ^PCWSTR) -> HRESULT ---
SetThreadDescription :: proc(hThread: HANDLE, lpThreadDescription: PCWSTR) -> HRESULT ---
GetExitCodeThread :: proc(thread: HANDLE, exit_code: ^DWORD) -> BOOL ---
TerminateThread :: proc(thread: HANDLE, exit_code: DWORD) -> BOOL ---
@@ -372,6 +373,12 @@ foreign kernel32 {
bInitialState: BOOL,
lpName: LPCWSTR,
) -> HANDLE ---
CreateEventExW :: proc(
lpEventAttributes: LPSECURITY_ATTRIBUTES,
lpName: LPCWSTR,
dwFlags: DWORD,
dwDesiredAccess: DWORD,
) -> HANDLE ---
ResetEvent :: proc(hEvent: HANDLE) -> BOOL ---
SetEvent :: proc(hEvent: HANDLE) -> BOOL ---
WaitForMultipleObjects :: proc(
@@ -857,7 +864,6 @@ MEMORY_RESOURCE_NOTIFICATION_TYPE :: enum c_int {
LowMemoryResourceNotification :: MEMORY_RESOURCE_NOTIFICATION_TYPE.LowMemoryResourceNotification
HighMemoryResourceNotification :: MEMORY_RESOURCE_NOTIFICATION_TYPE.HighMemoryResourceNotification
@(default_calling_convention="system")
foreign kernel32 {
CreateMemoryResourceNotification :: proc(
@@ -1194,7 +1200,7 @@ DUMMYUNIONNAME_u :: struct #raw_union {
SYSTEM_LOGICAL_PROCESSOR_INFORMATION :: struct {
ProcessorMask: ULONG_PTR,
Relationship: LOGICAL_PROCESSOR_RELATIONSHIP,
DummyUnion: DUMMYUNIONNAME_u,
using DummyUnion: DUMMYUNIONNAME_u,
}
SYSTEM_POWER_STATUS :: struct {
+2
View File
@@ -52,6 +52,8 @@ foreign Ole32 {
ppv: ^LPVOID,
) -> HRESULT ---
CoTaskMemAlloc :: proc(cb: SIZE_T) -> rawptr ---
CoTaskMemRealloc :: proc(pv: rawptr, cb: SIZE_T) -> rawptr ---
CoTaskMemFree :: proc(pv: rawptr) ---
CLSIDFromProgID :: proc(lpszProgID: LPCOLESTR, lpclsid: LPCLSID) -> HRESULT ---
+172
View File
@@ -0,0 +1,172 @@
#+build windows
package sys_windows
// Win32 scan codes for QWERTY layout
// https://learn.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input#scan-codes
KB_SYS_POWERDOWN :: 0xE05E
KB_SYS_SLEEP :: 0xE05F
KB_SYS_WAKEUP :: 0xE063
KB_ERR_ROLLOVER :: 0x00FF
KB_A :: 0x001E
KB_B :: 0x0030
KB_C :: 0x002E
KB_D :: 0x0020
KB_E :: 0x0012
KB_F :: 0x0021
KB_G :: 0x0022
KB_H :: 0x0023
KB_I :: 0x0017
KB_J :: 0x0024
KB_K :: 0x0025
KB_L :: 0x0026
KB_M :: 0x0032
KB_N :: 0x0031
KB_O :: 0x0018
KB_P :: 0x0019
KB_Q :: 0x0010
KB_R :: 0x0013
KB_S :: 0x001F
KB_T :: 0x0014
KB_U :: 0x0016
KB_V :: 0x002F
KB_W :: 0x0011
KB_X :: 0x002D
KB_Y :: 0x0015
KB_Z :: 0x002C
KB_1_BANG :: 0x0002
KB_2_AT :: 0x0003
KB_3_HASH :: 0x0004
KB_4_DOLLAR :: 0x0005
KB_5_PERCENT :: 0x0006
KB_6_CARET :: 0x0007
KB_7_AMPERSAND :: 0x0008
KB_8_STAR :: 0x0009
KB_9_LEFTBRACKET :: 0x000A
KB_0_RIGHTBRACKET :: 0x000B
KB_RETURN_ENTER :: 0x001C
KB_ESCAPE :: 0x0001
KB_DELETE :: 0x000E
KB_TAB :: 0x000F
KB_SPACEBAR :: 0x0039
KB_DASH_UNDERSCORE :: 0x000C
KB_EQUALS_PLUS :: 0x000D
KB_LEFTBRACE :: 0x001A
KB_RIGHTBRACE :: 0x001B
KB_PIPE_SLASH :: 0x002B
KB_NONUS :: 0x002B
KB_SEMICOLON_COLON :: 0x0027
KB_APOSTR_DOUBLEQUOT :: 0x0028
KB_GRAVEACC_TILDE :: 0x0029
KB_COMMA :: 0x0033
KB_PERIOD :: 0x0034
KB_QUESTIONMARK :: 0x0035
KB_CAPSLOCK :: 0x003A
KB_F1 :: 0x003B
KB_F2 :: 0x003C
KB_F3 :: 0x003D
KB_F4 :: 0x003E
KB_F5 :: 0x003F
KB_F6 :: 0x0040
KB_F7 :: 0x0041
KB_F8 :: 0x0042
KB_F9 :: 0x0043
KB_F10 :: 0x0044
KB_F11 :: 0x0057
KB_F12 :: 0x0058
KB_PRINTSCREEN :: 0xE037
KB_SCROLLLOCK :: 0x0046
KB_PAUSE :: 0xE11D45
KB_INSERT :: 0xE052
KB_HOME :: 0xE047
KB_PAGEUP :: 0xE049
KB_DELETEFORWARD :: 0xE053
KB_END :: 0xE04F
KB_PAGEDOWN :: 0xE051
KB_RIGHTARROW :: 0xE04D
KB_LEFTARROW :: 0xE04B
KB_DOWNARROW :: 0xE050
KB_UPARROW :: 0xE048
KP_NUMLOCK_CLEAR :: 0x0045
KP_FORWARDSLASH :: 0xE035
KP_STAR :: 0x0037
KP_DASH :: 0x004A
KP_PLUS :: 0x004E
KP_ENTER :: 0xE01C
KP_1_END :: 0x004F
KP_2_DOWNARROW :: 0x0050
KP_3_PAGEDN :: 0x0051
KP_4_LEFTARROW :: 0x004B
KP_5 :: 0x004C
KP_6_RIGHTARROW :: 0x004D
KP_7_HOME :: 0x0047
KP_8_UPARROW :: 0x0048
KP_9_PAGEUP :: 0x0049
KP_0_INSERT :: 0x0052
KP_PERIOD :: 0x0053
KB_NONUS_SLASHBAR :: 0x0056
KB_APPLICATION :: 0xE05D
KB_POWER :: 0xE05E
KB_EQUALS :: 0x0059
KB_F13 :: 0x0064
KB_F14 :: 0x0065
KB_F15 :: 0x0066
KB_F16 :: 0x0067
KB_F17 :: 0x0068
KB_F18 :: 0x0069
KB_F19 :: 0x006A
KB_F20 :: 0x006B
KB_F21 :: 0x006C
KB_F22 :: 0x006D
KB_F23 :: 0x006E
KB_F24 :: 0x0076
KP_COMMA :: 0x007E
KB_INTERNATIONAL1 :: 0x0073
KB_INTERNATIONAL2 :: 0x0070
KB_INTERNATIONAL3 :: 0x007D
KB_INTERNATIONAL4 :: 0x0079
KB_INTERNATIONAL5 :: 0x007B
KB_INTERNATIONAL6 :: 0x005C
KB_LANG1 :: 0x0072
KB_LANG2 :: 0x0071
KB_LANG3 :: 0x0078
KB_LANG4 :: 0x0077
KB_LANG5 :: 0x0076
KB_LEFTCONTROL :: 0x001D
KB_LEFTSHIFT :: 0x002A
KB_LEFTALT :: 0x0038
KB_LEFTGUI :: 0xE05B
KB_RIGHTCONTROL :: 0xE01D
KB_RIGHTSHIFT :: 0x0036
KB_RIGHTALT :: 0xE038
KB_RIGHTGUI :: 0xE05C
FN_SCANNEXTTRACK :: 0xE019
FN_SCANPREVTRACK :: 0xE010
FN_STOP :: 0xE024
FN_PLAY_PAUSE :: 0xE022
FN_MUTE :: 0xE020
FN_VOLUMEINC :: 0xE030
FN_VOLUMEDEC :: 0xE02E
FN_AL_CONSUMERCTRLCONFIG :: 0xE06D
FN_AL_EMAILREADER :: 0xE06C
FN_AL_CALCULATOR :: 0xE021
FN_AL_LOCALMACHINEBROWSER :: 0xE06B
FN_AC_SEARCH :: 0xE065
FN_AC_HOME :: 0xE032
FN_AC_BACK :: 0xE06A
FN_AC_FORWARD :: 0xE069
FN_AC_STOP :: 0xE068
FN_AC_REFRESH :: 0xE067
FN_AC_BOOKMARKS :: 0xE066
+6
View File
@@ -4845,6 +4845,12 @@ SOMAXCONN :: 128 // The number of messages that can be queued in memory after
SOCKET_ERROR :: -1
// Networking errors
WSA_INVALID_HANDLE :: 6 // Specified event object handle is invalid.
WSA_NOT_ENOUGH_MEMORY :: 8 // Insufficient memory available.
WSA_INVALID_PARAMETER :: 87 // One or more parameters are invalid.
WSA_OPERATION_ABORTED :: 995 // Overlapped operation aborted.
WSA_IO_INCOMPLETE :: 996 // Overlapped I/O event object not in signaled state.
WSA_IO_PENDING :: 997 // Overlapped operations will complete later.
WSAEINTR :: 10004 // Call interrupted. CancelBlockingCall was called. (This is different on Linux.)
WSAEACCES :: 10013 // If you try to bind a Udp socket to the broadcast address without the socket option set.
WSAEFAULT :: 10014 // A pointer that was passed to a WSA function is invalid, such as a buffer size is smaller than you said it was
+2
View File
@@ -47,6 +47,8 @@ foreign user32 {
lpParam: LPVOID,
) -> HWND ---
GetWindowThreadProcessId :: proc(hwnd: HWND, lpdwProcessId: LPDWORD) -> DWORD ---
DestroyWindow :: proc(hWnd: HWND) -> BOOL ---
ShowWindow :: proc(hWnd: HWND, nCmdShow: INT) -> BOOL ---
+68 -12
View File
@@ -75,15 +75,7 @@ LANGIDFROMLCID :: #force_inline proc "contextless" (lcid: LCID) -> LANGID {
return LANGID(lcid)
}
// this one gave me trouble as it do not mask the values.
// the _ in the name is also off comparing to the c code
// i can't find any usage in the odin repo
@(deprecated = "use MAKEWORD")
MAKE_WORD :: #force_inline proc "contextless" (x, y: WORD) -> WORD {
return x << 8 | y
}
utf8_to_utf16 :: proc(s: string, allocator := context.temp_allocator) -> []u16 {
utf8_to_utf16_alloc :: proc(s: string, allocator := context.temp_allocator) -> []u16 {
if len(s) < 1 {
return nil
}
@@ -109,14 +101,42 @@ utf8_to_utf16 :: proc(s: string, allocator := context.temp_allocator) -> []u16 {
}
return text[:n]
}
utf8_to_wstring :: proc(s: string, allocator := context.temp_allocator) -> wstring {
utf8_to_utf16_buf :: proc(buf: []u16, s: string) -> []u16 {
n1 := MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, raw_data(s), i32(len(s)), nil, 0)
if n1 == 0 {
return nil
} else if int(n1) > len(buf) {
return nil
}
n1 = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, raw_data(s), i32(len(s)), raw_data(buf[:]), n1)
if n1 == 0 {
return nil
} else if int(n1) > len(buf) {
return nil
}
return buf[:n1]
}
utf8_to_utf16 :: proc{utf8_to_utf16_alloc, utf8_to_utf16_buf}
utf8_to_wstring_alloc :: proc(s: string, allocator := context.temp_allocator) -> wstring {
if res := utf8_to_utf16(s, allocator); len(res) > 0 {
return raw_data(res)
}
return nil
}
wstring_to_utf8 :: proc(s: wstring, N: int, allocator := context.temp_allocator) -> (res: string, err: runtime.Allocator_Error) {
utf8_to_wstring_buf :: proc(buf: []u16, s: string) -> wstring {
if res := utf8_to_utf16(buf, s); len(res) > 0 {
return raw_data(res)
}
return nil
}
utf8_to_wstring :: proc{utf8_to_wstring_alloc, utf8_to_wstring_buf}
wstring_to_utf8_alloc :: proc(s: wstring, N: int, allocator := context.temp_allocator) -> (res: string, err: runtime.Allocator_Error) {
context.allocator = allocator
if N == 0 {
@@ -150,13 +170,49 @@ wstring_to_utf8 :: proc(s: wstring, N: int, allocator := context.temp_allocator)
return string(text[:n]), nil
}
utf16_to_utf8 :: proc(s: []u16, allocator := context.temp_allocator) -> (res: string, err: runtime.Allocator_Error) {
wstring_to_utf8_buf :: proc(buf: []u8, s: wstring) -> (res: string) {
n := WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, s, -1, nil, 0, nil, nil)
if n == 0 {
return
} else if int(n) > len(buf) {
return
}
n2 := WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, s, -1, raw_data(buf), n, nil, nil)
if n2 == 0 {
return
} else if int(n2) > len(buf) {
return
}
for i in 0..<n2 {
if buf[i] == 0 {
n2 = i
break
}
}
return string(buf[:n2])
}
wstring_to_utf8 :: proc{wstring_to_utf8_alloc, wstring_to_utf8_buf}
utf16_to_utf8_alloc :: proc(s: []u16, allocator := context.temp_allocator) -> (res: string, err: runtime.Allocator_Error) {
if len(s) == 0 {
return "", nil
}
return wstring_to_utf8(raw_data(s), len(s), allocator)
}
utf16_to_utf8_buf :: proc(buf: []u8, s: []u16) -> (res: string) {
if len(s) == 0 {
return
}
return wstring_to_utf8(buf, raw_data(s))
}
utf16_to_utf8 :: proc{utf16_to_utf8_alloc, utf16_to_utf8_buf}
// AdvAPI32, NetAPI32 and UserENV helpers.
allowed_username :: proc(username: string) -> bool {
+8
View File
@@ -173,6 +173,9 @@ FACILITY :: enum DWORD {
EAS = 85,
WEB = 885,
WEB_SOCKET = 886,
XAUDIO2 = 896,
XAPO = 897,
GAMEINPUT = 906,
MOBILE = 1793,
SQLITE = 1967,
SERVICE_FABRIC = 1968,
@@ -231,6 +234,7 @@ ERROR_PIPE_BUSY : DWORD : 231
// https://learn.microsoft.com/en-us/windows/win32/seccrypto/common-hresult-values
S_OK :: 0x00000000 // Operation successful
S_FALSE :: 0x00000001
E_NOTIMPL :: 0x80004001 // Not implemented
E_NOINTERFACE :: 0x80004002 // No such interface supported
E_POINTER :: 0x80004003 // Pointer that is not valid
@@ -270,6 +274,10 @@ MAKE_HRESULT :: #force_inline proc "contextless" (#any_int sev: int, #any_int fa
return HRESULT((uint(sev)<<31) | (uint(fac)<<16) | (uint(code)))
}
HRESULT_FROM_WIN32 :: #force_inline proc "contextless" (#any_int code: int) -> HRESULT {
return HRESULT(code) <= 0 ? HRESULT(code) : HRESULT(uint(code & 0x0000FFFF) | (uint(FACILITY.WIN32) << 16) | 0x80000000)
}
DECODE_HRESULT :: #force_inline proc "contextless" (#any_int hr: int) -> (SEVERITY, FACILITY, int) {
return HRESULT_SEVERITY(hr), HRESULT_FACILITY(hr), HRESULT_CODE(hr)
}
+331 -18
View File
@@ -265,7 +265,7 @@ HWAVE :: distinct HANDLE
HWAVEIN :: distinct HANDLE
HWAVEOUT :: distinct HANDLE
LPHWAVEIN :: ^HWAVEIN
LPHWAVEIN :: ^HWAVEIN
LPHWAVEOUT :: ^HWAVEOUT
// https://learn.microsoft.com/en-us/windows/win32/multimedia/multimedia-timer-structures
@@ -311,10 +311,285 @@ MAXPNAMELEN :: 32
MAXERRORLENGTH :: 256
MMVERSION :: UINT
// Input is four characters string
// Output is little-endian u32 representation
MAKEFOURCC :: #force_inline proc "contextless" (s: [4]byte) -> DWORD {
return (DWORD(s[0])) | (DWORD(s[1]) << 8) | (DWORD(s[2]) << 16) | (DWORD(s[3]) << 24 )
}
/* flags for wFormatTag field of WAVEFORMAT */
WAVE_FORMAT_PCM :: 1
WAVEFORMATEX :: struct {
WAVE_FORMAT_UNKNOWN :: 0x0000 /* Microsoft Corporation */
WAVE_FORMAT_ADPCM :: 0x0002 /* Microsoft Corporation */
WAVE_FORMAT_IEEE_FLOAT :: 0x0003 /* Microsoft Corporation */
WAVE_FORMAT_VSELP :: 0x0004 /* Compaq Computer Corp. */
WAVE_FORMAT_IBM_CVSD :: 0x0005 /* IBM Corporation */
WAVE_FORMAT_ALAW :: 0x0006 /* Microsoft Corporation */
WAVE_FORMAT_MULAW :: 0x0007 /* Microsoft Corporation */
WAVE_FORMAT_DTS :: 0x0008 /* Microsoft Corporation */
WAVE_FORMAT_DRM :: 0x0009 /* Microsoft Corporation */
WAVE_FORMAT_WMAVOICE9 :: 0x000A /* Microsoft Corporation */
WAVE_FORMAT_WMAVOICE10 :: 0x000B /* Microsoft Corporation */
WAVE_FORMAT_OKI_ADPCM :: 0x0010 /* OKI */
WAVE_FORMAT_DVI_ADPCM :: 0x0011 /* Intel Corporation */
WAVE_FORMAT_IMA_ADPCM :: WAVE_FORMAT_DVI_ADPCM /* Intel Corporation */
WAVE_FORMAT_MEDIASPACE_ADPCM :: 0x0012 /* Videologic */
WAVE_FORMAT_SIERRA_ADPCM :: 0x0013 /* Sierra Semiconductor Corp */
WAVE_FORMAT_G723_ADPCM :: 0x0014 /* Antex Electronics Corporation */
WAVE_FORMAT_DIGISTD :: 0x0015 /* DSP Solutions, Inc. */
WAVE_FORMAT_DIGIFIX :: 0x0016 /* DSP Solutions, Inc. */
WAVE_FORMAT_DIALOGIC_OKI_ADPCM :: 0x0017 /* Dialogic Corporation */
WAVE_FORMAT_MEDIAVISION_ADPCM :: 0x0018 /* Media Vision, Inc. */
WAVE_FORMAT_CU_CODEC :: 0x0019 /* Hewlett-Packard Company */
WAVE_FORMAT_HP_DYN_VOICE :: 0x001A /* Hewlett-Packard Company */
WAVE_FORMAT_YAMAHA_ADPCM :: 0x0020 /* Yamaha Corporation of America */
WAVE_FORMAT_SONARC :: 0x0021 /* Speech Compression */
WAVE_FORMAT_DSPGROUP_TRUESPEECH :: 0x0022 /* DSP Group, Inc */
WAVE_FORMAT_ECHOSC1 :: 0x0023 /* Echo Speech Corporation */
WAVE_FORMAT_AUDIOFILE_AF36 :: 0x0024 /* Virtual Music, Inc. */
WAVE_FORMAT_APTX :: 0x0025 /* Audio Processing Technology */
WAVE_FORMAT_AUDIOFILE_AF10 :: 0x0026 /* Virtual Music, Inc. */
WAVE_FORMAT_PROSODY_1612 :: 0x0027 /* Aculab plc */
WAVE_FORMAT_LRC :: 0x0028 /* Merging Technologies S.A. */
WAVE_FORMAT_DOLBY_AC2 :: 0x0030 /* Dolby Laboratories */
WAVE_FORMAT_GSM610 :: 0x0031 /* Microsoft Corporation */
WAVE_FORMAT_MSNAUDIO :: 0x0032 /* Microsoft Corporation */
WAVE_FORMAT_ANTEX_ADPCME :: 0x0033 /* Antex Electronics Corporation */
WAVE_FORMAT_CONTROL_RES_VQLPC :: 0x0034 /* Control Resources Limited */
WAVE_FORMAT_DIGIREAL :: 0x0035 /* DSP Solutions, Inc. */
WAVE_FORMAT_DIGIADPCM :: 0x0036 /* DSP Solutions, Inc. */
WAVE_FORMAT_CONTROL_RES_CR10 :: 0x0037 /* Control Resources Limited */
WAVE_FORMAT_NMS_VBXADPCM :: 0x0038 /* Natural MicroSystems */
WAVE_FORMAT_CS_IMAADPCM :: 0x0039 /* Crystal Semiconductor IMA ADPCM */
WAVE_FORMAT_ECHOSC3 :: 0x003A /* Echo Speech Corporation */
WAVE_FORMAT_ROCKWELL_ADPCM :: 0x003B /* Rockwell International */
WAVE_FORMAT_ROCKWELL_DIGITALK :: 0x003C /* Rockwell International */
WAVE_FORMAT_XEBEC :: 0x003D /* Xebec Multimedia Solutions Limited */
WAVE_FORMAT_G721_ADPCM :: 0x0040 /* Antex Electronics Corporation */
WAVE_FORMAT_G728_CELP :: 0x0041 /* Antex Electronics Corporation */
WAVE_FORMAT_MSG723 :: 0x0042 /* Microsoft Corporation */
WAVE_FORMAT_INTEL_G723_1 :: 0x0043 /* Intel Corp. */
WAVE_FORMAT_INTEL_G729 :: 0x0044 /* Intel Corp. */
WAVE_FORMAT_SHARP_G726 :: 0x0045 /* Sharp */
WAVE_FORMAT_MPEG :: 0x0050 /* Microsoft Corporation */
WAVE_FORMAT_RT24 :: 0x0052 /* InSoft, Inc. */
WAVE_FORMAT_PAC :: 0x0053 /* InSoft, Inc. */
WAVE_FORMAT_MPEGLAYER3 :: 0x0055 /* ISO/MPEG Layer3 Format Tag */
WAVE_FORMAT_LUCENT_G723 :: 0x0059 /* Lucent Technologies */
WAVE_FORMAT_CIRRUS :: 0x0060 /* Cirrus Logic */
WAVE_FORMAT_ESPCM :: 0x0061 /* ESS Technology */
WAVE_FORMAT_VOXWARE :: 0x0062 /* Voxware Inc */
WAVE_FORMAT_CANOPUS_ATRAC :: 0x0063 /* Canopus, co., Ltd. */
WAVE_FORMAT_G726_ADPCM :: 0x0064 /* APICOM */
WAVE_FORMAT_G722_ADPCM :: 0x0065 /* APICOM */
WAVE_FORMAT_DSAT :: 0x0066 /* Microsoft Corporation */
WAVE_FORMAT_DSAT_DISPLAY :: 0x0067 /* Microsoft Corporation */
WAVE_FORMAT_VOXWARE_BYTE_ALIGNED :: 0x0069 /* Voxware Inc */
WAVE_FORMAT_VOXWARE_AC8 :: 0x0070 /* Voxware Inc */
WAVE_FORMAT_VOXWARE_AC10 :: 0x0071 /* Voxware Inc */
WAVE_FORMAT_VOXWARE_AC16 :: 0x0072 /* Voxware Inc */
WAVE_FORMAT_VOXWARE_AC20 :: 0x0073 /* Voxware Inc */
WAVE_FORMAT_VOXWARE_RT24 :: 0x0074 /* Voxware Inc */
WAVE_FORMAT_VOXWARE_RT29 :: 0x0075 /* Voxware Inc */
WAVE_FORMAT_VOXWARE_RT29HW :: 0x0076 /* Voxware Inc */
WAVE_FORMAT_VOXWARE_VR12 :: 0x0077 /* Voxware Inc */
WAVE_FORMAT_VOXWARE_VR18 :: 0x0078 /* Voxware Inc */
WAVE_FORMAT_VOXWARE_TQ40 :: 0x0079 /* Voxware Inc */
WAVE_FORMAT_VOXWARE_SC3 :: 0x007A /* Voxware Inc */
WAVE_FORMAT_VOXWARE_SC3_1 :: 0x007B /* Voxware Inc */
WAVE_FORMAT_SOFTSOUND :: 0x0080 /* Softsound, Ltd. */
WAVE_FORMAT_VOXWARE_TQ60 :: 0x0081 /* Voxware Inc */
WAVE_FORMAT_MSRT24 :: 0x0082 /* Microsoft Corporation */
WAVE_FORMAT_G729A :: 0x0083 /* AT&T Labs, Inc. */
WAVE_FORMAT_MVI_MVI2 :: 0x0084 /* Motion Pixels */
WAVE_FORMAT_DF_G726 :: 0x0085 /* DataFusion Systems (Pty) (Ltd) */
WAVE_FORMAT_DF_GSM610 :: 0x0086 /* DataFusion Systems (Pty) (Ltd) */
WAVE_FORMAT_ISIAUDIO :: 0x0088 /* Iterated Systems, Inc. */
WAVE_FORMAT_ONLIVE :: 0x0089 /* OnLive! Technologies, Inc. */
WAVE_FORMAT_MULTITUDE_FT_SX20 :: 0x008A /* Multitude Inc. */
WAVE_FORMAT_INFOCOM_ITS_G721_ADPCM :: 0x008B /* Infocom */
WAVE_FORMAT_CONVEDIA_G729 :: 0x008C /* Convedia Corp. */
WAVE_FORMAT_CONGRUENCY :: 0x008D /* Congruency Inc. */
WAVE_FORMAT_SBC24 :: 0x0091 /* Siemens Business Communications Sys */
WAVE_FORMAT_DOLBY_AC3_SPDIF :: 0x0092 /* Sonic Foundry */
WAVE_FORMAT_MEDIASONIC_G723 :: 0x0093 /* MediaSonic */
WAVE_FORMAT_PROSODY_8KBPS :: 0x0094 /* Aculab plc */
WAVE_FORMAT_ZYXEL_ADPCM :: 0x0097 /* ZyXEL Communications, Inc. */
WAVE_FORMAT_PHILIPS_LPCBB :: 0x0098 /* Philips Speech Processing */
WAVE_FORMAT_PACKED :: 0x0099 /* Studer Professional Audio AG */
WAVE_FORMAT_MALDEN_PHONYTALK :: 0x00A0 /* Malden Electronics Ltd. */
WAVE_FORMAT_RACAL_RECORDER_GSM :: 0x00A1 /* Racal recorders */
WAVE_FORMAT_RACAL_RECORDER_G720_A :: 0x00A2 /* Racal recorders */
WAVE_FORMAT_RACAL_RECORDER_G723_1 :: 0x00A3 /* Racal recorders */
WAVE_FORMAT_RACAL_RECORDER_TETRA_ACELP :: 0x00A4 /* Racal recorders */
WAVE_FORMAT_NEC_AAC :: 0x00B0 /* NEC Corp. */
WAVE_FORMAT_RAW_AAC1 :: 0x00FF /* For Raw AAC, with format block AudioSpecificConfig() (as defined by MPEG-4), that follows WAVEFORMATEX */
WAVE_FORMAT_RHETOREX_ADPCM :: 0x0100 /* Rhetorex Inc. */
WAVE_FORMAT_IRAT :: 0x0101 /* BeCubed Software Inc. */
WAVE_FORMAT_VIVO_G723 :: 0x0111 /* Vivo Software */
WAVE_FORMAT_VIVO_SIREN :: 0x0112 /* Vivo Software */
WAVE_FORMAT_PHILIPS_CELP :: 0x0120 /* Philips Speech Processing */
WAVE_FORMAT_PHILIPS_GRUNDIG :: 0x0121 /* Philips Speech Processing */
WAVE_FORMAT_DIGITAL_G723 :: 0x0123 /* Digital Equipment Corporation */
WAVE_FORMAT_SANYO_LD_ADPCM :: 0x0125 /* Sanyo Electric Co., Ltd. */
WAVE_FORMAT_SIPROLAB_ACEPLNET :: 0x0130 /* Sipro Lab Telecom Inc. */
WAVE_FORMAT_SIPROLAB_ACELP4800 :: 0x0131 /* Sipro Lab Telecom Inc. */
WAVE_FORMAT_SIPROLAB_ACELP8V3 :: 0x0132 /* Sipro Lab Telecom Inc. */
WAVE_FORMAT_SIPROLAB_G729 :: 0x0133 /* Sipro Lab Telecom Inc. */
WAVE_FORMAT_SIPROLAB_G729A :: 0x0134 /* Sipro Lab Telecom Inc. */
WAVE_FORMAT_SIPROLAB_KELVIN :: 0x0135 /* Sipro Lab Telecom Inc. */
WAVE_FORMAT_VOICEAGE_AMR :: 0x0136 /* VoiceAge Corp. */
WAVE_FORMAT_G726ADPCM :: 0x0140 /* Dictaphone Corporation */
WAVE_FORMAT_DICTAPHONE_CELP68 :: 0x0141 /* Dictaphone Corporation */
WAVE_FORMAT_DICTAPHONE_CELP54 :: 0x0142 /* Dictaphone Corporation */
WAVE_FORMAT_QUALCOMM_PUREVOICE :: 0x0150 /* Qualcomm, Inc. */
WAVE_FORMAT_QUALCOMM_HALFRATE :: 0x0151 /* Qualcomm, Inc. */
WAVE_FORMAT_TUBGSM :: 0x0155 /* Ring Zero Systems, Inc. */
WAVE_FORMAT_MSAUDIO1 :: 0x0160 /* Microsoft Corporation */
WAVE_FORMAT_WMAUDIO2 :: 0x0161 /* Microsoft Corporation */
WAVE_FORMAT_WMAUDIO3 :: 0x0162 /* Microsoft Corporation */
WAVE_FORMAT_WMAUDIO_LOSSLESS :: 0x0163 /* Microsoft Corporation */
WAVE_FORMAT_WMASPDIF :: 0x0164 /* Microsoft Corporation */
WAVE_FORMAT_UNISYS_NAP_ADPCM :: 0x0170 /* Unisys Corp. */
WAVE_FORMAT_UNISYS_NAP_ULAW :: 0x0171 /* Unisys Corp. */
WAVE_FORMAT_UNISYS_NAP_ALAW :: 0x0172 /* Unisys Corp. */
WAVE_FORMAT_UNISYS_NAP_16K :: 0x0173 /* Unisys Corp. */
WAVE_FORMAT_SYCOM_ACM_SYC008 :: 0x0174 /* SyCom Technologies */
WAVE_FORMAT_SYCOM_ACM_SYC701_G726L :: 0x0175 /* SyCom Technologies */
WAVE_FORMAT_SYCOM_ACM_SYC701_CELP54 :: 0x0176 /* SyCom Technologies */
WAVE_FORMAT_SYCOM_ACM_SYC701_CELP68 :: 0x0177 /* SyCom Technologies */
WAVE_FORMAT_KNOWLEDGE_ADVENTURE_ADPCM :: 0x0178 /* Knowledge Adventure, Inc. */
WAVE_FORMAT_FRAUNHOFER_IIS_MPEG2_AAC :: 0x0180 /* Fraunhofer IIS */
WAVE_FORMAT_DTS_DS :: 0x0190 /* Digital Theatre Systems, Inc. */
WAVE_FORMAT_CREATIVE_ADPCM :: 0x0200 /* Creative Labs, Inc */
WAVE_FORMAT_CREATIVE_FASTSPEECH8 :: 0x0202 /* Creative Labs, Inc */
WAVE_FORMAT_CREATIVE_FASTSPEECH10 :: 0x0203 /* Creative Labs, Inc */
WAVE_FORMAT_UHER_ADPCM :: 0x0210 /* UHER informatic GmbH */
WAVE_FORMAT_ULEAD_DV_AUDIO :: 0x0215 /* Ulead Systems, Inc. */
WAVE_FORMAT_ULEAD_DV_AUDIO_1 :: 0x0216 /* Ulead Systems, Inc. */
WAVE_FORMAT_QUARTERDECK :: 0x0220 /* Quarterdeck Corporation */
WAVE_FORMAT_ILINK_VC :: 0x0230 /* I-link Worldwide */
WAVE_FORMAT_RAW_SPORT :: 0x0240 /* Aureal Semiconductor */
WAVE_FORMAT_ESST_AC3 :: 0x0241 /* ESS Technology, Inc. */
WAVE_FORMAT_GENERIC_PASSTHRU :: 0x0249
WAVE_FORMAT_IPI_HSX :: 0x0250 /* Interactive Products, Inc. */
WAVE_FORMAT_IPI_RPELP :: 0x0251 /* Interactive Products, Inc. */
WAVE_FORMAT_CS2 :: 0x0260 /* Consistent Software */
WAVE_FORMAT_SONY_SCX :: 0x0270 /* Sony Corp. */
WAVE_FORMAT_SONY_SCY :: 0x0271 /* Sony Corp. */
WAVE_FORMAT_SONY_ATRAC3 :: 0x0272 /* Sony Corp. */
WAVE_FORMAT_SONY_SPC :: 0x0273 /* Sony Corp. */
WAVE_FORMAT_TELUM_AUDIO :: 0x0280 /* Telum Inc. */
WAVE_FORMAT_TELUM_IA_AUDIO :: 0x0281 /* Telum Inc. */
WAVE_FORMAT_NORCOM_VOICE_SYSTEMS_ADPCM :: 0x0285 /* Norcom Electronics Corp. */
WAVE_FORMAT_FM_TOWNS_SND :: 0x0300 /* Fujitsu Corp. */
WAVE_FORMAT_MICRONAS :: 0x0350 /* Micronas Semiconductors, Inc. */
WAVE_FORMAT_MICRONAS_CELP833 :: 0x0351 /* Micronas Semiconductors, Inc. */
WAVE_FORMAT_BTV_DIGITAL :: 0x0400 /* Brooktree Corporation */
WAVE_FORMAT_INTEL_MUSIC_CODER :: 0x0401 /* Intel Corp. */
WAVE_FORMAT_INDEO_AUDIO :: 0x0402 /* Ligos */
WAVE_FORMAT_QDESIGN_MUSIC :: 0x0450 /* QDesign Corporation */
WAVE_FORMAT_ON2_VP7_AUDIO :: 0x0500 /* On2 Technologies */
WAVE_FORMAT_ON2_VP6_AUDIO :: 0x0501 /* On2 Technologies */
WAVE_FORMAT_VME_VMPCM :: 0x0680 /* AT&T Labs, Inc. */
WAVE_FORMAT_TPC :: 0x0681 /* AT&T Labs, Inc. */
WAVE_FORMAT_LIGHTWAVE_LOSSLESS :: 0x08AE /* Clearjump */
WAVE_FORMAT_OLIGSM :: 0x1000 /* Ing C. Olivetti & C., S.p.A. */
WAVE_FORMAT_OLIADPCM :: 0x1001 /* Ing C. Olivetti & C., S.p.A. */
WAVE_FORMAT_OLICELP :: 0x1002 /* Ing C. Olivetti & C., S.p.A. */
WAVE_FORMAT_OLISBC :: 0x1003 /* Ing C. Olivetti & C., S.p.A. */
WAVE_FORMAT_OLIOPR :: 0x1004 /* Ing C. Olivetti & C., S.p.A. */
WAVE_FORMAT_LH_CODEC :: 0x1100 /* Lernout & Hauspie */
WAVE_FORMAT_LH_CODEC_CELP :: 0x1101 /* Lernout & Hauspie */
WAVE_FORMAT_LH_CODEC_SBC8 :: 0x1102 /* Lernout & Hauspie */
WAVE_FORMAT_LH_CODEC_SBC12 :: 0x1103 /* Lernout & Hauspie */
WAVE_FORMAT_LH_CODEC_SBC16 :: 0x1104 /* Lernout & Hauspie */
WAVE_FORMAT_NORRIS :: 0x1400 /* Norris Communications, Inc. */
WAVE_FORMAT_ISIAUDIO_2 :: 0x1401 /* ISIAudio */
WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS :: 0x1500 /* AT&T Labs, Inc. */
WAVE_FORMAT_MPEG_ADTS_AAC :: 0x1600 /* Microsoft Corporation */
WAVE_FORMAT_MPEG_RAW_AAC :: 0x1601 /* Microsoft Corporation */
WAVE_FORMAT_MPEG_LOAS :: 0x1602 /* Microsoft Corporation (MPEG-4 Audio Transport Streams (LOAS/LATM) */
WAVE_FORMAT_NOKIA_MPEG_ADTS_AAC :: 0x1608 /* Microsoft Corporation */
WAVE_FORMAT_NOKIA_MPEG_RAW_AAC :: 0x1609 /* Microsoft Corporation */
WAVE_FORMAT_VODAFONE_MPEG_ADTS_AAC :: 0x160A /* Microsoft Corporation */
WAVE_FORMAT_VODAFONE_MPEG_RAW_AAC :: 0x160B /* Microsoft Corporation */
WAVE_FORMAT_MPEG_HEAAC :: 0x1610 /* Microsoft Corporation (MPEG-2 AAC or MPEG-4 HE-AAC v1/v2 streams with any payload (ADTS, ADIF, LOAS/LATM, RAW). Format block includes MP4 AudioSpecificConfig() -- see HEAACWAVEFORMAT below */
WAVE_FORMAT_VOXWARE_RT24_SPEECH :: 0x181C /* Voxware Inc. */
WAVE_FORMAT_SONICFOUNDRY_LOSSLESS :: 0x1971 /* Sonic Foundry */
WAVE_FORMAT_INNINGS_TELECOM_ADPCM :: 0x1979 /* Innings Telecom Inc. */
WAVE_FORMAT_LUCENT_SX8300P :: 0x1C07 /* Lucent Technologies */
WAVE_FORMAT_LUCENT_SX5363S :: 0x1C0C /* Lucent Technologies */
WAVE_FORMAT_CUSEEME :: 0x1F03 /* CUSeeMe */
WAVE_FORMAT_NTCSOFT_ALF2CM_ACM :: 0x1FC4 /* NTCSoft */
WAVE_FORMAT_DVM :: 0x2000 /* FAST Multimedia AG */
WAVE_FORMAT_DTS2 :: 0x2001
WAVE_FORMAT_MAKEAVIS :: 0x3313
WAVE_FORMAT_DIVIO_MPEG4_AAC :: 0x4143 /* Divio, Inc. */
WAVE_FORMAT_NOKIA_ADAPTIVE_MULTIRATE :: 0x4201 /* Nokia */
WAVE_FORMAT_DIVIO_G726 :: 0x4243 /* Divio, Inc. */
WAVE_FORMAT_LEAD_SPEECH :: 0x434C /* LEAD Technologies */
WAVE_FORMAT_LEAD_VORBIS :: 0x564C /* LEAD Technologies */
WAVE_FORMAT_WAVPACK_AUDIO :: 0x5756 /* xiph.org */
WAVE_FORMAT_ALAC :: 0x6C61 /* Apple Lossless */
WAVE_FORMAT_OGG_VORBIS_MODE_1 :: 0x674F /* Ogg Vorbis */
WAVE_FORMAT_OGG_VORBIS_MODE_2 :: 0x6750 /* Ogg Vorbis */
WAVE_FORMAT_OGG_VORBIS_MODE_3 :: 0x6751 /* Ogg Vorbis */
WAVE_FORMAT_OGG_VORBIS_MODE_1_PLUS :: 0x676F /* Ogg Vorbis */
WAVE_FORMAT_OGG_VORBIS_MODE_2_PLUS :: 0x6770 /* Ogg Vorbis */
WAVE_FORMAT_OGG_VORBIS_MODE_3_PLUS :: 0x6771 /* Ogg Vorbis */
WAVE_FORMAT_3COM_NBX :: 0x7000 /* 3COM Corp. */
WAVE_FORMAT_OPUS :: 0x704F /* Opus */
WAVE_FORMAT_FAAD_AAC :: 0x706D
WAVE_FORMAT_AMR_NB :: 0x7361 /* AMR Narrowband */
WAVE_FORMAT_AMR_WB :: 0x7362 /* AMR Wideband */
WAVE_FORMAT_AMR_WP :: 0x7363 /* AMR Wideband Plus */
WAVE_FORMAT_GSM_AMR_CBR :: 0x7A21 /* GSMA/3GPP */
WAVE_FORMAT_GSM_AMR_VBR_SID :: 0x7A22 /* GSMA/3GPP */
WAVE_FORMAT_COMVERSE_INFOSYS_G723_1 :: 0xA100 /* Comverse Infosys */
WAVE_FORMAT_COMVERSE_INFOSYS_AVQSBC :: 0xA101 /* Comverse Infosys */
WAVE_FORMAT_COMVERSE_INFOSYS_SBC :: 0xA102 /* Comverse Infosys */
WAVE_FORMAT_SYMBOL_G729_A :: 0xA103 /* Symbol Technologies */
WAVE_FORMAT_VOICEAGE_AMR_WB :: 0xA104 /* VoiceAge Corp. */
WAVE_FORMAT_INGENIENT_G726 :: 0xA105 /* Ingenient Technologies, Inc. */
WAVE_FORMAT_MPEG4_AAC :: 0xA106 /* ISO/MPEG-4 */
WAVE_FORMAT_ENCORE_G726 :: 0xA107 /* Encore Software */
WAVE_FORMAT_ZOLL_ASAO :: 0xA108 /* ZOLL Medical Corp. */
WAVE_FORMAT_SPEEX_VOICE :: 0xA109 /* xiph.org */
WAVE_FORMAT_VIANIX_MASC :: 0xA10A /* Vianix LLC */
WAVE_FORMAT_WM9_SPECTRUM_ANALYZER :: 0xA10B /* Microsoft */
WAVE_FORMAT_WMF_SPECTRUM_ANAYZER :: 0xA10C /* Microsoft */
WAVE_FORMAT_GSM_610 :: 0xA10D
WAVE_FORMAT_GSM_620 :: 0xA10E
WAVE_FORMAT_GSM_660 :: 0xA10F
WAVE_FORMAT_GSM_690 :: 0xA110
WAVE_FORMAT_GSM_ADAPTIVE_MULTIRATE_WB :: 0xA111
WAVE_FORMAT_POLYCOM_G722 :: 0xA112 /* Polycom */
WAVE_FORMAT_POLYCOM_G728 :: 0xA113 /* Polycom */
WAVE_FORMAT_POLYCOM_G729_A :: 0xA114 /* Polycom */
WAVE_FORMAT_POLYCOM_SIREN :: 0xA115 /* Polycom */
WAVE_FORMAT_GLOBAL_IP_ILBC :: 0xA116 /* Global IP */
WAVE_FORMAT_RADIOTIME_TIME_SHIFT_RADIO :: 0xA117 /* RadioTime */
WAVE_FORMAT_NICE_ACA :: 0xA118 /* Nice Systems */
WAVE_FORMAT_NICE_ADPCM :: 0xA119 /* Nice Systems */
WAVE_FORMAT_VOCORD_G721 :: 0xA11A /* Vocord Telecom */
WAVE_FORMAT_VOCORD_G726 :: 0xA11B /* Vocord Telecom */
WAVE_FORMAT_VOCORD_G722_1 :: 0xA11C /* Vocord Telecom */
WAVE_FORMAT_VOCORD_G728 :: 0xA11D /* Vocord Telecom */
WAVE_FORMAT_VOCORD_G729 :: 0xA11E /* Vocord Telecom */
WAVE_FORMAT_VOCORD_G729_A :: 0xA11F /* Vocord Telecom */
WAVE_FORMAT_VOCORD_G723_1 :: 0xA120 /* Vocord Telecom */
WAVE_FORMAT_VOCORD_LBC :: 0xA121 /* Vocord Telecom */
WAVE_FORMAT_NICE_G728 :: 0xA122 /* Nice Systems */
WAVE_FORMAT_FRACE_TELECOM_G729 :: 0xA123 /* France Telecom */
WAVE_FORMAT_CODIAN :: 0xA124 /* CODIAN */
WAVE_FORMAT_DOLBY_AC4 :: 0xAC40 /* Dolby AC-4 */
WAVE_FORMAT_FLAC :: 0xF1AC /* flac.sourceforge.net */
WAVE_FORMAT_EXTENSIBLE :: 0xFFFE /* Microsoft */
WAVEFORMATEX :: struct #packed {
wFormatTag: WORD,
nChannels: WORD,
nSamplesPerSec: DWORD,
@@ -325,6 +600,20 @@ WAVEFORMATEX :: struct {
}
LPCWAVEFORMATEX :: ^WAVEFORMATEX
// New wave format development should be based on the WAVEFORMATEXTENSIBLE structure.
// WAVEFORMATEXTENSIBLE allows you to avoid having to register a new format tag with Microsoft.
// Simply define a new GUID value for the WAVEFORMATEXTENSIBLE.SubFormat field and use WAVE_FORMAT_EXTENSIBLE in the WAVEFORMATEXTENSIBLE.Format.wFormatTag field.
WAVEFORMATEXTENSIBLE :: struct #packed {
using Format: WAVEFORMATEX,
Samples: struct #raw_union {
wValidBitsPerSample: WORD, /* bits of precision */
wSamplesPerBlock: WORD, /* valid if wBitsPerSample==0 */
wReserved: WORD, /* If neither applies, set to zero. */
},
dwChannelMask: SPEAKER_FLAGS, /* which channels are present in stream */
SubFormat: GUID,
}
WAVEHDR :: struct {
lpData: LPSTR, /* pointer to locked data buffer */
dwBufferLength: DWORD, /* length of data buffer */
@@ -360,26 +649,50 @@ WAVEOUTCAPSW :: struct {
}
LPWAVEOUTCAPSW :: ^WAVEOUTCAPSW
SPEAKER_FLAGS :: distinct bit_set[SPEAKER_FLAG; DWORD]
SPEAKER_FLAG :: enum DWORD {
FRONT_LEFT = 0,
FRONT_RIGHT = 1,
FRONT_CENTER = 2,
LOW_FREQUENCY = 3,
BACK_LEFT = 4,
BACK_RIGHT = 5,
FRONT_LEFT_OF_CENTER = 6,
FRONT_RIGHT_OF_CENTER = 7,
BACK_CENTER = 8,
SIDE_LEFT = 9,
SIDE_RIGHT = 10,
TOP_CENTER = 11,
TOP_FRONT_LEFT = 12,
TOP_FRONT_CENTER = 13,
TOP_FRONT_RIGHT = 14,
TOP_BACK_LEFT = 15,
TOP_BACK_CENTER = 16,
TOP_BACK_RIGHT = 17,
//RESERVED = 0x7FFC0000, // bit mask locations reserved for future use
ALL = 31, // used to specify that any possible permutation of speaker configurations
}
// flag values for PlaySound
SND_SYNC :: 0x0000 /* play synchronously (default) */
SND_ASYNC :: 0x0001 /* play asynchronously */
SND_NODEFAULT :: 0x0002 /* silence (!default) if sound not found */
SND_MEMORY :: 0x0004 /* pszSound points to a memory file */
SND_LOOP :: 0x0008 /* loop the sound until next sndPlaySound */
SND_NOSTOP :: 0x0010 /* don't stop any currently playing sound */
SND_SYNC :: 0x0000 /* play synchronously (default) */
SND_ASYNC :: 0x0001 /* play asynchronously */
SND_NODEFAULT :: 0x0002 /* silence (!default) if sound not found */
SND_MEMORY :: 0x0004 /* pszSound points to a memory file */
SND_LOOP :: 0x0008 /* loop the sound until next sndPlaySound */
SND_NOSTOP :: 0x0010 /* don't stop any currently playing sound */
SND_NOWAIT :: 0x00002000 /* don't wait if the driver is busy */
SND_ALIAS :: 0x00010000 /* name is a registry alias */
SND_ALIAS_ID :: 0x00110000 /* alias is a predefined ID */
SND_FILENAME :: 0x00020000 /* name is file name */
SND_RESOURCE :: 0x00040004 /* name is resource name or atom */
SND_NOWAIT :: 0x00002000 /* don't wait if the driver is busy */
SND_ALIAS :: 0x00010000 /* name is a registry alias */
SND_ALIAS_ID :: 0x00110000 /* alias is a predefined ID */
SND_FILENAME :: 0x00020000 /* name is file name */
SND_RESOURCE :: 0x00040004 /* name is resource name or atom */
SND_PURGE :: 0x0040 /* purge non-static events for task */
SND_APPLICATION :: 0x0080 /* look for application specific association */
SND_PURGE :: 0x0040 /* purge non-static events for task */
SND_APPLICATION :: 0x0080 /* look for application specific association */
SND_SENTRY :: 0x00080000 /* Generate a SoundSentry event with this sound */
SND_RING :: 0x00100000 /* Treat this as a "ring" from a communications app - don't duck me */
SND_SYSTEM :: 0x00200000 /* Treat this as a system sound */
SND_SENTRY :: 0x00080000 /* Generate a SoundSentry event with this sound */
SND_RING :: 0x00100000 /* Treat this as a "ring" from a communications app - don't duck me */
SND_SYSTEM :: 0x00200000 /* Treat this as a system sound */
CALLBACK_TYPEMASK :: 0x00070000 /* callback type mask */
+8 -3
View File
@@ -91,6 +91,7 @@ foreign ws2_32 {
WSACleanup :: proc() -> c_int ---
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsagetlasterror)
WSAGetLastError :: proc() -> c_int ---
WSASetLastError :: proc(err: c_int) ---
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll)
WSAPoll :: proc(fdArray: ^WSA_POLLFD, fds: c_ulong, timeout: c_int) -> c_int ---
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsaduplicatesocketw)
@@ -130,6 +131,10 @@ foreign ws2_32 {
) -> SOCKET ---
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsaioctl)
WSAIoctl :: proc(s: SOCKET, dwIoControlCode: DWORD, lpvInBuffer: rawptr, cbInBuffer: DWORD, lpvOutBuffer: rawptr, cbOutBuffer: DWORD, lpcbBytesReturned: ^DWORD, lpOverlapped: ^OVERLAPPED, lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE) -> c_int ---
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsacreateevent)
WSACreateEvent :: proc() -> WSAEVENT ---
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsacloseevent)
WSACloseEvent :: proc(hEvent: WSAEVENT) -> bool ---
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsaeventselect)
WSAEventSelect :: proc(s: SOCKET, hEventObject: WSAEVENT, lNetworkEvents: i32) -> c_int ---
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsawaitformultipleevents)
@@ -238,9 +243,9 @@ foreign ws2_32 {
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-ntohs)
ntohs :: proc(netshort: c_ushort) -> c_ushort ---
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-htonl)
@(deprecated="Use endian specific integers instead, https://odin-lang.org/docs/overview/#basic-types")
// Prefer using endian-specific integers instead, https://odin-lang.org/docs/overview/#basic-types
htonl :: proc(hostlong: c_ulong) -> c_ulong ---
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-htons)
@(deprecated="Use endian specific integers instead, https://odin-lang.org/docs/overview/#basic-types")
// Prefer using endian-specific integers instead, https://odin-lang.org/docs/overview/#basic-types
htons :: proc(hostshort: c_ushort) -> c_ushort ---
}
}