diff --git a/Sources/OpenGraph_SPI/Attribute/OGAttribute.h b/Sources/OpenGraph_SPI/Attribute/OGAttribute.h deleted file mode 100644 index 9af1b3b9..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGAttribute.h +++ /dev/null @@ -1,166 +0,0 @@ -// -// OGAttribute.h -// -// -// Created by Kyle on 2023/9/25. -// - -#ifndef OGAttribute_h -#define OGAttribute_h - -#include "OGBase.h" -#include "OGAttributeInfo.h" -#include "OGAttributeFlags.h" -#include "OGCachedValueOptions.h" -#include "OGGraph.h" -#include "OGInputOptions.h" -#include "OGTypeID.h" -#include "OGValue.h" -#include "OGValueOptions.h" -#include "OGValueState.h" - -OG_ASSUME_NONNULL_BEGIN - -OG_EXTERN_C_BEGIN - -OG_EXPORT -const OGAttribute OGAttributeNil; - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGAttribute OGGraphGetCurrentAttribute(void); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGAttribute OGGraphCreateOffsetAttribute(OGAttribute attribute, long offset) OG_SWIFT_NAME(OGAttribute.create(self:offset:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGAttribute OGGraphCreateOffsetAttribute2(OGAttribute attribute, long offset, uint64_t size) OG_SWIFT_NAME(OGAttribute.create(self:offset:size:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGAttribute OGGraphCreateIndirectAttribute(OGAttribute attribute) OG_SWIFT_NAME(OGAttribute.createIndirect(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGAttribute OGGraphCreateIndirectAttribute2(OGAttribute attribute, uint64_t size) OG_SWIFT_NAME(OGAttribute.createIndirect(self:size:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGAttributeFlags OGGraphGetFlags(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute.flags(self:)); - -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_SWIFT_NAME(getter:OGAttribute.info(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphMutateAttribute(OGAttribute attribute, - const OGTypeID type, - bool invalidating, - const void (*function)(const void * _Nullable context OG_SWIFT_CONTEXT, void *body) OG_SWIFT_CC(swift), - const void * _Nullable context); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGAttribute OGGraphGetIndirectDependency(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute._indirectDependency(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphSetIndirectDependency(OGAttribute attribute1, OGAttribute attribute2) OG_SWIFT_NAME(setter:OGAttribute._indirectDependency(self:_:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGAttribute OGGraphGetIndirectAttribute(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute.source(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphSetIndirectAttribute(OGAttribute attribute1, OGAttribute attribute2) OG_SWIFT_NAME(setter:OGAttribute.source(self:_:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGAttribute OGGraphCreateAttribute(long index, const void *body, const void * _Nullable value); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -const OGValue OGGraphGetValue(OGAttribute attribute, OGValueOptions options, const OGTypeID type); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -bool OGGraphSetValue(OGAttribute attribute, const void *value, const OGTypeID type); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -const OGValue OGGraphGetInputValue(OGAttribute attribute, OGAttribute inputAttribute, OGValueOptions options, const OGTypeID type); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -const void * _Nullable OGGraphGetOutputValue(OGTypeID type); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphSetOutputValue(const void *value, const OGTypeID type); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGValueState OGGraphGetValueState(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute.valueState(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -bool OGGraphHasValue(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute.hasValue(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphUpdateValue(OGAttribute attribute) OG_SWIFT_NAME(OGAttribute.updateValue(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphPrefetchValue(OGAttribute attribute) OG_SWIFT_NAME(OGAttribute.prefetchValue(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphInvalidateValue(OGAttribute attribute) OG_SWIFT_NAME(OGAttribute.invalidateValue(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphVerifyType(OGAttribute attribute, OGTypeID type) OG_SWIFT_NAME(OGAttribute.verify(self:type:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGGraphRef OGGraphGetAttributeGraph(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute.graph(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGSubgraphRef OGGraphGetAttributeSubgraph(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute.subgraph(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -const void * OGGraphReadCachedAttribute(long hashValue, OGTypeID bodyType, const void *bodyPointer, OGTypeID valueType, OGCachedValueOptions options, OGAttribute attribute, bool unknown/*, ...*/); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -const void * _Nullable OGGraphReadCachedAttributeIfExists(long hashValue, OGTypeID bodyType, const void *bodyPointer, OGTypeID valueType, OGCachedValueOptions options, OGAttribute attribute, bool unknown); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphWithUpdate( - OGAttribute attribute, - void (* callback)(const void *context OG_SWIFT_CONTEXT) OG_SWIFT_CC(swift), - const void *context -); - -OG_EXTERN_C_END - -OG_ASSUME_NONNULL_END - -#endif /* OGAttribute_h */ - diff --git a/Sources/OpenGraph_SPI/Attribute/OGAttributeFlags.h b/Sources/OpenGraph_SPI/Attribute/OGAttributeFlags.h deleted file mode 100644 index 390eb136..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGAttributeFlags.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// OGAttributeFlags.h -// _OpenGraph -// -// Audited for RELEASE_2021 -// Status: Complete - -#ifndef OGAttributeFlags_h -#define OGAttributeFlags_h - -#include "OGBase.h" - -typedef OG_OPTIONS(uint32_t, OGAttributeFlags) { - OGAttributeFlagsDefault = 0, - OGAttributeFlagsActive = 1 << 0, - OGAttributeFlagsRemovable = 1 << 1, - OGAttributeFlagsInvalidatable = 1 << 2, - - OGAttributeFlagsMask = 0xFF, -}; - -#endif /* OGAttributeFlags_h */ diff --git a/Sources/OpenGraph_SPI/Attribute/OGAttributeInfo.h b/Sources/OpenGraph_SPI/Attribute/OGAttributeInfo.h deleted file mode 100644 index a9994df5..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGAttributeInfo.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// 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_SPI/Attribute/OGAttributeType.h b/Sources/OpenGraph_SPI/Attribute/OGAttributeType.h deleted file mode 100644 index 73fbfe68..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGAttributeType.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// 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_SPI/Attribute/OGAttributeTypeFlags.h b/Sources/OpenGraph_SPI/Attribute/OGAttributeTypeFlags.h deleted file mode 100644 index 438ca797..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGAttributeTypeFlags.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// OGAttributeTypeFlags.h -// -// -// Created by Kyle on 2023/9/25. -// - -#ifndef OGAttributeTypeFlags_h -#define OGAttributeTypeFlags_h - -#include "OGBase.h" - -typedef OG_OPTIONS(uint32_t, OGAttributeTypeFlags) { - OGAttributeTypeFlagsDefault = 0, - OGAttributeTypeFlags_1 = 1 << 0, - OGAttributeTypeFlags_2 = 1 << 1, - OGAttributeTypeFlags_4 = 1 << 2, - OGAttributeTypeFlagsMainThread = 1 << 3, - OGAttributeTypeFlags_16 = 1 << 4, - OGAttributeTypeFlagsAsyncThread = 1 << 5, -}; - -#endif /* OGAttributeTypeFlags_h */ - diff --git a/Sources/OpenGraph_SPI/Attribute/OGCachedValueOptions.h b/Sources/OpenGraph_SPI/Attribute/OGCachedValueOptions.h deleted file mode 100644 index c3e70c4c..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGCachedValueOptions.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// OGCachedValueOptions.h -// -// -// Created by Kyle on 2024/2/23. -// - -#ifndef OGCachedValueOptions_h -#define OGCachedValueOptions_h - -#include "OGBase.h" - -typedef OG_OPTIONS(uint32_t, OGCachedValueOptions) { - OGCachedValueOptions_0 = 0, - OGCachedValueOptions_1 = 1 << 0, - OGCachedValueOptions_2 = 1 << 1, - OGCachedValueOptions_4 = 1 << 2, - OGCachedValueOptions_8 = 1 << 3, - OGCachedValueOptions_16 = 1 << 4, -}; - -#endif /* OGCachedValueOptions_h */ - diff --git a/Sources/OpenGraph_SPI/Attribute/OGChangedValueFlags.h b/Sources/OpenGraph_SPI/Attribute/OGChangedValueFlags.h deleted file mode 100644 index 6fd84b40..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGChangedValueFlags.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// OGChangedValueFlags.h -// -// -// Created by Kyle on 2024/2/21. -// - -#ifndef OGChangedValueFlags_h -#define OGChangedValueFlags_h - -#include "OGBase.h" - -typedef OG_OPTIONS(uint32_t, OGChangedValueFlags) { - OGChangedValueFlags_1 = 1 << 0, - OGChangedValueFlagsRequiresMainThread = 1 << 1, -}; - -#endif /* OGChangedValueFlags_h */ diff --git a/Sources/OpenGraph_SPI/Attribute/OGInputOptions.h b/Sources/OpenGraph_SPI/Attribute/OGInputOptions.h deleted file mode 100644 index 477d263c..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGInputOptions.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// 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_SPI/Attribute/OGSearchOptions.h b/Sources/OpenGraph_SPI/Attribute/OGSearchOptions.h deleted file mode 100644 index 42142e63..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGSearchOptions.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// 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_SPI/Attribute/OGValue.h b/Sources/OpenGraph_SPI/Attribute/OGValue.h deleted file mode 100644 index 6e5a34bf..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGValue.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// OGValue.h -// -// -// Created by Kyle on 2024/2/19. -// - -#ifndef OGValue_h -#define OGValue_h - -#include "OGBase.h" - -OG_ASSUME_NONNULL_BEGIN - -typedef struct OGValue { - const void* value; - const bool changed; -} OGValue; - -OG_ASSUME_NONNULL_END - -#endif /* OGValue_h */ diff --git a/Sources/OpenGraph_SPI/Attribute/OGValueOptions.h b/Sources/OpenGraph_SPI/Attribute/OGValueOptions.h deleted file mode 100644 index 15188c49..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGValueOptions.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// OGValueOptions.h -// -// -// Created by Kyle on 2024/2/19. -// - -#ifndef OGValueOptions_h -#define OGValueOptions_h - -#include "OGBase.h" - -typedef OG_OPTIONS(uint32_t, OGValueOptions) { - OGValueOptions_0 = 0, - OGValueOptions_1 = 1, - OGValueOptions_2 = 2, -}; - -#endif /* OGValueOptions_h */ diff --git a/Sources/OpenGraph_SPI/Attribute/OGValueState.h b/Sources/OpenGraph_SPI/Attribute/OGValueState.h deleted file mode 100644 index bca21d7c..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGValueState.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// OGValueState.h -// -// -// Created by Kyle on 2024/2/21. -// - -#ifndef OGValueState_h -#define OGValueState_h - -#include "OGBase.h" - -OG_ASSUME_NONNULL_BEGIN - -typedef struct OGValueState { - // TODO -} OGValueState; - -OG_ASSUME_NONNULL_END - -#endif /* OGValueState_h */ diff --git a/Sources/OpenGraph_SPI/Attribute/OGWeakAttribute.h b/Sources/OpenGraph_SPI/Attribute/OGWeakAttribute.h deleted file mode 100644 index fce42dd4..00000000 --- a/Sources/OpenGraph_SPI/Attribute/OGWeakAttribute.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// OGWeakAttribute.h -// -// -// Created by Kyle on 2024/2/27. -// - -#ifndef OGWeakAttribute_hpp -#define OGWeakAttribute_hpp - -#include "OGBase.h" -#include "OGAttribute.h" - -OG_ASSUME_NONNULL_BEGIN - -typedef struct OGWeakAttribute { - const OGAttribute raw_attribute; - const uint32_t subgraph_id; -} OGWeakAttribute; - -OG_EXTERN_C_BEGIN - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGWeakAttribute OGCreateWeakAttribute(OGAttribute attribute); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGAttribute OGWeakAttributeGetAttribute(OGWeakAttribute weakAttribute); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGValue OGGraphGetWeakValue(OGWeakAttribute weakAttribute, OGValueOptions options, OGTypeID type); - -OG_EXTERN_C_END - -OG_ASSUME_NONNULL_END - -#endif /* OGWeakAttribute_h */ diff --git a/Sources/OpenGraph_SPI/Data/OGUniqueID.h b/Sources/OpenGraph_SPI/Data/OGUniqueID.h deleted file mode 100644 index f0348c92..00000000 --- a/Sources/OpenGraph_SPI/Data/OGUniqueID.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// OGMakeUniqueID.h -// OpenGraph_SPI -// -// Audited for iOS 18.0 -// Status: Complete - -#ifndef OGMakeUniqueID_h -#define OGMakeUniqueID_h - -#include "OGBase.h" -typedef long OGUniqueID; - -OG_EXTERN_C_BEGIN -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGUniqueID OGMakeUniqueID(void) OG_SWIFT_NAME(makeUniqueID()); -OG_EXTERN_C_END - -#endif /* OGMakeUniqueID_h */ diff --git a/Sources/OpenGraph_SPI/Debug/OGDebugServer.h b/Sources/OpenGraph_SPI/Debug/OGDebugServer.h deleted file mode 100644 index cb0b615a..00000000 --- a/Sources/OpenGraph_SPI/Debug/OGDebugServer.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// OGDebugServer.h -// -// -// Created by Kyle on 2024/2/17. -// - -#ifndef OGDebugServer_h -#define OGDebugServer_h - -#include "OGBase.h" - -#if OG_TARGET_OS_DARWIN - -OG_ASSUME_NONNULL_BEGIN - -typedef struct OGDebugServerStorage OGDebugServerStorage; - -typedef const OGDebugServerStorage *OGDebugServer OG_SWIFT_STRUCT; - -// MARK: - Exported C functions - -OG_EXTERN_C_BEGIN -OG_EXPORT -OGDebugServer _Nullable OGDebugServerStart(unsigned int mode) OG_SWIFT_NAME(OGDebugServer.start(mode:)); -OG_EXPORT -void OGDebugServerStop(void) OG_SWIFT_NAME(OGDebugServer.stop()); -OG_EXPORT -CFURLRef _Nullable OGDebugServerCopyURL(void) OG_SWIFT_NAME(OGDebugServer.copyURL()); -OG_EXPORT -void OGDebugServerRun(int timeout) OG_SWIFT_NAME(OGDebugServer.run(timeout:)); -OG_EXTERN_C_END - -OG_ASSUME_NONNULL_END - -#endif - -#endif /* OGDebugServer_h */ diff --git a/Sources/OpenGraph_SPI/Debug/og-debug-server.mm b/Sources/OpenGraph_SPI/Debug/og-debug-server.mm index b6d73275..9a0db8b5 100644 --- a/Sources/OpenGraph_SPI/Debug/og-debug-server.mm +++ b/Sources/OpenGraph_SPI/Debug/og-debug-server.mm @@ -8,9 +8,9 @@ #include "og-debug-server.hpp" #if OG_TARGET_OS_DARWIN +#include "OGGraphDescription.h" #include "../Util/log.hpp" #include "../Util/assert.hpp" -#include "../Graph/OGGraphDescription.h" #include "../Graph/Graph.hpp" #include diff --git a/Sources/OpenGraph_SPI/Graph/Graph.hpp b/Sources/OpenGraph_SPI/Graph/Graph.hpp index 39111ca1..cf5055de 100644 --- a/Sources/OpenGraph_SPI/Graph/Graph.hpp +++ b/Sources/OpenGraph_SPI/Graph/Graph.hpp @@ -10,9 +10,9 @@ #include "OGBase.h" #include "OGGraph.h" +#include "OGUniqueID.h" #include "../Private/CFRuntime.h" #include "../Data/ClosureFunction.hpp" -#include "../Data/OGUniqueID.h" OG_ASSUME_NONNULL_BEGIN diff --git a/Sources/OpenGraph_SPI/Graph/OGCounterQueryType.h b/Sources/OpenGraph_SPI/Graph/OGCounterQueryType.h deleted file mode 100644 index ffafcbac..00000000 --- a/Sources/OpenGraph_SPI/Graph/OGCounterQueryType.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// OGCounterQueryType.h -// -// -// Created by Kyle on 2024/3/8. -// - -#ifndef OGCounterQueryType_h -#define OGCounterQueryType_h - -#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, -}; - -#endif /* OGCounterQueryType_h */ diff --git a/Sources/OpenGraph_SPI/Graph/OGGraph.h b/Sources/OpenGraph_SPI/Graph/OGGraph.h deleted file mode 100644 index 37154bfa..00000000 --- a/Sources/OpenGraph_SPI/Graph/OGGraph.h +++ /dev/null @@ -1,110 +0,0 @@ -// -// OGGraph.h -// OpenGraph_SPI - -#ifndef OGGraph_h -#define OGGraph_h - -#include "OGBase.h" -#include "../Private/CFRuntime.h" -#include "OGCounterQueryType.h" - -// Note: Place all structure declaration in a single place to avoid header cycle dependency - -typedef struct OG_BRIDGED_TYPE(id) OGGraphStorage * OGGraphRef OG_SWIFT_NAME(Graph); -typedef struct OG_BRIDGED_TYPE(id) OGSubgraphStorage * OGSubgraphRef OG_SWIFT_NAME(Subgraph); -typedef struct OG_BRIDGED_TYPE(id) OGGraphContextStorage * OGGraphContextRef OG_SWIFT_NAME(GraphContext); - -struct OGGraphStorage; -struct OGGraphContextStorage; -struct OGSubgraphStorage; - -typedef uint32_t OGAttribute OG_SWIFT_STRUCT OG_SWIFT_NAME(AnyAttribute); - -OG_ASSUME_NONNULL_BEGIN - -// MARK: - Exported C functions - -OG_EXTERN_C_BEGIN - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGGraphRef OGGraphCreate(void) OG_SWIFT_NAME(OGGraphRef.init()); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGGraphRef OGGraphCreateShared(_Nullable OGGraphRef graph) OG_SWIFT_NAME(OGGraphRef.init(shared:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphArchiveJSON(char const * _Nullable name) OG_SWIFT_NAME(OGGraphRef.archiveJSON(name:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -_Nullable CFTypeRef OGGraphDescription(_Nullable OGGraphRef graph, CFDictionaryRef options) OG_SWIFT_NAME(OGGraphRef.description(_:options:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -CFTypeID OGGraphGetTypeID(void) OG_SWIFT_NAME(getter:OGGraphRef.typeID()); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphStartProfiling(_Nullable OGGraphRef graph); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphStopProfiling(_Nullable OGGraphRef graph); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -const void * _Nullable OGGraphGetContext(OGGraphRef graph) OG_SWIFT_NAME(getter:OGGraphRef.context(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphSetContext(OGGraphRef graph, const void * _Nullable context) OG_SWIFT_NAME(setter:OGGraphRef.context(self:_:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGGraphContextRef OGGraphGetGraphContext(OGGraphRef graph) OG_SWIFT_NAME(getter:OGGraphRef.graphContext(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphInvalidate(OGGraphRef graph) OG_SWIFT_NAME(OGGraphRef.invalidate(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphInvalidateAllValues(OGGraphRef graph) OG_SWIFT_NAME(OGGraphRef.invalidateAllValues(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphSetInvalidationCallback(OGGraphRef graph, - const void (*_Nullable function)(const void * _Nullable context OG_SWIFT_CONTEXT, OGAttribute) OG_SWIFT_CC(swift), - const void * _Nullable context); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphSetUpdateCallback(OGGraphRef graph, - const void (*_Nullable function)(const void * _Nullable context OG_SWIFT_CONTEXT) OG_SWIFT_CC(swift), - const void * _Nullable context); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -uint64_t OGGraphGetCounter(OGGraphRef graph, OGCounterQueryType query) OG_SWIFT_NAME(OGGraphRef.counter(self:for:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphSetUpdate(const void * _Nullable value) OG_SWIFT_NAME(OGGraphRef.setUpdate(_:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -const void * _Nullable OGGraphClearUpdate(void) OG_SWIFT_NAME(OGGraphRef.clearUpdate()); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGGraphSetNeedsUpdate(OGGraphRef graph) OG_SWIFT_NAME(OGGraphRef.setNeedsUpdate(self:)); - -OG_EXTERN_C_END - -OG_ASSUME_NONNULL_END - -#endif /* OGGraph_h */ diff --git a/Sources/OpenGraph_SPI/Graph/OGGraphContext.h b/Sources/OpenGraph_SPI/Graph/OGGraphContext.h deleted file mode 100644 index 20697398..00000000 --- a/Sources/OpenGraph_SPI/Graph/OGGraphContext.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// OGGraphContext.h -// -// -// Created by Kyle on 2024/2/16. -// - -#ifndef OGGraphContext_h -#define OGGraphContext_h - -#include "OGBase.h" -#include "OGGraph.h" - -// MARK: - Exported C functions - -OG_ASSUME_NONNULL_BEGIN - -OG_EXTERN_C_BEGIN - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGGraphRef OGGraphContextGetGraph(OGGraphContextRef context) OG_SWIFT_NAME(getter:OGGraphContextRef.graph(self:)); - -OG_EXTERN_C_END - -OG_ASSUME_NONNULL_END - -#endif /* OGGraphContext_h */ diff --git a/Sources/OpenGraph_SPI/Graph/OGGraphDescription.h b/Sources/OpenGraph_SPI/Graph/OGGraphDescription.h deleted file mode 100644 index 4e12a2af..00000000 --- a/Sources/OpenGraph_SPI/Graph/OGGraphDescription.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// OGGraphDescription.h -// -// -// Created by Kyle on 2024/1/21. -// - -#ifndef OGGraphDescription_h -#define OGGraphDescription_h - -#include "OGBase.h" - -OG_ASSUME_NONNULL_BEGIN - -#if OG_OBJC_FOUNDATION -OG_EXTERN_C_BEGIN -OG_EXPORT -CFStringRef OGDescriptionFormat OG_SWIFT_NAME(OGGraphRef.descriptionFormat); -OG_EXTERN_C_END -#endif - -OG_ASSUME_NONNULL_END - -#endif /* OGGraphDescription_h */ diff --git a/Sources/OpenGraph_SPI/Graph/OGSubgraph.h b/Sources/OpenGraph_SPI/Graph/OGSubgraph.h deleted file mode 100644 index ddf4ea20..00000000 --- a/Sources/OpenGraph_SPI/Graph/OGSubgraph.h +++ /dev/null @@ -1,113 +0,0 @@ -// -// OGSubgraph.h -// -// -// Created by Kyle on 2024/2/15. -// - -#ifndef OGSubgraph_h -#define OGSubgraph_h - -#include "OGBase.h" -#include "OGGraph.h" -#include "OGAttribute.h" -#include "OGAttributeFlags.h" -#include "OGUniqueID.h" -#include "../Private/CFRuntime.h" - -OG_ASSUME_NONNULL_BEGIN - -// MARK: - Exported C functions - -OG_EXTERN_C_BEGIN - -OG_EXPORT -OG_REFINED_FOR_SWIFT -CFTypeID OGSubgraphGetTypeID(); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGSubgraphRef OGSubgraphCreate(OGGraphRef cf_graph) OG_SWIFT_NAME(OGSubgraphRef.init(graph:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGSubgraphRef OGSubgraphCreate2(OGGraphRef cf_graph, OGAttribute attribute) OG_SWIFT_NAME(OGSubgraphRef.init(graph:attribute:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -_Nullable OGSubgraphRef OGSubgraphGetCurrent(void) OG_SWIFT_NAME(getter:OGSubgraphRef.current()); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGSubgraphSetCurrent(_Nullable OGSubgraphRef cf_subgraph) OG_SWIFT_NAME(setter:OGSubgraphRef.current(_:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -_Nullable OGGraphContextRef OGSubgraphGetCurrentGraphContext(void) OG_SWIFT_NAME(getter:OGSubgraphRef.currentGraphContext()); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGSubgraphInvalidate(OGSubgraphRef cf_subgraph) OG_SWIFT_NAME(OGSubgraphRef.invalidate(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -bool OGSubgraphIsValid(OGSubgraphRef cf_subgraph) OG_SWIFT_NAME(getter:OGSubgraphRef.isValid(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGGraphRef OGSubgraphGetGraph(OGSubgraphRef cf_subgraph) OG_SWIFT_NAME(getter:OGSubgraphRef.graph(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGSubgraphAddChild(OGSubgraphRef parent, OGSubgraphRef child) OG_SWIFT_NAME(OGSubgraphRef.addChild(self:_:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGSubgraphRemoveChild(OGSubgraphRef parent, OGSubgraphRef child) OG_SWIFT_NAME(OGSubgraphRef.removeChild(self:_:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGSubgraphApply(OGSubgraphRef cf_subgraph, - OGAttributeFlags flags, - const void (*function)(const void * _Nullable context OG_SWIFT_CONTEXT, OGAttribute attribute) OG_SWIFT_CC(swift), - const void * _Nullable context); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGSubgraphUpdate(OGSubgraphRef cf_subgraph, OGAttributeFlags flags) OG_SWIFT_NAME(OGSubgraphRef.update(self:flags:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -bool OGSubgraphIsDirty(OGSubgraphRef cf_subgraph, uint32_t unknown) OG_SWIFT_NAME(OGSubgraphRef.isDirty(self:_:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGUniqueID OGSubgraphAddObserver(OGSubgraphRef cf_subgraph, - const void (*function)(const void * _Nullable context OG_SWIFT_CONTEXT) OG_SWIFT_CC(swift), - const void * _Nullable context); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -bool OGSubgraphShouldRecordTree(void) OG_SWIFT_NAME(getter:OGSubgraphRef.shouldRecordTree()); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGSubgraphSetShouldRecordTree(void) OG_SWIFT_NAME(OGSubgraphRef.setShouldRecordTree()); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGSubgraphBeginTreeElement(OGAttribute attribute, OGTypeID type, uint32_t flags); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGSubgraphAddTreeValue(OGAttribute attribute, OGTypeID type, const char * key, uint32_t flags); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGSubgraphEndTreeElement(OGAttribute attribute); - -OG_EXTERN_C_END - -OG_ASSUME_NONNULL_END - -#endif /* OGSubgraph_h */ diff --git a/Sources/OpenGraph_SPI/OGBase.h b/Sources/OpenGraph_SPI/OGBase.h deleted file mode 100644 index eaacdc5d..00000000 --- a/Sources/OpenGraph_SPI/OGBase.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// OGBase.h -// OpenGraph - -#ifndef OGBase_h -#define OGBase_h - -#if DEBUG -#define OG_ASSERTION -#else -#undef OG_ASSERTION -#endif - -#if __has_attribute(cold) -#define __cold __attribute__((__cold__)) -#else -#define __cold -#endif - -#if __has_attribute(noreturn) -#define __dead2 __attribute__((__noreturn__)) -#else -#define __dead2 -#endif - -#if defined(__cplusplus) -#define OG_NOEXCEPT noexcept -#else -#define OG_NOEXCEPT -#endif - -#if defined(__GNUC__) -#define OG_INLINE __inline__ __attribute__((always_inline)) -#elif defined(__cplusplus) -#define OG_INLINE inline -#else -#define OG_INLINE -#endif - -#if defined(__cplusplus) -#define OG_CONSTEXPR constexpr -#else -#define OG_CONSTEXPR -#endif - -#include "OGSwiftSupport.h" -#include "OGTargetConditionals.h" -#include -#include -#include - -#define OG_ENUM CF_ENUM -#define OG_CLOSED_ENUM CF_CLOSED_ENUM -#define OG_OPTIONS CF_OPTIONS -#define OG_EXTERN_C_BEGIN CF_EXTERN_C_BEGIN -#define OG_EXTERN_C_END CF_EXTERN_C_END -#define OG_ASSUME_NONNULL_BEGIN CF_ASSUME_NONNULL_BEGIN -#define OG_ASSUME_NONNULL_END CF_ASSUME_NONNULL_END -#define OG_IMPLICIT_BRIDGING_ENABLED CF_IMPLICIT_BRIDGING_ENABLED -#define OG_IMPLICIT_BRIDGING_DISABLED CF_IMPLICIT_BRIDGING_DISABLED -#define OG_EXPORT CF_EXPORT -#define OG_BRIDGED_TYPE CF_BRIDGED_TYPE - -#if OG_TARGET_OS_DARWIN && __OBJC__ -#define OG_OBJC_FOUNDATION 1 -#else -#define OG_OBJC_FOUNDATION 0 -#endif /* OG_TARGET_OS_DARWIN && __OBJC__ */ - -#endif /* OGBase_h */ diff --git a/Sources/OpenGraph_SPI/OGSwiftSupport.h b/Sources/OpenGraph_SPI/OGSwiftSupport.h deleted file mode 100644 index c0cb4d80..00000000 --- a/Sources/OpenGraph_SPI/OGSwiftSupport.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// OGSwiftSupport.h -// OpenGraph - -#ifndef OGSwiftSupport_h -#define OGSwiftSupport_h - -#if __has_attribute(swift_name) -#define OG_SWIFT_NAME(_name) __attribute__((swift_name(#_name))) -#else -#define OG_SWIFT_NAME -#endif - -#if __has_attribute(swift_wrapper) -#define OG_SWIFT_STRUCT __attribute__((swift_wrapper(struct))) -#else -#define OG_SWIFT_STRUCT -#endif - -#if __has_attribute(swift_private) -#define OG_REFINED_FOR_SWIFT __attribute__((swift_private)) -#else -#define OG_REFINED_FOR_SWIFT -#endif - -// MARK: - Call Convension - -#define OG_SWIFT_CC(CC) OG_SWIFT_CC_##CC -// OG_SWIFT_CC(c) is the C calling convention. -#define OG_SWIFT_CC_c - -// OG_SWIFT_CC(swift) is the Swift calling convention. -#if __has_attribute(swiftcall) -#define OG_SWIFT_CC_swift __attribute__((swiftcall)) -#define OG_SWIFT_CONTEXT __attribute__((swift_context)) -#define OG_SWIFT_ERROR_RESULT __attribute__((swift_error_result)) -#define OG_SWIFT_INDIRECT_RESULT __attribute__((swift_indirect_result)) -#else -#define OG_SWIFT_CC_swift -#define OG_SWIFT_CONTEXT -#define OG_SWIFT_ERROR_RESULT -#define OG_SWIFT_INDIRECT_RESULT -#endif - -#endif /* OGSwiftSupport_h */ diff --git a/Sources/OpenGraph_SPI/OGTargetConditionals.h b/Sources/OpenGraph_SPI/OGTargetConditionals.h deleted file mode 100644 index d9691620..00000000 --- a/Sources/OpenGraph_SPI/OGTargetConditionals.h +++ /dev/null @@ -1,277 +0,0 @@ -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See http://swift.org/LICENSE.txt for license information -// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// - -/* - File: OGTargetConditionals.h - - Contains: Autoconfiguration of TARGET_ conditionals for Mac OS X and iPhone - - Note: OpenSwiftUITargetConditionals.h in 3.4 Universal Interfaces works - with all compilers. This header only recognizes compilers - known to run on Mac OS X. - -*/ - -#ifndef __OPENGRAPHTARGETCONDITIONALS__ -#define __OPENGRAPHTARGETCONDITIONALS__ -/**************************************************************************************************** - - TARGET_CPU_* - These conditionals specify which microprocessor instruction set is being - generated. At most one of these is true, the rest are false. - - TARGET_CPU_PPC - Compiler is generating PowerPC instructions for 32-bit mode - TARGET_CPU_PPC64 - Compiler is generating PowerPC instructions for 64-bit mode - TARGET_CPU_68K - Compiler is generating 680x0 instructions - TARGET_CPU_X86 - Compiler is generating x86 instructions - TARGET_CPU_ARM - Compiler is generating ARM instructions - TARGET_CPU_MIPS - Compiler is generating MIPS instructions - TARGET_CPU_SPARC - Compiler is generating Sparc instructions - TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions - TARGET_CPU_WASM32 - Compiler is generating WebAssembly instructions for 32-bit mode - - - TARGET_OS_* - These conditionals specify in which Operating System the generated code will - run. Indention is used to show which conditionals are evolutionary subclasses. - - The MAC/WIN32/UNIX conditionals are mutually exclusive. - The IOS/TV/WATCH conditionals are mutually exclusive. - - - TARGET_OS_WIN32 - Generated code will run under 32-bit Windows - TARGET_OS_UNIX - Generated code will run under some Unix (not OSX) - TARGET_OS_CYGWIN - Generated code will run under 64-bit Cygwin - TARGET_OS_WASI - Generated code will run under WebAssembly System Interface - TARGET_OS_MAC - Generated code will run under Mac OS X variant - TARGET_OS_IPHONE - Generated code for firmware, devices, or simulator - TARGET_OS_IOS - Generated code will run under iOS - TARGET_OS_TV - Generated code will run under Apple TV OS - TARGET_OS_WATCH - Generated code will run under Apple Watch OS - TARGET_OS_SIMULATOR - Generated code will run under a simulator - TARGET_OS_EMBEDDED - Generated code for firmware - - TARGET_IPHONE_SIMULATOR - DEPRECATED: Same as TARGET_OS_SIMULATOR - TARGET_OS_NANO - DEPRECATED: Same as TARGET_OS_WATCH - - TARGET_RT_* - These conditionals specify in which runtime the generated code will - run. This is needed when the OS and CPU support more than one runtime - (e.g. Mac OS X supports CFM and mach-o). - - TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers - TARGET_RT_BIG_ENDIAN - Generated code uses big endian format for integers - TARGET_RT_64_BIT - Generated code uses 64-bit pointers - TARGET_RT_MAC_CFM - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used - TARGET_RT_MAC_MACHO - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used - - -****************************************************************************************************/ - -#if __APPLE__ -#define OG_TARGET_OS_DARWIN 1 -#define OG_TARGET_OS_LINUX 0 -#define OG_TARGET_OS_WINDOWS 0 -#define OG_TARGET_OS_BSD 0 -#define OG_TARGET_OS_ANDROID 0 -#define OG_TARGET_OS_CYGWIN 0 -#define OG_TARGET_OS_WASI 0 -#elif __ANDROID__ -#define OG_TARGET_OS_DARWIN 0 -#define OG_TARGET_OS_LINUX 1 -#define OG_TARGET_OS_WINDOWS 0 -#define OG_TARGET_OS_BSD 0 -#define OG_TARGET_OS_ANDROID 1 -#define OG_TARGET_OS_CYGWIN 0 -#define OG_TARGET_OS_WASI 0 -#elif __linux__ -#define OG_TARGET_OS_DARWIN 0 -#define OG_TARGET_OS_LINUX 1 -#define OG_TARGET_OS_WINDOWS 0 -#define OG_TARGET_OS_BSD 0 -#define OG_TARGET_OS_ANDROID 0 -#define OG_TARGET_OS_CYGWIN 0 -#define OG_TARGET_OS_WASI 0 -#elif __CYGWIN__ -#define OG_TARGET_OS_DARWIN 0 -#define OG_TARGET_OS_LINUX 1 -#define OG_TARGET_OS_WINDOWS 0 -#define OG_TARGET_OS_BSD 0 -#define OG_TARGET_OS_ANDROID 0 -#define OG_TARGET_OS_CYGWIN 1 -#define OG_TARGET_OS_WASI 0 -#elif _WIN32 || _WIN64 -#define OG_TARGET_OS_DARWIN 0 -#define OG_TARGET_OS_LINUX 0 -#define OG_TARGET_OS_WINDOWS 1 -#define OG_TARGET_OS_BSD 0 -#define OG_TARGET_OS_ANDROID 0 -#define OG_TARGET_OS_CYGWIN 0 -#define OG_TARGET_OS_WASI 0 -#elif __unix__ -#define OG_TARGET_OS_DARWIN 0 -#define OG_TARGET_OS_LINUX 0 -#define OG_TARGET_OS_WINDOWS 0 -#define OG_TARGET_OS_BSD 1 -#define OG_TARGET_OS_ANDROID 0 -#define OG_TARGET_OS_CYGWIN 0 -#define OG_TARGET_OS_WASI 0 -#elif __wasi__ -#define OG_TARGET_OS_DARWIN 0 -#define OG_TARGET_OS_LINUX 0 -#define OG_TARGET_OS_WINDOWS 0 -#define OG_TARGET_OS_BSD 0 -#define OG_TARGET_OS_ANDROID 0 -#define OG_TARGET_OS_CYGWIN 0 -#define OG_TARGET_OS_WASI 1 -#else -#error unknown operating system -#endif - -#define OG_TARGET_OS_WIN32 OG_TARGET_OS_WINDOWS -#define OG_TARGET_OS_MAC OG_TARGET_OS_DARWIN -#define OG_TARGET_OS_OSX OG_TARGET_OS_DARWIN - -// iOS, watchOS, and tvOS are not supported -#define OG_TARGET_OS_IPHONE 0 -#define OG_TARGET_OS_IOS 0 -#define OG_TARGET_OS_WATCH 0 -#define OG_TARGET_OS_TV 0 - -#if __x86_64__ -#define OG_TARGET_CPU_PPC 0 -#define OG_TARGET_CPU_PPC64 0 -#define OG_TARGET_CPU_X86 0 -#define OG_TARGET_CPU_X86_64 1 -#define OG_TARGET_CPU_ARM 0 -#define OG_TARGET_CPU_ARM64 0 -#define OG_TARGET_CPU_MIPS 0 -#define OG_TARGET_CPU_MIPS64 0 -#define OG_TARGET_CPU_S390X 0 -#define OG_TARGET_CPU_WASM32 0 -#elif __arm64__ || __aarch64__ -#define OG_TARGET_CPU_PPC 0 -#define OG_TARGET_CPU_PPC64 0 -#define OG_TARGET_CPU_X86 0 -#define OG_TARGET_CPU_X86_64 0 -#define OG_TARGET_CPU_ARM 0 -#define OG_TARGET_CPU_ARM64 1 -#define OG_TARGET_CPU_MIPS 0 -#define OG_TARGET_CPU_MIPS64 0 -#define OG_TARGET_CPU_S390X 0 -#define OG_TARGET_CPU_WASM32 0 -#elif __mips64__ -#define OG_TARGET_CPU_PPC 0 -#define OG_TARGET_CPU_PPC64 0 -#define OG_TARGET_CPU_X86 0 -#define OG_TARGET_CPU_X86_64 0 -#define OG_TARGET_CPU_ARM 0 -#define OG_TARGET_CPU_ARM64 0 -#define OG_TARGET_CPU_MIPS 0 -#define OG_TARGET_CPU_MIPS64 1 -#define OG_TARGET_CPU_S390X 0 -#define OG_TARGET_CPU_WASM32 0 -#elif __powerpc64__ -#define OG_TARGET_CPU_PPC 0 -#define OG_TARGET_CPU_PPC64 1 -#define OG_TARGET_CPU_X86 0 -#define OG_TARGET_CPU_X86_64 0 -#define OG_TARGET_CPU_ARM 0 -#define OG_TARGET_CPU_ARM64 0 -#define OG_TARGET_CPU_MIPS 0 -#define OG_TARGET_CPU_MIPS64 0 -#define OG_TARGET_CPU_S390X 0 -#define OG_TARGET_CPU_WASM32 0 -#elif __i386__ -#define OG_TARGET_CPU_PPC 0 -#define OG_TARGET_CPU_PPC64 0 -#define OG_TARGET_CPU_X86 1 -#define OG_TARGET_CPU_X86_64 0 -#define OG_TARGET_CPU_ARM 0 -#define OG_TARGET_CPU_ARM64 0 -#define OG_TARGET_CPU_MIPS 0 -#define OG_TARGET_CPU_MIPS64 0 -#define OG_TARGET_CPU_S390X 0 -#define OG_TARGET_CPU_WASM32 0 -#elif __arm__ -#define OG_TARGET_CPU_PPC 0 -#define OG_TARGET_CPU_PPC64 0 -#define OG_TARGET_CPU_X86 0 -#define OG_TARGET_CPU_X86_64 0 -#define OG_TARGET_CPU_ARM 1 -#define OG_TARGET_CPU_ARM64 0 -#define OG_TARGET_CPU_MIPS 0 -#define OG_TARGET_CPU_MIPS64 0 -#define OG_TARGET_CPU_S390X 0 -#define OG_TARGET_CPU_WASM32 0 -#elif __mips__ -#define OG_TARGET_CPU_PPC 0 -#define OG_TARGET_CPU_PPC64 0 -#define OG_TARGET_CPU_X86 0 -#define OG_TARGET_CPU_X86_64 0 -#define OG_TARGET_CPU_ARM 0 -#define OG_TARGET_CPU_ARM64 0 -#define OG_TARGET_CPU_MIPS 1 -#define OG_TARGET_CPU_MIPS64 0 -#define OG_TARGET_CPU_S390X 0 -#define OG_TARGET_CPU_WASM32 0 -#elif __powerpc__ -#define OG_TARGET_CPU_PPC 1 -#define OG_TARGET_CPU_PPC64 0 -#define OG_TARGET_CPU_X86 0 -#define OG_TARGET_CPU_X86_64 0 -#define OG_TARGET_CPU_ARM 0 -#define OG_TARGET_CPU_ARM64 0 -#define OG_TARGET_CPU_MIPS 0 -#define OG_TARGET_CPU_MIPS64 0 -#define OG_TARGET_CPU_S390X 0 -#define OG_TARGET_CPU_WASM32 0 -#elif __s390x__ -#define OG_TARGET_CPU_PPC 0 -#define OG_TARGET_CPU_PPC64 0 -#define OG_TARGET_CPU_X86 0 -#define OG_TARGET_CPU_X86_64 0 -#define OG_TARGET_CPU_ARM 0 -#define OG_TARGET_CPU_ARM64 0 -#define OG_TARGET_CPU_MIPS 0 -#define OG_TARGET_CPU_MIPS64 0 -#define OG_TARGET_CPU_S390X 1 -#define OG_TARGET_CPU_WASM32 0 -#elif __wasm32__ -#define OG_TARGET_CPU_PPC 0 -#define OG_TARGET_CPU_PPC64 0 -#define OG_TARGET_CPU_X86 0 -#define OG_TARGET_CPU_X86_64 0 -#define OG_TARGET_CPU_ARM 0 -#define OG_TARGET_CPU_ARM64 0 -#define OG_TARGET_CPU_MIPS 0 -#define OG_TARGET_CPU_MIPS64 0 -#define OG_TARGET_CPU_S390X 0 -#define OG_TARGET_CPU_WASM32 1 -#else -#error unknown architecture -#endif - -#if __LITTLE_ENDIAN__ -#define OG_TARGET_RT_LITTLE_ENDIAN 1 -#define OG_TARGET_RT_BIG_ENDIAN 0 -#elif __BIG_ENDIAN__ -#define OG_TARGET_RT_LITTLE_ENDIAN 0 -#define OG_TARGET_RT_BIG_ENDIAN 1 -#else -#error unknown endian -#endif - -#if __LP64__ || __LLP64__ || __POINTER_WIDTH__-0 == 64 -#define OG_TARGET_RT_64_BIT 1 -#else -#define OG_TARGET_RT_64_BIT 0 -#endif - -#endif /* __OPENGRAPHTARGETCONDITIONALS__ */ diff --git a/Sources/OpenGraph_SPI/Runtime/OGCompareValues.h b/Sources/OpenGraph_SPI/Runtime/OGCompareValues.h deleted file mode 100644 index c09beffc..00000000 --- a/Sources/OpenGraph_SPI/Runtime/OGCompareValues.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// OGCompareValues.h -// -// -// Created by Kyle on 2023/10/9. -// - -#ifndef OGCompareValues_h -#define OGCompareValues_h - -#include "OGBase.h" -#include "OGComparisonMode.h" - -OG_EXTERN_C_BEGIN -OG_EXPORT -OG_REFINED_FOR_SWIFT -bool OGCompareValues(const void *lhs, const void *rhs, const void *type, const OGComparisonMode comparisonMode); -OG_EXTERN_C_END - -#endif /* OGCompareValues_h */ diff --git a/Sources/OpenGraph_SPI/Runtime/OGComparisonMode.h b/Sources/OpenGraph_SPI/Runtime/OGComparisonMode.h deleted file mode 100644 index 3d8e27dd..00000000 --- a/Sources/OpenGraph_SPI/Runtime/OGComparisonMode.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// OGComparisonMode.h -// -// -// Created by Kyle on 2023/12/20. -// - -#ifndef OGComparisonMode_h -#define OGComparisonMode_h - -#include "OGBase.h" - -typedef OG_OPTIONS(uint32_t, OGComparisonMode) { - OGComparisonMode_0 = 0, - OGComparisonMode_1 = 1 << 0, - OGComparisonMode_2 = 1 << 1, - OGComparisonMode_3 = OGComparisonMode_1 | OGComparisonMode_2, -}; - -typedef OG_OPTIONS(uint32_t, OGComparisonOptions) { - OGComparisonOptions_0 = 0, - OGComparisonOptions_1 = 1 << 0, - OGComparisonOptions_2 = 1 << 1, - OGComparisonOptions_3 = OGComparisonOptions_1 | OGComparisonOptions_2, -}; - -#endif /* OGComparisonMode_h */ - diff --git a/Sources/OpenGraph_SPI/Runtime/OGTupleType.h b/Sources/OpenGraph_SPI/Runtime/OGTupleType.h deleted file mode 100644 index 3b7016eb..00000000 --- a/Sources/OpenGraph_SPI/Runtime/OGTupleType.h +++ /dev/null @@ -1,89 +0,0 @@ -// -// OGTupleType.h -// OpenGraph_SPI -// -// Audited for iOS 18.0 -// Status: Complete - -#ifndef OGTupleType_h -#define OGTupleType_h - -#include "OGBase.h" -#include "OGTypeID.h" - -OG_ASSUME_NONNULL_BEGIN - -typedef const OGSwiftMetadata *OGTupleType OG_SWIFT_STRUCT OG_SWIFT_NAME(TupleType); - -typedef OG_CLOSED_ENUM(uint32_t, OGTupleCopyOptions) { - OGTupleCopyOptionsAssignCopy = 0, - OGTupleCopyOptionsInitCopy = 1, - OGTupleCopyOptionsAssignTake = 2, - OGTupleCopyOptionsInitTake = 3 -} OG_SWIFT_NAME(TupleType.CopyOptions); - -typedef struct OG_SWIFT_NAME(UnsafeTuple) OGUnsafeTuple { - OGTupleType type; - const void *value; -} OGUnsafeTuple; - -typedef struct OG_SWIFT_NAME(UnsafeMutableTuple) OGUnsafeMutableTuple { - OGTupleType type; - void *value; -} OGUnsafeMutableTuple; - -OG_EXTERN_C_BEGIN - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGTupleType OGNewTupleType(size_t count, const OGTypeID _Nonnull * _Nonnull elements) OG_SWIFT_NAME(TupleType.init(count:elements:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -size_t OGTupleCount(OGTupleType tuple_type) OG_SWIFT_NAME(getter:TupleType.count(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -size_t OGTupleSize(OGTupleType tuple_type) OG_SWIFT_NAME(getter:TupleType.size(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGTypeID OGTupleElementType(OGTupleType tuple_type, size_t index) OG_SWIFT_NAME(TupleType.elementType(self:at:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -size_t OGTupleElementSize(OGTupleType tuple_type, size_t index) OG_SWIFT_NAME(TupleType.elementSize(self:at:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -size_t OGTupleElementOffset(OGTupleType tuple_type, size_t index) OG_SWIFT_NAME(TupleType.elementOffset(self:at:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -size_t OGTupleElementOffsetChecked(OGTupleType tuple_type, size_t index, OGTypeID check_type) OG_SWIFT_NAME(TupleType.elementOffset(self:at:type:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void *OGTupleSetElement(OGTupleType tuple_type, void* tuple_value, size_t index, const void *element_value, OGTypeID check_type, OGTupleCopyOptions mode); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void *OGTupleGetElement(OGTupleType tuple_type, void* tuple_value, size_t index, void *element_value, OGTypeID check_type, OGTupleCopyOptions mode); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGTupleDestroy(OGTupleType tuple_type, void *buffer) OG_SWIFT_NAME(TupleType.destroy(self:_:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGTupleDestroyElement(OGTupleType tuple_type, void *buffer, size_t index) OG_SWIFT_NAME(TupleType.destroy(self:_:at:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGTupleWithBuffer(OGTupleType tuple_type, size_t count, const void (* function)(const OGUnsafeMutableTuple mutableTuple, const void * context OG_SWIFT_CONTEXT) OG_SWIFT_CC(swift), const void *context); - -OG_EXTERN_C_END - -OG_ASSUME_NONNULL_END - -#endif /* OGTupleType_h */ diff --git a/Sources/OpenGraph_SPI/Runtime/OGTypeID.h b/Sources/OpenGraph_SPI/Runtime/OGTypeID.h deleted file mode 100644 index a411c0d6..00000000 --- a/Sources/OpenGraph_SPI/Runtime/OGTypeID.h +++ /dev/null @@ -1,119 +0,0 @@ -// -// OGTypeID.h -// OpenGraph_SPI -// -// Audited for iOS 18.0 -// Status: Complete - -#ifndef OGTypeID_h -#define OGTypeID_h - -#include "OGBase.h" -#include "OGVersion.h" - -OG_ASSUME_NONNULL_BEGIN - -typedef struct OG_SWIFT_NAME(_Metadata) OGSwiftMetadata { -} OGSwiftMetadata; - -typedef const OGSwiftMetadata *OGTypeID OG_SWIFT_STRUCT OG_SWIFT_NAME(Metadata); - -typedef OG_CLOSED_ENUM(uint32_t, OGTypeKind) { - OGTypeKindNone, - OGTypeKindClass, - OGTypeKindStruct, - OGTypeKindEnum, - OGTypeKindOptional, - OGTypeKindTuple, - OGTypeKindFunction, - OGTypeKindExistential, - OGTypeKindMetatype, -} 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, -}; - -#if OPENGRAPH_RELEASE >= OPENGRAPH_RELEASE_2024 - -typedef struct OG_SWIFT_NAME(Signature) OGTypeSignature { - uint32_t bytes[5]; -} OGTypeSignature; - -#endif - -OG_EXTERN_C_BEGIN - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGTypeKind OGTypeGetKind(OGTypeID typeID) OG_SWIFT_NAME(getter:Metadata.kind(self:)); - -// TODO -// OGOverrideComparisonForTypeDescriptor(); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGTypeApplyFields(const void *type, const void *block, void *context); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -bool OGTypeApplyFields2(const void *type, OGTypeApplyOptions options, const void *block, void *context); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -uint32_t OGTypeGetEnumTag(OGTypeID typeID, const void *value) OG_SWIFT_NAME(Metadata.enumTag(self:_:)); - -#if OPENGRAPH_RELEASE >= OPENGRAPH_RELEASE_2024 - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGTypeProjectEnumData(OGTypeID typeID, void *value) OG_SWIFT_NAME(Metadata.projectEnumData(self:_:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void OGTypeInjectEnumTag(OGTypeID typeID, uint32_t tag, void *value) OG_SWIFT_NAME(Metadata.injectEnumTag(self:tag:_:)); - -#endif /* OPENGRAPH_RELEASE */ - -// TODO -OG_EXPORT -OG_REFINED_FOR_SWIFT -bool OGTypeApplyEnumData(); - -// TODO -OG_EXPORT -OG_REFINED_FOR_SWIFT -bool OGTypeApplyMutableEnumData(); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -CFStringRef OGTypeDescription(OGTypeID typeID); - -#if OPENGRAPH_RELEASE >= OPENGRAPH_RELEASE_2024 - -OG_EXPORT -OG_REFINED_FOR_SWIFT -OGTypeSignature const OGTypeGetSignature(OGTypeID typeID) OG_SWIFT_NAME(getter:Metadata.signature(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void const* _Nullable OGTypeGetDescriptor(OGTypeID typeID) OG_SWIFT_NAME(getter:Metadata.descriptor(self:)); - -#endif /* OPENGRAPH_RELEASE */ - -OG_EXPORT -OG_REFINED_FOR_SWIFT -void const* _Nullable OGTypeNominalDescriptor(OGTypeID typeID) OG_SWIFT_NAME(getter:Metadata.nominalDescriptor(self:)); - -OG_EXPORT -OG_REFINED_FOR_SWIFT -char const* _Nullable OGTypeNominalDescriptorName(OGTypeID typeID) OG_SWIFT_NAME(getter:Metadata.nominalDescriptorName(self:)); - -OG_EXTERN_C_END - -OG_ASSUME_NONNULL_END - -#endif /* OGTypeID_h */ diff --git a/Sources/OpenGraph_SPI/Version/OGVersion.h b/Sources/OpenGraph_SPI/Version/OGVersion.h deleted file mode 100644 index 76745007..00000000 --- a/Sources/OpenGraph_SPI/Version/OGVersion.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// OGVersion.h -// OpenGraph - -#ifndef OGVersion_h -#define OGVersion_h - -#include "OGBase.h" - -#define OPENGRAPH_RELEASE_2021 2021 -#define OPENGRAPH_RELEASE_2024 2024 - -#ifndef OPENGRAPH_RELEASE -#define OPENGRAPH_RELEASE OPENGRAPH_RELEASE_2024 -#endif - -OG_EXTERN_C_BEGIN - -OG_EXPORT const uint64_t OGVersion; - -OG_EXTERN_C_END - -#endif /* OGVersion_h */ diff --git a/Sources/OpenGraph_SPI/include/CFRuntime.h b/Sources/OpenGraph_SPI/include/CFRuntime.h deleted file mode 120000 index 6c4b716a..00000000 --- a/Sources/OpenGraph_SPI/include/CFRuntime.h +++ /dev/null @@ -1 +0,0 @@ -../Private/CFRuntime.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGAttribute.h b/Sources/OpenGraph_SPI/include/OGAttribute.h deleted file mode 120000 index 62291267..00000000 --- a/Sources/OpenGraph_SPI/include/OGAttribute.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGAttribute.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGAttribute.h b/Sources/OpenGraph_SPI/include/OGAttribute.h new file mode 100644 index 00000000..628ac6dd --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGAttribute.h @@ -0,0 +1,163 @@ +// +// OGAttribute.h +// OpenGraph_SPI + +#ifndef OGAttribute_h +#define OGAttribute_h + +#include "OGBase.h" +#include "OGAttributeInfo.h" +#include "OGAttributeFlags.h" +#include "OGCachedValueOptions.h" +#include "OGGraph.h" +#include "OGInputOptions.h" +#include "OGTypeID.h" +#include "OGValue.h" +#include "OGValueOptions.h" +#include "OGValueState.h" + +OG_ASSUME_NONNULL_BEGIN + +OG_EXTERN_C_BEGIN + +OG_EXPORT +const OGAttribute OGAttributeNil; + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGAttribute OGGraphGetCurrentAttribute(void); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGAttribute OGGraphCreateOffsetAttribute(OGAttribute attribute, long offset) OG_SWIFT_NAME(OGAttribute.create(self:offset:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGAttribute OGGraphCreateOffsetAttribute2(OGAttribute attribute, long offset, uint64_t size) OG_SWIFT_NAME(OGAttribute.create(self:offset:size:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGAttribute OGGraphCreateIndirectAttribute(OGAttribute attribute) OG_SWIFT_NAME(OGAttribute.createIndirect(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGAttribute OGGraphCreateIndirectAttribute2(OGAttribute attribute, uint64_t size) OG_SWIFT_NAME(OGAttribute.createIndirect(self:size:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGAttributeFlags OGGraphGetFlags(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute.flags(self:)); + +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_SWIFT_NAME(getter:OGAttribute.info(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphMutateAttribute(OGAttribute attribute, + const OGTypeID type, + bool invalidating, + const void (*function)(const void * _Nullable context OG_SWIFT_CONTEXT, void *body) OG_SWIFT_CC(swift), + const void * _Nullable context); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGAttribute OGGraphGetIndirectDependency(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute._indirectDependency(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphSetIndirectDependency(OGAttribute attribute1, OGAttribute attribute2) OG_SWIFT_NAME(setter:OGAttribute._indirectDependency(self:_:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGAttribute OGGraphGetIndirectAttribute(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute.source(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphSetIndirectAttribute(OGAttribute attribute1, OGAttribute attribute2) OG_SWIFT_NAME(setter:OGAttribute.source(self:_:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGAttribute OGGraphCreateAttribute(long index, const void *body, const void * _Nullable value); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +const OGValue OGGraphGetValue(OGAttribute attribute, OGValueOptions options, const OGTypeID type); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +bool OGGraphSetValue(OGAttribute attribute, const void *value, const OGTypeID type); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +const OGValue OGGraphGetInputValue(OGAttribute attribute, OGAttribute inputAttribute, OGValueOptions options, const OGTypeID type); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +const void * _Nullable OGGraphGetOutputValue(OGTypeID type); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphSetOutputValue(const void *value, const OGTypeID type); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGValueState OGGraphGetValueState(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute.valueState(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +bool OGGraphHasValue(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute.hasValue(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphUpdateValue(OGAttribute attribute) OG_SWIFT_NAME(OGAttribute.updateValue(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphPrefetchValue(OGAttribute attribute) OG_SWIFT_NAME(OGAttribute.prefetchValue(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphInvalidateValue(OGAttribute attribute) OG_SWIFT_NAME(OGAttribute.invalidateValue(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphVerifyType(OGAttribute attribute, OGTypeID type) OG_SWIFT_NAME(OGAttribute.verify(self:type:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGGraphRef OGGraphGetAttributeGraph(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute.graph(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGSubgraphRef OGGraphGetAttributeSubgraph(OGAttribute attribute) OG_SWIFT_NAME(getter:OGAttribute.subgraph(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +const void * OGGraphReadCachedAttribute(long hashValue, OGTypeID bodyType, const void *bodyPointer, OGTypeID valueType, OGCachedValueOptions options, OGAttribute attribute, bool unknown/*, ...*/); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +const void * _Nullable OGGraphReadCachedAttributeIfExists(long hashValue, OGTypeID bodyType, const void *bodyPointer, OGTypeID valueType, OGCachedValueOptions options, OGAttribute attribute, bool unknown); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphWithUpdate( + OGAttribute attribute, + void (* callback)(const void *context OG_SWIFT_CONTEXT) OG_SWIFT_CC(swift), + const void *context +); + +OG_EXTERN_C_END + +OG_ASSUME_NONNULL_END + +#endif /* OGAttribute_h */ + diff --git a/Sources/OpenGraph_SPI/include/OGAttributeFlags.h b/Sources/OpenGraph_SPI/include/OGAttributeFlags.h deleted file mode 120000 index 42df2390..00000000 --- a/Sources/OpenGraph_SPI/include/OGAttributeFlags.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGAttributeFlags.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGAttributeFlags.h b/Sources/OpenGraph_SPI/include/OGAttributeFlags.h new file mode 100644 index 00000000..03c89dd6 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGAttributeFlags.h @@ -0,0 +1,22 @@ +// +// OGAttributeFlags.h +// OpenGraph_SPI +// +// Audited for RELEASE_2021 +// Status: Complete + +#ifndef OGAttributeFlags_h +#define OGAttributeFlags_h + +#include "OGBase.h" + +typedef OG_OPTIONS(uint32_t, OGAttributeFlags) { + OGAttributeFlagsDefault = 0, + OGAttributeFlagsActive = 1 << 0, + OGAttributeFlagsRemovable = 1 << 1, + OGAttributeFlagsInvalidatable = 1 << 2, + + OGAttributeFlagsMask = 0xFF, +}; + +#endif /* OGAttributeFlags_h */ diff --git a/Sources/OpenGraph_SPI/include/OGAttributeInfo.h b/Sources/OpenGraph_SPI/include/OGAttributeInfo.h deleted file mode 120000 index e141ee8a..00000000 --- a/Sources/OpenGraph_SPI/include/OGAttributeInfo.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGAttributeInfo.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGAttributeInfo.h b/Sources/OpenGraph_SPI/include/OGAttributeInfo.h new file mode 100644 index 00000000..a9994df5 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/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_SPI/include/OGAttributeType.h b/Sources/OpenGraph_SPI/include/OGAttributeType.h deleted file mode 120000 index a6a7b2e0..00000000 --- a/Sources/OpenGraph_SPI/include/OGAttributeType.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGAttributeType.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGAttributeType.h b/Sources/OpenGraph_SPI/include/OGAttributeType.h new file mode 100644 index 00000000..b2c03ab3 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGAttributeType.h @@ -0,0 +1,21 @@ +// +// OGAttributeType.h +// OpenGraph_SPI + +#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_SPI/include/OGAttributeTypeFlags.h b/Sources/OpenGraph_SPI/include/OGAttributeTypeFlags.h deleted file mode 120000 index 41a1bd2d..00000000 --- a/Sources/OpenGraph_SPI/include/OGAttributeTypeFlags.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGAttributeTypeFlags.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGAttributeTypeFlags.h b/Sources/OpenGraph_SPI/include/OGAttributeTypeFlags.h new file mode 100644 index 00000000..61c09a4f --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGAttributeTypeFlags.h @@ -0,0 +1,21 @@ +// +// OGAttributeTypeFlags.h +// OpenGraph_SPI + +#ifndef OGAttributeTypeFlags_h +#define OGAttributeTypeFlags_h + +#include "OGBase.h" + +typedef OG_OPTIONS(uint32_t, OGAttributeTypeFlags) { + OGAttributeTypeFlagsDefault = 0, + OGAttributeTypeFlags_1 = 1 << 0, + OGAttributeTypeFlags_2 = 1 << 1, + OGAttributeTypeFlags_4 = 1 << 2, + OGAttributeTypeFlagsMainThread = 1 << 3, + OGAttributeTypeFlags_16 = 1 << 4, + OGAttributeTypeFlagsAsyncThread = 1 << 5, +}; + +#endif /* OGAttributeTypeFlags_h */ + diff --git a/Sources/OpenGraph_SPI/include/OGBase.h b/Sources/OpenGraph_SPI/include/OGBase.h deleted file mode 120000 index 87502168..00000000 --- a/Sources/OpenGraph_SPI/include/OGBase.h +++ /dev/null @@ -1 +0,0 @@ -../OGBase.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGBase.h b/Sources/OpenGraph_SPI/include/OGBase.h new file mode 100644 index 00000000..b44fe9a5 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGBase.h @@ -0,0 +1,70 @@ +// +// OGBase.h +// OpenGraph_SPI + +#ifndef OGBase_h +#define OGBase_h + +#if DEBUG +#define OG_ASSERTION +#else +#undef OG_ASSERTION +#endif + +#if __has_attribute(cold) +#define __cold __attribute__((__cold__)) +#else +#define __cold +#endif + +#if __has_attribute(noreturn) +#define __dead2 __attribute__((__noreturn__)) +#else +#define __dead2 +#endif + +#if defined(__cplusplus) +#define OG_NOEXCEPT noexcept +#else +#define OG_NOEXCEPT +#endif + +#if defined(__GNUC__) +#define OG_INLINE __inline__ __attribute__((always_inline)) +#elif defined(__cplusplus) +#define OG_INLINE inline +#else +#define OG_INLINE +#endif + +#if defined(__cplusplus) +#define OG_CONSTEXPR constexpr +#else +#define OG_CONSTEXPR +#endif + +#include "OGSwiftSupport.h" +#include "OGTargetConditionals.h" +#include +#include +#include + +#define OG_ENUM CF_ENUM +#define OG_CLOSED_ENUM CF_CLOSED_ENUM +#define OG_OPTIONS CF_OPTIONS +#define OG_EXTERN_C_BEGIN CF_EXTERN_C_BEGIN +#define OG_EXTERN_C_END CF_EXTERN_C_END +#define OG_ASSUME_NONNULL_BEGIN CF_ASSUME_NONNULL_BEGIN +#define OG_ASSUME_NONNULL_END CF_ASSUME_NONNULL_END +#define OG_IMPLICIT_BRIDGING_ENABLED CF_IMPLICIT_BRIDGING_ENABLED +#define OG_IMPLICIT_BRIDGING_DISABLED CF_IMPLICIT_BRIDGING_DISABLED +#define OG_EXPORT CF_EXPORT +#define OG_BRIDGED_TYPE CF_BRIDGED_TYPE + +#if OG_TARGET_OS_DARWIN && __OBJC__ +#define OG_OBJC_FOUNDATION 1 +#else +#define OG_OBJC_FOUNDATION 0 +#endif /* OG_TARGET_OS_DARWIN && __OBJC__ */ + +#endif /* OGBase_h */ diff --git a/Sources/OpenGraph_SPI/include/OGCachedValueOptions.h b/Sources/OpenGraph_SPI/include/OGCachedValueOptions.h deleted file mode 120000 index 1050999c..00000000 --- a/Sources/OpenGraph_SPI/include/OGCachedValueOptions.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGCachedValueOptions.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGCachedValueOptions.h b/Sources/OpenGraph_SPI/include/OGCachedValueOptions.h new file mode 100644 index 00000000..b53de723 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGCachedValueOptions.h @@ -0,0 +1,20 @@ +// +// OGCachedValueOptions.h +// OpenGraph_SPI + +#ifndef OGCachedValueOptions_h +#define OGCachedValueOptions_h + +#include "OGBase.h" + +typedef OG_OPTIONS(uint32_t, OGCachedValueOptions) { + OGCachedValueOptions_0 = 0, + OGCachedValueOptions_1 = 1 << 0, + OGCachedValueOptions_2 = 1 << 1, + OGCachedValueOptions_4 = 1 << 2, + OGCachedValueOptions_8 = 1 << 3, + OGCachedValueOptions_16 = 1 << 4, +}; + +#endif /* OGCachedValueOptions_h */ + diff --git a/Sources/OpenGraph_SPI/include/OGChangedValueFlags.h b/Sources/OpenGraph_SPI/include/OGChangedValueFlags.h deleted file mode 120000 index 22da32f7..00000000 --- a/Sources/OpenGraph_SPI/include/OGChangedValueFlags.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGChangedValueFlags.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGChangedValueFlags.h b/Sources/OpenGraph_SPI/include/OGChangedValueFlags.h new file mode 100644 index 00000000..cd7af2a4 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGChangedValueFlags.h @@ -0,0 +1,15 @@ +// +// OGChangedValueFlags.h +// OpenGraph_SPI + +#ifndef OGChangedValueFlags_h +#define OGChangedValueFlags_h + +#include "OGBase.h" + +typedef OG_OPTIONS(uint32_t, OGChangedValueFlags) { + OGChangedValueFlags_1 = 1 << 0, + OGChangedValueFlagsRequiresMainThread = 1 << 1, +}; + +#endif /* OGChangedValueFlags_h */ diff --git a/Sources/OpenGraph_SPI/include/OGCompareValues.h b/Sources/OpenGraph_SPI/include/OGCompareValues.h deleted file mode 120000 index 028e4743..00000000 --- a/Sources/OpenGraph_SPI/include/OGCompareValues.h +++ /dev/null @@ -1 +0,0 @@ -../Runtime/OGCompareValues.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGCompareValues.h b/Sources/OpenGraph_SPI/include/OGCompareValues.h new file mode 100644 index 00000000..16fa55e7 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGCompareValues.h @@ -0,0 +1,17 @@ +// +// OGCompareValues.h +// OpenGraph_SPI + +#ifndef OGCompareValues_h +#define OGCompareValues_h + +#include "OGBase.h" +#include "OGComparisonMode.h" + +OG_EXTERN_C_BEGIN +OG_EXPORT +OG_REFINED_FOR_SWIFT +bool OGCompareValues(const void *lhs, const void *rhs, const void *type, const OGComparisonMode comparisonMode); +OG_EXTERN_C_END + +#endif /* OGCompareValues_h */ diff --git a/Sources/OpenGraph_SPI/include/OGComparisonMode.h b/Sources/OpenGraph_SPI/include/OGComparisonMode.h deleted file mode 120000 index 8f1efac1..00000000 --- a/Sources/OpenGraph_SPI/include/OGComparisonMode.h +++ /dev/null @@ -1 +0,0 @@ -../Runtime/OGComparisonMode.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGComparisonMode.h b/Sources/OpenGraph_SPI/include/OGComparisonMode.h new file mode 100644 index 00000000..333a8700 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGComparisonMode.h @@ -0,0 +1,25 @@ +// +// OGComparisonMode.h +// OpenGraph_SPI + +#ifndef OGComparisonMode_h +#define OGComparisonMode_h + +#include "OGBase.h" + +typedef OG_OPTIONS(uint32_t, OGComparisonMode) { + OGComparisonMode_0 = 0, + OGComparisonMode_1 = 1 << 0, + OGComparisonMode_2 = 1 << 1, + OGComparisonMode_3 = OGComparisonMode_1 | OGComparisonMode_2, +}; + +typedef OG_OPTIONS(uint32_t, OGComparisonOptions) { + OGComparisonOptions_0 = 0, + OGComparisonOptions_1 = 1 << 0, + OGComparisonOptions_2 = 1 << 1, + OGComparisonOptions_3 = OGComparisonOptions_1 | OGComparisonOptions_2, +}; + +#endif /* OGComparisonMode_h */ + diff --git a/Sources/OpenGraph_SPI/include/OGCounterQueryType.h b/Sources/OpenGraph_SPI/include/OGCounterQueryType.h deleted file mode 120000 index b0d3e377..00000000 --- a/Sources/OpenGraph_SPI/include/OGCounterQueryType.h +++ /dev/null @@ -1 +0,0 @@ -../Graph/OGCounterQueryType.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGCounterQueryType.h b/Sources/OpenGraph_SPI/include/OGCounterQueryType.h new file mode 100644 index 00000000..ad87b096 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGCounterQueryType.h @@ -0,0 +1,24 @@ +// +// OGCounterQueryType.h +// OpenGraph_SPI + +#ifndef OGCounterQueryType_h +#define OGCounterQueryType_h + +#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, +}; + +#endif /* OGCounterQueryType_h */ diff --git a/Sources/OpenGraph_SPI/include/OGDebugServer.h b/Sources/OpenGraph_SPI/include/OGDebugServer.h deleted file mode 120000 index 681bce16..00000000 --- a/Sources/OpenGraph_SPI/include/OGDebugServer.h +++ /dev/null @@ -1 +0,0 @@ -../Debug/OGDebugServer.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGDebugServer.h b/Sources/OpenGraph_SPI/include/OGDebugServer.h new file mode 100644 index 00000000..7317b0e6 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGDebugServer.h @@ -0,0 +1,35 @@ +// +// OGDebugServer.h +// OpenGraph_SPI + +#ifndef OGDebugServer_h +#define OGDebugServer_h + +#include "OGBase.h" + +#if OG_TARGET_OS_DARWIN + +OG_ASSUME_NONNULL_BEGIN + +typedef struct OGDebugServerStorage OGDebugServerStorage; + +typedef const OGDebugServerStorage *OGDebugServer OG_SWIFT_STRUCT; + +// MARK: - Exported C functions + +OG_EXTERN_C_BEGIN +OG_EXPORT +OGDebugServer _Nullable OGDebugServerStart(unsigned int mode) OG_SWIFT_NAME(OGDebugServer.start(mode:)); +OG_EXPORT +void OGDebugServerStop(void) OG_SWIFT_NAME(OGDebugServer.stop()); +OG_EXPORT +CFURLRef _Nullable OGDebugServerCopyURL(void) OG_SWIFT_NAME(OGDebugServer.copyURL()); +OG_EXPORT +void OGDebugServerRun(int timeout) OG_SWIFT_NAME(OGDebugServer.run(timeout:)); +OG_EXTERN_C_END + +OG_ASSUME_NONNULL_END + +#endif + +#endif /* OGDebugServer_h */ diff --git a/Sources/OpenGraph_SPI/include/OGGraph.h b/Sources/OpenGraph_SPI/include/OGGraph.h deleted file mode 120000 index 0bbb9da4..00000000 --- a/Sources/OpenGraph_SPI/include/OGGraph.h +++ /dev/null @@ -1 +0,0 @@ -../Graph/OGGraph.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGGraph.h b/Sources/OpenGraph_SPI/include/OGGraph.h new file mode 100644 index 00000000..37154bfa --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGGraph.h @@ -0,0 +1,110 @@ +// +// OGGraph.h +// OpenGraph_SPI + +#ifndef OGGraph_h +#define OGGraph_h + +#include "OGBase.h" +#include "../Private/CFRuntime.h" +#include "OGCounterQueryType.h" + +// Note: Place all structure declaration in a single place to avoid header cycle dependency + +typedef struct OG_BRIDGED_TYPE(id) OGGraphStorage * OGGraphRef OG_SWIFT_NAME(Graph); +typedef struct OG_BRIDGED_TYPE(id) OGSubgraphStorage * OGSubgraphRef OG_SWIFT_NAME(Subgraph); +typedef struct OG_BRIDGED_TYPE(id) OGGraphContextStorage * OGGraphContextRef OG_SWIFT_NAME(GraphContext); + +struct OGGraphStorage; +struct OGGraphContextStorage; +struct OGSubgraphStorage; + +typedef uint32_t OGAttribute OG_SWIFT_STRUCT OG_SWIFT_NAME(AnyAttribute); + +OG_ASSUME_NONNULL_BEGIN + +// MARK: - Exported C functions + +OG_EXTERN_C_BEGIN + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGGraphRef OGGraphCreate(void) OG_SWIFT_NAME(OGGraphRef.init()); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGGraphRef OGGraphCreateShared(_Nullable OGGraphRef graph) OG_SWIFT_NAME(OGGraphRef.init(shared:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphArchiveJSON(char const * _Nullable name) OG_SWIFT_NAME(OGGraphRef.archiveJSON(name:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +_Nullable CFTypeRef OGGraphDescription(_Nullable OGGraphRef graph, CFDictionaryRef options) OG_SWIFT_NAME(OGGraphRef.description(_:options:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +CFTypeID OGGraphGetTypeID(void) OG_SWIFT_NAME(getter:OGGraphRef.typeID()); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphStartProfiling(_Nullable OGGraphRef graph); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphStopProfiling(_Nullable OGGraphRef graph); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +const void * _Nullable OGGraphGetContext(OGGraphRef graph) OG_SWIFT_NAME(getter:OGGraphRef.context(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphSetContext(OGGraphRef graph, const void * _Nullable context) OG_SWIFT_NAME(setter:OGGraphRef.context(self:_:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGGraphContextRef OGGraphGetGraphContext(OGGraphRef graph) OG_SWIFT_NAME(getter:OGGraphRef.graphContext(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphInvalidate(OGGraphRef graph) OG_SWIFT_NAME(OGGraphRef.invalidate(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphInvalidateAllValues(OGGraphRef graph) OG_SWIFT_NAME(OGGraphRef.invalidateAllValues(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphSetInvalidationCallback(OGGraphRef graph, + const void (*_Nullable function)(const void * _Nullable context OG_SWIFT_CONTEXT, OGAttribute) OG_SWIFT_CC(swift), + const void * _Nullable context); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphSetUpdateCallback(OGGraphRef graph, + const void (*_Nullable function)(const void * _Nullable context OG_SWIFT_CONTEXT) OG_SWIFT_CC(swift), + const void * _Nullable context); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +uint64_t OGGraphGetCounter(OGGraphRef graph, OGCounterQueryType query) OG_SWIFT_NAME(OGGraphRef.counter(self:for:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphSetUpdate(const void * _Nullable value) OG_SWIFT_NAME(OGGraphRef.setUpdate(_:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +const void * _Nullable OGGraphClearUpdate(void) OG_SWIFT_NAME(OGGraphRef.clearUpdate()); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGGraphSetNeedsUpdate(OGGraphRef graph) OG_SWIFT_NAME(OGGraphRef.setNeedsUpdate(self:)); + +OG_EXTERN_C_END + +OG_ASSUME_NONNULL_END + +#endif /* OGGraph_h */ diff --git a/Sources/OpenGraph_SPI/include/OGGraphContext.h b/Sources/OpenGraph_SPI/include/OGGraphContext.h deleted file mode 120000 index 80b5e685..00000000 --- a/Sources/OpenGraph_SPI/include/OGGraphContext.h +++ /dev/null @@ -1 +0,0 @@ -../Graph/OGGraphContext.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGGraphContext.h b/Sources/OpenGraph_SPI/include/OGGraphContext.h new file mode 100644 index 00000000..942c4308 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGGraphContext.h @@ -0,0 +1,25 @@ +// +// OGGraphContext.h +// OpenGraph_SPI + +#ifndef OGGraphContext_h +#define OGGraphContext_h + +#include "OGBase.h" +#include "OGGraph.h" + +// MARK: - Exported C functions + +OG_ASSUME_NONNULL_BEGIN + +OG_EXTERN_C_BEGIN + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGGraphRef OGGraphContextGetGraph(OGGraphContextRef context) OG_SWIFT_NAME(getter:OGGraphContextRef.graph(self:)); + +OG_EXTERN_C_END + +OG_ASSUME_NONNULL_END + +#endif /* OGGraphContext_h */ diff --git a/Sources/OpenGraph_SPI/include/OGGraphDescription.h b/Sources/OpenGraph_SPI/include/OGGraphDescription.h deleted file mode 120000 index 3f8b9a3a..00000000 --- a/Sources/OpenGraph_SPI/include/OGGraphDescription.h +++ /dev/null @@ -1 +0,0 @@ -../Graph/OGGraphDescription.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGGraphDescription.h b/Sources/OpenGraph_SPI/include/OGGraphDescription.h new file mode 100644 index 00000000..0c7f7096 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGGraphDescription.h @@ -0,0 +1,21 @@ +// +// OGGraphDescription.h +// OpenGraph_SPI + +#ifndef OGGraphDescription_h +#define OGGraphDescription_h + +#include "OGBase.h" + +OG_ASSUME_NONNULL_BEGIN + +#if OG_OBJC_FOUNDATION +OG_EXTERN_C_BEGIN +OG_EXPORT +CFStringRef OGDescriptionFormat OG_SWIFT_NAME(OGGraphRef.descriptionFormat); +OG_EXTERN_C_END +#endif + +OG_ASSUME_NONNULL_END + +#endif /* OGGraphDescription_h */ diff --git a/Sources/OpenGraph_SPI/include/OGInputOptions.h b/Sources/OpenGraph_SPI/include/OGInputOptions.h deleted file mode 120000 index 6c0f1710..00000000 --- a/Sources/OpenGraph_SPI/include/OGInputOptions.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGInputOptions.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGInputOptions.h b/Sources/OpenGraph_SPI/include/OGInputOptions.h new file mode 100644 index 00000000..d71741fc --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGInputOptions.h @@ -0,0 +1,15 @@ +// +// OGInputOptions.h +// OpenGraph_SPI + +#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_SPI/include/OGSearchOptions.h b/Sources/OpenGraph_SPI/include/OGSearchOptions.h deleted file mode 120000 index 010d47b4..00000000 --- a/Sources/OpenGraph_SPI/include/OGSearchOptions.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGSearchOptions.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGSearchOptions.h b/Sources/OpenGraph_SPI/include/OGSearchOptions.h new file mode 100644 index 00000000..4e9c2f03 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGSearchOptions.h @@ -0,0 +1,15 @@ +// +// OGSearchOptions.h +// OpenGraph_SPI + +#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_SPI/include/OGSubgraph.h b/Sources/OpenGraph_SPI/include/OGSubgraph.h deleted file mode 120000 index daf86e35..00000000 --- a/Sources/OpenGraph_SPI/include/OGSubgraph.h +++ /dev/null @@ -1 +0,0 @@ -../Graph/OGSubgraph.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGSubgraph.h b/Sources/OpenGraph_SPI/include/OGSubgraph.h new file mode 100644 index 00000000..95862141 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGSubgraph.h @@ -0,0 +1,110 @@ +// +// OGSubgraph.h +// OpenGraph_SPI + +#ifndef OGSubgraph_h +#define OGSubgraph_h + +#include "OGAttribute.h" +#include "OGAttributeFlags.h" +#include "OGBase.h" +#include "OGGraph.h" +#include "OGUniqueID.h" +#include "../Private/CFRuntime.h" + +OG_ASSUME_NONNULL_BEGIN + +// MARK: - Exported C functions + +OG_EXTERN_C_BEGIN + +OG_EXPORT +OG_REFINED_FOR_SWIFT +CFTypeID OGSubgraphGetTypeID(); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGSubgraphRef OGSubgraphCreate(OGGraphRef cf_graph) OG_SWIFT_NAME(OGSubgraphRef.init(graph:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGSubgraphRef OGSubgraphCreate2(OGGraphRef cf_graph, OGAttribute attribute) OG_SWIFT_NAME(OGSubgraphRef.init(graph:attribute:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +_Nullable OGSubgraphRef OGSubgraphGetCurrent(void) OG_SWIFT_NAME(getter:OGSubgraphRef.current()); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGSubgraphSetCurrent(_Nullable OGSubgraphRef cf_subgraph) OG_SWIFT_NAME(setter:OGSubgraphRef.current(_:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +_Nullable OGGraphContextRef OGSubgraphGetCurrentGraphContext(void) OG_SWIFT_NAME(getter:OGSubgraphRef.currentGraphContext()); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGSubgraphInvalidate(OGSubgraphRef cf_subgraph) OG_SWIFT_NAME(OGSubgraphRef.invalidate(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +bool OGSubgraphIsValid(OGSubgraphRef cf_subgraph) OG_SWIFT_NAME(getter:OGSubgraphRef.isValid(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGGraphRef OGSubgraphGetGraph(OGSubgraphRef cf_subgraph) OG_SWIFT_NAME(getter:OGSubgraphRef.graph(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGSubgraphAddChild(OGSubgraphRef parent, OGSubgraphRef child) OG_SWIFT_NAME(OGSubgraphRef.addChild(self:_:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGSubgraphRemoveChild(OGSubgraphRef parent, OGSubgraphRef child) OG_SWIFT_NAME(OGSubgraphRef.removeChild(self:_:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGSubgraphApply(OGSubgraphRef cf_subgraph, + OGAttributeFlags flags, + const void (*function)(const void * _Nullable context OG_SWIFT_CONTEXT, OGAttribute attribute) OG_SWIFT_CC(swift), + const void * _Nullable context); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGSubgraphUpdate(OGSubgraphRef cf_subgraph, OGAttributeFlags flags) OG_SWIFT_NAME(OGSubgraphRef.update(self:flags:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +bool OGSubgraphIsDirty(OGSubgraphRef cf_subgraph, uint32_t unknown) OG_SWIFT_NAME(OGSubgraphRef.isDirty(self:_:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGUniqueID OGSubgraphAddObserver(OGSubgraphRef cf_subgraph, + const void (*function)(const void * _Nullable context OG_SWIFT_CONTEXT) OG_SWIFT_CC(swift), + const void * _Nullable context); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +bool OGSubgraphShouldRecordTree(void) OG_SWIFT_NAME(getter:OGSubgraphRef.shouldRecordTree()); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGSubgraphSetShouldRecordTree(void) OG_SWIFT_NAME(OGSubgraphRef.setShouldRecordTree()); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGSubgraphBeginTreeElement(OGAttribute attribute, OGTypeID type, uint32_t flags); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGSubgraphAddTreeValue(OGAttribute attribute, OGTypeID type, const char * key, uint32_t flags); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGSubgraphEndTreeElement(OGAttribute attribute); + +OG_EXTERN_C_END + +OG_ASSUME_NONNULL_END + +#endif /* OGSubgraph_h */ diff --git a/Sources/OpenGraph_SPI/include/OGSwiftSupport.h b/Sources/OpenGraph_SPI/include/OGSwiftSupport.h deleted file mode 120000 index 5ab9751a..00000000 --- a/Sources/OpenGraph_SPI/include/OGSwiftSupport.h +++ /dev/null @@ -1 +0,0 @@ -../OGSwiftSupport.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGSwiftSupport.h b/Sources/OpenGraph_SPI/include/OGSwiftSupport.h new file mode 100644 index 00000000..46efbb26 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGSwiftSupport.h @@ -0,0 +1,45 @@ +// +// OGSwiftSupport.h +// OpenGraph_SPI + +#ifndef OGSwiftSupport_h +#define OGSwiftSupport_h + +#if __has_attribute(swift_name) +#define OG_SWIFT_NAME(_name) __attribute__((swift_name(#_name))) +#else +#define OG_SWIFT_NAME +#endif + +#if __has_attribute(swift_wrapper) +#define OG_SWIFT_STRUCT __attribute__((swift_wrapper(struct))) +#else +#define OG_SWIFT_STRUCT +#endif + +#if __has_attribute(swift_private) +#define OG_REFINED_FOR_SWIFT __attribute__((swift_private)) +#else +#define OG_REFINED_FOR_SWIFT +#endif + +// MARK: - Call Convension + +#define OG_SWIFT_CC(CC) OG_SWIFT_CC_##CC +// OG_SWIFT_CC(c) is the C calling convention. +#define OG_SWIFT_CC_c + +// OG_SWIFT_CC(swift) is the Swift calling convention. +#if __has_attribute(swiftcall) +#define OG_SWIFT_CC_swift __attribute__((swiftcall)) +#define OG_SWIFT_CONTEXT __attribute__((swift_context)) +#define OG_SWIFT_ERROR_RESULT __attribute__((swift_error_result)) +#define OG_SWIFT_INDIRECT_RESULT __attribute__((swift_indirect_result)) +#else +#define OG_SWIFT_CC_swift +#define OG_SWIFT_CONTEXT +#define OG_SWIFT_ERROR_RESULT +#define OG_SWIFT_INDIRECT_RESULT +#endif + +#endif /* OGSwiftSupport_h */ diff --git a/Sources/OpenGraph_SPI/include/OGTargetConditionals.h b/Sources/OpenGraph_SPI/include/OGTargetConditionals.h deleted file mode 120000 index b9f963bc..00000000 --- a/Sources/OpenGraph_SPI/include/OGTargetConditionals.h +++ /dev/null @@ -1 +0,0 @@ -../OGTargetConditionals.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGTargetConditionals.h b/Sources/OpenGraph_SPI/include/OGTargetConditionals.h new file mode 100644 index 00000000..d9691620 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGTargetConditionals.h @@ -0,0 +1,277 @@ +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See http://swift.org/LICENSE.txt for license information +// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// + +/* + File: OGTargetConditionals.h + + Contains: Autoconfiguration of TARGET_ conditionals for Mac OS X and iPhone + + Note: OpenSwiftUITargetConditionals.h in 3.4 Universal Interfaces works + with all compilers. This header only recognizes compilers + known to run on Mac OS X. + +*/ + +#ifndef __OPENGRAPHTARGETCONDITIONALS__ +#define __OPENGRAPHTARGETCONDITIONALS__ +/**************************************************************************************************** + + TARGET_CPU_* + These conditionals specify which microprocessor instruction set is being + generated. At most one of these is true, the rest are false. + + TARGET_CPU_PPC - Compiler is generating PowerPC instructions for 32-bit mode + TARGET_CPU_PPC64 - Compiler is generating PowerPC instructions for 64-bit mode + TARGET_CPU_68K - Compiler is generating 680x0 instructions + TARGET_CPU_X86 - Compiler is generating x86 instructions + TARGET_CPU_ARM - Compiler is generating ARM instructions + TARGET_CPU_MIPS - Compiler is generating MIPS instructions + TARGET_CPU_SPARC - Compiler is generating Sparc instructions + TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions + TARGET_CPU_WASM32 - Compiler is generating WebAssembly instructions for 32-bit mode + + + TARGET_OS_* + These conditionals specify in which Operating System the generated code will + run. Indention is used to show which conditionals are evolutionary subclasses. + + The MAC/WIN32/UNIX conditionals are mutually exclusive. + The IOS/TV/WATCH conditionals are mutually exclusive. + + + TARGET_OS_WIN32 - Generated code will run under 32-bit Windows + TARGET_OS_UNIX - Generated code will run under some Unix (not OSX) + TARGET_OS_CYGWIN - Generated code will run under 64-bit Cygwin + TARGET_OS_WASI - Generated code will run under WebAssembly System Interface + TARGET_OS_MAC - Generated code will run under Mac OS X variant + TARGET_OS_IPHONE - Generated code for firmware, devices, or simulator + TARGET_OS_IOS - Generated code will run under iOS + TARGET_OS_TV - Generated code will run under Apple TV OS + TARGET_OS_WATCH - Generated code will run under Apple Watch OS + TARGET_OS_SIMULATOR - Generated code will run under a simulator + TARGET_OS_EMBEDDED - Generated code for firmware + + TARGET_IPHONE_SIMULATOR - DEPRECATED: Same as TARGET_OS_SIMULATOR + TARGET_OS_NANO - DEPRECATED: Same as TARGET_OS_WATCH + + TARGET_RT_* + These conditionals specify in which runtime the generated code will + run. This is needed when the OS and CPU support more than one runtime + (e.g. Mac OS X supports CFM and mach-o). + + TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers + TARGET_RT_BIG_ENDIAN - Generated code uses big endian format for integers + TARGET_RT_64_BIT - Generated code uses 64-bit pointers + TARGET_RT_MAC_CFM - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used + TARGET_RT_MAC_MACHO - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used + + +****************************************************************************************************/ + +#if __APPLE__ +#define OG_TARGET_OS_DARWIN 1 +#define OG_TARGET_OS_LINUX 0 +#define OG_TARGET_OS_WINDOWS 0 +#define OG_TARGET_OS_BSD 0 +#define OG_TARGET_OS_ANDROID 0 +#define OG_TARGET_OS_CYGWIN 0 +#define OG_TARGET_OS_WASI 0 +#elif __ANDROID__ +#define OG_TARGET_OS_DARWIN 0 +#define OG_TARGET_OS_LINUX 1 +#define OG_TARGET_OS_WINDOWS 0 +#define OG_TARGET_OS_BSD 0 +#define OG_TARGET_OS_ANDROID 1 +#define OG_TARGET_OS_CYGWIN 0 +#define OG_TARGET_OS_WASI 0 +#elif __linux__ +#define OG_TARGET_OS_DARWIN 0 +#define OG_TARGET_OS_LINUX 1 +#define OG_TARGET_OS_WINDOWS 0 +#define OG_TARGET_OS_BSD 0 +#define OG_TARGET_OS_ANDROID 0 +#define OG_TARGET_OS_CYGWIN 0 +#define OG_TARGET_OS_WASI 0 +#elif __CYGWIN__ +#define OG_TARGET_OS_DARWIN 0 +#define OG_TARGET_OS_LINUX 1 +#define OG_TARGET_OS_WINDOWS 0 +#define OG_TARGET_OS_BSD 0 +#define OG_TARGET_OS_ANDROID 0 +#define OG_TARGET_OS_CYGWIN 1 +#define OG_TARGET_OS_WASI 0 +#elif _WIN32 || _WIN64 +#define OG_TARGET_OS_DARWIN 0 +#define OG_TARGET_OS_LINUX 0 +#define OG_TARGET_OS_WINDOWS 1 +#define OG_TARGET_OS_BSD 0 +#define OG_TARGET_OS_ANDROID 0 +#define OG_TARGET_OS_CYGWIN 0 +#define OG_TARGET_OS_WASI 0 +#elif __unix__ +#define OG_TARGET_OS_DARWIN 0 +#define OG_TARGET_OS_LINUX 0 +#define OG_TARGET_OS_WINDOWS 0 +#define OG_TARGET_OS_BSD 1 +#define OG_TARGET_OS_ANDROID 0 +#define OG_TARGET_OS_CYGWIN 0 +#define OG_TARGET_OS_WASI 0 +#elif __wasi__ +#define OG_TARGET_OS_DARWIN 0 +#define OG_TARGET_OS_LINUX 0 +#define OG_TARGET_OS_WINDOWS 0 +#define OG_TARGET_OS_BSD 0 +#define OG_TARGET_OS_ANDROID 0 +#define OG_TARGET_OS_CYGWIN 0 +#define OG_TARGET_OS_WASI 1 +#else +#error unknown operating system +#endif + +#define OG_TARGET_OS_WIN32 OG_TARGET_OS_WINDOWS +#define OG_TARGET_OS_MAC OG_TARGET_OS_DARWIN +#define OG_TARGET_OS_OSX OG_TARGET_OS_DARWIN + +// iOS, watchOS, and tvOS are not supported +#define OG_TARGET_OS_IPHONE 0 +#define OG_TARGET_OS_IOS 0 +#define OG_TARGET_OS_WATCH 0 +#define OG_TARGET_OS_TV 0 + +#if __x86_64__ +#define OG_TARGET_CPU_PPC 0 +#define OG_TARGET_CPU_PPC64 0 +#define OG_TARGET_CPU_X86 0 +#define OG_TARGET_CPU_X86_64 1 +#define OG_TARGET_CPU_ARM 0 +#define OG_TARGET_CPU_ARM64 0 +#define OG_TARGET_CPU_MIPS 0 +#define OG_TARGET_CPU_MIPS64 0 +#define OG_TARGET_CPU_S390X 0 +#define OG_TARGET_CPU_WASM32 0 +#elif __arm64__ || __aarch64__ +#define OG_TARGET_CPU_PPC 0 +#define OG_TARGET_CPU_PPC64 0 +#define OG_TARGET_CPU_X86 0 +#define OG_TARGET_CPU_X86_64 0 +#define OG_TARGET_CPU_ARM 0 +#define OG_TARGET_CPU_ARM64 1 +#define OG_TARGET_CPU_MIPS 0 +#define OG_TARGET_CPU_MIPS64 0 +#define OG_TARGET_CPU_S390X 0 +#define OG_TARGET_CPU_WASM32 0 +#elif __mips64__ +#define OG_TARGET_CPU_PPC 0 +#define OG_TARGET_CPU_PPC64 0 +#define OG_TARGET_CPU_X86 0 +#define OG_TARGET_CPU_X86_64 0 +#define OG_TARGET_CPU_ARM 0 +#define OG_TARGET_CPU_ARM64 0 +#define OG_TARGET_CPU_MIPS 0 +#define OG_TARGET_CPU_MIPS64 1 +#define OG_TARGET_CPU_S390X 0 +#define OG_TARGET_CPU_WASM32 0 +#elif __powerpc64__ +#define OG_TARGET_CPU_PPC 0 +#define OG_TARGET_CPU_PPC64 1 +#define OG_TARGET_CPU_X86 0 +#define OG_TARGET_CPU_X86_64 0 +#define OG_TARGET_CPU_ARM 0 +#define OG_TARGET_CPU_ARM64 0 +#define OG_TARGET_CPU_MIPS 0 +#define OG_TARGET_CPU_MIPS64 0 +#define OG_TARGET_CPU_S390X 0 +#define OG_TARGET_CPU_WASM32 0 +#elif __i386__ +#define OG_TARGET_CPU_PPC 0 +#define OG_TARGET_CPU_PPC64 0 +#define OG_TARGET_CPU_X86 1 +#define OG_TARGET_CPU_X86_64 0 +#define OG_TARGET_CPU_ARM 0 +#define OG_TARGET_CPU_ARM64 0 +#define OG_TARGET_CPU_MIPS 0 +#define OG_TARGET_CPU_MIPS64 0 +#define OG_TARGET_CPU_S390X 0 +#define OG_TARGET_CPU_WASM32 0 +#elif __arm__ +#define OG_TARGET_CPU_PPC 0 +#define OG_TARGET_CPU_PPC64 0 +#define OG_TARGET_CPU_X86 0 +#define OG_TARGET_CPU_X86_64 0 +#define OG_TARGET_CPU_ARM 1 +#define OG_TARGET_CPU_ARM64 0 +#define OG_TARGET_CPU_MIPS 0 +#define OG_TARGET_CPU_MIPS64 0 +#define OG_TARGET_CPU_S390X 0 +#define OG_TARGET_CPU_WASM32 0 +#elif __mips__ +#define OG_TARGET_CPU_PPC 0 +#define OG_TARGET_CPU_PPC64 0 +#define OG_TARGET_CPU_X86 0 +#define OG_TARGET_CPU_X86_64 0 +#define OG_TARGET_CPU_ARM 0 +#define OG_TARGET_CPU_ARM64 0 +#define OG_TARGET_CPU_MIPS 1 +#define OG_TARGET_CPU_MIPS64 0 +#define OG_TARGET_CPU_S390X 0 +#define OG_TARGET_CPU_WASM32 0 +#elif __powerpc__ +#define OG_TARGET_CPU_PPC 1 +#define OG_TARGET_CPU_PPC64 0 +#define OG_TARGET_CPU_X86 0 +#define OG_TARGET_CPU_X86_64 0 +#define OG_TARGET_CPU_ARM 0 +#define OG_TARGET_CPU_ARM64 0 +#define OG_TARGET_CPU_MIPS 0 +#define OG_TARGET_CPU_MIPS64 0 +#define OG_TARGET_CPU_S390X 0 +#define OG_TARGET_CPU_WASM32 0 +#elif __s390x__ +#define OG_TARGET_CPU_PPC 0 +#define OG_TARGET_CPU_PPC64 0 +#define OG_TARGET_CPU_X86 0 +#define OG_TARGET_CPU_X86_64 0 +#define OG_TARGET_CPU_ARM 0 +#define OG_TARGET_CPU_ARM64 0 +#define OG_TARGET_CPU_MIPS 0 +#define OG_TARGET_CPU_MIPS64 0 +#define OG_TARGET_CPU_S390X 1 +#define OG_TARGET_CPU_WASM32 0 +#elif __wasm32__ +#define OG_TARGET_CPU_PPC 0 +#define OG_TARGET_CPU_PPC64 0 +#define OG_TARGET_CPU_X86 0 +#define OG_TARGET_CPU_X86_64 0 +#define OG_TARGET_CPU_ARM 0 +#define OG_TARGET_CPU_ARM64 0 +#define OG_TARGET_CPU_MIPS 0 +#define OG_TARGET_CPU_MIPS64 0 +#define OG_TARGET_CPU_S390X 0 +#define OG_TARGET_CPU_WASM32 1 +#else +#error unknown architecture +#endif + +#if __LITTLE_ENDIAN__ +#define OG_TARGET_RT_LITTLE_ENDIAN 1 +#define OG_TARGET_RT_BIG_ENDIAN 0 +#elif __BIG_ENDIAN__ +#define OG_TARGET_RT_LITTLE_ENDIAN 0 +#define OG_TARGET_RT_BIG_ENDIAN 1 +#else +#error unknown endian +#endif + +#if __LP64__ || __LLP64__ || __POINTER_WIDTH__-0 == 64 +#define OG_TARGET_RT_64_BIT 1 +#else +#define OG_TARGET_RT_64_BIT 0 +#endif + +#endif /* __OPENGRAPHTARGETCONDITIONALS__ */ diff --git a/Sources/OpenGraph_SPI/include/OGTupleType.h b/Sources/OpenGraph_SPI/include/OGTupleType.h deleted file mode 120000 index 3ec6b669..00000000 --- a/Sources/OpenGraph_SPI/include/OGTupleType.h +++ /dev/null @@ -1 +0,0 @@ -../Runtime/OGTupleType.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGTupleType.h b/Sources/OpenGraph_SPI/include/OGTupleType.h new file mode 100644 index 00000000..3b7016eb --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGTupleType.h @@ -0,0 +1,89 @@ +// +// OGTupleType.h +// OpenGraph_SPI +// +// Audited for iOS 18.0 +// Status: Complete + +#ifndef OGTupleType_h +#define OGTupleType_h + +#include "OGBase.h" +#include "OGTypeID.h" + +OG_ASSUME_NONNULL_BEGIN + +typedef const OGSwiftMetadata *OGTupleType OG_SWIFT_STRUCT OG_SWIFT_NAME(TupleType); + +typedef OG_CLOSED_ENUM(uint32_t, OGTupleCopyOptions) { + OGTupleCopyOptionsAssignCopy = 0, + OGTupleCopyOptionsInitCopy = 1, + OGTupleCopyOptionsAssignTake = 2, + OGTupleCopyOptionsInitTake = 3 +} OG_SWIFT_NAME(TupleType.CopyOptions); + +typedef struct OG_SWIFT_NAME(UnsafeTuple) OGUnsafeTuple { + OGTupleType type; + const void *value; +} OGUnsafeTuple; + +typedef struct OG_SWIFT_NAME(UnsafeMutableTuple) OGUnsafeMutableTuple { + OGTupleType type; + void *value; +} OGUnsafeMutableTuple; + +OG_EXTERN_C_BEGIN + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGTupleType OGNewTupleType(size_t count, const OGTypeID _Nonnull * _Nonnull elements) OG_SWIFT_NAME(TupleType.init(count:elements:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +size_t OGTupleCount(OGTupleType tuple_type) OG_SWIFT_NAME(getter:TupleType.count(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +size_t OGTupleSize(OGTupleType tuple_type) OG_SWIFT_NAME(getter:TupleType.size(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGTypeID OGTupleElementType(OGTupleType tuple_type, size_t index) OG_SWIFT_NAME(TupleType.elementType(self:at:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +size_t OGTupleElementSize(OGTupleType tuple_type, size_t index) OG_SWIFT_NAME(TupleType.elementSize(self:at:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +size_t OGTupleElementOffset(OGTupleType tuple_type, size_t index) OG_SWIFT_NAME(TupleType.elementOffset(self:at:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +size_t OGTupleElementOffsetChecked(OGTupleType tuple_type, size_t index, OGTypeID check_type) OG_SWIFT_NAME(TupleType.elementOffset(self:at:type:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void *OGTupleSetElement(OGTupleType tuple_type, void* tuple_value, size_t index, const void *element_value, OGTypeID check_type, OGTupleCopyOptions mode); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void *OGTupleGetElement(OGTupleType tuple_type, void* tuple_value, size_t index, void *element_value, OGTypeID check_type, OGTupleCopyOptions mode); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGTupleDestroy(OGTupleType tuple_type, void *buffer) OG_SWIFT_NAME(TupleType.destroy(self:_:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGTupleDestroyElement(OGTupleType tuple_type, void *buffer, size_t index) OG_SWIFT_NAME(TupleType.destroy(self:_:at:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGTupleWithBuffer(OGTupleType tuple_type, size_t count, const void (* function)(const OGUnsafeMutableTuple mutableTuple, const void * context OG_SWIFT_CONTEXT) OG_SWIFT_CC(swift), const void *context); + +OG_EXTERN_C_END + +OG_ASSUME_NONNULL_END + +#endif /* OGTupleType_h */ diff --git a/Sources/OpenGraph_SPI/include/OGTypeID.h b/Sources/OpenGraph_SPI/include/OGTypeID.h deleted file mode 120000 index a5f9a637..00000000 --- a/Sources/OpenGraph_SPI/include/OGTypeID.h +++ /dev/null @@ -1 +0,0 @@ -../Runtime/OGTypeID.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGTypeID.h b/Sources/OpenGraph_SPI/include/OGTypeID.h new file mode 100644 index 00000000..a411c0d6 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGTypeID.h @@ -0,0 +1,119 @@ +// +// OGTypeID.h +// OpenGraph_SPI +// +// Audited for iOS 18.0 +// Status: Complete + +#ifndef OGTypeID_h +#define OGTypeID_h + +#include "OGBase.h" +#include "OGVersion.h" + +OG_ASSUME_NONNULL_BEGIN + +typedef struct OG_SWIFT_NAME(_Metadata) OGSwiftMetadata { +} OGSwiftMetadata; + +typedef const OGSwiftMetadata *OGTypeID OG_SWIFT_STRUCT OG_SWIFT_NAME(Metadata); + +typedef OG_CLOSED_ENUM(uint32_t, OGTypeKind) { + OGTypeKindNone, + OGTypeKindClass, + OGTypeKindStruct, + OGTypeKindEnum, + OGTypeKindOptional, + OGTypeKindTuple, + OGTypeKindFunction, + OGTypeKindExistential, + OGTypeKindMetatype, +} 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, +}; + +#if OPENGRAPH_RELEASE >= OPENGRAPH_RELEASE_2024 + +typedef struct OG_SWIFT_NAME(Signature) OGTypeSignature { + uint32_t bytes[5]; +} OGTypeSignature; + +#endif + +OG_EXTERN_C_BEGIN + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGTypeKind OGTypeGetKind(OGTypeID typeID) OG_SWIFT_NAME(getter:Metadata.kind(self:)); + +// TODO +// OGOverrideComparisonForTypeDescriptor(); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGTypeApplyFields(const void *type, const void *block, void *context); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +bool OGTypeApplyFields2(const void *type, OGTypeApplyOptions options, const void *block, void *context); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +uint32_t OGTypeGetEnumTag(OGTypeID typeID, const void *value) OG_SWIFT_NAME(Metadata.enumTag(self:_:)); + +#if OPENGRAPH_RELEASE >= OPENGRAPH_RELEASE_2024 + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGTypeProjectEnumData(OGTypeID typeID, void *value) OG_SWIFT_NAME(Metadata.projectEnumData(self:_:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void OGTypeInjectEnumTag(OGTypeID typeID, uint32_t tag, void *value) OG_SWIFT_NAME(Metadata.injectEnumTag(self:tag:_:)); + +#endif /* OPENGRAPH_RELEASE */ + +// TODO +OG_EXPORT +OG_REFINED_FOR_SWIFT +bool OGTypeApplyEnumData(); + +// TODO +OG_EXPORT +OG_REFINED_FOR_SWIFT +bool OGTypeApplyMutableEnumData(); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +CFStringRef OGTypeDescription(OGTypeID typeID); + +#if OPENGRAPH_RELEASE >= OPENGRAPH_RELEASE_2024 + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGTypeSignature const OGTypeGetSignature(OGTypeID typeID) OG_SWIFT_NAME(getter:Metadata.signature(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void const* _Nullable OGTypeGetDescriptor(OGTypeID typeID) OG_SWIFT_NAME(getter:Metadata.descriptor(self:)); + +#endif /* OPENGRAPH_RELEASE */ + +OG_EXPORT +OG_REFINED_FOR_SWIFT +void const* _Nullable OGTypeNominalDescriptor(OGTypeID typeID) OG_SWIFT_NAME(getter:Metadata.nominalDescriptor(self:)); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +char const* _Nullable OGTypeNominalDescriptorName(OGTypeID typeID) OG_SWIFT_NAME(getter:Metadata.nominalDescriptorName(self:)); + +OG_EXTERN_C_END + +OG_ASSUME_NONNULL_END + +#endif /* OGTypeID_h */ diff --git a/Sources/OpenGraph_SPI/include/OGUniqueID.h b/Sources/OpenGraph_SPI/include/OGUniqueID.h deleted file mode 120000 index d4ec43e4..00000000 --- a/Sources/OpenGraph_SPI/include/OGUniqueID.h +++ /dev/null @@ -1 +0,0 @@ -../Data/OGUniqueID.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGUniqueID.h b/Sources/OpenGraph_SPI/include/OGUniqueID.h new file mode 100644 index 00000000..f0348c92 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGUniqueID.h @@ -0,0 +1,20 @@ +// +// OGMakeUniqueID.h +// OpenGraph_SPI +// +// Audited for iOS 18.0 +// Status: Complete + +#ifndef OGMakeUniqueID_h +#define OGMakeUniqueID_h + +#include "OGBase.h" +typedef long OGUniqueID; + +OG_EXTERN_C_BEGIN +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGUniqueID OGMakeUniqueID(void) OG_SWIFT_NAME(makeUniqueID()); +OG_EXTERN_C_END + +#endif /* OGMakeUniqueID_h */ diff --git a/Sources/OpenGraph_SPI/include/OGValue.h b/Sources/OpenGraph_SPI/include/OGValue.h deleted file mode 120000 index 658e1ecb..00000000 --- a/Sources/OpenGraph_SPI/include/OGValue.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGValue.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGValue.h b/Sources/OpenGraph_SPI/include/OGValue.h new file mode 100644 index 00000000..cea55304 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGValue.h @@ -0,0 +1,19 @@ +// +// OGValue.h +// OpenGraph_SPI + +#ifndef OGValue_h +#define OGValue_h + +#include "OGBase.h" + +OG_ASSUME_NONNULL_BEGIN + +typedef struct OGValue { + const void* value; + const bool changed; +} OGValue; + +OG_ASSUME_NONNULL_END + +#endif /* OGValue_h */ diff --git a/Sources/OpenGraph_SPI/include/OGValueOptions.h b/Sources/OpenGraph_SPI/include/OGValueOptions.h deleted file mode 120000 index afb1a6c7..00000000 --- a/Sources/OpenGraph_SPI/include/OGValueOptions.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGValueOptions.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGValueOptions.h b/Sources/OpenGraph_SPI/include/OGValueOptions.h new file mode 100644 index 00000000..652dd407 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGValueOptions.h @@ -0,0 +1,16 @@ +// +// OGValueOptions.h +// OpenGraph_SPI + +#ifndef OGValueOptions_h +#define OGValueOptions_h + +#include "OGBase.h" + +typedef OG_OPTIONS(uint32_t, OGValueOptions) { + OGValueOptions_0 = 0, + OGValueOptions_1 = 1, + OGValueOptions_2 = 2, +}; + +#endif /* OGValueOptions_h */ diff --git a/Sources/OpenGraph_SPI/include/OGValueState.h b/Sources/OpenGraph_SPI/include/OGValueState.h deleted file mode 120000 index 34ddddcc..00000000 --- a/Sources/OpenGraph_SPI/include/OGValueState.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGValueState.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGValueState.h b/Sources/OpenGraph_SPI/include/OGValueState.h new file mode 100644 index 00000000..aa4b81ad --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGValueState.h @@ -0,0 +1,18 @@ +// +// OGValueState.h +// OpenGraph_SPI + +#ifndef OGValueState_h +#define OGValueState_h + +#include "OGBase.h" + +OG_ASSUME_NONNULL_BEGIN + +typedef struct OGValueState { + // TODO +} OGValueState; + +OG_ASSUME_NONNULL_END + +#endif /* OGValueState_h */ diff --git a/Sources/OpenGraph_SPI/include/OGVersion.h b/Sources/OpenGraph_SPI/include/OGVersion.h deleted file mode 120000 index 94624a22..00000000 --- a/Sources/OpenGraph_SPI/include/OGVersion.h +++ /dev/null @@ -1 +0,0 @@ -../Version/OGVersion.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGVersion.h b/Sources/OpenGraph_SPI/include/OGVersion.h new file mode 100644 index 00000000..13f094db --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGVersion.h @@ -0,0 +1,23 @@ +// +// OGVersion.h +// OpenGraph_SPI + +#ifndef OGVersion_h +#define OGVersion_h + +#include "OGBase.h" + +#define OPENGRAPH_RELEASE_2021 2021 +#define OPENGRAPH_RELEASE_2024 2024 + +#ifndef OPENGRAPH_RELEASE +#define OPENGRAPH_RELEASE OPENGRAPH_RELEASE_2024 +#endif + +OG_EXTERN_C_BEGIN + +OG_EXPORT const uint64_t OGVersion; + +OG_EXTERN_C_END + +#endif /* OGVersion_h */ diff --git a/Sources/OpenGraph_SPI/include/OGWeakAttribute.h b/Sources/OpenGraph_SPI/include/OGWeakAttribute.h deleted file mode 120000 index b1667f57..00000000 --- a/Sources/OpenGraph_SPI/include/OGWeakAttribute.h +++ /dev/null @@ -1 +0,0 @@ -../Attribute/OGWeakAttribute.h \ No newline at end of file diff --git a/Sources/OpenGraph_SPI/include/OGWeakAttribute.h b/Sources/OpenGraph_SPI/include/OGWeakAttribute.h new file mode 100644 index 00000000..7b2472e6 --- /dev/null +++ b/Sources/OpenGraph_SPI/include/OGWeakAttribute.h @@ -0,0 +1,36 @@ +// +// OGWeakAttribute.h +// OpenGraph_SPI + +#ifndef OGWeakAttribute_hpp +#define OGWeakAttribute_hpp + +#include "OGBase.h" +#include "OGAttribute.h" + +OG_ASSUME_NONNULL_BEGIN + +typedef struct OGWeakAttribute { + const OGAttribute raw_attribute; + const uint32_t subgraph_id; +} OGWeakAttribute; + +OG_EXTERN_C_BEGIN + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGWeakAttribute OGCreateWeakAttribute(OGAttribute attribute); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGAttribute OGWeakAttributeGetAttribute(OGWeakAttribute weakAttribute); + +OG_EXPORT +OG_REFINED_FOR_SWIFT +OGValue OGGraphGetWeakValue(OGWeakAttribute weakAttribute, OGValueOptions options, OGTypeID type); + +OG_EXTERN_C_END + +OG_ASSUME_NONNULL_END + +#endif /* OGWeakAttribute_h */