diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttribute.h b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttribute.h index 4c1a2c97..f30041d9 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttribute.h +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttribute.h @@ -11,6 +11,9 @@ #include "AGBase.h" #include "AGAttributeFlags.h" +#include "AGInputOptions.h" +#include "AGAttributeInfo.h" +#include "AGTypeID.h" typedef uint32_t AGAttribute __attribute((swift_newtype(struct))); @@ -19,22 +22,17 @@ AG_EXTERN_C_BEGIN AG_EXPORT const AGAttribute AGAttributeNil; -AG_EXTERN_C_BEGIN -AG_EXPORT -const AGAttribute AGAttributeNil; -AG_EXTERN_C_END - AG_EXPORT AG_REFINED_FOR_SWIFT AGAttribute AGGraphGetCurrentAttribute(void); AG_EXPORT AG_REFINED_FOR_SWIFT -AGAttribute AGGraphCreateOffsetAttribute(AGAttribute attribute, uint64_t offset) AG_SWIFT_NAME(AGAttribute.create(self:offset:)); +AGAttribute AGGraphCreateOffsetAttribute(AGAttribute attribute, long offset) AG_SWIFT_NAME(AGAttribute.create(self:offset:)); AG_EXPORT AG_REFINED_FOR_SWIFT -AGAttribute AGGraphCreateOffsetAttribute2(AGAttribute attribute, uint64_t offset, uint64_t size) AG_SWIFT_NAME(AGAttribute.create(self:offset:size:)); +AGAttribute AGGraphCreateOffsetAttribute2(AGAttribute attribute, long offset, uint64_t size) AG_SWIFT_NAME(AGAttribute.create(self:offset:size:)); AG_EXPORT AG_REFINED_FOR_SWIFT @@ -44,6 +42,26 @@ AG_EXPORT AG_REFINED_FOR_SWIFT void AGGraphSetFlags(AGAttribute attribute, AGAttributeFlags flags) AG_SWIFT_NAME(setter:AGAttribute.flags(self:_:)); +AG_EXPORT +AG_REFINED_FOR_SWIFT +void AGGraphAddInput(AGAttribute attribute1, AGAttribute attribute2, AGInputOptions options, long token); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +const AGAttributeInfo AGGraphGetAttributeInfo(AGAttribute attribute); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +void AGGraphMutateAttribute(AGAttribute attribute, const AGTypeID type, bool invalidating/*, closure*/); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +AGAttribute AGGraphGetIndirectDependency(AGAttribute attribute); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +void AGGraphSetIndirectDependency(AGAttribute attribute1, AGAttribute attribute2); + AG_EXTERN_C_END #endif /* AGAttribute_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttributeInfo.h b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttributeInfo.h new file mode 100644 index 00000000..390547a5 --- /dev/null +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttributeInfo.h @@ -0,0 +1,23 @@ +// +// AGAttributeInfo.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGAttributeInfo_h +#define AGAttributeInfo_h + +#include "AGBase.h" +#include "AGAttributeType.h" + +AG_ASSUME_NONNULL_BEGIN + +typedef struct AGAttributeInfo { + const AGAttributeType* type; + const void *body; +} AGAttributeInfo; + +AG_ASSUME_NONNULL_END + +#endif /* AGAttributeInfo_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttributeType.h b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttributeType.h new file mode 100644 index 00000000..4229ac2c --- /dev/null +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttributeType.h @@ -0,0 +1,24 @@ +// +// AGAttributeType.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGAttributeType_h +#define AGAttributeType_h + +#include "AGBase.h" +#include "AGTypeID.h" + +AG_ASSUME_NONNULL_BEGIN + +typedef struct AGAttributeType { + AGTypeID typeID; + AGTypeID valueTypeID; + // TODO +} AGAttributeType; + +AG_ASSUME_NONNULL_END + +#endif /* AGAttributeType_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGInputOptions.h b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGInputOptions.h new file mode 100644 index 00000000..54abdc1e --- /dev/null +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGInputOptions.h @@ -0,0 +1,18 @@ +// +// AGInputOptions.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGInputOptions_h +#define AGInputOptions_h + +#include "AGBase.h" + +typedef AG_OPTIONS(uint32_t, AGInputOptions) { + AGInputOptions_0 = 0, + AGInputOptions_1 = 1, +}; + +#endif /* AGInputOptions_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGSearchOptions.h b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGSearchOptions.h new file mode 100644 index 00000000..8cd7de49 --- /dev/null +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGSearchOptions.h @@ -0,0 +1,18 @@ +// +// AGSearchOptions.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGSearchOptions_h +#define AGSearchOptions_h + +#include "AGBase.h" + +typedef AG_OPTIONS(uint32_t, AGSearchOptions) { + AGSearchOptions_0 = 0, + AGSearchOptions_1 = 1, +}; + +#endif /* Header_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h index 2bec2681..2d97ccc3 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h @@ -8,12 +8,16 @@ #include "AGAttribute.h" #include "AGAttributeFlags.h" +#include "AGAttributeInfo.h" +#include "AGAttributeType.h" #include "AGAttributeTypeFlags.h" #include "AGBase.h" #include "AGCompareValues.h" #include "AGComparisonMode.h" #include "AGDebugServer.h" #include "AGGraph.h" +#include "AGInputOptions.h" +#include "AGSearchOptions.h" #include "AGSubgraph.h" #include "AGSwiftMetadata.h" #include "AGTupleType.h" diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios.swiftinterface b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios.swiftinterface index 7fbce9da..fdd66c28 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios.swiftinterface +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios.swiftinterface @@ -13,14 +13,20 @@ import _StringProcessing // MARK: - AGAttribute extension AGAttribute { - @inlinable + public init(_ attribute: AttributeGraph.Attribute) public func unsafeCast(to type: Value.Type) -> AttributeGraph.Attribute - @inlinable public static var current: AGAttribute? { get } - @inlinable public func unsafeOffset(at offset: Int) -> AGAttribute - @inlinable public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) + public func visitBody(_ visitor: inout Visitor); + public func mutateBody(as: Value.Type, invalidating: Swift.Bool, _ body: (inout Value) -> ()) + public func breadthFirstSearch(options: AGSearchOptions, _: (AGAttribute) -> Swift.Bool) -> Swift.Bool + public var _bodyType: Any.Type { get } + public var _bodyPointer: UnsafeRawPointer { get } + public var valueType: Any.Type { get } + public var indirectDependency: AGAttribute? { get set } } extension AGAttribute: Swift.CustomStringConvertible { @@ -60,6 +66,11 @@ extension AGAttribute: Swift.CustomStringConvertible { public func hash(into hasher: inout Swift.Hasher) public var hashValue: Swift.Int { get } public var value: Value { get set } + + @inlinable + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + @inlinable + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) } // MARK: - _AttributeBody diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-ios.swiftinterface b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-ios.swiftinterface index 7fbce9da..fdd66c28 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-ios.swiftinterface +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-ios.swiftinterface @@ -13,14 +13,20 @@ import _StringProcessing // MARK: - AGAttribute extension AGAttribute { - @inlinable + public init(_ attribute: AttributeGraph.Attribute) public func unsafeCast(to type: Value.Type) -> AttributeGraph.Attribute - @inlinable public static var current: AGAttribute? { get } - @inlinable public func unsafeOffset(at offset: Int) -> AGAttribute - @inlinable public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) + public func visitBody(_ visitor: inout Visitor); + public func mutateBody(as: Value.Type, invalidating: Swift.Bool, _ body: (inout Value) -> ()) + public func breadthFirstSearch(options: AGSearchOptions, _: (AGAttribute) -> Swift.Bool) -> Swift.Bool + public var _bodyType: Any.Type { get } + public var _bodyPointer: UnsafeRawPointer { get } + public var valueType: Any.Type { get } + public var indirectDependency: AGAttribute? { get set } } extension AGAttribute: Swift.CustomStringConvertible { @@ -60,6 +66,11 @@ extension AGAttribute: Swift.CustomStringConvertible { public func hash(into hasher: inout Swift.Hasher) public var hashValue: Swift.Int { get } public var value: Value { get set } + + @inlinable + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + @inlinable + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) } // MARK: - _AttributeBody diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttribute.h b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttribute.h index 4c1a2c97..f30041d9 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttribute.h +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttribute.h @@ -11,6 +11,9 @@ #include "AGBase.h" #include "AGAttributeFlags.h" +#include "AGInputOptions.h" +#include "AGAttributeInfo.h" +#include "AGTypeID.h" typedef uint32_t AGAttribute __attribute((swift_newtype(struct))); @@ -19,22 +22,17 @@ AG_EXTERN_C_BEGIN AG_EXPORT const AGAttribute AGAttributeNil; -AG_EXTERN_C_BEGIN -AG_EXPORT -const AGAttribute AGAttributeNil; -AG_EXTERN_C_END - AG_EXPORT AG_REFINED_FOR_SWIFT AGAttribute AGGraphGetCurrentAttribute(void); AG_EXPORT AG_REFINED_FOR_SWIFT -AGAttribute AGGraphCreateOffsetAttribute(AGAttribute attribute, uint64_t offset) AG_SWIFT_NAME(AGAttribute.create(self:offset:)); +AGAttribute AGGraphCreateOffsetAttribute(AGAttribute attribute, long offset) AG_SWIFT_NAME(AGAttribute.create(self:offset:)); AG_EXPORT AG_REFINED_FOR_SWIFT -AGAttribute AGGraphCreateOffsetAttribute2(AGAttribute attribute, uint64_t offset, uint64_t size) AG_SWIFT_NAME(AGAttribute.create(self:offset:size:)); +AGAttribute AGGraphCreateOffsetAttribute2(AGAttribute attribute, long offset, uint64_t size) AG_SWIFT_NAME(AGAttribute.create(self:offset:size:)); AG_EXPORT AG_REFINED_FOR_SWIFT @@ -44,6 +42,26 @@ AG_EXPORT AG_REFINED_FOR_SWIFT void AGGraphSetFlags(AGAttribute attribute, AGAttributeFlags flags) AG_SWIFT_NAME(setter:AGAttribute.flags(self:_:)); +AG_EXPORT +AG_REFINED_FOR_SWIFT +void AGGraphAddInput(AGAttribute attribute1, AGAttribute attribute2, AGInputOptions options, long token); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +const AGAttributeInfo AGGraphGetAttributeInfo(AGAttribute attribute); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +void AGGraphMutateAttribute(AGAttribute attribute, const AGTypeID type, bool invalidating/*, closure*/); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +AGAttribute AGGraphGetIndirectDependency(AGAttribute attribute); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +void AGGraphSetIndirectDependency(AGAttribute attribute1, AGAttribute attribute2); + AG_EXTERN_C_END #endif /* AGAttribute_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttributeInfo.h b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttributeInfo.h new file mode 100644 index 00000000..390547a5 --- /dev/null +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttributeInfo.h @@ -0,0 +1,23 @@ +// +// AGAttributeInfo.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGAttributeInfo_h +#define AGAttributeInfo_h + +#include "AGBase.h" +#include "AGAttributeType.h" + +AG_ASSUME_NONNULL_BEGIN + +typedef struct AGAttributeInfo { + const AGAttributeType* type; + const void *body; +} AGAttributeInfo; + +AG_ASSUME_NONNULL_END + +#endif /* AGAttributeInfo_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttributeType.h b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttributeType.h new file mode 100644 index 00000000..4229ac2c --- /dev/null +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttributeType.h @@ -0,0 +1,24 @@ +// +// AGAttributeType.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGAttributeType_h +#define AGAttributeType_h + +#include "AGBase.h" +#include "AGTypeID.h" + +AG_ASSUME_NONNULL_BEGIN + +typedef struct AGAttributeType { + AGTypeID typeID; + AGTypeID valueTypeID; + // TODO +} AGAttributeType; + +AG_ASSUME_NONNULL_END + +#endif /* AGAttributeType_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGInputOptions.h b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGInputOptions.h new file mode 100644 index 00000000..54abdc1e --- /dev/null +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGInputOptions.h @@ -0,0 +1,18 @@ +// +// AGInputOptions.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGInputOptions_h +#define AGInputOptions_h + +#include "AGBase.h" + +typedef AG_OPTIONS(uint32_t, AGInputOptions) { + AGInputOptions_0 = 0, + AGInputOptions_1 = 1, +}; + +#endif /* AGInputOptions_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGSearchOptions.h b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGSearchOptions.h new file mode 100644 index 00000000..8cd7de49 --- /dev/null +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGSearchOptions.h @@ -0,0 +1,18 @@ +// +// AGSearchOptions.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGSearchOptions_h +#define AGSearchOptions_h + +#include "AGBase.h" + +typedef AG_OPTIONS(uint32_t, AGSearchOptions) { + AGSearchOptions_0 = 0, + AGSearchOptions_1 = 1, +}; + +#endif /* Header_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h index 2bec2681..2d97ccc3 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h @@ -8,12 +8,16 @@ #include "AGAttribute.h" #include "AGAttributeFlags.h" +#include "AGAttributeInfo.h" +#include "AGAttributeType.h" #include "AGAttributeTypeFlags.h" #include "AGBase.h" #include "AGCompareValues.h" #include "AGComparisonMode.h" #include "AGDebugServer.h" #include "AGGraph.h" +#include "AGInputOptions.h" +#include "AGSearchOptions.h" #include "AGSubgraph.h" #include "AGSwiftMetadata.h" #include "AGTupleType.h" diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios-simulator.swiftinterface b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios-simulator.swiftinterface index 9c19df6c..b08d1296 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios-simulator.swiftinterface +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios-simulator.swiftinterface @@ -13,14 +13,20 @@ import _StringProcessing // MARK: - AGAttribute extension AGAttribute { - @inlinable + public init(_ attribute: AttributeGraph.Attribute) public func unsafeCast(to type: Value.Type) -> AttributeGraph.Attribute - @inlinable public static var current: AGAttribute? { get } - @inlinable public func unsafeOffset(at offset: Int) -> AGAttribute - @inlinable public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) + public func visitBody(_ visitor: inout Visitor); + public func mutateBody(as: Value.Type, invalidating: Swift.Bool, _ body: (inout Value) -> ()) + public func breadthFirstSearch(options: AGSearchOptions, _: (AGAttribute) -> Swift.Bool) -> Swift.Bool + public var _bodyType: Any.Type { get } + public var _bodyPointer: UnsafeRawPointer { get } + public var valueType: Any.Type { get } + public var indirectDependency: AGAttribute? { get set } } extension AGAttribute: Swift.CustomStringConvertible { @@ -60,6 +66,11 @@ extension AGAttribute: Swift.CustomStringConvertible { public func hash(into hasher: inout Swift.Hasher) public var hashValue: Swift.Int { get } public var value: Value { get set } + + @inlinable + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + @inlinable + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) } // MARK: - _AttributeBody diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-ios-simulator.swiftinterface b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-ios-simulator.swiftinterface index 9197e012..5bf1d130 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-ios-simulator.swiftinterface @@ -13,14 +13,20 @@ import _StringProcessing // MARK: - AGAttribute extension AGAttribute { - @inlinable + public init(_ attribute: AttributeGraph.Attribute) public func unsafeCast(to type: Value.Type) -> AttributeGraph.Attribute - @inlinable public static var current: AGAttribute? { get } - @inlinable public func unsafeOffset(at offset: Int) -> AGAttribute - @inlinable public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) + public func visitBody(_ visitor: inout Visitor); + public func mutateBody(as: Value.Type, invalidating: Swift.Bool, _ body: (inout Value) -> ()) + public func breadthFirstSearch(options: AGSearchOptions, _: (AGAttribute) -> Swift.Bool) -> Swift.Bool + public var _bodyType: Any.Type { get } + public var _bodyPointer: UnsafeRawPointer { get } + public var valueType: Any.Type { get } + public var indirectDependency: AGAttribute? { get set } } extension AGAttribute: Swift.CustomStringConvertible { @@ -60,6 +66,11 @@ extension AGAttribute: Swift.CustomStringConvertible { public func hash(into hasher: inout Swift.Hasher) public var hashValue: Swift.Int { get } public var value: Value { get set } + + @inlinable + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + @inlinable + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) } // MARK: - _AttributeBody diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttribute.h b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttribute.h index 4c1a2c97..f30041d9 100644 --- a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttribute.h +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttribute.h @@ -11,6 +11,9 @@ #include "AGBase.h" #include "AGAttributeFlags.h" +#include "AGInputOptions.h" +#include "AGAttributeInfo.h" +#include "AGTypeID.h" typedef uint32_t AGAttribute __attribute((swift_newtype(struct))); @@ -19,22 +22,17 @@ AG_EXTERN_C_BEGIN AG_EXPORT const AGAttribute AGAttributeNil; -AG_EXTERN_C_BEGIN -AG_EXPORT -const AGAttribute AGAttributeNil; -AG_EXTERN_C_END - AG_EXPORT AG_REFINED_FOR_SWIFT AGAttribute AGGraphGetCurrentAttribute(void); AG_EXPORT AG_REFINED_FOR_SWIFT -AGAttribute AGGraphCreateOffsetAttribute(AGAttribute attribute, uint64_t offset) AG_SWIFT_NAME(AGAttribute.create(self:offset:)); +AGAttribute AGGraphCreateOffsetAttribute(AGAttribute attribute, long offset) AG_SWIFT_NAME(AGAttribute.create(self:offset:)); AG_EXPORT AG_REFINED_FOR_SWIFT -AGAttribute AGGraphCreateOffsetAttribute2(AGAttribute attribute, uint64_t offset, uint64_t size) AG_SWIFT_NAME(AGAttribute.create(self:offset:size:)); +AGAttribute AGGraphCreateOffsetAttribute2(AGAttribute attribute, long offset, uint64_t size) AG_SWIFT_NAME(AGAttribute.create(self:offset:size:)); AG_EXPORT AG_REFINED_FOR_SWIFT @@ -44,6 +42,26 @@ AG_EXPORT AG_REFINED_FOR_SWIFT void AGGraphSetFlags(AGAttribute attribute, AGAttributeFlags flags) AG_SWIFT_NAME(setter:AGAttribute.flags(self:_:)); +AG_EXPORT +AG_REFINED_FOR_SWIFT +void AGGraphAddInput(AGAttribute attribute1, AGAttribute attribute2, AGInputOptions options, long token); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +const AGAttributeInfo AGGraphGetAttributeInfo(AGAttribute attribute); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +void AGGraphMutateAttribute(AGAttribute attribute, const AGTypeID type, bool invalidating/*, closure*/); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +AGAttribute AGGraphGetIndirectDependency(AGAttribute attribute); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +void AGGraphSetIndirectDependency(AGAttribute attribute1, AGAttribute attribute2); + AG_EXTERN_C_END #endif /* AGAttribute_h */ diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttributeInfo.h b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttributeInfo.h new file mode 100644 index 00000000..390547a5 --- /dev/null +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttributeInfo.h @@ -0,0 +1,23 @@ +// +// AGAttributeInfo.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGAttributeInfo_h +#define AGAttributeInfo_h + +#include "AGBase.h" +#include "AGAttributeType.h" + +AG_ASSUME_NONNULL_BEGIN + +typedef struct AGAttributeInfo { + const AGAttributeType* type; + const void *body; +} AGAttributeInfo; + +AG_ASSUME_NONNULL_END + +#endif /* AGAttributeInfo_h */ diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttributeType.h b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttributeType.h new file mode 100644 index 00000000..4229ac2c --- /dev/null +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttributeType.h @@ -0,0 +1,24 @@ +// +// AGAttributeType.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGAttributeType_h +#define AGAttributeType_h + +#include "AGBase.h" +#include "AGTypeID.h" + +AG_ASSUME_NONNULL_BEGIN + +typedef struct AGAttributeType { + AGTypeID typeID; + AGTypeID valueTypeID; + // TODO +} AGAttributeType; + +AG_ASSUME_NONNULL_END + +#endif /* AGAttributeType_h */ diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGInputOptions.h b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGInputOptions.h new file mode 100644 index 00000000..54abdc1e --- /dev/null +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGInputOptions.h @@ -0,0 +1,18 @@ +// +// AGInputOptions.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGInputOptions_h +#define AGInputOptions_h + +#include "AGBase.h" + +typedef AG_OPTIONS(uint32_t, AGInputOptions) { + AGInputOptions_0 = 0, + AGInputOptions_1 = 1, +}; + +#endif /* AGInputOptions_h */ diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGSearchOptions.h b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGSearchOptions.h new file mode 100644 index 00000000..8cd7de49 --- /dev/null +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGSearchOptions.h @@ -0,0 +1,18 @@ +// +// AGSearchOptions.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGSearchOptions_h +#define AGSearchOptions_h + +#include "AGBase.h" + +typedef AG_OPTIONS(uint32_t, AGSearchOptions) { + AGSearchOptions_0 = 0, + AGSearchOptions_1 = 1, +}; + +#endif /* Header_h */ diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h index 2bec2681..2d97ccc3 100644 --- a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h @@ -8,12 +8,16 @@ #include "AGAttribute.h" #include "AGAttributeFlags.h" +#include "AGAttributeInfo.h" +#include "AGAttributeType.h" #include "AGAttributeTypeFlags.h" #include "AGBase.h" #include "AGCompareValues.h" #include "AGComparisonMode.h" #include "AGDebugServer.h" #include "AGGraph.h" +#include "AGInputOptions.h" +#include "AGSearchOptions.h" #include "AGSubgraph.h" #include "AGSwiftMetadata.h" #include "AGTupleType.h" diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-macos.swiftinterface b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-macos.swiftinterface index e01333e5..8a8f6bb7 100644 --- a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-macos.swiftinterface +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-macos.swiftinterface @@ -13,14 +13,20 @@ import _StringProcessing // MARK: - AGAttribute extension AGAttribute { - @inlinable + public init(_ attribute: AttributeGraph.Attribute) public func unsafeCast(to type: Value.Type) -> AttributeGraph.Attribute - @inlinable public static var current: AGAttribute? { get } - @inlinable public func unsafeOffset(at offset: Int) -> AGAttribute - @inlinable public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) + public func visitBody(_ visitor: inout Visitor); + public func mutateBody(as: Value.Type, invalidating: Swift.Bool, _ body: (inout Value) -> ()) + public func breadthFirstSearch(options: AGSearchOptions, _: (AGAttribute) -> Swift.Bool) -> Swift.Bool + public var _bodyType: Any.Type { get } + public var _bodyPointer: UnsafeRawPointer { get } + public var valueType: Any.Type { get } + public var indirectDependency: AGAttribute? { get set } } extension AGAttribute: Swift.CustomStringConvertible { @@ -60,6 +66,11 @@ extension AGAttribute: Swift.CustomStringConvertible { public func hash(into hasher: inout Swift.Hasher) public var hashValue: Swift.Int { get } public var value: Value { get set } + + @inlinable + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + @inlinable + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) } // MARK: - _AttributeBody diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-macos.swiftinterface b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-macos.swiftinterface index af2e8f29..d6eb6df1 100644 --- a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-macos.swiftinterface +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-macos.swiftinterface @@ -13,14 +13,20 @@ import _StringProcessing // MARK: - AGAttribute extension AGAttribute { - @inlinable + public init(_ attribute: AttributeGraph.Attribute) public func unsafeCast(to type: Value.Type) -> AttributeGraph.Attribute - @inlinable public static var current: AGAttribute? { get } - @inlinable public func unsafeOffset(at offset: Int) -> AGAttribute - @inlinable public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) + public func visitBody(_ visitor: inout Visitor); + public func mutateBody(as: Value.Type, invalidating: Swift.Bool, _ body: (inout Value) -> ()) + public func breadthFirstSearch(options: AGSearchOptions, _: (AGAttribute) -> Swift.Bool) -> Swift.Bool + public var _bodyType: Any.Type { get } + public var _bodyPointer: UnsafeRawPointer { get } + public var valueType: Any.Type { get } + public var indirectDependency: AGAttribute? { get set } } extension AGAttribute: Swift.CustomStringConvertible { @@ -60,6 +66,11 @@ extension AGAttribute: Swift.CustomStringConvertible { public func hash(into hasher: inout Swift.Hasher) public var hashValue: Swift.Int { get } public var value: Value { get set } + + @inlinable + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + @inlinable + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) } // MARK: - _AttributeBody diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-macos.swiftinterface b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-macos.swiftinterface index dcda9b41..b14e4bb5 100644 --- a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-macos.swiftinterface +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-macos.swiftinterface @@ -13,14 +13,20 @@ import _StringProcessing // MARK: - AGAttribute extension AGAttribute { - @inlinable + public init(_ attribute: AttributeGraph.Attribute) public func unsafeCast(to type: Value.Type) -> AttributeGraph.Attribute - @inlinable public static var current: AGAttribute? { get } - @inlinable public func unsafeOffset(at offset: Int) -> AGAttribute - @inlinable public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) + public func visitBody(_ visitor: inout Visitor); + public func mutateBody(as: Value.Type, invalidating: Swift.Bool, _ body: (inout Value) -> ()) + public func breadthFirstSearch(options: AGSearchOptions, _: (AGAttribute) -> Swift.Bool) -> Swift.Bool + public var _bodyType: Any.Type { get } + public var _bodyPointer: UnsafeRawPointer { get } + public var valueType: Any.Type { get } + public var indirectDependency: AGAttribute? { get set } } extension AGAttribute: Swift.CustomStringConvertible { @@ -60,6 +66,11 @@ extension AGAttribute: Swift.CustomStringConvertible { public func hash(into hasher: inout Swift.Hasher) public var hashValue: Swift.Int { get } public var value: Value { get set } + + @inlinable + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + @inlinable + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) } // MARK: - _AttributeBody diff --git a/AG/Sources/Headers/AGAttribute.h b/AG/Sources/Headers/AGAttribute.h index 4c1a2c97..f30041d9 100644 --- a/AG/Sources/Headers/AGAttribute.h +++ b/AG/Sources/Headers/AGAttribute.h @@ -11,6 +11,9 @@ #include "AGBase.h" #include "AGAttributeFlags.h" +#include "AGInputOptions.h" +#include "AGAttributeInfo.h" +#include "AGTypeID.h" typedef uint32_t AGAttribute __attribute((swift_newtype(struct))); @@ -19,22 +22,17 @@ AG_EXTERN_C_BEGIN AG_EXPORT const AGAttribute AGAttributeNil; -AG_EXTERN_C_BEGIN -AG_EXPORT -const AGAttribute AGAttributeNil; -AG_EXTERN_C_END - AG_EXPORT AG_REFINED_FOR_SWIFT AGAttribute AGGraphGetCurrentAttribute(void); AG_EXPORT AG_REFINED_FOR_SWIFT -AGAttribute AGGraphCreateOffsetAttribute(AGAttribute attribute, uint64_t offset) AG_SWIFT_NAME(AGAttribute.create(self:offset:)); +AGAttribute AGGraphCreateOffsetAttribute(AGAttribute attribute, long offset) AG_SWIFT_NAME(AGAttribute.create(self:offset:)); AG_EXPORT AG_REFINED_FOR_SWIFT -AGAttribute AGGraphCreateOffsetAttribute2(AGAttribute attribute, uint64_t offset, uint64_t size) AG_SWIFT_NAME(AGAttribute.create(self:offset:size:)); +AGAttribute AGGraphCreateOffsetAttribute2(AGAttribute attribute, long offset, uint64_t size) AG_SWIFT_NAME(AGAttribute.create(self:offset:size:)); AG_EXPORT AG_REFINED_FOR_SWIFT @@ -44,6 +42,26 @@ AG_EXPORT AG_REFINED_FOR_SWIFT void AGGraphSetFlags(AGAttribute attribute, AGAttributeFlags flags) AG_SWIFT_NAME(setter:AGAttribute.flags(self:_:)); +AG_EXPORT +AG_REFINED_FOR_SWIFT +void AGGraphAddInput(AGAttribute attribute1, AGAttribute attribute2, AGInputOptions options, long token); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +const AGAttributeInfo AGGraphGetAttributeInfo(AGAttribute attribute); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +void AGGraphMutateAttribute(AGAttribute attribute, const AGTypeID type, bool invalidating/*, closure*/); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +AGAttribute AGGraphGetIndirectDependency(AGAttribute attribute); + +AG_EXPORT +AG_REFINED_FOR_SWIFT +void AGGraphSetIndirectDependency(AGAttribute attribute1, AGAttribute attribute2); + AG_EXTERN_C_END #endif /* AGAttribute_h */ diff --git a/AG/Sources/Headers/AGAttributeInfo.h b/AG/Sources/Headers/AGAttributeInfo.h new file mode 100644 index 00000000..390547a5 --- /dev/null +++ b/AG/Sources/Headers/AGAttributeInfo.h @@ -0,0 +1,23 @@ +// +// AGAttributeInfo.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGAttributeInfo_h +#define AGAttributeInfo_h + +#include "AGBase.h" +#include "AGAttributeType.h" + +AG_ASSUME_NONNULL_BEGIN + +typedef struct AGAttributeInfo { + const AGAttributeType* type; + const void *body; +} AGAttributeInfo; + +AG_ASSUME_NONNULL_END + +#endif /* AGAttributeInfo_h */ diff --git a/AG/Sources/Headers/AGAttributeType.h b/AG/Sources/Headers/AGAttributeType.h new file mode 100644 index 00000000..4229ac2c --- /dev/null +++ b/AG/Sources/Headers/AGAttributeType.h @@ -0,0 +1,24 @@ +// +// AGAttributeType.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGAttributeType_h +#define AGAttributeType_h + +#include "AGBase.h" +#include "AGTypeID.h" + +AG_ASSUME_NONNULL_BEGIN + +typedef struct AGAttributeType { + AGTypeID typeID; + AGTypeID valueTypeID; + // TODO +} AGAttributeType; + +AG_ASSUME_NONNULL_END + +#endif /* AGAttributeType_h */ diff --git a/AG/Sources/Headers/AGInputOptions.h b/AG/Sources/Headers/AGInputOptions.h new file mode 100644 index 00000000..54abdc1e --- /dev/null +++ b/AG/Sources/Headers/AGInputOptions.h @@ -0,0 +1,18 @@ +// +// AGInputOptions.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGInputOptions_h +#define AGInputOptions_h + +#include "AGBase.h" + +typedef AG_OPTIONS(uint32_t, AGInputOptions) { + AGInputOptions_0 = 0, + AGInputOptions_1 = 1, +}; + +#endif /* AGInputOptions_h */ diff --git a/AG/Sources/Headers/AGSearchOptions.h b/AG/Sources/Headers/AGSearchOptions.h new file mode 100644 index 00000000..8cd7de49 --- /dev/null +++ b/AG/Sources/Headers/AGSearchOptions.h @@ -0,0 +1,18 @@ +// +// AGSearchOptions.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AGSearchOptions_h +#define AGSearchOptions_h + +#include "AGBase.h" + +typedef AG_OPTIONS(uint32_t, AGSearchOptions) { + AGSearchOptions_0 = 0, + AGSearchOptions_1 = 1, +}; + +#endif /* Header_h */ diff --git a/AG/Sources/Headers/AttributeGraph-umbrella.h b/AG/Sources/Headers/AttributeGraph-umbrella.h index 2bec2681..2d97ccc3 100644 --- a/AG/Sources/Headers/AttributeGraph-umbrella.h +++ b/AG/Sources/Headers/AttributeGraph-umbrella.h @@ -8,12 +8,16 @@ #include "AGAttribute.h" #include "AGAttributeFlags.h" +#include "AGAttributeInfo.h" +#include "AGAttributeType.h" #include "AGAttributeTypeFlags.h" #include "AGBase.h" #include "AGCompareValues.h" #include "AGComparisonMode.h" #include "AGDebugServer.h" #include "AGGraph.h" +#include "AGInputOptions.h" +#include "AGSearchOptions.h" #include "AGSubgraph.h" #include "AGSwiftMetadata.h" #include "AGTupleType.h" diff --git a/AG/Sources/Modules/AttributeGraph.swiftmodule/template.swiftinterface b/AG/Sources/Modules/AttributeGraph.swiftmodule/template.swiftinterface index 6f634d33..ad5bad53 100644 --- a/AG/Sources/Modules/AttributeGraph.swiftmodule/template.swiftinterface +++ b/AG/Sources/Modules/AttributeGraph.swiftmodule/template.swiftinterface @@ -9,14 +9,20 @@ import _StringProcessing // MARK: - AGAttribute extension AGAttribute { - @inlinable + public init(_ attribute: AttributeGraph.Attribute) public func unsafeCast(to type: Value.Type) -> AttributeGraph.Attribute - @inlinable public static var current: AGAttribute? { get } - @inlinable public func unsafeOffset(at offset: Int) -> AGAttribute - @inlinable public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) + public func visitBody(_ visitor: inout Visitor); + public func mutateBody(as: Value.Type, invalidating: Swift.Bool, _ body: (inout Value) -> ()) + public func breadthFirstSearch(options: AGSearchOptions, _: (AGAttribute) -> Swift.Bool) -> Swift.Bool + public var _bodyType: Any.Type { get } + public var _bodyPointer: UnsafeRawPointer { get } + public var valueType: Any.Type { get } + public var indirectDependency: AGAttribute? { get set } } extension AGAttribute: Swift.CustomStringConvertible { @@ -56,6 +62,11 @@ extension AGAttribute: Swift.CustomStringConvertible { public func hash(into hasher: inout Swift.Hasher) public var hashValue: Swift.Int { get } public var value: Value { get set } + + @inlinable + public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int) + @inlinable + public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions, token: Int) } // MARK: - _AttributeBody diff --git a/AG/reset.sh b/AG/reset.sh new file mode 100755 index 00000000..3968c2d8 --- /dev/null +++ b/AG/reset.sh @@ -0,0 +1,20 @@ +#!/bin/zsh + +# A `realpath` alternative using the default C implementation. +filepath() { + [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" +} + +AG_ROOT="$(dirname $(filepath $0))" +xcframework_path="${AG_ROOT}/AttributeGraph.xcframework" +framework_name=AttributeGraph.framework + +reset_framework() { + local frmework_name=$1 + rm -rf ${xcframework_path}/${frmework_name}/${framework_name}/Headers + rm -rf ${xcframework_path}/${frmework_name}/${framework_name}/Modules +} + +reset_framework ios-arm64-x86_64-simulator +reset_framework ios-arm64-arm64e +reset_framework macos-arm64e-arm64-x86_64 diff --git a/Sources/OpenGraph/Attribute/Attribute.swift b/Sources/OpenGraph/Attribute/Attribute.swift index ae5ef89e..144b465b 100644 --- a/Sources/OpenGraph/Attribute/Attribute.swift +++ b/Sources/OpenGraph/Attribute/Attribute.swift @@ -2,7 +2,7 @@ import _OpenGraph @propertyWrapper public struct Attribute { - var identifier: OGAttribute + public var identifier: OGAttribute public init() { fatalError("TODO") @@ -19,6 +19,16 @@ public struct Attribute { get { wrappedValue } set { fatalError("TODO") } } + + @inlinable + public func addInput(_ attribute: OGAttribute, options: OGInputOptions, token: Int) { + __OGGraphAddInput(self.identifier, attribute, options, token) + } + + @inlinable + public func addInput(_ attribute: Attribute, options: OGInputOptions, token: Int) { + addInput(attribute.identifier, options: options, token: token) + } } extension Attribute: Equatable {} diff --git a/Sources/OpenGraph/Attribute/AttributeBodyVisitor.swift b/Sources/OpenGraph/Attribute/AttributeBodyVisitor.swift index 7756d953..aa1d9801 100644 --- a/Sources/OpenGraph/Attribute/AttributeBodyVisitor.swift +++ b/Sources/OpenGraph/Attribute/AttributeBodyVisitor.swift @@ -1,9 +1,9 @@ // // AttributeBodyVisitor.swift -// +// OpenGraph // // Created by Kyle on 2024/2/16. -// +// Status: WIP public protocol AttributeBodyVisitor { func visit(body: UnsafePointer) diff --git a/Sources/OpenGraph/Attribute/External.swift b/Sources/OpenGraph/Attribute/External.swift index c97ff2ef..5342dad2 100644 --- a/Sources/OpenGraph/Attribute/External.swift +++ b/Sources/OpenGraph/Attribute/External.swift @@ -1,6 +1,6 @@ // // External.swift -// +// OpenGraph // // Created by Kyle on 2024/2/16. // Lastest Version: iOS 15.5 diff --git a/Sources/OpenGraph/Attribute/Focus.swift b/Sources/OpenGraph/Attribute/Focus.swift index 70ddb6dc..57c73357 100644 --- a/Sources/OpenGraph/Attribute/Focus.swift +++ b/Sources/OpenGraph/Attribute/Focus.swift @@ -1,6 +1,6 @@ // // Focus.swift -// +// OpenGraph // // Created by Kyle on 2024/2/16. // Lastest Version: iOS 15.5 diff --git a/Sources/OpenGraph/Attribute/OGExtension/OGAttribute.swift b/Sources/OpenGraph/Attribute/OGExtension/OGAttribute.swift index baeb9dc0..a438fc05 100644 --- a/Sources/OpenGraph/Attribute/OGExtension/OGAttribute.swift +++ b/Sources/OpenGraph/Attribute/OGExtension/OGAttribute.swift @@ -1,33 +1,80 @@ // // OGAttribute.swift -// +// OpenGraph // // Created by Kyle on 2024/2/17. -// +// Lastest Version: iOS 15.5 +// Status: API complete import _OpenGraph extension OGAttribute { - @inlinable - public func unsafeCast(to type: Value.Type) -> Attribute { + public init(_ attribute: Attribute) { + self = attribute.identifier + } + + public func unsafeCast(to _: Value.Type) -> Attribute { fatalError("TODO") } - @inlinable public static var current: OGAttribute? { let current = __OGGraphGetCurrentAttribute() return current == .nil ? nil : current } - @inlinable public func unsafeOffset(at offset: Int) -> OGAttribute { - create(offset: UInt64(offset)) + create(offset: offset) } - - @inlinable + public func setFlags(_ newFlags: OGAttributeFlags, mask: OGAttributeFlags) { flags = flags.subtracting(mask).union(newFlags.intersection(mask)) } + + public func addInput(_ attribute: OGAttribute, options: OGInputOptions, token: Int) { + __OGGraphAddInput(self, attribute, options, token) + } + + public func addInput(_ attribute: Attribute, options: OGInputOptions, token: Int) { + addInput(attribute.identifier, options: options, token: token) + } + + // Question + public func visitBody(_ visitor: inout some AttributeBodyVisitor) { + let info = __OGGraphGetAttributeInfo(self) + let bodyType = info.type.advanced(by: 1).pointee.typeID.type as! _AttributeBody.Type + bodyType._visitBody(&visitor, info.body) + } + + public func mutateBody(as type: Value.Type, invalidating: Bool, _: (inout Value) -> Void) { + // FIXME: pass body + __OGGraphMutateAttribute(self, OGTypeID(type), invalidating) + } + + public func breadthFirstSearch(options _: OGSearchOptions, _: (OGAttribute) -> Bool) -> Bool { + fatalError("TODO") + } + + public var _bodyType: Any.Type { + __OGGraphGetAttributeInfo(self).type.pointee.typeID.type + } + + public var _bodyPointer: UnsafeRawPointer { + __OGGraphGetAttributeInfo(self).body + } + + public var valueType: Any.Type { + __OGGraphGetAttributeInfo(self).type.pointee.valueTypeID.type + } + + public var indirectDependency: OGAttribute? { + get { + let indirectDependency = __OGGraphGetIndirectDependency(self) + return indirectDependency == .nil ? nil : indirectDependency + } + nonmutating set { + __OGGraphSetIndirectDependency(self, newValue ?? .nil) + } + } } // MARK: CustomStringConvertible diff --git a/Sources/OpenGraph/Runtime/OGTypeID.swift b/Sources/OpenGraph/Runtime/OGTypeID.swift index 00495c62..1048f0d4 100644 --- a/Sources/OpenGraph/Runtime/OGTypeID.swift +++ b/Sources/OpenGraph/Runtime/OGTypeID.swift @@ -25,16 +25,19 @@ public func OGTypeApplyFields2( ) -> Bool extension OGTypeID: Hashable, CustomStringConvertible { + @inlinable @inline(__always) public init(_ type: Any.Type) { self.init(rawValue: unsafeBitCast(type, to: UnsafePointer.self)) } + @inlinable @inline(__always) public var type: Any.Type { unsafeBitCast(rawValue, to: Any.Type.self) } + @inlinable @inline(__always) public var description: String { #if canImport(ObjectiveC) @@ -44,12 +47,16 @@ extension OGTypeID: Hashable, CustomStringConvertible { #endif } + @inlinable + @inline(__always) /* public */func forEachField( do body: (UnsafePointer, Int, Any.Type) -> Void ) { OGTypeApplyFields(type, body: body) } + @inlinable + @inline(__always) public func forEachField( options: OGTypeApplyOptions, do body: (UnsafePointer, Int, Any.Type) -> Bool diff --git a/Sources/OpenGraphShims/GraphShims.swift b/Sources/OpenGraphShims/GraphShims.swift index 64a75a79..9b8a1d3a 100644 --- a/Sources/OpenGraphShims/GraphShims.swift +++ b/Sources/OpenGraphShims/GraphShims.swift @@ -8,12 +8,22 @@ #if OPENGRAPH_ATTRIBUTEGRAPH @_exported import AttributeGraph public typealias OGAttribute = AGAttribute +public typealias OGAttributeFlags = AGAttributeFlags +public typealias OGAttributeInfo = AGAttributeInfo +public typealias OGAttributeType = AGAttributeType +public typealias OGAttributeTypeFlags = AGAttributeTypeFlags +public typealias OGComparisonMode = AGComparisonMode +public typealias OGComparisonOptions = AGComparisonOptions public typealias OGDebugServer = AGDebugServer public typealias OGGraph = AGGraph +public typealias OGGraphContext = AGGraphContext +public typealias OGInputOptions = AGInputOptions +public typealias OGSearchOptions = AGSearchOptions public typealias OGSubgraph = AGSubgraph public typealias OGSwiftMetadata = AGSwiftMetadata public typealias OGTupleType = AGTupleType public typealias OGTypeApplyOptions = AGTypeApplyOptions +public typealias OGTypeKind = AGTypeKind public typealias OGTypeID = AGTypeID public typealias OGUniqueID = AGUniqueID #else diff --git a/Sources/_OpenGraph/Attribute/AttributeType.cpp b/Sources/_OpenGraph/Attribute/AttributeType.cpp new file mode 100644 index 00000000..91c8ede1 --- /dev/null +++ b/Sources/_OpenGraph/Attribute/AttributeType.cpp @@ -0,0 +1,8 @@ +// +// OGAttributeType.cpp +// +// +// Created by Kyle on 2024/2/17. +// + +#include "OGAttributeType.h" diff --git a/Sources/_OpenGraph/Attribute/AttributeType.hpp b/Sources/_OpenGraph/Attribute/AttributeType.hpp new file mode 100644 index 00000000..8deffb3b --- /dev/null +++ b/Sources/_OpenGraph/Attribute/AttributeType.hpp @@ -0,0 +1,19 @@ +// +// AttributeType.hpp +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef AttributeType_hpp +#define AttributeType_hpp + +#include "OGBase.h" +#include "OGAttributeType.h" + +namespace OG { +struct AttributeType { + OGAttributeType storage; +}; +} +#endif /* AttributeType_2_hpp */ diff --git a/Sources/_OpenGraph/Attribute/OGAttribute.cpp b/Sources/_OpenGraph/Attribute/OGAttribute.cpp index 63a3f832..b3be2043 100644 --- a/Sources/_OpenGraph/Attribute/OGAttribute.cpp +++ b/Sources/_OpenGraph/Attribute/OGAttribute.cpp @@ -25,11 +25,11 @@ OGAttribute create_offset_attribute(OGAttribute attribute, uint64_t offset, std: } } -OGAttribute OGGraphCreateOffsetAttribute(OGAttribute attribute, uint64_t offset) { +OGAttribute OGGraphCreateOffsetAttribute(OGAttribute attribute, long offset) { return create_offset_attribute(attribute, offset, std::nullopt); } -OGAttribute OGGraphCreateOffsetAttribute2(OGAttribute attribute, uint64_t offset, uint64_t size) { +OGAttribute OGGraphCreateOffsetAttribute2(OGAttribute attribute, long offset, uint64_t size) { return create_offset_attribute(attribute, offset, std::optional(size)); } @@ -49,3 +49,33 @@ void OGGraphSetFlags(OGAttribute attribute, OGAttributeFlags flags) { } // TODO: data/table } + +void OGGraphAddInput(OGAttribute attribute1, OGAttribute attribute2, OGInputOptions options, long token) { + const OG::AttributeID id = OG::AttributeID(attribute1); + if (!id.isDirect()) { + OG::precondition_failure("non-direct attribute id: %u", id); + } + // TODO: data/table +} + +const OGAttributeInfo OGGraphGetAttributeInfo(OGAttribute attribute) { + const OG::AttributeID id = OG::AttributeID(attribute); + if (!id.isDirect()) { + OG::precondition_failure("non-direct attribute id: %u", id); + } + // TODO + return { nullptr, nullptr }; +} + +void OGGraphMutateAttribute(OGAttribute attribute, const OGTypeID type, bool invalidating) { + // TODO +} + +OGAttribute OGGraphGetIndirectDependency(OGAttribute attribute) { + // TODO + return OGAttributeNil; +} + +void OGGraphSetIndirectDependency(OGAttribute attribute1, OGAttribute attribute2) { + // TODO +} diff --git a/Sources/_OpenGraph/Attribute/OGAttribute.h b/Sources/_OpenGraph/Attribute/OGAttribute.h index cb040d13..6798707b 100644 --- a/Sources/_OpenGraph/Attribute/OGAttribute.h +++ b/Sources/_OpenGraph/Attribute/OGAttribute.h @@ -10,6 +10,9 @@ #include "OGBase.h" #include "OGAttributeFlags.h" +#include "OGInputOptions.h" +#include "OGAttributeInfo.h" +#include "OGTypeID.h" typedef uint32_t OGAttribute __attribute((swift_newtype(struct))); @@ -24,11 +27,11 @@ OGAttribute OGGraphGetCurrentAttribute(void); OG_EXPORT OG_REFINED_FOR_SWIFT -OGAttribute OGGraphCreateOffsetAttribute(OGAttribute attribute, uint64_t offset) OG_SWIFT_NAME(OGAttribute.create(self:offset:)); +OGAttribute OGGraphCreateOffsetAttribute(OGAttribute attribute, long offset) OG_SWIFT_NAME(OGAttribute.create(self:offset:)); OG_EXPORT OG_REFINED_FOR_SWIFT -OGAttribute OGGraphCreateOffsetAttribute2(OGAttribute attribute, uint64_t offset, uint64_t size) OG_SWIFT_NAME(OGAttribute.create(self:offset:size:)); +OGAttribute OGGraphCreateOffsetAttribute2(OGAttribute attribute, long offset, uint64_t size) OG_SWIFT_NAME(OGAttribute.create(self:offset:size:)); OG_EXPORT OG_REFINED_FOR_SWIFT @@ -38,6 +41,26 @@ OG_EXPORT OG_REFINED_FOR_SWIFT void OGGraphSetFlags(OGAttribute attribute, OGAttributeFlags flags) OG_SWIFT_NAME(setter:OGAttribute.flags(self:_:)); +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphAddInput(OGAttribute attribute1, OGAttribute attribute2, OGInputOptions options, long token); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +const OGAttributeInfo OGGraphGetAttributeInfo(OGAttribute attribute); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphMutateAttribute(OGAttribute attribute, const OGTypeID type, bool invalidating/*, closure*/); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGAttribute OGGraphGetIndirectDependency(OGAttribute attribute); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphSetIndirectDependency(OGAttribute attribute1, OGAttribute attribute2); + OG_EXTERN_C_END #endif /* OGAttribute_h */ diff --git a/Sources/_OpenGraph/Attribute/OGAttributeInfo.h b/Sources/_OpenGraph/Attribute/OGAttributeInfo.h new file mode 100644 index 00000000..a9994df5 --- /dev/null +++ b/Sources/_OpenGraph/Attribute/OGAttributeInfo.h @@ -0,0 +1,23 @@ +// +// OGAttributeInfo.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef OGAttributeInfo_h +#define OGAttributeInfo_h + +#include "OGBase.h" +#include "OGAttributeType.h" + +OG_ASSUME_NONNULL_BEGIN + +typedef struct OGAttributeInfo { + const OGAttributeType* type; + const void *body; +} OGAttributeInfo; + +OG_ASSUME_NONNULL_END + +#endif /* OGAttributeInfo_h */ diff --git a/Sources/_OpenGraph/Attribute/OGAttributeType.h b/Sources/_OpenGraph/Attribute/OGAttributeType.h new file mode 100644 index 00000000..73fbfe68 --- /dev/null +++ b/Sources/_OpenGraph/Attribute/OGAttributeType.h @@ -0,0 +1,24 @@ +// +// OGAttributeType.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef OGAttributeType_h +#define OGAttributeType_h + +#include "OGBase.h" +#include "OGTypeID.h" + +OG_ASSUME_NONNULL_BEGIN + +typedef struct OGAttributeType { + OGTypeID typeID; + OGTypeID valueTypeID; + // TODO +} OGAttributeType; + +OG_ASSUME_NONNULL_END + +#endif /* OGAttributeType_h */ diff --git a/Sources/_OpenGraph/Attribute/OGInputOptions.h b/Sources/_OpenGraph/Attribute/OGInputOptions.h new file mode 100644 index 00000000..477d263c --- /dev/null +++ b/Sources/_OpenGraph/Attribute/OGInputOptions.h @@ -0,0 +1,18 @@ +// +// OGInputOptions.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef OGInputOptions_h +#define OGInputOptions_h + +#include "OGBase.h" + +typedef OG_OPTIONS(uint32_t, OGInputOptions) { + OGInputOptions_0 = 0, + OGInputOptions_1 = 1, +}; + +#endif /* OGInputOptions_h */ diff --git a/Sources/_OpenGraph/Attribute/OGSearchOptions.h b/Sources/_OpenGraph/Attribute/OGSearchOptions.h new file mode 100644 index 00000000..42142e63 --- /dev/null +++ b/Sources/_OpenGraph/Attribute/OGSearchOptions.h @@ -0,0 +1,18 @@ +// +// OGSearchOptions.h +// +// +// Created by Kyle on 2024/2/17. +// + +#ifndef OGSearchOptions_h +#define OGSearchOptions_h + +#include "OGBase.h" + +typedef OG_OPTIONS(uint32_t, OGSearchOptions) { + OGSearchOptions_0 = 0, + OGSearchOptions_1 = 1, +}; + +#endif /* Header_h */ diff --git a/Sources/_OpenGraph/Debug/og-debug-server.mm b/Sources/_OpenGraph/Debug/og-debug-server.mm index f2dde12f..4458b917 100644 --- a/Sources/_OpenGraph/Debug/og-debug-server.mm +++ b/Sources/_OpenGraph/Debug/og-debug-server.mm @@ -10,8 +10,8 @@ #include "../Util/log.hpp" #include "../Util/assert.hpp" -#include "../Graph/graph-description.hpp" -#include "../Graph/graph.hpp" +#include "../Graph/GraphDescription.hpp" +#include "../Graph/Graph.hpp" #include #include diff --git a/Sources/_OpenGraph/Graph/graph.cpp b/Sources/_OpenGraph/Graph/Graph.cpp similarity index 73% rename from Sources/_OpenGraph/Graph/graph.cpp rename to Sources/_OpenGraph/Graph/Graph.cpp index 6ead831d..e55f0637 100644 --- a/Sources/_OpenGraph/Graph/graph.cpp +++ b/Sources/_OpenGraph/Graph/Graph.cpp @@ -1,10 +1,10 @@ // -// graph.cpp +// Graph.cpp // // // Created by Kyle on 2024/1/18. // -#include "graph.hpp" +#include "Graph.hpp" pthread_key_t OG::Graph::_current_update_key; diff --git a/Sources/_OpenGraph/Graph/graph.hpp b/Sources/_OpenGraph/Graph/Graph.hpp similarity index 95% rename from Sources/_OpenGraph/Graph/graph.hpp rename to Sources/_OpenGraph/Graph/Graph.hpp index 424447a6..155ee882 100644 --- a/Sources/_OpenGraph/Graph/graph.hpp +++ b/Sources/_OpenGraph/Graph/Graph.hpp @@ -1,12 +1,12 @@ // -// graph.hpp +// Graph.hpp // // // Created by Kyle on 2024/1/18. // -#ifndef graph_hpp -#define graph_hpp +#ifndef Graph_hpp +#define Graph_hpp #include "OGBase.h" #include "OGGraph.h" @@ -79,4 +79,4 @@ struct OGGraphContextStorage { OG::Graph::Context context; }; -#endif /* graph_hpp */ +#endif /* Graph_hpp */ diff --git a/Sources/_OpenGraph/Graph/graph-context.cpp b/Sources/_OpenGraph/Graph/GraphContext.cpp similarity index 90% rename from Sources/_OpenGraph/Graph/graph-context.cpp rename to Sources/_OpenGraph/Graph/GraphContext.cpp index c2311be9..f1f7fe45 100644 --- a/Sources/_OpenGraph/Graph/graph-context.cpp +++ b/Sources/_OpenGraph/Graph/GraphContext.cpp @@ -1,11 +1,11 @@ // -// graph-context.cpp -// +// GraphContext.cpp +// // // Created by Kyle on 2024/2/16. // -#include "graph.hpp" +#include "Graph.hpp" #include "OGGraph.h" #include "../Util/assert.hpp" diff --git a/Sources/_OpenGraph/Graph/graph-description.hpp b/Sources/_OpenGraph/Graph/GraphDescription.hpp similarity index 59% rename from Sources/_OpenGraph/Graph/graph-description.hpp rename to Sources/_OpenGraph/Graph/GraphDescription.hpp index 59c79d76..303c5d11 100644 --- a/Sources/_OpenGraph/Graph/graph-description.hpp +++ b/Sources/_OpenGraph/Graph/GraphDescription.hpp @@ -1,12 +1,12 @@ // -// graph-description.hpp +// GraphDescription.hpp // // // Created by Kyle on 2024/1/21. // -#ifndef graph_description_hpp -#define graph_description_hpp +#ifndef GraphDescription_hpp +#define GraphDescription_hpp #include "OGBase.h" @@ -17,4 +17,4 @@ CFStringRef OGDescriptionFormat; OG_EXTERN_C_END #endif -#endif /* graph_description_hpp */ +#endif /* GraphDescription_hpp */ diff --git a/Sources/_OpenGraph/Graph/graph-description.mm b/Sources/_OpenGraph/Graph/GraphDescription.mm similarity index 91% rename from Sources/_OpenGraph/Graph/graph-description.mm rename to Sources/_OpenGraph/Graph/GraphDescription.mm index ebe18c5c..3c14e234 100644 --- a/Sources/_OpenGraph/Graph/graph-description.mm +++ b/Sources/_OpenGraph/Graph/GraphDescription.mm @@ -1,13 +1,13 @@ // -// graph-description.cpp +// GraphDescription.mm // // // Created by Kyle on 2024/1/21. // -#include "graph-description.hpp" +#include "GraphDescription.hpp" #include "OGGraph.h" -#include "graph.hpp" +#include "Graph.hpp" #include "../Util/assert.hpp" #if OG_OBJC_FOUNDATION diff --git a/Sources/_OpenGraph/Graph/OGGraph.cpp b/Sources/_OpenGraph/Graph/OGGraph.cpp index c260cd2d..02cb1a1d 100644 --- a/Sources/_OpenGraph/Graph/OGGraph.cpp +++ b/Sources/_OpenGraph/Graph/OGGraph.cpp @@ -6,7 +6,7 @@ // #include "OGGraph.h" -#include "graph.hpp" +#include "Graph.hpp" #include "../Util/assert.hpp" OGGraphRef OGGraphCreate() { diff --git a/Sources/_OpenGraph/Graph/OGSubgraph.cpp b/Sources/_OpenGraph/Graph/OGSubgraph.cpp index 3ff7d912..a12e876e 100644 --- a/Sources/_OpenGraph/Graph/OGSubgraph.cpp +++ b/Sources/_OpenGraph/Graph/OGSubgraph.cpp @@ -7,7 +7,7 @@ #include "OGSubgraph.h" #include "OGGraph.h" -#include "subgraph.hpp" +#include "Subgraph.hpp" #include "../Util/assert.hpp" #include #include "OGGraphContext.h" diff --git a/Sources/_OpenGraph/Graph/subgraph.cpp b/Sources/_OpenGraph/Graph/Subgraph.cpp similarity index 92% rename from Sources/_OpenGraph/Graph/subgraph.cpp rename to Sources/_OpenGraph/Graph/Subgraph.cpp index 16a0f25b..87476aaa 100644 --- a/Sources/_OpenGraph/Graph/subgraph.cpp +++ b/Sources/_OpenGraph/Graph/Subgraph.cpp @@ -1,11 +1,11 @@ // -// subgraph.cpp +// Subgraph.cpp // // // Created by Kyle on 2024/2/15. // -#include "subgraph.hpp" +#include "Subgraph.hpp" #include "OGSubgraph.h" pthread_key_t OG::Subgraph::_current_subgraph_key; diff --git a/Sources/_OpenGraph/Graph/subgraph.hpp b/Sources/_OpenGraph/Graph/Subgraph.hpp similarity index 94% rename from Sources/_OpenGraph/Graph/subgraph.hpp rename to Sources/_OpenGraph/Graph/Subgraph.hpp index c36c9f92..27ace20d 100644 --- a/Sources/_OpenGraph/Graph/subgraph.hpp +++ b/Sources/_OpenGraph/Graph/Subgraph.hpp @@ -1,16 +1,16 @@ // -// subgraph.hpp -// +// Subgraph.hpp +// // // Created by Kyle on 2024/2/15. // -#ifndef subgraph_hpp -#define subgraph_hpp +#ifndef Subgraph_hpp +#define Subgraph_hpp #include "OGBase.h" #include "../Attribute/AttributeID.hpp" -#include "graph.hpp" +#include "Graph.hpp" #include typedef struct OG_BRIDGED_TYPE(id) OGSubgraphStorage * OGSubgraphRef; @@ -88,4 +88,4 @@ class SubgraphObject final { }; } -#endif /* subgraph_hpp */ +#endif /* Subgraph_hpp */ diff --git a/Sources/_OpenGraph/include/OGAttributeInfo.h b/Sources/_OpenGraph/include/OGAttributeInfo.h new file mode 120000 index 00000000..e141ee8a --- /dev/null +++ b/Sources/_OpenGraph/include/OGAttributeInfo.h @@ -0,0 +1 @@ +../Attribute/OGAttributeInfo.h \ No newline at end of file diff --git a/Sources/_OpenGraph/include/OGAttributeType.h b/Sources/_OpenGraph/include/OGAttributeType.h new file mode 120000 index 00000000..a6a7b2e0 --- /dev/null +++ b/Sources/_OpenGraph/include/OGAttributeType.h @@ -0,0 +1 @@ +../Attribute/OGAttributeType.h \ No newline at end of file diff --git a/Sources/_OpenGraph/include/OGInputOptions.h b/Sources/_OpenGraph/include/OGInputOptions.h new file mode 120000 index 00000000..6c0f1710 --- /dev/null +++ b/Sources/_OpenGraph/include/OGInputOptions.h @@ -0,0 +1 @@ +../Attribute/OGInputOptions.h \ No newline at end of file diff --git a/Sources/_OpenGraph/include/OGSearchOptions.h b/Sources/_OpenGraph/include/OGSearchOptions.h new file mode 120000 index 00000000..010d47b4 --- /dev/null +++ b/Sources/_OpenGraph/include/OGSearchOptions.h @@ -0,0 +1 @@ +../Attribute/OGSearchOptions.h \ No newline at end of file diff --git a/Sources/_OpenGraph/include/_OGGraph.h b/Sources/_OpenGraph/include/_OGGraph.h index 2b529fc5..2cf594ca 100644 --- a/Sources/_OpenGraph/include/_OGGraph.h +++ b/Sources/_OpenGraph/include/_OGGraph.h @@ -10,6 +10,8 @@ #include "OGAttribute.h" #include "OGAttributeFlags.h" +#include "OGAttributeInfo.h" +#include "OGAttributeType.h" #include "OGAttributeTypeFlags.h" #include "OGBase.h" #include "OGCompareValues.h" @@ -17,6 +19,8 @@ #include "OGDebugServer.h" #include "OGGraph.h" #include "OGGraphContext.h" +#include "OGInputOptions.h" +#include "OGSearchOptions.h" #include "OGSubgraph.h" #include "OGSwiftMetadata.h" #include "OGTupleType.h" diff --git a/Status.md b/Status.md index 79f196b3..58d69bc4 100644 --- a/Status.md +++ b/Status.md @@ -8,6 +8,10 @@ Only have an empty namespace used as placeholder type in other implementation. Some interface is implemented while some is not. +## API Complete + +All interface is added while some implementation is empty. + ## Blocked Most implementation is complete. diff --git a/Tests/OpenGraphCompatibilityTests/Attribute/OGExtension/OGAttributeTests.swift b/Tests/OpenGraphCompatibilityTests/Attribute/OGExtension/OGAttributeTests.swift index 87adde64..83be0407 100644 --- a/Tests/OpenGraphCompatibilityTests/Attribute/OGExtension/OGAttributeTests.swift +++ b/Tests/OpenGraphCompatibilityTests/Attribute/OGExtension/OGAttributeTests.swift @@ -40,5 +40,17 @@ final class OGAttributeTests: XCTestCase { // TODO: Add OGAttribute init func testSetFlags() throws {} + + func testVisitBody() { + // FIXME: attribute is invalid here. +// struct Visitor: AttributeBodyVisitor { +// func visit(body: UnsafePointer) where Body : _AttributeBody { +// print("Visit") +// } +// } +// let attribute = OGAttribute.nil +// var visitor = Visitor() +// attribute.visitBody(&visitor) + } #endif } diff --git a/Tests/OpenGraphCompatibilityTests/Graph/GraphTests.swift b/Tests/OpenGraphCompatibilityTests/Graph/GraphTests.swift index 6c8aaff4..f9018dd0 100644 --- a/Tests/OpenGraphCompatibilityTests/Graph/GraphTests.swift +++ b/Tests/OpenGraphCompatibilityTests/Graph/GraphTests.swift @@ -27,7 +27,11 @@ final class GraphTests: XCTestCase { } let name = "empty_graph.json" name.withCString { OGGraph.archiveJSON(name: $0) } - let url = URL(filePath: NSTemporaryDirectory().appending(name)) + let url = if #available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) { + URL(filePath: NSTemporaryDirectory().appending(name)) + } else { + URL(fileURLWithPath: NSTemporaryDirectory().appending(name)) + } let data = try Data(contentsOf: url) let graphs = try JSONDecoder().decode(Graphs.self, from: data) XCTAssertEqual(graphs.version, 2) diff --git a/Tests/OpenGraphCompatibilityTests/GraphShims.swift b/Tests/OpenGraphCompatibilityTests/GraphShims.swift index 9a569196..191da20c 100644 --- a/Tests/OpenGraphCompatibilityTests/GraphShims.swift +++ b/Tests/OpenGraphCompatibilityTests/GraphShims.swift @@ -8,12 +8,22 @@ #if OPENGRAPH_COMPATIBILITY_TEST @_exported import AttributeGraph public typealias OGAttribute = AGAttribute +public typealias OGAttributeFlags = AGAttributeFlags +public typealias OGAttributeInfo = AGAttributeInfo +public typealias OGAttributeType = AGAttributeType +public typealias OGAttributeTypeFlags = AGAttributeTypeFlags +public typealias OGComparisonMode = AGComparisonMode +public typealias OGComparisonOptions = AGComparisonOptions public typealias OGDebugServer = AGDebugServer public typealias OGGraph = AGGraph +public typealias OGGraphContext = AGGraphContext +public typealias OGInputOptions = AGInputOptions +public typealias OGSearchOptions = AGSearchOptions public typealias OGSubgraph = AGSubgraph public typealias OGSwiftMetadata = AGSwiftMetadata public typealias OGTupleType = AGTupleType public typealias OGTypeApplyOptions = AGTypeApplyOptions +public typealias OGTypeKind = AGTypeKind public typealias OGTypeID = AGTypeID public typealias OGUniqueID = AGUniqueID #else