diff --git a/Sources/OpenGraph/Attribute/Attribute/AnyAttribute.swift b/Sources/OpenGraph/Attribute/Attribute/AnyAttribute.swift index a9eaef40..d3e49931 100644 --- a/Sources/OpenGraph/Attribute/Attribute/AnyAttribute.swift +++ b/Sources/OpenGraph/Attribute/Attribute/AnyAttribute.swift @@ -8,7 +8,7 @@ public import OpenGraph_SPI extension AnyAttribute { - public typealias Flags = OGAttributeTypeFlags + public typealias Flags = AttributeType.Flags public init(_ attribute: Attribute) { self = attribute.identifier @@ -41,7 +41,7 @@ extension AnyAttribute { // FIXME: Use AttributeType instead public func visitBody(_ visitor: inout Body) { - let bodyType = info.type.advanced(by: 1).pointee.typeID.type as! _AttributeBody.Type + let bodyType = info.type.advanced(by: 1).pointee.self_id.type as! _AttributeBody.Type bodyType._visitBody(&visitor, info.body) } @@ -56,7 +56,7 @@ extension AnyAttribute { } public var _bodyType: Any.Type { - info.type.pointee.typeID.type + info.type.pointee.self_id.type } public var _bodyPointer: UnsafeRawPointer { @@ -64,7 +64,7 @@ extension AnyAttribute { } public var valueType: Any.Type { - info.type.pointee.valueTypeID.type + info.type.pointee.value_id.type } public var indirectDependency: AnyAttribute? { diff --git a/Sources/OpenGraph/Attribute/Attribute/Attribute.swift b/Sources/OpenGraph/Attribute/Attribute/Attribute.swift index cfcab2de..c2e4c873 100644 --- a/Sources/OpenGraph/Attribute/Attribute/Attribute.swift +++ b/Sources/OpenGraph/Attribute/Attribute/Attribute.swift @@ -19,7 +19,7 @@ public struct Attribute { public init(value: Value) { self = withUnsafePointer(to: value) { valuePointer in withUnsafePointer(to: External()) { bodyPointer in - Attribute(body: bodyPointer, value: valuePointer, flags: ._16) { + Attribute(body: bodyPointer, value: valuePointer, flags: .external) { External._update } } @@ -28,7 +28,7 @@ public struct Attribute { public init(type _: Value.Type) { self = withUnsafePointer(to: External()) { bodyPointer in - Attribute(body: bodyPointer, value: nil, flags: ._16) { + Attribute(body: bodyPointer, value: nil, flags: .external) { External._update } } @@ -37,7 +37,7 @@ public struct Attribute { public init( body: UnsafePointer, value: UnsafePointer?, - flags: OGAttributeTypeFlags = [], + flags: AttributeType.Flags = [], update: AttributeUpdateBlock ) { #if os(WASI) @@ -158,7 +158,7 @@ public struct Attribute { let value = OGGraphGetValue(identifier, options: options, type: Value.self) return ( value.value.assumingMemoryBound(to: Value.self).pointee, - value.changed ? ._1 : [] + value.flags ) } @@ -166,7 +166,7 @@ public struct Attribute { let value = OGGraphGetValue(identifier, options: options, type: Value.self) return ( value.value.assumingMemoryBound(to: Value.self).pointee, - value.changed + value.flags.contains(.changed) ) } @@ -228,12 +228,6 @@ extension Attribute { } } -// TODO: -private struct AttributeType { - var graphType: OGAttributeType - var type: _AttributeBody.Type -} - @_silgen_name("OGGraphCreateAttribute") @inline(__always) @inlinable diff --git a/Sources/OpenGraph/Attribute/Attribute/External.swift b/Sources/OpenGraph/Attribute/Attribute/External.swift index 10a0b07d..eaf8764c 100644 --- a/Sources/OpenGraph/Attribute/Attribute/External.swift +++ b/Sources/OpenGraph/Attribute/Attribute/External.swift @@ -15,7 +15,7 @@ public struct External { extension External: _AttributeBody { public static var comparisonMode: ComparisonMode { .equatableAlways } - public static var flags: OGAttributeTypeFlags { [] } + public static var flags: AttributeType.Flags { [] } public static func _update(_: UnsafeMutableRawPointer, attribute _: AnyAttribute) {} } diff --git a/Sources/OpenGraph/Attribute/Body/AttributeBody.swift b/Sources/OpenGraph/Attribute/Body/AttributeBody.swift index e7919edd..90d4cd7c 100644 --- a/Sources/OpenGraph/Attribute/Body/AttributeBody.swift +++ b/Sources/OpenGraph/Attribute/Body/AttributeBody.swift @@ -12,7 +12,7 @@ public protocol _AttributeBody { static var _hasDestroySelf: Bool { get } static func _updateDefault(_ pointer: UnsafeMutableRawPointer) static var comparisonMode: ComparisonMode { get } - static var flags: OGAttributeTypeFlags { get } + static var flags: AttributeType.Flags { get } } // MARK: - Protocol Default implementation @@ -22,7 +22,7 @@ extension _AttributeBody { public static var _hasDestroySelf: Bool { false } public static func _updateDefault(_ pointer: UnsafeMutableRawPointer) {} public static var comparisonMode: ComparisonMode { .equatableUnlessPOD } - public static var flags: OGAttributeTypeFlags { .mainThread } + public static var flags: AttributeType.Flags { .mainThread } } extension _AttributeBody { diff --git a/Sources/OpenGraph/Attribute/Rule/Focus.swift b/Sources/OpenGraph/Attribute/Rule/Focus.swift index c3a7ecc8..f714ab1b 100644 --- a/Sources/OpenGraph/Attribute/Rule/Focus.swift +++ b/Sources/OpenGraph/Attribute/Rule/Focus.swift @@ -17,7 +17,7 @@ public struct Focus: Rule, CustomStringConvertible { public var value: Value { root.value[keyPath: keyPath] } - public static var flags: OGAttributeTypeFlags { [] } + public static var flags: AttributeType.Flags { [] } public var description: String { "• \(Metadata(Value.self).description)" } } diff --git a/Sources/OpenGraph/Attribute/Rule/Map.swift b/Sources/OpenGraph/Attribute/Rule/Map.swift index 4965876d..2688eecc 100644 --- a/Sources/OpenGraph/Attribute/Rule/Map.swift +++ b/Sources/OpenGraph/Attribute/Rule/Map.swift @@ -19,7 +19,7 @@ public struct Map: Rule, CustomStringConvertible { public var value: Value { body(arg.value) } - public static var flags: OGAttributeTypeFlags { [] } + public static var flags: AttributeType.Flags { [] } public var description: String { "λ \(Value.self)" } } diff --git a/Sources/OpenGraph/Attribute/RuleContext/AnyRuleContext.swift b/Sources/OpenGraph/Attribute/RuleContext/AnyRuleContext.swift index 89139182..0ce940dc 100644 --- a/Sources/OpenGraph/Attribute/RuleContext/AnyRuleContext.swift +++ b/Sources/OpenGraph/Attribute/RuleContext/AnyRuleContext.swift @@ -49,7 +49,7 @@ public struct AnyRuleContext: Equatable { let value = OGGraphGetInputValue(attribute, input: input.identifier, options: options, type: V.self) return ( value.value.assumingMemoryBound(to: V.self).pointee, - value.changed ? ._1 : [] + value.flags ) } @@ -57,7 +57,7 @@ public struct AnyRuleContext: Equatable { let value = OGGraphGetInputValue(attribute, input: input.identifier, options: options, type: V.self) return ( value.value.assumingMemoryBound(to: V.self).pointee, - value.changed + value.flags.contains(.changed) ) } diff --git a/Sources/OpenGraph/Attribute/RuleContext/RuleContext.swift b/Sources/OpenGraph/Attribute/RuleContext/RuleContext.swift index b86c2006..d08f4e83 100644 --- a/Sources/OpenGraph/Attribute/RuleContext/RuleContext.swift +++ b/Sources/OpenGraph/Attribute/RuleContext/RuleContext.swift @@ -61,7 +61,7 @@ public struct RuleContext: Equatable { let value = OGGraphGetInputValue(attribute.identifier, input: input.identifier, options: options, type: V.self) return ( value.value.assumingMemoryBound(to: V.self).pointee, - value.changed ? ._1 : [] + value.flags ) } @@ -69,7 +69,7 @@ public struct RuleContext: Equatable { let value = OGGraphGetInputValue(attribute.identifier, input: input.identifier, options: options, type: V.self) return ( value.value.assumingMemoryBound(to: V.self).pointee, - value.changed + value.flags.contains(.changed) ) } diff --git a/Sources/OpenGraph/Attribute/Weak/AnyWeakAttribute.swift b/Sources/OpenGraph/Attribute/Weak/AnyWeakAttribute.swift index a2849009..ebb3fc30 100644 --- a/Sources/OpenGraph/Attribute/Weak/AnyWeakAttribute.swift +++ b/Sources/OpenGraph/Attribute/Weak/AnyWeakAttribute.swift @@ -14,7 +14,7 @@ extension AnyWeakAttribute { public init(_ attribute: AnyAttribute?) { self = __OGCreateWeakAttribute(attribute ?? .nil) } - + @_alwaysEmitIntoClient public init(_ weakAttribute: WeakAttribute) { self = weakAttribute.base @@ -40,13 +40,13 @@ extension AnyWeakAttribute { extension AnyWeakAttribute: Swift.Hashable { @_alwaysEmitIntoClient public static func == (lhs: AnyWeakAttribute, rhs: AnyWeakAttribute) -> Bool { - lhs.raw_attribute == rhs.raw_attribute && lhs.subgraph_id == rhs.subgraph_id + lhs._details.identifier == rhs._details.identifier && lhs._details.seed == rhs._details.seed } @_alwaysEmitIntoClient public func hash(into hasher: inout Hasher) { - hasher.combine(raw_attribute) - hasher.combine(subgraph_id) + hasher.combine(_details.identifier) + hasher.combine(_details.seed) } @_alwaysEmitIntoClient diff --git a/Sources/OpenGraph/Attribute/Weak/WeakAttribute.swift b/Sources/OpenGraph/Attribute/Weak/WeakAttribute.swift index eaa99f97..96787148 100644 --- a/Sources/OpenGraph/Attribute/Weak/WeakAttribute.swift +++ b/Sources/OpenGraph/Attribute/Weak/WeakAttribute.swift @@ -20,7 +20,7 @@ public struct WeakAttribute { } public init() { - base = AnyWeakAttribute(raw_attribute: AnyAttribute(rawValue: 0), subgraph_id: 0) + base = AnyWeakAttribute(_details: AnyWeakAttribute.__Unnamed_struct__details(identifier: AnyAttribute(rawValue: 0), seed: 0)) } public init(_ attribute: Attribute) { diff --git a/Sources/OpenGraph/Graph/Graph.swift b/Sources/OpenGraph/Graph/Graph.swift index bfd33f49..df9e9cf1 100644 --- a/Sources/OpenGraph/Graph/Graph.swift +++ b/Sources/OpenGraph/Graph/Graph.swift @@ -12,7 +12,7 @@ extension Graph { ctx: GraphContext, body: _AttributeBody.Type, valueType: Metadata, - flags: OGAttributeTypeFlags, + flags: AttributeType.Flags, update: AttributeUpdateBlock ) -> Int { // TODO: __AGGraphInternAttributeType @@ -48,7 +48,7 @@ extension Graph { extension Graph { @_transparent @inline(__always) - public var mainUpdates: Int { numericCast(counter(for: ._10)) } + public var mainUpdates: Int { numericCast(counter(for: .mainThreadUpdateCount)) } } extension Graph { diff --git a/Sources/OpenGraph_SPI/Graph/GraphDescription.mm b/Sources/OpenGraph_SPI/Graph/GraphDescription.mm index e578e2a1..505dc2ce 100644 --- a/Sources/OpenGraph_SPI/Graph/GraphDescription.mm +++ b/Sources/OpenGraph_SPI/Graph/GraphDescription.mm @@ -12,7 +12,7 @@ #if OG_OBJC_FOUNDATION #include -CFStringRef OGDescriptionFormat = CFSTR("format"); +const CFStringRef OGDescriptionFormat = CFSTR("format"); CFTypeRef OG::Graph::description(const Graph * _Nullable graph, NSDictionary* dic) { // TODO diff --git a/Sources/OpenGraph_SPI/Graph/OGGraph.cpp b/Sources/OpenGraph_SPI/Graph/OGGraph.cpp index 3e283367..b4783767 100644 --- a/Sources/OpenGraph_SPI/Graph/OGGraph.cpp +++ b/Sources/OpenGraph_SPI/Graph/OGGraph.cpp @@ -161,27 +161,27 @@ uint64_t OGGraphGetCounter(OGGraphRef graph, OGCounterQueryType query) { } OG::Graph::Context& context = graph->context; switch (query) { - case OGCounterQueryType_0: + case OGCounterQueryTypeNodeCount: return context.get_graph().get_counter_0(); - case OGCounterQueryType_1: + case OGCounterQueryTypeTransactionCount: return context.get_graph().get_counter_1(); - case OGCounterQueryType_2: + case OGCounterQueryTypeUpdateCount: return context.get_graph().get_counter_2(); - case OGCounterQueryType_3: + case OGCounterQueryTypeChangeCount: return context.get_graph().get_counter_3(); - case OGCounterQueryType_4: + case OGCounterQueryTypeContextID: return context.get_graph().get_counter_4(); - case OGCounterQueryType_5: + case OGCounterQueryTypeGraphID: return context.get_graph().get_counter_5(); - case OGCounterQueryType_6: + case OGCounterQueryTypeContextThreadUpdating: return context.thread_is_updating(); - case OGCounterQueryType_7: + case OGCounterQueryTypeThreadUpdating: return context.get_graph().thread_is_updating(); - case OGCounterQueryType_8: + case OGCounterQueryTypeContextNeedsUpdate: return context.get_graph().get_counter_8(); - case OGCounterQueryType_9: + case OGCounterQueryTypeNeedsUpdate: return context.get_graph().get_counter_9(); - case OGCounterQueryType_10: + case OGCounterQueryTypeMainThreadUpdateCount: return context.get_graph().get_counter_10(); default: return 0; diff --git a/Sources/OpenGraph_SPI/include/OGAttributeFlags.h b/Sources/OpenGraph_SPI/include/OGAttributeFlags.h index 03c89dd6..8c2b5024 100644 --- a/Sources/OpenGraph_SPI/include/OGAttributeFlags.h +++ b/Sources/OpenGraph_SPI/include/OGAttributeFlags.h @@ -10,7 +10,7 @@ #include "OGBase.h" -typedef OG_OPTIONS(uint32_t, OGAttributeFlags) { +typedef OG_OPTIONS(uint8_t, OGAttributeFlags) { OGAttributeFlagsDefault = 0, OGAttributeFlagsActive = 1 << 0, OGAttributeFlagsRemovable = 1 << 1, diff --git a/Sources/OpenGraph_SPI/include/OGAttributeType.h b/Sources/OpenGraph_SPI/include/OGAttributeType.h index b2c03ab3..9d889a85 100644 --- a/Sources/OpenGraph_SPI/include/OGAttributeType.h +++ b/Sources/OpenGraph_SPI/include/OGAttributeType.h @@ -6,14 +6,37 @@ #define OGAttributeType_h #include "OGBase.h" +#include "OGAttributeTypeFlags.h" +#include "OGClosure.h" #include "OGTypeID.h" OG_ASSUME_NONNULL_BEGIN -typedef struct OGAttributeType { - OGTypeID typeID; - OGTypeID valueTypeID; - // TODO +typedef struct OGAttributeType OGAttributeType; + +typedef struct OGAttributeVTable { + unsigned long version; + void (*_Nullable type_destroy)(OGAttributeType *); + void (*_Nullable self_destroy)(const OGAttributeType *, void *); + CFStringRef _Nullable (*_Nullable self_description)(const OGAttributeType *, const void *); + CFStringRef _Nullable (*_Nullable value_description)(const OGAttributeType *, const void *); + void (*_Nullable update_default)(const OGAttributeType *, void *); +} OGAttributeVTable OG_SWIFT_NAME(_AttributeVTable); + +typedef struct OG_SWIFT_NAME(AttributeType) OGAttributeType { + OGTypeID self_id; + OGTypeID value_id; + OGClosureStorage update; + const OGAttributeVTable *vtable; + OGAttributeTypeFlags flags; + + uint32_t internal_offset; + const unsigned char *_Nullable value_layout; + + struct { + OGTypeID type_id; + const void *witness_table; + } body_conformance; } OGAttributeType; OG_ASSUME_NONNULL_END diff --git a/Sources/OpenGraph_SPI/include/OGAttributeTypeFlags.h b/Sources/OpenGraph_SPI/include/OGAttributeTypeFlags.h index 61c09a4f..6b8758d0 100644 --- a/Sources/OpenGraph_SPI/include/OGAttributeTypeFlags.h +++ b/Sources/OpenGraph_SPI/include/OGAttributeTypeFlags.h @@ -8,14 +8,17 @@ #include "OGBase.h" typedef OG_OPTIONS(uint32_t, OGAttributeTypeFlags) { - OGAttributeTypeFlagsDefault = 0, - OGAttributeTypeFlags_1 = 1 << 0, - OGAttributeTypeFlags_2 = 1 << 1, - OGAttributeTypeFlags_4 = 1 << 2, + OGAttributeTypeFlagsComparisonModeBitwise = 0, + OGAttributeTypeFlagsComparisonModeIndirect = 1, + OGAttributeTypeFlagsComparisonModeEquatableUnlessPOD = 2, + OGAttributeTypeFlagsComparisonModeEquatableAlways = 3, + OGAttributeTypeFlagsComparisonModeMask = 0x03, + + OGAttributeTypeFlagsHasDestroySelf = 1 << 2, OGAttributeTypeFlagsMainThread = 1 << 3, - OGAttributeTypeFlags_16 = 1 << 4, + OGAttributeTypeFlagsExternal = 1 << 4, OGAttributeTypeFlagsAsyncThread = 1 << 5, -}; +} OG_SWIFT_NAME(AttributeType.Flags); #endif /* OGAttributeTypeFlags_h */ diff --git a/Sources/OpenGraph_SPI/include/OGChangedValueFlags.h b/Sources/OpenGraph_SPI/include/OGChangedValueFlags.h index cd7af2a4..b00544d4 100644 --- a/Sources/OpenGraph_SPI/include/OGChangedValueFlags.h +++ b/Sources/OpenGraph_SPI/include/OGChangedValueFlags.h @@ -8,7 +8,7 @@ #include "OGBase.h" typedef OG_OPTIONS(uint32_t, OGChangedValueFlags) { - OGChangedValueFlags_1 = 1 << 0, + OGChangedValueFlagsChanged = 1 << 0, OGChangedValueFlagsRequiresMainThread = 1 << 1, }; diff --git a/Sources/OpenGraph_SPI/include/OGClosure.h b/Sources/OpenGraph_SPI/include/OGClosure.h new file mode 100644 index 00000000..d5d61a8e --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGClosure.h @@ -0,0 +1,32 @@ +// +// OGClosure.h +// OpenGraph_SPI + +#ifndef OGClosure_h +#define OGClosure_h + +#include "OGBase.h" + +OG_ASSUME_NONNULL_BEGIN + +OG_EXTERN_C_BEGIN + +typedef struct OGClosureStorage { + const void *thunk; + const void *_Nullable context; +} OGClosureStorage; + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGClosureStorage OGRetainClosure(void (*thunk)(void *_Nullable context OG_SWIFT_CONTEXT) OG_SWIFT_CC(swift), + void *_Nullable context); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGReleaseClosure(OGClosureStorage closure); + +OG_EXTERN_C_END + +OG_ASSUME_NONNULL_END + +#endif /* OGClosure_h */ diff --git a/Sources/OpenGraph_SPI/include/OGComparison.h b/Sources/OpenGraph_SPI/include/OGComparison.h index 54acd6a3..de9f7d98 100644 --- a/Sources/OpenGraph_SPI/include/OGComparison.h +++ b/Sources/OpenGraph_SPI/include/OGComparison.h @@ -76,7 +76,7 @@ typedef OG_OPTIONS(uint32_t, OGComparisonOptions) { OGComparisonOptionsCopyOnWrite = 1 << 8, OGComparisonOptionsFetchLayoutsSynchronously = 1 << 9, - OGComparisonOptionsReportFailures = 1ul << 31, // -1 signed int + OGComparisonOptionsTraceCompareFailed = 1ul << 31, // -1 signed int } OG_SWIFT_NAME(ComparisonOptions); OG_EXPORT diff --git a/Sources/OpenGraph_SPI/include/OGCounterQueryType.h b/Sources/OpenGraph_SPI/include/OGCounterQueryType.h index ad87b096..4a93af0b 100644 --- a/Sources/OpenGraph_SPI/include/OGCounterQueryType.h +++ b/Sources/OpenGraph_SPI/include/OGCounterQueryType.h @@ -8,17 +8,20 @@ #include "OGBase.h" typedef OG_ENUM(uint32_t, OGCounterQueryType) { - OGCounterQueryType_0, - OGCounterQueryType_1, - OGCounterQueryType_2, - OGCounterQueryType_3, - OGCounterQueryType_4, - OGCounterQueryType_5, - OGCounterQueryType_6, - OGCounterQueryType_7, - OGCounterQueryType_8, - OGCounterQueryType_9, - OGCounterQueryType_10, + OGCounterQueryTypeNodeCount, + OGCounterQueryTypeTransactionCount, + OGCounterQueryTypeUpdateCount, + OGCounterQueryTypeChangeCount, + OGCounterQueryTypeContextID, + OGCounterQueryTypeGraphID, + OGCounterQueryTypeContextThreadUpdating, + OGCounterQueryTypeThreadUpdating, + OGCounterQueryTypeContextNeedsUpdate, + OGCounterQueryTypeNeedsUpdate, + OGCounterQueryTypeMainThreadUpdateCount, + OGCounterQueryTypeNodeTotalCount, + OGCounterQueryTypeSubgraphCount, + OGCounterQueryTypeSubgraphTotalCount, }; #endif /* OGCounterQueryType_h */ diff --git a/Sources/OpenGraph_SPI/include/OGGraphDescription.h b/Sources/OpenGraph_SPI/include/OGGraphDescription.h index 0c7f7096..1612737e 100644 --- a/Sources/OpenGraph_SPI/include/OGGraphDescription.h +++ b/Sources/OpenGraph_SPI/include/OGGraphDescription.h @@ -11,8 +11,19 @@ OG_ASSUME_NONNULL_BEGIN #if OG_OBJC_FOUNDATION OG_EXTERN_C_BEGIN + +OG_EXPORT +const CFStringRef OGDescriptionFormat OG_SWIFT_NAME(OGGraphRef.descriptionFormat); + +OG_EXPORT +const CFStringRef OGDescriptionMaxFrames OG_SWIFT_NAME(OGGraphRef.maxFrames); + +OG_EXPORT +const CFStringRef OGDescriptionIncludeValues OG_SWIFT_NAME(OGGraphRef.includeValues); + OG_EXPORT -CFStringRef OGDescriptionFormat OG_SWIFT_NAME(OGGraphRef.descriptionFormat); +const CFStringRef OGDescriptionTruncationLimit OG_SWIFT_NAME(OGGraphRef.truncationLimit); + OG_EXTERN_C_END #endif diff --git a/Sources/OpenGraph_SPI/include/OGInputOptions.h b/Sources/OpenGraph_SPI/include/OGInputOptions.h index d71741fc..5e95e938 100644 --- a/Sources/OpenGraph_SPI/include/OGInputOptions.h +++ b/Sources/OpenGraph_SPI/include/OGInputOptions.h @@ -8,8 +8,9 @@ #include "OGBase.h" typedef OG_OPTIONS(uint32_t, OGInputOptions) { - OGInputOptions_0 = 0, - OGInputOptions_1 = 1, + OGInputOptionsNone = 0, + OGInputOptionsUnprefetched = 1 << 0, + OGInputOptionsSyncMainRef = 1 << 1, }; #endif /* OGInputOptions_h */ diff --git a/Sources/OpenGraph_SPI/include/OGSearchOptions.h b/Sources/OpenGraph_SPI/include/OGSearchOptions.h index 4e9c2f03..240522ec 100644 --- a/Sources/OpenGraph_SPI/include/OGSearchOptions.h +++ b/Sources/OpenGraph_SPI/include/OGSearchOptions.h @@ -8,8 +8,9 @@ #include "OGBase.h" typedef OG_OPTIONS(uint32_t, OGSearchOptions) { - OGSearchOptions_0 = 0, - OGSearchOptions_1 = 1, + OGSearchOptionsSearchInputs = 1 << 0, + OGSearchOptionsSearchOutputs = 1 << 1, + OGSearchOptionsTraverseGraphContexts = 1 << 2, }; #endif /* Header_h */ diff --git a/Sources/OpenGraph_SPI/include/OGTypeID.h b/Sources/OpenGraph_SPI/include/OGTypeID.h index a411c0d6..304d4f18 100644 --- a/Sources/OpenGraph_SPI/include/OGTypeID.h +++ b/Sources/OpenGraph_SPI/include/OGTypeID.h @@ -31,16 +31,16 @@ typedef OG_CLOSED_ENUM(uint32_t, OGTypeKind) { } OG_SWIFT_NAME(Metadata.Kind); typedef OG_OPTIONS(uint32_t, OGTypeApplyOptions) { - OGTypeApplyOptions_0 = 0, - OGTypeApplyOptions_1 = 1 << 0, - OGTypeApplyOptions_2 = 1 << 1, - OGTypeApplyOptions_4 = 1 << 2, + OGTypeApplyOptionsEnumerateStructFields = 0, + OGTypeApplyOptionsEnumerateClassFields = 1 << 0, + OGTypeApplyOptionsContinueAfterUnknownField = 1 << 1, + OGTypeApplyOptionsEnumerateEnumCases = 1 << 2, }; #if OPENGRAPH_RELEASE >= OPENGRAPH_RELEASE_2024 typedef struct OG_SWIFT_NAME(Signature) OGTypeSignature { - uint32_t bytes[5]; + uint8_t bytes[20]; } OGTypeSignature; #endif diff --git a/Sources/OpenGraph_SPI/include/OGValue.h b/Sources/OpenGraph_SPI/include/OGValue.h index cea55304..20a70051 100644 --- a/Sources/OpenGraph_SPI/include/OGValue.h +++ b/Sources/OpenGraph_SPI/include/OGValue.h @@ -6,12 +6,13 @@ #define OGValue_h #include "OGBase.h" +#include "OGChangedValueFlags.h" OG_ASSUME_NONNULL_BEGIN typedef struct OGValue { - const void* value; - const bool changed; + const void *value; + OGChangedValueFlags flags; } OGValue; OG_ASSUME_NONNULL_END diff --git a/Sources/OpenGraph_SPI/include/OGValueOptions.h b/Sources/OpenGraph_SPI/include/OGValueOptions.h index 652dd407..9d0c2527 100644 --- a/Sources/OpenGraph_SPI/include/OGValueOptions.h +++ b/Sources/OpenGraph_SPI/include/OGValueOptions.h @@ -8,9 +8,10 @@ #include "OGBase.h" typedef OG_OPTIONS(uint32_t, OGValueOptions) { - OGValueOptions_0 = 0, - OGValueOptions_1 = 1, - OGValueOptions_2 = 2, + OGValueOptionsNone = 0, + OGValueOptionsInputOptionsMask = 0x03, + + OGValueOptionsIncrementGraphVersion = 1 << 2, // AsTopLevelOutput }; #endif /* OGValueOptions_h */ diff --git a/Sources/OpenGraph_SPI/include/OGValueState.h b/Sources/OpenGraph_SPI/include/OGValueState.h index aa4b81ad..ad82bd38 100644 --- a/Sources/OpenGraph_SPI/include/OGValueState.h +++ b/Sources/OpenGraph_SPI/include/OGValueState.h @@ -9,9 +9,17 @@ OG_ASSUME_NONNULL_BEGIN -typedef struct OGValueState { - // TODO -} OGValueState; +typedef OG_OPTIONS(uint8_t, OGValueState) { + OGValueStateNone = 0, + OGValueStateDirty = 1 << 0, + OGValueStatePending = 1 << 1, + OGValueStateUpdating = 1 << 2, + OGValueStateValueExists = 1 << 3, + OGValueStateMainThread = 1 << 4, + OGValueStateMainRef = 1 << 5, + OGValueStateRequiresMainThread = 1 << 6, + OGValueStateSelfModified = 1 << 7, +}; OG_ASSUME_NONNULL_END diff --git a/Sources/OpenGraph_SPI/include/OGWeakAttribute.h b/Sources/OpenGraph_SPI/include/OGWeakAttribute.h index 7b2472e6..5d0d8c07 100644 --- a/Sources/OpenGraph_SPI/include/OGWeakAttribute.h +++ b/Sources/OpenGraph_SPI/include/OGWeakAttribute.h @@ -11,9 +11,11 @@ OG_ASSUME_NONNULL_BEGIN typedef struct OGWeakAttribute { - const OGAttribute raw_attribute; - const uint32_t subgraph_id; -} OGWeakAttribute; + struct { + OGAttribute identifier; + uint32_t seed; + } _details; +} OGWeakAttribute OG_SWIFT_NAME(AnyWeakAttribute); OG_EXTERN_C_BEGIN