├── .gitattributes ├── .github ├── FUNDING.yml ├── pull_request_template.md └── workflows │ └── ci.yml ├── src ├── core_foundation.zig ├── core_midi.zig ├── core_graphics.zig ├── quartz_core.zig ├── main.zig ├── system.zig ├── objc.zig └── avf_audio.zig ├── core_midi_manual.zig ├── .gitignore ├── avf_audio_manual.zig ├── README.md ├── LICENSE ├── MACHWindowDelegate.m ├── LICENSE-MIT ├── MACHAppDelegate.m ├── app_kit_manual.zig ├── update.sh ├── MACHView.m ├── MACHWindowDelegate_x86_64_apple_macos12.s ├── registry.zig ├── MACHWindowDelegate_arm64_apple_macos12.s ├── metal_manual.zig ├── LICENSE-APACHE ├── MACHAppDelegate_x86_64_apple_macos12.s ├── MACHAppDelegate_arm64_apple_macos12.s └── avf_audio_headers.m /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: emidoots 2 | -------------------------------------------------------------------------------- /src/core_foundation.zig: -------------------------------------------------------------------------------- 1 | pub const TimeInterval = f64; 2 | -------------------------------------------------------------------------------- /src/core_midi.zig: -------------------------------------------------------------------------------- 1 | const cf = @import("core_foundation.zig"); 2 | const ns = @import("foundation.zig"); 3 | 4 | // ------------------------------------------------------------------------------------------------ 5 | // Types 6 | -------------------------------------------------------------------------------- /core_midi_manual.zig: -------------------------------------------------------------------------------- 1 | const cf = @import("core_foundation.zig"); 2 | const ns = @import("foundation.zig"); 3 | 4 | // ------------------------------------------------------------------------------------------------ 5 | // Types 6 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | - [ ] By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right. -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This file is for zig-specific build artifacts. 2 | # If you have OS-specific or editor-specific files to ignore, 3 | # such as *.swp or .DS_Store, put those in your global 4 | # ~/.gitignore and put this in your ~/.gitconfig: 5 | # 6 | # [core] 7 | # excludesfile = ~/.gitignore 8 | # 9 | # Cheers! 10 | # -andrewrk 11 | 12 | .zig-cache/ 13 | zig-out/ 14 | /release/ 15 | /debug/ 16 | /build/ 17 | /build-*/ 18 | /docgen_tmp/ 19 | xcode-frameworks/ 20 | -------------------------------------------------------------------------------- /src/core_graphics.zig: -------------------------------------------------------------------------------- 1 | const builtin = @import("builtin"); 2 | 3 | pub const ColorSpaceRef = *opaque {}; 4 | 5 | pub const Float = if (builtin.target.ptrBitWidth() == 64) f64 else f32; 6 | 7 | pub const Point = extern struct { 8 | x: Float, 9 | y: Float, 10 | }; 11 | 12 | pub const Size = extern struct { 13 | width: Float, 14 | height: Float, 15 | }; 16 | 17 | pub const Rect = extern struct { 18 | origin: Point, 19 | size: Size, 20 | }; 21 | -------------------------------------------------------------------------------- /avf_audio_manual.zig: -------------------------------------------------------------------------------- 1 | const cf = @import("core_foundation.zig"); 2 | const ns = @import("foundation.zig"); 3 | const objc = @import("objc.zig"); 4 | 5 | // ------------------------------------------------------------------------------------------------ 6 | // Types 7 | 8 | pub const AVAudioSessionCategory = *ns.String; 9 | pub const AVAudioSessionMode = *ns.String; 10 | pub const AVAudioSessionPort = *ns.String; 11 | pub const AVAudioSessionPolarPattern = *ns.String; 12 | pub const AVAudioSessionLocation = *ns.String; 13 | pub const AVAudioSessionOrientation = *ns.String; 14 | 15 | pub const AudioChannelLabel = u32; 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mach-objc: Generated Objective-C bindings for Zig 2 | 3 | Zig bindings to various Objective-C APIs, e.g. Metal, AVFAudio, etc. 4 | 5 | ## Usage 6 | 7 | See https://machengine.org/pkg/mach-objc 8 | 9 | Use `update.sh` to regenerate the generated source files. 10 | 11 | ## Issues 12 | 13 | Issues are tracked in the [main Mach repository](https://github.com/hexops/mach/issues?q=is%3Aissue+is%3Aopen+label%3Aobjc). 14 | 15 | ## Community 16 | 17 | Join the Mach engine community [on Discord](https://discord.gg/XNG3NZgCqp) to discuss this project, ask questions, get help, etc. 18 | 19 | ## Special thanks 20 | 21 | Special thanks to @pdoane who did all of the initial work on the generator and generously contributed this to the Mach ecosystem. 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2021, Hexops Contributors (given via the Git commit history). 2 | 3 | All documentation, image, sound, font, and 2D/3D model files are CC-BY-4.0 licensed unless 4 | otherwise noted. You may get a copy of this license at https://creativecommons.org/licenses/by/4.0 5 | 6 | Files in a directory with a separate LICENSE file may contain files under different license terms, 7 | described within that LICENSE file. 8 | 9 | All other files are licensed under the Apache License, Version 2.0 (see LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) 10 | or the MIT license (see LICENSE-MIT or http://opensource.org/licenses/MIT), at your option. 11 | 12 | All files in the project without exclusions may not be copied, modified, or distributed except 13 | according to the terms above. -------------------------------------------------------------------------------- /MACHWindowDelegate.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface MACHWindowDelegate : NSObject 5 | @end 6 | 7 | @implementation MACHWindowDelegate { 8 | void (^_windowDidResize_block)(void); 9 | bool (^_windowShouldClose_block)(void); 10 | } 11 | 12 | - (void)setBlock_windowDidResize:(void (^)(void))windowDidResize_block __attribute__((objc_direct)) { 13 | _windowDidResize_block = windowDidResize_block; 14 | } 15 | 16 | - (void)setBlock_windowShouldClose:(bool (^)(void))windowShouldClose_block __attribute__((objc_direct)) { 17 | _windowShouldClose_block = windowShouldClose_block; 18 | } 19 | 20 | - (void) windowDidResize:(NSNotification *) notification { 21 | if (self->_windowDidResize_block) self->_windowDidResize_block(); 22 | } 23 | 24 | - (BOOL)windowShouldClose:(NSWindow *)sender { 25 | if (self->_windowShouldClose_block) self->_windowShouldClose_block(); 26 | return NO; 27 | } 28 | 29 | - (void)windowWillClose:(NSNotification *)notification { 30 | //NSLog(@"windowWillClose"); 31 | } 32 | @end 33 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021 Hexops Contributors (given via the Git commit history). 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /MACHAppDelegate.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if TARGET_OS_OSX 4 | #import 5 | #else 6 | #import 7 | #endif 8 | 9 | @interface MACHAppDelegate : NSObject 10 | @end 11 | 12 | #if TARGET_OS_OSX 13 | @interface MACHAppDelegate () 14 | #else 15 | @interface MACHAppDelegate () 16 | #endif 17 | @end 18 | 19 | @implementation MACHAppDelegate { 20 | dispatch_block_t _runBlock; 21 | } 22 | 23 | - (void)setRunBlock:(dispatch_block_t)runBlock __attribute__((objc_direct)) { 24 | _runBlock = runBlock; 25 | } 26 | 27 | #if TARGET_OS_OSX 28 | - (void)applicationDidFinishLaunching:(NSNotification *)notification { 29 | if (self->_runBlock) self->_runBlock(); 30 | } 31 | #else 32 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 33 | if (self->_runBlock) self->_runBlock(); 34 | return YES; 35 | } 36 | #endif 37 | 38 | - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { 39 | return NSTerminateCancel; 40 | } 41 | 42 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { 43 | return YES; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | - push 4 | - pull_request 5 | jobs: 6 | x86_64-linux: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout 10 | uses: actions/checkout@v2 11 | - name: Setup Zig 12 | run: | 13 | sudo apt install xz-utils 14 | sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.14.0-dev.2577+271452d22.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' 15 | - name: x86_64-linux -> aarch64-macos 16 | run: zig build -Dtarget=aarch64-macos 17 | # TODO: re-enable this, unsure why it is failing during cross-compilation: 18 | # zig test mach-objc-tests Debug aarch64-macos: error: warning: Unexpected: C:\Users\runneradmin\AppData\Local\zig\p\12202044ed9fd69af156b0afde619ffd1d111554c557f57ab670ca9960e76d60d0b8\Frameworks\CoreFoundation.framework\CoreFoundation.tbd 19 | # error: Unexpected 20 | # x86_64-windows: 21 | # runs-on: windows-latest 22 | # steps: 23 | # - name: Checkout 24 | # uses: actions/checkout@v2 25 | # - name: Setup Zig 26 | # run: | 27 | # $ProgressPreference = 'SilentlyContinue' 28 | # Invoke-WebRequest -Uri "https://pkg.machengine.org/zig/zig-windows-x86_64-0.14.0-dev.2577+271452d22.zip" -OutFile "C:\zig.zip" 29 | # cd C:\ 30 | # 7z x zig.zip 31 | # Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.14.0-dev.2577+271452d22\" 32 | # - name: x86_64-windows -> aarch64-macos 33 | # run: zig build -Dtarget=aarch64-macos 34 | x86_64-macos: 35 | runs-on: macos-latest 36 | steps: 37 | - name: Checkout 38 | uses: actions/checkout@v2 39 | - name: Setup Zig 40 | run: | 41 | brew install xz 42 | sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-macos-x86_64-0.14.0-dev.2577+271452d22.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' 43 | - name: build 44 | run: zig build 45 | -------------------------------------------------------------------------------- /app_kit_manual.zig: -------------------------------------------------------------------------------- 1 | const ca = @import("quartz_core.zig"); 2 | const cf = @import("core_foundation.zig"); 3 | const ns = @import("foundation.zig"); 4 | const cg = @import("core_graphics.zig"); 5 | const objc = @import("objc.zig"); 6 | 7 | pub const applicationMain = NSApplicationMain; 8 | extern fn NSApplicationMain(argc: c_int, argv: [*]*c_char) c_int; 9 | 10 | // ------------------------------------------------------------------------------------------------ 11 | // Shared 12 | 13 | pub const ErrorDomain = ns.ErrorDomain; 14 | pub const ErrorUserInfoKey = ns.ErrorUserInfoKey; 15 | pub const Integer = ns.Integer; 16 | pub const NotificationName = ns.NotificationName; 17 | pub const TimeInterval = ns.TimeInterval; 18 | pub const UInteger = ns.UInteger; 19 | pub const unichar = ns.unichar; 20 | pub const Range = ns.Range; 21 | pub const StringEncoding = ns.StringEncoding; 22 | pub const StringTransform = ns.StringTransform; 23 | pub const StringEncodingDetectionOptionsKey = ns.StringEncodingDetectionOptionsKey; 24 | pub const Array = ns.Array; 25 | pub const String = ns.String; 26 | 27 | // ------------------------------------------------------------------------------------------------ 28 | // Types 29 | 30 | pub const ModalResponse = *String; 31 | pub const PasteboardType = *String; 32 | pub const AboutPanelOptionKey = *String; 33 | pub const AppearanceName = *String; 34 | pub const ModalSession = *opaque {}; 35 | pub const PrintInfoAttributeKey = *String; 36 | pub const Rect = cg.Rect; 37 | pub const Point = cg.Point; 38 | pub const Size = cg.Size; 39 | pub const RunLoopMode = *String; 40 | pub const PrinterPaperName = *String; 41 | pub const PrintJobDispositionValue = *String; 42 | pub const InterfaceStyle = UInteger; 43 | pub const TouchBarItemIdentifier = *String; 44 | pub const TouchBarCustomizationIdentifier = *String; 45 | pub const TouchBarItemPriority = f32; 46 | pub const DeviceDescriptionKey = *String; 47 | pub const PrinterTypeName = *String; 48 | pub const PrintInfoSettingKey = *String; 49 | pub const AccessibilityActionName = *String; 50 | pub const AccessibilityAttributeName = *String; 51 | pub const ExceptionName = *String; 52 | pub const ImageName = *String; 53 | pub const NibName = *String; 54 | pub const WindowFrameAutosaveName = *String; 55 | pub const AccessibilityParameterizedAttributeName = *String; 56 | pub const UserInterfaceItemIdentifier = *String; 57 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | # TODO: delete this shell script and move all this logic into generator.zig 5 | 6 | #`git clone --depth 1` but at a specific revision 7 | git_clone_rev() { 8 | repo=$1 9 | rev=$2 10 | dir=$3 11 | 12 | rm -rf "$dir" 13 | mkdir "$dir" 14 | pushd "$dir" 15 | git init -q 16 | git fetch "$repo" "$rev" --depth 1 17 | git checkout -q FETCH_HEAD 18 | popd 19 | } 20 | 21 | git_clone_rev https://github.com/hexops/xcode-frameworks 3d1d9613c39bfc2ebfa2551626e87b7f38e0a29f xcode-frameworks 22 | 23 | zig build -Doptimize=ReleaseFast 24 | 25 | rm -f src/metal.zig 26 | echo "Generating Metal" 27 | echo " 28 | #include 29 | " > headers.m 30 | clang headers.m -F ./xcode-frameworks/Frameworks -Xclang -ast-dump=json -fsyntax-only -Wno-deprecated-declarations > headers.json 31 | cat metal_manual.zig > src/metal.zig 32 | ./zig-out/bin/generator --framework Metal >> src/metal.zig 33 | rm headers.json headers.m 34 | 35 | rm -f src/avf_audio.zig 36 | echo "Generating AVFAudio" 37 | cp avf_audio_headers.m headers.m 38 | clang headers.m -F ./xcode-frameworks/Frameworks -Xclang -ast-dump=json -fsyntax-only -Wno-deprecated-declarations > headers.json 39 | cat avf_audio_manual.zig > src/avf_audio.zig 40 | ./zig-out/bin/generator --framework AVFAudio >> src/avf_audio.zig 41 | rm headers.json headers.m 42 | 43 | rm -f src/core_midi.zig 44 | echo "Generating CoreMIDI" 45 | echo " 46 | #include 47 | " > headers.m 48 | clang headers.m -F ./xcode-frameworks/Frameworks -Xclang -ast-dump=json -fsyntax-only -Wno-deprecated-declarations > headers.json 49 | cat core_midi_manual.zig > src/core_midi.zig 50 | ./zig-out/bin/generator --framework CoreMIDI >> src/core_midi.zig 51 | rm headers.json headers.m 52 | 53 | rm -f src/app_kit.zig 54 | echo "Generating AppKit" 55 | echo " 56 | #include 57 | " > headers.m 58 | clang headers.m -F ./xcode-frameworks/Frameworks -Xclang -ast-dump=json -fsyntax-only -Wno-deprecated-declarations -Wno-availability > headers.json 59 | cat app_kit_manual.zig > src/app_kit.zig 60 | ./zig-out/bin/generator --framework AppKit >> src/app_kit.zig 61 | rm headers.json headers.m 62 | 63 | zig fmt . 64 | 65 | # TODO: generate src/foundation/ns.zig 66 | # TODO: generate src/quartz_core/ca.zig 67 | 68 | # Generate assembly. We currently target iOS 15+ and macOS 12+. 69 | # TODO: Add arm64-apple-ios15 and x86_64-apple-ios15-simulator to the targets once we get their SDKs in xcode-frameworks 70 | for pair in \ 71 | 'MACHAppDelegate_aarch64-macos.s aarch64-macos.12.0' \ 72 | 'MACHAppDelegate_x86_64-macos.s x86_64-macos.12.0' 73 | do 74 | dst=${pair%% *} 75 | target=${pair#* } 76 | 77 | zig cc -c MACHAppDelegate.m \ 78 | -target "$target" \ 79 | -S -Os -fomit-frame-pointer -fobjc-arc -fno-objc-exceptions \ 80 | -o "$dst" \ 81 | -iframework ./xcode-frameworks/Frameworks \ 82 | -isystem ./xcode-frameworks/include 83 | 84 | cat "$dst" | 85 | sed 's/\x01/\\x01/g' | 86 | sed 's/ *; .*//g' | # Strip comments at the end of lines 87 | sed 's/ *## .*//g' | 88 | sed '/^ \.build_version .*/d' | # Strip OS-specific version info 89 | sed '/^; .*/d' | # Strip whole-line comments 90 | sed '/^## .*/d' > "$dst.tmp" 91 | 92 | mv "$dst.tmp" "$dst" 93 | done 94 | 95 | mv MACHAppDelegate_aarch64-macos.s MACHAppDelegate_arm64_apple_macos12.s 96 | mv MACHAppDelegate_x86_64-macos.s MACHAppDelegate_x86_64_apple_macos12.s 97 | 98 | for pair in \ 99 | 'MACHWindowDelegate_aarch64-macos.s aarch64-macos.12.0' \ 100 | 'MACHWindowDelegate_x86_64-macos.s x86_64-macos.12.0' 101 | do 102 | dst=${pair%% *} 103 | target=${pair#* } 104 | 105 | zig cc -c MACHWindowDelegate.m \ 106 | -target "$target" \ 107 | -S -Os -fomit-frame-pointer -fobjc-arc -fno-objc-exceptions \ 108 | -o "$dst" \ 109 | -iframework ./xcode-frameworks/Frameworks \ 110 | -isystem ./xcode-frameworks/include 111 | 112 | cat "$dst" | 113 | sed 's/\x01/\\x01/g' | 114 | sed 's/ *; .*//g' | # Strip comments at the end of lines 115 | sed 's/ *## .*//g' | 116 | sed '/^ \.build_version .*/d' | # Strip OS-specific version info 117 | sed '/^; .*/d' | # Strip whole-line comments 118 | sed '/^## .*/d' > "$dst.tmp" 119 | 120 | mv "$dst.tmp" "$dst" 121 | done 122 | 123 | mv MACHWindowDelegate_aarch64-macos.s MACHWindowDelegate_arm64_apple_macos12.s 124 | mv MACHWindowDelegate_x86_64-macos.s MACHWindowDelegate_x86_64_apple_macos12.s 125 | 126 | for pair in \ 127 | 'MACHView_aarch64-macos.s aarch64-macos.12.0' \ 128 | 'MACHView_x86_64-macos.s x86_64-macos.12.0' 129 | do 130 | dst=${pair%% *} 131 | target=${pair#* } 132 | 133 | zig cc -c MACHView.m \ 134 | -target "$target" \ 135 | -S -Os -fomit-frame-pointer -fobjc-arc -fno-objc-exceptions \ 136 | -o "$dst" \ 137 | -iframework ./xcode-frameworks/Frameworks \ 138 | -isystem ./xcode-frameworks/include 139 | 140 | cat "$dst" | 141 | sed 's/\x01/\\x01/g' | 142 | sed 's/ *; .*//g' | # Strip comments at the end of lines 143 | sed 's/ *## .*//g' | 144 | sed '/^ \.build_version .*/d' | # Strip OS-specific version info 145 | sed '/^; .*/d' | # Strip whole-line comments 146 | sed '/^## .*/d' > "$dst.tmp" 147 | 148 | mv "$dst.tmp" "$dst" 149 | done 150 | 151 | mv MACHView_aarch64-macos.s MACHView_arm64_apple_macos12.s 152 | mv MACHView_x86_64-macos.s MACHView_x86_64_apple_macos12.s 153 | -------------------------------------------------------------------------------- /src/quartz_core.zig: -------------------------------------------------------------------------------- 1 | const cg = @import("core_graphics.zig"); 2 | const mtl = @import("metal.zig"); 3 | const ns = @import("foundation.zig"); 4 | const objc = @import("objc.zig"); 5 | 6 | pub const Layer = opaque { 7 | pub const InternalInfo = objc.ExternClass("CALayer", @This(), ns.ObjectInterface, &.{}); 8 | pub const as = InternalInfo.as; 9 | pub const retain = InternalInfo.retain; 10 | pub const release = InternalInfo.release; 11 | pub const autorelease = InternalInfo.autorelease; 12 | }; 13 | 14 | pub const MetalDrawable = opaque { 15 | pub const InternalInfo = objc.ExternProtocol(@This(), &.{mtl.Drawable}); 16 | pub const as = InternalInfo.as; 17 | pub const retain = InternalInfo.retain; 18 | pub const release = InternalInfo.release; 19 | pub const autorelease = InternalInfo.autorelease; 20 | 21 | pub fn present(self_: *@This()) void { 22 | return objc.msgSend(self_, "present", void, .{}); 23 | } 24 | 25 | pub fn texture(self_: *@This()) *mtl.Texture { 26 | return objc.msgSend(self_, "texture", *mtl.Texture, .{}); 27 | } 28 | pub fn layer(self_: *@This()) *MetalLayer { 29 | return objc.msgSend(self_, "layer", *MetalLayer, .{}); 30 | } 31 | }; 32 | 33 | pub const MetalLayer = opaque { 34 | pub const InternalInfo = objc.ExternClass("CAMetalLayer", @This(), Layer, &.{}); 35 | pub const as = InternalInfo.as; 36 | pub const retain = InternalInfo.retain; 37 | pub const release = InternalInfo.release; 38 | pub const autorelease = InternalInfo.autorelease; 39 | pub const new = InternalInfo.new; 40 | pub const alloc = InternalInfo.alloc; 41 | pub const allocInit = InternalInfo.allocInit; 42 | 43 | pub fn nextDrawable(self_: *@This()) ?*MetalDrawable { 44 | return objc.msgSend(self_, "nextDrawable", ?*MetalDrawable, .{}); 45 | } 46 | pub fn device(self_: *@This()) ?*mtl.Device { 47 | return objc.msgSend(self_, "device", ?*mtl.Device, .{}); 48 | } 49 | pub fn setDevice(self_: *@This(), device_: ?*mtl.Device) void { 50 | return objc.msgSend(self_, "setDevice:", void, .{device_}); 51 | } 52 | pub fn preferredDevice(self_: *@This()) ?*mtl.Device { 53 | return objc.msgSend(self_, "preferredDevice", ?*mtl.Device, .{}); 54 | } 55 | pub fn pixelFormat(self_: *@This()) mtl.PixelFormat { 56 | return objc.msgSend(self_, "pixelFormat", mtl.PixelFormat, .{}); 57 | } 58 | pub fn setPixelFormat(self_: *@This(), pixelFormat_: mtl.PixelFormat) void { 59 | return objc.msgSend(self_, "setPixelFormat:", void, .{pixelFormat_}); 60 | } 61 | pub fn framebufferOnly(self_: *@This()) bool { 62 | return objc.msgSend(self_, "framebufferOnly", bool, .{}); 63 | } 64 | pub fn setFramebufferOnly(self_: *@This(), framebufferOnly_: bool) void { 65 | return objc.msgSend(self_, "setFramebufferOnly:", void, .{framebufferOnly_}); 66 | } 67 | pub fn drawableSize(self_: *@This()) cg.Size { 68 | return objc.msgSend(self_, "drawableSize", cg.Size, .{}); 69 | } 70 | pub fn setDrawableSize(self_: *@This(), drawableSize_: cg.Size) void { 71 | return objc.msgSend(self_, "setDrawableSize:", void, .{drawableSize_}); 72 | } 73 | pub fn maximumDrawableCount(self_: *@This()) ns.UInteger { 74 | return objc.msgSend(self_, "maximumDrawableCount", ns.UInteger, .{}); 75 | } 76 | pub fn setMaximumDrawableCount(self_: *@This(), maximumDrawableCount_: ns.UInteger) void { 77 | return objc.msgSend(self_, "setMaximumDrawableCount:", void, .{maximumDrawableCount_}); 78 | } 79 | pub fn presentsWithTransaction(self_: *@This()) bool { 80 | return objc.msgSend(self_, "presentsWithTransaction", bool, .{}); 81 | } 82 | pub fn setPresentsWithTransaction(self_: *@This(), presentsWithTransaction_: bool) void { 83 | return objc.msgSend(self_, "setPresentsWithTransaction:", void, .{presentsWithTransaction_}); 84 | } 85 | pub fn colorspace(self_: *@This()) cg.ColorSpaceRef { 86 | return objc.msgSend(self_, "colorspace", cg.ColorSpaceRef, .{}); 87 | } 88 | pub fn setColorspace(self_: *@This(), colorspace_: cg.ColorSpaceRef) void { 89 | return objc.msgSend(self_, "setColorspace:", void, .{colorspace_}); 90 | } 91 | pub fn setOpaque(self_: *@This(), opaque_: bool) void { 92 | return objc.msgSend(self_, "setOpaque:", void, .{opaque_}); 93 | } 94 | pub fn setOpacity(self_: *@This(), opacity_: f32) void { 95 | return objc.msgSend(self_, "setOpacity:", void, .{opacity_}); 96 | } 97 | pub fn wantsExtendedDynamicRangeContent(self_: *@This()) bool { 98 | return objc.msgSend(self_, "wantsExtendedDynamicRangeContent", bool, .{}); 99 | } 100 | pub fn setWantsExtendedDynamicRangeContent(self_: *@This(), wantsExtendedDynamicRangeContent_: bool) void { 101 | return objc.msgSend(self_, "setWantsExtendedDynamicRangeContent:", void, .{wantsExtendedDynamicRangeContent_}); 102 | } 103 | // pub fn EDRMetadata(self_: *@This()) ?*EDRMetadata { 104 | // return objc.msgSend(self_, "EDRMetadata", ?*EDRMetadata, .{}); 105 | // } 106 | // pub fn setEDRMetadata(self_: *@This(), EDRMetadata_: ?*EDRMetadata) void { 107 | // return objc.msgSend(self_, "setEDRMetadata:", void, .{EDRMetadata_}); 108 | // } 109 | pub fn displaySyncEnabled(self_: *@This()) bool { 110 | return objc.msgSend(self_, "displaySyncEnabled", bool, .{}); 111 | } 112 | pub fn setDisplaySyncEnabled(self_: *@This(), displaySyncEnabled_: bool) void { 113 | return objc.msgSend(self_, "setDisplaySyncEnabled:", void, .{displaySyncEnabled_}); 114 | } 115 | pub fn allowsNextDrawableTimeout(self_: *@This()) bool { 116 | return objc.msgSend(self_, "allowsNextDrawableTimeout", bool, .{}); 117 | } 118 | pub fn setAllowsNextDrawableTimeout(self_: *@This(), allowsNextDrawableTimeout_: bool) void { 119 | return objc.msgSend(self_, "setAllowsNextDrawableTimeout:", void, .{allowsNextDrawableTimeout_}); 120 | } 121 | }; 122 | -------------------------------------------------------------------------------- /MACHView.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface MACHView : NSView 5 | @end 6 | 7 | @implementation MACHView { 8 | void (^_keyDown_block)(NSEvent *); 9 | void (^_keyUp_block)(NSEvent *); 10 | void (^_flagsChanged_block)(NSEvent *); 11 | void (^_mouseMoved_block)(NSEvent *); 12 | void (^_mouseDown_block)(NSEvent *); 13 | void (^_mouseUp_block)(NSEvent *); 14 | void (^_scrollWheel_block)(NSEvent *); 15 | void (^_magnify_block)(NSEvent *); 16 | void (^_insertText_block)(NSEvent *, uint32_t); 17 | NSTrackingArea *trackingArea; 18 | } 19 | 20 | - (BOOL)canBecomeKeyView { 21 | return YES; 22 | } 23 | 24 | - (BOOL)acceptsFirstResponder { 25 | return YES; 26 | } 27 | 28 | - (void)setBlock_keyDown:(void (^)(NSEvent *))keyDown_block 29 | __attribute__((objc_direct)) { 30 | _keyDown_block = keyDown_block; 31 | } 32 | 33 | - (void)setBlock_keyUp:(void (^)(NSEvent *))keyUp_block 34 | __attribute__((objc_direct)) { 35 | _keyUp_block = keyUp_block; 36 | } 37 | 38 | - (void)setBlock_mouseMoved:(void (^)(NSEvent *))mouseMoved_block 39 | __attribute__((objc_direct)) { 40 | _mouseMoved_block = mouseMoved_block; 41 | } 42 | 43 | - (void)setBlock_mouseDown:(void (^)(NSEvent *))mouseDown_block 44 | __attribute__((objc_direct)) { 45 | _mouseDown_block = mouseDown_block; 46 | } 47 | 48 | - (void)setBlock_mouseUp:(void (^)(NSEvent *))mouseUp_block 49 | __attribute__((objc_direct)) { 50 | _mouseUp_block = mouseUp_block; 51 | } 52 | 53 | - (void)setBlock_scrollWheel:(void (^)(NSEvent *))scrollWheel_block 54 | __attribute__((objc_direct)) { 55 | _scrollWheel_block = scrollWheel_block; 56 | } 57 | 58 | - (void)setBlock_flagsChanged:(void (^)(NSEvent *))flagsChanged_block 59 | __attribute__((objc_direct)) { 60 | _flagsChanged_block = flagsChanged_block; 61 | } 62 | 63 | - (void)setBlock_insertText:(void (^)(NSEvent *, uint32_t))insertText_block 64 | __attribute__((objc_direct)) { 65 | _insertText_block = insertText_block; 66 | } 67 | 68 | - (void)setBlock_magnify:(void (^)(NSEvent *))magnify_block 69 | __attribute__((objc_direct)) { 70 | _magnify_block = magnify_block; 71 | } 72 | 73 | - (void)keyDown:(NSEvent *)event { 74 | if (_keyDown_block) 75 | _keyDown_block(event); 76 | 77 | [self interpretKeyEvents:@[ event ]]; 78 | } 79 | 80 | - (void)insertText:(id)string { 81 | NSString *characters; 82 | NSEvent *event = [NSApp currentEvent]; 83 | 84 | if ([string isKindOfClass:[NSAttributedString class]]) 85 | characters = [string string]; 86 | else 87 | characters = (NSString *)string; 88 | 89 | NSRange range = NSMakeRange(0, [characters length]); 90 | while (range.length) { 91 | uint32_t codepoint = 0; 92 | 93 | if ([characters getBytes:&codepoint 94 | maxLength:sizeof(codepoint) 95 | usedLength:NULL 96 | encoding:NSUTF32StringEncoding 97 | options:0 98 | range:range 99 | remainingRange:&range]) { 100 | if (codepoint >= 0xf700 && codepoint <= 0xf7ff) { 101 | continue; 102 | } 103 | if (_insertText_block) 104 | _insertText_block(event, codepoint); 105 | } 106 | } 107 | } 108 | 109 | - (void)keyUp:(NSEvent *)event { 110 | if (_keyUp_block) 111 | _keyUp_block(event); 112 | } 113 | 114 | - (void)flagsChanged:(NSEvent *)event { 115 | if (_flagsChanged_block) 116 | _flagsChanged_block(event); 117 | } 118 | 119 | - (void)mouseMoved:(NSEvent *)event { 120 | if (_mouseMoved_block) 121 | _mouseMoved_block(event); 122 | } 123 | 124 | - (void)mouseDragged:(NSEvent *)event { 125 | if (_mouseMoved_block) 126 | _mouseMoved_block(event); 127 | } 128 | 129 | - (void)rightMouseDragged:(NSEvent *)event { 130 | if (_mouseMoved_block) 131 | _mouseMoved_block(event); 132 | } 133 | 134 | - (void)otherMouseDragged:(NSEvent *)event { 135 | if (_mouseMoved_block) 136 | _mouseMoved_block(event); 137 | } 138 | 139 | - (void)mouseDown:(NSEvent *)event { 140 | if (_mouseDown_block) 141 | _mouseDown_block(event); 142 | } 143 | 144 | - (void)rightMouseDown:(NSEvent *)event { 145 | if (_mouseDown_block) 146 | _mouseDown_block(event); 147 | } 148 | 149 | - (void)otherMouseDown:(NSEvent *)event { 150 | if (_mouseDown_block) 151 | _mouseDown_block(event); 152 | } 153 | 154 | - (void)mouseUp:(NSEvent *)event { 155 | if (_mouseUp_block) 156 | _mouseUp_block(event); 157 | } 158 | 159 | - (void)rightMouseUp:(NSEvent *)event { 160 | if (_mouseUp_block) 161 | _mouseUp_block(event); 162 | } 163 | 164 | - (void)otherMouseUp:(NSEvent *)event { 165 | if (_mouseUp_block) 166 | _mouseUp_block(event); 167 | } 168 | 169 | - (void)scrollWheel:(NSEvent *)event { 170 | if (_scrollWheel_block) 171 | _scrollWheel_block(event); 172 | } 173 | 174 | - (void)magnifyWithEvent:(NSEvent *)event { 175 | if (_magnify_block) 176 | _magnify_block(event); 177 | } 178 | 179 | // Add this method to prevent default macos keybind operations 180 | // such as escape pulling the window out of fullscreen 181 | - (void)doCommandBySelector:(SEL)selector 182 | { 183 | } 184 | 185 | // This overrides the default initializer and creates a tracking area over the 186 | // views visible rect 187 | - (id)initWithFrame:(NSRect)frame { 188 | self = [super initWithFrame:frame]; 189 | if (self) { 190 | // Create a new tracking area to monitor mouse movement 191 | NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | 192 | NSTrackingMouseMoved | 193 | NSTrackingActiveInActiveApp; 194 | NSRect rect = self.visibleRect; 195 | trackingArea = [[NSTrackingArea alloc] initWithRect:rect 196 | options:options 197 | owner:self 198 | userInfo:nil]; 199 | [self addTrackingArea:trackingArea]; 200 | } 201 | return self; 202 | } 203 | 204 | // This is automatically called each time the view size changes 205 | - (void)updateTrackingAreas { 206 | // Remove any existing tracking area 207 | [self removeTrackingArea:trackingArea]; 208 | // Create a new tracking area to monitor mouse movement 209 | NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | 210 | NSTrackingMouseMoved | 211 | NSTrackingActiveInActiveApp; 212 | NSRect rect = self.visibleRect; 213 | trackingArea = [[NSTrackingArea alloc] initWithRect:rect 214 | options:options 215 | owner:self 216 | userInfo:nil]; 217 | [self addTrackingArea:trackingArea]; 218 | } 219 | 220 | @end -------------------------------------------------------------------------------- /MACHWindowDelegate_x86_64_apple_macos12.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .build_version macos, 12, 0 3 | .private_extern "-[MACHWindowDelegate setBlock_windowDidResize:]" 4 | .globl "-[MACHWindowDelegate setBlock_windowDidResize:]" 5 | "-[MACHWindowDelegate setBlock_windowDidResize:]": 6 | .cfi_startproc 7 | pushq %rbx 8 | .cfi_def_cfa_offset 16 9 | .cfi_offset %rbx, -16 10 | testq %rdi, %rdi 11 | je LBB0_1 12 | movq %rdi, %rbx 13 | movq %rsi, %rdi 14 | callq _objc_retainBlock 15 | movq 8(%rbx), %rdi 16 | movq %rax, 8(%rbx) 17 | popq %rbx 18 | jmpq *_objc_release@GOTPCREL(%rip) 19 | LBB0_1: 20 | popq %rbx 21 | retq 22 | .cfi_endproc 23 | 24 | .private_extern "-[MACHWindowDelegate setBlock_windowShouldClose:]" 25 | .globl "-[MACHWindowDelegate setBlock_windowShouldClose:]" 26 | "-[MACHWindowDelegate setBlock_windowShouldClose:]": 27 | .cfi_startproc 28 | pushq %rbx 29 | .cfi_def_cfa_offset 16 30 | .cfi_offset %rbx, -16 31 | testq %rdi, %rdi 32 | je LBB1_1 33 | movq %rdi, %rbx 34 | movq %rsi, %rdi 35 | callq _objc_retainBlock 36 | movq 16(%rbx), %rdi 37 | movq %rax, 16(%rbx) 38 | popq %rbx 39 | jmpq *_objc_release@GOTPCREL(%rip) 40 | LBB1_1: 41 | popq %rbx 42 | retq 43 | .cfi_endproc 44 | 45 | "-[MACHWindowDelegate windowDidResize:]": 46 | 47 | .cfi_startproc 48 | movq 8(%rdi), %rdi 49 | testq %rdi, %rdi 50 | je LBB2_1 51 | jmpq *16(%rdi) 52 | LBB2_1: 53 | retq 54 | .cfi_endproc 55 | 56 | "-[MACHWindowDelegate windowShouldClose:]": 57 | 58 | .cfi_startproc 59 | movq 16(%rdi), %rdi 60 | testq %rdi, %rdi 61 | je LBB3_2 62 | pushq %rax 63 | .cfi_def_cfa_offset 16 64 | callq *16(%rdi) 65 | addq $8, %rsp 66 | LBB3_2: 67 | xorl %eax, %eax 68 | retq 69 | .cfi_endproc 70 | 71 | "-[MACHWindowDelegate windowWillClose:]": 72 | 73 | .cfi_startproc 74 | retq 75 | .cfi_endproc 76 | 77 | "-[MACHWindowDelegate .cxx_destruct]": 78 | 79 | .cfi_startproc 80 | pushq %rbx 81 | .cfi_def_cfa_offset 16 82 | .cfi_offset %rbx, -16 83 | movq %rdi, %rbx 84 | addq $16, %rdi 85 | xorl %esi, %esi 86 | callq _objc_storeStrong 87 | addq $8, %rbx 88 | movq %rbx, %rdi 89 | xorl %esi, %esi 90 | popq %rbx 91 | jmp _objc_storeStrong 92 | .cfi_endproc 93 | 94 | .section __TEXT,__objc_classname,cstring_literals 95 | L_OBJC_CLASS_NAME_: 96 | .asciz "MACHWindowDelegate" 97 | 98 | .section __DATA,__objc_const 99 | .p2align 3, 0x0 100 | __OBJC_METACLASS_RO_$_MACHWindowDelegate: 101 | .long 389 102 | .long 40 103 | .long 40 104 | .space 4 105 | .quad 0 106 | .quad L_OBJC_CLASS_NAME_ 107 | .quad 0 108 | .quad 0 109 | .quad 0 110 | .quad 0 111 | .quad 0 112 | 113 | .section __DATA,__objc_data 114 | .globl _OBJC_METACLASS_$_MACHWindowDelegate 115 | .p2align 3, 0x0 116 | _OBJC_METACLASS_$_MACHWindowDelegate: 117 | .quad _OBJC_METACLASS_$_NSObject 118 | .quad _OBJC_METACLASS_$_NSObject 119 | .quad __objc_empty_cache 120 | .quad 0 121 | .quad __OBJC_METACLASS_RO_$_MACHWindowDelegate 122 | 123 | .section __TEXT,__objc_classname,cstring_literals 124 | L_OBJC_CLASS_NAME_.1: 125 | .asciz "\002" 126 | 127 | .section __TEXT,__objc_methname,cstring_literals 128 | L_OBJC_METH_VAR_NAME_: 129 | .asciz "windowDidResize:" 130 | 131 | .section __TEXT,__objc_methtype,cstring_literals 132 | L_OBJC_METH_VAR_TYPE_: 133 | .asciz "v24@0:8@16" 134 | 135 | .section __TEXT,__objc_methname,cstring_literals 136 | L_OBJC_METH_VAR_NAME_.2: 137 | .asciz "windowShouldClose:" 138 | 139 | .section __TEXT,__objc_methtype,cstring_literals 140 | L_OBJC_METH_VAR_TYPE_.3: 141 | .asciz "c24@0:8@16" 142 | 143 | .section __TEXT,__objc_methname,cstring_literals 144 | L_OBJC_METH_VAR_NAME_.4: 145 | .asciz "windowWillClose:" 146 | 147 | L_OBJC_METH_VAR_NAME_.5: 148 | .asciz ".cxx_destruct" 149 | 150 | .section __TEXT,__objc_methtype,cstring_literals 151 | L_OBJC_METH_VAR_TYPE_.6: 152 | .asciz "v16@0:8" 153 | 154 | .section __DATA,__objc_const 155 | .p2align 3, 0x0 156 | __OBJC_$_INSTANCE_METHODS_MACHWindowDelegate: 157 | .long 24 158 | .long 4 159 | .quad L_OBJC_METH_VAR_NAME_ 160 | .quad L_OBJC_METH_VAR_TYPE_ 161 | .quad "-[MACHWindowDelegate windowDidResize:]" 162 | .quad L_OBJC_METH_VAR_NAME_.2 163 | .quad L_OBJC_METH_VAR_TYPE_.3 164 | .quad "-[MACHWindowDelegate windowShouldClose:]" 165 | .quad L_OBJC_METH_VAR_NAME_.4 166 | .quad L_OBJC_METH_VAR_TYPE_ 167 | .quad "-[MACHWindowDelegate windowWillClose:]" 168 | .quad L_OBJC_METH_VAR_NAME_.5 169 | .quad L_OBJC_METH_VAR_TYPE_.6 170 | .quad "-[MACHWindowDelegate .cxx_destruct]" 171 | 172 | .private_extern _OBJC_IVAR_$_MACHWindowDelegate._windowDidResize_block 173 | .section __DATA,__objc_ivar 174 | .globl _OBJC_IVAR_$_MACHWindowDelegate._windowDidResize_block 175 | .p2align 3, 0x0 176 | _OBJC_IVAR_$_MACHWindowDelegate._windowDidResize_block: 177 | .quad 8 178 | 179 | .section __TEXT,__objc_methname,cstring_literals 180 | L_OBJC_METH_VAR_NAME_.7: 181 | .asciz "_windowDidResize_block" 182 | 183 | .section __TEXT,__objc_methtype,cstring_literals 184 | L_OBJC_METH_VAR_TYPE_.8: 185 | .asciz "@?" 186 | 187 | .private_extern _OBJC_IVAR_$_MACHWindowDelegate._windowShouldClose_block 188 | .section __DATA,__objc_ivar 189 | .globl _OBJC_IVAR_$_MACHWindowDelegate._windowShouldClose_block 190 | .p2align 3, 0x0 191 | _OBJC_IVAR_$_MACHWindowDelegate._windowShouldClose_block: 192 | .quad 16 193 | 194 | .section __TEXT,__objc_methname,cstring_literals 195 | L_OBJC_METH_VAR_NAME_.9: 196 | .asciz "_windowShouldClose_block" 197 | 198 | .section __DATA,__objc_const 199 | .p2align 3, 0x0 200 | __OBJC_$_INSTANCE_VARIABLES_MACHWindowDelegate: 201 | .long 32 202 | .long 2 203 | .quad _OBJC_IVAR_$_MACHWindowDelegate._windowDidResize_block 204 | .quad L_OBJC_METH_VAR_NAME_.7 205 | .quad L_OBJC_METH_VAR_TYPE_.8 206 | .long 3 207 | .long 8 208 | .quad _OBJC_IVAR_$_MACHWindowDelegate._windowShouldClose_block 209 | .quad L_OBJC_METH_VAR_NAME_.9 210 | .quad L_OBJC_METH_VAR_TYPE_.8 211 | .long 3 212 | .long 8 213 | 214 | .p2align 3, 0x0 215 | __OBJC_CLASS_RO_$_MACHWindowDelegate: 216 | .long 388 217 | .long 8 218 | .long 24 219 | .space 4 220 | .quad L_OBJC_CLASS_NAME_.1 221 | .quad L_OBJC_CLASS_NAME_ 222 | .quad __OBJC_$_INSTANCE_METHODS_MACHWindowDelegate 223 | .quad 0 224 | .quad __OBJC_$_INSTANCE_VARIABLES_MACHWindowDelegate 225 | .quad 0 226 | .quad 0 227 | 228 | .section __DATA,__objc_data 229 | .globl _OBJC_CLASS_$_MACHWindowDelegate 230 | .p2align 3, 0x0 231 | _OBJC_CLASS_$_MACHWindowDelegate: 232 | .quad _OBJC_METACLASS_$_MACHWindowDelegate 233 | .quad _OBJC_CLASS_$_NSObject 234 | .quad __objc_empty_cache 235 | .quad 0 236 | .quad __OBJC_CLASS_RO_$_MACHWindowDelegate 237 | 238 | .section __DATA,__objc_classlist,regular,no_dead_strip 239 | .p2align 3, 0x0 240 | l_OBJC_LABEL_CLASS_$: 241 | .quad _OBJC_CLASS_$_MACHWindowDelegate 242 | 243 | .section __DATA,__objc_imageinfo,regular,no_dead_strip 244 | L_OBJC_IMAGE_INFO: 245 | .long 0 246 | .long 64 247 | 248 | .subsections_via_symbols 249 | -------------------------------------------------------------------------------- /registry.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | 3 | // Types are dynamically allocated into the converter's arena so do not need a deinit 4 | pub const Type = union(enum) { 5 | void, 6 | bool, 7 | int: u8, 8 | uint: u8, 9 | float: u8, 10 | c_short, 11 | c_ushort, 12 | c_int, 13 | c_uint, 14 | c_long, 15 | c_ulong, 16 | c_longlong, 17 | c_ulonglong, 18 | name: []const u8, 19 | pointer: Pointer, 20 | instance_type, 21 | function: Function, 22 | generic: Generic, 23 | 24 | pub const Pointer = struct { 25 | is_single: bool, 26 | is_const: bool, 27 | is_optional: bool, 28 | child: *Type, 29 | }; 30 | 31 | pub const Function = struct { 32 | return_type: *Type, 33 | params: std.ArrayList(Type), 34 | }; 35 | 36 | pub const Generic = struct { 37 | base_type: *Type, 38 | args: std.ArrayList(Type), 39 | }; 40 | }; 41 | 42 | pub const EnumValue = struct { 43 | name: []const u8, 44 | value: i64, 45 | }; 46 | 47 | pub const Enum = struct { 48 | const Self = @This(); 49 | const ValueList = std.ArrayList(EnumValue); 50 | 51 | name: []const u8, 52 | ty: Type, 53 | values: ValueList, 54 | 55 | pub fn init(allocator: std.mem.Allocator, name: []const u8) Enum { 56 | return Enum{ 57 | .name = name, 58 | .ty = undefined, 59 | .values = ValueList.init(allocator), 60 | }; 61 | } 62 | 63 | pub fn deinit(self: *Self) void { 64 | self.values.deinit(); 65 | } 66 | }; 67 | 68 | pub const TypeParam = struct { 69 | name: []const u8, 70 | 71 | pub fn init(name: []const u8) TypeParam { 72 | return TypeParam{ .name = name }; 73 | } 74 | }; 75 | 76 | pub const Property = struct { 77 | name: []const u8, 78 | ty: Type, 79 | 80 | pub fn init(name: []const u8, ty: Type) Property { 81 | return Property{ .name = name, .ty = ty }; 82 | } 83 | }; 84 | 85 | pub const Param = struct { 86 | name: []const u8, 87 | ty: Type, 88 | 89 | pub fn init(name: []const u8, ty: Type) Param { 90 | return Param{ .name = name, .ty = ty }; 91 | } 92 | }; 93 | 94 | pub const Method = struct { 95 | const Self = @This(); 96 | const ParamList = std.ArrayList(Param); 97 | 98 | name: []const u8, 99 | instance: bool, 100 | return_type: Type, 101 | params: ParamList, 102 | 103 | pub fn init(name: []const u8, instance: bool, return_type: Type, params: ParamList) Method { 104 | return Method{ 105 | .name = name, 106 | .instance = instance, 107 | .return_type = return_type, 108 | .params = params, 109 | }; 110 | } 111 | 112 | pub fn deinit(self: *Self) void { 113 | self.params.deinit(); 114 | } 115 | }; 116 | 117 | pub const Container = struct { 118 | const Self = @This(); 119 | const ContainerList = std.ArrayList(*Container); 120 | const TypeParamList = std.ArrayList(TypeParam); 121 | const PropertyList = std.ArrayList(Property); 122 | const MethodList = std.ArrayList(Method); 123 | 124 | name: []const u8, 125 | super: ?*Container, 126 | protocols: ContainerList, 127 | type_params: TypeParamList, 128 | properties: PropertyList, 129 | methods: MethodList, 130 | is_interface: bool, 131 | ambiguous: bool, // Same typename as protocol and interface 132 | 133 | pub fn init(allocator: std.mem.Allocator, name: []const u8, is_interface: bool) Container { 134 | return Container{ 135 | .name = name, 136 | .super = null, 137 | .protocols = ContainerList.init(allocator), 138 | .type_params = TypeParamList.init(allocator), 139 | .properties = PropertyList.init(allocator), 140 | .methods = MethodList.init(allocator), 141 | .is_interface = is_interface, 142 | .ambiguous = false, 143 | }; 144 | } 145 | 146 | pub fn deinit(self: *Self) void { 147 | self.protocols.deinit(); 148 | self.type_params.deinit(); 149 | self.properties.deinit(); 150 | for (self.methods.items) |*method| { 151 | method.deinit(); 152 | } 153 | self.methods.deinit(); 154 | } 155 | }; 156 | 157 | pub const Registry = struct { 158 | const Self = @This(); 159 | const TypedefHashMap = std.StringHashMap(Type); 160 | const EnumHashMap = std.StringHashMap(*Enum); 161 | const ContainerHashMap = std.StringHashMap(*Container); 162 | 163 | allocator: std.mem.Allocator, 164 | typedefs: TypedefHashMap, 165 | enums: EnumHashMap, 166 | protocols: ContainerHashMap, 167 | interfaces: ContainerHashMap, 168 | 169 | pub fn init(allocator: std.mem.Allocator) Registry { 170 | return Registry{ 171 | .allocator = allocator, 172 | .typedefs = TypedefHashMap.init(allocator), 173 | .enums = EnumHashMap.init(allocator), 174 | .protocols = ContainerHashMap.init(allocator), 175 | .interfaces = ContainerHashMap.init(allocator), 176 | }; 177 | } 178 | 179 | pub fn deinit(self: *Self) void { 180 | self.typedefs.deinit(); 181 | self.deinitMap(&self.enums); 182 | self.deinitMap(&self.protocols); 183 | self.deinitMap(&self.interfaces); 184 | } 185 | 186 | fn deinitMap(self: *Self, map: anytype) void { 187 | var it = map.iterator(); 188 | while (it.next()) |entry| { 189 | var value = entry.value_ptr.*; 190 | value.deinit(); 191 | self.allocator.destroy(value); 192 | } 193 | map.deinit(); 194 | } 195 | 196 | pub fn getEnum(self: *Self, name: []const u8) !*Enum { 197 | const v = try self.enums.getOrPut(name); 198 | if (v.found_existing) { 199 | return v.value_ptr.*; 200 | } else { 201 | const e = try self.allocator.create(Enum); 202 | e.* = Enum.init(self.allocator, name); 203 | v.value_ptr.* = e; 204 | return e; 205 | } 206 | } 207 | 208 | pub fn getProtocol(self: *Self, name: []const u8) !*Container { 209 | return try self.getContainer(&self.protocols, &self.interfaces, name, false); 210 | } 211 | 212 | pub fn getInterface(self: *Self, name: []const u8) !*Container { 213 | return try self.getContainer(&self.interfaces, &self.protocols, name, true); 214 | } 215 | 216 | fn getContainer( 217 | self: *Self, 218 | primary: *ContainerHashMap, 219 | secondary: *ContainerHashMap, 220 | name: []const u8, 221 | is_interface: bool, 222 | ) !*Container { 223 | const v = try primary.getOrPut(name); 224 | var container: *Container = undefined; 225 | if (v.found_existing) { 226 | container = v.value_ptr.*; 227 | } else { 228 | container = try self.allocator.create(Container); 229 | container.* = Container.init(self.allocator, name, is_interface); 230 | v.value_ptr.* = container; 231 | } 232 | 233 | if (secondary.get(name)) |other| { 234 | other.ambiguous = true; 235 | container.ambiguous = true; 236 | } 237 | 238 | return container; 239 | } 240 | }; 241 | -------------------------------------------------------------------------------- /MACHWindowDelegate_arm64_apple_macos12.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .build_version macos, 12, 0 3 | .private_extern "-[MACHWindowDelegate setBlock_windowDidResize:]" 4 | .globl "-[MACHWindowDelegate setBlock_windowDidResize:]" 5 | .p2align 2 6 | "-[MACHWindowDelegate setBlock_windowDidResize:]": 7 | .cfi_startproc 8 | cbz x0, LBB0_2 9 | stp x20, x19, [sp, #-32]! 10 | .cfi_def_cfa_offset 32 11 | stp x29, x30, [sp, #16] 12 | .cfi_offset w30, -8 13 | .cfi_offset w29, -16 14 | .cfi_offset w19, -24 15 | .cfi_offset w20, -32 16 | mov x19, x0 17 | mov x0, x1 18 | bl _objc_retainBlock 19 | ldr x8, [x19, #8] 20 | str x0, [x19, #8] 21 | mov x0, x8 22 | ldp x29, x30, [sp, #16] 23 | ldp x20, x19, [sp], #32 24 | .cfi_def_cfa_offset 0 25 | .cfi_restore w30 26 | .cfi_restore w29 27 | .cfi_restore w19 28 | .cfi_restore w20 29 | b _objc_release 30 | LBB0_2: 31 | ret 32 | .cfi_endproc 33 | 34 | .private_extern "-[MACHWindowDelegate setBlock_windowShouldClose:]" 35 | .globl "-[MACHWindowDelegate setBlock_windowShouldClose:]" 36 | .p2align 2 37 | "-[MACHWindowDelegate setBlock_windowShouldClose:]": 38 | .cfi_startproc 39 | cbz x0, LBB1_2 40 | stp x20, x19, [sp, #-32]! 41 | .cfi_def_cfa_offset 32 42 | stp x29, x30, [sp, #16] 43 | .cfi_offset w30, -8 44 | .cfi_offset w29, -16 45 | .cfi_offset w19, -24 46 | .cfi_offset w20, -32 47 | mov x19, x0 48 | mov x0, x1 49 | bl _objc_retainBlock 50 | ldr x8, [x19, #16] 51 | str x0, [x19, #16] 52 | mov x0, x8 53 | ldp x29, x30, [sp, #16] 54 | ldp x20, x19, [sp], #32 55 | .cfi_def_cfa_offset 0 56 | .cfi_restore w30 57 | .cfi_restore w29 58 | .cfi_restore w19 59 | .cfi_restore w20 60 | b _objc_release 61 | LBB1_2: 62 | ret 63 | .cfi_endproc 64 | 65 | .p2align 2 66 | "-[MACHWindowDelegate windowDidResize:]": 67 | .cfi_startproc 68 | ldr x0, [x0, #8] 69 | cbz x0, LBB2_2 70 | ldr x1, [x0, #16] 71 | br x1 72 | LBB2_2: 73 | ret 74 | .cfi_endproc 75 | 76 | .p2align 2 77 | "-[MACHWindowDelegate windowShouldClose:]": 78 | .cfi_startproc 79 | ldr x0, [x0, #16] 80 | cbz x0, LBB3_2 81 | stp x29, x30, [sp, #-16]! 82 | .cfi_def_cfa_offset 16 83 | .cfi_offset w30, -8 84 | .cfi_offset w29, -16 85 | ldr x8, [x0, #16] 86 | blr x8 87 | ldp x29, x30, [sp], #16 88 | .cfi_def_cfa_offset 0 89 | .cfi_restore w30 90 | .cfi_restore w29 91 | LBB3_2: 92 | mov w0, #0 93 | ret 94 | .cfi_endproc 95 | 96 | .p2align 2 97 | "-[MACHWindowDelegate windowWillClose:]": 98 | .cfi_startproc 99 | ret 100 | .cfi_endproc 101 | 102 | .p2align 2 103 | "-[MACHWindowDelegate .cxx_destruct]": 104 | .cfi_startproc 105 | stp x20, x19, [sp, #-32]! 106 | .cfi_def_cfa_offset 32 107 | stp x29, x30, [sp, #16] 108 | .cfi_offset w30, -8 109 | .cfi_offset w29, -16 110 | .cfi_offset w19, -24 111 | .cfi_offset w20, -32 112 | mov x19, x0 113 | add x0, x0, #16 114 | mov x1, #0 115 | bl _objc_storeStrong 116 | add x0, x19, #8 117 | mov x1, #0 118 | ldp x29, x30, [sp, #16] 119 | ldp x20, x19, [sp], #32 120 | .cfi_def_cfa_offset 0 121 | .cfi_restore w30 122 | .cfi_restore w29 123 | .cfi_restore w19 124 | .cfi_restore w20 125 | b _objc_storeStrong 126 | .cfi_endproc 127 | 128 | .section __TEXT,__objc_classname,cstring_literals 129 | l_OBJC_CLASS_NAME_: 130 | .asciz "MACHWindowDelegate" 131 | 132 | .section __DATA,__objc_const 133 | .p2align 3, 0x0 134 | __OBJC_METACLASS_RO_$_MACHWindowDelegate: 135 | .long 389 136 | .long 40 137 | .long 40 138 | .space 4 139 | .quad 0 140 | .quad l_OBJC_CLASS_NAME_ 141 | .quad 0 142 | .quad 0 143 | .quad 0 144 | .quad 0 145 | .quad 0 146 | 147 | .section __DATA,__objc_data 148 | .globl _OBJC_METACLASS_$_MACHWindowDelegate 149 | .p2align 3, 0x0 150 | _OBJC_METACLASS_$_MACHWindowDelegate: 151 | .quad _OBJC_METACLASS_$_NSObject 152 | .quad _OBJC_METACLASS_$_NSObject 153 | .quad __objc_empty_cache 154 | .quad 0 155 | .quad __OBJC_METACLASS_RO_$_MACHWindowDelegate 156 | 157 | .section __TEXT,__objc_classname,cstring_literals 158 | l_OBJC_CLASS_NAME_.1: 159 | .asciz "\002" 160 | 161 | .section __TEXT,__objc_methname,cstring_literals 162 | l_OBJC_METH_VAR_NAME_: 163 | .asciz "windowDidResize:" 164 | 165 | .section __TEXT,__objc_methtype,cstring_literals 166 | l_OBJC_METH_VAR_TYPE_: 167 | .asciz "v24@0:8@16" 168 | 169 | .section __TEXT,__objc_methname,cstring_literals 170 | l_OBJC_METH_VAR_NAME_.2: 171 | .asciz "windowShouldClose:" 172 | 173 | .section __TEXT,__objc_methtype,cstring_literals 174 | l_OBJC_METH_VAR_TYPE_.3: 175 | .asciz "B24@0:8@16" 176 | 177 | .section __TEXT,__objc_methname,cstring_literals 178 | l_OBJC_METH_VAR_NAME_.4: 179 | .asciz "windowWillClose:" 180 | 181 | l_OBJC_METH_VAR_NAME_.5: 182 | .asciz ".cxx_destruct" 183 | 184 | .section __TEXT,__objc_methtype,cstring_literals 185 | l_OBJC_METH_VAR_TYPE_.6: 186 | .asciz "v16@0:8" 187 | 188 | .section __DATA,__objc_const 189 | .p2align 3, 0x0 190 | __OBJC_$_INSTANCE_METHODS_MACHWindowDelegate: 191 | .long 24 192 | .long 4 193 | .quad l_OBJC_METH_VAR_NAME_ 194 | .quad l_OBJC_METH_VAR_TYPE_ 195 | .quad "-[MACHWindowDelegate windowDidResize:]" 196 | .quad l_OBJC_METH_VAR_NAME_.2 197 | .quad l_OBJC_METH_VAR_TYPE_.3 198 | .quad "-[MACHWindowDelegate windowShouldClose:]" 199 | .quad l_OBJC_METH_VAR_NAME_.4 200 | .quad l_OBJC_METH_VAR_TYPE_ 201 | .quad "-[MACHWindowDelegate windowWillClose:]" 202 | .quad l_OBJC_METH_VAR_NAME_.5 203 | .quad l_OBJC_METH_VAR_TYPE_.6 204 | .quad "-[MACHWindowDelegate .cxx_destruct]" 205 | 206 | .private_extern _OBJC_IVAR_$_MACHWindowDelegate._windowDidResize_block 207 | .section __DATA,__objc_ivar 208 | .globl _OBJC_IVAR_$_MACHWindowDelegate._windowDidResize_block 209 | .p2align 2, 0x0 210 | _OBJC_IVAR_$_MACHWindowDelegate._windowDidResize_block: 211 | .long 8 212 | 213 | .section __TEXT,__objc_methname,cstring_literals 214 | l_OBJC_METH_VAR_NAME_.7: 215 | .asciz "_windowDidResize_block" 216 | 217 | .section __TEXT,__objc_methtype,cstring_literals 218 | l_OBJC_METH_VAR_TYPE_.8: 219 | .asciz "@?" 220 | 221 | .private_extern _OBJC_IVAR_$_MACHWindowDelegate._windowShouldClose_block 222 | .section __DATA,__objc_ivar 223 | .globl _OBJC_IVAR_$_MACHWindowDelegate._windowShouldClose_block 224 | .p2align 2, 0x0 225 | _OBJC_IVAR_$_MACHWindowDelegate._windowShouldClose_block: 226 | .long 16 227 | 228 | .section __TEXT,__objc_methname,cstring_literals 229 | l_OBJC_METH_VAR_NAME_.9: 230 | .asciz "_windowShouldClose_block" 231 | 232 | .section __DATA,__objc_const 233 | .p2align 3, 0x0 234 | __OBJC_$_INSTANCE_VARIABLES_MACHWindowDelegate: 235 | .long 32 236 | .long 2 237 | .quad _OBJC_IVAR_$_MACHWindowDelegate._windowDidResize_block 238 | .quad l_OBJC_METH_VAR_NAME_.7 239 | .quad l_OBJC_METH_VAR_TYPE_.8 240 | .long 3 241 | .long 8 242 | .quad _OBJC_IVAR_$_MACHWindowDelegate._windowShouldClose_block 243 | .quad l_OBJC_METH_VAR_NAME_.9 244 | .quad l_OBJC_METH_VAR_TYPE_.8 245 | .long 3 246 | .long 8 247 | 248 | .p2align 3, 0x0 249 | __OBJC_CLASS_RO_$_MACHWindowDelegate: 250 | .long 388 251 | .long 8 252 | .long 24 253 | .space 4 254 | .quad l_OBJC_CLASS_NAME_.1 255 | .quad l_OBJC_CLASS_NAME_ 256 | .quad __OBJC_$_INSTANCE_METHODS_MACHWindowDelegate 257 | .quad 0 258 | .quad __OBJC_$_INSTANCE_VARIABLES_MACHWindowDelegate 259 | .quad 0 260 | .quad 0 261 | 262 | .section __DATA,__objc_data 263 | .globl _OBJC_CLASS_$_MACHWindowDelegate 264 | .p2align 3, 0x0 265 | _OBJC_CLASS_$_MACHWindowDelegate: 266 | .quad _OBJC_METACLASS_$_MACHWindowDelegate 267 | .quad _OBJC_CLASS_$_NSObject 268 | .quad __objc_empty_cache 269 | .quad 0 270 | .quad __OBJC_CLASS_RO_$_MACHWindowDelegate 271 | 272 | .section __DATA,__objc_classlist,regular,no_dead_strip 273 | .p2align 3, 0x0 274 | l_OBJC_LABEL_CLASS_$: 275 | .quad _OBJC_CLASS_$_MACHWindowDelegate 276 | 277 | .section __DATA,__objc_imageinfo,regular,no_dead_strip 278 | L_OBJC_IMAGE_INFO: 279 | .long 0 280 | .long 64 281 | 282 | .subsections_via_symbols 283 | -------------------------------------------------------------------------------- /src/main.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | 3 | pub const objc = @import("objc.zig"); 4 | pub const avf_audio = @import("avf_audio.zig"); 5 | pub const core_foundation = @import("core_foundation.zig"); 6 | pub const core_graphics = @import("core_graphics.zig"); 7 | pub const foundation = @import("foundation.zig"); 8 | pub const metal = @import("metal.zig"); 9 | pub const quartz_core = @import("quartz_core.zig"); 10 | pub const app_kit = @import("app_kit.zig"); 11 | 12 | pub const mach = struct { 13 | pub const AppDelegate = opaque { 14 | pub const InternalInfo = objc.ExternClass("MACHAppDelegate", AppDelegate, foundation.ObjectInterface, &.{app_kit.ApplicationDelegate}); 15 | pub const as = InternalInfo.as; 16 | pub const retain = InternalInfo.retain; 17 | pub const release = InternalInfo.release; 18 | pub const autorelease = InternalInfo.autorelease; 19 | pub const new = InternalInfo.new; 20 | pub const alloc = InternalInfo.alloc; 21 | pub const allocInit = InternalInfo.allocInit; 22 | 23 | pub fn setRunBlock(self: *AppDelegate, block: *foundation.Block(fn () void)) void { 24 | method(self, block); 25 | } 26 | const method = @extern( 27 | *const fn (*AppDelegate, *foundation.Block(fn () void)) callconv(.C) void, 28 | .{ .name = "\x01-[MACHAppDelegate setRunBlock:]" }, 29 | ); 30 | }; 31 | 32 | pub const WindowDelegate = opaque { 33 | pub const InternalInfo = objc.ExternClass("MACHWindowDelegate", WindowDelegate, foundation.ObjectInterface, &.{app_kit.WindowDelegate}); 34 | pub const as = InternalInfo.as; 35 | pub const retain = InternalInfo.retain; 36 | pub const release = InternalInfo.release; 37 | pub const autorelease = InternalInfo.autorelease; 38 | pub const new = InternalInfo.new; 39 | pub const alloc = InternalInfo.alloc; 40 | pub const allocInit = InternalInfo.allocInit; 41 | 42 | pub fn setBlock_windowDidResize(self: *WindowDelegate, block: *foundation.Block(fn () void)) void { 43 | method_windowDidResize(self, block); 44 | } 45 | const method_windowDidResize = @extern( 46 | *const fn (*WindowDelegate, *foundation.Block(fn () void)) callconv(.C) void, 47 | .{ .name = "\x01-[MACHWindowDelegate setBlock_windowDidResize:]" }, 48 | ); 49 | 50 | pub fn setBlock_windowShouldClose(self: *WindowDelegate, block: *foundation.Block(fn () bool)) void { 51 | method_windowShouldClose(self, block); 52 | } 53 | const method_windowShouldClose = @extern( 54 | *const fn (*WindowDelegate, *foundation.Block(fn () bool)) callconv(.C) void, 55 | .{ .name = "\x01-[MACHWindowDelegate setBlock_windowShouldClose:]" }, 56 | ); 57 | }; 58 | 59 | pub const View = opaque { 60 | pub const InternalInfo = objc.ExternClass("MACHView", View, app_kit.View, &.{}); 61 | pub const as = InternalInfo.as; 62 | pub const retain = InternalInfo.retain; 63 | pub const release = InternalInfo.release; 64 | pub const autorelease = InternalInfo.autorelease; 65 | pub const new = InternalInfo.new; 66 | pub const alloc = InternalInfo.alloc; 67 | pub const allocInit = InternalInfo.allocInit; 68 | 69 | pub fn initWithFrame(self_: *@This(), frameRect_: app_kit.Rect) *@This() { 70 | return objc.msgSend(self_, "initWithFrame:", *@This(), .{frameRect_}); 71 | } 72 | 73 | pub fn currentDrawable(self_: *@This()) ?*quartz_core.MetalDrawable { 74 | return objc.msgSend(self_, "currentDrawable", ?*quartz_core.MetalDrawable, .{}); 75 | } 76 | 77 | pub fn layer(self_: *@This()) *quartz_core.MetalLayer { 78 | return objc.msgSend(self_, "layer", *quartz_core.MetalLayer, .{}); 79 | } 80 | pub fn setLayer(self_: *@This(), layer_: *quartz_core.MetalLayer) void { 81 | return objc.msgSend(self_, "setLayer:", void, .{layer_}); 82 | } 83 | 84 | pub fn setBlock_keyDown(self: *View, block: *foundation.Block(fn (*app_kit.Event) void)) void { 85 | method_keyDown(self, block); 86 | } 87 | const method_keyDown = @extern( 88 | *const fn (*View, *foundation.Block(fn (*app_kit.Event) void)) callconv(.C) void, 89 | .{ .name = "\x01-[MACHView setBlock_keyDown:]" }, 90 | ); 91 | 92 | pub fn setBlock_insertText(self: *View, block: *foundation.Block(fn (*app_kit.Event, u32) void)) void { 93 | method_insertText(self, block); 94 | } 95 | const method_insertText = @extern( 96 | *const fn (*View, *foundation.Block(fn (*app_kit.Event, u32) void)) callconv(.C) void, 97 | .{ .name = "\x01-[MACHView setBlock_insertText:]" }, 98 | ); 99 | 100 | pub fn setBlock_keyUp(self: *View, block: *foundation.Block(fn (*app_kit.Event) void)) void { 101 | method_keyUp(self, block); 102 | } 103 | const method_keyUp = @extern( 104 | *const fn (*View, *foundation.Block(fn (*app_kit.Event) void)) callconv(.C) void, 105 | .{ .name = "\x01-[MACHView setBlock_keyUp:]" }, 106 | ); 107 | 108 | pub fn setBlock_flagsChanged(self: *View, block: *foundation.Block(fn (*app_kit.Event) void)) void { 109 | method_flagsChanged(self, block); 110 | } 111 | const method_flagsChanged = @extern( 112 | *const fn (*View, *foundation.Block(fn (*app_kit.Event) void)) callconv(.C) void, 113 | .{ .name = "\x01-[MACHView setBlock_flagsChanged:]" }, 114 | ); 115 | 116 | pub fn setBlock_magnify(self: *View, block: *foundation.Block(fn (*app_kit.Event) void)) void { 117 | method_magnify(self, block); 118 | } 119 | const method_magnify = @extern( 120 | *const fn (*View, *foundation.Block(fn (*app_kit.Event) void)) callconv(.C) void, 121 | .{ .name = "\x01-[MACHView setBlock_magnify:]" }, 122 | ); 123 | 124 | pub fn setBlock_mouseMoved(self: *View, block: *foundation.Block(fn (*app_kit.Event) void)) void { 125 | method_mouseMoved(self, block); 126 | } 127 | const method_mouseMoved = @extern( 128 | *const fn (*View, *foundation.Block(fn (*app_kit.Event) void)) callconv(.C) void, 129 | .{ .name = "\x01-[MACHView setBlock_mouseMoved:]" }, 130 | ); 131 | 132 | pub fn setBlock_mouseDown(self: *View, block: *foundation.Block(fn (*app_kit.Event) void)) void { 133 | method_mouseDown(self, block); 134 | } 135 | const method_mouseDown = @extern( 136 | *const fn (*View, *foundation.Block(fn (*app_kit.Event) void)) callconv(.C) void, 137 | .{ .name = "\x01-[MACHView setBlock_mouseDown:]" }, 138 | ); 139 | 140 | pub fn setBlock_mouseUp(self: *View, block: *foundation.Block(fn (*app_kit.Event) void)) void { 141 | method_mouseUp(self, block); 142 | } 143 | const method_mouseUp = @extern( 144 | *const fn (*View, *foundation.Block(fn (*app_kit.Event) void)) callconv(.C) void, 145 | .{ .name = "\x01-[MACHView setBlock_mouseUp:]" }, 146 | ); 147 | 148 | pub fn setBlock_scrollWheel(self: *View, block: *foundation.Block(fn (*app_kit.Event) void)) void { 149 | method_scrollWheel(self, block); 150 | } 151 | const method_scrollWheel = @extern( 152 | *const fn (*View, *foundation.Block(fn (*app_kit.Event) void)) callconv(.C) void, 153 | .{ .name = "\x01-[MACHView setBlock_scrollWheel:]" }, 154 | ); 155 | }; 156 | }; 157 | 158 | test { 159 | @setEvalBranchQuota(10000); 160 | std.testing.refAllDeclsRecursive(@This()); 161 | } 162 | -------------------------------------------------------------------------------- /src/system.zig: -------------------------------------------------------------------------------- 1 | const builtin = @import("builtin"); 2 | const std = @import("std"); 3 | 4 | pub extern "System" fn dispatch_async(queue: *anyopaque, work: *const Block(fn (*BlockLiteral(void)) void)) void; 5 | pub extern "System" fn dispatch_async_f(queue: *anyopaque, context: ?*anyopaque, work: *const fn (context: ?*anyopaque) callconv(.C) void) void; 6 | pub extern "System" fn @"dispatch_assert_queue$V2"(queue: *anyopaque) void; 7 | pub extern "System" var _dispatch_main_q: anyopaque; 8 | 9 | extern fn _Block_copy(*const anyopaque) *anyopaque; // Provided by libSystem on iOS but not macOS. 10 | extern fn _Block_release(*const anyopaque) void; // Provided by libSystem on iOS but not macOS. 11 | 12 | pub fn Block(comptime Signature: type) type { 13 | const signature_fn_info = @typeInfo(Signature).@"fn"; 14 | return opaque { 15 | pub fn invoke(self: *@This(), args: std.meta.ArgsTuple(Signature)) signature_fn_info.return_type.? { 16 | const self_param = std.builtin.Type.Fn.Param{ 17 | .is_generic = false, 18 | .is_noalias = false, 19 | .type = *@This(), 20 | }; 21 | const SignatureForInvoke = @Type(.{ 22 | .@"fn" = .{ 23 | .calling_convention = std.builtin.CallingConvention.c, 24 | .is_generic = signature_fn_info.is_generic, 25 | .is_var_args = signature_fn_info.is_var_args, 26 | .return_type = signature_fn_info.return_type, 27 | .params = .{self_param} ++ signature_fn_info.params, 28 | }, 29 | }); 30 | 31 | const offset = @offsetOf(BlockLiteral(void), "invoke"); 32 | const invoke_ptr: *const SignatureForInvoke = @ptrCast(self + offset); 33 | return @call(.auto, invoke_ptr, .{self} ++ args); 34 | } 35 | 36 | pub fn copy(self: *const @This()) *@This() { 37 | return @ptrCast(_Block_copy(self)); 38 | } 39 | 40 | pub fn release(self: *const @This()) void { 41 | _Block_release(self); 42 | } 43 | }; 44 | } 45 | 46 | pub fn BlockLiteral(comptime Context: type) type { 47 | return extern struct { 48 | isa: *anyopaque, 49 | flags: i32, 50 | reserved: i32 = 0, 51 | invoke: *const anyopaque, 52 | descriptor: *const anyopaque, 53 | context: Context, 54 | 55 | fn trivialStaticDescriptor() *const anyopaque { 56 | return TrivialBlockDescriptor.static(@sizeOf(@This())); 57 | } 58 | 59 | fn copyDisposeStaticDescriptor(comptime copy: anytype, comptime dispose: anytype) *const anyopaque { 60 | return CopyDisposeBlockDescriptor(Context).static(@sizeOf(@This()), copy, dispose); 61 | } 62 | 63 | pub fn asBlockWithSignature(self: *@This(), comptime Signature: type) *Block(Signature) { 64 | return @ptrCast(self); 65 | } 66 | 67 | pub fn release(self: *const @This()) void { 68 | _Block_release(self); 69 | } 70 | }; 71 | } 72 | 73 | pub fn BlockLiteralWithSignature(comptime Context: type, comptime Signature: type) type { 74 | // We could also obtain `Context` from `@typeInfo(Signature).@"fn".params[0].type`. 75 | return extern struct { 76 | literal: BlockLiteral(Context), 77 | 78 | pub fn asBlock(self: *@This()) *Block(Signature) { 79 | return self.literal.asBlockWithSignature(Signature); 80 | } 81 | }; 82 | } 83 | 84 | const TrivialBlockDescriptor = extern struct { 85 | reserved: c_ulong = 0, 86 | size: c_ulong, 87 | 88 | fn static(comptime size: c_ulong) *const TrivialBlockDescriptor { 89 | const Static = struct { 90 | const descriptor: TrivialBlockDescriptor = .{ .size = size }; 91 | }; 92 | return &Static.descriptor; 93 | } 94 | }; 95 | 96 | fn CopyDisposeBlockDescriptor(comptime Context: type) type { 97 | return extern struct { 98 | reserved: c_ulong = 0, 99 | size: c_ulong, 100 | copy: *const CopyFn, 101 | dispose: *const DisposeFn, 102 | 103 | pub const CopyFn = fn (dst: *BlockLiteral(Context), src: *const BlockLiteral(Context)) callconv(.C) void; 104 | pub const DisposeFn = fn (block: *const BlockLiteral(Context)) callconv(.C) void; 105 | 106 | fn static(comptime size: c_ulong, comptime copy: CopyFn, comptime dispose: DisposeFn) *const CopyDisposeBlockDescriptor { 107 | const Static = struct { 108 | const descriptor: CopyDisposeBlockDescriptor = .{ 109 | .size = size, 110 | .copy = copy, 111 | .dispose = dispose, 112 | }; 113 | }; 114 | return &Static.descriptor; 115 | } 116 | }; 117 | } 118 | 119 | fn SignatureWithoutBlockLiteral(comptime Signature: type) type { 120 | var type_info = @typeInfo(Signature); 121 | type_info.@"fn".calling_convention = .auto; 122 | type_info.@"fn".params = type_info.@"fn".params[1..]; 123 | return @Type(type_info); 124 | } 125 | 126 | fn validateBlockSignature(comptime Invoke: type, comptime ExpectedLiteralType: type) void { 127 | switch (@typeInfo(Invoke)) { 128 | .@"fn" => |fn_info| { 129 | // TODO: unsure how to write this with latest Zig version 130 | // if (fn_info.calling_convention != .c) { 131 | // @compileError("A block's `invoke` must use the C calling convention"); 132 | // } 133 | 134 | // TODO: should we allow zero params? At the ABI-level it would be fine but I think the compiler might consider it UB. 135 | if (fn_info.params.len == 0 or fn_info.params[0].type != *ExpectedLiteralType) { 136 | @compileError("The first parameter for a block's `invoke` must be a block literal pointer"); 137 | } 138 | }, 139 | else => @compileError("A block's `invoke` must be a function"), 140 | } 141 | } 142 | 143 | pub fn stackBlockLiteral( 144 | invoke: anytype, 145 | context: anytype, 146 | comptime copy: ?fn (dst: *BlockLiteral(@TypeOf(context)), src: *const BlockLiteral(@TypeOf(context))) callconv(.C) void, 147 | comptime dispose: ?fn (block: *const BlockLiteral(@TypeOf(context))) callconv(.C) void, 148 | ) BlockLiteralWithSignature(@TypeOf(context), SignatureWithoutBlockLiteral(@TypeOf(invoke))) { 149 | const Context = @TypeOf(context); 150 | const Literal = BlockLiteral(Context); 151 | comptime { 152 | validateBlockSignature(@TypeOf(invoke), Literal); 153 | if ((copy == null) != (dispose == null)) { 154 | @compileError("Both `copy` and `dispose` must either be null or nonnull"); 155 | } 156 | } 157 | // const has_copy_dispose = if (comptime copy != null and dispose != null) 1 << 25 else 0; 158 | const has_copy_dispose = comptime copy != null and dispose != null; 159 | return .{ 160 | .literal = .{ 161 | .isa = _NSConcreteStackBlock, 162 | .flags = if (has_copy_dispose) 1 << 25 else 0, 163 | .invoke = invoke, 164 | .descriptor = if (has_copy_dispose) Literal.copyDisposeStaticDescriptor(copy, dispose) else Literal.trivialStaticDescriptor(), 165 | .context = context, 166 | }, 167 | }; 168 | } 169 | const _NSConcreteStackBlock = @extern(*anyopaque, .{ 170 | .name = "_NSConcreteStackBlock", 171 | .library_name = if (builtin.target.os.tag == .macos) null else "System", 172 | }); 173 | 174 | pub fn globalBlockLiteral(invoke: anytype, context: anytype) BlockLiteralWithSignature(@TypeOf(context), SignatureWithoutBlockLiteral(@TypeOf(invoke))) { 175 | const Context = @TypeOf(context); 176 | const Literal = BlockLiteral(Context); 177 | comptime { 178 | validateBlockSignature(@TypeOf(invoke), Literal); 179 | } 180 | const block_is_no_escape = 1 << 23; 181 | const block_is_global = 1 << 28; 182 | return .{ 183 | .literal = .{ 184 | .isa = _NSConcreteGlobalBlock, 185 | .flags = block_is_no_escape | block_is_global, 186 | .invoke = invoke, 187 | .descriptor = Literal.trivialStaticDescriptor(), 188 | .context = context, 189 | }, 190 | }; 191 | } 192 | const _NSConcreteGlobalBlock = @extern(*anyopaque, .{ 193 | .name = "_NSConcreteGlobalBlock", 194 | .library_name = if (builtin.target.os.tag == .macos) null else "System", 195 | }); 196 | 197 | pub fn globalBlock(comptime invoke: anytype) *Block(SignatureWithoutBlockLiteral(@TypeOf(invoke))) { 198 | const Static = struct { 199 | const literal = globalBlockLiteral(invoke, {}); 200 | }; 201 | return Static.literal.asBlock(); 202 | } 203 | -------------------------------------------------------------------------------- /metal_manual.zig: -------------------------------------------------------------------------------- 1 | const cf = @import("core_foundation.zig"); 2 | const ns = @import("foundation.zig"); 3 | const objc = @import("objc.zig"); 4 | 5 | // ------------------------------------------------------------------------------------------------ 6 | // Opaque types 7 | 8 | pub const dispatch_data_t = *opaque {}; 9 | pub const dispatch_queue_t = *opaque {}; 10 | pub const IOSurfaceRef = *opaque {}; 11 | 12 | // ------------------------------------------------------------------------------------------------ 13 | // Types 14 | 15 | // MTLCounters.hpp 16 | pub const CommonCounter = *ns.String; 17 | pub const CommonCounterSet = *ns.String; 18 | 19 | // MTLDevice.hpp 20 | pub const DeviceNotificationName = *ns.String; 21 | pub const AutoreleasedComputePipelineReflection = *ComputePipelineReflection; 22 | pub const AutoreleasedRenderPipelineReflection = *RenderPipelineReflection; 23 | pub const Timestamp = u64; 24 | 25 | // MTLLibrary.hpp 26 | pub const AutoreleasedArgument = *Argument; 27 | 28 | // ------------------------------------------------------------------------------------------------ 29 | // Constants 30 | 31 | // MTLCounters.hpp 32 | extern const CounterErrorDomain: ns.ErrorDomain; 33 | 34 | extern const CommonCounterTimestamp: CommonCounter; 35 | extern const CommonCounterTessellationInputPatches: CommonCounter; 36 | extern const CommonCounterVertexInvocations: CommonCounter; 37 | extern const CommonCounterPostTessellationVertexInvocations: CommonCounter; 38 | extern const CommonCounterClipperInvocations: CommonCounter; 39 | extern const CommonCounterClipperPrimitivesOut: CommonCounter; 40 | extern const CommonCounterFragmentInvocations: CommonCounter; 41 | extern const CommonCounterFragmentsPassed: CommonCounter; 42 | extern const CommonCounterComputeKernelInvocations: CommonCounter; 43 | extern const CommonCounterTotalCycles: CommonCounter; 44 | extern const CommonCounterVertexCycles: CommonCounter; 45 | extern const CommonCounterTessellationCycles: CommonCounter; 46 | extern const CommonCounterPostTessellationVertexCycles: CommonCounter; 47 | extern const CommonCounterFragmentCycles: CommonCounter; 48 | extern const CommonCounterRenderTargetWriteCycles: CommonCounter; 49 | 50 | extern const CommonCounterSetTimestamp: CommonCounterSet; 51 | extern const CommonCounterSetStageUtilization: CommonCounterSet; 52 | extern const CommonCounterSetStatistic: CommonCounterSet; 53 | 54 | // MTLDevice.hpp 55 | extern const DeviceWasAddedNotification: DeviceNotificationName; 56 | extern const DeviceRemovalRequestedNotification: DeviceNotificationName; 57 | extern const DeviceWasRemovedNotification: DeviceNotificationName; 58 | 59 | // ------------------------------------------------------------------------------------------------ 60 | // Functions 61 | 62 | // MTLDevice.hpp 63 | extern fn MTLCreateSystemDefaultDevice() ?*Device; 64 | pub const createSystemDefaultDevice = MTLCreateSystemDefaultDevice; 65 | 66 | //extern fn MTLCopyAllDevices() *ns.Array; 67 | //extern fn MTLCopyAllDevicesWithObserver(**ns.Object, DeviceNotificationHandlerBlock) *ns.Array; 68 | //extern fn MTLRemoveDeviceObserver(*ns.Object) void; 69 | 70 | // ------------------------------------------------------------------------------------------------ 71 | // Structs 72 | 73 | // MTLComputeCommandEncoder.hpp 74 | pub const DispatchThreadgroupsIndirectArguments = extern struct { 75 | threadgroupsPerGrid: [3]u32, 76 | 77 | pub fn init(threadgroupsPerGrid: [3]u32) DispatchThreadgroupsIndirectArguments { 78 | return DispatchThreadgroupsIndirectArguments{ .threadgroupsPerGrid = threadgroupsPerGrid }; 79 | } 80 | }; 81 | 82 | pub const StageInRegionIndirectArguments = extern struct { 83 | stageInOrigin: [3]u32, 84 | stageInSize: [3]u32, 85 | 86 | pub fn init(stageInOrigin: [3]u32, stageInSize: [3]u32) StageInRegionIndirectArguments { 87 | return StageInRegionIndirectArguments{ .stageInOrigin = stageInOrigin, .stageInSize = stageInSize }; 88 | } 89 | }; 90 | 91 | // MTLRenderCommandEncoder.hpp 92 | pub const ScissorRect = extern struct { 93 | x: ns.UInteger, 94 | y: ns.UInteger, 95 | width: ns.UInteger, 96 | height: ns.UInteger, 97 | 98 | pub fn init(x: ns.UInteger, y: ns.UInteger, width: ns.UInteger, height: ns.UInteger) ScissorRect { 99 | return ScissorRect{ .x = x, .y = y, .width = width, .height = height }; 100 | } 101 | }; 102 | 103 | pub const Viewport = extern struct { 104 | originX: f64, 105 | originY: f64, 106 | width: f64, 107 | height: f64, 108 | znear: f64, 109 | zfar: f64, 110 | 111 | pub fn init(originX: f64, originY: f64, width: f64, height: f64, znear: f64, zfar: f64) Viewport { 112 | return Viewport{ .originX = originX, .originY = originY, .width = width, .height = height, .znear = znear, .zfar = zfar }; 113 | } 114 | }; 115 | 116 | pub const VertexAmplificationViewMapping = extern struct { 117 | viewportArrayIndexOffset: u32, 118 | renderTargetArrayIndexOffset: u32, 119 | 120 | pub fn init(viewportArrayIndexOffset: u32, renderTargetArrayIndexOffset: u32) VertexAmplificationViewMapping { 121 | return VertexAmplificationViewMapping{ .viewportArrayIndexOffset = viewportArrayIndexOffset, .renderTargetArrayIndexOffset = renderTargetArrayIndexOffset }; 122 | } 123 | }; 124 | 125 | // MTLRenderPass.hpp 126 | pub const ClearColor = extern struct { 127 | red: f64, 128 | green: f64, 129 | blue: f64, 130 | alpha: f64, 131 | 132 | pub fn init(red: f64, green: f64, blue: f64, alpha: f64) ClearColor { 133 | return ClearColor{ .red = red, .green = green, .blue = blue, .alpha = alpha }; 134 | } 135 | }; 136 | 137 | // MTLTexture.hpp 138 | pub const TextureSwizzleChannels = extern struct { 139 | red: TextureSwizzle, 140 | green: TextureSwizzle, 141 | blue: TextureSwizzle, 142 | alpha: TextureSwizzle, 143 | 144 | pub fn init(red: TextureSwizzle, green: TextureSwizzle, blue: TextureSwizzle, alpha: TextureSwizzle) TextureSwizzleChannels { 145 | return TextureSwizzleChannels{ .red = red, .green = green, .blue = blue, .alpha = alpha }; 146 | } 147 | }; 148 | 149 | // MTLTypes.hpp 150 | pub const Origin = extern struct { 151 | x: ns.UInteger, 152 | y: ns.UInteger, 153 | z: ns.UInteger, 154 | 155 | pub fn init(x: ns.UInteger, y: ns.UInteger, z: ns.UInteger) Origin { 156 | return .{ .x = x, .y = y, .z = z }; 157 | } 158 | }; 159 | 160 | pub const Size = extern struct { 161 | width: ns.UInteger, 162 | height: ns.UInteger, 163 | depth: ns.UInteger, 164 | 165 | pub fn init(width: ns.UInteger, height: ns.UInteger, depth: ns.UInteger) Size { 166 | return .{ .width = width, .height = height, .depth = depth }; 167 | } 168 | }; 169 | 170 | pub const Region = extern struct { 171 | origin: Origin, 172 | size: Size, 173 | 174 | pub fn init1d(x: ns.UInteger, width: ns.UInteger) Region { 175 | return .{ .origin = .{ .x = x, .y = 0, .z = 0 }, .size = .{ .width = width, .height = 1, .depth = 1 } }; 176 | } 177 | 178 | pub fn init2d(x: ns.UInteger, y: ns.UInteger, width: ns.UInteger, height: ns.UInteger) Region { 179 | return .{ .origin = .{ .x = x, .y = y, .z = 0 }, .size = .{ .width = width, .height = height, .depth = 1 } }; 180 | } 181 | 182 | pub fn init3d(x: ns.UInteger, y: ns.UInteger, z: ns.UInteger, width: ns.UInteger, height: ns.UInteger, depth: ns.UInteger) Region { 183 | return .{ .origin = .{ .x = x, .y = y, .z = z }, .size = .{ .width = width, .height = height, .depth = depth } }; 184 | } 185 | }; 186 | 187 | pub const SamplePosition = extern struct { 188 | x: f32, 189 | y: f32, 190 | 191 | pub fn init(x: f32, y: f32) SamplePosition { 192 | return .{ .x = x, .y = y }; 193 | } 194 | }; 195 | 196 | pub const Coordinate2D = SamplePosition; 197 | 198 | pub const ResourceID = extern struct { 199 | _impl: u64, 200 | }; 201 | 202 | // MTLCounters.hpp 203 | pub const CounterResultTimestamp = extern struct { timestamp: u64 }; 204 | 205 | pub const CounterResultStageUtilization = extern struct { 206 | totalCycles: u64, 207 | vertexCycles: u64, 208 | tessellationCycles: u64, 209 | postTessellationVertexCycles: u64, 210 | fragmentCycles: u64, 211 | renderTargetCycles: u64, 212 | }; 213 | 214 | pub const CounterResultStatistic = extern struct { 215 | tessellationInputPatches: u64, 216 | vertexInvocations: u64, 217 | postTessellationVertexInvocations: u64, 218 | clipperInvocations: u64, 219 | clipperPrimitivesOut: u64, 220 | fragmentInvocations: u64, 221 | fragmentsPassed: u64, 222 | computeKernelInvocations: u64, 223 | }; 224 | 225 | // MTLDevice.hpp 226 | pub const AccelerationStructureSizes = extern struct { 227 | accelerationStructureSize: ns.UInteger, 228 | buildScratchBufferSize: ns.UInteger, 229 | refitScratchBufferSize: ns.UInteger, 230 | }; 231 | 232 | pub const SizeAndAlign = extern struct { 233 | size: ns.UInteger, 234 | @"align": ns.UInteger, 235 | }; 236 | // ------------------------------------------------------------------------------------------------ 237 | -------------------------------------------------------------------------------- /src/objc.zig: -------------------------------------------------------------------------------- 1 | const builtin = @import("builtin"); 2 | const std = @import("std"); 3 | 4 | // LLVM's documented ARC APIs that technically aren't part of libobjc's public API. 5 | pub const AutoreleasePool = opaque {}; 6 | extern "objc" fn objc_autoreleasePoolPop(pool: *AutoreleasePool) void; 7 | extern "objc" fn objc_autoreleasePoolPush() *AutoreleasePool; 8 | 9 | pub const autoreleasePoolPop = objc_autoreleasePoolPop; 10 | pub const autoreleasePoolPush = objc_autoreleasePoolPush; 11 | 12 | extern "objc" fn objc_autorelease(*Id) *Id; // Same as `[object autorelease]`. 13 | extern "objc" fn objc_release(*Id) void; // Same as `[object release]`. 14 | extern "objc" fn objc_retain(*Id) *Id; // Same as `[object retain]`. 15 | 16 | pub const autorelease = objc_autorelease; 17 | pub const release = objc_release; 18 | pub const retain = objc_retain; 19 | 20 | // APIs that are part of libobjc's public ABI, but not its public API. 21 | extern "objc" fn objc_alloc(class: *Class) ?*Id; // Same as `[Class alloc]`. 22 | extern "objc" fn objc_alloc_init(class: *Class) ?*Id; // Same as `[[Class alloc] init]`. 23 | extern "objc" fn objc_opt_new(class: *Class) ?*Id; // Same as `[Class new]`. 24 | extern "objc" fn objc_opt_class(object: ?*Id) ?*Class; // Same as `[object class]`. 25 | extern "objc" fn objc_opt_isKindOfClass(object: ?*Id, class: ?*Class) bool; // Same as `[object isKindOfClass:class]`. 26 | 27 | pub const alloc = objc_alloc_init; 28 | pub const alloc_init = objc_alloc_init; 29 | pub const opt_new = objc_opt_new; 30 | pub const opt_class = objc_opt_class; 31 | pub const opt_isKindOfClass = objc_opt_isKindOfClass; 32 | 33 | // APIs that are part of libobjc's public API. 34 | pub const Class = opaque {}; 35 | pub const Id = opaque { 36 | pub const InternalInfo = struct { 37 | pub fn canCastTo(comptime Base: type) bool { 38 | return Base == Id; 39 | } 40 | 41 | pub fn as(self: *Id, comptime Base: type) *Base { 42 | if (comptime Base == Id) return self; 43 | @compileError("Cannot cast `Id` to `" ++ @typeName(Base) ++ "`"); 44 | } 45 | }; 46 | pub const as = InternalInfo.as; 47 | pub const retain = objc_retain; 48 | pub const release = objc_release; 49 | pub const autorelease = objc_autorelease; 50 | }; 51 | 52 | /// Calls `objc_msgSend(receiver, selector, args...)` (or `objc_msgSend_stret` if needed). 53 | /// 54 | /// Be careful. The return type and argument types *must* match the Objective-C method's signature. 55 | /// No compile-time verification is performed. 56 | pub fn msgSend(receiver: anytype, comptime selector: []const u8, return_type: type, args: anytype) return_type { 57 | const n_colons = comptime std.mem.count(u8, selector, ":"); 58 | if (comptime n_colons != args.len) { 59 | @compileError(std.fmt.comptimePrint( 60 | "Selector `{s}` has {} argument{s}, but {} were given", 61 | .{ selector, n_colons, (if (n_colons == 1) "" else "s"), args.len }, 62 | )); 63 | } 64 | 65 | // TODO: Consider run-time signature verification if `builtin.mode == .Debug` (or use some other 66 | // toggle). Register the selector, then call `class_getInstanceMethod()` or 67 | // `class_getClassMethod()`, then call `method_getTypeEncoding()`, and then parse the string and 68 | // validate it against `receiver` and `args`. 69 | 70 | const fn_type = comptime init: { 71 | var params: []const std.builtin.Type.Fn.Param = &.{ 72 | .{ 73 | .is_generic = false, 74 | .is_noalias = false, 75 | .type = @TypeOf(receiver), 76 | }, 77 | .{ 78 | .is_generic = false, 79 | .is_noalias = false, 80 | .type = [*:0]c_char, 81 | }, 82 | }; 83 | for (@typeInfo(@TypeOf(args)).@"struct".fields) |field| { 84 | params = params ++ 85 | [_]std.builtin.Type.Fn.Param{.{ 86 | .is_generic = false, 87 | .is_noalias = false, 88 | .type = field.type, 89 | }}; 90 | } 91 | break :init std.builtin.Type{ 92 | .@"fn" = .{ 93 | .calling_convention = std.builtin.CallingConvention.c, 94 | .is_generic = false, 95 | .is_var_args = false, 96 | .return_type = return_type, 97 | .params = params, 98 | }, 99 | }; 100 | }; 101 | 102 | const needs_fpret = comptime builtin.target.cpu.arch == .x86 and (return_type == f32 or return_type == f64); 103 | const needs_stret = comptime builtin.target.cpu.arch == .x86 and @sizeOf(return_type) > 16; 104 | const msg_send_fn_name = comptime if (needs_stret) "objc_msgSend_stret" else if (needs_fpret) "objc_msgSend_fpret" else "objc_msgSend"; 105 | const msg_send_fn = @extern(*const @Type(fn_type), .{ .name = msg_send_fn_name ++ "$" ++ selector }); 106 | return @call(.auto, msg_send_fn, .{ receiver, undefined } ++ args); 107 | } 108 | 109 | pub fn ExternClass(comptime name: []const u8, T: type, SuperType: type, comptime protocols: []const type) type { 110 | return struct { 111 | pub fn class() *Class { 112 | // This global asm lives inside the `class()` function so we only generate it if `class()` is actually called. 113 | const GlobalAsm = struct { 114 | comptime { 115 | // zig fmt: off 116 | asm ( 117 | " .section __DATA,__objc_classrefs,regular,no_dead_strip\n" ++ 118 | " .p2align 3, 0x0\n" ++ 119 | "_OBJC_CLASSLIST_REFERENCES_$_" ++ name ++ ":\n" ++ 120 | " .quad _OBJC_CLASS_$_" ++ name 121 | ); 122 | // zig fmt: on 123 | } 124 | }; 125 | _ = GlobalAsm; 126 | 127 | var ptr: *anyopaque = undefined; 128 | if (comptime builtin.cpu.arch == .x86_64) { 129 | // zig fmt: off 130 | asm ( 131 | "movq _OBJC_CLASSLIST_REFERENCES_$_" ++ name ++ "(%rip), %[ptr]" 132 | : [ptr] "=r" (ptr), 133 | ); 134 | // zig fmt: on 135 | } else { 136 | // zig fmt: off 137 | asm ( 138 | "adrp %[ptr], _OBJC_CLASSLIST_REFERENCES_$_" ++ name ++ "@PAGE\n" ++ 139 | "ldr %[ptr], [%[ptr], _OBJC_CLASSLIST_REFERENCES_$_" ++ name ++ "@PAGEOFF]" 140 | : [ptr] "=r" (ptr), 141 | ); 142 | // zig fmt: on 143 | } 144 | return @ptrCast(ptr); 145 | } 146 | 147 | pub fn canCastTo(comptime Base: type) bool { 148 | if (Base == T) return true; 149 | inline for (protocols) |P| { 150 | if (P.InternalInfo.canCastTo(Base)) return true; 151 | } 152 | return SuperType.InternalInfo.canCastTo(Base); 153 | } 154 | 155 | pub fn as(self: *T, comptime Base: type) *Base { 156 | if (comptime canCastTo(Base)) return @ptrCast(self); 157 | @compileError("Cannot cast `" ++ @typeName(T) ++ "` to `" ++ @typeName(Base) ++ "`"); 158 | } 159 | 160 | pub fn new() *T { 161 | return @ptrCast(opt_new(class())); 162 | } 163 | 164 | pub fn alloc() *T { 165 | return @ptrCast(objc_alloc(class())); 166 | } 167 | 168 | pub fn allocInit() *T { 169 | return @ptrCast(alloc_init(class())); 170 | } 171 | 172 | pub fn retain(self: *T) *T { 173 | return @ptrCast(objc_retain(@ptrCast(self))); 174 | } 175 | 176 | pub fn release(self: *T) void { 177 | return objc_release(@ptrCast(self)); 178 | } 179 | 180 | pub fn autorelease(self: *T) *T { 181 | return @ptrCast(objc_autorelease(@ptrCast(self))); 182 | } 183 | }; 184 | } 185 | 186 | pub fn ExternProtocol(T: type, comptime super_protocols: []const type) type { 187 | return struct { 188 | pub fn canCastTo(comptime Base: type) bool { 189 | if (Base == T) return true; 190 | inline for (super_protocols) |P| { 191 | if (P.InternalInfo.canCastTo(Base)) return true; 192 | } 193 | return false; 194 | } 195 | 196 | pub fn as(self: *T, comptime Base: type) *Base { 197 | if (comptime canCastTo(Base)) return @ptrCast(self); 198 | @compileError("Cannot cast `" ++ @typeName(T) ++ "` to `" ++ @typeName(Base) ++ "`"); 199 | } 200 | 201 | pub fn retain(self: *T) *T { 202 | return @ptrCast(objc_retain(@ptrCast(self))); 203 | } 204 | 205 | pub fn release(self: *T) void { 206 | return objc_release(@ptrCast(self)); 207 | } 208 | 209 | pub fn autorelease(self: *T) *T { 210 | return @ptrCast(objc_autorelease(@ptrCast(self))); 211 | } 212 | }; 213 | } 214 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /src/avf_audio.zig: -------------------------------------------------------------------------------- 1 | const cf = @import("core_foundation.zig"); 2 | const ns = @import("foundation.zig"); 3 | const objc = @import("objc.zig"); 4 | 5 | // ------------------------------------------------------------------------------------------------ 6 | // Types 7 | 8 | pub const AVAudioSessionCategory = *ns.String; 9 | pub const AVAudioSessionMode = *ns.String; 10 | pub const AVAudioSessionPort = *ns.String; 11 | pub const AVAudioSessionPolarPattern = *ns.String; 12 | pub const AVAudioSessionLocation = *ns.String; 13 | pub const AVAudioSessionOrientation = *ns.String; 14 | 15 | pub const AudioChannelLabel = u32; 16 | 17 | pub const AVAudioSessionCategoryOptions = ns.UInteger; 18 | pub const AVAudioSessionCategoryOptionMixWithOthers: AVAudioSessionCategoryOptions = 1; 19 | pub const AVAudioSessionCategoryOptionDuckOthers: AVAudioSessionCategoryOptions = 2; 20 | pub const AVAudioSessionCategoryOptionAllowBluetooth: AVAudioSessionCategoryOptions = 4; 21 | pub const AVAudioSessionCategoryOptionDefaultToSpeaker: AVAudioSessionCategoryOptions = 8; 22 | pub const AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers: AVAudioSessionCategoryOptions = 17; 23 | pub const AVAudioSessionCategoryOptionAllowBluetoothA2DP: AVAudioSessionCategoryOptions = 32; 24 | pub const AVAudioSessionCategoryOptionAllowAirPlay: AVAudioSessionCategoryOptions = 64; 25 | pub const AVAudioSessionCategoryOptionOverrideMutedMicrophoneInterruption: AVAudioSessionCategoryOptions = 128; 26 | 27 | pub const AVAudioSessionRouteSharingPolicy = ns.UInteger; 28 | pub const AVAudioSessionRouteSharingPolicyDefault: AVAudioSessionRouteSharingPolicy = 0; 29 | pub const AVAudioSessionRouteSharingPolicyLongFormAudio: AVAudioSessionRouteSharingPolicy = 1; 30 | pub const AVAudioSessionRouteSharingPolicyLongForm: AVAudioSessionRouteSharingPolicy = 1; 31 | pub const AVAudioSessionRouteSharingPolicyIndependent: AVAudioSessionRouteSharingPolicy = 2; 32 | pub const AVAudioSessionRouteSharingPolicyLongFormVideo: AVAudioSessionRouteSharingPolicy = 3; 33 | 34 | pub const AVAudioSessionPortOverride = ns.UInteger; 35 | pub const AVAudioSessionPortOverrideNone: AVAudioSessionPortOverride = 0; 36 | pub const AVAudioSessionPortOverrideSpeaker: AVAudioSessionPortOverride = 1936747378; 37 | 38 | pub const AVAudioSessionRecordPermission = ns.UInteger; 39 | pub const AVAudioSessionRecordPermissionUndetermined: AVAudioSessionRecordPermission = 1970168948; 40 | pub const AVAudioSessionRecordPermissionDenied: AVAudioSessionRecordPermission = 1684369017; 41 | pub const AVAudioSessionRecordPermissionGranted: AVAudioSessionRecordPermission = 1735552628; 42 | 43 | pub const AVAudioSessionSetActiveOptions = ns.UInteger; 44 | pub const AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation: AVAudioSessionSetActiveOptions = 1; 45 | 46 | pub const AVAudioSessionActivationOptions = ns.UInteger; 47 | pub const AVAudioSessionActivationOptionNone: AVAudioSessionActivationOptions = 0; 48 | 49 | pub const AVAudioStereoOrientation = ns.Integer; 50 | pub const AVAudioStereoOrientationNone: AVAudioStereoOrientation = 0; 51 | pub const AVAudioStereoOrientationPortrait: AVAudioStereoOrientation = 1; 52 | pub const AVAudioStereoOrientationPortraitUpsideDown: AVAudioStereoOrientation = 2; 53 | pub const AVAudioStereoOrientationLandscapeRight: AVAudioStereoOrientation = 3; 54 | pub const AVAudioStereoOrientationLandscapeLeft: AVAudioStereoOrientation = 4; 55 | 56 | pub const AVAudioSessionPromptStyle = ns.UInteger; 57 | pub const AVAudioSessionPromptStyleNone: AVAudioSessionPromptStyle = 1852796517; 58 | pub const AVAudioSessionPromptStyleShort: AVAudioSessionPromptStyle = 1936224884; 59 | pub const AVAudioSessionPromptStyleNormal: AVAudioSessionPromptStyle = 1852992876; 60 | 61 | pub const AVAudioSessionIOType = ns.UInteger; 62 | pub const AVAudioSessionIOTypeNotSpecified: AVAudioSessionIOType = 0; 63 | pub const AVAudioSessionIOTypeAggregated: AVAudioSessionIOType = 1; 64 | 65 | pub const AVAudioSession = opaque { 66 | pub const InternalInfo = objc.ExternClass("AVAudioSession", @This(), ns.ObjectInterface, &.{}); 67 | pub const as = InternalInfo.as; 68 | pub const retain = InternalInfo.retain; 69 | pub const release = InternalInfo.release; 70 | pub const autorelease = InternalInfo.autorelease; 71 | pub const new = InternalInfo.new; 72 | pub const alloc = InternalInfo.alloc; 73 | pub const allocInit = InternalInfo.allocInit; 74 | 75 | pub fn sharedInstance() *AVAudioSession { 76 | return objc.msgSend(@This().InternalInfo.class(), "sharedInstance", *AVAudioSession, .{}); 77 | } 78 | pub fn setCategory_error(self_: *@This(), category_: AVAudioSessionCategory, outError_: ?*?*ns.Error) bool { 79 | return objc.msgSend(self_, "setCategory:error:", bool, .{ category_, outError_ }); 80 | } 81 | pub fn setCategory_withOptions_error(self_: *@This(), category_: AVAudioSessionCategory, options_: AVAudioSessionCategoryOptions, outError_: ?*?*ns.Error) bool { 82 | return objc.msgSend(self_, "setCategory:withOptions:error:", bool, .{ category_, options_, outError_ }); 83 | } 84 | pub fn setCategory_mode_options_error(self_: *@This(), category_: AVAudioSessionCategory, mode_: AVAudioSessionMode, options_: *objc.Id, outError_: ?*?*ns.Error) bool { 85 | return objc.msgSend(self_, "setCategory:mode:options:error:", bool, .{ category_, mode_, options_, outError_ }); 86 | } 87 | pub fn setCategory_mode_routeSharingPolicy_options_error(self_: *@This(), category_: AVAudioSessionCategory, mode_: AVAudioSessionMode, policy_: AVAudioSessionRouteSharingPolicy, options_: AVAudioSessionCategoryOptions, outError_: ?*?*ns.Error) bool { 88 | return objc.msgSend(self_, "setCategory:mode:routeSharingPolicy:options:error:", bool, .{ category_, mode_, policy_, options_, outError_ }); 89 | } 90 | pub fn setMode_error(self_: *@This(), mode_: AVAudioSessionMode, outError_: ?*?*ns.Error) bool { 91 | return objc.msgSend(self_, "setMode:error:", bool, .{ mode_, outError_ }); 92 | } 93 | pub fn setAllowHapticsAndSystemSoundsDuringRecording_error(self_: *@This(), inValue_: bool, outError_: ?*?*ns.Error) bool { 94 | return objc.msgSend(self_, "setAllowHapticsAndSystemSoundsDuringRecording:error:", bool, .{ inValue_, outError_ }); 95 | } 96 | pub fn requestRecordPermission(self_: *@This(), response_: *ns.Block(fn (bool) void)) void { 97 | return objc.msgSend(self_, "requestRecordPermission:", void, .{response_}); 98 | } 99 | pub fn overrideOutputAudioPort_error(self_: *@This(), portOverride_: AVAudioSessionPortOverride, outError_: ?*?*ns.Error) bool { 100 | return objc.msgSend(self_, "overrideOutputAudioPort:error:", bool, .{ portOverride_, outError_ }); 101 | } 102 | pub fn setPreferredInput_error(self_: *@This(), inPort_: ?*AVAudioSessionPortDescription, outError_: ?*?*ns.Error) bool { 103 | return objc.msgSend(self_, "setPreferredInput:error:", bool, .{ inPort_, outError_ }); 104 | } 105 | pub fn setPrefersNoInterruptionsFromSystemAlerts_error(self_: *@This(), inValue_: bool, outError_: ?*?*ns.Error) bool { 106 | return objc.msgSend(self_, "setPrefersNoInterruptionsFromSystemAlerts:error:", bool, .{ inValue_, outError_ }); 107 | } 108 | pub fn availableCategories(self_: *@This()) *ns.Array(AVAudioSessionCategory) { 109 | return objc.msgSend(self_, "availableCategories", *ns.Array(AVAudioSessionCategory), .{}); 110 | } 111 | pub fn category(self_: *@This()) AVAudioSessionCategory { 112 | return objc.msgSend(self_, "category", AVAudioSessionCategory, .{}); 113 | } 114 | pub fn categoryOptions(self_: *@This()) AVAudioSessionCategoryOptions { 115 | return objc.msgSend(self_, "categoryOptions", AVAudioSessionCategoryOptions, .{}); 116 | } 117 | pub fn routeSharingPolicy(self_: *@This()) AVAudioSessionRouteSharingPolicy { 118 | return objc.msgSend(self_, "routeSharingPolicy", AVAudioSessionRouteSharingPolicy, .{}); 119 | } 120 | pub fn availableModes(self_: *@This()) *ns.Array(AVAudioSessionMode) { 121 | return objc.msgSend(self_, "availableModes", *ns.Array(AVAudioSessionMode), .{}); 122 | } 123 | pub fn mode(self_: *@This()) AVAudioSessionMode { 124 | return objc.msgSend(self_, "mode", AVAudioSessionMode, .{}); 125 | } 126 | pub fn allowHapticsAndSystemSoundsDuringRecording(self_: *@This()) bool { 127 | return objc.msgSend(self_, "allowHapticsAndSystemSoundsDuringRecording", bool, .{}); 128 | } 129 | pub fn recordPermission(self_: *@This()) AVAudioSessionRecordPermission { 130 | return objc.msgSend(self_, "recordPermission", AVAudioSessionRecordPermission, .{}); 131 | } 132 | pub fn preferredInput(self_: *@This()) ?*AVAudioSessionPortDescription { 133 | return objc.msgSend(self_, "preferredInput", ?*AVAudioSessionPortDescription, .{}); 134 | } 135 | pub fn prefersNoInterruptionsFromSystemAlerts(self_: *@This()) bool { 136 | return objc.msgSend(self_, "prefersNoInterruptionsFromSystemAlerts", bool, .{}); 137 | } 138 | pub fn setActive_error(self_: *@This(), active_: bool, outError_: ?*?*ns.Error) bool { 139 | return objc.msgSend(self_, "setActive:error:", bool, .{ active_, outError_ }); 140 | } 141 | pub fn setActive_withOptions_error(self_: *@This(), active_: bool, options_: AVAudioSessionSetActiveOptions, outError_: ?*?*ns.Error) bool { 142 | return objc.msgSend(self_, "setActive:withOptions:error:", bool, .{ active_, options_, outError_ }); 143 | } 144 | pub fn activateWithOptions_completionHandler(self_: *@This(), options_: AVAudioSessionActivationOptions, handler_: *ns.Block(fn (bool, ?*ns.Error) void)) void { 145 | return objc.msgSend(self_, "activateWithOptions:completionHandler:", void, .{ options_, handler_ }); 146 | } 147 | pub fn setPreferredSampleRate_error(self_: *@This(), sampleRate_: f64, outError_: ?*?*ns.Error) bool { 148 | return objc.msgSend(self_, "setPreferredSampleRate:error:", bool, .{ sampleRate_, outError_ }); 149 | } 150 | pub fn setPreferredIOBufferDuration_error(self_: *@This(), duration_: ns.TimeInterval, outError_: ?*?*ns.Error) bool { 151 | return objc.msgSend(self_, "setPreferredIOBufferDuration:error:", bool, .{ duration_, outError_ }); 152 | } 153 | pub fn setPreferredInputNumberOfChannels_error(self_: *@This(), count_: ns.Integer, outError_: ?*?*ns.Error) bool { 154 | return objc.msgSend(self_, "setPreferredInputNumberOfChannels:error:", bool, .{ count_, outError_ }); 155 | } 156 | pub fn setPreferredOutputNumberOfChannels_error(self_: *@This(), count_: ns.Integer, outError_: ?*?*ns.Error) bool { 157 | return objc.msgSend(self_, "setPreferredOutputNumberOfChannels:error:", bool, .{ count_, outError_ }); 158 | } 159 | pub fn setPreferredInputOrientation_error(self_: *@This(), orientation_: AVAudioStereoOrientation, outError_: ?*?*ns.Error) bool { 160 | return objc.msgSend(self_, "setPreferredInputOrientation:error:", bool, .{ orientation_, outError_ }); 161 | } 162 | pub fn setInputGain_error(self_: *@This(), gain_: f32, outError_: ?*?*ns.Error) bool { 163 | return objc.msgSend(self_, "setInputGain:error:", bool, .{ gain_, outError_ }); 164 | } 165 | pub fn setInputDataSource_error(self_: *@This(), dataSource_: ?*AVAudioSessionDataSourceDescription, outError_: ?*?*ns.Error) bool { 166 | return objc.msgSend(self_, "setInputDataSource:error:", bool, .{ dataSource_, outError_ }); 167 | } 168 | pub fn setOutputDataSource_error(self_: *@This(), dataSource_: ?*AVAudioSessionDataSourceDescription, outError_: ?*?*ns.Error) bool { 169 | return objc.msgSend(self_, "setOutputDataSource:error:", bool, .{ dataSource_, outError_ }); 170 | } 171 | pub fn preferredSampleRate(self_: *@This()) f64 { 172 | return objc.msgSend(self_, "preferredSampleRate", f64, .{}); 173 | } 174 | pub fn preferredIOBufferDuration(self_: *@This()) ns.TimeInterval { 175 | return objc.msgSend(self_, "preferredIOBufferDuration", ns.TimeInterval, .{}); 176 | } 177 | pub fn preferredInputNumberOfChannels(self_: *@This()) ns.Integer { 178 | return objc.msgSend(self_, "preferredInputNumberOfChannels", ns.Integer, .{}); 179 | } 180 | pub fn preferredOutputNumberOfChannels(self_: *@This()) ns.Integer { 181 | return objc.msgSend(self_, "preferredOutputNumberOfChannels", ns.Integer, .{}); 182 | } 183 | pub fn preferredInputOrientation(self_: *@This()) AVAudioStereoOrientation { 184 | return objc.msgSend(self_, "preferredInputOrientation", AVAudioStereoOrientation, .{}); 185 | } 186 | pub fn inputOrientation(self_: *@This()) AVAudioStereoOrientation { 187 | return objc.msgSend(self_, "inputOrientation", AVAudioStereoOrientation, .{}); 188 | } 189 | pub fn maximumInputNumberOfChannels(self_: *@This()) ns.Integer { 190 | return objc.msgSend(self_, "maximumInputNumberOfChannels", ns.Integer, .{}); 191 | } 192 | pub fn maximumOutputNumberOfChannels(self_: *@This()) ns.Integer { 193 | return objc.msgSend(self_, "maximumOutputNumberOfChannels", ns.Integer, .{}); 194 | } 195 | pub fn inputGain(self_: *@This()) f32 { 196 | return objc.msgSend(self_, "inputGain", f32, .{}); 197 | } 198 | pub fn isInputGainSettable(self_: *@This()) bool { 199 | return objc.msgSend(self_, "isInputGainSettable", bool, .{}); 200 | } 201 | pub fn isInputAvailable(self_: *@This()) bool { 202 | return objc.msgSend(self_, "isInputAvailable", bool, .{}); 203 | } 204 | pub fn inputDataSources(self_: *@This()) *ns.Array(*AVAudioSessionDataSourceDescription) { 205 | return objc.msgSend(self_, "inputDataSources", *ns.Array(*AVAudioSessionDataSourceDescription), .{}); 206 | } 207 | pub fn inputDataSource(self_: *@This()) *AVAudioSessionDataSourceDescription { 208 | return objc.msgSend(self_, "inputDataSource", *AVAudioSessionDataSourceDescription, .{}); 209 | } 210 | pub fn outputDataSources(self_: *@This()) *ns.Array(*AVAudioSessionDataSourceDescription) { 211 | return objc.msgSend(self_, "outputDataSources", *ns.Array(*AVAudioSessionDataSourceDescription), .{}); 212 | } 213 | pub fn outputDataSource(self_: *@This()) *AVAudioSessionDataSourceDescription { 214 | return objc.msgSend(self_, "outputDataSource", *AVAudioSessionDataSourceDescription, .{}); 215 | } 216 | pub fn sampleRate(self_: *@This()) f64 { 217 | return objc.msgSend(self_, "sampleRate", f64, .{}); 218 | } 219 | pub fn inputNumberOfChannels(self_: *@This()) ns.Integer { 220 | return objc.msgSend(self_, "inputNumberOfChannels", ns.Integer, .{}); 221 | } 222 | pub fn outputNumberOfChannels(self_: *@This()) ns.Integer { 223 | return objc.msgSend(self_, "outputNumberOfChannels", ns.Integer, .{}); 224 | } 225 | pub fn inputLatency(self_: *@This()) ns.TimeInterval { 226 | return objc.msgSend(self_, "inputLatency", ns.TimeInterval, .{}); 227 | } 228 | pub fn outputLatency(self_: *@This()) ns.TimeInterval { 229 | return objc.msgSend(self_, "outputLatency", ns.TimeInterval, .{}); 230 | } 231 | pub fn IOBufferDuration(self_: *@This()) ns.TimeInterval { 232 | return objc.msgSend(self_, "IOBufferDuration", ns.TimeInterval, .{}); 233 | } 234 | pub fn isOtherAudioPlaying(self_: *@This()) bool { 235 | return objc.msgSend(self_, "isOtherAudioPlaying", bool, .{}); 236 | } 237 | pub fn secondaryAudioShouldBeSilencedHint(self_: *@This()) bool { 238 | return objc.msgSend(self_, "secondaryAudioShouldBeSilencedHint", bool, .{}); 239 | } 240 | pub fn outputVolume(self_: *@This()) f32 { 241 | return objc.msgSend(self_, "outputVolume", f32, .{}); 242 | } 243 | pub fn promptStyle(self_: *@This()) AVAudioSessionPromptStyle { 244 | return objc.msgSend(self_, "promptStyle", AVAudioSessionPromptStyle, .{}); 245 | } 246 | pub fn setAggregatedIOPreference_error(self_: *@This(), inIOType_: AVAudioSessionIOType, outError_: ?*?*ns.Error) bool { 247 | return objc.msgSend(self_, "setAggregatedIOPreference:error:", bool, .{ inIOType_, outError_ }); 248 | } 249 | pub fn availableInputs(self_: *@This()) *ns.Array(*AVAudioSessionPortDescription) { 250 | return objc.msgSend(self_, "availableInputs", *ns.Array(*AVAudioSessionPortDescription), .{}); 251 | } 252 | pub fn currentRoute(self_: *@This()) *AVAudioSessionRouteDescription { 253 | return objc.msgSend(self_, "currentRoute", *AVAudioSessionRouteDescription, .{}); 254 | } 255 | pub fn setActive_withFlags_error(self_: *@This(), active_: bool, flags_: ns.Integer, outError_: ?*?*ns.Error) bool { 256 | return objc.msgSend(self_, "setActive:withFlags:error:", bool, .{ active_, flags_, outError_ }); 257 | } 258 | pub fn setPreferredHardwareSampleRate_error(self_: *@This(), sampleRate_: f64, outError_: ?*?*ns.Error) bool { 259 | return objc.msgSend(self_, "setPreferredHardwareSampleRate:error:", bool, .{ sampleRate_, outError_ }); 260 | } 261 | pub fn delegate(self_: *@This()) *AVAudioSessionDelegate { 262 | return objc.msgSend(self_, "delegate", *AVAudioSessionDelegate, .{}); 263 | } 264 | pub fn setDelegate(self_: *@This(), delegate_: *AVAudioSessionDelegate) void { 265 | return objc.msgSend(self_, "setDelegate:", void, .{delegate_}); 266 | } 267 | pub fn inputIsAvailable(self_: *@This()) bool { 268 | return objc.msgSend(self_, "inputIsAvailable", bool, .{}); 269 | } 270 | pub fn currentHardwareSampleRate(self_: *@This()) f64 { 271 | return objc.msgSend(self_, "currentHardwareSampleRate", f64, .{}); 272 | } 273 | pub fn currentHardwareInputNumberOfChannels(self_: *@This()) ns.Integer { 274 | return objc.msgSend(self_, "currentHardwareInputNumberOfChannels", ns.Integer, .{}); 275 | } 276 | pub fn currentHardwareOutputNumberOfChannels(self_: *@This()) ns.Integer { 277 | return objc.msgSend(self_, "currentHardwareOutputNumberOfChannels", ns.Integer, .{}); 278 | } 279 | pub fn preferredHardwareSampleRate(self_: *@This()) f64 { 280 | return objc.msgSend(self_, "preferredHardwareSampleRate", f64, .{}); 281 | } 282 | }; 283 | 284 | pub const AVAudioSessionPortDescription = opaque { 285 | pub const InternalInfo = objc.ExternClass("AVAudioSessionPortDescription", @This(), ns.ObjectInterface, &.{}); 286 | pub const as = InternalInfo.as; 287 | pub const retain = InternalInfo.retain; 288 | pub const release = InternalInfo.release; 289 | pub const autorelease = InternalInfo.autorelease; 290 | pub const new = InternalInfo.new; 291 | pub const alloc = InternalInfo.alloc; 292 | pub const allocInit = InternalInfo.allocInit; 293 | 294 | pub fn setPreferredDataSource_error(self_: *@This(), dataSource_: ?*AVAudioSessionDataSourceDescription, outError_: ?*?*ns.Error) bool { 295 | return objc.msgSend(self_, "setPreferredDataSource:error:", bool, .{ dataSource_, outError_ }); 296 | } 297 | pub fn portType(self_: *@This()) AVAudioSessionPort { 298 | return objc.msgSend(self_, "portType", AVAudioSessionPort, .{}); 299 | } 300 | pub fn portName(self_: *@This()) *ns.String { 301 | return objc.msgSend(self_, "portName", *ns.String, .{}); 302 | } 303 | pub fn UID(self_: *@This()) *ns.String { 304 | return objc.msgSend(self_, "UID", *ns.String, .{}); 305 | } 306 | pub fn hasHardwareVoiceCallProcessing(self_: *@This()) bool { 307 | return objc.msgSend(self_, "hasHardwareVoiceCallProcessing", bool, .{}); 308 | } 309 | pub fn isSpatialAudioEnabled(self_: *@This()) bool { 310 | return objc.msgSend(self_, "isSpatialAudioEnabled", bool, .{}); 311 | } 312 | pub fn channels(self_: *@This()) *ns.Array(*AVAudioSessionChannelDescription) { 313 | return objc.msgSend(self_, "channels", *ns.Array(*AVAudioSessionChannelDescription), .{}); 314 | } 315 | pub fn dataSources(self_: *@This()) ?*ns.Array(*AVAudioSessionDataSourceDescription) { 316 | return objc.msgSend(self_, "dataSources", ?*ns.Array(*AVAudioSessionDataSourceDescription), .{}); 317 | } 318 | pub fn selectedDataSource(self_: *@This()) ?*AVAudioSessionDataSourceDescription { 319 | return objc.msgSend(self_, "selectedDataSource", ?*AVAudioSessionDataSourceDescription, .{}); 320 | } 321 | pub fn preferredDataSource(self_: *@This()) ?*AVAudioSessionDataSourceDescription { 322 | return objc.msgSend(self_, "preferredDataSource", ?*AVAudioSessionDataSourceDescription, .{}); 323 | } 324 | }; 325 | 326 | pub const AVAudioSessionDataSourceDescription = opaque { 327 | pub const InternalInfo = objc.ExternClass("AVAudioSessionDataSourceDescription", @This(), ns.ObjectInterface, &.{}); 328 | pub const as = InternalInfo.as; 329 | pub const retain = InternalInfo.retain; 330 | pub const release = InternalInfo.release; 331 | pub const autorelease = InternalInfo.autorelease; 332 | pub const new = InternalInfo.new; 333 | pub const alloc = InternalInfo.alloc; 334 | pub const allocInit = InternalInfo.allocInit; 335 | 336 | pub fn setPreferredPolarPattern_error(self_: *@This(), pattern_: AVAudioSessionPolarPattern, outError_: ?*?*ns.Error) bool { 337 | return objc.msgSend(self_, "setPreferredPolarPattern:error:", bool, .{ pattern_, outError_ }); 338 | } 339 | pub fn dataSourceID(self_: *@This()) *ns.Number { 340 | return objc.msgSend(self_, "dataSourceID", *ns.Number, .{}); 341 | } 342 | pub fn dataSourceName(self_: *@This()) *ns.String { 343 | return objc.msgSend(self_, "dataSourceName", *ns.String, .{}); 344 | } 345 | pub fn location(self_: *@This()) AVAudioSessionLocation { 346 | return objc.msgSend(self_, "location", AVAudioSessionLocation, .{}); 347 | } 348 | pub fn orientation(self_: *@This()) AVAudioSessionOrientation { 349 | return objc.msgSend(self_, "orientation", AVAudioSessionOrientation, .{}); 350 | } 351 | pub fn supportedPolarPatterns(self_: *@This()) ?*ns.Array(AVAudioSessionPolarPattern) { 352 | return objc.msgSend(self_, "supportedPolarPatterns", ?*ns.Array(AVAudioSessionPolarPattern), .{}); 353 | } 354 | pub fn selectedPolarPattern(self_: *@This()) AVAudioSessionPolarPattern { 355 | return objc.msgSend(self_, "selectedPolarPattern", AVAudioSessionPolarPattern, .{}); 356 | } 357 | pub fn preferredPolarPattern(self_: *@This()) AVAudioSessionPolarPattern { 358 | return objc.msgSend(self_, "preferredPolarPattern", AVAudioSessionPolarPattern, .{}); 359 | } 360 | }; 361 | 362 | pub const AVAudioSessionRouteDescription = opaque { 363 | pub const InternalInfo = objc.ExternClass("AVAudioSessionRouteDescription", @This(), ns.ObjectInterface, &.{}); 364 | pub const as = InternalInfo.as; 365 | pub const retain = InternalInfo.retain; 366 | pub const release = InternalInfo.release; 367 | pub const autorelease = InternalInfo.autorelease; 368 | pub const new = InternalInfo.new; 369 | pub const alloc = InternalInfo.alloc; 370 | pub const allocInit = InternalInfo.allocInit; 371 | 372 | pub fn inputs(self_: *@This()) *ns.Array(*AVAudioSessionPortDescription) { 373 | return objc.msgSend(self_, "inputs", *ns.Array(*AVAudioSessionPortDescription), .{}); 374 | } 375 | pub fn outputs(self_: *@This()) *ns.Array(*AVAudioSessionPortDescription) { 376 | return objc.msgSend(self_, "outputs", *ns.Array(*AVAudioSessionPortDescription), .{}); 377 | } 378 | }; 379 | 380 | pub const AVAudioSessionChannelDescription = opaque { 381 | pub const InternalInfo = objc.ExternClass("AVAudioSessionChannelDescription", @This(), ns.ObjectInterface, &.{}); 382 | pub const as = InternalInfo.as; 383 | pub const retain = InternalInfo.retain; 384 | pub const release = InternalInfo.release; 385 | pub const autorelease = InternalInfo.autorelease; 386 | pub const new = InternalInfo.new; 387 | pub const alloc = InternalInfo.alloc; 388 | pub const allocInit = InternalInfo.allocInit; 389 | 390 | pub fn channelName(self_: *@This()) *ns.String { 391 | return objc.msgSend(self_, "channelName", *ns.String, .{}); 392 | } 393 | pub fn owningPortUID(self_: *@This()) *ns.String { 394 | return objc.msgSend(self_, "owningPortUID", *ns.String, .{}); 395 | } 396 | pub fn channelNumber(self_: *@This()) ns.UInteger { 397 | return objc.msgSend(self_, "channelNumber", ns.UInteger, .{}); 398 | } 399 | pub fn channelLabel(self_: *@This()) AudioChannelLabel { 400 | return objc.msgSend(self_, "channelLabel", AudioChannelLabel, .{}); 401 | } 402 | }; 403 | 404 | pub const AVAudioSessionDelegate = opaque { 405 | pub const InternalInfo = objc.ExternProtocol(@This(), &.{}); 406 | pub const as = InternalInfo.as; 407 | pub const retain = InternalInfo.retain; 408 | pub const release = InternalInfo.release; 409 | pub const autorelease = InternalInfo.autorelease; 410 | 411 | pub fn beginInterruption(self_: *@This()) void { 412 | return objc.msgSend(self_, "beginInterruption", void, .{}); 413 | } 414 | pub fn endInterruptionWithFlags(self_: *@This(), flags_: ns.UInteger) void { 415 | return objc.msgSend(self_, "endInterruptionWithFlags:", void, .{flags_}); 416 | } 417 | pub fn endInterruption(self_: *@This()) void { 418 | return objc.msgSend(self_, "endInterruption", void, .{}); 419 | } 420 | pub fn inputIsAvailableChanged(self_: *@This(), isInputAvailable_: bool) void { 421 | return objc.msgSend(self_, "inputIsAvailableChanged:", void, .{isInputAvailable_}); 422 | } 423 | }; 424 | -------------------------------------------------------------------------------- /MACHAppDelegate_x86_64_apple_macos12.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .build_version macos, 12, 0 3 | .private_extern "-[MACHAppDelegate setRunBlock:]" 4 | .globl "-[MACHAppDelegate setRunBlock:]" 5 | "-[MACHAppDelegate setRunBlock:]": 6 | .cfi_startproc 7 | pushq %rbx 8 | .cfi_def_cfa_offset 16 9 | .cfi_offset %rbx, -16 10 | testq %rdi, %rdi 11 | je LBB0_1 12 | movq %rdi, %rbx 13 | movq %rsi, %rdi 14 | callq _objc_retainBlock 15 | movq 8(%rbx), %rdi 16 | movq %rax, 8(%rbx) 17 | popq %rbx 18 | jmpq *_objc_release@GOTPCREL(%rip) 19 | LBB0_1: 20 | popq %rbx 21 | retq 22 | .cfi_endproc 23 | 24 | "-[MACHAppDelegate applicationDidFinishLaunching:]": 25 | 26 | .cfi_startproc 27 | movq 8(%rdi), %rdi 28 | testq %rdi, %rdi 29 | je LBB1_1 30 | jmpq *16(%rdi) 31 | LBB1_1: 32 | retq 33 | .cfi_endproc 34 | 35 | "-[MACHAppDelegate applicationShouldTerminate:]": 36 | 37 | .cfi_startproc 38 | xorl %eax, %eax 39 | retq 40 | .cfi_endproc 41 | 42 | "-[MACHAppDelegate applicationShouldTerminateAfterLastWindowClosed:]": 43 | 44 | .cfi_startproc 45 | movl $1, %eax 46 | retq 47 | .cfi_endproc 48 | 49 | "-[MACHAppDelegate .cxx_destruct]": 50 | 51 | .cfi_startproc 52 | addq $8, %rdi 53 | xorl %esi, %esi 54 | jmp _objc_storeStrong 55 | .cfi_endproc 56 | 57 | .section __TEXT,__objc_classname,cstring_literals 58 | L_OBJC_CLASS_NAME_: 59 | .asciz "MACHAppDelegate" 60 | 61 | L_OBJC_CLASS_NAME_.1: 62 | .asciz "NSApplicationDelegate" 63 | 64 | L_OBJC_CLASS_NAME_.2: 65 | .asciz "NSObject" 66 | 67 | .section __TEXT,__objc_methname,cstring_literals 68 | L_OBJC_METH_VAR_NAME_: 69 | .asciz "isEqual:" 70 | 71 | .section __TEXT,__objc_methtype,cstring_literals 72 | L_OBJC_METH_VAR_TYPE_: 73 | .asciz "c24@0:8@16" 74 | 75 | .section __TEXT,__objc_methname,cstring_literals 76 | L_OBJC_METH_VAR_NAME_.3: 77 | .asciz "class" 78 | 79 | .section __TEXT,__objc_methtype,cstring_literals 80 | L_OBJC_METH_VAR_TYPE_.4: 81 | .asciz "#16@0:8" 82 | 83 | .section __TEXT,__objc_methname,cstring_literals 84 | L_OBJC_METH_VAR_NAME_.5: 85 | .asciz "self" 86 | 87 | .section __TEXT,__objc_methtype,cstring_literals 88 | L_OBJC_METH_VAR_TYPE_.6: 89 | .asciz "@16@0:8" 90 | 91 | .section __TEXT,__objc_methname,cstring_literals 92 | L_OBJC_METH_VAR_NAME_.7: 93 | .asciz "performSelector:" 94 | 95 | .section __TEXT,__objc_methtype,cstring_literals 96 | L_OBJC_METH_VAR_TYPE_.8: 97 | .asciz "@24@0:8:16" 98 | 99 | .section __TEXT,__objc_methname,cstring_literals 100 | L_OBJC_METH_VAR_NAME_.9: 101 | .asciz "performSelector:withObject:" 102 | 103 | .section __TEXT,__objc_methtype,cstring_literals 104 | L_OBJC_METH_VAR_TYPE_.10: 105 | .asciz "@32@0:8:16@24" 106 | 107 | .section __TEXT,__objc_methname,cstring_literals 108 | L_OBJC_METH_VAR_NAME_.11: 109 | .asciz "performSelector:withObject:withObject:" 110 | 111 | .section __TEXT,__objc_methtype,cstring_literals 112 | L_OBJC_METH_VAR_TYPE_.12: 113 | .asciz "@40@0:8:16@24@32" 114 | 115 | .section __TEXT,__objc_methname,cstring_literals 116 | L_OBJC_METH_VAR_NAME_.13: 117 | .asciz "isProxy" 118 | 119 | .section __TEXT,__objc_methtype,cstring_literals 120 | L_OBJC_METH_VAR_TYPE_.14: 121 | .asciz "c16@0:8" 122 | 123 | .section __TEXT,__objc_methname,cstring_literals 124 | L_OBJC_METH_VAR_NAME_.15: 125 | .asciz "isKindOfClass:" 126 | 127 | .section __TEXT,__objc_methtype,cstring_literals 128 | L_OBJC_METH_VAR_TYPE_.16: 129 | .asciz "c24@0:8#16" 130 | 131 | .section __TEXT,__objc_methname,cstring_literals 132 | L_OBJC_METH_VAR_NAME_.17: 133 | .asciz "isMemberOfClass:" 134 | 135 | L_OBJC_METH_VAR_NAME_.18: 136 | .asciz "conformsToProtocol:" 137 | 138 | L_OBJC_METH_VAR_NAME_.19: 139 | .asciz "respondsToSelector:" 140 | 141 | .section __TEXT,__objc_methtype,cstring_literals 142 | L_OBJC_METH_VAR_TYPE_.20: 143 | .asciz "c24@0:8:16" 144 | 145 | .section __TEXT,__objc_methname,cstring_literals 146 | L_OBJC_METH_VAR_NAME_.21: 147 | .asciz "retain" 148 | 149 | L_OBJC_METH_VAR_NAME_.22: 150 | .asciz "release" 151 | 152 | .section __TEXT,__objc_methtype,cstring_literals 153 | L_OBJC_METH_VAR_TYPE_.23: 154 | .asciz "Vv16@0:8" 155 | 156 | .section __TEXT,__objc_methname,cstring_literals 157 | L_OBJC_METH_VAR_NAME_.24: 158 | .asciz "autorelease" 159 | 160 | L_OBJC_METH_VAR_NAME_.25: 161 | .asciz "retainCount" 162 | 163 | .section __TEXT,__objc_methtype,cstring_literals 164 | L_OBJC_METH_VAR_TYPE_.26: 165 | .asciz "Q16@0:8" 166 | 167 | .section __TEXT,__objc_methname,cstring_literals 168 | L_OBJC_METH_VAR_NAME_.27: 169 | .asciz "zone" 170 | 171 | .section __TEXT,__objc_methtype,cstring_literals 172 | L_OBJC_METH_VAR_TYPE_.28: 173 | .asciz "^{_NSZone=}16@0:8" 174 | 175 | .section __TEXT,__objc_methname,cstring_literals 176 | L_OBJC_METH_VAR_NAME_.29: 177 | .asciz "hash" 178 | 179 | L_OBJC_METH_VAR_NAME_.30: 180 | .asciz "superclass" 181 | 182 | L_OBJC_METH_VAR_NAME_.31: 183 | .asciz "description" 184 | 185 | .section __DATA,__objc_const 186 | .p2align 3, 0x0 187 | __OBJC_$_PROTOCOL_INSTANCE_METHODS_NSObject: 188 | .long 24 189 | .long 19 190 | .quad L_OBJC_METH_VAR_NAME_ 191 | .quad L_OBJC_METH_VAR_TYPE_ 192 | .quad 0 193 | .quad L_OBJC_METH_VAR_NAME_.3 194 | .quad L_OBJC_METH_VAR_TYPE_.4 195 | .quad 0 196 | .quad L_OBJC_METH_VAR_NAME_.5 197 | .quad L_OBJC_METH_VAR_TYPE_.6 198 | .quad 0 199 | .quad L_OBJC_METH_VAR_NAME_.7 200 | .quad L_OBJC_METH_VAR_TYPE_.8 201 | .quad 0 202 | .quad L_OBJC_METH_VAR_NAME_.9 203 | .quad L_OBJC_METH_VAR_TYPE_.10 204 | .quad 0 205 | .quad L_OBJC_METH_VAR_NAME_.11 206 | .quad L_OBJC_METH_VAR_TYPE_.12 207 | .quad 0 208 | .quad L_OBJC_METH_VAR_NAME_.13 209 | .quad L_OBJC_METH_VAR_TYPE_.14 210 | .quad 0 211 | .quad L_OBJC_METH_VAR_NAME_.15 212 | .quad L_OBJC_METH_VAR_TYPE_.16 213 | .quad 0 214 | .quad L_OBJC_METH_VAR_NAME_.17 215 | .quad L_OBJC_METH_VAR_TYPE_.16 216 | .quad 0 217 | .quad L_OBJC_METH_VAR_NAME_.18 218 | .quad L_OBJC_METH_VAR_TYPE_ 219 | .quad 0 220 | .quad L_OBJC_METH_VAR_NAME_.19 221 | .quad L_OBJC_METH_VAR_TYPE_.20 222 | .quad 0 223 | .quad L_OBJC_METH_VAR_NAME_.21 224 | .quad L_OBJC_METH_VAR_TYPE_.6 225 | .quad 0 226 | .quad L_OBJC_METH_VAR_NAME_.22 227 | .quad L_OBJC_METH_VAR_TYPE_.23 228 | .quad 0 229 | .quad L_OBJC_METH_VAR_NAME_.24 230 | .quad L_OBJC_METH_VAR_TYPE_.6 231 | .quad 0 232 | .quad L_OBJC_METH_VAR_NAME_.25 233 | .quad L_OBJC_METH_VAR_TYPE_.26 234 | .quad 0 235 | .quad L_OBJC_METH_VAR_NAME_.27 236 | .quad L_OBJC_METH_VAR_TYPE_.28 237 | .quad 0 238 | .quad L_OBJC_METH_VAR_NAME_.29 239 | .quad L_OBJC_METH_VAR_TYPE_.26 240 | .quad 0 241 | .quad L_OBJC_METH_VAR_NAME_.30 242 | .quad L_OBJC_METH_VAR_TYPE_.4 243 | .quad 0 244 | .quad L_OBJC_METH_VAR_NAME_.31 245 | .quad L_OBJC_METH_VAR_TYPE_.6 246 | .quad 0 247 | 248 | .section __TEXT,__objc_methname,cstring_literals 249 | L_OBJC_METH_VAR_NAME_.32: 250 | .asciz "debugDescription" 251 | 252 | .section __DATA,__objc_const 253 | .p2align 3, 0x0 254 | __OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT_NSObject: 255 | .long 24 256 | .long 1 257 | .quad L_OBJC_METH_VAR_NAME_.32 258 | .quad L_OBJC_METH_VAR_TYPE_.6 259 | .quad 0 260 | 261 | .section __TEXT,__objc_methname,cstring_literals 262 | L_OBJC_PROP_NAME_ATTR_: 263 | .asciz "hash" 264 | 265 | L_OBJC_PROP_NAME_ATTR_.33: 266 | .asciz "TQ,R" 267 | 268 | L_OBJC_PROP_NAME_ATTR_.34: 269 | .asciz "superclass" 270 | 271 | L_OBJC_PROP_NAME_ATTR_.35: 272 | .asciz "T#,R" 273 | 274 | L_OBJC_PROP_NAME_ATTR_.36: 275 | .asciz "description" 276 | 277 | L_OBJC_PROP_NAME_ATTR_.37: 278 | .asciz "T@\"NSString\",R,C" 279 | 280 | L_OBJC_PROP_NAME_ATTR_.38: 281 | .asciz "debugDescription" 282 | 283 | L_OBJC_PROP_NAME_ATTR_.39: 284 | .asciz "T@\"NSString\",?,R,C" 285 | 286 | .section __DATA,__objc_const 287 | .p2align 3, 0x0 288 | __OBJC_$_PROP_LIST_NSObject: 289 | .long 16 290 | .long 4 291 | .quad L_OBJC_PROP_NAME_ATTR_ 292 | .quad L_OBJC_PROP_NAME_ATTR_.33 293 | .quad L_OBJC_PROP_NAME_ATTR_.34 294 | .quad L_OBJC_PROP_NAME_ATTR_.35 295 | .quad L_OBJC_PROP_NAME_ATTR_.36 296 | .quad L_OBJC_PROP_NAME_ATTR_.37 297 | .quad L_OBJC_PROP_NAME_ATTR_.38 298 | .quad L_OBJC_PROP_NAME_ATTR_.39 299 | 300 | .section __TEXT,__objc_methtype,cstring_literals 301 | L_OBJC_METH_VAR_TYPE_.40: 302 | .asciz "c24@0:8@\"Protocol\"16" 303 | 304 | L_OBJC_METH_VAR_TYPE_.41: 305 | .asciz "@\"NSString\"16@0:8" 306 | 307 | .section __DATA,__objc_const 308 | .p2align 3, 0x0 309 | __OBJC_$_PROTOCOL_METHOD_TYPES_NSObject: 310 | .quad L_OBJC_METH_VAR_TYPE_ 311 | .quad L_OBJC_METH_VAR_TYPE_.4 312 | .quad L_OBJC_METH_VAR_TYPE_.6 313 | .quad L_OBJC_METH_VAR_TYPE_.8 314 | .quad L_OBJC_METH_VAR_TYPE_.10 315 | .quad L_OBJC_METH_VAR_TYPE_.12 316 | .quad L_OBJC_METH_VAR_TYPE_.14 317 | .quad L_OBJC_METH_VAR_TYPE_.16 318 | .quad L_OBJC_METH_VAR_TYPE_.16 319 | .quad L_OBJC_METH_VAR_TYPE_.40 320 | .quad L_OBJC_METH_VAR_TYPE_.20 321 | .quad L_OBJC_METH_VAR_TYPE_.6 322 | .quad L_OBJC_METH_VAR_TYPE_.23 323 | .quad L_OBJC_METH_VAR_TYPE_.6 324 | .quad L_OBJC_METH_VAR_TYPE_.26 325 | .quad L_OBJC_METH_VAR_TYPE_.28 326 | .quad L_OBJC_METH_VAR_TYPE_.26 327 | .quad L_OBJC_METH_VAR_TYPE_.4 328 | .quad L_OBJC_METH_VAR_TYPE_.41 329 | .quad L_OBJC_METH_VAR_TYPE_.41 330 | 331 | .private_extern __OBJC_PROTOCOL_$_NSObject 332 | .section __DATA,__data 333 | .globl __OBJC_PROTOCOL_$_NSObject 334 | .weak_definition __OBJC_PROTOCOL_$_NSObject 335 | .p2align 3, 0x0 336 | __OBJC_PROTOCOL_$_NSObject: 337 | .quad 0 338 | .quad L_OBJC_CLASS_NAME_.2 339 | .quad 0 340 | .quad __OBJC_$_PROTOCOL_INSTANCE_METHODS_NSObject 341 | .quad 0 342 | .quad __OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT_NSObject 343 | .quad 0 344 | .quad __OBJC_$_PROP_LIST_NSObject 345 | .long 96 346 | .long 0 347 | .quad __OBJC_$_PROTOCOL_METHOD_TYPES_NSObject 348 | .quad 0 349 | .quad 0 350 | 351 | .private_extern __OBJC_LABEL_PROTOCOL_$_NSObject 352 | .section __DATA,__objc_protolist,coalesced,no_dead_strip 353 | .globl __OBJC_LABEL_PROTOCOL_$_NSObject 354 | .weak_definition __OBJC_LABEL_PROTOCOL_$_NSObject 355 | .p2align 3, 0x0 356 | __OBJC_LABEL_PROTOCOL_$_NSObject: 357 | .quad __OBJC_PROTOCOL_$_NSObject 358 | 359 | .section __DATA,__objc_const 360 | .p2align 3, 0x0 361 | __OBJC_$_PROTOCOL_REFS_NSApplicationDelegate: 362 | .quad 1 363 | .quad __OBJC_PROTOCOL_$_NSObject 364 | .quad 0 365 | 366 | .section __TEXT,__objc_methname,cstring_literals 367 | L_OBJC_METH_VAR_NAME_.42: 368 | .asciz "applicationShouldTerminate:" 369 | 370 | .section __TEXT,__objc_methtype,cstring_literals 371 | L_OBJC_METH_VAR_TYPE_.43: 372 | .asciz "Q24@0:8@16" 373 | 374 | .section __TEXT,__objc_methname,cstring_literals 375 | L_OBJC_METH_VAR_NAME_.44: 376 | .asciz "application:openURLs:" 377 | 378 | .section __TEXT,__objc_methtype,cstring_literals 379 | L_OBJC_METH_VAR_TYPE_.45: 380 | .asciz "v32@0:8@16@24" 381 | 382 | .section __TEXT,__objc_methname,cstring_literals 383 | L_OBJC_METH_VAR_NAME_.46: 384 | .asciz "application:openFile:" 385 | 386 | .section __TEXT,__objc_methtype,cstring_literals 387 | L_OBJC_METH_VAR_TYPE_.47: 388 | .asciz "c32@0:8@16@24" 389 | 390 | .section __TEXT,__objc_methname,cstring_literals 391 | L_OBJC_METH_VAR_NAME_.48: 392 | .asciz "application:openFiles:" 393 | 394 | L_OBJC_METH_VAR_NAME_.49: 395 | .asciz "application:openTempFile:" 396 | 397 | L_OBJC_METH_VAR_NAME_.50: 398 | .asciz "applicationShouldOpenUntitledFile:" 399 | 400 | L_OBJC_METH_VAR_NAME_.51: 401 | .asciz "applicationOpenUntitledFile:" 402 | 403 | L_OBJC_METH_VAR_NAME_.52: 404 | .asciz "application:openFileWithoutUI:" 405 | 406 | L_OBJC_METH_VAR_NAME_.53: 407 | .asciz "application:printFile:" 408 | 409 | L_OBJC_METH_VAR_NAME_.54: 410 | .asciz "application:printFiles:withSettings:showPrintPanels:" 411 | 412 | .section __TEXT,__objc_methtype,cstring_literals 413 | L_OBJC_METH_VAR_TYPE_.55: 414 | .asciz "Q44@0:8@16@24@32c40" 415 | 416 | .section __TEXT,__objc_methname,cstring_literals 417 | L_OBJC_METH_VAR_NAME_.56: 418 | .asciz "applicationShouldTerminateAfterLastWindowClosed:" 419 | 420 | L_OBJC_METH_VAR_NAME_.57: 421 | .asciz "applicationShouldHandleReopen:hasVisibleWindows:" 422 | 423 | .section __TEXT,__objc_methtype,cstring_literals 424 | L_OBJC_METH_VAR_TYPE_.58: 425 | .asciz "c28@0:8@16c24" 426 | 427 | .section __TEXT,__objc_methname,cstring_literals 428 | L_OBJC_METH_VAR_NAME_.59: 429 | .asciz "applicationDockMenu:" 430 | 431 | .section __TEXT,__objc_methtype,cstring_literals 432 | L_OBJC_METH_VAR_TYPE_.60: 433 | .asciz "@24@0:8@16" 434 | 435 | .section __TEXT,__objc_methname,cstring_literals 436 | L_OBJC_METH_VAR_NAME_.61: 437 | .asciz "application:willPresentError:" 438 | 439 | .section __TEXT,__objc_methtype,cstring_literals 440 | L_OBJC_METH_VAR_TYPE_.62: 441 | .asciz "@32@0:8@16@24" 442 | 443 | .section __TEXT,__objc_methname,cstring_literals 444 | L_OBJC_METH_VAR_NAME_.63: 445 | .asciz "application:didRegisterForRemoteNotificationsWithDeviceToken:" 446 | 447 | L_OBJC_METH_VAR_NAME_.64: 448 | .asciz "application:didFailToRegisterForRemoteNotificationsWithError:" 449 | 450 | L_OBJC_METH_VAR_NAME_.65: 451 | .asciz "application:didReceiveRemoteNotification:" 452 | 453 | L_OBJC_METH_VAR_NAME_.66: 454 | .asciz "applicationSupportsSecureRestorableState:" 455 | 456 | L_OBJC_METH_VAR_NAME_.67: 457 | .asciz "application:handlerForIntent:" 458 | 459 | L_OBJC_METH_VAR_NAME_.68: 460 | .asciz "application:willEncodeRestorableState:" 461 | 462 | L_OBJC_METH_VAR_NAME_.69: 463 | .asciz "application:didDecodeRestorableState:" 464 | 465 | L_OBJC_METH_VAR_NAME_.70: 466 | .asciz "application:willContinueUserActivityWithType:" 467 | 468 | L_OBJC_METH_VAR_NAME_.71: 469 | .asciz "application:continueUserActivity:restorationHandler:" 470 | 471 | .section __TEXT,__objc_methtype,cstring_literals 472 | L_OBJC_METH_VAR_TYPE_.72: 473 | .asciz "c40@0:8@16@24@?32" 474 | 475 | .section __TEXT,__objc_methname,cstring_literals 476 | L_OBJC_METH_VAR_NAME_.73: 477 | .asciz "application:didFailToContinueUserActivityWithType:error:" 478 | 479 | .section __TEXT,__objc_methtype,cstring_literals 480 | L_OBJC_METH_VAR_TYPE_.74: 481 | .asciz "v40@0:8@16@24@32" 482 | 483 | .section __TEXT,__objc_methname,cstring_literals 484 | L_OBJC_METH_VAR_NAME_.75: 485 | .asciz "application:didUpdateUserActivity:" 486 | 487 | L_OBJC_METH_VAR_NAME_.76: 488 | .asciz "application:userDidAcceptCloudKitShareWithMetadata:" 489 | 490 | L_OBJC_METH_VAR_NAME_.77: 491 | .asciz "application:delegateHandlesKey:" 492 | 493 | L_OBJC_METH_VAR_NAME_.78: 494 | .asciz "applicationShouldAutomaticallyLocalizeKeyEquivalents:" 495 | 496 | L_OBJC_METH_VAR_NAME_.79: 497 | .asciz "applicationWillFinishLaunching:" 498 | 499 | .section __TEXT,__objc_methtype,cstring_literals 500 | L_OBJC_METH_VAR_TYPE_.80: 501 | .asciz "v24@0:8@16" 502 | 503 | .section __TEXT,__objc_methname,cstring_literals 504 | L_OBJC_METH_VAR_NAME_.81: 505 | .asciz "applicationDidFinishLaunching:" 506 | 507 | L_OBJC_METH_VAR_NAME_.82: 508 | .asciz "applicationWillHide:" 509 | 510 | L_OBJC_METH_VAR_NAME_.83: 511 | .asciz "applicationDidHide:" 512 | 513 | L_OBJC_METH_VAR_NAME_.84: 514 | .asciz "applicationWillUnhide:" 515 | 516 | L_OBJC_METH_VAR_NAME_.85: 517 | .asciz "applicationDidUnhide:" 518 | 519 | L_OBJC_METH_VAR_NAME_.86: 520 | .asciz "applicationWillBecomeActive:" 521 | 522 | L_OBJC_METH_VAR_NAME_.87: 523 | .asciz "applicationDidBecomeActive:" 524 | 525 | L_OBJC_METH_VAR_NAME_.88: 526 | .asciz "applicationWillResignActive:" 527 | 528 | L_OBJC_METH_VAR_NAME_.89: 529 | .asciz "applicationDidResignActive:" 530 | 531 | L_OBJC_METH_VAR_NAME_.90: 532 | .asciz "applicationWillUpdate:" 533 | 534 | L_OBJC_METH_VAR_NAME_.91: 535 | .asciz "applicationDidUpdate:" 536 | 537 | L_OBJC_METH_VAR_NAME_.92: 538 | .asciz "applicationWillTerminate:" 539 | 540 | L_OBJC_METH_VAR_NAME_.93: 541 | .asciz "applicationDidChangeScreenParameters:" 542 | 543 | L_OBJC_METH_VAR_NAME_.94: 544 | .asciz "applicationDidChangeOcclusionState:" 545 | 546 | L_OBJC_METH_VAR_NAME_.95: 547 | .asciz "applicationProtectedDataWillBecomeUnavailable:" 548 | 549 | L_OBJC_METH_VAR_NAME_.96: 550 | .asciz "applicationProtectedDataDidBecomeAvailable:" 551 | 552 | .section __DATA,__objc_const 553 | .p2align 3, 0x0 554 | __OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT_NSApplicationDelegate: 555 | .long 24 556 | .long 45 557 | .quad L_OBJC_METH_VAR_NAME_.42 558 | .quad L_OBJC_METH_VAR_TYPE_.43 559 | .quad 0 560 | .quad L_OBJC_METH_VAR_NAME_.44 561 | .quad L_OBJC_METH_VAR_TYPE_.45 562 | .quad 0 563 | .quad L_OBJC_METH_VAR_NAME_.46 564 | .quad L_OBJC_METH_VAR_TYPE_.47 565 | .quad 0 566 | .quad L_OBJC_METH_VAR_NAME_.48 567 | .quad L_OBJC_METH_VAR_TYPE_.45 568 | .quad 0 569 | .quad L_OBJC_METH_VAR_NAME_.49 570 | .quad L_OBJC_METH_VAR_TYPE_.47 571 | .quad 0 572 | .quad L_OBJC_METH_VAR_NAME_.50 573 | .quad L_OBJC_METH_VAR_TYPE_ 574 | .quad 0 575 | .quad L_OBJC_METH_VAR_NAME_.51 576 | .quad L_OBJC_METH_VAR_TYPE_ 577 | .quad 0 578 | .quad L_OBJC_METH_VAR_NAME_.52 579 | .quad L_OBJC_METH_VAR_TYPE_.47 580 | .quad 0 581 | .quad L_OBJC_METH_VAR_NAME_.53 582 | .quad L_OBJC_METH_VAR_TYPE_.47 583 | .quad 0 584 | .quad L_OBJC_METH_VAR_NAME_.54 585 | .quad L_OBJC_METH_VAR_TYPE_.55 586 | .quad 0 587 | .quad L_OBJC_METH_VAR_NAME_.56 588 | .quad L_OBJC_METH_VAR_TYPE_ 589 | .quad 0 590 | .quad L_OBJC_METH_VAR_NAME_.57 591 | .quad L_OBJC_METH_VAR_TYPE_.58 592 | .quad 0 593 | .quad L_OBJC_METH_VAR_NAME_.59 594 | .quad L_OBJC_METH_VAR_TYPE_.60 595 | .quad 0 596 | .quad L_OBJC_METH_VAR_NAME_.61 597 | .quad L_OBJC_METH_VAR_TYPE_.62 598 | .quad 0 599 | .quad L_OBJC_METH_VAR_NAME_.63 600 | .quad L_OBJC_METH_VAR_TYPE_.45 601 | .quad 0 602 | .quad L_OBJC_METH_VAR_NAME_.64 603 | .quad L_OBJC_METH_VAR_TYPE_.45 604 | .quad 0 605 | .quad L_OBJC_METH_VAR_NAME_.65 606 | .quad L_OBJC_METH_VAR_TYPE_.45 607 | .quad 0 608 | .quad L_OBJC_METH_VAR_NAME_.66 609 | .quad L_OBJC_METH_VAR_TYPE_ 610 | .quad 0 611 | .quad L_OBJC_METH_VAR_NAME_.67 612 | .quad L_OBJC_METH_VAR_TYPE_.62 613 | .quad 0 614 | .quad L_OBJC_METH_VAR_NAME_.68 615 | .quad L_OBJC_METH_VAR_TYPE_.45 616 | .quad 0 617 | .quad L_OBJC_METH_VAR_NAME_.69 618 | .quad L_OBJC_METH_VAR_TYPE_.45 619 | .quad 0 620 | .quad L_OBJC_METH_VAR_NAME_.70 621 | .quad L_OBJC_METH_VAR_TYPE_.47 622 | .quad 0 623 | .quad L_OBJC_METH_VAR_NAME_.71 624 | .quad L_OBJC_METH_VAR_TYPE_.72 625 | .quad 0 626 | .quad L_OBJC_METH_VAR_NAME_.73 627 | .quad L_OBJC_METH_VAR_TYPE_.74 628 | .quad 0 629 | .quad L_OBJC_METH_VAR_NAME_.75 630 | .quad L_OBJC_METH_VAR_TYPE_.45 631 | .quad 0 632 | .quad L_OBJC_METH_VAR_NAME_.76 633 | .quad L_OBJC_METH_VAR_TYPE_.45 634 | .quad 0 635 | .quad L_OBJC_METH_VAR_NAME_.77 636 | .quad L_OBJC_METH_VAR_TYPE_.47 637 | .quad 0 638 | .quad L_OBJC_METH_VAR_NAME_.78 639 | .quad L_OBJC_METH_VAR_TYPE_ 640 | .quad 0 641 | .quad L_OBJC_METH_VAR_NAME_.79 642 | .quad L_OBJC_METH_VAR_TYPE_.80 643 | .quad 0 644 | .quad L_OBJC_METH_VAR_NAME_.81 645 | .quad L_OBJC_METH_VAR_TYPE_.80 646 | .quad 0 647 | .quad L_OBJC_METH_VAR_NAME_.82 648 | .quad L_OBJC_METH_VAR_TYPE_.80 649 | .quad 0 650 | .quad L_OBJC_METH_VAR_NAME_.83 651 | .quad L_OBJC_METH_VAR_TYPE_.80 652 | .quad 0 653 | .quad L_OBJC_METH_VAR_NAME_.84 654 | .quad L_OBJC_METH_VAR_TYPE_.80 655 | .quad 0 656 | .quad L_OBJC_METH_VAR_NAME_.85 657 | .quad L_OBJC_METH_VAR_TYPE_.80 658 | .quad 0 659 | .quad L_OBJC_METH_VAR_NAME_.86 660 | .quad L_OBJC_METH_VAR_TYPE_.80 661 | .quad 0 662 | .quad L_OBJC_METH_VAR_NAME_.87 663 | .quad L_OBJC_METH_VAR_TYPE_.80 664 | .quad 0 665 | .quad L_OBJC_METH_VAR_NAME_.88 666 | .quad L_OBJC_METH_VAR_TYPE_.80 667 | .quad 0 668 | .quad L_OBJC_METH_VAR_NAME_.89 669 | .quad L_OBJC_METH_VAR_TYPE_.80 670 | .quad 0 671 | .quad L_OBJC_METH_VAR_NAME_.90 672 | .quad L_OBJC_METH_VAR_TYPE_.80 673 | .quad 0 674 | .quad L_OBJC_METH_VAR_NAME_.91 675 | .quad L_OBJC_METH_VAR_TYPE_.80 676 | .quad 0 677 | .quad L_OBJC_METH_VAR_NAME_.92 678 | .quad L_OBJC_METH_VAR_TYPE_.80 679 | .quad 0 680 | .quad L_OBJC_METH_VAR_NAME_.93 681 | .quad L_OBJC_METH_VAR_TYPE_.80 682 | .quad 0 683 | .quad L_OBJC_METH_VAR_NAME_.94 684 | .quad L_OBJC_METH_VAR_TYPE_.80 685 | .quad 0 686 | .quad L_OBJC_METH_VAR_NAME_.95 687 | .quad L_OBJC_METH_VAR_TYPE_.80 688 | .quad 0 689 | .quad L_OBJC_METH_VAR_NAME_.96 690 | .quad L_OBJC_METH_VAR_TYPE_.80 691 | .quad 0 692 | 693 | .section __TEXT,__objc_methtype,cstring_literals 694 | L_OBJC_METH_VAR_TYPE_.97: 695 | .asciz "Q24@0:8@\"NSApplication\"16" 696 | 697 | L_OBJC_METH_VAR_TYPE_.98: 698 | .asciz "v32@0:8@\"NSApplication\"16@\"NSArray\"24" 699 | 700 | L_OBJC_METH_VAR_TYPE_.99: 701 | .asciz "c32@0:8@\"NSApplication\"16@\"NSString\"24" 702 | 703 | L_OBJC_METH_VAR_TYPE_.100: 704 | .asciz "c24@0:8@\"NSApplication\"16" 705 | 706 | L_OBJC_METH_VAR_TYPE_.101: 707 | .asciz "c32@0:8@16@\"NSString\"24" 708 | 709 | L_OBJC_METH_VAR_TYPE_.102: 710 | .asciz "Q44@0:8@\"NSApplication\"16@\"NSArray\"24@\"NSDictionary\"32c40" 711 | 712 | L_OBJC_METH_VAR_TYPE_.103: 713 | .asciz "c28@0:8@\"NSApplication\"16c24" 714 | 715 | L_OBJC_METH_VAR_TYPE_.104: 716 | .asciz "@\"NSMenu\"24@0:8@\"NSApplication\"16" 717 | 718 | L_OBJC_METH_VAR_TYPE_.105: 719 | .asciz "@\"NSError\"32@0:8@\"NSApplication\"16@\"NSError\"24" 720 | 721 | L_OBJC_METH_VAR_TYPE_.106: 722 | .asciz "v32@0:8@\"NSApplication\"16@\"NSData\"24" 723 | 724 | L_OBJC_METH_VAR_TYPE_.107: 725 | .asciz "v32@0:8@\"NSApplication\"16@\"NSError\"24" 726 | 727 | L_OBJC_METH_VAR_TYPE_.108: 728 | .asciz "v32@0:8@\"NSApplication\"16@\"NSDictionary\"24" 729 | 730 | L_OBJC_METH_VAR_TYPE_.109: 731 | .asciz "@32@0:8@\"NSApplication\"16@\"INIntent\"24" 732 | 733 | L_OBJC_METH_VAR_TYPE_.110: 734 | .asciz "v32@0:8@\"NSApplication\"16@\"NSCoder\"24" 735 | 736 | L_OBJC_METH_VAR_TYPE_.111: 737 | .asciz "c40@0:8@\"NSApplication\"16@\"NSUserActivity\"24@?32" 738 | 739 | L_OBJC_METH_VAR_TYPE_.112: 740 | .asciz "v40@0:8@\"NSApplication\"16@\"NSString\"24@\"NSError\"32" 741 | 742 | L_OBJC_METH_VAR_TYPE_.113: 743 | .asciz "v32@0:8@\"NSApplication\"16@\"NSUserActivity\"24" 744 | 745 | L_OBJC_METH_VAR_TYPE_.114: 746 | .asciz "v32@0:8@\"NSApplication\"16@\"CKShareMetadata\"24" 747 | 748 | L_OBJC_METH_VAR_TYPE_.115: 749 | .asciz "v24@0:8@\"NSNotification\"16" 750 | 751 | .section __DATA,__objc_const 752 | .p2align 3, 0x0 753 | __OBJC_$_PROTOCOL_METHOD_TYPES_NSApplicationDelegate: 754 | .quad L_OBJC_METH_VAR_TYPE_.97 755 | .quad L_OBJC_METH_VAR_TYPE_.98 756 | .quad L_OBJC_METH_VAR_TYPE_.99 757 | .quad L_OBJC_METH_VAR_TYPE_.98 758 | .quad L_OBJC_METH_VAR_TYPE_.99 759 | .quad L_OBJC_METH_VAR_TYPE_.100 760 | .quad L_OBJC_METH_VAR_TYPE_.100 761 | .quad L_OBJC_METH_VAR_TYPE_.101 762 | .quad L_OBJC_METH_VAR_TYPE_.99 763 | .quad L_OBJC_METH_VAR_TYPE_.102 764 | .quad L_OBJC_METH_VAR_TYPE_.100 765 | .quad L_OBJC_METH_VAR_TYPE_.103 766 | .quad L_OBJC_METH_VAR_TYPE_.104 767 | .quad L_OBJC_METH_VAR_TYPE_.105 768 | .quad L_OBJC_METH_VAR_TYPE_.106 769 | .quad L_OBJC_METH_VAR_TYPE_.107 770 | .quad L_OBJC_METH_VAR_TYPE_.108 771 | .quad L_OBJC_METH_VAR_TYPE_.100 772 | .quad L_OBJC_METH_VAR_TYPE_.109 773 | .quad L_OBJC_METH_VAR_TYPE_.110 774 | .quad L_OBJC_METH_VAR_TYPE_.110 775 | .quad L_OBJC_METH_VAR_TYPE_.99 776 | .quad L_OBJC_METH_VAR_TYPE_.111 777 | .quad L_OBJC_METH_VAR_TYPE_.112 778 | .quad L_OBJC_METH_VAR_TYPE_.113 779 | .quad L_OBJC_METH_VAR_TYPE_.114 780 | .quad L_OBJC_METH_VAR_TYPE_.99 781 | .quad L_OBJC_METH_VAR_TYPE_.100 782 | .quad L_OBJC_METH_VAR_TYPE_.115 783 | .quad L_OBJC_METH_VAR_TYPE_.115 784 | .quad L_OBJC_METH_VAR_TYPE_.115 785 | .quad L_OBJC_METH_VAR_TYPE_.115 786 | .quad L_OBJC_METH_VAR_TYPE_.115 787 | .quad L_OBJC_METH_VAR_TYPE_.115 788 | .quad L_OBJC_METH_VAR_TYPE_.115 789 | .quad L_OBJC_METH_VAR_TYPE_.115 790 | .quad L_OBJC_METH_VAR_TYPE_.115 791 | .quad L_OBJC_METH_VAR_TYPE_.115 792 | .quad L_OBJC_METH_VAR_TYPE_.115 793 | .quad L_OBJC_METH_VAR_TYPE_.115 794 | .quad L_OBJC_METH_VAR_TYPE_.115 795 | .quad L_OBJC_METH_VAR_TYPE_.115 796 | .quad L_OBJC_METH_VAR_TYPE_.115 797 | .quad L_OBJC_METH_VAR_TYPE_.115 798 | .quad L_OBJC_METH_VAR_TYPE_.115 799 | 800 | .private_extern __OBJC_PROTOCOL_$_NSApplicationDelegate 801 | .section __DATA,__data 802 | .globl __OBJC_PROTOCOL_$_NSApplicationDelegate 803 | .weak_definition __OBJC_PROTOCOL_$_NSApplicationDelegate 804 | .p2align 3, 0x0 805 | __OBJC_PROTOCOL_$_NSApplicationDelegate: 806 | .quad 0 807 | .quad L_OBJC_CLASS_NAME_.1 808 | .quad __OBJC_$_PROTOCOL_REFS_NSApplicationDelegate 809 | .quad 0 810 | .quad 0 811 | .quad __OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT_NSApplicationDelegate 812 | .quad 0 813 | .quad 0 814 | .long 96 815 | .long 0 816 | .quad __OBJC_$_PROTOCOL_METHOD_TYPES_NSApplicationDelegate 817 | .quad 0 818 | .quad 0 819 | 820 | .private_extern __OBJC_LABEL_PROTOCOL_$_NSApplicationDelegate 821 | .section __DATA,__objc_protolist,coalesced,no_dead_strip 822 | .globl __OBJC_LABEL_PROTOCOL_$_NSApplicationDelegate 823 | .weak_definition __OBJC_LABEL_PROTOCOL_$_NSApplicationDelegate 824 | .p2align 3, 0x0 825 | __OBJC_LABEL_PROTOCOL_$_NSApplicationDelegate: 826 | .quad __OBJC_PROTOCOL_$_NSApplicationDelegate 827 | 828 | .section __DATA,__objc_const 829 | .p2align 3, 0x0 830 | __OBJC_CLASS_PROTOCOLS_$_MACHAppDelegate: 831 | .quad 1 832 | .quad __OBJC_PROTOCOL_$_NSApplicationDelegate 833 | .quad 0 834 | 835 | .p2align 3, 0x0 836 | __OBJC_METACLASS_RO_$_MACHAppDelegate: 837 | .long 389 838 | .long 40 839 | .long 40 840 | .space 4 841 | .quad 0 842 | .quad L_OBJC_CLASS_NAME_ 843 | .quad 0 844 | .quad __OBJC_CLASS_PROTOCOLS_$_MACHAppDelegate 845 | .quad 0 846 | .quad 0 847 | .quad 0 848 | 849 | .section __DATA,__objc_data 850 | .globl _OBJC_METACLASS_$_MACHAppDelegate 851 | .p2align 3, 0x0 852 | _OBJC_METACLASS_$_MACHAppDelegate: 853 | .quad _OBJC_METACLASS_$_NSObject 854 | .quad _OBJC_METACLASS_$_NSObject 855 | .quad __objc_empty_cache 856 | .quad 0 857 | .quad __OBJC_METACLASS_RO_$_MACHAppDelegate 858 | 859 | .section __TEXT,__objc_classname,cstring_literals 860 | L_OBJC_CLASS_NAME_.116: 861 | .asciz "\001" 862 | 863 | .section __TEXT,__objc_methname,cstring_literals 864 | L_OBJC_METH_VAR_NAME_.117: 865 | .asciz ".cxx_destruct" 866 | 867 | .section __TEXT,__objc_methtype,cstring_literals 868 | L_OBJC_METH_VAR_TYPE_.118: 869 | .asciz "v16@0:8" 870 | 871 | .section __DATA,__objc_const 872 | .p2align 3, 0x0 873 | __OBJC_$_INSTANCE_METHODS_MACHAppDelegate: 874 | .long 24 875 | .long 4 876 | .quad L_OBJC_METH_VAR_NAME_.81 877 | .quad L_OBJC_METH_VAR_TYPE_.80 878 | .quad "-[MACHAppDelegate applicationDidFinishLaunching:]" 879 | .quad L_OBJC_METH_VAR_NAME_.42 880 | .quad L_OBJC_METH_VAR_TYPE_.43 881 | .quad "-[MACHAppDelegate applicationShouldTerminate:]" 882 | .quad L_OBJC_METH_VAR_NAME_.56 883 | .quad L_OBJC_METH_VAR_TYPE_ 884 | .quad "-[MACHAppDelegate applicationShouldTerminateAfterLastWindowClosed:]" 885 | .quad L_OBJC_METH_VAR_NAME_.117 886 | .quad L_OBJC_METH_VAR_TYPE_.118 887 | .quad "-[MACHAppDelegate .cxx_destruct]" 888 | 889 | .private_extern _OBJC_IVAR_$_MACHAppDelegate._runBlock 890 | .section __DATA,__objc_ivar 891 | .globl _OBJC_IVAR_$_MACHAppDelegate._runBlock 892 | .p2align 3, 0x0 893 | _OBJC_IVAR_$_MACHAppDelegate._runBlock: 894 | .quad 8 895 | 896 | .section __TEXT,__objc_methname,cstring_literals 897 | L_OBJC_METH_VAR_NAME_.119: 898 | .asciz "_runBlock" 899 | 900 | .section __TEXT,__objc_methtype,cstring_literals 901 | L_OBJC_METH_VAR_TYPE_.120: 902 | .asciz "@?" 903 | 904 | .section __DATA,__objc_const 905 | .p2align 3, 0x0 906 | __OBJC_$_INSTANCE_VARIABLES_MACHAppDelegate: 907 | .long 32 908 | .long 1 909 | .quad _OBJC_IVAR_$_MACHAppDelegate._runBlock 910 | .quad L_OBJC_METH_VAR_NAME_.119 911 | .quad L_OBJC_METH_VAR_TYPE_.120 912 | .long 3 913 | .long 8 914 | 915 | .p2align 3, 0x0 916 | __OBJC_$_PROP_LIST_MACHAppDelegate: 917 | .long 16 918 | .long 4 919 | .quad L_OBJC_PROP_NAME_ATTR_ 920 | .quad L_OBJC_PROP_NAME_ATTR_.33 921 | .quad L_OBJC_PROP_NAME_ATTR_.34 922 | .quad L_OBJC_PROP_NAME_ATTR_.35 923 | .quad L_OBJC_PROP_NAME_ATTR_.36 924 | .quad L_OBJC_PROP_NAME_ATTR_.37 925 | .quad L_OBJC_PROP_NAME_ATTR_.38 926 | .quad L_OBJC_PROP_NAME_ATTR_.39 927 | 928 | .p2align 3, 0x0 929 | __OBJC_CLASS_RO_$_MACHAppDelegate: 930 | .long 388 931 | .long 8 932 | .long 16 933 | .space 4 934 | .quad L_OBJC_CLASS_NAME_.116 935 | .quad L_OBJC_CLASS_NAME_ 936 | .quad __OBJC_$_INSTANCE_METHODS_MACHAppDelegate 937 | .quad __OBJC_CLASS_PROTOCOLS_$_MACHAppDelegate 938 | .quad __OBJC_$_INSTANCE_VARIABLES_MACHAppDelegate 939 | .quad 0 940 | .quad __OBJC_$_PROP_LIST_MACHAppDelegate 941 | 942 | .section __DATA,__objc_data 943 | .globl _OBJC_CLASS_$_MACHAppDelegate 944 | .p2align 3, 0x0 945 | _OBJC_CLASS_$_MACHAppDelegate: 946 | .quad _OBJC_METACLASS_$_MACHAppDelegate 947 | .quad _OBJC_CLASS_$_NSObject 948 | .quad __objc_empty_cache 949 | .quad 0 950 | .quad __OBJC_CLASS_RO_$_MACHAppDelegate 951 | 952 | .section __DATA,__objc_classlist,regular,no_dead_strip 953 | .p2align 3, 0x0 954 | l_OBJC_LABEL_CLASS_$: 955 | .quad _OBJC_CLASS_$_MACHAppDelegate 956 | 957 | .no_dead_strip __OBJC_LABEL_PROTOCOL_$_NSApplicationDelegate 958 | .no_dead_strip __OBJC_LABEL_PROTOCOL_$_NSObject 959 | .no_dead_strip __OBJC_PROTOCOL_$_NSApplicationDelegate 960 | .no_dead_strip __OBJC_PROTOCOL_$_NSObject 961 | .section __DATA,__objc_imageinfo,regular,no_dead_strip 962 | L_OBJC_IMAGE_INFO: 963 | .long 0 964 | .long 64 965 | 966 | .subsections_via_symbols 967 | -------------------------------------------------------------------------------- /MACHAppDelegate_arm64_apple_macos12.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .build_version macos, 12, 0 3 | .private_extern "-[MACHAppDelegate setRunBlock:]" 4 | .globl "-[MACHAppDelegate setRunBlock:]" 5 | .p2align 2 6 | "-[MACHAppDelegate setRunBlock:]": 7 | .cfi_startproc 8 | cbz x0, LBB0_2 9 | stp x20, x19, [sp, #-32]! 10 | .cfi_def_cfa_offset 32 11 | stp x29, x30, [sp, #16] 12 | .cfi_offset w30, -8 13 | .cfi_offset w29, -16 14 | .cfi_offset w19, -24 15 | .cfi_offset w20, -32 16 | mov x19, x0 17 | mov x0, x1 18 | bl _objc_retainBlock 19 | ldr x8, [x19, #8] 20 | str x0, [x19, #8] 21 | mov x0, x8 22 | ldp x29, x30, [sp, #16] 23 | ldp x20, x19, [sp], #32 24 | .cfi_def_cfa_offset 0 25 | .cfi_restore w30 26 | .cfi_restore w29 27 | .cfi_restore w19 28 | .cfi_restore w20 29 | b _objc_release 30 | LBB0_2: 31 | ret 32 | .cfi_endproc 33 | 34 | .p2align 2 35 | "-[MACHAppDelegate applicationDidFinishLaunching:]": 36 | .cfi_startproc 37 | ldr x0, [x0, #8] 38 | cbz x0, LBB1_2 39 | ldr x1, [x0, #16] 40 | br x1 41 | LBB1_2: 42 | ret 43 | .cfi_endproc 44 | 45 | .p2align 2 46 | "-[MACHAppDelegate applicationShouldTerminate:]": 47 | .cfi_startproc 48 | mov x0, #0 49 | ret 50 | .cfi_endproc 51 | 52 | .p2align 2 53 | "-[MACHAppDelegate applicationShouldTerminateAfterLastWindowClosed:]": 54 | .cfi_startproc 55 | mov w0, #1 56 | ret 57 | .cfi_endproc 58 | 59 | .p2align 2 60 | "-[MACHAppDelegate .cxx_destruct]": 61 | .cfi_startproc 62 | add x0, x0, #8 63 | mov x1, #0 64 | b _objc_storeStrong 65 | .cfi_endproc 66 | 67 | .section __TEXT,__objc_classname,cstring_literals 68 | l_OBJC_CLASS_NAME_: 69 | .asciz "MACHAppDelegate" 70 | 71 | l_OBJC_CLASS_NAME_.1: 72 | .asciz "NSApplicationDelegate" 73 | 74 | l_OBJC_CLASS_NAME_.2: 75 | .asciz "NSObject" 76 | 77 | .section __TEXT,__objc_methname,cstring_literals 78 | l_OBJC_METH_VAR_NAME_: 79 | .asciz "isEqual:" 80 | 81 | .section __TEXT,__objc_methtype,cstring_literals 82 | l_OBJC_METH_VAR_TYPE_: 83 | .asciz "B24@0:8@16" 84 | 85 | .section __TEXT,__objc_methname,cstring_literals 86 | l_OBJC_METH_VAR_NAME_.3: 87 | .asciz "class" 88 | 89 | .section __TEXT,__objc_methtype,cstring_literals 90 | l_OBJC_METH_VAR_TYPE_.4: 91 | .asciz "#16@0:8" 92 | 93 | .section __TEXT,__objc_methname,cstring_literals 94 | l_OBJC_METH_VAR_NAME_.5: 95 | .asciz "self" 96 | 97 | .section __TEXT,__objc_methtype,cstring_literals 98 | l_OBJC_METH_VAR_TYPE_.6: 99 | .asciz "@16@0:8" 100 | 101 | .section __TEXT,__objc_methname,cstring_literals 102 | l_OBJC_METH_VAR_NAME_.7: 103 | .asciz "performSelector:" 104 | 105 | .section __TEXT,__objc_methtype,cstring_literals 106 | l_OBJC_METH_VAR_TYPE_.8: 107 | .asciz "@24@0:8:16" 108 | 109 | .section __TEXT,__objc_methname,cstring_literals 110 | l_OBJC_METH_VAR_NAME_.9: 111 | .asciz "performSelector:withObject:" 112 | 113 | .section __TEXT,__objc_methtype,cstring_literals 114 | l_OBJC_METH_VAR_TYPE_.10: 115 | .asciz "@32@0:8:16@24" 116 | 117 | .section __TEXT,__objc_methname,cstring_literals 118 | l_OBJC_METH_VAR_NAME_.11: 119 | .asciz "performSelector:withObject:withObject:" 120 | 121 | .section __TEXT,__objc_methtype,cstring_literals 122 | l_OBJC_METH_VAR_TYPE_.12: 123 | .asciz "@40@0:8:16@24@32" 124 | 125 | .section __TEXT,__objc_methname,cstring_literals 126 | l_OBJC_METH_VAR_NAME_.13: 127 | .asciz "isProxy" 128 | 129 | .section __TEXT,__objc_methtype,cstring_literals 130 | l_OBJC_METH_VAR_TYPE_.14: 131 | .asciz "B16@0:8" 132 | 133 | .section __TEXT,__objc_methname,cstring_literals 134 | l_OBJC_METH_VAR_NAME_.15: 135 | .asciz "isKindOfClass:" 136 | 137 | .section __TEXT,__objc_methtype,cstring_literals 138 | l_OBJC_METH_VAR_TYPE_.16: 139 | .asciz "B24@0:8#16" 140 | 141 | .section __TEXT,__objc_methname,cstring_literals 142 | l_OBJC_METH_VAR_NAME_.17: 143 | .asciz "isMemberOfClass:" 144 | 145 | l_OBJC_METH_VAR_NAME_.18: 146 | .asciz "conformsToProtocol:" 147 | 148 | l_OBJC_METH_VAR_NAME_.19: 149 | .asciz "respondsToSelector:" 150 | 151 | .section __TEXT,__objc_methtype,cstring_literals 152 | l_OBJC_METH_VAR_TYPE_.20: 153 | .asciz "B24@0:8:16" 154 | 155 | .section __TEXT,__objc_methname,cstring_literals 156 | l_OBJC_METH_VAR_NAME_.21: 157 | .asciz "retain" 158 | 159 | l_OBJC_METH_VAR_NAME_.22: 160 | .asciz "release" 161 | 162 | .section __TEXT,__objc_methtype,cstring_literals 163 | l_OBJC_METH_VAR_TYPE_.23: 164 | .asciz "Vv16@0:8" 165 | 166 | .section __TEXT,__objc_methname,cstring_literals 167 | l_OBJC_METH_VAR_NAME_.24: 168 | .asciz "autorelease" 169 | 170 | l_OBJC_METH_VAR_NAME_.25: 171 | .asciz "retainCount" 172 | 173 | .section __TEXT,__objc_methtype,cstring_literals 174 | l_OBJC_METH_VAR_TYPE_.26: 175 | .asciz "Q16@0:8" 176 | 177 | .section __TEXT,__objc_methname,cstring_literals 178 | l_OBJC_METH_VAR_NAME_.27: 179 | .asciz "zone" 180 | 181 | .section __TEXT,__objc_methtype,cstring_literals 182 | l_OBJC_METH_VAR_TYPE_.28: 183 | .asciz "^{_NSZone=}16@0:8" 184 | 185 | .section __TEXT,__objc_methname,cstring_literals 186 | l_OBJC_METH_VAR_NAME_.29: 187 | .asciz "hash" 188 | 189 | l_OBJC_METH_VAR_NAME_.30: 190 | .asciz "superclass" 191 | 192 | l_OBJC_METH_VAR_NAME_.31: 193 | .asciz "description" 194 | 195 | .section __DATA,__objc_const 196 | .p2align 3, 0x0 197 | __OBJC_$_PROTOCOL_INSTANCE_METHODS_NSObject: 198 | .long 24 199 | .long 19 200 | .quad l_OBJC_METH_VAR_NAME_ 201 | .quad l_OBJC_METH_VAR_TYPE_ 202 | .quad 0 203 | .quad l_OBJC_METH_VAR_NAME_.3 204 | .quad l_OBJC_METH_VAR_TYPE_.4 205 | .quad 0 206 | .quad l_OBJC_METH_VAR_NAME_.5 207 | .quad l_OBJC_METH_VAR_TYPE_.6 208 | .quad 0 209 | .quad l_OBJC_METH_VAR_NAME_.7 210 | .quad l_OBJC_METH_VAR_TYPE_.8 211 | .quad 0 212 | .quad l_OBJC_METH_VAR_NAME_.9 213 | .quad l_OBJC_METH_VAR_TYPE_.10 214 | .quad 0 215 | .quad l_OBJC_METH_VAR_NAME_.11 216 | .quad l_OBJC_METH_VAR_TYPE_.12 217 | .quad 0 218 | .quad l_OBJC_METH_VAR_NAME_.13 219 | .quad l_OBJC_METH_VAR_TYPE_.14 220 | .quad 0 221 | .quad l_OBJC_METH_VAR_NAME_.15 222 | .quad l_OBJC_METH_VAR_TYPE_.16 223 | .quad 0 224 | .quad l_OBJC_METH_VAR_NAME_.17 225 | .quad l_OBJC_METH_VAR_TYPE_.16 226 | .quad 0 227 | .quad l_OBJC_METH_VAR_NAME_.18 228 | .quad l_OBJC_METH_VAR_TYPE_ 229 | .quad 0 230 | .quad l_OBJC_METH_VAR_NAME_.19 231 | .quad l_OBJC_METH_VAR_TYPE_.20 232 | .quad 0 233 | .quad l_OBJC_METH_VAR_NAME_.21 234 | .quad l_OBJC_METH_VAR_TYPE_.6 235 | .quad 0 236 | .quad l_OBJC_METH_VAR_NAME_.22 237 | .quad l_OBJC_METH_VAR_TYPE_.23 238 | .quad 0 239 | .quad l_OBJC_METH_VAR_NAME_.24 240 | .quad l_OBJC_METH_VAR_TYPE_.6 241 | .quad 0 242 | .quad l_OBJC_METH_VAR_NAME_.25 243 | .quad l_OBJC_METH_VAR_TYPE_.26 244 | .quad 0 245 | .quad l_OBJC_METH_VAR_NAME_.27 246 | .quad l_OBJC_METH_VAR_TYPE_.28 247 | .quad 0 248 | .quad l_OBJC_METH_VAR_NAME_.29 249 | .quad l_OBJC_METH_VAR_TYPE_.26 250 | .quad 0 251 | .quad l_OBJC_METH_VAR_NAME_.30 252 | .quad l_OBJC_METH_VAR_TYPE_.4 253 | .quad 0 254 | .quad l_OBJC_METH_VAR_NAME_.31 255 | .quad l_OBJC_METH_VAR_TYPE_.6 256 | .quad 0 257 | 258 | .section __TEXT,__objc_methname,cstring_literals 259 | l_OBJC_METH_VAR_NAME_.32: 260 | .asciz "debugDescription" 261 | 262 | .section __DATA,__objc_const 263 | .p2align 3, 0x0 264 | __OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT_NSObject: 265 | .long 24 266 | .long 1 267 | .quad l_OBJC_METH_VAR_NAME_.32 268 | .quad l_OBJC_METH_VAR_TYPE_.6 269 | .quad 0 270 | 271 | .section __TEXT,__objc_methname,cstring_literals 272 | l_OBJC_PROP_NAME_ATTR_: 273 | .asciz "hash" 274 | 275 | l_OBJC_PROP_NAME_ATTR_.33: 276 | .asciz "TQ,R" 277 | 278 | l_OBJC_PROP_NAME_ATTR_.34: 279 | .asciz "superclass" 280 | 281 | l_OBJC_PROP_NAME_ATTR_.35: 282 | .asciz "T#,R" 283 | 284 | l_OBJC_PROP_NAME_ATTR_.36: 285 | .asciz "description" 286 | 287 | l_OBJC_PROP_NAME_ATTR_.37: 288 | .asciz "T@\"NSString\",R,C" 289 | 290 | l_OBJC_PROP_NAME_ATTR_.38: 291 | .asciz "debugDescription" 292 | 293 | l_OBJC_PROP_NAME_ATTR_.39: 294 | .asciz "T@\"NSString\",?,R,C" 295 | 296 | .section __DATA,__objc_const 297 | .p2align 3, 0x0 298 | __OBJC_$_PROP_LIST_NSObject: 299 | .long 16 300 | .long 4 301 | .quad l_OBJC_PROP_NAME_ATTR_ 302 | .quad l_OBJC_PROP_NAME_ATTR_.33 303 | .quad l_OBJC_PROP_NAME_ATTR_.34 304 | .quad l_OBJC_PROP_NAME_ATTR_.35 305 | .quad l_OBJC_PROP_NAME_ATTR_.36 306 | .quad l_OBJC_PROP_NAME_ATTR_.37 307 | .quad l_OBJC_PROP_NAME_ATTR_.38 308 | .quad l_OBJC_PROP_NAME_ATTR_.39 309 | 310 | .section __TEXT,__objc_methtype,cstring_literals 311 | l_OBJC_METH_VAR_TYPE_.40: 312 | .asciz "B24@0:8@\"Protocol\"16" 313 | 314 | l_OBJC_METH_VAR_TYPE_.41: 315 | .asciz "@\"NSString\"16@0:8" 316 | 317 | .section __DATA,__objc_const 318 | .p2align 3, 0x0 319 | __OBJC_$_PROTOCOL_METHOD_TYPES_NSObject: 320 | .quad l_OBJC_METH_VAR_TYPE_ 321 | .quad l_OBJC_METH_VAR_TYPE_.4 322 | .quad l_OBJC_METH_VAR_TYPE_.6 323 | .quad l_OBJC_METH_VAR_TYPE_.8 324 | .quad l_OBJC_METH_VAR_TYPE_.10 325 | .quad l_OBJC_METH_VAR_TYPE_.12 326 | .quad l_OBJC_METH_VAR_TYPE_.14 327 | .quad l_OBJC_METH_VAR_TYPE_.16 328 | .quad l_OBJC_METH_VAR_TYPE_.16 329 | .quad l_OBJC_METH_VAR_TYPE_.40 330 | .quad l_OBJC_METH_VAR_TYPE_.20 331 | .quad l_OBJC_METH_VAR_TYPE_.6 332 | .quad l_OBJC_METH_VAR_TYPE_.23 333 | .quad l_OBJC_METH_VAR_TYPE_.6 334 | .quad l_OBJC_METH_VAR_TYPE_.26 335 | .quad l_OBJC_METH_VAR_TYPE_.28 336 | .quad l_OBJC_METH_VAR_TYPE_.26 337 | .quad l_OBJC_METH_VAR_TYPE_.4 338 | .quad l_OBJC_METH_VAR_TYPE_.41 339 | .quad l_OBJC_METH_VAR_TYPE_.41 340 | 341 | .private_extern __OBJC_PROTOCOL_$_NSObject 342 | .section __DATA,__data 343 | .globl __OBJC_PROTOCOL_$_NSObject 344 | .weak_definition __OBJC_PROTOCOL_$_NSObject 345 | .p2align 3, 0x0 346 | __OBJC_PROTOCOL_$_NSObject: 347 | .quad 0 348 | .quad l_OBJC_CLASS_NAME_.2 349 | .quad 0 350 | .quad __OBJC_$_PROTOCOL_INSTANCE_METHODS_NSObject 351 | .quad 0 352 | .quad __OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT_NSObject 353 | .quad 0 354 | .quad __OBJC_$_PROP_LIST_NSObject 355 | .long 96 356 | .long 0 357 | .quad __OBJC_$_PROTOCOL_METHOD_TYPES_NSObject 358 | .quad 0 359 | .quad 0 360 | 361 | .private_extern __OBJC_LABEL_PROTOCOL_$_NSObject 362 | .section __DATA,__objc_protolist,coalesced,no_dead_strip 363 | .globl __OBJC_LABEL_PROTOCOL_$_NSObject 364 | .weak_definition __OBJC_LABEL_PROTOCOL_$_NSObject 365 | .p2align 3, 0x0 366 | __OBJC_LABEL_PROTOCOL_$_NSObject: 367 | .quad __OBJC_PROTOCOL_$_NSObject 368 | 369 | .section __DATA,__objc_const 370 | .p2align 3, 0x0 371 | __OBJC_$_PROTOCOL_REFS_NSApplicationDelegate: 372 | .quad 1 373 | .quad __OBJC_PROTOCOL_$_NSObject 374 | .quad 0 375 | 376 | .section __TEXT,__objc_methname,cstring_literals 377 | l_OBJC_METH_VAR_NAME_.42: 378 | .asciz "applicationShouldTerminate:" 379 | 380 | .section __TEXT,__objc_methtype,cstring_literals 381 | l_OBJC_METH_VAR_TYPE_.43: 382 | .asciz "Q24@0:8@16" 383 | 384 | .section __TEXT,__objc_methname,cstring_literals 385 | l_OBJC_METH_VAR_NAME_.44: 386 | .asciz "application:openURLs:" 387 | 388 | .section __TEXT,__objc_methtype,cstring_literals 389 | l_OBJC_METH_VAR_TYPE_.45: 390 | .asciz "v32@0:8@16@24" 391 | 392 | .section __TEXT,__objc_methname,cstring_literals 393 | l_OBJC_METH_VAR_NAME_.46: 394 | .asciz "application:openFile:" 395 | 396 | .section __TEXT,__objc_methtype,cstring_literals 397 | l_OBJC_METH_VAR_TYPE_.47: 398 | .asciz "B32@0:8@16@24" 399 | 400 | .section __TEXT,__objc_methname,cstring_literals 401 | l_OBJC_METH_VAR_NAME_.48: 402 | .asciz "application:openFiles:" 403 | 404 | l_OBJC_METH_VAR_NAME_.49: 405 | .asciz "application:openTempFile:" 406 | 407 | l_OBJC_METH_VAR_NAME_.50: 408 | .asciz "applicationShouldOpenUntitledFile:" 409 | 410 | l_OBJC_METH_VAR_NAME_.51: 411 | .asciz "applicationOpenUntitledFile:" 412 | 413 | l_OBJC_METH_VAR_NAME_.52: 414 | .asciz "application:openFileWithoutUI:" 415 | 416 | l_OBJC_METH_VAR_NAME_.53: 417 | .asciz "application:printFile:" 418 | 419 | l_OBJC_METH_VAR_NAME_.54: 420 | .asciz "application:printFiles:withSettings:showPrintPanels:" 421 | 422 | .section __TEXT,__objc_methtype,cstring_literals 423 | l_OBJC_METH_VAR_TYPE_.55: 424 | .asciz "Q44@0:8@16@24@32B40" 425 | 426 | .section __TEXT,__objc_methname,cstring_literals 427 | l_OBJC_METH_VAR_NAME_.56: 428 | .asciz "applicationShouldTerminateAfterLastWindowClosed:" 429 | 430 | l_OBJC_METH_VAR_NAME_.57: 431 | .asciz "applicationShouldHandleReopen:hasVisibleWindows:" 432 | 433 | .section __TEXT,__objc_methtype,cstring_literals 434 | l_OBJC_METH_VAR_TYPE_.58: 435 | .asciz "B28@0:8@16B24" 436 | 437 | .section __TEXT,__objc_methname,cstring_literals 438 | l_OBJC_METH_VAR_NAME_.59: 439 | .asciz "applicationDockMenu:" 440 | 441 | .section __TEXT,__objc_methtype,cstring_literals 442 | l_OBJC_METH_VAR_TYPE_.60: 443 | .asciz "@24@0:8@16" 444 | 445 | .section __TEXT,__objc_methname,cstring_literals 446 | l_OBJC_METH_VAR_NAME_.61: 447 | .asciz "application:willPresentError:" 448 | 449 | .section __TEXT,__objc_methtype,cstring_literals 450 | l_OBJC_METH_VAR_TYPE_.62: 451 | .asciz "@32@0:8@16@24" 452 | 453 | .section __TEXT,__objc_methname,cstring_literals 454 | l_OBJC_METH_VAR_NAME_.63: 455 | .asciz "application:didRegisterForRemoteNotificationsWithDeviceToken:" 456 | 457 | l_OBJC_METH_VAR_NAME_.64: 458 | .asciz "application:didFailToRegisterForRemoteNotificationsWithError:" 459 | 460 | l_OBJC_METH_VAR_NAME_.65: 461 | .asciz "application:didReceiveRemoteNotification:" 462 | 463 | l_OBJC_METH_VAR_NAME_.66: 464 | .asciz "applicationSupportsSecureRestorableState:" 465 | 466 | l_OBJC_METH_VAR_NAME_.67: 467 | .asciz "application:handlerForIntent:" 468 | 469 | l_OBJC_METH_VAR_NAME_.68: 470 | .asciz "application:willEncodeRestorableState:" 471 | 472 | l_OBJC_METH_VAR_NAME_.69: 473 | .asciz "application:didDecodeRestorableState:" 474 | 475 | l_OBJC_METH_VAR_NAME_.70: 476 | .asciz "application:willContinueUserActivityWithType:" 477 | 478 | l_OBJC_METH_VAR_NAME_.71: 479 | .asciz "application:continueUserActivity:restorationHandler:" 480 | 481 | .section __TEXT,__objc_methtype,cstring_literals 482 | l_OBJC_METH_VAR_TYPE_.72: 483 | .asciz "B40@0:8@16@24@?32" 484 | 485 | .section __TEXT,__objc_methname,cstring_literals 486 | l_OBJC_METH_VAR_NAME_.73: 487 | .asciz "application:didFailToContinueUserActivityWithType:error:" 488 | 489 | .section __TEXT,__objc_methtype,cstring_literals 490 | l_OBJC_METH_VAR_TYPE_.74: 491 | .asciz "v40@0:8@16@24@32" 492 | 493 | .section __TEXT,__objc_methname,cstring_literals 494 | l_OBJC_METH_VAR_NAME_.75: 495 | .asciz "application:didUpdateUserActivity:" 496 | 497 | l_OBJC_METH_VAR_NAME_.76: 498 | .asciz "application:userDidAcceptCloudKitShareWithMetadata:" 499 | 500 | l_OBJC_METH_VAR_NAME_.77: 501 | .asciz "application:delegateHandlesKey:" 502 | 503 | l_OBJC_METH_VAR_NAME_.78: 504 | .asciz "applicationShouldAutomaticallyLocalizeKeyEquivalents:" 505 | 506 | l_OBJC_METH_VAR_NAME_.79: 507 | .asciz "applicationWillFinishLaunching:" 508 | 509 | .section __TEXT,__objc_methtype,cstring_literals 510 | l_OBJC_METH_VAR_TYPE_.80: 511 | .asciz "v24@0:8@16" 512 | 513 | .section __TEXT,__objc_methname,cstring_literals 514 | l_OBJC_METH_VAR_NAME_.81: 515 | .asciz "applicationDidFinishLaunching:" 516 | 517 | l_OBJC_METH_VAR_NAME_.82: 518 | .asciz "applicationWillHide:" 519 | 520 | l_OBJC_METH_VAR_NAME_.83: 521 | .asciz "applicationDidHide:" 522 | 523 | l_OBJC_METH_VAR_NAME_.84: 524 | .asciz "applicationWillUnhide:" 525 | 526 | l_OBJC_METH_VAR_NAME_.85: 527 | .asciz "applicationDidUnhide:" 528 | 529 | l_OBJC_METH_VAR_NAME_.86: 530 | .asciz "applicationWillBecomeActive:" 531 | 532 | l_OBJC_METH_VAR_NAME_.87: 533 | .asciz "applicationDidBecomeActive:" 534 | 535 | l_OBJC_METH_VAR_NAME_.88: 536 | .asciz "applicationWillResignActive:" 537 | 538 | l_OBJC_METH_VAR_NAME_.89: 539 | .asciz "applicationDidResignActive:" 540 | 541 | l_OBJC_METH_VAR_NAME_.90: 542 | .asciz "applicationWillUpdate:" 543 | 544 | l_OBJC_METH_VAR_NAME_.91: 545 | .asciz "applicationDidUpdate:" 546 | 547 | l_OBJC_METH_VAR_NAME_.92: 548 | .asciz "applicationWillTerminate:" 549 | 550 | l_OBJC_METH_VAR_NAME_.93: 551 | .asciz "applicationDidChangeScreenParameters:" 552 | 553 | l_OBJC_METH_VAR_NAME_.94: 554 | .asciz "applicationDidChangeOcclusionState:" 555 | 556 | l_OBJC_METH_VAR_NAME_.95: 557 | .asciz "applicationProtectedDataWillBecomeUnavailable:" 558 | 559 | l_OBJC_METH_VAR_NAME_.96: 560 | .asciz "applicationProtectedDataDidBecomeAvailable:" 561 | 562 | .section __DATA,__objc_const 563 | .p2align 3, 0x0 564 | __OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT_NSApplicationDelegate: 565 | .long 24 566 | .long 45 567 | .quad l_OBJC_METH_VAR_NAME_.42 568 | .quad l_OBJC_METH_VAR_TYPE_.43 569 | .quad 0 570 | .quad l_OBJC_METH_VAR_NAME_.44 571 | .quad l_OBJC_METH_VAR_TYPE_.45 572 | .quad 0 573 | .quad l_OBJC_METH_VAR_NAME_.46 574 | .quad l_OBJC_METH_VAR_TYPE_.47 575 | .quad 0 576 | .quad l_OBJC_METH_VAR_NAME_.48 577 | .quad l_OBJC_METH_VAR_TYPE_.45 578 | .quad 0 579 | .quad l_OBJC_METH_VAR_NAME_.49 580 | .quad l_OBJC_METH_VAR_TYPE_.47 581 | .quad 0 582 | .quad l_OBJC_METH_VAR_NAME_.50 583 | .quad l_OBJC_METH_VAR_TYPE_ 584 | .quad 0 585 | .quad l_OBJC_METH_VAR_NAME_.51 586 | .quad l_OBJC_METH_VAR_TYPE_ 587 | .quad 0 588 | .quad l_OBJC_METH_VAR_NAME_.52 589 | .quad l_OBJC_METH_VAR_TYPE_.47 590 | .quad 0 591 | .quad l_OBJC_METH_VAR_NAME_.53 592 | .quad l_OBJC_METH_VAR_TYPE_.47 593 | .quad 0 594 | .quad l_OBJC_METH_VAR_NAME_.54 595 | .quad l_OBJC_METH_VAR_TYPE_.55 596 | .quad 0 597 | .quad l_OBJC_METH_VAR_NAME_.56 598 | .quad l_OBJC_METH_VAR_TYPE_ 599 | .quad 0 600 | .quad l_OBJC_METH_VAR_NAME_.57 601 | .quad l_OBJC_METH_VAR_TYPE_.58 602 | .quad 0 603 | .quad l_OBJC_METH_VAR_NAME_.59 604 | .quad l_OBJC_METH_VAR_TYPE_.60 605 | .quad 0 606 | .quad l_OBJC_METH_VAR_NAME_.61 607 | .quad l_OBJC_METH_VAR_TYPE_.62 608 | .quad 0 609 | .quad l_OBJC_METH_VAR_NAME_.63 610 | .quad l_OBJC_METH_VAR_TYPE_.45 611 | .quad 0 612 | .quad l_OBJC_METH_VAR_NAME_.64 613 | .quad l_OBJC_METH_VAR_TYPE_.45 614 | .quad 0 615 | .quad l_OBJC_METH_VAR_NAME_.65 616 | .quad l_OBJC_METH_VAR_TYPE_.45 617 | .quad 0 618 | .quad l_OBJC_METH_VAR_NAME_.66 619 | .quad l_OBJC_METH_VAR_TYPE_ 620 | .quad 0 621 | .quad l_OBJC_METH_VAR_NAME_.67 622 | .quad l_OBJC_METH_VAR_TYPE_.62 623 | .quad 0 624 | .quad l_OBJC_METH_VAR_NAME_.68 625 | .quad l_OBJC_METH_VAR_TYPE_.45 626 | .quad 0 627 | .quad l_OBJC_METH_VAR_NAME_.69 628 | .quad l_OBJC_METH_VAR_TYPE_.45 629 | .quad 0 630 | .quad l_OBJC_METH_VAR_NAME_.70 631 | .quad l_OBJC_METH_VAR_TYPE_.47 632 | .quad 0 633 | .quad l_OBJC_METH_VAR_NAME_.71 634 | .quad l_OBJC_METH_VAR_TYPE_.72 635 | .quad 0 636 | .quad l_OBJC_METH_VAR_NAME_.73 637 | .quad l_OBJC_METH_VAR_TYPE_.74 638 | .quad 0 639 | .quad l_OBJC_METH_VAR_NAME_.75 640 | .quad l_OBJC_METH_VAR_TYPE_.45 641 | .quad 0 642 | .quad l_OBJC_METH_VAR_NAME_.76 643 | .quad l_OBJC_METH_VAR_TYPE_.45 644 | .quad 0 645 | .quad l_OBJC_METH_VAR_NAME_.77 646 | .quad l_OBJC_METH_VAR_TYPE_.47 647 | .quad 0 648 | .quad l_OBJC_METH_VAR_NAME_.78 649 | .quad l_OBJC_METH_VAR_TYPE_ 650 | .quad 0 651 | .quad l_OBJC_METH_VAR_NAME_.79 652 | .quad l_OBJC_METH_VAR_TYPE_.80 653 | .quad 0 654 | .quad l_OBJC_METH_VAR_NAME_.81 655 | .quad l_OBJC_METH_VAR_TYPE_.80 656 | .quad 0 657 | .quad l_OBJC_METH_VAR_NAME_.82 658 | .quad l_OBJC_METH_VAR_TYPE_.80 659 | .quad 0 660 | .quad l_OBJC_METH_VAR_NAME_.83 661 | .quad l_OBJC_METH_VAR_TYPE_.80 662 | .quad 0 663 | .quad l_OBJC_METH_VAR_NAME_.84 664 | .quad l_OBJC_METH_VAR_TYPE_.80 665 | .quad 0 666 | .quad l_OBJC_METH_VAR_NAME_.85 667 | .quad l_OBJC_METH_VAR_TYPE_.80 668 | .quad 0 669 | .quad l_OBJC_METH_VAR_NAME_.86 670 | .quad l_OBJC_METH_VAR_TYPE_.80 671 | .quad 0 672 | .quad l_OBJC_METH_VAR_NAME_.87 673 | .quad l_OBJC_METH_VAR_TYPE_.80 674 | .quad 0 675 | .quad l_OBJC_METH_VAR_NAME_.88 676 | .quad l_OBJC_METH_VAR_TYPE_.80 677 | .quad 0 678 | .quad l_OBJC_METH_VAR_NAME_.89 679 | .quad l_OBJC_METH_VAR_TYPE_.80 680 | .quad 0 681 | .quad l_OBJC_METH_VAR_NAME_.90 682 | .quad l_OBJC_METH_VAR_TYPE_.80 683 | .quad 0 684 | .quad l_OBJC_METH_VAR_NAME_.91 685 | .quad l_OBJC_METH_VAR_TYPE_.80 686 | .quad 0 687 | .quad l_OBJC_METH_VAR_NAME_.92 688 | .quad l_OBJC_METH_VAR_TYPE_.80 689 | .quad 0 690 | .quad l_OBJC_METH_VAR_NAME_.93 691 | .quad l_OBJC_METH_VAR_TYPE_.80 692 | .quad 0 693 | .quad l_OBJC_METH_VAR_NAME_.94 694 | .quad l_OBJC_METH_VAR_TYPE_.80 695 | .quad 0 696 | .quad l_OBJC_METH_VAR_NAME_.95 697 | .quad l_OBJC_METH_VAR_TYPE_.80 698 | .quad 0 699 | .quad l_OBJC_METH_VAR_NAME_.96 700 | .quad l_OBJC_METH_VAR_TYPE_.80 701 | .quad 0 702 | 703 | .section __TEXT,__objc_methtype,cstring_literals 704 | l_OBJC_METH_VAR_TYPE_.97: 705 | .asciz "Q24@0:8@\"NSApplication\"16" 706 | 707 | l_OBJC_METH_VAR_TYPE_.98: 708 | .asciz "v32@0:8@\"NSApplication\"16@\"NSArray\"24" 709 | 710 | l_OBJC_METH_VAR_TYPE_.99: 711 | .asciz "B32@0:8@\"NSApplication\"16@\"NSString\"24" 712 | 713 | l_OBJC_METH_VAR_TYPE_.100: 714 | .asciz "B24@0:8@\"NSApplication\"16" 715 | 716 | l_OBJC_METH_VAR_TYPE_.101: 717 | .asciz "B32@0:8@16@\"NSString\"24" 718 | 719 | l_OBJC_METH_VAR_TYPE_.102: 720 | .asciz "Q44@0:8@\"NSApplication\"16@\"NSArray\"24@\"NSDictionary\"32B40" 721 | 722 | l_OBJC_METH_VAR_TYPE_.103: 723 | .asciz "B28@0:8@\"NSApplication\"16B24" 724 | 725 | l_OBJC_METH_VAR_TYPE_.104: 726 | .asciz "@\"NSMenu\"24@0:8@\"NSApplication\"16" 727 | 728 | l_OBJC_METH_VAR_TYPE_.105: 729 | .asciz "@\"NSError\"32@0:8@\"NSApplication\"16@\"NSError\"24" 730 | 731 | l_OBJC_METH_VAR_TYPE_.106: 732 | .asciz "v32@0:8@\"NSApplication\"16@\"NSData\"24" 733 | 734 | l_OBJC_METH_VAR_TYPE_.107: 735 | .asciz "v32@0:8@\"NSApplication\"16@\"NSError\"24" 736 | 737 | l_OBJC_METH_VAR_TYPE_.108: 738 | .asciz "v32@0:8@\"NSApplication\"16@\"NSDictionary\"24" 739 | 740 | l_OBJC_METH_VAR_TYPE_.109: 741 | .asciz "@32@0:8@\"NSApplication\"16@\"INIntent\"24" 742 | 743 | l_OBJC_METH_VAR_TYPE_.110: 744 | .asciz "v32@0:8@\"NSApplication\"16@\"NSCoder\"24" 745 | 746 | l_OBJC_METH_VAR_TYPE_.111: 747 | .asciz "B40@0:8@\"NSApplication\"16@\"NSUserActivity\"24@?32" 748 | 749 | l_OBJC_METH_VAR_TYPE_.112: 750 | .asciz "v40@0:8@\"NSApplication\"16@\"NSString\"24@\"NSError\"32" 751 | 752 | l_OBJC_METH_VAR_TYPE_.113: 753 | .asciz "v32@0:8@\"NSApplication\"16@\"NSUserActivity\"24" 754 | 755 | l_OBJC_METH_VAR_TYPE_.114: 756 | .asciz "v32@0:8@\"NSApplication\"16@\"CKShareMetadata\"24" 757 | 758 | l_OBJC_METH_VAR_TYPE_.115: 759 | .asciz "v24@0:8@\"NSNotification\"16" 760 | 761 | .section __DATA,__objc_const 762 | .p2align 3, 0x0 763 | __OBJC_$_PROTOCOL_METHOD_TYPES_NSApplicationDelegate: 764 | .quad l_OBJC_METH_VAR_TYPE_.97 765 | .quad l_OBJC_METH_VAR_TYPE_.98 766 | .quad l_OBJC_METH_VAR_TYPE_.99 767 | .quad l_OBJC_METH_VAR_TYPE_.98 768 | .quad l_OBJC_METH_VAR_TYPE_.99 769 | .quad l_OBJC_METH_VAR_TYPE_.100 770 | .quad l_OBJC_METH_VAR_TYPE_.100 771 | .quad l_OBJC_METH_VAR_TYPE_.101 772 | .quad l_OBJC_METH_VAR_TYPE_.99 773 | .quad l_OBJC_METH_VAR_TYPE_.102 774 | .quad l_OBJC_METH_VAR_TYPE_.100 775 | .quad l_OBJC_METH_VAR_TYPE_.103 776 | .quad l_OBJC_METH_VAR_TYPE_.104 777 | .quad l_OBJC_METH_VAR_TYPE_.105 778 | .quad l_OBJC_METH_VAR_TYPE_.106 779 | .quad l_OBJC_METH_VAR_TYPE_.107 780 | .quad l_OBJC_METH_VAR_TYPE_.108 781 | .quad l_OBJC_METH_VAR_TYPE_.100 782 | .quad l_OBJC_METH_VAR_TYPE_.109 783 | .quad l_OBJC_METH_VAR_TYPE_.110 784 | .quad l_OBJC_METH_VAR_TYPE_.110 785 | .quad l_OBJC_METH_VAR_TYPE_.99 786 | .quad l_OBJC_METH_VAR_TYPE_.111 787 | .quad l_OBJC_METH_VAR_TYPE_.112 788 | .quad l_OBJC_METH_VAR_TYPE_.113 789 | .quad l_OBJC_METH_VAR_TYPE_.114 790 | .quad l_OBJC_METH_VAR_TYPE_.99 791 | .quad l_OBJC_METH_VAR_TYPE_.100 792 | .quad l_OBJC_METH_VAR_TYPE_.115 793 | .quad l_OBJC_METH_VAR_TYPE_.115 794 | .quad l_OBJC_METH_VAR_TYPE_.115 795 | .quad l_OBJC_METH_VAR_TYPE_.115 796 | .quad l_OBJC_METH_VAR_TYPE_.115 797 | .quad l_OBJC_METH_VAR_TYPE_.115 798 | .quad l_OBJC_METH_VAR_TYPE_.115 799 | .quad l_OBJC_METH_VAR_TYPE_.115 800 | .quad l_OBJC_METH_VAR_TYPE_.115 801 | .quad l_OBJC_METH_VAR_TYPE_.115 802 | .quad l_OBJC_METH_VAR_TYPE_.115 803 | .quad l_OBJC_METH_VAR_TYPE_.115 804 | .quad l_OBJC_METH_VAR_TYPE_.115 805 | .quad l_OBJC_METH_VAR_TYPE_.115 806 | .quad l_OBJC_METH_VAR_TYPE_.115 807 | .quad l_OBJC_METH_VAR_TYPE_.115 808 | .quad l_OBJC_METH_VAR_TYPE_.115 809 | 810 | .private_extern __OBJC_PROTOCOL_$_NSApplicationDelegate 811 | .section __DATA,__data 812 | .globl __OBJC_PROTOCOL_$_NSApplicationDelegate 813 | .weak_definition __OBJC_PROTOCOL_$_NSApplicationDelegate 814 | .p2align 3, 0x0 815 | __OBJC_PROTOCOL_$_NSApplicationDelegate: 816 | .quad 0 817 | .quad l_OBJC_CLASS_NAME_.1 818 | .quad __OBJC_$_PROTOCOL_REFS_NSApplicationDelegate 819 | .quad 0 820 | .quad 0 821 | .quad __OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT_NSApplicationDelegate 822 | .quad 0 823 | .quad 0 824 | .long 96 825 | .long 0 826 | .quad __OBJC_$_PROTOCOL_METHOD_TYPES_NSApplicationDelegate 827 | .quad 0 828 | .quad 0 829 | 830 | .private_extern __OBJC_LABEL_PROTOCOL_$_NSApplicationDelegate 831 | .section __DATA,__objc_protolist,coalesced,no_dead_strip 832 | .globl __OBJC_LABEL_PROTOCOL_$_NSApplicationDelegate 833 | .weak_definition __OBJC_LABEL_PROTOCOL_$_NSApplicationDelegate 834 | .p2align 3, 0x0 835 | __OBJC_LABEL_PROTOCOL_$_NSApplicationDelegate: 836 | .quad __OBJC_PROTOCOL_$_NSApplicationDelegate 837 | 838 | .section __DATA,__objc_const 839 | .p2align 3, 0x0 840 | __OBJC_CLASS_PROTOCOLS_$_MACHAppDelegate: 841 | .quad 1 842 | .quad __OBJC_PROTOCOL_$_NSApplicationDelegate 843 | .quad 0 844 | 845 | .p2align 3, 0x0 846 | __OBJC_METACLASS_RO_$_MACHAppDelegate: 847 | .long 389 848 | .long 40 849 | .long 40 850 | .space 4 851 | .quad 0 852 | .quad l_OBJC_CLASS_NAME_ 853 | .quad 0 854 | .quad __OBJC_CLASS_PROTOCOLS_$_MACHAppDelegate 855 | .quad 0 856 | .quad 0 857 | .quad 0 858 | 859 | .section __DATA,__objc_data 860 | .globl _OBJC_METACLASS_$_MACHAppDelegate 861 | .p2align 3, 0x0 862 | _OBJC_METACLASS_$_MACHAppDelegate: 863 | .quad _OBJC_METACLASS_$_NSObject 864 | .quad _OBJC_METACLASS_$_NSObject 865 | .quad __objc_empty_cache 866 | .quad 0 867 | .quad __OBJC_METACLASS_RO_$_MACHAppDelegate 868 | 869 | .section __TEXT,__objc_classname,cstring_literals 870 | l_OBJC_CLASS_NAME_.116: 871 | .asciz "\001" 872 | 873 | .section __TEXT,__objc_methname,cstring_literals 874 | l_OBJC_METH_VAR_NAME_.117: 875 | .asciz ".cxx_destruct" 876 | 877 | .section __TEXT,__objc_methtype,cstring_literals 878 | l_OBJC_METH_VAR_TYPE_.118: 879 | .asciz "v16@0:8" 880 | 881 | .section __DATA,__objc_const 882 | .p2align 3, 0x0 883 | __OBJC_$_INSTANCE_METHODS_MACHAppDelegate: 884 | .long 24 885 | .long 4 886 | .quad l_OBJC_METH_VAR_NAME_.81 887 | .quad l_OBJC_METH_VAR_TYPE_.80 888 | .quad "-[MACHAppDelegate applicationDidFinishLaunching:]" 889 | .quad l_OBJC_METH_VAR_NAME_.42 890 | .quad l_OBJC_METH_VAR_TYPE_.43 891 | .quad "-[MACHAppDelegate applicationShouldTerminate:]" 892 | .quad l_OBJC_METH_VAR_NAME_.56 893 | .quad l_OBJC_METH_VAR_TYPE_ 894 | .quad "-[MACHAppDelegate applicationShouldTerminateAfterLastWindowClosed:]" 895 | .quad l_OBJC_METH_VAR_NAME_.117 896 | .quad l_OBJC_METH_VAR_TYPE_.118 897 | .quad "-[MACHAppDelegate .cxx_destruct]" 898 | 899 | .private_extern _OBJC_IVAR_$_MACHAppDelegate._runBlock 900 | .section __DATA,__objc_ivar 901 | .globl _OBJC_IVAR_$_MACHAppDelegate._runBlock 902 | .p2align 2, 0x0 903 | _OBJC_IVAR_$_MACHAppDelegate._runBlock: 904 | .long 8 905 | 906 | .section __TEXT,__objc_methname,cstring_literals 907 | l_OBJC_METH_VAR_NAME_.119: 908 | .asciz "_runBlock" 909 | 910 | .section __TEXT,__objc_methtype,cstring_literals 911 | l_OBJC_METH_VAR_TYPE_.120: 912 | .asciz "@?" 913 | 914 | .section __DATA,__objc_const 915 | .p2align 3, 0x0 916 | __OBJC_$_INSTANCE_VARIABLES_MACHAppDelegate: 917 | .long 32 918 | .long 1 919 | .quad _OBJC_IVAR_$_MACHAppDelegate._runBlock 920 | .quad l_OBJC_METH_VAR_NAME_.119 921 | .quad l_OBJC_METH_VAR_TYPE_.120 922 | .long 3 923 | .long 8 924 | 925 | .p2align 3, 0x0 926 | __OBJC_$_PROP_LIST_MACHAppDelegate: 927 | .long 16 928 | .long 4 929 | .quad l_OBJC_PROP_NAME_ATTR_ 930 | .quad l_OBJC_PROP_NAME_ATTR_.33 931 | .quad l_OBJC_PROP_NAME_ATTR_.34 932 | .quad l_OBJC_PROP_NAME_ATTR_.35 933 | .quad l_OBJC_PROP_NAME_ATTR_.36 934 | .quad l_OBJC_PROP_NAME_ATTR_.37 935 | .quad l_OBJC_PROP_NAME_ATTR_.38 936 | .quad l_OBJC_PROP_NAME_ATTR_.39 937 | 938 | .p2align 3, 0x0 939 | __OBJC_CLASS_RO_$_MACHAppDelegate: 940 | .long 388 941 | .long 8 942 | .long 16 943 | .space 4 944 | .quad l_OBJC_CLASS_NAME_.116 945 | .quad l_OBJC_CLASS_NAME_ 946 | .quad __OBJC_$_INSTANCE_METHODS_MACHAppDelegate 947 | .quad __OBJC_CLASS_PROTOCOLS_$_MACHAppDelegate 948 | .quad __OBJC_$_INSTANCE_VARIABLES_MACHAppDelegate 949 | .quad 0 950 | .quad __OBJC_$_PROP_LIST_MACHAppDelegate 951 | 952 | .section __DATA,__objc_data 953 | .globl _OBJC_CLASS_$_MACHAppDelegate 954 | .p2align 3, 0x0 955 | _OBJC_CLASS_$_MACHAppDelegate: 956 | .quad _OBJC_METACLASS_$_MACHAppDelegate 957 | .quad _OBJC_CLASS_$_NSObject 958 | .quad __objc_empty_cache 959 | .quad 0 960 | .quad __OBJC_CLASS_RO_$_MACHAppDelegate 961 | 962 | .section __DATA,__objc_classlist,regular,no_dead_strip 963 | .p2align 3, 0x0 964 | l_OBJC_LABEL_CLASS_$: 965 | .quad _OBJC_CLASS_$_MACHAppDelegate 966 | 967 | .no_dead_strip __OBJC_LABEL_PROTOCOL_$_NSApplicationDelegate 968 | .no_dead_strip __OBJC_LABEL_PROTOCOL_$_NSObject 969 | .no_dead_strip __OBJC_PROTOCOL_$_NSApplicationDelegate 970 | .no_dead_strip __OBJC_PROTOCOL_$_NSObject 971 | .section __DATA,__objc_imageinfo,regular,no_dead_strip 972 | L_OBJC_IMAGE_INFO: 973 | .long 0 974 | .long 64 975 | 976 | .subsections_via_symbols 977 | -------------------------------------------------------------------------------- /avf_audio_headers.m: -------------------------------------------------------------------------------- 1 | // NOTE(mach): this is: 2 | // 3 | // #include 4 | // 5 | // But Apple's macOS 14 SDK does not include 'deprecated' symbols like requestRecordPermission 6 | // in the headers. This function was deprecated in macOS 14 (the absolute latest macOS version 7 | // at the time of writing this), so we cannot use the new API yet - but the 'deprecated' API 8 | // is not available in the 14.x SDK. So for now we use an old version of the header ourselves 9 | // here. 10 | 11 | #if (defined(USE_AVFAUDIO_PUBLIC_HEADERS) && USE_AVFAUDIO_PUBLIC_HEADERS) || !__has_include() 12 | /*! 13 | @file AVAudioSession.h 14 | @framework AudioSession.framework 15 | @copyright (c) 2009-2020 Apple Inc. All rights reserved. 16 | */ 17 | 18 | #ifndef AudioSession_AVAudioSession_h 19 | #define AudioSession_AVAudioSession_h 20 | 21 | #import 22 | // Note: historically, declarations in AVAudioSessionRoute.h and AVAudioSessionTypes.h were 23 | // declared in AVAudioSession.h. They must be imported here to preserve backwards compatibility. 24 | #import 25 | #import 26 | #import 27 | 28 | NS_ASSUME_NONNULL_BEGIN 29 | 30 | // Forward declarations 31 | @class NSError, NSString, NSNumber; 32 | 33 | 34 | // ================================================================================================= 35 | #pragma mark-- iOS/tvOS/watchOS AVAudioSession interface -- 36 | 37 | API_AVAILABLE(ios(3.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos) 38 | @interface AVAudioSession : NSObject { 39 | @private 40 | void *_impl; 41 | } 42 | 43 | /// Return singleton instance. 44 | + (AVAudioSession *)sharedInstance API_AVAILABLE(ios(3.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 45 | 46 | /// Get the list of categories available on the device. Certain categories may be unavailable on 47 | /// particular devices. For example, AVAudioSessionCategoryRecord will not be available on devices 48 | /// that have no support for audio input. 49 | @property (readonly, nonatomic) NSArray *availableCategories API_AVAILABLE(ios(9.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 50 | 51 | /// Set session category. 52 | - (BOOL)setCategory:(AVAudioSessionCategory)category error:(NSError **)outError API_AVAILABLE(ios(3.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 53 | /// Set session category with options. 54 | - (BOOL)setCategory:(AVAudioSessionCategory)category 55 | withOptions:(AVAudioSessionCategoryOptions)options 56 | error:(NSError **)outError 57 | API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 58 | /// Set session category and mode with options. 59 | - (BOOL)setCategory:(AVAudioSessionCategory)category 60 | mode:(AVAudioSessionMode)mode 61 | options:options 62 | error:(NSError **)outError 63 | API_AVAILABLE(ios(10.0), watchos(3.0), tvos(10.0)) API_UNAVAILABLE(macos); 64 | 65 | /*! 66 | @brief Set session category, mode, routing sharing policy, and options. 67 | 68 | Use of the long-form route sharing policy is only valid in conjunction with a limited set of 69 | category, mode, and option values. 70 | 71 | Allowed categories: AVAudioSessionCategoryPlayback. 72 | 73 | Allowed modes: AVAudioSessionModeDefault, AVAudioSessionModeMoviePlayback, 74 | AVAudioSessionModeSpokenAudio. 75 | 76 | Allowed options: None. Options are allowed when changing the routing policy back to Default, 77 | however. 78 | */ 79 | - (BOOL)setCategory:(AVAudioSessionCategory)category 80 | mode:(AVAudioSessionMode)mode 81 | routeSharingPolicy:(AVAudioSessionRouteSharingPolicy)policy 82 | options:(AVAudioSessionCategoryOptions)options 83 | error:(NSError **)outError API_AVAILABLE(ios(11.0), tvos(11.0), watchos(5.0)) API_UNAVAILABLE(macos); 84 | 85 | /// Get session category. 86 | /// Examples: AVAudioSessionCategoryRecord, AVAudioSessionCategoryPlayAndRecord, etc. 87 | @property (readonly) AVAudioSessionCategory category API_AVAILABLE(ios(3.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 88 | 89 | /// Get the current set of AVAudioSessionCategoryOptions. 90 | @property (readonly) AVAudioSessionCategoryOptions categoryOptions API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 91 | 92 | /*! 93 | @brief Get the route sharing policy. 94 | 95 | See AVAudioSessionRouteSharingPolicy for a description of the available policies. 96 | See setCategory:mode:routeSharingPolicy:options:error: for additional discussion. 97 | */ 98 | @property (readonly) AVAudioSessionRouteSharingPolicy routeSharingPolicy API_AVAILABLE(ios(11.0), tvos(11.0), watchos(5.0)) API_UNAVAILABLE(macos); 99 | 100 | /// Get the list of modes available on the device. Certain modes may be unavailable on particular 101 | /// devices. For example, AVAudioSessionModeVideoRecording will not be available on devices that 102 | /// have no support for recording video. 103 | @property (readonly) NSArray *availableModes API_AVAILABLE(ios(9.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 104 | 105 | /*! 106 | @brief Set the session's mode. 107 | 108 | Modes modify the audio category in order to introduce behavior that is tailored to the specific 109 | use of audio within an application. Examples: AVAudioSessionModeVideoRecording, 110 | AVAudioSessionModeVoiceChat, AVAudioSessionModeMeasurement, etc. 111 | */ 112 | - (BOOL)setMode:(AVAudioSessionMode)mode 113 | error:(NSError **)outError 114 | API_AVAILABLE(ios(5.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 115 | 116 | /// Get the session's mode. 117 | @property (readonly) 118 | AVAudioSessionMode mode API_AVAILABLE(ios(5.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 119 | 120 | /// Set allowHapticsAndSystemSoundsDuringRecording to YES in order to allow system sounds and haptics to play while the session is actively using audio input. 121 | /// Default value is NO. 122 | - (BOOL)setAllowHapticsAndSystemSoundsDuringRecording:(BOOL)inValue error:(NSError **)outError API_AVAILABLE(ios(13.0), watchos(6.0), tvos(13.0)) API_UNAVAILABLE(macos); 123 | 124 | /// Whether system sounds and haptics can play while the session is actively using audio input. 125 | @property(readonly) BOOL allowHapticsAndSystemSoundsDuringRecording API_AVAILABLE(ios(13.0), watchos(6.0), tvos(13.0)) API_UNAVAILABLE(macos); 126 | 127 | /// Returns an enum indicating whether the user has granted or denied permission to record, or has 128 | /// not been asked 129 | @property (readonly) AVAudioSessionRecordPermission recordPermission API_AVAILABLE(ios(8.0), watchos(4.0)) API_UNAVAILABLE(macos, tvos); 130 | 131 | 132 | /*! 133 | @brief Checks to see if calling process has permission to record audio. 134 | 135 | The 'response' block will be called immediately if permission has already been granted or 136 | denied. Otherwise, it presents a dialog to notify the user and allow them to choose, and calls 137 | the block once the UI has been dismissed. 'granted' indicates whether permission has been 138 | granted. Note that the block may be called in a different thread context. 139 | */ 140 | - (void)requestRecordPermission:(void (^)(BOOL granted))response API_AVAILABLE(ios(7.0), watchos(4.0)) API_UNAVAILABLE(macos, tvos); 141 | 142 | /*! 143 | @brief Use this method to temporarily override the output to built-in speaker. 144 | 145 | This method is only valid for a session using PlayAndRecord category. This change remains in 146 | effect only until the current route changes or you call this method again with the 147 | AVAudioSessionPortOverrideNone option. Sessions using PlayAndRecord category that always want to 148 | prefer the built-in speaker output over the receiver, should use 149 | AVAudioSessionCategoryOptionDefaultToSpeaker instead. 150 | */ 151 | - (BOOL)overrideOutputAudioPort:(AVAudioSessionPortOverride)portOverride 152 | error:(NSError **)outError 153 | API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 154 | 155 | 156 | /*! 157 | @brief Select a preferred input port for audio routing. 158 | 159 | If the input port is already part of the current audio route, this will have no effect. 160 | Otherwise, selecting an input port for routing will initiate a route change to use the preferred 161 | input port. Setting a nil value will clear the preference. 162 | */ 163 | - (BOOL)setPreferredInput:(nullable AVAudioSessionPortDescription *)inPort 164 | error:(NSError **)outError API_AVAILABLE(ios(7.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 165 | 166 | /// Get the preferred input port. Will be nil if no preference has been set. 167 | @property (readonly, nullable) AVAudioSessionPortDescription *preferredInput API_AVAILABLE(ios(7.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 168 | 169 | /*! 170 | @brief Set ringtone and alert interruption preference. 171 | 172 | Inform the system when the session prefers to not be interrupted by 173 | ringtones and alerts. By setting this property to YES, clients will not be interrupted 174 | by incoming call notifications and other alerts. Starting in iOS 14.0, users can set a global 175 | preference for incoming call display style to "Banner" or "Full Screen". With "Banner" display style, 176 | if below property is set to YES then clients will not be interrupted on incoming call notification 177 | and user will have opportunity to accept or decline the call. If call is declined, the session 178 | will not be interrupted, but if user accepts the incoming call, the session will be interrupted. 179 | With display style set as "Full Screen", below property will have no effect and clients will be 180 | interrupted by incoming calls. Apps that record audio and/or video and apps that are used for 181 | music performance are candidates for using this feature. 182 | */ 183 | - (BOOL)setPrefersNoInterruptionsFromSystemAlerts:(BOOL)inValue error:(NSError**)outError API_AVAILABLE(ios(14.5), watchos(7.3), tvos(14.5)) API_UNAVAILABLE(macos); 184 | @property (readonly, nonatomic) BOOL prefersNoInterruptionsFromSystemAlerts API_AVAILABLE(ios(14.5), watchos(7.3), tvos(14.5)) API_UNAVAILABLE(macos); 185 | 186 | @end 187 | 188 | // ------------------------------------------------------------------------------------------------- 189 | #pragma mark-- activation and deactivation -- 190 | // ------------------------------------------------------------------------------------------------- 191 | @interface AVAudioSession (Activation) 192 | 193 | /*! 194 | @brief Set the session active or inactive. 195 | 196 | Note that activating an audio session is a synchronous (blocking) operation. 197 | Therefore, we recommend that applications not activate their session from a thread where a long 198 | blocking operation will be problematic. When deactivating a session, the caller is required to 199 | first stop or pause all running I/Os (e.g. audio queues, players, recorders, converters, 200 | remote I/Os, etc.). Starting in iOS 8, if the session has running I/Os at the time that 201 | deactivation is requested, the session will be deactivated, but the method will return NO and 202 | populate the NSError with the code property set to AVAudioSessionErrorCodeIsBusy to indicate the 203 | misuse of the API. Prior to iOS 8, the session would have remained active if it had running I/Os 204 | at the time of the deactivation request. 205 | */ 206 | - (BOOL)setActive:(BOOL)active error:(NSError **)outError API_AVAILABLE(ios(3.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 207 | - (BOOL)setActive:(BOOL)active withOptions:(AVAudioSessionSetActiveOptions)options error:(NSError **)outError API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 208 | 209 | /*! 210 | @brief Asynchronously activate the session. 211 | 212 | This is a relatively time consuming operation. The completion handler will be called when the 213 | activation completes or if an error occurs while attempting to activate the session. If the 214 | session is configured to use AVAudioSessionRouteSharingPolicyLongFormAudio on watchOS, this 215 | method will also cause a route picker to be presented to the user in cases where an appropriate 216 | output route has not already been selected automatically. watchOS apps using 217 | AVAudioSessionRouteSharingPolicyLongFormAudio should be prepared for this method to fail if no 218 | eligible audio route can be activated or if the user cancels the route picker view. 219 | */ 220 | - (void)activateWithOptions:(AVAudioSessionActivationOptions)options completionHandler:(void (^)(BOOL activated, NSError * _Nullable error))handler API_AVAILABLE(watchos(5.0)) API_UNAVAILABLE(ios, tvos) API_UNAVAILABLE(macos, macCatalyst); 221 | 222 | @end // AVAudioSession(Activation) 223 | 224 | /*! 225 | @brief this category deals with the set of properties that reflect the current state of 226 | audio hardware in the current route. Applications whose functionality depends on these 227 | properties should reevaluate them any time the route changes. 228 | */ 229 | @interface AVAudioSession (AVAudioSessionHardwareConfiguration) 230 | 231 | /*! Get and set preferred values for hardware properties. Note: that there are corresponding read-only 232 | properties that describe the actual values for sample rate, I/O buffer duration, etc. 233 | */ 234 | 235 | /// The preferred hardware sample rate for the session. The actual sample rate may be different. 236 | - (BOOL)setPreferredSampleRate:(double)sampleRate error:(NSError **)outError API_AVAILABLE(ios(6.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 237 | @property (readonly) double preferredSampleRate API_AVAILABLE(ios(6.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 238 | 239 | /// The preferred hardware IO buffer duration in seconds. The actual IO buffer duration may be 240 | /// different. 241 | - (BOOL)setPreferredIOBufferDuration:(NSTimeInterval)duration error:(NSError **)outError API_AVAILABLE(ios(3.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 242 | @property (readonly) NSTimeInterval preferredIOBufferDuration API_AVAILABLE(ios(3.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 243 | 244 | /// Sets the number of input channels that the app would prefer for the current route 245 | - (BOOL)setPreferredInputNumberOfChannels:(NSInteger)count error:(NSError **)outError API_AVAILABLE(ios(7.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 246 | @property (readonly) NSInteger preferredInputNumberOfChannels API_AVAILABLE(ios(7.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 247 | 248 | /// Sets the number of output channels that the app would prefer for the current route 249 | - (BOOL)setPreferredOutputNumberOfChannels:(NSInteger)count error:(NSError **)outError API_AVAILABLE(ios(7.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 250 | @property (readonly) NSInteger preferredOutputNumberOfChannels API_AVAILABLE(ios(7.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 251 | 252 | /*! Sets the preferred input orientation. 253 | The input orientation determines which directions will be left and right 254 | when a built-in mic data source with the AVAudioSessionPolarPatternStereo polar pattern is selected. 255 | Typically, this orientation should match how the user is holding the device while recording, which will match 256 | the application's interface orientation when a single app is on the screen. 257 | The actual input orientation may be different, for example, if another app's session is in control of routing. 258 | The input orientation is independent of the orientation property of an AVAudioSessionDataSourceDescription. */ 259 | - (BOOL)setPreferredInputOrientation:(AVAudioStereoOrientation)orientation error:(NSError **)outError API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(watchos, tvos, macos); 260 | @property (readonly) AVAudioStereoOrientation preferredInputOrientation API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(watchos, tvos, macos); 261 | 262 | /// Describes the orientation of the input data source (valid for the built-in mic input data source when a stereo polar pattern is selected). 263 | @property (readonly) AVAudioStereoOrientation inputOrientation API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(watchos, tvos, macos); 264 | 265 | /// Returns the largest number of audio input channels available for the current route 266 | @property (readonly) NSInteger maximumInputNumberOfChannels API_AVAILABLE(ios(7.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 267 | 268 | /// Returns the largest number of audio output channels available for the current route 269 | @property (readonly) NSInteger maximumOutputNumberOfChannels API_AVAILABLE(ios(7.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 270 | 271 | /*! 272 | @brief A value defined over the range [0.0, 1.0], with 0.0 corresponding to the lowest analog 273 | gain setting and 1.0 corresponding to the highest analog gain setting. 274 | 275 | Attempting to set values outside of the defined range will result in the value being "clamped" 276 | to a valid input. This is a global input gain setting that applies to the current input source 277 | for the entire system. When no applications are using the input gain control, the system will 278 | restore the default input gain setting for the input source. Note that some audio accessories, 279 | such as USB devices, may not have a default value. This property is only valid if 280 | inputGainSettable is true. Note: inputGain is key-value observable. 281 | */ 282 | - (BOOL)setInputGain:(float)gain error:(NSError **)outError API_AVAILABLE(ios(6.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 283 | /// value in range [0.0, 1.0] 284 | @property (readonly) float inputGain API_AVAILABLE(ios(6.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 285 | 286 | /// True when audio input gain is available. Some input ports may not provide the ability to set the 287 | /// input gain, so check this value before attempting to set input gain. 288 | @property (readonly, getter=isInputGainSettable) BOOL inputGainSettable API_AVAILABLE(ios(6.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 289 | 290 | /// True if input hardware is available. 291 | @property (readonly, getter=isInputAvailable) BOOL inputAvailable API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 292 | 293 | /*! 294 | @brief DataSource methods are for use with routes that support input or output data source 295 | selection. 296 | 297 | If the attached accessory supports data source selection, the data source properties/methods 298 | provide for discovery and selection of input and/or output data sources. Note that the 299 | properties and methods for data source selection below are equivalent to the properties and 300 | methods on AVAudioSessionPortDescription. The methods below only apply to the currently routed 301 | ports. 302 | 303 | Key-value observable. 304 | */ 305 | @property (readonly, nullable) NSArray *inputDataSources API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 306 | 307 | /// Obtain the currently selected input data source. Will be nil if no data sources are available. 308 | @property (readonly, nullable) AVAudioSessionDataSourceDescription *inputDataSource API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 309 | 310 | /// Select a new input data source. Setting a nil value will clear the data source preference. 311 | - (BOOL)setInputDataSource:(nullable AVAudioSessionDataSourceDescription *)dataSource error:(NSError **)outError API_AVAILABLE(ios(6.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 312 | 313 | /// See inputDataSources for background. Key-value observable. 314 | @property (readonly, nullable) NSArray *outputDataSources API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 315 | 316 | /// Obtain the currently selected output data source. Will be nil if no data sources are available. 317 | @property (readonly, nullable) AVAudioSessionDataSourceDescription *outputDataSource API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 318 | 319 | /// Select a new output data source. Setting a nil value will clear the data source preference. 320 | - (BOOL)setOutputDataSource:(nullable AVAudioSessionDataSourceDescription *)dataSource error:(NSError **)outError API_AVAILABLE(ios(6.0), tvos(9.0)) API_UNAVAILABLE(watchos, macos); 321 | 322 | /*! 323 | @brief Current values for hardware properties. 324 | 325 | Note that most of these properties have corresponding methods for getting and setting preferred 326 | values. Input- and output-specific properties will generate an error if they are queried if the 327 | audio session category does not support them. Each of these will return 0 (or 0.0) if there is 328 | an error. 329 | */ 330 | 331 | /// The current hardware sample rate 332 | @property (readonly) double sampleRate API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 333 | 334 | /// The current number of hardware input channels. Is key-value observable. 335 | @property (readonly) NSInteger inputNumberOfChannels API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 336 | 337 | /// The current number of hardware output channels. Is key-value observable. 338 | @property (readonly) NSInteger outputNumberOfChannels API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 339 | 340 | /// The current hardware input latency in seconds. 341 | @property (readonly) NSTimeInterval inputLatency API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 342 | 343 | /// The current hardware output latency in seconds. 344 | @property (readonly) NSTimeInterval outputLatency API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 345 | 346 | /// The current hardware IO buffer duration in seconds. 347 | @property (readonly) NSTimeInterval IOBufferDuration API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 348 | 349 | @end 350 | 351 | 352 | // ------------------------------------------------------------------------------------------------- 353 | #pragma mark-- observation -- 354 | // ------------------------------------------------------------------------------------------------- 355 | @interface AVAudioSession (Observation) 356 | 357 | /*! 358 | @brief True when another application is playing audio. 359 | 360 | Note: As of iOS 8.0, Apple recommends that most applications use 361 | secondaryAudioShouldBeSilencedHint instead of this property. The otherAudioPlaying property 362 | will be true if any other audio (including audio from an app using 363 | AVAudioSessionCategoryAmbient) is playing, whereas the secondaryAudioShouldBeSilencedHint 364 | property is more restrictive in its consideration of whether primary audio from another 365 | application is playing. 366 | */ 367 | @property (readonly, getter=isOtherAudioPlaying) BOOL otherAudioPlaying API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 368 | 369 | /*! 370 | @brief True when another application with a non-mixable audio session is playing audio. 371 | 372 | Applications may use this property as a hint to silence audio that is secondary to the 373 | functionality of the application. For example, a game app using AVAudioSessionCategoryAmbient 374 | may use this property to decide to mute its soundtrack while leaving its sound effects unmuted. 375 | Note: This property is closely related to AVAudioSessionSilenceSecondaryAudioHintNotification. 376 | */ 377 | @property (readonly) BOOL secondaryAudioShouldBeSilencedHint API_AVAILABLE(ios(8.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 378 | 379 | /// The current output volume. Value in range [0.0, 1.0]. Is key-value observable. 380 | @property (readonly) float outputVolume API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 381 | 382 | /// The prompt style is a hint to sessions using AVAudioSessionModeVoicePrompt to alter the type of 383 | /// prompts they issue in response to other audio activity on the system, such as Siri and phone 384 | /// calls. This property is key-value observable. 385 | @property(readonly) AVAudioSessionPromptStyle promptStyle API_AVAILABLE(ios(13.0), watchos(6.0), tvos(13.0)) API_UNAVAILABLE(macos); 386 | 387 | @end // AVAudioSession (Observation) 388 | 389 | // ------------------------------------------------------------------------------------------------- 390 | #pragma mark-- routing configuration -- 391 | // ------------------------------------------------------------------------------------------------- 392 | @interface AVAudioSession (RoutingConfiguration) 393 | 394 | /*! 395 | @brief Get the set of input ports that are available for routing. 396 | 397 | Note that this property only applies to the session's current category and mode. For 398 | example, if the session's current category is AVAudioSessionCategoryPlayback, there will be 399 | no available inputs. 400 | */ 401 | @property (readonly, nullable) NSArray *availableInputs API_AVAILABLE(ios(7.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 402 | 403 | /// A description of the current route, consisting of zero or more input ports and zero or more 404 | /// output ports 405 | @property (readonly) AVAudioSessionRouteDescription *currentRoute 406 | API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos); 407 | 408 | /*! 409 | @brief Controls whether audio input and output are aggregated. Only valid in combination with 410 | AVAudioSessionCategoryPlayAndRecord or AVAudioSessionCategoryMultiRoute. 411 | 412 | See the AVAudioSessionIOType documentation for a more detailed explanation of why a client may 413 | want to change the IO type. 414 | */ 415 | - (BOOL)setAggregatedIOPreference:(AVAudioSessionIOType)inIOType 416 | error:(NSError **)outError API_AVAILABLE(ios(10.0)) API_UNAVAILABLE(tvos, watchos, macos); 417 | 418 | @end // interface for AVAudioSession (RoutingConfiguration) 419 | 420 | #pragma mark-- Names for NSNotifications -- 421 | 422 | /*! 423 | @brief Notification sent to registered listeners when the system has interrupted the audio 424 | session and when the interruption has ended. 425 | 426 | Check the notification's userInfo dictionary for the interruption type, which is either 427 | Begin or End. In the case of an end interruption notification, check the userInfo dictionary 428 | for AVAudioSessionInterruptionOptions that indicate whether audio playback should resume. 429 | In the case of a begin interruption notification, the reason for the interruption can be found 430 | within the info dictionary under the key AVAudioSessionInterruptionReasonKey. 431 | */ 432 | OS_EXPORT NSNotificationName const AVAudioSessionInterruptionNotification API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)); 433 | 434 | /*! 435 | @brief Notification sent to registered listeners when an audio route change has occurred. 436 | 437 | Check the notification's userInfo dictionary for the route change reason and for a description 438 | of the previous audio route. 439 | */ 440 | OS_EXPORT NSNotificationName const AVAudioSessionRouteChangeNotification API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)); 441 | 442 | /*! 443 | @brief Notification sent to registered listeners if the media server is killed. 444 | 445 | In the event that the server is killed, take appropriate steps to handle requests that come in 446 | before the server resets. See Technical Q&A QA1749. 447 | */ 448 | OS_EXPORT NSNotificationName const AVAudioSessionMediaServicesWereLostNotification API_AVAILABLE(ios(7.0), watchos(2.0), tvos(9.0)); 449 | 450 | /*! 451 | @brief Notification sent to registered listeners when the media server restarts. 452 | 453 | In the event that the server restarts, take appropriate steps to re-initialize any audio objects 454 | used by your application. See Technical Q&A QA1749. 455 | */ 456 | OS_EXPORT NSNotificationName const AVAudioSessionMediaServicesWereResetNotification API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)); 457 | 458 | /*! 459 | @brief Notification sent to registered listeners when they are in the foreground with an active 460 | audio session and primary audio from other applications starts and stops. 461 | 462 | Check the notification's userInfo dictionary for the notification type, which is either Begin or 463 | End. Foreground applications may use this notification as a hint to enable or disable audio that 464 | is secondary to the functionality of the application. For more information, see the related 465 | property secondaryAudioShouldBeSilencedHint. 466 | */ 467 | OS_EXPORT NSNotificationName const AVAudioSessionSilenceSecondaryAudioHintNotification API_AVAILABLE(ios(8.0), watchos(2.0), tvos(9.0)); 468 | 469 | 470 | #pragma mark-- Keys for NSNotification userInfo dictionaries -- 471 | 472 | /// keys for AVAudioSessionInterruptionNotification 473 | /// Value is an NSNumber representing an AVAudioSessionInterruptionType 474 | OS_EXPORT NSString *const AVAudioSessionInterruptionTypeKey API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)); 475 | 476 | /// Only present for end interruption events. Value is of type AVAudioSessionInterruptionOptions. 477 | OS_EXPORT NSString *const AVAudioSessionInterruptionOptionKey API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)); 478 | 479 | /// Only present in begin interruption events. Value is of type AVAudioSessionInterruptionReason. 480 | OS_EXPORT NSString *const AVAudioSessionInterruptionReasonKey API_AVAILABLE(ios(14.5), watchos(7.3)) API_UNAVAILABLE(tvos, macos); 481 | 482 | /*! 483 | Only present in begin interruption events, where the interruption is a direct result of the 484 | application being suspended by the operating sytem. Value is a boolean NSNumber, where a true 485 | value indicates that the interruption is the result of the application being suspended, rather 486 | than being interrupted by another audio session. 487 | 488 | Starting in iOS 10, the system will deactivate the audio session of most apps in response to the 489 | app process being suspended. When the app starts running again, it will receive the notification 490 | that its session has been deactivated by the system. Note that the notification is necessarily 491 | delayed in time, due to the fact that the application was suspended at the time the session was 492 | deactivated by the system and the notification can only be delivered once the app is running 493 | again. 494 | */ 495 | OS_EXPORT NSString *const AVAudioSessionInterruptionWasSuspendedKey API_DEPRECATED("No longer supported - see AVAudioSessionInterruptionReasonKey", ios(10.3, 14.5), watchos(3.2, 7.3), tvos(10.3, 14.5)); 496 | 497 | /// keys for AVAudioSessionRouteChangeNotification 498 | /// value is an NSNumber representing an AVAudioSessionRouteChangeReason 499 | OS_EXPORT NSString *const AVAudioSessionRouteChangeReasonKey API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)); 500 | /// value is AVAudioSessionRouteDescription * 501 | OS_EXPORT NSString *const AVAudioSessionRouteChangePreviousRouteKey API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)); 502 | 503 | /// keys for AVAudioSessionSilenceSecondaryAudioHintNotification 504 | /// value is an NSNumber representing an AVAudioSessionSilenceSecondaryAudioHintType 505 | OS_EXPORT NSString *const AVAudioSessionSilenceSecondaryAudioHintTypeKey API_AVAILABLE(ios(8.0), watchos(2.0), tvos(9.0)); 506 | 507 | NS_ASSUME_NONNULL_END 508 | 509 | // Note: This import comes at the end of the header because it contains content that was 510 | // historically part of AVAudioSession.h and it declares a class category on AVAudioSession. 511 | #import 512 | 513 | #endif // AudioSession_AVAudioSession_h 514 | #else 515 | #include 516 | #endif 517 | --------------------------------------------------------------------------------