From 076870a8889aa9f7d772e2d5838a8bb65b909beb Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Sat, 16 Jun 2018 09:40:39 -0700 Subject: [PATCH 1/2] Standardize "extern" decls on AS_EXTERN --- CHANGELOG.md | 1 + Source/ASConfigurationInternal.h | 4 +- Source/ASContextTransitioning.h | 4 +- Source/ASDisplayNode+Beta.h | 8 ++- Source/ASDisplayNode.h | 2 +- Source/ASDisplayNodeExtras.h | 52 +++++++++---------- Source/ASDisplayNodeExtras.mm | 36 ++++++------- Source/ASExperimentalFeatures.h | 6 +-- Source/ASImageNode.h | 7 +-- Source/ASImageNode.mm | 4 +- Source/ASMultiplexImageNode.h | 2 +- Source/ASVisibilityProtocols.h | 6 +-- Source/Base/ASAssert.h | 8 ++- Source/Base/ASBaseDefines.h | 17 ++---- Source/Base/ASLog.h | 20 +++---- Source/Details/ASAbstractLayoutController.h | 10 ++-- Source/Details/ASAbstractLayoutController.mm | 14 ++--- .../Details/ASCollectionViewLayoutInspector.h | 2 +- Source/Details/ASDataController.h | 4 +- Source/Details/ASGraphicsContext.h | 8 ++- Source/Details/ASGraphicsContext.m | 6 +-- Source/Details/ASHashing.h | 4 +- Source/Details/ASLayoutController.h | 4 -- Source/Details/ASLayoutRangeType.h | 4 +- Source/Details/ASObjectDescriptionHelpers.h | 14 ++--- Source/Details/ASPageTable.h | 16 +++--- Source/Details/ASPageTable.m | 12 ++--- .../Details/ASPhotosFrameworkImageRequest.h | 3 +- Source/Details/ASRecursiveUnfairLock.h | 11 ++-- Source/Details/ASScrollDirection.h | 22 ++++---- Source/Details/ASTraitCollection.h | 16 +++--- Source/Details/ASTraitCollection.m | 2 +- Source/Details/CoreGraphics+ASConvenience.h | 4 -- .../Transactions/_ASAsyncTransaction.h | 3 +- Source/Layout/ASDimension.h | 22 ++++---- Source/Layout/ASDimension.mm | 2 +- Source/Layout/ASDimensionInternal.h | 7 +-- Source/Layout/ASLayout.h | 12 ++--- Source/Layout/ASLayout.mm | 2 +- Source/Layout/ASLayoutElement.h | 34 ++++++------ Source/Layout/ASLayoutElementPrivate.h | 10 ++-- Source/Layout/ASYogaUtilities.h | 30 +++++------ Source/Layout/ASYogaUtilities.mm | 2 +- Source/Private/ASBatchFetching.h | 7 +-- Source/Private/ASCollectionLayoutDefines.h | 6 +-- Source/Private/ASCollectionLayoutDefines.m | 2 +- Source/Private/ASDispatch.h | 8 +-- Source/Private/ASDisplayNodeInternal.h | 4 +- .../ASImageNode+AnimatedImagePrivate.h | 2 +- Source/Private/ASImageNode+CGExtras.h | 7 +-- Source/Private/ASInternalHelpers.h | 38 ++++++-------- Source/Private/ASTwoDimensionalArrayUtils.h | 18 +++---- .../Layout/ASStackUnpositionedLayout.h | 2 +- .../TextExperiment/Component/ASTextLayout.h | 2 +- .../TextExperiment/String/ASTextAttribute.h | 3 +- Source/Private/_ASCoreAnimationExtras.h | 20 +++---- Source/Private/_ASCoreAnimationExtras.mm | 4 +- Source/TextKit/ASTextKitAttributes.h | 4 +- Source/TextKit/ASTextKitCoreTextAdditions.h | 11 ++-- Source/TextKit/ASTextKitCoreTextAdditions.m | 2 +- Tests/ASDisplayNodeTestsHelper.h | 12 ++--- 61 files changed, 247 insertions(+), 362 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b369de246..ce27c151c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Make the main thread ivar deallocation system available to other classes. Plus a little optimization. See `ASMainThreadDeallocation.h`. [Adlai Holler](https://github.com/Adlai-Holler) [#959](https://github.com/TextureGroup/Texture/pull/959) - Reduce usage of autorelease pools. [Adlai Holler](https://github.com/Adlai-Holler) [#968](https://github.com/TextureGroup/Texture/pull/968) - Clean up unused/unneeded header macros. [Adlai Holler](https://github.com/Adlai-Holler) +- Clean up C-function `extern` decorators. [Adlai Holler](https://github.com/Adlai-Holler) ## 2.7 - Fix pager node for interface coalescing. [Max Wang](https://github.com/wsdwsd0829) [#877](https://github.com/TextureGroup/Texture/pull/877) diff --git a/Source/ASConfigurationInternal.h b/Source/ASConfigurationInternal.h index 2a7d7e4f5..0d2662acd 100644 --- a/Source/ASConfigurationInternal.h +++ b/Source/ASConfigurationInternal.h @@ -17,7 +17,6 @@ #import NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN /** * Quickly check if an experiment is enabled and notify the delegate @@ -25,7 +24,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN * * The delegate will be notified asynchronously. */ -BOOL ASActivateExperimentalFeature(ASExperimentalFeatures option); +AS_EXTERN BOOL ASActivateExperimentalFeature(ASExperimentalFeatures option); AS_SUBCLASSING_RESTRICTED @interface ASConfigurationManager : NSObject @@ -38,4 +37,3 @@ AS_SUBCLASSING_RESTRICTED @end NS_ASSUME_NONNULL_END -ASDISPLAYNODE_EXTERN_C_END diff --git a/Source/ASContextTransitioning.h b/Source/ASContextTransitioning.h index 8982211b9..f433b85f1 100644 --- a/Source/ASContextTransitioning.h +++ b/Source/ASContextTransitioning.h @@ -22,8 +22,8 @@ NS_ASSUME_NONNULL_BEGIN -extern NSString * const ASTransitionContextFromLayoutKey; -extern NSString * const ASTransitionContextToLayoutKey; +AS_EXTERN NSString * const ASTransitionContextFromLayoutKey; +AS_EXTERN NSString * const ASTransitionContextToLayoutKey; @protocol ASContextTransitioning diff --git a/Source/ASDisplayNode+Beta.h b/Source/ASDisplayNode+Beta.h index e4b4df1ae..cd42006cc 100644 --- a/Source/ASDisplayNode+Beta.h +++ b/Source/ASDisplayNode+Beta.h @@ -27,10 +27,8 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN -void ASPerformBlockOnMainThread(void (^block)(void)); -void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void ASPerformBlockOnMainThread(void (^block)(void)); +AS_EXTERN void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT #if ASEVENTLOG_ENABLE #define ASDisplayNodeLogEvent(node, ...) [node.eventLog logEventWithBacktrace:(AS_SAVE_EVENT_BACKTRACES ? [NSThread callStackSymbols] : nil) format:__VA_ARGS__] @@ -167,7 +165,7 @@ typedef struct { #if YOGA -extern void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode * _Nullable node, void(^block)(ASDisplayNode *node)); +AS_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode * _Nullable node, void(^block)(ASDisplayNode *node)); @interface ASDisplayNode (Yoga) diff --git a/Source/ASDisplayNode.h b/Source/ASDisplayNode.h index 131069a95..e8dcb03c9 100644 --- a/Source/ASDisplayNode.h +++ b/Source/ASDisplayNode.h @@ -110,7 +110,7 @@ typedef NS_ENUM(NSInteger, ASCornerRoundingType) { /** * Default drawing priority for display node */ -extern NSInteger const ASDefaultDrawingPriority; +AS_EXTERN NSInteger const ASDefaultDrawingPriority; /** * An `ASDisplayNode` is an abstraction over `UIView` and `CALayer` that allows you to perform calculations about a view diff --git a/Source/ASDisplayNodeExtras.h b/Source/ASDisplayNodeExtras.h index afe00fdd0..b47eb5c6e 100644 --- a/Source/ASDisplayNodeExtras.h +++ b/Source/ASDisplayNodeExtras.h @@ -36,10 +36,8 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN - /// For deallocation of objects on the main thread across multiple run loops. -extern void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr); +AS_EXTERN void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr); // Because inline methods can't be extern'd and need to be part of the translation unit of code // that compiles with them to actually inline, we both declare and define these in the header. @@ -111,22 +109,22 @@ __unused static NSString *NSStringFromASInterfaceStateChange(ASInterfaceState ol /** Returns the appropriate interface state for a given ASDisplayNode and window */ -extern ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) AS_WARN_UNUSED_RESULT; +AS_EXTERN ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) AS_WARN_UNUSED_RESULT; /** Given a layer, returns the associated display node, if any. */ -extern ASDisplayNode * _Nullable ASLayerToDisplayNode(CALayer * _Nullable layer) AS_WARN_UNUSED_RESULT; +AS_EXTERN ASDisplayNode * _Nullable ASLayerToDisplayNode(CALayer * _Nullable layer) AS_WARN_UNUSED_RESULT; /** Given a view, returns the associated display node, if any. */ -extern ASDisplayNode * _Nullable ASViewToDisplayNode(UIView * _Nullable view) AS_WARN_UNUSED_RESULT; +AS_EXTERN ASDisplayNode * _Nullable ASViewToDisplayNode(UIView * _Nullable view) AS_WARN_UNUSED_RESULT; /** Given a node, returns the root of the node hierarchy (where supernode == nil) */ -extern ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) AS_WARN_UNUSED_RESULT; +AS_EXTERN ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) AS_WARN_UNUSED_RESULT; /** If traverseSublayers == YES, this function will walk the layer hierarchy, spanning discontinuous sections of the node hierarchy\ @@ -134,39 +132,39 @@ extern ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) AS_ In the event that a node's backing layer is not created yet, the function will only walk the direct subnodes instead of forcing the layer hierarchy to be created. */ -extern void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)); +AS_EXTERN void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)); /** This function will walk the node hierarchy in a breadth first fashion. It does run the block on the node provided directly to the function call. It does NOT traverse sublayers. */ -extern void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)); +AS_EXTERN void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)); /** Identical to ASDisplayNodePerformBlockOnEveryNode, except it does not run the block on the node provided directly to the function call - only on all descendants. */ -extern void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)); +AS_EXTERN void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)); /** Given a display node, traverses up the layer tree hierarchy, returning the first display node that passes block. */ -extern ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernode(ASDisplayNode * _Nullable node, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use the `supernodes` property instead."); +AS_EXTERN ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernode(ASDisplayNode * _Nullable node, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use the `supernodes` property instead."); /** Given a display node, traverses up the layer tree hierarchy, returning the first display node of kind class. */ -extern __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use the `supernodeOfClass:includingSelf:` method instead."); +AS_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use the `supernodeOfClass:includingSelf:` method instead."); /** * Given a layer, find the window it lives in, if any. */ -extern UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT; +AS_EXTERN UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT; /** * Given a layer, find the closest view it lives in, if any. */ -extern UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT; +AS_EXTERN UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT; /** * Given two nodes, finds their most immediate common parent. Used for geometry conversion methods. @@ -176,50 +174,48 @@ extern UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) AS_WARN_UNUSE * undefined and undocumented behavior of UIKit in ASDisplayNode, this operation is defined to be incorrect in all * circumstances and must be fixed wherever encountered. */ -extern ASDisplayNode * _Nullable ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) AS_WARN_UNUSED_RESULT; +AS_EXTERN ASDisplayNode * _Nullable ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) AS_WARN_UNUSED_RESULT; /** Given a display node, collects all descendants. This is a specialization of ASCollectContainer() that walks the Core Animation layer tree as opposed to the display node tree, thus supporting non-continues display node hierarchies. */ -extern NSArray *ASCollectDisplayNodes(ASDisplayNode *node) AS_WARN_UNUSED_RESULT; +AS_EXTERN NSArray *ASCollectDisplayNodes(ASDisplayNode *node) AS_WARN_UNUSED_RESULT; /** Given a display node, traverses down the node hierarchy, returning all the display nodes that pass the block. */ -extern NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; +AS_EXTERN NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; /** Given a display node, traverses down the node hierarchy, returning all the display nodes of kind class. */ -extern NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT; +AS_EXTERN NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT; /** Given a display node, traverses down the node hierarchy, returning the depth-first display node, including the start node that pass the block. */ -extern __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstNode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; +AS_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstNode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; /** Given a display node, traverses down the node hierarchy, returning the depth-first display node, excluding the start node, that pass the block */ -extern __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; +AS_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; /** Given a display node, traverses down the node hierarchy, returning the depth-first display node of kind class. */ -extern __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT; +AS_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT; -extern UIColor *ASDisplayNodeDefaultPlaceholderColor(void) AS_WARN_UNUSED_RESULT; -extern UIColor *ASDisplayNodeDefaultTintColor(void) AS_WARN_UNUSED_RESULT; +AS_EXTERN UIColor *ASDisplayNodeDefaultPlaceholderColor(void) AS_WARN_UNUSED_RESULT; +AS_EXTERN UIColor *ASDisplayNodeDefaultTintColor(void) AS_WARN_UNUSED_RESULT; /** Disable willAppear / didAppear / didDisappear notifications for a sub-hierarchy, then re-enable when done. Nested calls are supported. */ -extern void ASDisplayNodeDisableHierarchyNotifications(ASDisplayNode *node); -extern void ASDisplayNodeEnableHierarchyNotifications(ASDisplayNode *node); +AS_EXTERN void ASDisplayNodeDisableHierarchyNotifications(ASDisplayNode *node); +AS_EXTERN void ASDisplayNodeEnableHierarchyNotifications(ASDisplayNode *node); // Not to be called directly. -extern void _ASSetDebugNames(Class owningClass, NSString *names, ASDisplayNode *object, ...); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void _ASSetDebugNames(Class owningClass, NSString *names, ASDisplayNode *object, ...); NS_ASSUME_NONNULL_END diff --git a/Source/ASDisplayNodeExtras.mm b/Source/ASDisplayNodeExtras.mm index 651a3424e..2e87a04fd 100644 --- a/Source/ASDisplayNodeExtras.mm +++ b/Source/ASDisplayNodeExtras.mm @@ -23,7 +23,7 @@ #import #import -extern void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr) { +AS_EXTERN void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr) { /** * UIKit components must be deallocated on the main thread. We use this shared * run loop queue to gradually deallocate them across many turns of the main run loop. @@ -48,7 +48,7 @@ extern void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull obj } } -extern void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull names, ASDisplayNode * _Nullable object, ...) +AS_EXTERN void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull names, ASDisplayNode * _Nullable object, ...) { NSString *owningClassName = NSStringFromClass(owningClass); NSArray *nameArray = [names componentsSeparatedByString:@", "]; @@ -66,7 +66,7 @@ extern void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull nam va_end(args); } -extern ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) +AS_EXTERN ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) { ASDisplayNodeCAssert(![displayNode isLayerBacked], @"displayNode must not be layer backed as it may have a nil window"); if (displayNode && [displayNode supportsRangeManagedInterfaceState]) { @@ -81,17 +81,17 @@ extern ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNod } } -extern ASDisplayNode *ASLayerToDisplayNode(CALayer *layer) +AS_EXTERN ASDisplayNode *ASLayerToDisplayNode(CALayer *layer) { return layer.asyncdisplaykit_node; } -extern ASDisplayNode *ASViewToDisplayNode(UIView *view) +AS_EXTERN ASDisplayNode *ASViewToDisplayNode(UIView *view) { return view.asyncdisplaykit_node; } -extern void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) +AS_EXTERN void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) { if (!node) { ASDisplayNodeCAssertNotNil(layer, @"Cannot recursively perform with nil node and nil layer"); @@ -119,7 +119,7 @@ extern void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDi } } -extern void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) +AS_EXTERN void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) { // Queue used to keep track of subnodes while traversing this layout in a BFS fashion. std::queue queue; @@ -138,7 +138,7 @@ extern void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^b } } -extern void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) +AS_EXTERN void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) { for (ASDisplayNode *subnode in node.subnodes) { ASDisplayNodePerformBlockOnEveryNode(nil, subnode, YES, block); @@ -176,7 +176,7 @@ static void _ASCollectDisplayNodes(NSMutableArray *array, CALayer *layer) _ASCollectDisplayNodes(array, sublayer); } -extern NSArray *ASCollectDisplayNodes(ASDisplayNode *node) +AS_EXTERN NSArray *ASCollectDisplayNodes(ASDisplayNode *node) { NSMutableArray *list = [[NSMutableArray alloc] init]; for (CALayer *sublayer in node.layer.sublayers) { @@ -201,14 +201,14 @@ static void _ASDisplayNodeFindAllSubnodes(NSMutableArray *array, ASDisplayNode * } } -extern NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) +AS_EXTERN NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) { NSMutableArray *list = [[NSMutableArray alloc] init]; _ASDisplayNodeFindAllSubnodes(list, start, block); return list; } -extern NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) +AS_EXTERN NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) { return ASDisplayNodeFindAllSubnodes(start, ^(ASDisplayNode *n) { return [n isKindOfClass:c]; @@ -232,17 +232,17 @@ static void _ASDisplayNodeFindAllSubnodes(NSMutableArray *array, ASDisplayNode * return nil; } -extern __kindof ASDisplayNode *ASDisplayNodeFindFirstNode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) +AS_EXTERN __kindof ASDisplayNode *ASDisplayNodeFindFirstNode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) { return _ASDisplayNodeFindFirstNode(startNode, YES, block); } -extern __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) +AS_EXTERN __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) { return _ASDisplayNodeFindFirstNode(startNode, NO, block); } -extern __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) +AS_EXTERN __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) { return ASDisplayNodeFindFirstSubnode(start, ^(ASDisplayNode *n) { return [n isKindOfClass:c]; @@ -262,7 +262,7 @@ static inline BOOL _ASDisplayNodeIsAncestorOfDisplayNode(ASDisplayNode *possible return NO; } -extern UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) +AS_EXTERN UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) { UIView *view = ASFindClosestViewOfLayer(layer); if (UIWindow *window = ASDynamicCast(view, UIWindow)) { @@ -272,7 +272,7 @@ static inline BOOL _ASDisplayNodeIsAncestorOfDisplayNode(ASDisplayNode *possible } } -extern UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) +AS_EXTERN UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) { while (layer != nil) { if (UIView *view = ASDynamicCast(layer.delegate, UIView)) { @@ -283,7 +283,7 @@ static inline BOOL _ASDisplayNodeIsAncestorOfDisplayNode(ASDisplayNode *possible return nil; } -extern ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) +AS_EXTERN ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) { ASDisplayNode *possibleAncestor = node1; while (possibleAncestor) { @@ -297,7 +297,7 @@ static inline BOOL _ASDisplayNodeIsAncestorOfDisplayNode(ASDisplayNode *possible return possibleAncestor; } -extern ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) +AS_EXTERN ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) { // node <- supernode on each loop // previous <- node on each loop where node is not nil diff --git a/Source/ASExperimentalFeatures.h b/Source/ASExperimentalFeatures.h index 6b418d3b4..570ed95fd 100644 --- a/Source/ASExperimentalFeatures.h +++ b/Source/ASExperimentalFeatures.h @@ -14,7 +14,6 @@ #import NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN /** * A bit mask of features. Make sure to update configuration.json when you add entries. @@ -31,10 +30,9 @@ typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) { }; /// Convert flags -> name array. -NSArray *ASExperimentalFeaturesGetNames(ASExperimentalFeatures flags); +AS_EXTERN NSArray *ASExperimentalFeaturesGetNames(ASExperimentalFeatures flags); /// Convert name array -> flags. -ASExperimentalFeatures ASExperimentalFeaturesFromArray(NSArray *array); +AS_EXTERN ASExperimentalFeatures ASExperimentalFeaturesFromArray(NSArray *array); -ASDISPLAYNODE_EXTERN_C_END NS_ASSUME_NONNULL_END diff --git a/Source/ASImageNode.h b/Source/ASImageNode.h index a7c4c7811..13460bcf6 100644 --- a/Source/ASImageNode.h +++ b/Source/ASImageNode.h @@ -195,8 +195,6 @@ typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image); @end -ASDISPLAYNODE_EXTERN_C_BEGIN - /** * @abstract Image modification block that rounds (and optionally adds a border to) an image. * @@ -207,7 +205,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN * * @return An ASImageNode image modification block. */ -asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor * _Nullable borderColor); +AS_EXTERN asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor * _Nullable borderColor); /** * @abstract Image modification block that applies a tint color à la UIImage configured with @@ -219,7 +217,6 @@ asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat * * @return An ASImageNode image modification block. */ -asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color); +AS_EXTERN asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color); -ASDISPLAYNODE_EXTERN_C_END NS_ASSUME_NONNULL_END diff --git a/Source/ASImageNode.mm b/Source/ASImageNode.mm index 7f2caeda2..37a5777cf 100644 --- a/Source/ASImageNode.mm +++ b/Source/ASImageNode.mm @@ -732,7 +732,7 @@ - (NSDictionary *)debugLabelAttributes #pragma mark - Extras -extern asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor *borderColor) +AS_EXTERN asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor *borderColor) { return ^(UIImage *originalImage) { ASGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale); @@ -755,7 +755,7 @@ extern asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock( }; } -extern asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color) +AS_EXTERN asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color) { return ^(UIImage *originalImage) { ASGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale); diff --git a/Source/ASMultiplexImageNode.h b/Source/ASMultiplexImageNode.h index 5cf12ac32..95785afe2 100644 --- a/Source/ASMultiplexImageNode.h +++ b/Source/ASMultiplexImageNode.h @@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN typedef id ASImageIdentifier; -extern NSString *const ASMultiplexImageNodeErrorDomain; +AS_EXTERN NSString *const ASMultiplexImageNodeErrorDomain; /** * ASMultiplexImageNode error codes. diff --git a/Source/ASVisibilityProtocols.h b/Source/ASVisibilityProtocols.h index 67ee0ab0c..7f94bf6ae 100644 --- a/Source/ASVisibilityProtocols.h +++ b/Source/ASVisibilityProtocols.h @@ -22,11 +22,7 @@ NS_ASSUME_NONNULL_BEGIN @class UIViewController; -ASDISPLAYNODE_EXTERN_C_BEGIN - -extern ASLayoutRangeMode ASLayoutRangeModeForVisibilityDepth(NSUInteger visibilityDepth); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN ASLayoutRangeMode ASLayoutRangeModeForVisibilityDepth(NSUInteger visibilityDepth); /** * ASVisibilityDepth diff --git a/Source/Base/ASAssert.h b/Source/Base/ASAssert.h index 636ef45f2..863a52466 100644 --- a/Source/Base/ASAssert.h +++ b/Source/Base/ASAssert.h @@ -81,13 +81,11 @@ */ #pragma mark - Main Thread Assertions Disabling -ASDISPLAYNODE_EXTERN_C_BEGIN -BOOL ASMainThreadAssertionsAreDisabled(void); +AS_EXTERN BOOL ASMainThreadAssertionsAreDisabled(void); -void ASPushMainThreadAssertionsDisabled(void); +AS_EXTERN void ASPushMainThreadAssertionsDisabled(void); -void ASPopMainThreadAssertionsDisabled(void); -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void ASPopMainThreadAssertionsDisabled(void); #pragma mark - Non-Fatal Assertions diff --git a/Source/Base/ASBaseDefines.h b/Source/Base/ASBaseDefines.h index 240f2bcde..4150b8aed 100755 --- a/Source/Base/ASBaseDefines.h +++ b/Source/Base/ASBaseDefines.h @@ -15,20 +15,9 @@ // http://www.apache.org/licenses/LICENSE-2.0 // -// The C++ compiler mangles C function names. extern "C" { /* your C functions */ } prevents this. -// You should wrap all C function prototypes declared in headers with ASDISPLAYNODE_EXTERN_C_BEGIN/END, even if -// they are included only from .m (Objective-C) files. It's common for .m files to start using C++ -// features and become .mm (Objective-C++) files. Always wrapping the prototypes with -// ASDISPLAYNODE_EXTERN_C_BEGIN/END will save someone a headache once they need to do this. You do not need to -// wrap constants, only C functions. See StackOverflow for more details: -// http://stackoverflow.com/questions/1041866/in-c-source-what-is-the-effect-of-extern-c -#ifdef __cplusplus -# define ASDISPLAYNODE_EXTERN_C_BEGIN extern "C" { -# define ASDISPLAYNODE_EXTERN_C_END } -#else -# define ASDISPLAYNODE_EXTERN_C_BEGIN -# define ASDISPLAYNODE_EXTERN_C_END -#endif +#import + +#define AS_EXTERN FOUNDATION_EXTERN #ifdef __GNUC__ # define ASDISPLAYNODE_GNUC(major, minor) \ diff --git a/Source/Base/ASLog.h b/Source/Base/ASLog.h index e87404631..99da08cc1 100644 --- a/Source/Base/ASLog.h +++ b/Source/Base/ASLog.h @@ -25,8 +25,6 @@ #define ASEnableVerboseLogging 0 #endif -ASDISPLAYNODE_EXTERN_C_BEGIN - /** * Disable all logging. * @@ -40,7 +38,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN * are at the `debug` log level, which the system * disables in production. */ -void ASDisableLogging(void); +AS_EXTERN void ASDisableLogging(void); /** * Restore logging that has been runtime-disabled via ASDisableLogging(). @@ -50,33 +48,31 @@ void ASDisableLogging(void); * configuration. This can be used in conjunction with ASDisableLogging() * to allow logging to be toggled off and back on at runtime. */ -void ASEnableLogging(void); +AS_EXTERN void ASEnableLogging(void); /// Log for general node events e.g. interfaceState, didLoad. #define ASNodeLogEnabled 1 -os_log_t ASNodeLog(void); +AS_EXTERN os_log_t ASNodeLog(void); /// Log for layout-specific events e.g. calculateLayout. #define ASLayoutLogEnabled 1 -os_log_t ASLayoutLog(void); +AS_EXTERN os_log_t ASLayoutLog(void); /// Log for display-specific events e.g. display queue batches. #define ASDisplayLogEnabled 1 -os_log_t ASDisplayLog(void); +AS_EXTERN os_log_t ASDisplayLog(void); /// Log for collection events e.g. reloadData, performBatchUpdates. #define ASCollectionLogEnabled 1 -os_log_t ASCollectionLog(void); +AS_EXTERN os_log_t ASCollectionLog(void); /// Log for ASNetworkImageNode and ASMultiplexImageNode events. #define ASImageLoadingLogEnabled 1 -os_log_t ASImageLoadingLog(void); +AS_EXTERN os_log_t ASImageLoadingLog(void); /// Specialized log for our main thread deallocation trampoline. #define ASMainThreadDeallocationLogEnabled 0 -os_log_t ASMainThreadDeallocationLog(void); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN os_log_t ASMainThreadDeallocationLog(void); /** * The activity tracing system changed a lot between iOS 9 and 10. diff --git a/Source/Details/ASAbstractLayoutController.h b/Source/Details/ASAbstractLayoutController.h index c59e1a4e9..c5ffc740e 100644 --- a/Source/Details/ASAbstractLayoutController.h +++ b/Source/Details/ASAbstractLayoutController.h @@ -20,15 +20,11 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN +AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters); -FOUNDATION_EXPORT ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters); +AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters); -FOUNDATION_EXPORT ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters); - -FOUNDATION_EXPORT CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection); @interface ASAbstractLayoutController : NSObject diff --git a/Source/Details/ASAbstractLayoutController.mm b/Source/Details/ASAbstractLayoutController.mm index 4681206d3..f724a242a 100644 --- a/Source/Details/ASAbstractLayoutController.mm +++ b/Source/Details/ASAbstractLayoutController.mm @@ -21,14 +21,14 @@ #include -extern ASRangeTuningParameters const ASRangeTuningParametersZero = {}; +AS_EXTERN ASRangeTuningParameters const ASRangeTuningParametersZero = {}; -extern BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs) +AS_EXTERN BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs) { return lhs.leadingBufferScreenfuls == rhs.leadingBufferScreenfuls && lhs.trailingBufferScreenfuls == rhs.trailingBufferScreenfuls; } -extern ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, +AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters) { ASDirectionalScreenfulBuffer horizontalBuffer = {0, 0}; @@ -41,7 +41,7 @@ extern ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScr return horizontalBuffer; } -extern ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, +AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters) { ASDirectionalScreenfulBuffer verticalBuffer = {0, 0}; @@ -54,7 +54,7 @@ extern ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrol return verticalBuffer; } -extern CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuffer buffer) +AS_EXTERN CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuffer buffer) { CGFloat negativeDirectionWidth = buffer.negativeDirection * rect.size.width; CGFloat positiveDirectionWidth = buffer.positiveDirection * rect.size.width; @@ -63,7 +63,7 @@ extern CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuffer return rect; } -extern CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffer buffer) +AS_EXTERN CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffer buffer) { CGFloat negativeDirectionHeight = buffer.negativeDirection * rect.size.height; CGFloat positiveDirectionHeight = buffer.positiveDirection * rect.size.height; @@ -72,7 +72,7 @@ extern CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffer b return rect; } -extern CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, +AS_EXTERN CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection) { // Can scroll horizontally - expand the range appropriately diff --git a/Source/Details/ASCollectionViewLayoutInspector.h b/Source/Details/ASCollectionViewLayoutInspector.h index ba2aadf28..a3c283f56 100644 --- a/Source/Details/ASCollectionViewLayoutInspector.h +++ b/Source/Details/ASCollectionViewLayoutInspector.h @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN -extern ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView *collectionView); +AS_EXTERN ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView *collectionView); @protocol ASCollectionViewLayoutInspecting diff --git a/Source/Details/ASDataController.h b/Source/Details/ASDataController.h index 9407cda65..7bb5e75e2 100644 --- a/Source/Details/ASDataController.h +++ b/Source/Details/ASDataController.h @@ -47,8 +47,8 @@ NS_ASSUME_NONNULL_BEGIN typedef NSUInteger ASDataControllerAnimationOptions; -extern NSString * const ASDataControllerRowNodeKind; -extern NSString * const ASCollectionInvalidUpdateException; +AS_EXTERN NSString * const ASDataControllerRowNodeKind; +AS_EXTERN NSString * const ASCollectionInvalidUpdateException; /** Data source for data controller diff --git a/Source/Details/ASGraphicsContext.h b/Source/Details/ASGraphicsContext.h index 0713f104f..336ebbc46 100644 --- a/Source/Details/ASGraphicsContext.h +++ b/Source/Details/ASGraphicsContext.h @@ -29,28 +29,26 @@ */ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN /** * Creates a one-shot context. * * Behavior is the same as UIGraphicsBeginImageContextWithOptions. */ -extern void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale); +AS_EXTERN void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale); /** * Generates and image and ends the current one-shot context. * * Behavior is the same as UIGraphicsGetImageFromCurrentImageContext followed by UIGraphicsEndImageContext. */ -extern UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext(void) NS_RETURNS_RETAINED; +AS_EXTERN UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext(void) NS_RETURNS_RETAINED; /** * Call this if you want to end the current context without making an image. * * Behavior is the same as UIGraphicsEndImageContext. */ -extern void ASGraphicsEndImageContext(void); +AS_EXTERN void ASGraphicsEndImageContext(void); -ASDISPLAYNODE_EXTERN_C_END NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASGraphicsContext.m b/Source/Details/ASGraphicsContext.m index 37810a106..d1dd61cce 100644 --- a/Source/Details/ASGraphicsContext.m +++ b/Source/Details/ASGraphicsContext.m @@ -41,7 +41,7 @@ static size_t ASGraphicsGetAlignedBytesPerRow(size_t baseValue) { #pragma mark - Graphics Contexts -extern void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) +AS_EXTERN void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) { if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) { UIGraphicsBeginImageContextWithOptions(size, opaque, scale); @@ -106,7 +106,7 @@ extern void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGF CGContextRelease(context); } -extern UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext() NS_RETURNS_RETAINED +AS_EXTERN UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext() NS_RETURNS_RETAINED { if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) { UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); @@ -160,7 +160,7 @@ extern void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGF return result; } -extern void ASGraphicsEndImageContext() +AS_EXTERN void ASGraphicsEndImageContext() { if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) { UIGraphicsEndImageContext(); diff --git a/Source/Details/ASHashing.h b/Source/Details/ASHashing.h index 0fc8d72ff..6177a74fe 100644 --- a/Source/Details/ASHashing.h +++ b/Source/Details/ASHashing.h @@ -14,7 +14,6 @@ #import NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN /** * When std::hash is unavailable, this function will hash a bucket o' bits real fast. @@ -40,7 +39,6 @@ ASDISPLAYNODE_EXTERN_C_BEGIN * use `pragma clang diagnostic warning "-Wpadded"` around your struct definition * or manually initialize the fields of your struct (`myStruct.x = 7;` etc). */ -NSUInteger ASHashBytes(void *bytes, size_t length); +AS_EXTERN NSUInteger ASHashBytes(void *bytes, size_t length); -ASDISPLAYNODE_EXTERN_C_END NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASLayoutController.h b/Source/Details/ASLayoutController.h index dacaf09c6..3e8aa6dce 100644 --- a/Source/Details/ASLayoutController.h +++ b/Source/Details/ASLayoutController.h @@ -25,16 +25,12 @@ NS_ASSUME_NONNULL_BEGIN @class ASCollectionElement, ASElementMap; -ASDISPLAYNODE_EXTERN_C_BEGIN - struct ASDirectionalScreenfulBuffer { CGFloat positiveDirection; // Positive relative to iOS Core Animation layer coordinate space. CGFloat negativeDirection; }; typedef struct ASDirectionalScreenfulBuffer ASDirectionalScreenfulBuffer; -ASDISPLAYNODE_EXTERN_C_END - @protocol ASLayoutController - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType; diff --git a/Source/Details/ASLayoutRangeType.h b/Source/Details/ASLayoutRangeType.h index 2f2be5206..421dc995f 100644 --- a/Source/Details/ASLayoutRangeType.h +++ b/Source/Details/ASLayoutRangeType.h @@ -23,9 +23,9 @@ typedef struct { CGFloat trailingBufferScreenfuls; } ASRangeTuningParameters; -FOUNDATION_EXPORT ASRangeTuningParameters const ASRangeTuningParametersZero; +AS_EXTERN ASRangeTuningParameters const ASRangeTuningParametersZero; -FOUNDATION_EXPORT BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs); +AS_EXTERN BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs); /** * Each mode has a complete set of tuning parameters for range types. diff --git a/Source/Details/ASObjectDescriptionHelpers.h b/Source/Details/ASObjectDescriptionHelpers.h index c4ae0ec35..c3eb7053e 100644 --- a/Source/Details/ASObjectDescriptionHelpers.h +++ b/Source/Details/ASObjectDescriptionHelpers.h @@ -52,15 +52,13 @@ NS_ASSUME_NONNULL_BEGIN - (NSMutableArray *)propertiesForDescription; @end -ASDISPLAYNODE_EXTERN_C_BEGIN - -NSString *ASGetDescriptionValueString(id object); +AS_EXTERN NSString *ASGetDescriptionValueString(id object); /// Useful for structs etc. Returns e.g. { position = (0 0); frame = (0 0; 50 50) } -NSString *ASObjectDescriptionMakeWithoutObject(NSArray * _Nullable propertyGroups); +AS_EXTERN NSString *ASObjectDescriptionMakeWithoutObject(NSArray * _Nullable propertyGroups); /// Returns e.g. -NSString *ASObjectDescriptionMake(__autoreleasing id object, NSArray * _Nullable propertyGroups); +AS_EXTERN NSString *ASObjectDescriptionMake(__autoreleasing id object, NSArray * _Nullable propertyGroups); /** * Returns e.g. @@ -68,10 +66,8 @@ NSString *ASObjectDescriptionMake(__autoreleasing id object, NSArray -extern ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) +AS_EXTERN ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) { // Add 1 to the end result because 0 is not accepted by NSArray and NSMapTable. // To avoid overflow after adding, x and y can't be UINT16_MAX (0xFFFF) **at the same time**. @@ -22,29 +22,29 @@ extern ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) return (x << 16) + y + 1; } -extern ASPageCoordinate ASPageCoordinateForPageThatContainsPoint(CGPoint point, CGSize pageSize) +AS_EXTERN ASPageCoordinate ASPageCoordinateForPageThatContainsPoint(CGPoint point, CGSize pageSize) { return ASPageCoordinateMake((MAX(0.0, point.x) / pageSize.width), (MAX(0.0, point.y) / pageSize.height)); } -extern uint16_t ASPageCoordinateGetX(ASPageCoordinate pageCoordinate) +AS_EXTERN uint16_t ASPageCoordinateGetX(ASPageCoordinate pageCoordinate) { return (pageCoordinate - 1) >> 16; } -extern uint16_t ASPageCoordinateGetY(ASPageCoordinate pageCoordinate) +AS_EXTERN uint16_t ASPageCoordinateGetY(ASPageCoordinate pageCoordinate) { return (pageCoordinate - 1) & ~(0xFFFF<<16); } -extern CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSize pageSize) +AS_EXTERN CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSize pageSize) { CGFloat pageWidth = pageSize.width; CGFloat pageHeight = pageSize.height; return CGRectMake(ASPageCoordinateGetX(pageCoordinate) * pageWidth, ASPageCoordinateGetY(pageCoordinate) * pageHeight, pageWidth, pageHeight); } -extern NSPointerArray *ASPageCoordinatesForPagesThatIntersectRect(CGRect rect, CGSize contentSize, CGSize pageSize) +AS_EXTERN NSPointerArray *ASPageCoordinatesForPagesThatIntersectRect(CGRect rect, CGSize contentSize, CGSize pageSize) { CGRect contentRect = CGRectMake(0.0, 0.0, contentSize.width, contentSize.height); // Make sure the specified rect is within contentRect diff --git a/Source/Details/ASPhotosFrameworkImageRequest.h b/Source/Details/ASPhotosFrameworkImageRequest.h index 4efde4ff9..d11992233 100644 --- a/Source/Details/ASPhotosFrameworkImageRequest.h +++ b/Source/Details/ASPhotosFrameworkImageRequest.h @@ -17,10 +17,11 @@ #import #import +#import NS_ASSUME_NONNULL_BEGIN -extern NSString *const ASPhotosURLScheme; +AS_EXTERN NSString *const ASPhotosURLScheme; /** @abstract Use ASPhotosFrameworkImageRequest to encapsulate all the information needed to request an image from diff --git a/Source/Details/ASRecursiveUnfairLock.h b/Source/Details/ASRecursiveUnfairLock.h index fff42b59c..3b5ef11de 100644 --- a/Source/Details/ASRecursiveUnfairLock.h +++ b/Source/Details/ASRecursiveUnfairLock.h @@ -11,6 +11,7 @@ // #import +#import #import #import @@ -32,18 +33,16 @@ typedef struct { int _count; // Protected by lock } ASRecursiveUnfairLock; -CF_EXTERN_C_BEGIN - /** * Lock, blocking if needed. */ -OS_UNFAIR_LOCK_AVAILABILITY +AS_EXTERN OS_UNFAIR_LOCK_AVAILABILITY void ASRecursiveUnfairLockLock(ASRecursiveUnfairLock *l); /** * Try to lock without blocking. Returns whether we took the lock. */ -OS_UNFAIR_LOCK_AVAILABILITY +AS_EXTERN OS_UNFAIR_LOCK_AVAILABILITY BOOL ASRecursiveUnfairLockTryLock(ASRecursiveUnfairLock *l); /** @@ -51,9 +50,7 @@ BOOL ASRecursiveUnfairLockTryLock(ASRecursiveUnfairLock *l); * the lock will result in an assertion failure, and undefined * behavior if foundation assertions are disabled. */ -OS_UNFAIR_LOCK_AVAILABILITY +AS_EXTERN OS_UNFAIR_LOCK_AVAILABILITY void ASRecursiveUnfairLockUnlock(ASRecursiveUnfairLock *l); -CF_EXTERN_C_END - NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASScrollDirection.h b/Source/Details/ASScrollDirection.h index 373e22f97..6a89b6f09 100644 --- a/Source/Details/ASScrollDirection.h +++ b/Source/Details/ASScrollDirection.h @@ -30,20 +30,16 @@ typedef NS_OPTIONS(NSInteger, ASScrollDirection) { ASScrollDirectionDown = 1 << 3 }; -extern const ASScrollDirection ASScrollDirectionHorizontalDirections; -extern const ASScrollDirection ASScrollDirectionVerticalDirections; +AS_EXTERN const ASScrollDirection ASScrollDirectionHorizontalDirections; +AS_EXTERN const ASScrollDirection ASScrollDirectionVerticalDirections; -ASDISPLAYNODE_EXTERN_C_BEGIN +AS_EXTERN BOOL ASScrollDirectionContainsVerticalDirection(ASScrollDirection scrollDirection); +AS_EXTERN BOOL ASScrollDirectionContainsHorizontalDirection(ASScrollDirection scrollDirection); -BOOL ASScrollDirectionContainsVerticalDirection(ASScrollDirection scrollDirection); -BOOL ASScrollDirectionContainsHorizontalDirection(ASScrollDirection scrollDirection); - -BOOL ASScrollDirectionContainsRight(ASScrollDirection scrollDirection); -BOOL ASScrollDirectionContainsLeft(ASScrollDirection scrollDirection); -BOOL ASScrollDirectionContainsUp(ASScrollDirection scrollDirection); -BOOL ASScrollDirectionContainsDown(ASScrollDirection scrollDirection); -ASScrollDirection ASScrollDirectionApplyTransform(ASScrollDirection scrollDirection, CGAffineTransform transform); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN BOOL ASScrollDirectionContainsRight(ASScrollDirection scrollDirection); +AS_EXTERN BOOL ASScrollDirectionContainsLeft(ASScrollDirection scrollDirection); +AS_EXTERN BOOL ASScrollDirectionContainsUp(ASScrollDirection scrollDirection); +AS_EXTERN BOOL ASScrollDirectionContainsDown(ASScrollDirection scrollDirection); +AS_EXTERN ASScrollDirection ASScrollDirectionApplyTransform(ASScrollDirection scrollDirection, CGAffineTransform transform); NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASTraitCollection.h b/Source/Details/ASTraitCollection.h index fbea570c0..bd0ce1b9d 100644 --- a/Source/Details/ASTraitCollection.h +++ b/Source/Details/ASTraitCollection.h @@ -26,8 +26,6 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN - #pragma mark - ASPrimitiveContentSizeCategory /** @@ -54,7 +52,7 @@ typedef __unsafe_unretained UIContentSizeCategory ASPrimitiveContentSizeCategory * * @return a pointer to one of the UIContentSizeCategory constants. */ -extern ASPrimitiveContentSizeCategory ASPrimitiveContentSizeCategoryMake(UIContentSizeCategory sizeCategory); +AS_EXTERN ASPrimitiveContentSizeCategory ASPrimitiveContentSizeCategoryMake(UIContentSizeCategory sizeCategory); #pragma mark - ASPrimitiveTraitCollection @@ -88,31 +86,29 @@ typedef struct ASPrimitiveTraitCollection { /** * Creates ASPrimitiveTraitCollection with default values. */ -extern ASPrimitiveTraitCollection ASPrimitiveTraitCollectionMakeDefault(void); +AS_EXTERN ASPrimitiveTraitCollection ASPrimitiveTraitCollectionMakeDefault(void); /** * Creates a ASPrimitiveTraitCollection from a given UITraitCollection. */ -extern ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITraitCollection *traitCollection); +AS_EXTERN ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITraitCollection *traitCollection); /** * Compares two ASPrimitiveTraitCollection to determine if they are the same. */ -extern BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTraitCollection lhs, ASPrimitiveTraitCollection rhs); +AS_EXTERN BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTraitCollection lhs, ASPrimitiveTraitCollection rhs); /** * Returns a string representation of a ASPrimitiveTraitCollection. */ -extern NSString *NSStringFromASPrimitiveTraitCollection(ASPrimitiveTraitCollection traits); +AS_EXTERN NSString *NSStringFromASPrimitiveTraitCollection(ASPrimitiveTraitCollection traits); /** * This function will walk the layout element hierarchy and updates the layout element trait collection for every * layout element within the hierarchy. */ -extern void ASTraitCollectionPropagateDown(id element, ASPrimitiveTraitCollection traitCollection); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void ASTraitCollectionPropagateDown(id element, ASPrimitiveTraitCollection traitCollection); /** * Abstraction on top of UITraitCollection for propagation within AsyncDisplayKit-Layout diff --git a/Source/Details/ASTraitCollection.m b/Source/Details/ASTraitCollection.m index 9b1902c9c..bdf897f2f 100644 --- a/Source/Details/ASTraitCollection.m +++ b/Source/Details/ASTraitCollection.m @@ -80,7 +80,7 @@ ASPrimitiveContentSizeCategory ASPrimitiveContentSizeCategoryMake(UIContentSizeC #pragma mark - ASPrimitiveTraitCollection -extern void ASTraitCollectionPropagateDown(id element, ASPrimitiveTraitCollection traitCollection) { +AS_EXTERN void ASTraitCollectionPropagateDown(id element, ASPrimitiveTraitCollection traitCollection) { if (element) { element.primitiveTraitCollection = traitCollection; } diff --git a/Source/Details/CoreGraphics+ASConvenience.h b/Source/Details/CoreGraphics+ASConvenience.h index d4ec5ce02..9eeef3192 100644 --- a/Source/Details/CoreGraphics+ASConvenience.h +++ b/Source/Details/CoreGraphics+ASConvenience.h @@ -33,8 +33,6 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN - ASDISPLAYNODE_INLINE CGFloat ASCGFloatFromString(NSString *string) { #if CGFLOAT_IS_DOUBLE @@ -58,6 +56,4 @@ ASDISPLAYNODE_INLINE BOOL CGSizeEqualToSizeWithIn(CGSize size1, CGSize size2, CG return fabs(size1.width - size2.width) < delta && fabs(size1.height - size2.height) < delta; }; -ASDISPLAYNODE_EXTERN_C_END - NS_ASSUME_NONNULL_END diff --git a/Source/Details/Transactions/_ASAsyncTransaction.h b/Source/Details/Transactions/_ASAsyncTransaction.h index ffcc7565d..f22de659b 100644 --- a/Source/Details/Transactions/_ASAsyncTransaction.h +++ b/Source/Details/Transactions/_ASAsyncTransaction.h @@ -16,6 +16,7 @@ // #import +#import NS_ASSUME_NONNULL_BEGIN @@ -39,7 +40,7 @@ typedef NS_ENUM(NSUInteger, ASAsyncTransactionState) { ASAsyncTransactionStateComplete }; -extern NSInteger const ASDefaultTransactionPriority; +AS_EXTERN NSInteger const ASDefaultTransactionPriority; /** @summary ASAsyncTransaction provides lightweight transaction semantics for asynchronous operations. diff --git a/Source/Layout/ASDimension.h b/Source/Layout/ASDimension.h index 851f519e3..462406eed 100644 --- a/Source/Layout/ASDimension.h +++ b/Source/Layout/ASDimension.h @@ -21,7 +21,6 @@ #import #import -ASDISPLAYNODE_EXTERN_C_BEGIN NS_ASSUME_NONNULL_BEGIN #pragma mark - @@ -90,7 +89,7 @@ typedef struct { /** * Represents auto as ASDimension */ -extern ASDimension const ASDimensionAuto; +AS_EXTERN ASDimension const ASDimensionAuto; /** * Returns a dimension with the specified type and value. @@ -123,7 +122,7 @@ ASOVERLOADABLE ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensio * Examples: ASDimensionMake(@"50%") = ASDimensionMake(ASDimensionUnitFraction, 0.5) * ASDimensionMake(@"0.5pt") = ASDimensionMake(ASDimensionUnitPoints, 0.5) */ -ASOVERLOADABLE AS_WARN_UNUSED_RESULT extern ASDimension ASDimensionMake(NSString *dimension); +ASOVERLOADABLE AS_WARN_UNUSED_RESULT AS_EXTERN ASDimension ASDimensionMake(NSString *dimension); /** * Returns a dimension with the specified points value. @@ -154,7 +153,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASDimensionEqualToDimension(ASDi /** * Returns a NSString representation of a dimension. */ -extern AS_WARN_UNUSED_RESULT NSString *NSStringFromASDimension(ASDimension dimension); +AS_EXTERN AS_WARN_UNUSED_RESULT NSString *NSStringFromASDimension(ASDimension dimension); /** * Resolve this dimension to a parent size. @@ -181,7 +180,7 @@ typedef struct { ASDimension height; } ASLayoutSize; -extern ASLayoutSize const ASLayoutSizeAuto; +AS_EXTERN ASLayoutSize const ASLayoutSizeAuto; /* * Creates an ASLayoutSize with provided min and max dimensions. @@ -226,12 +225,12 @@ typedef struct { /** * A size range with all dimensions zero. */ -extern ASSizeRange const ASSizeRangeZero; +AS_EXTERN ASSizeRange const ASSizeRangeZero; /** * A size range from zero to infinity in both directions. */ -extern ASSizeRange const ASSizeRangeUnconstrained; +AS_EXTERN ASSizeRange const ASSizeRangeUnconstrained; /** * Returns whether a size range has > 0.1 max width and max height. @@ -282,7 +281,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT CGSize ASSizeRangeClamp(ASSizeRange s * Intersects another size range. If the other size range does not overlap in either dimension, this size range * "wins" by returning a single point within its own range that is closest to the non-overlapping range. */ -extern AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeIntersect(ASSizeRange sizeRange, ASSizeRange otherSizeRange); +AS_EXTERN AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeIntersect(ASSizeRange sizeRange, ASSizeRange otherSizeRange); /** * Returns whether two size ranges are equal in min and max size. @@ -295,7 +294,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASSizeRangeEqualToSizeRange(ASSi /** * Returns a string representation of a size range */ -extern AS_WARN_UNUSED_RESULT NSString *NSStringFromASSizeRange(ASSizeRange sizeRange); +AS_EXTERN AS_WARN_UNUSED_RESULT NSString *NSStringFromASSizeRange(ASSizeRange sizeRange); #if YOGA @@ -313,11 +312,10 @@ typedef struct { ASDimension all; } ASEdgeInsets; -extern ASEdgeInsets const ASEdgeInsetsZero; +AS_EXTERN ASEdgeInsets const ASEdgeInsetsZero; -extern ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets); +AS_EXTERN ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets); #endif NS_ASSUME_NONNULL_END -ASDISPLAYNODE_EXTERN_C_END diff --git a/Source/Layout/ASDimension.mm b/Source/Layout/ASDimension.mm index 2a9ccbbb3..2c541bbfe 100644 --- a/Source/Layout/ASDimension.mm +++ b/Source/Layout/ASDimension.mm @@ -121,7 +121,7 @@ ASSizeRange ASSizeRangeIntersect(ASSizeRange sizeRange, ASSizeRange otherSizeRan #pragma mark - Yoga - ASEdgeInsets ASEdgeInsets const ASEdgeInsetsZero = {}; -extern ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets) +AS_EXTERN ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets) { ASEdgeInsets asEdgeInsets = ASEdgeInsetsZero; asEdgeInsets.top = ASDimensionMake(edgeInsets.top); diff --git a/Source/Layout/ASDimensionInternal.h b/Source/Layout/ASDimensionInternal.h index 080500bc1..c853f425b 100644 --- a/Source/Layout/ASDimensionInternal.h +++ b/Source/Layout/ASDimensionInternal.h @@ -15,11 +15,9 @@ // http://www.apache.org/licenses/LICENSE-2.0 // -#pragma once #import #import -ASDISPLAYNODE_EXTERN_C_BEGIN NS_ASSUME_NONNULL_BEGIN #pragma mark - ASLayoutElementSize @@ -87,7 +85,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutElementSizeEqualToLayout /** * Returns a string formatted to contain the data from an ASLayoutElementSize. */ -extern AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutElementSize(ASLayoutElementSize size); +AS_EXTERN AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutElementSize(ASLayoutElementSize size); /** * Resolve the given size relative to a parent size and an auto size. @@ -96,7 +94,7 @@ extern AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutElementSize(ASLayoutE * dimension with unit ASDimensionUnitAuto the given autoASSizeRange value will be used. * Based on the calculated exact, min and max size constraints the final size range will be calculated. */ -extern AS_WARN_UNUSED_RESULT ASSizeRange ASLayoutElementSizeResolveAutoSize(ASLayoutElementSize size, const CGSize parentSize, ASSizeRange autoASSizeRange); +AS_EXTERN AS_WARN_UNUSED_RESULT ASSizeRange ASLayoutElementSizeResolveAutoSize(ASLayoutElementSize size, const CGSize parentSize, ASSizeRange autoASSizeRange); /** * Resolve the given size to a parent size. Uses internally ASLayoutElementSizeResolveAutoSize with {INFINITY, INFINITY} as @@ -109,4 +107,3 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASLayoutElementSizeResolv NS_ASSUME_NONNULL_END -ASDISPLAYNODE_EXTERN_C_END diff --git a/Source/Layout/ASLayout.h b/Source/Layout/ASLayout.h index 829dc4622..6e0841b3a 100644 --- a/Source/Layout/ASLayout.h +++ b/Source/Layout/ASLayout.h @@ -22,18 +22,16 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN +AS_EXTERN CGPoint const ASPointNull; // {NAN, NAN} -extern CGPoint const ASPointNull; // {NAN, NAN} - -extern BOOL ASPointIsNull(CGPoint point); +AS_EXTERN BOOL ASPointIsNull(CGPoint point); /** * Safely calculates the layout of the given root layoutElement by guarding against nil nodes. * @param rootLayoutElement The root node to calculate the layout for. * @param sizeRange The size range to calculate the root layout within. */ -extern ASLayout *ASCalculateRootLayout(id rootLayoutElement, const ASSizeRange sizeRange); +AS_EXTERN ASLayout *ASCalculateRootLayout(id rootLayoutElement, const ASSizeRange sizeRange); /** * Safely computes the layout of the given node by guarding against nil nodes. @@ -41,9 +39,7 @@ extern ASLayout *ASCalculateRootLayout(id rootLayoutElement, co * @param sizeRange The size range to calculate the node layout within. * @param parentSize The parent size of the node to calculate the layout for. */ -extern ASLayout *ASCalculateLayout(idlayoutElement, const ASSizeRange sizeRange, const CGSize parentSize); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN ASLayout *ASCalculateLayout(idlayoutElement, const ASSizeRange sizeRange, const CGSize parentSize); /** * A node in the layout tree that represents the size and position of the object that created it (ASLayoutElement). diff --git a/Source/Layout/ASLayout.mm b/Source/Layout/ASLayout.mm index 2400fa416..6a5ab6fe2 100644 --- a/Source/Layout/ASLayout.mm +++ b/Source/Layout/ASLayout.mm @@ -30,7 +30,7 @@ CGPoint const ASPointNull = {NAN, NAN}; -extern BOOL ASPointIsNull(CGPoint point) +AS_EXTERN BOOL ASPointIsNull(CGPoint point) { return isnan(point.x) && isnan(point.y); } diff --git a/Source/Layout/ASLayoutElement.h b/Source/Layout/ASLayoutElement.h index 0d35fe678..417550aa0 100644 --- a/Source/Layout/ASLayoutElement.h +++ b/Source/Layout/ASLayoutElement.h @@ -33,10 +33,10 @@ NS_ASSUME_NONNULL_BEGIN /** A constant that indicates that the parent's size is not yet determined in a given dimension. */ -extern CGFloat const ASLayoutElementParentDimensionUndefined; +AS_EXTERN CGFloat const ASLayoutElementParentDimensionUndefined; /** A constant that indicates that the parent's size is not yet determined in either dimension. */ -extern CGSize const ASLayoutElementParentSizeUndefined; +AS_EXTERN CGSize const ASLayoutElementParentSizeUndefined; /** Type of ASLayoutElement */ typedef NS_ENUM(NSUInteger, ASLayoutElementType) { @@ -152,24 +152,24 @@ typedef NS_ENUM(NSUInteger, ASLayoutElementType) { #pragma mark - ASLayoutElementStyle -extern NSString * const ASLayoutElementStyleWidthProperty; -extern NSString * const ASLayoutElementStyleMinWidthProperty; -extern NSString * const ASLayoutElementStyleMaxWidthProperty; +AS_EXTERN NSString * const ASLayoutElementStyleWidthProperty; +AS_EXTERN NSString * const ASLayoutElementStyleMinWidthProperty; +AS_EXTERN NSString * const ASLayoutElementStyleMaxWidthProperty; -extern NSString * const ASLayoutElementStyleHeightProperty; -extern NSString * const ASLayoutElementStyleMinHeightProperty; -extern NSString * const ASLayoutElementStyleMaxHeightProperty; +AS_EXTERN NSString * const ASLayoutElementStyleHeightProperty; +AS_EXTERN NSString * const ASLayoutElementStyleMinHeightProperty; +AS_EXTERN NSString * const ASLayoutElementStyleMaxHeightProperty; -extern NSString * const ASLayoutElementStyleSpacingBeforeProperty; -extern NSString * const ASLayoutElementStyleSpacingAfterProperty; -extern NSString * const ASLayoutElementStyleFlexGrowProperty; -extern NSString * const ASLayoutElementStyleFlexShrinkProperty; -extern NSString * const ASLayoutElementStyleFlexBasisProperty; -extern NSString * const ASLayoutElementStyleAlignSelfProperty; -extern NSString * const ASLayoutElementStyleAscenderProperty; -extern NSString * const ASLayoutElementStyleDescenderProperty; +AS_EXTERN NSString * const ASLayoutElementStyleSpacingBeforeProperty; +AS_EXTERN NSString * const ASLayoutElementStyleSpacingAfterProperty; +AS_EXTERN NSString * const ASLayoutElementStyleFlexGrowProperty; +AS_EXTERN NSString * const ASLayoutElementStyleFlexShrinkProperty; +AS_EXTERN NSString * const ASLayoutElementStyleFlexBasisProperty; +AS_EXTERN NSString * const ASLayoutElementStyleAlignSelfProperty; +AS_EXTERN NSString * const ASLayoutElementStyleAscenderProperty; +AS_EXTERN NSString * const ASLayoutElementStyleDescenderProperty; -extern NSString * const ASLayoutElementStyleLayoutPositionProperty; +AS_EXTERN NSString * const ASLayoutElementStyleLayoutPositionProperty; @protocol ASLayoutElementStyleDelegate - (void)style:(__kindof ASLayoutElementStyle *)style propertyDidChange:(NSString *)propertyName; diff --git a/Source/Layout/ASLayoutElementPrivate.h b/Source/Layout/ASLayoutElementPrivate.h index 96c520e5d..263b2f84d 100644 --- a/Source/Layout/ASLayoutElementPrivate.h +++ b/Source/Layout/ASLayoutElementPrivate.h @@ -30,16 +30,16 @@ AS_SUBCLASSING_RESTRICTED @property (nonatomic) int32_t transitionID; @end -extern int32_t const ASLayoutElementContextInvalidTransitionID; +AS_EXTERN int32_t const ASLayoutElementContextInvalidTransitionID; -extern int32_t const ASLayoutElementContextDefaultTransitionID; +AS_EXTERN int32_t const ASLayoutElementContextDefaultTransitionID; // Does not currently support nesting – there must be no current context. -extern void ASLayoutElementPushContext(ASLayoutElementContext * context); +AS_EXTERN void ASLayoutElementPushContext(ASLayoutElementContext * context); -extern ASLayoutElementContext * _Nullable ASLayoutElementGetCurrentContext(void); +AS_EXTERN ASLayoutElementContext * _Nullable ASLayoutElementGetCurrentContext(void); -extern void ASLayoutElementPopContext(void); +AS_EXTERN void ASLayoutElementPopContext(void); NS_ASSUME_NONNULL_END diff --git a/Source/Layout/ASYogaUtilities.h b/Source/Layout/ASYogaUtilities.h index b229b3435..aac1eaf24 100644 --- a/Source/Layout/ASYogaUtilities.h +++ b/Source/Layout/ASYogaUtilities.h @@ -30,25 +30,23 @@ @end -extern void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)); - -ASDISPLAYNODE_EXTERN_C_BEGIN +AS_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)); #pragma mark - Yoga Type Conversion Helpers -YGAlign yogaAlignItems(ASStackLayoutAlignItems alignItems); -YGJustify yogaJustifyContent(ASStackLayoutJustifyContent justifyContent); -YGAlign yogaAlignSelf(ASStackLayoutAlignSelf alignSelf); -YGFlexDirection yogaFlexDirection(ASStackLayoutDirection direction); -float yogaFloatForCGFloat(CGFloat value); -float yogaDimensionToPoints(ASDimension dimension); -float yogaDimensionToPercent(ASDimension dimension); -ASDimension dimensionForEdgeWithEdgeInsets(YGEdge edge, ASEdgeInsets insets); +AS_EXTERN YGAlign yogaAlignItems(ASStackLayoutAlignItems alignItems); +AS_EXTERN YGJustify yogaJustifyContent(ASStackLayoutJustifyContent justifyContent); +AS_EXTERN YGAlign yogaAlignSelf(ASStackLayoutAlignSelf alignSelf); +AS_EXTERN YGFlexDirection yogaFlexDirection(ASStackLayoutDirection direction); +AS_EXTERN float yogaFloatForCGFloat(CGFloat value); +AS_EXTERN float yogaDimensionToPoints(ASDimension dimension); +AS_EXTERN float yogaDimensionToPercent(ASDimension dimension); +AS_EXTERN ASDimension dimensionForEdgeWithEdgeInsets(YGEdge edge, ASEdgeInsets insets); -void ASLayoutElementYogaUpdateMeasureFunc(YGNodeRef yogaNode, id layoutElement); -YGSize ASLayoutElementYogaMeasureFunc(YGNodeRef yogaNode, - float width, YGMeasureMode widthMode, - float height, YGMeasureMode heightMode); +AS_EXTERN void ASLayoutElementYogaUpdateMeasureFunc(YGNodeRef yogaNode, id layoutElement); +AS_EXTERN YGSize ASLayoutElementYogaMeasureFunc(YGNodeRef yogaNode, + float width, YGMeasureMode widthMode, + float height, YGMeasureMode heightMode); #pragma mark - Yoga Style Setter Helpers @@ -79,6 +77,4 @@ YGSize ASLayoutElementYogaMeasureFunc(YGNodeRef yogaNode, YGNodeStyleSet##property(yogaNode, edge, YGUndefined); \ } \ -ASDISPLAYNODE_EXTERN_C_END - #endif /* YOGA */ diff --git a/Source/Layout/ASYogaUtilities.mm b/Source/Layout/ASYogaUtilities.mm index 566f5c3f7..8812e027b 100644 --- a/Source/Layout/ASYogaUtilities.mm +++ b/Source/Layout/ASYogaUtilities.mm @@ -47,7 +47,7 @@ + (ASDisplayNode *)yogaHorizontalStack @end -extern void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) +AS_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) { if (node == nil) { return; diff --git a/Source/Private/ASBatchFetching.h b/Source/Private/ASBatchFetching.h index 7ff4eb06d..39d18353d 100644 --- a/Source/Private/ASBatchFetching.h +++ b/Source/Private/ASBatchFetching.h @@ -19,8 +19,6 @@ #import -ASDISPLAYNODE_EXTERN_C_BEGIN - NS_ASSUME_NONNULL_BEGIN @class ASBatchContext; @@ -46,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN @param velocity The velocity of the scroll view (in points) at the moment the touch was released. @return Whether or not the current state should proceed with batch fetching. */ -BOOL ASDisplayShouldFetchBatchForScrollView(UIScrollView *scrollView, +AS_EXTERN BOOL ASDisplayShouldFetchBatchForScrollView(UIScrollView *scrollView, ASScrollDirection scrollDirection, ASScrollDirection scrollableDirections, CGPoint contentOffset, @@ -69,7 +67,7 @@ BOOL ASDisplayShouldFetchBatchForScrollView(UIScrollView delegate); NS_ASSUME_NONNULL_END -ASDISPLAYNODE_EXTERN_C_END diff --git a/Source/Private/ASCollectionLayoutDefines.h b/Source/Private/ASCollectionLayoutDefines.h index 07be880a0..3c05cae4a 100644 --- a/Source/Private/ASCollectionLayoutDefines.h +++ b/Source/Private/ASCollectionLayoutDefines.h @@ -18,10 +18,6 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN - -FOUNDATION_EXPORT ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) AS_WARN_UNUSED_RESULT; - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) AS_WARN_UNUSED_RESULT; NS_ASSUME_NONNULL_END diff --git a/Source/Private/ASCollectionLayoutDefines.m b/Source/Private/ASCollectionLayoutDefines.m index b8c9c21cc..bfa58aa5d 100644 --- a/Source/Private/ASCollectionLayoutDefines.m +++ b/Source/Private/ASCollectionLayoutDefines.m @@ -12,7 +12,7 @@ #import -extern ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) +AS_EXTERN ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) { ASSizeRange sizeRange = ASSizeRangeUnconstrained; if (ASScrollDirectionContainsVerticalDirection(scrollableDirections) == NO) { diff --git a/Source/Private/ASDispatch.h b/Source/Private/ASDispatch.h index 4f2a1cda9..22893aba0 100644 --- a/Source/Private/ASDispatch.h +++ b/Source/Private/ASDispatch.h @@ -18,15 +18,13 @@ #import #import -ASDISPLAYNODE_EXTERN_C_BEGIN - /** * Like dispatch_apply, but you can set the thread count. 0 means 2*active CPUs. * * Note: The actual number of threads may be lower than threadCount, if libdispatch * decides the system can't handle it. In reality this rarely happens. */ -void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)); +AS_EXTERN void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)); /** * Like dispatch_async, but you can set the thread count. 0 means 2*active CPUs. @@ -34,6 +32,4 @@ void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger t * Note: The actual number of threads may be lower than threadCount, if libdispatch * decides the system can't handle it. In reality this rarely happens. */ -void ASDispatchAsync(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void ASDispatchAsync(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)); diff --git a/Source/Private/ASDisplayNodeInternal.h b/Source/Private/ASDisplayNodeInternal.h index 4f509fb5f..18c93f103 100644 --- a/Source/Private/ASDisplayNodeInternal.h +++ b/Source/Private/ASDisplayNodeInternal.h @@ -65,8 +65,8 @@ typedef NS_OPTIONS(uint_least32_t, ASDisplayNodeAtomicFlags) #define setFlag(flag, x) (((x ? _atomicFlags.fetch_or(flag) \ : _atomicFlags.fetch_and(~flag)) & flag) != 0) -FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayScheduledNodesNotification; -FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp; +AS_EXTERN NSString * const ASRenderingEngineDidDisplayScheduledNodesNotification; +AS_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp; // Allow 2^n increments of begin disabling hierarchy notifications #define VISIBILITY_NOTIFICATIONS_DISABLED_BITS 4 diff --git a/Source/Private/ASImageNode+AnimatedImagePrivate.h b/Source/Private/ASImageNode+AnimatedImagePrivate.h index f77ee1f9b..c6a2f1771 100644 --- a/Source/Private/ASImageNode+AnimatedImagePrivate.h +++ b/Source/Private/ASImageNode+AnimatedImagePrivate.h @@ -17,7 +17,7 @@ #import -extern NSString *const ASAnimatedImageDefaultRunLoopMode; +AS_EXTERN NSString *const ASAnimatedImageDefaultRunLoopMode; @interface ASImageNode () { diff --git a/Source/Private/ASImageNode+CGExtras.h b/Source/Private/ASImageNode+CGExtras.h index f62380cd0..187f4833b 100644 --- a/Source/Private/ASImageNode+CGExtras.h +++ b/Source/Private/ASImageNode+CGExtras.h @@ -18,9 +18,6 @@ #import #import -ASDISPLAYNODE_EXTERN_C_BEGIN - - /** @abstract Decides how to scale and crop an image to fit in the provided size, while not wasting memory by upscaling images @param sourceImageSize The size of the encoded image. @@ -31,7 +28,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN @param forcedSize A CGSize, that if non-CGSizeZero, indicates that the backing size should be forcedSize and not calculated based on boundsSize. @discussion If the image is smaller than the size and UIViewContentModeScaleToAspectFill is specified, we suggest the input size so it will be efficiently upscaled on the GPU by the displaying layer at composite time. */ -extern void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize, +AS_EXTERN void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize, CGSize boundsSize, UIViewContentMode contentMode, CGRect cropRect, @@ -40,5 +37,3 @@ extern void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize, CGSize *outBackingSize, CGRect *outDrawRect ); - -ASDISPLAYNODE_EXTERN_C_END diff --git a/Source/Private/ASInternalHelpers.h b/Source/Private/ASInternalHelpers.h index 7bfca7242..537ba4a61 100644 --- a/Source/Private/ASInternalHelpers.h +++ b/Source/Private/ASInternalHelpers.h @@ -23,45 +23,41 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN +AS_EXTERN void ASInitializeFrameworkMainThread(void); -void ASInitializeFrameworkMainThread(void); +AS_EXTERN BOOL ASDefaultAllowsGroupOpacity(void); +AS_EXTERN BOOL ASDefaultAllowsEdgeAntialiasing(void); -BOOL ASDefaultAllowsGroupOpacity(void); -BOOL ASDefaultAllowsEdgeAntialiasing(void); - -BOOL ASSubclassOverridesSelector(Class superclass, Class subclass, SEL selector); -BOOL ASSubclassOverridesClassSelector(Class superclass, Class subclass, SEL selector); +AS_EXTERN BOOL ASSubclassOverridesSelector(Class superclass, Class subclass, SEL selector); +AS_EXTERN BOOL ASSubclassOverridesClassSelector(Class superclass, Class subclass, SEL selector); /// Replace a method from the given class with a block and returns the original method IMP -IMP ASReplaceMethodWithBlock(Class c, SEL origSEL, id block); +AS_EXTERN IMP ASReplaceMethodWithBlock(Class c, SEL origSEL, id block); /// Dispatches the given block to the main queue if not already running on the main thread -void ASPerformBlockOnMainThread(void (^block)(void)); +AS_EXTERN void ASPerformBlockOnMainThread(void (^block)(void)); /// Dispatches the given block to a background queue with priority of DISPATCH_QUEUE_PRIORITY_DEFAULT if not already run on a background queue -void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT +AS_EXTERN void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT /// For deallocation of objects on a background thread without GCD overhead / thread explosion -void ASPerformBackgroundDeallocation(id __strong _Nullable * _Nonnull object); - -CGFloat ASScreenScale(void); +AS_EXTERN void ASPerformBackgroundDeallocation(id __strong _Nullable * _Nonnull object); -CGSize ASFloorSizeValues(CGSize s); +AS_EXTERN CGFloat ASScreenScale(void); -CGFloat ASFloorPixelValue(CGFloat f); +AS_EXTERN CGSize ASFloorSizeValues(CGSize s); -CGPoint ASCeilPointValues(CGPoint p); +AS_EXTERN CGFloat ASFloorPixelValue(CGFloat f); -CGSize ASCeilSizeValues(CGSize s); +AS_EXTERN CGPoint ASCeilPointValues(CGPoint p); -CGFloat ASCeilPixelValue(CGFloat f); +AS_EXTERN CGSize ASCeilSizeValues(CGSize s); -CGFloat ASRoundPixelValue(CGFloat f); +AS_EXTERN CGFloat ASCeilPixelValue(CGFloat f); -Class _Nullable ASGetClassFromType(const char * _Nullable type); +AS_EXTERN CGFloat ASRoundPixelValue(CGFloat f); -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN Class _Nullable ASGetClassFromType(const char * _Nullable type); ASDISPLAYNODE_INLINE BOOL ASImageAlphaInfoIsOpaque(CGImageAlphaInfo info) { switch (info) { diff --git a/Source/Private/ASTwoDimensionalArrayUtils.h b/Source/Private/ASTwoDimensionalArrayUtils.h index 3c1d5c81a..ac9c9d92b 100644 --- a/Source/Private/ASTwoDimensionalArrayUtils.h +++ b/Source/Private/ASTwoDimensionalArrayUtils.h @@ -19,42 +19,36 @@ #import - NS_ASSUME_NONNULL_BEGIN /** - * Helper class for operation on two-dimensional array, where the objects of the root array are each arrays + * Helper functions for two-dimensional array, where the objects of the root array are each arrays. */ -ASDISPLAYNODE_EXTERN_C_BEGIN - /** * Deep mutable copy of an array that contains arrays, which contain objects. It will go one level deep into the array to copy. * This method is substantially faster than the generalized version, e.g. about 10x faster, so use it whenever it fits the need. */ -extern NSMutableArray *ASTwoDimensionalArrayDeepMutableCopy(NSArray *array) AS_WARN_UNUSED_RESULT; +AS_EXTERN NSMutableArray *ASTwoDimensionalArrayDeepMutableCopy(NSArray *array) AS_WARN_UNUSED_RESULT; /** * Delete the elements of the mutable two-dimensional array at given index paths – sorted in descending order! */ -extern void ASDeleteElementsInTwoDimensionalArrayAtIndexPaths(NSMutableArray *mutableArray, NSArray *indexPaths); +AS_EXTERN void ASDeleteElementsInTwoDimensionalArrayAtIndexPaths(NSMutableArray *mutableArray, NSArray *indexPaths); /** * Return all the index paths of a two-dimensional array, in ascending order. */ -extern NSArray *ASIndexPathsForTwoDimensionalArray(NSArray* twoDimensionalArray) AS_WARN_UNUSED_RESULT; +AS_EXTERN NSArray *ASIndexPathsForTwoDimensionalArray(NSArray* twoDimensionalArray) AS_WARN_UNUSED_RESULT; /** * Return all the elements of a two-dimensional array, in ascending order. */ -extern NSArray *ASElementsInTwoDimensionalArray(NSArray* twoDimensionalArray) AS_WARN_UNUSED_RESULT; +AS_EXTERN NSArray *ASElementsInTwoDimensionalArray(NSArray* twoDimensionalArray) AS_WARN_UNUSED_RESULT; /** * Attempt to get the object at the given index path. Returns @c nil if the index path is out of bounds. */ -extern id _Nullable ASGetElementInTwoDimensionalArray(NSArray *array, NSIndexPath *indexPath) AS_WARN_UNUSED_RESULT; - - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN id _Nullable ASGetElementInTwoDimensionalArray(NSArray *array, NSIndexPath *indexPath) AS_WARN_UNUSED_RESULT; NS_ASSUME_NONNULL_END diff --git a/Source/Private/Layout/ASStackUnpositionedLayout.h b/Source/Private/Layout/ASStackUnpositionedLayout.h index 1f781de50..4347a4b0c 100644 --- a/Source/Private/Layout/ASStackUnpositionedLayout.h +++ b/Source/Private/Layout/ASStackUnpositionedLayout.h @@ -22,7 +22,7 @@ #import /** The threshold that determines if a violation has actually occurred. */ -extern CGFloat const kViolationEpsilon; +AS_EXTERN CGFloat const kViolationEpsilon; struct ASStackLayoutSpecChild { /** The original source child. */ diff --git a/Source/Private/TextExperiment/Component/ASTextLayout.h b/Source/Private/TextExperiment/Component/ASTextLayout.h index 17a137b37..544d9f5f3 100755 --- a/Source/Private/TextExperiment/Component/ASTextLayout.h +++ b/Source/Private/TextExperiment/Component/ASTextLayout.h @@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN /** The max text container size in layout. */ -extern const CGSize ASTextContainerMaxSize; +AS_EXTERN const CGSize ASTextContainerMaxSize; /** The ASTextContainer class defines a region in which text is laid out. diff --git a/Source/Private/TextExperiment/String/ASTextAttribute.h b/Source/Private/TextExperiment/String/ASTextAttribute.h index a5575a290..49e868131 100755 --- a/Source/Private/TextExperiment/String/ASTextAttribute.h +++ b/Source/Private/TextExperiment/String/ASTextAttribute.h @@ -15,6 +15,7 @@ // http://www.apache.org/licenses/LICENSE-2.0 // +#import #import NS_ASSUME_NONNULL_BEGIN @@ -30,7 +31,7 @@ typedef NS_OPTIONS(NSInteger, ASTextAttributeType) { }; /// Get the attribute type from an attribute name. -extern ASTextAttributeType ASTextAttributeGetType(NSString *attributeName); +AS_EXTERN ASTextAttributeType ASTextAttributeGetType(NSString *attributeName); /** Line style in ASText (similar to NSUnderlineStyle). diff --git a/Source/Private/_ASCoreAnimationExtras.h b/Source/Private/_ASCoreAnimationExtras.h index 69c305395..e4a15ddf3 100644 --- a/Source/Private/_ASCoreAnimationExtras.h +++ b/Source/Private/_ASCoreAnimationExtras.h @@ -20,8 +20,6 @@ #import #import -ASDISPLAYNODE_EXTERN_C_BEGIN - // This protocol defines the core properties that ASDisplayNode and CALayer share, for managing contents. @protocol ASResizableContents @required @@ -44,21 +42,21 @@ ASDISPLAYNODE_EXTERN_C_BEGIN @param obj ASDisplayNode, CALayer or object that conforms to `ASResizableContents` protocol @param image Image you would like to resize */ -extern void ASDisplayNodeSetResizableContents(id obj, UIImage *image); +AS_EXTERN void ASDisplayNodeSetResizableContents(id obj, UIImage *image); /** Turns a value of UIViewContentMode to a string for debugging or serialization @param contentMode Any of the UIViewContentMode constants @return A human-readable representation of the constant, or the integer value of the constant if not recognized. */ -extern NSString *ASDisplayNodeNSStringFromUIContentMode(UIViewContentMode contentMode); +AS_EXTERN NSString *ASDisplayNodeNSStringFromUIContentMode(UIViewContentMode contentMode); /** Turns a string representing a contentMode into a contentMode @param string Any of the strings in UIContentModeDescriptionLUT @return Any of the UIViewContentMode constants, or an int if the string is a number. If the string is not recognized, UIViewContentModeScaleToFill is returned. */ -extern UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string); +AS_EXTERN UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string); /** Maps a value of UIViewContentMode to a corresponding contentsGravity @@ -66,7 +64,7 @@ extern UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string @param contentMode A content mode except for UIViewContentModeRedraw, which has no corresponding contentsGravity (it corresponds to needsDisplayOnBoundsChange = YES) @return An NSString constant from the documentation, eg kCAGravityCenter... or nil if there is no corresponding contentsGravity. Will assert if contentMode is unknown. */ -extern NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewContentMode contentMode); +AS_EXTERN NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewContentMode contentMode); /** Maps a value of contentsGravity to a corresponding UIViewContentMode @@ -74,23 +72,21 @@ extern NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewCon @param contentsGravity A contents gravity @return A UIViewContentMode constant from UIView.h, eg UIViewContentModeCenter..., or UIViewContentModeScaleToFill if contentsGravity is not one of the CA constants. Will assert if the contentsGravity is unknown. */ -extern UIViewContentMode ASDisplayNodeUIContentModeFromCAContentsGravity(NSString *const contentsGravity); +AS_EXTERN UIViewContentMode ASDisplayNodeUIContentModeFromCAContentsGravity(NSString *const contentsGravity); /** Use this to create a stretchable appropriate to approximate a filled rectangle, but with antialiasing on the edges when not pixel-aligned. It's best to keep the layer this image is added to with contentsScale equal to the scale of the final transform to screen space so it is able to antialias appropriately even when you shrink or grow the layer. @param color the fill color to use in the center of the image @param innerSize Unfortunately, 4 seems to be the smallest inner size that works if you're applying this stretchable to a larger box, whereas it does not display correctly for larger boxes. Thus some adjustment is necessary for the size of box you're displaying. If you're showing a 1px horizontal line, pass 1 height and at least 4 width. 2px vertical line: 2px wide, 4px high. Passing an innerSize greater that you desire is wasteful */ -extern UIImage *ASDisplayNodeStretchableBoxContentsWithColor(UIColor *color, CGSize innerSize); +AS_EXTERN UIImage *ASDisplayNodeStretchableBoxContentsWithColor(UIColor *color, CGSize innerSize); /** Checks whether a layer has ongoing animations @param layer A layer to check if animations are ongoing @return YES if the layer has ongoing animations, otherwise NO */ -extern BOOL ASDisplayNodeLayerHasAnimations(CALayer *layer); +AS_EXTERN BOOL ASDisplayNodeLayerHasAnimations(CALayer *layer); // This function is a less generalized version of ASDisplayNodeSetResizableContents. -extern void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) ASDISPLAYNODE_DEPRECATED; - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) ASDISPLAYNODE_DEPRECATED; diff --git a/Source/Private/_ASCoreAnimationExtras.mm b/Source/Private/_ASCoreAnimationExtras.mm index 3ed718651..5797ae9a3 100644 --- a/Source/Private/_ASCoreAnimationExtras.mm +++ b/Source/Private/_ASCoreAnimationExtras.mm @@ -19,12 +19,12 @@ #import #import -extern void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) +AS_EXTERN void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) { ASDisplayNodeSetResizableContents(layer, image); } -extern void ASDisplayNodeSetResizableContents(id obj, UIImage *image) +AS_EXTERN void ASDisplayNodeSetResizableContents(id obj, UIImage *image) { if (image) { ASDisplayNodeCAssert(image.resizingMode == UIImageResizingModeStretch || UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero), diff --git a/Source/TextKit/ASTextKitAttributes.h b/Source/TextKit/ASTextKitAttributes.h index ee11fddea..6398c9f84 100755 --- a/Source/TextKit/ASTextKitAttributes.h +++ b/Source/TextKit/ASTextKitAttributes.h @@ -20,12 +20,12 @@ #import #import -extern NSString *const ASTextKitTruncationAttributeName; +AS_EXTERN NSString *const ASTextKitTruncationAttributeName; /** Use ASTextKitEntityAttribute as the value of this attribute to embed a link or other interactable content inside the text. */ -extern NSString *const ASTextKitEntityAttributeName; +AS_EXTERN NSString *const ASTextKitEntityAttributeName; /** All NSObject values in this struct should be copied when passed into the TextComponent. diff --git a/Source/TextKit/ASTextKitCoreTextAdditions.h b/Source/TextKit/ASTextKitCoreTextAdditions.h index 211250e8c..4579d5c11 100644 --- a/Source/TextKit/ASTextKitCoreTextAdditions.h +++ b/Source/TextKit/ASTextKitCoreTextAdditions.h @@ -22,7 +22,6 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN /** @abstract Returns whether a given attribute is an unsupported Core Text attribute. @param attributeName The name of the attribute @@ -40,7 +39,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN - kCTUnderlineColorAttributeName @result Whether attributeName is an unsupported Core Text attribute. */ -BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName); +AS_EXTERN BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName); /** @@ -60,16 +59,14 @@ BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName); - kCTUnderlineColorAttributeName @result An NSDictionary of attributes for use by NSAttributedString. */ -extern NSDictionary *NSAttributedStringAttributesForCoreTextAttributes(NSDictionary *coreTextAttributes); +AS_EXTERN NSDictionary *NSAttributedStringAttributesForCoreTextAttributes(NSDictionary *coreTextAttributes); /** @abstract Returns an NSAttributedString whose Core Text attributes have been converted, where possible, to NSAttributedString attributes. @param dirtyAttributedString An NSAttributedString that may contain Core Text attributes. @result An NSAttributedString that's preserved as many CFAttributedString attributes as possible. */ -extern NSAttributedString *ASCleanseAttributedStringOfCoreTextAttributes(NSAttributedString *dirtyAttributedString); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN NSAttributedString *ASCleanseAttributedStringOfCoreTextAttributes(NSAttributedString *dirtyAttributedString); #pragma mark - #pragma mark - @@ -88,7 +85,7 @@ ASDISPLAYNODE_EXTERN_C_END @result An NSParagraphStyle initialized with as many of the paragraph specifiers from `coreTextParagraphStyle` as possible. */ -+ (instancetype)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle NS_RETURNS_RETAINED; ++ (NSParagraphStyle *)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle NS_RETURNS_RETAINED; @end diff --git a/Source/TextKit/ASTextKitCoreTextAdditions.m b/Source/TextKit/ASTextKitCoreTextAdditions.m index 272cacd3d..012d02a88 100644 --- a/Source/TextKit/ASTextKitCoreTextAdditions.m +++ b/Source/TextKit/ASTextKitCoreTextAdditions.m @@ -172,7 +172,7 @@ BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName) #pragma mark - @implementation NSParagraphStyle (ASTextKitCoreTextAdditions) -+ (instancetype)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle NS_RETURNS_RETAINED ++ (NSParagraphStyle *)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle NS_RETURNS_RETAINED { NSMutableParagraphStyle *newParagraphStyle = [[NSMutableParagraphStyle alloc] init]; diff --git a/Tests/ASDisplayNodeTestsHelper.h b/Tests/ASDisplayNodeTestsHelper.h index 3e0bea5fb..2d071bcf8 100644 --- a/Tests/ASDisplayNodeTestsHelper.h +++ b/Tests/ASDisplayNodeTestsHelper.h @@ -22,12 +22,8 @@ typedef BOOL (^as_condition_block_t)(void); -ASDISPLAYNODE_EXTERN_C_BEGIN +AS_EXTERN BOOL ASDisplayNodeRunRunLoopUntilBlockIsTrue(as_condition_block_t block); -BOOL ASDisplayNodeRunRunLoopUntilBlockIsTrue(as_condition_block_t block); - -void ASDisplayNodeSizeToFitSize(ASDisplayNode *node, CGSize size); -void ASDisplayNodeSizeToFitSizeRange(ASDisplayNode *node, ASSizeRange sizeRange); -void ASCATransactionQueueWait(ASCATransactionQueue *q); // nil means shared queue - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void ASDisplayNodeSizeToFitSize(ASDisplayNode *node, CGSize size); +AS_EXTERN void ASDisplayNodeSizeToFitSizeRange(ASDisplayNode *node, ASSizeRange sizeRange); +AS_EXTERN void ASCATransactionQueueWait(ASCATransactionQueue *q); // nil means shared queue From 4dc331e36c7d26537d61462d3fdd595573ed9cc0 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Mon, 18 Jun 2018 11:48:48 -0700 Subject: [PATCH 2/2] Rebase & remove from implementation files --- Source/ASDisplayNodeExtras.mm | 36 ++++++++++---------- Source/ASImageNode.mm | 4 +-- Source/Details/ASAbstractLayoutController.mm | 14 ++++---- Source/Details/ASGraphicsContext.m | 6 ++-- Source/Details/ASPageTable.m | 12 +++---- Source/Details/ASTraitCollection.m | 2 +- Source/Layout/ASDimension.mm | 2 +- Source/Layout/ASLayout.mm | 2 +- Source/Layout/ASYogaUtilities.mm | 2 +- Source/Private/ASCollectionLayoutDefines.m | 2 +- Source/Private/_ASCoreAnimationExtras.mm | 4 +-- 11 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Source/ASDisplayNodeExtras.mm b/Source/ASDisplayNodeExtras.mm index 2e87a04fd..01e8ff17e 100644 --- a/Source/ASDisplayNodeExtras.mm +++ b/Source/ASDisplayNodeExtras.mm @@ -23,7 +23,7 @@ #import #import -AS_EXTERN void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr) { +void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr) { /** * UIKit components must be deallocated on the main thread. We use this shared * run loop queue to gradually deallocate them across many turns of the main run loop. @@ -48,7 +48,7 @@ AS_EXTERN void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull } } -AS_EXTERN void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull names, ASDisplayNode * _Nullable object, ...) +void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull names, ASDisplayNode * _Nullable object, ...) { NSString *owningClassName = NSStringFromClass(owningClass); NSArray *nameArray = [names componentsSeparatedByString:@", "]; @@ -66,7 +66,7 @@ AS_EXTERN void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull va_end(args); } -AS_EXTERN ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) +ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) { ASDisplayNodeCAssert(![displayNode isLayerBacked], @"displayNode must not be layer backed as it may have a nil window"); if (displayNode && [displayNode supportsRangeManagedInterfaceState]) { @@ -81,17 +81,17 @@ AS_EXTERN ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *display } } -AS_EXTERN ASDisplayNode *ASLayerToDisplayNode(CALayer *layer) +ASDisplayNode *ASLayerToDisplayNode(CALayer *layer) { return layer.asyncdisplaykit_node; } -AS_EXTERN ASDisplayNode *ASViewToDisplayNode(UIView *view) +ASDisplayNode *ASViewToDisplayNode(UIView *view) { return view.asyncdisplaykit_node; } -AS_EXTERN void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) +void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) { if (!node) { ASDisplayNodeCAssertNotNil(layer, @"Cannot recursively perform with nil node and nil layer"); @@ -119,7 +119,7 @@ AS_EXTERN void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, A } } -AS_EXTERN void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) +void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) { // Queue used to keep track of subnodes while traversing this layout in a BFS fashion. std::queue queue; @@ -138,7 +138,7 @@ AS_EXTERN void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void } } -AS_EXTERN void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) +void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) { for (ASDisplayNode *subnode in node.subnodes) { ASDisplayNodePerformBlockOnEveryNode(nil, subnode, YES, block); @@ -176,7 +176,7 @@ static void _ASCollectDisplayNodes(NSMutableArray *array, CALayer *layer) _ASCollectDisplayNodes(array, sublayer); } -AS_EXTERN NSArray *ASCollectDisplayNodes(ASDisplayNode *node) +NSArray *ASCollectDisplayNodes(ASDisplayNode *node) { NSMutableArray *list = [[NSMutableArray alloc] init]; for (CALayer *sublayer in node.layer.sublayers) { @@ -201,14 +201,14 @@ static void _ASDisplayNodeFindAllSubnodes(NSMutableArray *array, ASDisplayNode * } } -AS_EXTERN NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) +NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) { NSMutableArray *list = [[NSMutableArray alloc] init]; _ASDisplayNodeFindAllSubnodes(list, start, block); return list; } -AS_EXTERN NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) +NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) { return ASDisplayNodeFindAllSubnodes(start, ^(ASDisplayNode *n) { return [n isKindOfClass:c]; @@ -232,17 +232,17 @@ static void _ASDisplayNodeFindAllSubnodes(NSMutableArray *array, ASDisplayNode * return nil; } -AS_EXTERN __kindof ASDisplayNode *ASDisplayNodeFindFirstNode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) +__kindof ASDisplayNode *ASDisplayNodeFindFirstNode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) { return _ASDisplayNodeFindFirstNode(startNode, YES, block); } -AS_EXTERN __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) +__kindof ASDisplayNode *ASDisplayNodeFindFirstSubnode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) { return _ASDisplayNodeFindFirstNode(startNode, NO, block); } -AS_EXTERN __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) +__kindof ASDisplayNode *ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) { return ASDisplayNodeFindFirstSubnode(start, ^(ASDisplayNode *n) { return [n isKindOfClass:c]; @@ -262,7 +262,7 @@ static inline BOOL _ASDisplayNodeIsAncestorOfDisplayNode(ASDisplayNode *possible return NO; } -AS_EXTERN UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) +UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) { UIView *view = ASFindClosestViewOfLayer(layer); if (UIWindow *window = ASDynamicCast(view, UIWindow)) { @@ -272,7 +272,7 @@ static inline BOOL _ASDisplayNodeIsAncestorOfDisplayNode(ASDisplayNode *possible } } -AS_EXTERN UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) +UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) { while (layer != nil) { if (UIView *view = ASDynamicCast(layer.delegate, UIView)) { @@ -283,7 +283,7 @@ static inline BOOL _ASDisplayNodeIsAncestorOfDisplayNode(ASDisplayNode *possible return nil; } -AS_EXTERN ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) +ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) { ASDisplayNode *possibleAncestor = node1; while (possibleAncestor) { @@ -297,7 +297,7 @@ static inline BOOL _ASDisplayNodeIsAncestorOfDisplayNode(ASDisplayNode *possible return possibleAncestor; } -AS_EXTERN ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) +ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) { // node <- supernode on each loop // previous <- node on each loop where node is not nil diff --git a/Source/ASImageNode.mm b/Source/ASImageNode.mm index 37a5777cf..6eb76ba69 100644 --- a/Source/ASImageNode.mm +++ b/Source/ASImageNode.mm @@ -732,7 +732,7 @@ - (NSDictionary *)debugLabelAttributes #pragma mark - Extras -AS_EXTERN asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor *borderColor) +asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor *borderColor) { return ^(UIImage *originalImage) { ASGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale); @@ -755,7 +755,7 @@ AS_EXTERN asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlo }; } -AS_EXTERN asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color) +asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color) { return ^(UIImage *originalImage) { ASGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale); diff --git a/Source/Details/ASAbstractLayoutController.mm b/Source/Details/ASAbstractLayoutController.mm index f724a242a..391c381f2 100644 --- a/Source/Details/ASAbstractLayoutController.mm +++ b/Source/Details/ASAbstractLayoutController.mm @@ -21,14 +21,14 @@ #include -AS_EXTERN ASRangeTuningParameters const ASRangeTuningParametersZero = {}; +ASRangeTuningParameters const ASRangeTuningParametersZero = {}; -AS_EXTERN BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs) +BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs) { return lhs.leadingBufferScreenfuls == rhs.leadingBufferScreenfuls && lhs.trailingBufferScreenfuls == rhs.trailingBufferScreenfuls; } -AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, +ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters) { ASDirectionalScreenfulBuffer horizontalBuffer = {0, 0}; @@ -41,7 +41,7 @@ AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(AS return horizontalBuffer; } -AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, +ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters) { ASDirectionalScreenfulBuffer verticalBuffer = {0, 0}; @@ -54,7 +54,7 @@ AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASSc return verticalBuffer; } -AS_EXTERN CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuffer buffer) +CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuffer buffer) { CGFloat negativeDirectionWidth = buffer.negativeDirection * rect.size.width; CGFloat positiveDirectionWidth = buffer.positiveDirection * rect.size.width; @@ -63,7 +63,7 @@ AS_EXTERN CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuf return rect; } -AS_EXTERN CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffer buffer) +CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffer buffer) { CGFloat negativeDirectionHeight = buffer.negativeDirection * rect.size.height; CGFloat positiveDirectionHeight = buffer.positiveDirection * rect.size.height; @@ -72,7 +72,7 @@ AS_EXTERN CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffe return rect; } -AS_EXTERN CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, +CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection) { // Can scroll horizontally - expand the range appropriately diff --git a/Source/Details/ASGraphicsContext.m b/Source/Details/ASGraphicsContext.m index d1dd61cce..efe965855 100644 --- a/Source/Details/ASGraphicsContext.m +++ b/Source/Details/ASGraphicsContext.m @@ -41,7 +41,7 @@ static size_t ASGraphicsGetAlignedBytesPerRow(size_t baseValue) { #pragma mark - Graphics Contexts -AS_EXTERN void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) +void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) { if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) { UIGraphicsBeginImageContextWithOptions(size, opaque, scale); @@ -106,7 +106,7 @@ AS_EXTERN void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGContextRelease(context); } -AS_EXTERN UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext() NS_RETURNS_RETAINED +UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext() NS_RETURNS_RETAINED { if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) { UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); @@ -160,7 +160,7 @@ AS_EXTERN void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, return result; } -AS_EXTERN void ASGraphicsEndImageContext() +void ASGraphicsEndImageContext() { if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) { UIGraphicsEndImageContext(); diff --git a/Source/Details/ASPageTable.m b/Source/Details/ASPageTable.m index 9725f3921..4e66fe981 100644 --- a/Source/Details/ASPageTable.m +++ b/Source/Details/ASPageTable.m @@ -12,7 +12,7 @@ #import -AS_EXTERN ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) +ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) { // Add 1 to the end result because 0 is not accepted by NSArray and NSMapTable. // To avoid overflow after adding, x and y can't be UINT16_MAX (0xFFFF) **at the same time**. @@ -22,29 +22,29 @@ AS_EXTERN ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) return (x << 16) + y + 1; } -AS_EXTERN ASPageCoordinate ASPageCoordinateForPageThatContainsPoint(CGPoint point, CGSize pageSize) +ASPageCoordinate ASPageCoordinateForPageThatContainsPoint(CGPoint point, CGSize pageSize) { return ASPageCoordinateMake((MAX(0.0, point.x) / pageSize.width), (MAX(0.0, point.y) / pageSize.height)); } -AS_EXTERN uint16_t ASPageCoordinateGetX(ASPageCoordinate pageCoordinate) +uint16_t ASPageCoordinateGetX(ASPageCoordinate pageCoordinate) { return (pageCoordinate - 1) >> 16; } -AS_EXTERN uint16_t ASPageCoordinateGetY(ASPageCoordinate pageCoordinate) +uint16_t ASPageCoordinateGetY(ASPageCoordinate pageCoordinate) { return (pageCoordinate - 1) & ~(0xFFFF<<16); } -AS_EXTERN CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSize pageSize) +CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSize pageSize) { CGFloat pageWidth = pageSize.width; CGFloat pageHeight = pageSize.height; return CGRectMake(ASPageCoordinateGetX(pageCoordinate) * pageWidth, ASPageCoordinateGetY(pageCoordinate) * pageHeight, pageWidth, pageHeight); } -AS_EXTERN NSPointerArray *ASPageCoordinatesForPagesThatIntersectRect(CGRect rect, CGSize contentSize, CGSize pageSize) +NSPointerArray *ASPageCoordinatesForPagesThatIntersectRect(CGRect rect, CGSize contentSize, CGSize pageSize) { CGRect contentRect = CGRectMake(0.0, 0.0, contentSize.width, contentSize.height); // Make sure the specified rect is within contentRect diff --git a/Source/Details/ASTraitCollection.m b/Source/Details/ASTraitCollection.m index bdf897f2f..e03db0f45 100644 --- a/Source/Details/ASTraitCollection.m +++ b/Source/Details/ASTraitCollection.m @@ -80,7 +80,7 @@ ASPrimitiveContentSizeCategory ASPrimitiveContentSizeCategoryMake(UIContentSizeC #pragma mark - ASPrimitiveTraitCollection -AS_EXTERN void ASTraitCollectionPropagateDown(id element, ASPrimitiveTraitCollection traitCollection) { +void ASTraitCollectionPropagateDown(id element, ASPrimitiveTraitCollection traitCollection) { if (element) { element.primitiveTraitCollection = traitCollection; } diff --git a/Source/Layout/ASDimension.mm b/Source/Layout/ASDimension.mm index 2c541bbfe..2fd9cf63d 100644 --- a/Source/Layout/ASDimension.mm +++ b/Source/Layout/ASDimension.mm @@ -121,7 +121,7 @@ ASSizeRange ASSizeRangeIntersect(ASSizeRange sizeRange, ASSizeRange otherSizeRan #pragma mark - Yoga - ASEdgeInsets ASEdgeInsets const ASEdgeInsetsZero = {}; -AS_EXTERN ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets) +ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets) { ASEdgeInsets asEdgeInsets = ASEdgeInsetsZero; asEdgeInsets.top = ASDimensionMake(edgeInsets.top); diff --git a/Source/Layout/ASLayout.mm b/Source/Layout/ASLayout.mm index 6a5ab6fe2..607a1c648 100644 --- a/Source/Layout/ASLayout.mm +++ b/Source/Layout/ASLayout.mm @@ -30,7 +30,7 @@ CGPoint const ASPointNull = {NAN, NAN}; -AS_EXTERN BOOL ASPointIsNull(CGPoint point) +BOOL ASPointIsNull(CGPoint point) { return isnan(point.x) && isnan(point.y); } diff --git a/Source/Layout/ASYogaUtilities.mm b/Source/Layout/ASYogaUtilities.mm index 8812e027b..47a6119a8 100644 --- a/Source/Layout/ASYogaUtilities.mm +++ b/Source/Layout/ASYogaUtilities.mm @@ -47,7 +47,7 @@ + (ASDisplayNode *)yogaHorizontalStack @end -AS_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) +void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) { if (node == nil) { return; diff --git a/Source/Private/ASCollectionLayoutDefines.m b/Source/Private/ASCollectionLayoutDefines.m index bfa58aa5d..ba1abb0b8 100644 --- a/Source/Private/ASCollectionLayoutDefines.m +++ b/Source/Private/ASCollectionLayoutDefines.m @@ -12,7 +12,7 @@ #import -AS_EXTERN ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) +ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) { ASSizeRange sizeRange = ASSizeRangeUnconstrained; if (ASScrollDirectionContainsVerticalDirection(scrollableDirections) == NO) { diff --git a/Source/Private/_ASCoreAnimationExtras.mm b/Source/Private/_ASCoreAnimationExtras.mm index 5797ae9a3..34a515abd 100644 --- a/Source/Private/_ASCoreAnimationExtras.mm +++ b/Source/Private/_ASCoreAnimationExtras.mm @@ -19,12 +19,12 @@ #import #import -AS_EXTERN void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) +void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) { ASDisplayNodeSetResizableContents(layer, image); } -AS_EXTERN void ASDisplayNodeSetResizableContents(id obj, UIImage *image) +void ASDisplayNodeSetResizableContents(id obj, UIImage *image) { if (image) { ASDisplayNodeCAssert(image.resizingMode == UIImageResizingModeStretch || UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero),