Skip to content

Updates from Compute #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
@@ -1,22 +1,42 @@
//
// AGAttributeType.h
//
//
//
// Created by Kyle on 2024/2/17.
//

#ifndef AGAttributeType_h
#define AGAttributeType_h

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

AG_ASSUME_NONNULL_BEGIN

typedef struct AGClosureStorage {
void *function;
void *context;
} AGClosureStorage;

typedef struct AGAttributeVTable {
} AGAttributeVTable;

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

AGClosureStorage updateClosure;

AGAttributeVTable *_Nullable callbacks;
AGAttributeTypeFlags flags;

// set after construction
uint32_t offset;
const unsigned char *_Nullable layout;

AGTypeID initialTypeID;
void *initialBodyTypeID;
} AGAttributeType;

AG_ASSUME_NONNULL_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@
#include "AGComparisonMode.h"

AG_EXTERN_C_BEGIN

AG_EXPORT
AG_REFINED_FOR_SWIFT
bool AGCompareValues(const void *lhs, const void *rhs, const void *type, const AGComparisonMode comparisonMode);

AG_EXPORT
AG_REFINED_FOR_SWIFT
const unsigned char *_Nullable AGPrefetchCompareValues(AGTypeID type, AGComparisonOptions options, uint32_t priority);

AG_EXTERN_C_END

#endif /* AGCompareValues_h */
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

#include "AGBase.h"

typedef AG_OPTIONS(uint32_t, AGComparisonMode) {
AGComparisonMode_0 = 0,
AGComparisonMode_1 = 1 << 0,
AGComparisonMode_2 = 1 << 1,
AGComparisonMode_3 = AGComparisonMode_1 | AGComparisonMode_2,
typedef AG_ENUM(uint8_t, AGComparisonMode){
AGComparisonModeBitwise = 0,
AGComparisonModeIndirect = 1,
AGComparisonModeEquatableUnlessPOD = 2,
AGComparisonModeEquatableAlways = 3,
};

typedef AG_OPTIONS(uint32_t, AGComparisonOptions) {
AGComparisonOptions_0 = 0,
AGComparisonOptions_1 = 1 << 0,
AGComparisonOptions_2 = 1 << 1,
AGComparisonOptions_3 = AGComparisonOptions_1 | AGComparisonOptions_2,
typedef AG_OPTIONS(uint32_t, AGComparisonOptions){
AGComparisonOptionsComparisonModeMask = 0xff,

AGComparisonOptionsCopyOnWrite = 1 << 8,
AGComparisonOptionsFetchLayoutsSynchronously = 1 << 9,
AGComparisonOptionsReportFailures = 1ul << 31, // -1 signed int
};

#endif /* AGComparisonMode_h */

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@

#include "AGBase.h"
#include "CFRuntime.h"
#include "AGCounterQueryType.h"
#include "AGGraphCounterQuery.h"

// Note: Place all structure declaration in a single place to avoid header cycle dependency

typedef struct AG_BRIDGED_TYPE(id) AGGraphStorage * AGGraphRef;
typedef struct AG_BRIDGED_TYPE(id) AGGraphContextStorage * AGGraphContextRef;
typedef struct AG_BRIDGED_TYPE(id) AGSubgraphStorage * AGSubgraphRef;

typedef void * AGUnownedGraphRef;
typedef struct AGGraphContextStorage * AGUnownedGraphContextRef;

struct AGGraphStorage;
struct AGGraphContextStorage;
struct AGSubgraphStorage;
struct AGGraphContextStorage;

typedef uint32_t AGAttribute AG_SWIFT_STRUCT AG_SWIFT_NAME(AnyAttribute);

Expand Down Expand Up @@ -68,7 +70,7 @@ void AGGraphSetContext(AGGraphRef graph, const void * _Nullable context) AG_SWIF

AG_EXPORT
AG_REFINED_FOR_SWIFT
AGGraphContextRef AGGraphGetGraphContext(AGGraphRef graph) AG_SWIFT_NAME(getter:AGGraphRef.graphContext(self:));
AGUnownedGraphRef AGGraphGetGraphContext(AGGraphRef graph) AG_SWIFT_NAME(getter:AGGraphRef.graphContext(self:));

AG_EXPORT
AG_REFINED_FOR_SWIFT
Expand All @@ -92,7 +94,7 @@ void AGGraphSetUpdateCallback(AGGraphRef graph,

AG_EXPORT
AG_REFINED_FOR_SWIFT
uint64_t AGGraphGetCounter(AGGraphRef graph, AGCounterQueryType query) AG_SWIFT_NAME(AGGraphRef.counter(self:for:));
uint64_t AGGraphGetCounter(AGGraphRef graph, AGGraphCounterQuery query) AG_SWIFT_NAME(AGGraphRef.counter(self:for:));

AG_EXPORT
AG_REFINED_FOR_SWIFT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ AG_EXTERN_C_BEGIN

AG_EXPORT
AG_REFINED_FOR_SWIFT
AGGraphRef AGGraphContextGetGraph(AGGraphContextRef context) AG_SWIFT_NAME(getter:AGGraphContextRef.graph(self:));
AGGraphRef AGGraphContextGetGraph(AGUnownedGraphContextRef context) AG_SWIFT_NAME(getter:AGUnownedGraphContextRef.graph(self:));

AG_EXTERN_C_END

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// AGCounterQueryType.h
//
//
// Created by Kyle on 2024/3/8.
//

#ifndef AGGraphCounterQuery_h
#define AGGraphCounterQuery_h

#include "AGBase.h"

typedef AG_ENUM(uint32_t, AGGraphCounterQuery){
AGGraphCounterQueryNodeCount,
AGGraphCounterQueryTransactionCount,
AGGraphCounterQueryUpdateCount,
AGGraphCounterQueryChangeCount,
AGGraphCounterQueryContextID,
AGGraphCounterQueryGraphID,
AGGraphCounterQueryContextThreadUpdating,
AGGraphCounterQueryThreadUpdating,
AGGraphCounterQueryContextNeedsUpdate,
AGGraphCounterQueryNeedsUpdate,
AGGraphCounterQueryMainThreadUpdateCount,
AGGraphCounterQueryNodeTotalCount,
AGGraphCounterQuerySubgraphCount,
AGGraphCounterQuerySubgraphTotalCount,
};

#endif /* AGGraphCounterQuery_h */
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void AGSubgraphSetCurrent(_Nullable AGSubgraphRef cf_subgraph) AG_SWIFT_NAME(set

AG_EXPORT
AG_REFINED_FOR_SWIFT
_Nullable AGGraphContextRef AGSubgraphGetCurrentGraphContext(void) AG_SWIFT_NAME(getter:AGSubgraphRef.currentGraphContext());
_Nullable AGUnownedGraphRef AGSubgraphGetCurrentGraphContext(void) AG_SWIFT_NAME(getter:AGSubgraphRef.currentGraphContext());

AG_EXPORT
AG_REFINED_FOR_SWIFT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

AG_ASSUME_NONNULL_BEGIN

typedef struct AG_SWIFT_NAME(_Metadata) AGSwiftMetadata {
} AGSwiftMetadata;

typedef const AGSwiftMetadata *AGTypeID AG_SWIFT_STRUCT AG_SWIFT_NAME(Metadata);
typedef const struct AGSwiftMetadata *AGTypeID AG_SWIFT_STRUCT AG_SWIFT_NAME(Metadata);

#if ATTRIBUTEGRAPH_RELEASE >= ATTRIBUTEGRAPH_RELEASE_2024

Expand All @@ -35,11 +32,11 @@ typedef AG_CLOSED_ENUM(uint32_t, AGTypeKind) {
AGTypeKindMetatype,
} AG_SWIFT_NAME(Metadata.Kind);

typedef AG_OPTIONS(uint32_t, AGTypeApplyOptions) {
AGTypeApplyOptions_0 = 0,
AGTypeApplyOptions_1 = 1 << 0,
AGTypeApplyOptions_2 = 1 << 1,
AGTypeApplyOptions_4 = 1 << 2,
typedef AG_OPTIONS(uint32_t, AGTypeApplyOptions){
AGTypeApplyOptionsEnumerateStructFields = 0,
AGTypeApplyOptionsEnumerateClassFields = 1 << 0,
AGTypeApplyOptionsContinueAfterUnknownField = 1 << 1,
AGTypeApplyOptionsEnumerateEnumCases = 1 << 2,
};

AG_EXTERN_C_BEGIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include "AGChangedValueFlags.h"
#include "AGCompareValues.h"
#include "AGComparisonMode.h"
#include "AGCounterQueryType.h"
#include "AGDebugServer.h"
#include "AGGraph.h"
#include "AGGraphContext.h"
#include "AGGraphCounterQuery.h"
#include "AGGraphDescription.h"
#include "AGInputOptions.h"
#include "AGSearchOptions.h"
Expand Down
Loading