-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract an ABIBindings module (#296)
- Loading branch information
1 parent
8b8c62f
commit 1589508
Showing
14 changed files
with
31 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
file(GLOB_RECURSE SOURCES *.swift) | ||
add_library(ABIBindings STATIC ${SOURCES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/// Binding for an enumeration whose ABI representation is an integer, | ||
/// and for which allowed values are limited to a set of defined enumerants. | ||
public protocol ClosedEnumBinding: RawRepresentable, PODBinding | ||
where ABIValue == RawValue, SwiftValue == Self, RawValue: FixedWidthInteger & Hashable { | ||
} | ||
|
||
extension ClosedEnumBinding { | ||
public static var abiDefaultValue: RawValue { RawValue.zero } | ||
public static func toSwift(_ value: RawValue) -> Self { Self(rawValue: value)! } | ||
public static func toABI(_ value: Self) -> RawValue { value.rawValue } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// Binds a Swift type to an identical ABI type. | ||
public protocol IdentityBinding: PODBinding where SwiftValue == ABIValue {} | ||
|
||
extension IdentityBinding { | ||
public static func toABI(_ value: SwiftValue) -> ABIValue { value } | ||
public static func toSwift(_ value: ABIValue) -> SwiftValue { value } | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@_exported import ABIBindings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
file(GLOB_RECURSE SOURCES *.swift) | ||
add_library(COM STATIC ${SOURCES}) | ||
target_link_libraries(COM PRIVATE COM_ABI SWRT_InternalABI) | ||
target_link_libraries(COM PUBLIC ABIBindings COM_ABI SWRT_InternalABI) | ||
target_link_libraries(COM PRIVATE SWRT_InternalABI) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
file(GLOB_RECURSE SOURCES *.swift) | ||
add_library(WindowsRuntime STATIC ${SOURCES}) | ||
target_link_libraries(WindowsRuntime PRIVATE COM WindowsRuntime_ABI SWRT_InternalABI) | ||
target_link_libraries(WindowsRuntime PUBLIC COM WindowsRuntime_ABI) | ||
target_link_libraries(WindowsRuntime PRIVATE SWRT_InternalABI) |