Skip to content

Commit

Permalink
Use CoreFoundation types where previously not possible
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Dec 9, 2024
1 parent 1eb7555 commit 0320576
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 53 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions framework-crates/objc2-core-bluetooth/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions framework-crates/objc2-core-bluetooth/translation-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,3 @@ class.CBCentralManager.methods."initWithDelegate:queue:".skipped = true
class.CBCentralManager.methods."initWithDelegate:queue:options:".skipped = true
class.CBPeripheralManager.methods."initWithDelegate:queue:".skipped = true
class.CBPeripheralManager.methods."initWithDelegate:queue:options:".skipped = true

# Needs `CFAbsoluteTime`
protocol.CBCentralManagerDelegate.methods."centralManager:didDisconnectPeripheral:timestamp:isReconnecting:error:".skipped = true

# Needs `CFUUIDRef`
class.CBUUID.methods."UUIDWithCFUUID:".skipped = true
18 changes: 14 additions & 4 deletions framework-crates/objc2-core-wlan/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions framework-crates/objc2-core-wlan/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ extern crate std;
mod generated;
#[allow(unused_imports, unreachable_pub)]
pub use self::generated::*;

#[allow(dead_code)]
pub(crate) type OSStatus = i32;
20 changes: 4 additions & 16 deletions framework-crates/objc2-core-wlan/translation-config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
framework = "CoreWLAN"
crate = "objc2-core-wlan"
required-dependencies = ["objc2-foundation"]
custom-lib-rs = true
macos = "10.6"
maccatalyst = "13.0"

Expand All @@ -10,24 +11,11 @@ class.CWMutableConfiguration.counterpart = "ImmutableSuperclass(CoreWLAN::CWConf
class.CWNetworkProfile.counterpart = "MutableSubclass(CoreWLAN::CWNetworkProfile::CWMutableNetworkProfile)"
class.CWMutableNetworkProfile.counterpart = "ImmutableSuperclass(CoreWLAN::CWNetworkProfile::CWNetworkProfile)"

# Uses types from CoreFoundation
fn.CWKeychainCopyEAPUsernameAndPassword.skipped = true
fn.CWKeychainCopyEAPIdentityList.skipped = true
fn.CWKeychainSetEAPUsernameAndPassword.skipped = true
fn.CWKeychainDeleteEAPUsernameAndPassword.skipped = true
fn.CWKeychainSetPassword.skipped = true
fn.CWKeychainDeletePassword.skipped = true
fn.CWKeychainCopyEAPIdentity.skipped = true
fn.CWKeychainSetEAPIdentity.skipped = true
fn.CWKeychainCopyPassword.skipped = true
fn.CWKeychainFindWiFiPassword.skipped = true
fn.CWKeychainSetWiFiPassword.skipped = true
fn.CWKeychainDeleteWiFiPassword.skipped = true
fn.CWKeychainFindWiFiEAPUsernameAndPassword.skipped = true
fn.CWKeychainSetWiFiEAPUsernameAndPassword.skipped = true
fn.CWKeychainDeleteWiFiEAPUsernameAndPassword.skipped = true
# Needs SecIdentityRef from Security
fn.CWKeychainCopyWiFiEAPIdentity.skipped = true
fn.CWKeychainSetWiFiEAPIdentity.skipped = true
fn.CWKeychainCopyEAPIdentity.skipped = true
fn.CWKeychainSetEAPIdentity.skipped = true
class.CWInterface.methods."associateToEnterpriseNetwork:identity:username:password:error:".skipped = true

# Needs `SFAuthorization` from the `SecurityFoundation` framework
Expand Down
2 changes: 1 addition & 1 deletion framework-crates/objc2-foundation/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions framework-crates/objc2-foundation/translation-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gnustep = true

# ns_consumed / NS_RELEASES_ARGUMENT / cf_consumed / CF_CONSUMED
fn.CFBridgingRelease.skipped = true
fn.CFBridgingRetain.skipped = true
fn.NSMakeCollectable.skipped = true
fn.NSFreeMapTable.skipped = true
protocol.NSKeyedUnarchiverDelegate.methods."unarchiver:didDecodeObject:".skipped = true
Expand Down Expand Up @@ -174,10 +175,6 @@ class.NSDictionary.methods."dictionaryWithContentsOfURL:error:".skipped = true
# enough to make it safe anyhow, we need to do manual work here anyhow.
class.NSDictionary.categories.NSGenericFastEnumeration.skipped = true

# Needs CoreFoundation
fn.CFBridgingRetain.skipped = true
class.NSRunLoop.methods.getCFRunLoop.skipped = true

# Uses constants from CoreFoundation or similar frameworks
enum.NSAppleEventSendOptions.use-value = true
enum.NSCalendarUnit.use-value = true
Expand Down
5 changes: 0 additions & 5 deletions framework-crates/objc2-game-controller/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,3 @@ pub use self::extended_gamepad_snapshot::GCExtendedGamepadSnapshotData;
pub use self::generated::*;
#[cfg(feature = "GCInputNames")]
pub use self::input_names::*;

// TODO: GCKeyCode = CFIndex
// NOTE: CFIndex is c_long_long on __LLP64__ / Windows 64-bit (doesn't matter for us)
#[cfg(feature = "GCKeyCodes")]
pub type GCKeyCode = core::ffi::c_long;
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,5 @@ protocol.GCDevice.methods."setHandlerQueue:".skipped = true
protocol.GCDevicePhysicalInput.methods.queue.skipped = true
protocol.GCDevicePhysicalInput.methods."setQueue:".skipped = true

# Needs `CFIndex` (fixed locally for now)
typedef.GCKeyCode.skipped = true

# Needs `IOHIDDeviceRef` from IOKit
class.GCController.methods."supportsHIDDevice:".skipped = true
4 changes: 1 addition & 3 deletions framework-crates/objc2-quartz-core/translation-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ios = "2.0"
tvos = "9.0"
visionos = "1.0"

# Uses stuff from CoreFoundation and CoreGraphics
# Uses stuff from CoreGraphics
class.CAKeyframeAnimation.methods.path.skipped = true
class.CAKeyframeAnimation.methods."setPath:".skipped = true
class.CAShapeLayer.methods.path.skipped = true
Expand All @@ -20,8 +20,6 @@ class.CAShapeLayer.methods.strokeColor.skipped = true
class.CAShapeLayer.methods."setStrokeColor:".skipped = true
class.CAEmitterCell.methods.color.skipped = true
class.CAEmitterCell.methods."setColor:".skipped = true
class.CALayer.methods.affineTransform.skipped = true
class.CALayer.methods."setAffineTransform:".skipped = true
class.CALayer.methods."drawInContext:".skipped = true
class.CALayer.methods."renderInContext:".skipped = true
class.CALayer.methods.backgroundColor.skipped = true
Expand Down
1 change: 1 addition & 0 deletions framework-crates/objc2-ui-kit/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions framework-crates/objc2-ui-kit/translation-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ class.UIImage.methods."drawInRect:blendMode:alpha:".skipped = true
fn.UIRectFillUsingBlendMode.skipped = true
fn.UIRectFrameUsingBlendMode.skipped = true

# Needs `CFTimeInterval`
class.UIScreen.methods.calibratedLatency.skipped = true

# Needs `CGGlyph`
class.NSLayoutManager.methods."CGGlyphAtIndex:isValidIndex:".skipped = true
class.NSLayoutManager.methods."CGGlyphAtIndex:".skipped = true
Expand Down
1 change: 1 addition & 0 deletions framework-crates/objc2-vision/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions framework-crates/objc2-vision/translation-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ class.VNTargetedImageRequest.methods."initWithTargetedCMSampleBuffer:options:com
class.VNVideoProcessor.methods."analyzeTimeRange:error:".skipped = true
class.VNVideoProcessor.methods."analyzeWithTimeRange:error:".skipped = true

# Needs `CFTimeInterval` from CoreFoundation
class.VNVideoProcessorTimeIntervalCadence.methods."initWithTimeInterval:".skipped = true
class.VNVideoProcessorTimeIntervalCadence.methods.timeInterval.skipped = true

# Needs CoreVideo
class.VNTargetedImageRequest.methods."initWithTargetedCVPixelBuffer:options:".skipped = true
class.VNTargetedImageRequest.methods."initWithTargetedCVPixelBuffer:options:completionHandler:".skipped = true
Expand Down

0 comments on commit 0320576

Please sign in to comment.