Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "AGBase.h"
#include "AGAttributeFlags.h"
#include "AGInputOptions.h"
#include "AGAttributeInfo.h"
#include "AGTypeID.h"

typedef uint32_t AGAttribute __attribute((swift_newtype(struct)));

Expand All @@ -19,22 +22,17 @@ AG_EXTERN_C_BEGIN
AG_EXPORT
const AGAttribute AGAttributeNil;

AG_EXTERN_C_BEGIN
AG_EXPORT
const AGAttribute AGAttributeNil;
AG_EXTERN_C_END

AG_EXPORT
AG_REFINED_FOR_SWIFT
AGAttribute AGGraphGetCurrentAttribute(void);

AG_EXPORT
AG_REFINED_FOR_SWIFT
AGAttribute AGGraphCreateOffsetAttribute(AGAttribute attribute, uint64_t offset) AG_SWIFT_NAME(AGAttribute.create(self:offset:));
AGAttribute AGGraphCreateOffsetAttribute(AGAttribute attribute, long offset) AG_SWIFT_NAME(AGAttribute.create(self:offset:));

AG_EXPORT
AG_REFINED_FOR_SWIFT
AGAttribute AGGraphCreateOffsetAttribute2(AGAttribute attribute, uint64_t offset, uint64_t size) AG_SWIFT_NAME(AGAttribute.create(self:offset:size:));
AGAttribute AGGraphCreateOffsetAttribute2(AGAttribute attribute, long offset, uint64_t size) AG_SWIFT_NAME(AGAttribute.create(self:offset:size:));

AG_EXPORT
AG_REFINED_FOR_SWIFT
Expand All @@ -44,6 +42,26 @@ AG_EXPORT
AG_REFINED_FOR_SWIFT
void AGGraphSetFlags(AGAttribute attribute, AGAttributeFlags flags) AG_SWIFT_NAME(setter:AGAttribute.flags(self:_:));

AG_EXPORT
AG_REFINED_FOR_SWIFT
void AGGraphAddInput(AGAttribute attribute1, AGAttribute attribute2, AGInputOptions options, long token);

AG_EXPORT
AG_REFINED_FOR_SWIFT
const AGAttributeInfo AGGraphGetAttributeInfo(AGAttribute attribute);

AG_EXPORT
AG_REFINED_FOR_SWIFT
void AGGraphMutateAttribute(AGAttribute attribute, const AGTypeID type, bool invalidating/*, closure*/);

AG_EXPORT
AG_REFINED_FOR_SWIFT
AGAttribute AGGraphGetIndirectDependency(AGAttribute attribute);

AG_EXPORT
AG_REFINED_FOR_SWIFT
void AGGraphSetIndirectDependency(AGAttribute attribute1, AGAttribute attribute2);

AG_EXTERN_C_END

#endif /* AGAttribute_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// AGAttributeInfo.h
//
//
// Created by Kyle on 2024/2/17.
//

#ifndef AGAttributeInfo_h
#define AGAttributeInfo_h

#include "AGBase.h"
#include "AGAttributeType.h"

AG_ASSUME_NONNULL_BEGIN

typedef struct AGAttributeInfo {
const AGAttributeType* type;
const void *body;
} AGAttributeInfo;

AG_ASSUME_NONNULL_END

#endif /* AGAttributeInfo_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// AGAttributeType.h
//
//
// Created by Kyle on 2024/2/17.
//

#ifndef AGAttributeType_h
#define AGAttributeType_h

#include "AGBase.h"
#include "AGTypeID.h"

AG_ASSUME_NONNULL_BEGIN

typedef struct AGAttributeType {
AGTypeID typeID;
AGTypeID valueTypeID;
// TODO
} AGAttributeType;

AG_ASSUME_NONNULL_END

#endif /* AGAttributeType_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// AGInputOptions.h
//
//
// Created by Kyle on 2024/2/17.
//

#ifndef AGInputOptions_h
#define AGInputOptions_h

#include "AGBase.h"

typedef AG_OPTIONS(uint32_t, AGInputOptions) {
AGInputOptions_0 = 0,
AGInputOptions_1 = 1,
};

#endif /* AGInputOptions_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// AGSearchOptions.h
//
//
// Created by Kyle on 2024/2/17.
//

#ifndef AGSearchOptions_h
#define AGSearchOptions_h

#include "AGBase.h"

typedef AG_OPTIONS(uint32_t, AGSearchOptions) {
AGSearchOptions_0 = 0,
AGSearchOptions_1 = 1,
};

#endif /* Header_h */
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@

#include "AGAttribute.h"
#include "AGAttributeFlags.h"
#include "AGAttributeInfo.h"
#include "AGAttributeType.h"
#include "AGAttributeTypeFlags.h"
#include "AGBase.h"
#include "AGCompareValues.h"
#include "AGComparisonMode.h"
#include "AGDebugServer.h"
#include "AGGraph.h"
#include "AGInputOptions.h"
#include "AGSearchOptions.h"
#include "AGSubgraph.h"
#include "AGSwiftMetadata.h"
#include "AGTupleType.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ import _StringProcessing
// MARK: - AGAttribute

extension AGAttribute {
@inlinable
public init<Value>(_ attribute: AttributeGraph.Attribute<Value>)
public func unsafeCast<Value>(to type: Value.Type) -> AttributeGraph.Attribute<Value>
@inlinable
public static var current: AGAttribute? { get }
@inlinable
public func unsafeOffset(at offset: Int) -> AGAttribute
@inlinable
public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags)
public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int)
public func addInput<Value>(_ attribute: AttributeGraph.Attribute<Value>, options: AGInputOptions, token: Int)
public func visitBody<Visitor: AttributeGraph.AttributeBodyVisitor>(_ visitor: inout Visitor);
public func mutateBody<Value>(as: Value.Type, invalidating: Swift.Bool, _ body: (inout Value) -> ())
public func breadthFirstSearch(options: AGSearchOptions, _: (AGAttribute) -> Swift.Bool) -> Swift.Bool
public var _bodyType: Any.Type { get }
public var _bodyPointer: UnsafeRawPointer { get }
public var valueType: Any.Type { get }
public var indirectDependency: AGAttribute? { get set }
}

extension AGAttribute: Swift.CustomStringConvertible {
Expand Down Expand Up @@ -60,6 +66,11 @@ extension AGAttribute: Swift.CustomStringConvertible {
public func hash(into hasher: inout Swift.Hasher)
public var hashValue: Swift.Int { get }
public var value: Value { get set }

@inlinable
public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int)
@inlinable
public func addInput<V>(_ attribute: AttributeGraph.Attribute<V>, options: AGInputOptions, token: Int)
}

// MARK: - _AttributeBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ import _StringProcessing
// MARK: - AGAttribute

extension AGAttribute {
@inlinable
public init<Value>(_ attribute: AttributeGraph.Attribute<Value>)
public func unsafeCast<Value>(to type: Value.Type) -> AttributeGraph.Attribute<Value>
@inlinable
public static var current: AGAttribute? { get }
@inlinable
public func unsafeOffset(at offset: Int) -> AGAttribute
@inlinable
public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags)
public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int)
public func addInput<Value>(_ attribute: AttributeGraph.Attribute<Value>, options: AGInputOptions, token: Int)
public func visitBody<Visitor: AttributeGraph.AttributeBodyVisitor>(_ visitor: inout Visitor);
public func mutateBody<Value>(as: Value.Type, invalidating: Swift.Bool, _ body: (inout Value) -> ())
public func breadthFirstSearch(options: AGSearchOptions, _: (AGAttribute) -> Swift.Bool) -> Swift.Bool
public var _bodyType: Any.Type { get }
public var _bodyPointer: UnsafeRawPointer { get }
public var valueType: Any.Type { get }
public var indirectDependency: AGAttribute? { get set }
}

extension AGAttribute: Swift.CustomStringConvertible {
Expand Down Expand Up @@ -60,6 +66,11 @@ extension AGAttribute: Swift.CustomStringConvertible {
public func hash(into hasher: inout Swift.Hasher)
public var hashValue: Swift.Int { get }
public var value: Value { get set }

@inlinable
public func addInput(_ attribute: AGAttribute, options: AGInputOptions, token: Swift.Int)
@inlinable
public func addInput<V>(_ attribute: AttributeGraph.Attribute<V>, options: AGInputOptions, token: Int)
}

// MARK: - _AttributeBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "AGBase.h"
#include "AGAttributeFlags.h"
#include "AGInputOptions.h"
#include "AGAttributeInfo.h"
#include "AGTypeID.h"

typedef uint32_t AGAttribute __attribute((swift_newtype(struct)));

Expand All @@ -19,22 +22,17 @@ AG_EXTERN_C_BEGIN
AG_EXPORT
const AGAttribute AGAttributeNil;

AG_EXTERN_C_BEGIN
AG_EXPORT
const AGAttribute AGAttributeNil;
AG_EXTERN_C_END

AG_EXPORT
AG_REFINED_FOR_SWIFT
AGAttribute AGGraphGetCurrentAttribute(void);

AG_EXPORT
AG_REFINED_FOR_SWIFT
AGAttribute AGGraphCreateOffsetAttribute(AGAttribute attribute, uint64_t offset) AG_SWIFT_NAME(AGAttribute.create(self:offset:));
AGAttribute AGGraphCreateOffsetAttribute(AGAttribute attribute, long offset) AG_SWIFT_NAME(AGAttribute.create(self:offset:));

AG_EXPORT
AG_REFINED_FOR_SWIFT
AGAttribute AGGraphCreateOffsetAttribute2(AGAttribute attribute, uint64_t offset, uint64_t size) AG_SWIFT_NAME(AGAttribute.create(self:offset:size:));
AGAttribute AGGraphCreateOffsetAttribute2(AGAttribute attribute, long offset, uint64_t size) AG_SWIFT_NAME(AGAttribute.create(self:offset:size:));

AG_EXPORT
AG_REFINED_FOR_SWIFT
Expand All @@ -44,6 +42,26 @@ AG_EXPORT
AG_REFINED_FOR_SWIFT
void AGGraphSetFlags(AGAttribute attribute, AGAttributeFlags flags) AG_SWIFT_NAME(setter:AGAttribute.flags(self:_:));

AG_EXPORT
AG_REFINED_FOR_SWIFT
void AGGraphAddInput(AGAttribute attribute1, AGAttribute attribute2, AGInputOptions options, long token);

AG_EXPORT
AG_REFINED_FOR_SWIFT
const AGAttributeInfo AGGraphGetAttributeInfo(AGAttribute attribute);

AG_EXPORT
AG_REFINED_FOR_SWIFT
void AGGraphMutateAttribute(AGAttribute attribute, const AGTypeID type, bool invalidating/*, closure*/);

AG_EXPORT
AG_REFINED_FOR_SWIFT
AGAttribute AGGraphGetIndirectDependency(AGAttribute attribute);

AG_EXPORT
AG_REFINED_FOR_SWIFT
void AGGraphSetIndirectDependency(AGAttribute attribute1, AGAttribute attribute2);

AG_EXTERN_C_END

#endif /* AGAttribute_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// AGAttributeInfo.h
//
//
// Created by Kyle on 2024/2/17.
//

#ifndef AGAttributeInfo_h
#define AGAttributeInfo_h

#include "AGBase.h"
#include "AGAttributeType.h"

AG_ASSUME_NONNULL_BEGIN

typedef struct AGAttributeInfo {
const AGAttributeType* type;
const void *body;
} AGAttributeInfo;

AG_ASSUME_NONNULL_END

#endif /* AGAttributeInfo_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// AGAttributeType.h
//
//
// Created by Kyle on 2024/2/17.
//

#ifndef AGAttributeType_h
#define AGAttributeType_h

#include "AGBase.h"
#include "AGTypeID.h"

AG_ASSUME_NONNULL_BEGIN

typedef struct AGAttributeType {
AGTypeID typeID;
AGTypeID valueTypeID;
// TODO
} AGAttributeType;

AG_ASSUME_NONNULL_END

#endif /* AGAttributeType_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// AGInputOptions.h
//
//
// Created by Kyle on 2024/2/17.
//

#ifndef AGInputOptions_h
#define AGInputOptions_h

#include "AGBase.h"

typedef AG_OPTIONS(uint32_t, AGInputOptions) {
AGInputOptions_0 = 0,
AGInputOptions_1 = 1,
};

#endif /* AGInputOptions_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// AGSearchOptions.h
//
//
// Created by Kyle on 2024/2/17.
//

#ifndef AGSearchOptions_h
#define AGSearchOptions_h

#include "AGBase.h"

typedef AG_OPTIONS(uint32_t, AGSearchOptions) {
AGSearchOptions_0 = 0,
AGSearchOptions_1 = 1,
};

#endif /* Header_h */
Loading