diff --git a/.gitignore b/.gitignore index 81b99d3bd..209c03a45 100755 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ xcuserdata profile *.moved-aside .DS_Store -Notes.txt \ No newline at end of file +Notes.txt +DerivedData diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/A2BlockDelegate.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/A2BlockDelegate.h new file mode 100644 index 000000000..50c448dcc --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/A2BlockDelegate.h @@ -0,0 +1,103 @@ +// +// A2BlockDelegate.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** The A2BlockDelegate category extends features provided by A2DynamicDelegate + to create custom block properties in a category on a delegating object and + dynamically map them to delegate (`UIAlertViewDelegate`), data source + (`UITableViewDataSource`), or other delegated protocol + (`NSErrorRecoveryAttempting`) methods. + + A2BlockDelegate also supports replacing the delegate of a given class with an + automatic - though optional - version of these block-based properties, while + still allowing for traditional method-based delegate implementations. + + Simply call one of the methods in the category on a class to add a block + property to that class, preferably during a `+load` method in a category. + + To interplay between classes that support delegation but are extended to have + block properties through delegate replacement extended to have block + properties, one should implement an `A2Dynamic` subclass of + `A2DynamicDelegate`. This behavior is documented in detail in the class + documentation for A2DynamicDelegate, and examples exist in BlocksKit. + */ +@interface NSObject (A2BlockDelegate) + +/** @name Linking Block Properties */ + +/** Synthesizes multiple properties and links them to the appropriate selector + in the data source protocol. + + A2DynamicDelegate assumes a protocol name `FooBarDataSource` for instances of + class `FooBar`. The method will generate appropriate `setHandler:` and + `handler` implementations for each property name and selector name string pair. + + @param selectorsForPropertyNames A dictionary with property names as keys and + selector strings as objects. + */ ++ (void) linkDataSourceMethods: (NSDictionary *) selectorsForPropertyNames; + +/** Synthesizes multiple properties and links them to the appropriate selector + in the delegate protocol. + + A2DynamicDelegate assumes a protocol name `FooBarDelegate` for instances of + class `FooBar`. The method will generate appropriate `setHandler:` and + `handler` implementations for each property name and selector name string pair. + + @param selectorsForPropertyNames A dictionary with property names as keys and + selectors strings as objects. + */ ++ (void) linkDelegateMethods: (NSDictionary *) selectorsForPropertyNames; + +/** Synthesizes multiple properties and links them to the appropriate selector + in the given protocol. + + The method will generate appropriate `setHandler:` and `handler` + implementations for each property name and selector name string pair. + + @param protocol A protocol that declares all of the given selectors. Must not + be NULL. + @param selectorsForPropertyNames A dictionary with property names as keys and + selector strings as objects. + */ ++ (void) linkProtocol: (Protocol *) protocol methods: (NSDictionary *) selectorsForPropertyNames; + +/** @name Delegate replacement properties */ + +/** Registers a dynamic data source replacement using the property name + `dataSource` and the protocol name `FooBarDataSource` for an instance of + `FooBar`. */ ++ (void) registerDynamicDataSource; + +/** Registers a dynamic delegate replacement using the property name `delegate` + and the protocol name `FooBarDelegate` for an instance of `FooBar`. */ ++ (void) registerDynamicDelegate; + +/** Registers a dynamic data source replacement using the given property name + and the protocol name `FooBarDataSource` for an instance of `FooBar`. + + @param dataSourceName The name of the class' data source property. Must not be + nil. + */ ++ (void) registerDynamicDataSourceNamed: (NSString *) dataSourceName; + +/** Registers a dynamic delegate replacement using the given property name and + the protocol name `FooBarDelegate` for an instance of `FooBar`. + + @param delegateName The name of the class' delegate property. Must not be nil. + */ ++ (void) registerDynamicDelegateNamed: (NSString *) delegateName; + +/** Registers a dynamic protocol implementation replacement + using the given property name and the given protocol. + + @param delegateName The name of the class' delegation protocol property, such + as `safeDelegate`. Must not be nil. + @param protocol A properly encoded protocol. Must not be NULL. + */ ++ (void) registerDynamicDelegateNamed: (NSString *) delegateName forProtocol: (Protocol *) protocol; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/A2BlockInvocation.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/A2BlockInvocation.h new file mode 100644 index 000000000..7ac252504 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/A2BlockInvocation.h @@ -0,0 +1,209 @@ +// +// A2BlockInvocation.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** An `A2BlockInvocation` is an Objective-C block call rendered static, that + is, it is an action turned into an object. `A2BlockInvocation` objects are used + to store and forward closure invocations between objects, primarily by the + `A2DynamicDelegate` system. + + An `A2BlockInvocation` object encapsulates all the elements of an Objective-C + block invocation, including arguments and the return value. Each of these can + be set directly, and the return value is set automatically when the object is + dispatched. + + An `A2BlockInvocation` object can be repeatedly dispatched. Its arguments can + be modified between dispatches for varying results, making it useful for + repeating calls with many arguments. This flexibility makes `A2BlockInvocation` + extremely powerful, because blocks can be used to capture scope and + `A2BlockInvocation` can be used to save them for later. + + Like `NSInvocation`, `A2BlockInvocation` does not support invocations of + methods with variadic arguments or union arguments. + + This class does not retain the arguments for the contained call by default. If + those objects might disappear between the time you create your invocation and + the time you use it, you should call the retainArguments method to have the + invocation object retain them itself. + + `A2BlockInvocation` is powered by [libffi](http://sourceware.org/libffi/), + which serves as a way to call functions like `NSInvocation` calls methods. + This is the only way to do this for now. Get used to it. + */ +@interface A2BlockInvocation : NSObject + +/** @name Creating A2BlockInvocation Objects */ + +/** Returns an `A2BlockInvocation` object able to construct calls using a given + block and a given method signature. + + The new object must have its arguments set with setArgument:atIndex: before it + can be invoked. + + The method signature given must be compatible with the signature of the block. + Generally, this means being all the same except for the removal of the + selector argument, for the block is the first parameter of the block's + function just like `self` is the first parameter of a method. An example method + that returns a string and has an integer argument would have a block signature + of `NSString *(^)(int)`, and an Objective-C method signature `@@i`. + + @param block An Objective-C block literal. + @param methodSignature An Objective-C method signature matching the block. + @return An initialized block invocation object. +*/ +- (id) initWithBlock: (id) block methodSignature: (NSMethodSignature *)methodSignature; + +/** @name Getting the Block and Method Signatures */ + +/** Returns the reciever's method signature. Appropriate for use in + `methodSignatureForSelector:`, and reflects the method *with* a selector. */ +@property (nonatomic, strong, readonly) NSMethodSignature *methodSignature; + +/** Returns the reciever's block signature. Intended for use in compatibility + comparison, and generally not useful. */ +@property (nonatomic, strong, readonly) NSMethodSignature *blockSignature; + +/** Returns the reciever's block. Can be used to call it manually, if you + know its signature. */ +@property (nonatomic, copy, readonly) id block; + +/** @name Configuring a Block Invocation Object */ + +/** If the receiver hasn’t already done so, retains all object arguments of the + receiver and copies all of its C-string arguments. + + Before this method is invoked, argumentsRetained returns NO; after, it returns + YES. + + For efficiency, newly created block invocations don’t retain or copy their + arguments, nor do they retain their targets or copy C strings. You should + instruct a block invocation to retain its arguments if you intend to cache it, + since the arguments may otherwise be released before the NSInvocation is + invoked. + + Note that objects referenced in the scope of the block are generally retained. + + @see argumentsRetained + */ +- (void) retainArguments; + +/** Returns YES if the receiver has retained its arguments, NO otherwise. + + @see retainArguments + */ +- (BOOL) argumentsRetained; + +/** Gets the receiver's return value. + + Use the `NSMethodSignature` method `-methodReturnLength` to determine the size + needed for the buffer: + + NSUInteger length = [[myInvocation methodSignature] methodReturnLength]; + buffer = (void *)malloc(length); + [invocation getReturnValue:buffer]; + + When the return value is an object (or a pointer), pass a pointer to the + variable (or memory) into which the object should be placed: + + id anObject; + NSArray *anArray; + [invocation1 getReturnValue:&anObject]; + [invocation2 getReturnValue:&anArray]; + + If the block invocation object has never been invoked, the result of this + method is undefined and is not recommended. + + @param retLoc An untyped buffer into which the receiver copies its return + value. It should be large enough to accommodate the value. See the discussion + for more information. + @see setReturnValue: + */ +- (void) getReturnValue: (void *) retLoc; + +/** Sets the receiver’s return value. + + This value is normally set when you send an invoke message. + + @param retLoc An untyped buffer whose contents are copied as the receiver's + return value. + @see invoke + @see getReturnValue: + */ +- (void) setReturnValue: (void *) retLoc; + +/** Returns by indirection the receiver's argument at a specified index. + + This method copies the argument stored at index into the storage pointed to by + buffer. The size of buffer must be large enough to accommodate the argument value. + + When the argument value is an object, pass a pointer to the variable + (or memory) into which the object should be placed: + + NSArray *anArray; + [invocation getArgument:&anArray atIndex:3]; + + This method raises NSInvalidArgumentException if idx is greater than the + actual number of arguments for the selector. + + @param argumentLocation An untyped buffer to hold the returned argument. See + the discussion relating to argument values that are objects. + @param idx An integer specifying the index of the argument to get, starting + at 0 representing the first argument of the underlying block. + @see setArgument:atIndex: + */ +- (void) getArgument: (void *) argumentLocation atIndex: (NSInteger) idx; + +/** Sets an argument of the receiver. + + This method copies the contents of buffer as the argument at index. The number + of bytes copied is determined by the argument size. + + When the argument value is an object, pass a pointer to the variable + (or memory) from which the object should be copied: + + NSArray *anArray; + [invocation setArgument:&anArray atIndex:3]; + + This method raises NSInvalidArgumentException if the value of index is greater + than the actual number of arguments for the selector. + + @param argumentLocation An untyped buffer containing an argument to be assigned + to the receiver. See the discussion relating to arguments that are objects. + @param idx An integer specifying the index of the argument, starting at 0 + representing the first argument of the underlying block. + */ +- (void) setArgument: (void *) argumentLocation atIndex: (NSInteger) idx; + +/** Unsets all arguments in the block invocation, including releasing any + objects if argumentsRetained is YES. */ +- (void) clearArguments; + +/** @name Dispatching an Invocation */ + +/** Calls the receiver's block (with arguments) and sets the return value. + + You must set the receiver's argument values before calling this method. + + @see setArgument:atIndex: + @see getReturnValue: + */ +- (void) invoke; + +/** Calls the receiver's block with the arguments from the given invocation, + and sets the return value both on the receiving invocation and the given + invocation. + + Copying arguments will exclude the target and selector of the given invocation. + Otherwise, this method raises NSInvalidArgumentException if the number of + arguments in both invocations are not appropriately matched. + + @param inv An instance of NSInvocation with values for its arguments set. + @see setArgument:atIndex: + @see getReturnValue: + */ +- (void) invokeUsingInvocation: (NSInvocation *) inv; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/A2DynamicDelegate.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/A2DynamicDelegate.h new file mode 100644 index 000000000..f9ac81124 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/A2DynamicDelegate.h @@ -0,0 +1,138 @@ +// +// A2DynamicDelegate.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** A2DynamicDelegate implements a class's delegate, data source, or other + delegated protocol by associating protocol methods with a block implementation. + + - (IBAction) annoyUser + { + // Create an alert view + UIAlertView *alertView = [[UIAlertView alloc] + initWithTitle: @"Hello World!" + message: @"This alert's delegate is implemented using blocks. That's so cool!" + delegate: nil + cancelButtonTitle: @"Meh." + otherButtonTitles: @"Woo!", nil]; + + // Get the dynamic delegate + A2DynamicDelegate *dd = alertView.dynamicDelegate; + + // Implement -alertViewShouldEnableFirstOtherButton: + [dd implementMethod: @selector(alertViewShouldEnableFirstOtherButton:) withBlock: ^(UIAlertView *alertView) { + NSLog(@"Message: %@", alertView.message); + return YES; + }]; + + // Implement -alertView:willDismissWithButtonIndex: + [dd implementMethod: @selector(alertView:willDismissWithButtonIndex:) withBlock: ^(UIAlertView *alertView, NSInteger buttonIndex) { + NSLog(@"You pushed button #%d (%@)", buttonIndex, [alertView buttonTitleAtIndex: buttonIndex]); + }]; + + // Set the delegate + alertView.delegate = dd; + + [alertView show]; + [alertView release]; + } + + A2DynamicDelegate is designed to be 'plug and play'. + */ +@interface A2DynamicDelegate : NSProxy + +/** + * The designated initializer for the A2DynamicDelegate proxy. + * + * An instance of A2DynamicDelegate should generally not be created by the user, + * but instead by calling a method in NSObject(A2DynamicDelegate). Since + * delegates are usually weak references on the part of the delegating object, a + * dynamic delegate would be deallocated immediately after its declaring scope + * ends. NSObject(A2DynamicDelegate) creates a strong reference. + * + * @param protocol A protocol to which the dynamic delegate should conform. + * @return An initialized delegate proxy. + */ +- (id)initWithProtocol:(Protocol *)protocol; + +/** The protocol delegating the dynamic delegate. */ +@property (nonatomic, readonly) Protocol *protocol; + +/** A dictionary of custom handlers to be used by custom responders + in a A2Dynamic(Protocol Name) subclass of A2DynamicDelegate, like + `A2DynamicUIAlertViewDelegate`. */ +@property (nonatomic, strong, readonly) NSMutableDictionary *handlers; + +/** When replacing the delegate using the A2BlockDelegate extensions, the object + responding to classical delegate method implementations. */ +@property (nonatomic, weak, readonly) id realDelegate; + +/** @name Block Instance Method Implementations */ + +/** The block that is to be fired when the specified + selector is called on the reciever. + + @param selector An encoded selector. Must not be NULL. + @return A code block, or nil if no block is assigned. + */ +- (id) blockImplementationForMethod: (SEL) selector; + +/** Assigns the given block to be fired when the specified + selector is called on the reciever. + + [tableView.dynamicDataSource implementMethod:@selector(numberOfSectionsInTableView:) + withBlock:NSInteger^(UITableView *tableView){ + return 2; + }]; + + @warning Starting with A2DynamicDelegate 2.0, a block will + not be checked for a matching signature. A block can have + less parameters than the original selector and will be + ignored, but cannot have more. + + @param selector An encoded selector. Must not be NULL. + @param block A code block with the same signature as selector. + */ +- (void) implementMethod: (SEL) selector withBlock: (id) block; + +/** Disassociates any block so that nothing will be fired + when the specified selector is called on the reciever. + + @param selector An encoded selector. Must not be NULL. + */ +- (void) removeBlockImplementationForMethod: (SEL) selector; + +/** @name Block Class Method Implementations */ + +/** The block that is to be fired when the specified + selector is called on the delegating object's class. + + @param selector An encoded selector. Must not be NULL. + @return A code block, or nil if no block is assigned. + */ +- (id) blockImplementationForClassMethod: (SEL) selector; + +/** Assigns the given block to be fired when the specified + selector is called on the reciever. + + @warning Starting with A2DynamicDelegate 2.0, a block will + not be checked for a matching signature. A block can have + less parameters than the original selector and will be + ignored, but cannot have more. + + @param selector An encoded selector. Must not be NULL. + @param block A code block with the same signature as selector. + */ +- (void) implementClassMethod: (SEL) selector withBlock: (id) block; + +/** Disassociates any blocks so that nothing will be fired + when the specified selector is called on the delegating + object's class. + + @param selector An encoded selector. Must not be NULL. + */ +- (void) removeBlockImplementationForClassMethod: (SEL) selector; + +@end \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/BKGlobals.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/BKGlobals.h new file mode 100755 index 000000000..401da3a77 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/BKGlobals.h @@ -0,0 +1,66 @@ +// +// BKGlobals.h +// BlocksKit +// + +#import +#import + +#import "A2BlockDelegate.h" +#import "NSObject+A2DynamicDelegate.h" + +#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) +#define BK_HAS_UIKIT 0 +#define BK_HAS_APPKIT 1 +#elif (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) +#define BK_HAS_UIKIT 1 +#define BK_HAS_APPKIT 0 +#else +#define BK_HAS_UIKIT 0 +#define BK_HAS_APPKIT 0 +#endif + +#ifndef DEPRECATED_ATTRIBUTE_M +#if __has_attribute(deprecated) +#define DEPRECATED_ATTRIBUTE_M(...) __attribute__((deprecated(__VA_ARGS__))) +#else +#define DEPRECATED_ATTRIBUTE_M(...) DEPRECATED_ATTRIBUTE +#endif +#endif + +#import + +#if BK_HAS_APPKIT +#import +#endif + +#if BK_HAS_UIKIT +#import +#import + +typedef void (^BKGestureRecognizerBlock)(UIGestureRecognizer *sender, UIGestureRecognizerState state, CGPoint location); +typedef void (^BKTouchBlock)(NSSet* set, UIEvent* event); +#endif + +typedef void (^BKBlock)(void); // compatible with dispatch_block_t +typedef void (^BKSenderBlock)(id sender); +typedef void (^BKSenderKeyPathBlock)(id obj, NSString *keyPath); +typedef void (^BKKeyValueBlock)(id key, id obj); +typedef void (^BKIndexBlock)(NSUInteger index); +typedef void (^BKTimerBlock)(NSTimeInterval time); +typedef void (^BKResponseBlock)(NSURLResponse *response); + +typedef void (^BKObservationBlock)(id obj, NSDictionary *change); +typedef void (^BKMultipleObservationBlock)(id obj, NSString *keyPath, NSDictionary *change); + +typedef BOOL (^BKValidationBlock)(id obj); +typedef BOOL (^BKKeyValueValidationBlock)(id key, id obj); +typedef BOOL (^BKIndexValidationBlock)(NSUInteger index); + +typedef id (^BKReturnBlock)(void); +typedef id (^BKTransformBlock)(id obj); +typedef id (^BKKeyValueTransformBlock)(id key, id obj); +typedef id (^BKAccumulationBlock)(id sum, id obj); +typedef id (^BKIndexMapBlock)(NSUInteger index); + +typedef NSUInteger (^BKIndexTransformBlock)(NSUInteger index); diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/BKMacros.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/BKMacros.h new file mode 100755 index 000000000..88591e7b9 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/BKMacros.h @@ -0,0 +1,60 @@ +// +// BKMacros.h +// BlocksKit +// +// Includes code by Michael Ash. . +// + +#import "NSArray+BlocksKit.h" +#import "NSSet+BlocksKit.h" +#import "NSDictionary+BlocksKit.h" +#import "NSIndexSet+BlocksKit.h" + +#ifndef __BLOCKSKIT_MACROS__ +#define __BLOCKSKIT_MACROS__ + +#define __BK_EACH_WRAPPER(...) (^{ __block CFMutableDictionaryRef MA_eachTable = nil; \ + (void)MA_eachTable; \ + __typeof__(__VA_ARGS__) MA_retval = __VA_ARGS__; \ + if(MA_eachTable) \ + CFRelease(MA_eachTable); \ + return MA_retval; \ + }()) + +#define BK_EACH(collection, ...) __BK_EACH_WRAPPER([collection each:^(id obj) { __VA_ARGS__ }]; +#define BK_APPLY(collection, ...) __BK_EACH_WRAPPER([collection apply:^(id obj) { __VA_ARGS__ }]; +#define BK_MAP(collection, ...) __BK_EACH_WRAPPER([collection map: ^id (id obj) { return (__VA_ARGS__); }]) +#define BK_SELECT(collection, ...) __BK_EACH_WRAPPER([collection select: ^BOOL (id obj) { return (__VA_ARGS__) != 0; }]) +#define BK_REJECT(collection, ...) __BK_EACH_WRAPPER([collection select: ^BOOL (id obj) { return (__VA_ARGS__) == 0; }]) +#define BK_MATCH(collection, ...) __BK_EACH_WRAPPER([collection match: ^BOOL (id obj) { return (__VA_ARGS__) != 0; }]) +#define BK_REDUCE(collection, initial, ...) __BK_EACH_WRAPPER([collection reduce: (initial) block: ^id (id a, id b) { return (__VA_ARGS__); }]) + +#ifndef EACH +#define EACH BK_EACH +#endif + +#ifndef APPLY +#define APPLY BK_APPLY +#endif + +#ifndef MAP +#define MAP BK_MAP +#endif + +#ifndef SELECT +#define SELECT BK_SELECT +#endif + +#ifndef REJECT +#define REJECT BK_REJECT +#endif + +#ifndef MATCH +#define MATCH BK_MATCH +#endif + +#ifndef REDUCE +#define REDUCE BK_REDUCE +#endif + +#endif \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/BlocksKit.h new file mode 100755 index 000000000..14f80d95d --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/BlocksKit.h @@ -0,0 +1,65 @@ +// +// BlocksKit +// +// The Objective-C block utilities you always wish you had. +// +// Copyright (c) 2011-2012 Pandamonia LLC. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#import "BKGlobals.h" + +#import "BKMacros.h" + +#import "NSObject+BlocksKit.h" +#import "NSObject+AssociatedObjects.h" +#import "NSObject+BlockObservation.h" + +#import "NSArray+BlocksKit.h" +#import "NSMutableArray+BlocksKit.h" +#import "NSSet+BlocksKit.h" +#import "NSMutableSet+BlocksKit.h" +#import "NSDictionary+BlocksKit.h" +#import "NSMutableDictionary+BlocksKit.h" +#import "NSIndexSet+BlocksKit.h" +#import "NSMutableIndexSet+BlocksKit.h" +#import "NSOrderedSet+BlocksKit.h" +#import "NSMutableOrderedSet+BlocksKit.h" + +#import "NSInvocation+BlocksKit.h" +#import "NSTimer+BlocksKit.h" + +#import "NSURLConnection+BlocksKit.h" +#import "NSCache+BlocksKit.h" + +#if BK_HAS_UIKIT +#import "UIAlertView+BlocksKit.h" +#import "UIActionSheet+BlocksKit.h" +#import "UIBarButtonItem+BlocksKit.h" +#import "UIControl+BlocksKit.h" +#import "UIGestureRecognizer+BlocksKit.h" +#import "UIPopoverController+BlocksKit.h" +#import "UIView+BlocksKit.h" +#import "UIWebView+BlocksKit.h" +#import "MFMailComposeViewController+BlocksKit.h" +#import "MFMessageComposeViewController+BlocksKit.h" +#else +// AppKit extensions +#endif diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/MFMailComposeViewController+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/MFMailComposeViewController+BlocksKit.h new file mode 100644 index 000000000..ca498a29f --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/MFMailComposeViewController+BlocksKit.h @@ -0,0 +1,30 @@ +// +// MFMailComposeViewController+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** MFMailComposeViewController with block callbacks. + + If you provide a completion handler to an instance of + MFMailComposeViewController but do not implement a delegate callback for + mailComposeController:didFinishWithResult:error:, the mail compose view + controller will automatically be dismissed if it was launched modally. + + Created by [Igor Evsukov](https://github.com/evsukov89) and contributed to + BlocksKit. + + @warning UIWebView is only available on a platform with UIKit. + */ +@interface MFMailComposeViewController (BlocksKit) + +/** The block fired on the dismissal of the mail composition interface. + + This block callback is an analog for the + mailComposeController:didFinishWithResult:error: method + of MFMailComposeViewControllerDelegate. +*/ +@property (nonatomic, copy) void(^completionBlock)(MFMailComposeViewController *, MFMailComposeResult, NSError *); + +@end \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/MFMessageComposeViewController+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/MFMessageComposeViewController+BlocksKit.h new file mode 100644 index 000000000..148e9bb9b --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/MFMessageComposeViewController+BlocksKit.h @@ -0,0 +1,30 @@ +// +// MFMessageComposeViewController+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** MFMessageComposeViewController with block callback in addition to delegation. + + If you provide a completion handler to an instance of + MFMessageComposeViewController but do not implement a delegate callback for + messageComposeViewController:didFinishWithResult:error:, the message compose + view controller will automatically be dismissed if it was launched modally. + + Created by [Igor Evsukov](https://github.com/evsukov89) and contributed to + BlocksKit. + + @warning UIWebView is only available on a platform with UIKit. +*/ +@interface MFMessageComposeViewController (BlocksKit) + +/** The block fired on the dismissal of the SMS composition interface. + + This block callback is an analog for the + messageComposeViewController:didFinishWithResult: method + of MFMessageComposeViewControllerDelegate. + */ +@property (nonatomic, copy) void(^completionBlock)(MFMessageComposeViewController *, MessageComposeResult); + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSArray+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSArray+BlocksKit.h new file mode 100755 index 000000000..b699c82b9 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSArray+BlocksKit.h @@ -0,0 +1,163 @@ +// +// NSArray+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block extensions for NSArray. + + Both inspired by and resembling Smalltalk syntax, these utilities + allows for iteration of an array in a concise way that + saves quite a bit of boilerplate code for filtering or finding + objects or an object. + + Includes code by the following: + +- [Robin Lu](https://github.com/robin) +- [Michael Ash](https://github.com/mikeash) +- [Aleks Nesterow](https://github.com/nesterow) +- [Zach Waldowski](https://github.com/zwaldowski) + + @see NSDictionary(BlocksKit) + @see NSSet(BlocksKit) + */ +@interface NSArray (BlocksKit) + +/** Loops through an array and executes the given block with each object. + + @param block A single-argument, void-returning code block. + */ +- (void)each:(BKSenderBlock)block; + +/** Enumerates through an array concurrently and executes + the given block once for each object. + + Enumeration will occur on appropriate background queues. This + will have a noticeable speed increase, especially on dual-core + devices, but you *must* be aware of the thread safety of the + objects you message from within the block. Be aware that the + order of objects is not necessarily the order each block will + be called in. + + @param block A single-argument, void-returning code block. + */ +- (void)apply:(BKSenderBlock)block; + +/** Loops through an array to find the object matching the block. + + match: is functionally identical to select:, but will stop and return + on the first match. + + @param block A single-argument, `BOOL`-returning code block. + @return Returns the object, if found, or `nil`. + @see select: + */ +- (id)match:(BKValidationBlock)block; + +/** Loops through an array to find the objects matching the block. + + @param block A single-argument, BOOL-returning code block. + @return Returns an array of the objects found. + @see match: + */ +- (NSArray *)select:(BKValidationBlock)block; + +/** Loops through an array to find the objects not matching the block. + + This selector performs *literally* the exact same function as select: but in reverse. + + This is useful, as one may expect, for removing objects from an array. + NSArray *new = [computers reject:^BOOL(id obj) { + return ([obj isUgly]); + }]; + + @param block A single-argument, BOOL-returning code block. + @return Returns an array of all objects not found. + */ +- (NSArray *)reject:(BKValidationBlock)block; + +/** Call the block once for each object and create an array of the return values. + + This is sometimes referred to as a transform, mutating one of each object: + NSArray *new = [stringArray map:^id(id obj) { + return [obj stringByAppendingString:@".png"]); + }]; + + @param block A single-argument, object-returning code block. + @return Returns an array of the objects returned by the block. + */ +- (NSArray *)map:(BKTransformBlock)block; + +/** Arbitrarily accumulate objects using a block. + + The concept of this selector is difficult to illustrate in words. The sum can + be any NSObject, including (but not limited to) a string, number, or value. + + For example, you can concentate the strings in an array: + NSString *concentrated = [stringArray reduce:@"" withBlock:^id(id sum, id obj) { + return [sum stringByAppendingString:obj]; + }]; + + You can also do something like summing the lengths of strings in an array: + NSUInteger value = [[[stringArray reduce:nil withBlock:^id(id sum, id obj) { + return @([sum integerValue] + obj.length); + }]] unsignedIntegerValue]; + + @param initial The value of the reduction at its start. + @param block A block that takes the current sum and the next object to return the new sum. + @return An accumulated value. + */ +- (id)reduce:(id)initial withBlock:(BKAccumulationBlock)block; + +/** Loops through an array to find whether any object matches the block. + + This method is similar to the Scala list `exists`. It is functionally + identical to match: but returns a `BOOL` instead. It is not recommended + to use any: as a check condition before executing match:, since it would + require two loops through the array. + + For example, you can find if a string in an array starts with a certain letter: + + NSString *letter = @"A"; + BOOL containsLetter = [stringArray any: ^(id obj) { + return [obj hasPrefix: @"A"]; + }]; + + @param block A single-argument, BOOL-returning code block. + @return YES for the first time the block returns YES for an object, NO otherwise. + */ +- (BOOL)any:(BKValidationBlock)block; + +/** Loops through an array to find whether no objects match the block. + + This selector performs *literally* the exact same function as all: but in reverse. + + @param block A single-argument, BOOL-returning code block. + @return YES if the block returns NO for all objects in the array, NO otherwise. + */ +- (BOOL)none:(BKValidationBlock)block; + +/** Loops through an array to find whether all objects match the block. + + @param block A single-argument, BOOL-returning code block. + @return YES if the block returns YES for all objects in the array, NO otherwise. + */ +- (BOOL) all: (BKValidationBlock)block; + +/** Tests whether every element of this array relates to the corresponding element of another array according to match by block. + + For example, finding if a list of numbers corresponds to their sequenced string values; + NSArray *numbers = @[ @(1), @(2), @(3) ]; + NSArray *letters = @[ @"1", @"2", @"3" ]; + BOOL doesCorrespond = [numbers corresponds: letters withBlock: ^(id number, id letter) { + return [[number stringValue] isEqualToString: letter]; + }]; + + @param list An array of objects to compare with. + @param block A two-argument, BOOL-returning code block. + @return Returns a BOOL, true if every element of array relates to corresponding element in another array. + */ +- (BOOL) corresponds: (NSArray *) list withBlock: (BKKeyValueValidationBlock) block; + +@end \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSCache+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSCache+BlocksKit.h new file mode 100644 index 000000000..12a7e4e05 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSCache+BlocksKit.h @@ -0,0 +1,53 @@ +// +// NSCache+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** NSCache with block adding of objects + + This category allows you to conditionally add objects to + an instance of NSCache using blocks. Both the normal + delegation pattern and a block callback for NSCache's one + delegate method are allowed. + + These methods emulate Rails caching behavior. + + Created by [Igor Evsukov](https://github.com/evsukov89) and contributed to BlocksKit. + */ + +@interface NSCache (BlocksKit) + +/** Returns the value associated with a given key. If there is no + object for that key, it uses the result of the block, saves + that to the cache, and returns it. + + This mimics the cache behavior of Ruby on Rails. The following code: + + @products = Rails.cache.fetch('products') do + Product.all + end + + becomes: + + NSMutableArray *products = [cache objectForKey:@"products" withGetter:^id{ + return [Product all]; + }]; + + @return The value associated with *key*, or the object returned + by the block if no value is associated with *key*. + @param key An object identifying the value. + @param getterBlock A block used to get an object if there is no + value in the cache. + */ +- (id)objectForKey:(id)key withGetter:(BKReturnBlock)getterBlock; + +/** Called when an object is about to be evicted from the cache. + + This block callback is an analog for the cache:willEviceObject: + method of NSCacheDelegate. + */ +@property (nonatomic, copy) void(^willEvictBlock)(NSCache *, id); + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSDictionary+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSDictionary+BlocksKit.h new file mode 100755 index 000000000..80c8d9d91 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSDictionary+BlocksKit.h @@ -0,0 +1,110 @@ +// +// NSDictionary+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block extension for NSDictionary. + + Both inspired by and resembling Smalltalk syntax, this utility + allows iteration of a dictionary in a concise way that + saves quite a bit of boilerplate code. + + Includes code by the following: + +- [Mirko Kiefer](https://github.com/mirkok) +- [Zach Waldowski](https://github.com/zwaldowski) + + @see NSArray(BlocksKit) + @see NSSet(BlocksKit) + */ +@interface NSDictionary (BlocksKit) + +/** Loops through the dictionary and executes the given block using each item. + + @param block A block that performs an action using a key/value pair. + */ +- (void)each:(BKKeyValueBlock)block; + +/** Enumerates through the dictionary concurrently and executes + the given block once for each pair. + + Enumeration will occur on appropriate background queues; + the system will spawn threads as need for execution. This + will have a noticeable speed increase, especially on dual-core + devices, but you *must* be aware of the thread safety of the + objects you message from within the block. + + @param block A block that performs an action using a key/value pair. + */ +- (void)apply:(BKKeyValueBlock)block; + +/** Loops through a dictionary to find the first key/value pair matching the block. + + match: is functionally identical to select:, but will stop and return + the value on the first match. + + @param block A BOOL-returning code block for a key/value pair. + @return The value of the first pair found; + */ +- (id)match:(BKKeyValueValidationBlock)block; + +/** Loops through a dictionary to find the key/value pairs matching the block. + + @param block A BOOL-returning code block for a key/value pair. + @return Returns a dictionary of the objects found. + */ +- (NSDictionary *)select:(BKKeyValueValidationBlock)block; + +/** Loops through a dictionary to find the key/value pairs not matching the block. + + This selector performs *literally* the exact same function as select: but in reverse. + + This is useful, as one may expect, for filtering objects. + NSDictionary *strings = [userData reject:^BOOL(id key, id value) { + return ([obj isKindOfClass:[NSString class]]); + }]; + + @param block A BOOL-returning code block for a key/value pair. + @return Returns a dictionary of all objects not found. + */ +- (NSDictionary *)reject:(BKKeyValueValidationBlock)block; + +/** Call the block once for each object and create a dictionary with the same keys + and a new set of values. + + @param block A block that returns a new value for a key/value pair. + @return Returns a dictionary of the objects returned by the block. + */ +- (NSDictionary *)map:(BKKeyValueTransformBlock)block; + +/** Loops through a dictionary to find whether any key/value pair matches the block. + + This method is similar to the Scala list `exists`. It is functionally + identical to match: but returns a `BOOL` instead. It is not recommended + to use any: as a check condition before executing match:, since it would + require two loops through the dictionary. + + @param block A two-argument, BOOL-returning code block. + @return YES for the first time the block returns YES for a key/value pair, NO otherwise. + */ +- (BOOL)any:(BKKeyValueValidationBlock)block; + +/** Loops through a dictionary to find whether no key/value pairs match the block. + + This selector performs *literally* the exact same function as all: but in reverse. + + @param block A two-argument, BOOL-returning code block. + @return YES if the block returns NO for all key/value pairs in the dictionary, NO otherwise. + */ +- (BOOL)none:(BKKeyValueValidationBlock)block; + +/** Loops through a dictionary to find whether all key/value pairs match the block. + + @param block A two-argument, BOOL-returning code block. + @return YES if the block returns YES for all key/value pairs in the dictionary, NO otherwise. + */ +- (BOOL)all:(BKKeyValueValidationBlock)block; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSIndexSet+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSIndexSet+BlocksKit.h new file mode 100755 index 000000000..47432648d --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSIndexSet+BlocksKit.h @@ -0,0 +1,119 @@ +// +// NSIndexSet+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block extensions for NSIndexSet. + + Both inspired by and resembling Smalltalk syntax, these utilities + allows for iteration of an array in a concise way that + saves quite a bit of boilerplate code for filtering or finding + objects or an object. + + Includes code by the following: + +- [Robin Lu](https://github.com/robin) +- [Michael Ash](https://github.com/mikeash) +- [Zach Waldowski](https://github.com/zwaldowski) +- [Kaelin Colclasure] + + @see NSArray(BlocksKit) + @see NSDictionary(BlocksKit) + @see NSSet(BlocksKit) + */ +@interface NSIndexSet (BlocksKit) + +/** Loops through an index set and executes the given block at each index. + + @param block A single-argument, void-returning code block. + */ +- (void)each:(BKIndexBlock)block; + +/** Enumerates each index in an index set concurrently and executes the + given block once per index. + + Enumeration will occur on appropriate background queues. + Be aware that the block will not necessarily be executed + in order for each index. + + @param block A single-argument, void-returning code block. + */ +- (void)apply:(BKIndexBlock)block; + +/** Loops through an array and returns the index matching the block. + + @param block A single-argument, `BOOL`-returning code block. + @return Returns the index if found, `NSNotFound` otherwise. + @see select: + */ +- (NSUInteger)match:(BKIndexValidationBlock)block; + +/** Loops through an index set and returns an all indexes matching the block. + + @param block A single-argument, BOOL-returning code block. + @return Returns an index set of matching indexes found. + @see match: + */ +- (NSIndexSet *)select:(BKIndexValidationBlock)block; + +/** Loops through an index set and returns an all indexes but the ones matching the block. + + This selector performs *literally* the exact same function as select: but in reverse. + + @param block A single-argument, BOOL-returning code block. + @return Returns an index set of all indexes but those matched. + */ +- (NSIndexSet *)reject:(BKIndexValidationBlock)block; + +/** Call the block once for each index and create an index set with the new values. + + @param block A block that returns a new index for an index. + @return An index set of the indexes returned by the block. + */ +- (NSIndexSet *)map:(BKIndexTransformBlock)block; + +/** Call the block once for each index and create an array of the return values. + + This method allows transforming indexes into objects: + int values[10] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }; + NSIndexSet *idxs = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 10)]; + NSArray *new = [idxs mapIndex:^id(NSUInteger index) { + return [NSNumber numberWithInt:values[index]]); + }]; + + @param block A block that returns an object for an index. + @return Returns an array of the objects returned by the block. + */ +- (NSArray *)mapIndex:(BKIndexMapBlock)block; + +/** Loops through an index set to find whether any of the indexes matche the block. + + This method is similar to the Scala list `exists`. It is functionally + identical to match: but returns a `BOOL` instead. It is not recommended + to use any: as a check condition before executing match:, since it would + require two loops through the index set. + + @param block A single-argument, BOOL-returning code block. + @return YES for the first time the block returns YES for an index, NO otherwise. + */ +- (BOOL)any:(BKIndexValidationBlock)block; + +/** Loops through an index set to find whether all objects match the block. + + @param block A single-argument, BOOL-returning code block. + @return YES if the block returns YES for all indexes in the array, NO otherwise. + */ +- (BOOL)all:(BKIndexValidationBlock)block; + +/** Loops through an index set to find whether no objects match the block. + + This selector performs *literally* the exact same function as all: but in reverse. + + @param block A single-argument, BOOL-returning code block. + @return YES if the block returns NO for all indexes in the array, NO otherwise. + */ +- (BOOL)none:(BKIndexValidationBlock)block; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSInvocation+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSInvocation+BlocksKit.h new file mode 100755 index 000000000..15a8be746 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSInvocation+BlocksKit.h @@ -0,0 +1,30 @@ +// +// NSInvocation+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** BlocksKit extensions for NSInvocation. */ +@interface NSInvocation (BlocksKit) + +/** Generates an `NSInvocation` instance for a given block. + + NSInvocation *invocation = [NSInvocation invocationWithTarget: target block: ^(id myObject){ + [myObject someMethodWithArg:42.0]; + }]; + + This returns an invocation with the appropriate target, selector, and arguments + without creating the buffers yourself. It is only recommended to call a method + on the argument to the block only once. + + Created by [Jonathan Rentzch](https://github.com/rentzsch) as + `NSInvocation-blocks`. + + @param target The object to "grab" the block invocation from. + @param block A code block. + @return A fully-prepared instance of NSInvocation ready to be invoked. + */ ++ (NSInvocation *)invocationWithTarget:(id)target block:(BKSenderBlock)block; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableArray+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableArray+BlocksKit.h new file mode 100644 index 000000000..cc33c8ee5 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableArray+BlocksKit.h @@ -0,0 +1,50 @@ +// +// NSMutableArray+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block extensions for NSMutableArray. + + These utilities expound upon the BlocksKit additions to the immutable + superclass by allowing certain utilities to work on an instance of the mutable + class, saving memory by not creating an immutable copy of the results. + + Includes code by the following: + + - [Martin Schürrer](https://github.com/MSch) + - [Zach Waldowski](https://github.com/zwaldowski) + + @see NSArray(BlocksKit) + */ +@interface NSMutableArray (BlocksKit) + +/** Filters a mutable array to the objects matching the block. + + @param block A single-argument, BOOL-returning code block. + @see reject: + */ +- (void)performSelect:(BKValidationBlock)block; + +/** Filters a mutable array to all objects but the ones matching the block, + the logical inverse to select:. + + @param block A single-argument, BOOL-returning code block. + @see select: + */ +- (void)performReject:(BKValidationBlock)block; + +/** Transform the objects in the array to the results of the block. + + This is sometimes referred to as a transform, mutating one of each object: + [foo performMap:^id(id obj) { + return [dateTransformer dateFromString:obj]; + }]; + + @param block A single-argument, object-returning code block. + @see map: + */ +- (void)performMap:(BKTransformBlock)block; + +@end \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableDictionary+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableDictionary+BlocksKit.h new file mode 100644 index 000000000..6da885480 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableDictionary+BlocksKit.h @@ -0,0 +1,46 @@ +// +// NSMutableDictionary+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block extensions for NSMutableDictionary. + + These utilities expound upon the BlocksKit additions to the immutable + superclass by allowing certain utilities to work on an instance of the mutable + class, saving memory by not creating an immutable copy of the results. + + Includes code by the following: + + - [Martin Schürrer](https://github.com/MSch) + - [Zach Waldowski](https://github.com/zwaldowski) + + @see NSDictionary(BlocksKit) + */ +@interface NSMutableDictionary (BlocksKit) + +/** Filters a mutable dictionary to the key/value pairs matching the block. + + @param block A BOOL-returning code block for a key/value pair. + @see reject: + */ +- (void)performSelect:(BKKeyValueValidationBlock)block; + +/** Filters a mutable dictionary to the key/value pairs not matching the block, + the logical inverse to select:. + + @param block A BOOL-returning code block for a key/value pair. + @see select: + */ +- (void)performReject:(BKKeyValueValidationBlock)block; + +/** Transform each value of the dictionary to a new value, as returned by the + block. + + @param block A block that returns a new value for a given key/value pair. + @see map: + */ +- (void)performMap:(BKKeyValueTransformBlock)block; + +@end \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableIndexSet+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableIndexSet+BlocksKit.h new file mode 100644 index 000000000..d9c411b87 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableIndexSet+BlocksKit.h @@ -0,0 +1,42 @@ +// +// NSMutableIndexSet+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block extensions for NSMutableIndexSet. + + These utilities expound upon the BlocksKit additions to the immutable + superclass by allowing certain utilities to work on an instance of the mutable + class, saving memory by not creating an immutable copy of the results. + + @see NSIndexSet(BlocksKit) + */ +@interface NSMutableIndexSet (BlocksKit) + +/** Filters a mutable index set to the indexes matching the block. + + @param block A single-argument, BOOL-returning code block. + @see reject: + */ +- (void)performSelect:(BKIndexValidationBlock)block; + +/** Filters a mutable index set to all indexes but the ones matching the block, + the logical inverse to select:. + + @param block A single-argument, BOOL-returning code block. + @see select: + */ +- (void)performReject:(BKIndexValidationBlock)block; + +/** Transform each index of the index set to a new index, as returned by the + block. + + @param block A block that returns a new index for a index. + @see map: + */ +- (void)performMap:(BKIndexTransformBlock)block; + + +@end \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableOrderedSet+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableOrderedSet+BlocksKit.h new file mode 100755 index 000000000..5ad06fb40 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableOrderedSet+BlocksKit.h @@ -0,0 +1,50 @@ +// +// NSMutableOrderedSet+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block extensions for NSMutableOrderedSet. + + These utilities expound upon the BlocksKit additions to the immutable + superclass by allowing certain utilities to work on an instance of the mutable + class, saving memory by not creating an immutable copy of the results. + + Includes code by the following: + + - [Martin Schürrer](https://github.com/MSch) + - [Zach Waldowski](https://github.com/zwaldowski) + + @see NSOrderedSet(BlocksKit) + */ +@interface NSMutableOrderedSet (BlocksKit) + +/** Filters a mutable ordered set to the objects matching the block. + + @param block A single-argument, BOOL-returning code block. + @see reject: + */ +- (void)performSelect:(BKValidationBlock)block; + +/** Filters a mutable ordered set to all objects but the ones matching the + block, the logical inverse to select:. + + @param block A single-argument, BOOL-returning code block. + @see select: + */ +- (void)performReject:(BKValidationBlock)block; + +/** Transform the objects in the ordered set to the results of the block. + + This is sometimes referred to as a transform, mutating one of each object: + [foo performMap:^id(id obj) { + return [dateTransformer dateFromString:obj]; + }]; + + @param block A single-argument, object-returning code block. + @see map: + */ +- (void)performMap:(BKTransformBlock)block; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableSet+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableSet+BlocksKit.h new file mode 100644 index 000000000..604f845d8 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSMutableSet+BlocksKit.h @@ -0,0 +1,50 @@ +// +// NSMutableSet+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block extensions for NSMutableSet. + + These utilities expound upon the BlocksKit additions to the immutable + superclass by allowing certain utilities to work on an instance of the mutable + class, saving memory by not creating an immutable copy of the results. + + Includes code by the following: + + - [Martin Schürrer](https://github.com/MSch) + - [Zach Waldowski](https://github.com/zwaldowski) + + @see NSSet(BlocksKit) + */ +@interface NSMutableSet (BlocksKit) + +/** Filters a mutable set to the objects matching the block. + + @param block A single-argument, BOOL-returning code block. + @see reject: + */ +- (void)performSelect:(BKValidationBlock)block; + +/** Filters a mutable set to all objects but the ones matching the block, + the logical inverse to select:. + + @param block A single-argument, BOOL-returning code block. + @see select: + */ +- (void)performReject:(BKValidationBlock)block; + +/** Transform the objects in the set to the results of the block. + + This is sometimes referred to as a transform, mutating one of each object: + [controllers map:^id(id obj) { + return [obj view]; + }]; + + @param block A single-argument, object-returning code block. + @see map: + */ +- (void)performMap:(BKTransformBlock)block; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSObject+A2DynamicDelegate.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSObject+A2DynamicDelegate.h new file mode 100644 index 000000000..a58112618 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSObject+A2DynamicDelegate.h @@ -0,0 +1,68 @@ +// +// NSObject+A2DynamicDelegate.h +// BlocksKit +// + +#import "BKGlobals.h" +#import "A2DynamicDelegate.h" + +/** The A2DynamicDelegate category to NSObject provides the primary interface + by which dynamic delegates are generated for a given object. */ +@interface NSObject (A2DynamicDelegate) + +/** Creates or gets a dynamic data source for the reciever. + + A2DynamicDelegate assumes a protocol name `FooBarDataSource` + for instances of class `FooBar`. The object is given a strong + attachment to the reciever, and is automatically deallocated + when the reciever is released. + + If the user implements a `A2DynamicFooBarDataSource` subclass + of A2DynamicDelegate, its implementation of any method + will be used over the block. If the block needs to be used, + it can be called from within the custom + implementation using blockImplementationForMethod:. + + @see blockImplementationForMethod: + @return A dynamic data source. + */ +- (id) dynamicDataSource; + +/** Creates or gets a dynamic delegate for the reciever. + + A2DynamicDelegate assumes a protocol name `FooBarDelegate` + for instances of class `FooBar`. The object is given a strong + attachment to the reciever, and is automatically deallocated + when the reciever is released. + + If the user implements a `A2DynamicFooBarDelegate` subclass + of A2DynamicDelegate, its implementation of any method + will be used over the block. If the block needs to be used, + it can be called from within the custom + implementation using blockImplementationForMethod:. + + @see blockImplementationForMethod: + @return A dynamic delegate. + */ +- (id) dynamicDelegate; + +/** Creates or gets a dynamic protocol implementation for + the reciever. The designated initializer. + + The object is given a strong attachment to the reciever, + and is automatically deallocated when the reciever is released. + + If the user implements a subclass of A2DynamicDelegate prepended + with `A2Dynamic`, such as `A2DynamicFooProvider`, its + implementation of any method will be used over the block. + If the block needs to be used, it can be called from within the + custom implementation using blockImplementationForMethod:. + + @param protocol A custom protocol. + @return A dynamic protocol implementation. + @see blockImplementationForMethod: + */ +- (id) dynamicDelegateForProtocol: (Protocol *) protocol; + + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSObject+AssociatedObjects.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSObject+AssociatedObjects.h new file mode 100755 index 000000000..f39fa352b --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSObject+AssociatedObjects.h @@ -0,0 +1,158 @@ +// +// NSObject+AssociatedObjects.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Objective-C wrapper for 10.6+ associated object API. + + In Mac OS X Snow Leopard and iOS 3.0, Apple introduced an addition to the + Objective-C Runtime called associated objects. Associated objects allow for the + pairing of a random key and object pair to be saved on an instance. + + In BlocksKit, associated objects allow us to emulate instance variables in the + ategories we use. + + Class methods also exist for each association. These associations are unique to + each class, and exist for the lifetime of the application unless set to `nil`. + Each class is a unique meta-object; the ultimate singleton. + + Created by [Andy Matuschak](https://github.com/andymatuschak) as + `AMAssociatedObjects`. + */ +@interface NSObject (BKAssociatedObjects) + +/** Strongly associates an object with the reciever. + + The associated value is retained as if it were a property + synthesized with `nonatomic` and `retain`. + + Using retained association is strongly recommended for most + Objective-C object derivative of NSObject, particularly + when it is subject to being externally released or is in an + `NSAutoreleasePool`. + + @param value Any object. + @param key A unique key pointer. + */ +- (void)associateValue:(id)value withKey:(const void *)key; + +/** Strongly associates an object with the receiving class. + + @see associateValue:withKey: + @param value Any object. + @param key A unique key pointer. + */ ++ (void)associateValue:(id)value withKey:(const void *)key; + +/** Strongly, thread-safely associates an object with the reciever. + + The associated value is retained as if it were a property + synthesized with `atomic` and `retain`. + + Using retained association is strongly recommended for most + Objective-C object derivative of NSObject, particularly + when it is subject to being externally released or is in an + `NSAutoreleasePool`. + + @see associateValue:withKey: + @param value Any object. + @param key A unique key pointer. + */ +- (void)atomicallyAssociateValue:(id)value withKey:(const void *)key; + +/** Strongly, thread-safely associates an object with the receiving class. + + @see associateValue:withKey: + @param value Any object. + @param key A unique key pointer. + */ ++ (void)atomicallyAssociateValue:(id)value withKey:(const void *)key; + +/** Associates a copy of an object with the reciever. + + The associated value is copied as if it were a property + synthesized with `nonatomic` and `copy`. + + Using copied association is recommended for a block or + otherwise `NSCopying`-compliant instances like NSString. + + @param value Any object, pointer, or value. + @param key A unique key pointer. + */ +- (void)associateCopyOfValue:(id)value withKey:(const void *)key; + +/** Associates a copy of an object with the receiving class. + + @see associateCopyOfValue:withKey: + @param value Any object, pointer, or value. + @param key A unique key pointer. + */ ++ (void)associateCopyOfValue:(id)value withKey:(const void *)key; + +/** Thread-safely associates a copy of an object with the reciever. + + The associated value is copied as if it were a property + synthesized with `atomic` and `copy`. + + Using copied association is recommended for a block or + otherwise `NSCopying`-compliant instances like NSString. + + @see associateCopyOfValue:withKey: + @param value Any object, pointer, or value. + @param key A unique key pointer. + */ +- (void)atomicallyAssociateCopyOfValue:(id)value withKey:(const void *)key; + +/** Thread-safely associates a copy of an object with the receiving class. + + @see associateCopyOfValue:withKey: + @param value Any object, pointer, or value. + @param key A unique key pointer. + */ ++ (void)atomicallyAssociateCopyOfValue:(id)value withKey:(const void *)key; + +/** Weakly associates an object with the reciever. + + A weak association will cause the pointer to be set to zero + or nil upon the disappearance of what it references; + in other words, the associated object is not kept alive. + + @param value Any object. + @param key A unique key pointer. + */ +- (void)weaklyAssociateValue:(id)value withKey:(const void *)key; + +/** Weakly associates an object with the receiving class. + + @see weaklyAssociateValue:withKey: + @param value Any object. + @param key A unique key pointer. + */ ++ (void)weaklyAssociateValue:(id)value withKey:(const void *)key; + +/** Returns the associated value for a key on the reciever. + + @param key A unique key pointer. + @return The object associated with the key, or `nil` if not found. + */ +- (id)associatedValueForKey:(const void *)key; + +/** Returns the associated value for a key on the receiving class. + + @see associatedValueForKey: + @param key A unique key pointer. + @return The object associated with the key, or `nil` if not found. + */ ++ (id)associatedValueForKey:(const void *)key; + +/** Returns the reciever to a clean state by removing all + associated objects, releasing them if necessary. */ +- (void)removeAllAssociatedObjects; + +/** Returns the recieving class to a clean state by removing + all associated objects, releasing them if necessary. */ ++ (void)removeAllAssociatedObjects; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSObject+BlockObservation.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSObject+BlockObservation.h new file mode 100755 index 000000000..b66d9d354 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSObject+BlockObservation.h @@ -0,0 +1,138 @@ +// +// NSObject+BlockObservation.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Blocks wrapper for key-value observation. + + In Mac OS X Panther, Apple introduced an API called "key-value + observing." It implements an [observer pattern](http://en.wikipedia.org/wiki/Observer_pattern), + where an object will notify observers of any changes in state. + + NSNotification is a rudimentary form of this design style; + KVO, however, allows for the observation of any change in key-value state. + The API for key-value observation, however, is flawed, ugly, and lengthy. + + Like most of the other block abilities in BlocksKit, observation saves + and a bunch of code and a bunch of potential bugs. + + Includes code by the following: + + - [Andy Matuschak](https://github.com/andymatuschak) + - [Jon Sterling](https://github.com/jonsterling) + - [Zach Waldowski](https://github.com/zwaldowski) + - [Jonathan Wight](https://github.com/schwa) + */ + +@interface NSObject (BlockObservation) + +/** Adds an observer to an object conforming to NSKeyValueObserving. + + Adds a block observer that executes a block upon a state change. + + @param keyPath The property to observe, relative to the reciever. + @param task A block with no return argument, and a single parameter: the reciever. + @return Returns a globally unique process identifier for removing + observation with removeObserverWithBlockToken:. + @see addObserverForKeyPath:identifier:options:task: + */ +- (NSString *)addObserverForKeyPath:(NSString *)keyPath task:(BKSenderBlock)task; + +/** Adds an observer to an object conforming to NSKeyValueObserving. + + Adds a block observer that executes the same block upon + multiple state changes. + + @param keyPaths An array of properties to observe, relative to the reciever. + @param task A block with no return argument and two parameters: the + reciever and the key path of the value change. + @return A unique identifier for removing + observation with removeObserverWithBlockToken:. + @see addObserverForKeyPath:identifier:options:task: + */ +- (NSString *)addObserverForKeyPaths:(NSArray *)keyPaths task:(BKSenderKeyPathBlock)task; + +/** Adds an observer to an object conforming to NSKeyValueObserving. + + Adds a block observer that executes a block upon a state change + with specific options. + + @param keyPath The property to observe, relative to the reciever. + @param options The NSKeyValueObservingOptions to use. + @param task A block with no return argument and two parameters: the + reciever and the change dictionary. + @return Returns a globally unique process identifier for removing + observation with removeObserverWithBlockToken:. + @see addObserverForKeyPath:identifier:options:task: + */ +- (NSString *)addObserverForKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options task:(BKObservationBlock)task; + +/** Adds an observer to an object conforming to NSKeyValueObserving. + + Adds a block observer that executes the same block upon + multiple state changes with specific options. + + @param keyPaths An array of properties to observe, relative to the reciever. + @param options The NSKeyValueObservingOptions to use. + @param task A block with no return argument and three parameters: the + reciever, the key path of the value change, and the change dictionary. + @param task A block responding to the reciever, the key path, and the KVO change. + @return A unique identifier for removing + observation with removeObserverWithBlockToken:. + @see addObserverForKeyPath:identifier:options:task: + */ +- (NSString *)addObserverForKeyPaths:(NSArray *)keyPaths options:(NSKeyValueObservingOptions)options task:(BKMultipleObservationBlock)task; + +/** Adds an observer to an object conforming to NSKeyValueObserving. + + Adds a block observer that executes the block upon a + state change. + + @param keyPath The property to observe, relative to the reciever. + @param token An identifier for the observation block. + @param options The NSKeyValueObservingOptions to use. + @param task A block responding to the reciever and the KVO change. + observation with removeObserverWithBlockToken:. + @see addObserverForKeyPath:task: + */ +- (void)addObserverForKeyPath:(NSString *)keyPath identifier:(NSString *)token options:(NSKeyValueObservingOptions)options task:(BKObservationBlock)task; + +/** Adds an observer to an object conforming to NSKeyValueObserving. + + Adds a block observer that executes the same block upon + multiple state changes. + + @param keyPaths An array of properties to observe, relative to the reciever. + @param token An identifier for the observation block. + @param options The NSKeyValueObservingOptions to use. + @param task A block responding to the reciever, the key path, and the KVO change. + observation with removeObserversWithIdentifier:. + @see addObserverForKeyPath:task: + */ +- (void)addObserverForKeyPaths:(NSArray *)keyPaths identifier:(NSString *)token options:(NSKeyValueObservingOptions)options task:(BKMultipleObservationBlock)task; + +/** Removes a block observer. + + @param keyPath The property to stop observing, relative to the reciever. + @param token The unique key returned by addObserverForKeyPath:task: + or the identifier given in addObserverForKeyPath:identifier:task:. + @see removeObserversWithIdentifier: + */ +- (void)removeObserverForKeyPath:(NSString *)keyPath identifier:(NSString *)token; + +/** Removes multiple block observers with a certain identifier. + + @param token A unique key returned by addObserverForKeyPath:task: + and addObserverForKeyPaths:task: or the identifier given in + addObserverForKeyPath:identifier:task: and + addObserverForKeyPaths:identifier:task:. + @see removeObserverForKeyPath:identifier: + */ +- (void)removeObserversWithIdentifier:(NSString *)token; + +/** Remove all registered block observers. */ +- (void)removeAllBlockObservers; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSObject+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSObject+BlocksKit.h new file mode 100755 index 000000000..ef50cf9a2 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSObject+BlocksKit.h @@ -0,0 +1,72 @@ +// +// NSObject+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" +#import "NSObject+AssociatedObjects.h" + +/** Block execution on *any* object. + + This category overhauls the `performSelector:` utilities on + NSObject to instead use blocks. Not only are the blocks performed + extremely speedily, thread-safely, and asynchronously using + Grand Central Dispatch, but each convenience method also returns + a pointer that can be used to cancel the execution before it happens! + + Includes code by the following: + + - [Peter Steinberger](https://github.com/steipete) + - [Zach Waldowski](https://github.com/zwaldowski) + + */ +@interface NSObject (BlocksKit) + +/** Executes a block after a given delay on the reciever. + + [array performBlock:^(id obj){ + [obj addObject:self]; + [self release]; + } afterDelay:0.5f]; + + @warning *Important:* Use of the **self** reference in a block will + reference the current implementation context. The block argument, + `obj`, should be used instead. + + @param block A single-argument code block, where `obj` is the reciever. + @param delay A measure in seconds. + @return Returns a pointer to the block that may or may not execute the given block. + */ +- (id)performBlock:(BKSenderBlock)block afterDelay:(NSTimeInterval)delay; + +/** Executes a block after a given delay. + + This class method is functionally identical to its instance method version. It still executes + asynchronously via GCD. However, the current context is not passed so that the block is performed + in a general context. + + Block execution is very useful, particularly for small events that you would like delayed. + + [object performBlock:^(){ + [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; + } afterDelay:0.5f]; + + @see performBlock:afterDelay: + @param block A code block. + @param delay A measure in seconds. + @return Returns a pointer to the block that may or may not execute the given block. + */ ++ (id)performBlock:(BKBlock)block afterDelay:(NSTimeInterval)delay; + +/** Cancels the potential execution of a block. + + @warning *Important:* It is not recommended to cancel a block executed + with no delay (a delay of 0.0). While it it still possible to catch the block + before GCD has executed it, it has likely already been executed and disposed of. + + @param block A pointer to a containing block, as returned from one of the + `performBlock` selectors. + */ ++ (void)cancelBlock:(id)block; + +@end \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSOrderedSet+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSOrderedSet+BlocksKit.h new file mode 100755 index 000000000..b6413814b --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSOrderedSet+BlocksKit.h @@ -0,0 +1,168 @@ +// +// NSOrderedSet+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block extensions for NSOrderedSet. + + Both inspired by and resembling Smalltalk syntax, these utilities allow for + iteration through an ordered set (also known as a uniqued array) in a concise + way that saves a ton of boilerplate code for filtering or finding objects. + + Includes code by the following: + + - Robin Lu. . 2009. + - Michael Ash. . 2010. BSD. + - Aleks Nesterow. . 2010. BSD. + - Zach Waldowski. . 2011. + + @see NSArray(BlocksKit) + @see NSSet(BlocksKit) + */ +@interface NSOrderedSet (BlocksKit) + +/** Loops through an ordered set and executes the given block with each object. + + @param block A single-argument, void-returning code block. + */ +- (void)each:(BKSenderBlock)block; + +/** Enumerates through an ordered set concurrently and executes the given block + once for each object. + + Enumeration will occur on appropriate background queues. This will have a + noticeable speed increase, especially on multi-core devices, but you *must* + be aware of the thread safety of the objects you message from within the block. + Be aware that the order of objects is not necessarily the order each block will + be called in. + + @param block A single-argument, void-returning code block. + */ +- (void)apply:(BKSenderBlock)block; + +/** Loops through an ordered set to find the object matching the block. + + match: is functionally identical to select:, but will stop and return + on the first match. + + @param block A single-argument, `BOOL`-returning code block. + @return Returns the object, if found, or `nil`. + @see select: + */ +- (id)match:(BKValidationBlock)block; + +/** Loops through an ordered set to find the objects matching the block. + + @param block A single-argument, BOOL-returning code block. + @return Returns an ordered set of the objects found. + @see match: + */ +- (NSOrderedSet *)select:(BKValidationBlock)block; + +/** Loops through an ordered set to to find the objects not matching the block. + + This selector performs *literally* the exact same function as select: but in + reverse. + + This is useful, as one may expect, for removing objects from an ordered set to. + NSOrderedSet *new = [computers reject:^BOOL(id obj) { + return ([obj isUgly]); + }]; + + @param block A single-argument, BOOL-returning code block. + @return Returns an ordered set of all objects not found. + */ +- (NSOrderedSet *)reject:(BKValidationBlock)block; + +/** Call the block once for each object and create an ordered set of the return + values. + + This is sometimes referred to as a transform, mutating one of each object: + NSOrderedSet *new = [stringArray map:^id(id obj) { + return [obj stringByAppendingString:@".png"]); + }]; + + @param block A single-argument, object-returning code block. + @return Returns an ordered set of the objects returned by the block. + */ +- (NSOrderedSet *)map:(BKTransformBlock)block; + +/** Arbitrarily accumulate objects using a block. + + The concept of this selector is difficult to illustrate in words. The sum can + be any NSObject, including (but not limited to) a string, number, or value. + + For example, you can concentate the strings in an ordered set: + NSString *concentrated = [stringArray reduce:@"" withBlock:^id(id sum, id obj) { + return [sum stringByAppendingString:obj]; + }]; + + You can also do something like summing the lengths of strings in an ordered set: + NSUInteger value = [[[stringArray reduce:nil withBlock:^id(id sum, id obj) { + return @([sum integerValue] + obj.length); + }]] unsignedIntegerValue]; + + @param initial The value of the reduction at its start. + @param block A block that takes the current sum and the next object to return the new sum. + @return An accumulated value. + */ +- (id)reduce:(id)initial withBlock:(BKAccumulationBlock)block; + +/** Loops through an ordered set to find whether any object matches the block. + + This method is similar to the Scala list `exists`. It is functionally + identical to match: but returns a `BOOL` instead. It is not recommended + to use any: as a check condition before executing match:, since it would + require two loops through the ordered set. + + For example, you can find if a string in an ordered set starts with a certain + letter: + + NSString *letter = @"A"; + BOOL containsLetter = [stringArray any: ^(id obj) { + return [obj hasPrefix: @"A"]; + }]; + + @param block A single-argument, BOOL-returning code block. + @return YES for the first time the block returns YES for an object, NO otherwise. + */ +- (BOOL)any:(BKValidationBlock)block; + +/** Loops through an ordered set to find whether no objects match the block. + + This selector performs *literally* the exact same function as all: but in reverse. + + @param block A single-argument, BOOL-returning code block. + @return YES if the block returns NO for all objects in the ordered set, NO + otherwise. + */ +- (BOOL)none:(BKValidationBlock)block; + +/** Loops through an ordered set to find whether all objects match the block. + + @param block A single-argument, BOOL-returning code block. + @return YES if the block returns YES for all objects in the ordered set, NO + otherwise. + */ +- (BOOL) all: (BKValidationBlock)block; + +/** Tests whether every element of this ordered set relates to the corresponding + element of another array according to match by block. + + For example, finding if a list of numbers corresponds to their sequenced string values; + + NSArray *numbers = @[ @(1), @(2), @(3) ]; + NSArray *letters = @[ @"1", @"2", @"3" ]; + BOOL doesCorrespond = [numbers corresponds: letters withBlock: ^(id number, id letter) { + return [[number stringValue] isEqualToString: letter]; + }]; + + @param list An array of objects to compare with. + @param block A two-argument, BOOL-returning code block. + @return Returns a BOOL, true if every element of the ordered set relates to + corresponding element in another ordered set. + */ +- (BOOL) corresponds: (NSOrderedSet *) list withBlock: (BKKeyValueValidationBlock) block; +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSSet+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSSet+BlocksKit.h new file mode 100755 index 000000000..64b85b555 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSSet+BlocksKit.h @@ -0,0 +1,133 @@ +// +// NSSet+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block extensions for NSSet. + + Both inspired by and resembling Smalltalk syntax, these utilities allows for + iteration of a set in a logical way that saves quite a bit of boilerplate code + for filtering or finding objects or an object. + + Includes code by the following: + +- [Michael Ash](https://github.com/mikeash) +- [Corey Floyd](https://github.com/coreyfloyd) +- [Aleks Nesterow](https://github.com/nesterow) +- [Zach Waldowski](https://github.com/zwaldowski) + + @see NSArray(BlocksKit) + @see NSDictionary(BlocksKit) + */ +@interface NSSet (BlocksKit) + +/** Loops through a set and executes the given block with each object. + + @param block A single-argument, void-returning code block. + */ +- (void)each:(BKSenderBlock)block; + +/** Enumerates through a set concurrently and executes + the given block once for each object. + + Enumeration will occur on appropriate background queues. This + will have a noticeable speed increase, especially on dual-core + devices, but you *must* be aware of the thread safety of the + objects you message from within the block. + + @param block A single-argument, void-returning code block. + */ +- (void)apply:(BKSenderBlock)block; + +/** Loops through a set to find the object matching the block. + + match: is functionally identical to select:, but will stop and return + on the first match. + + @param block A single-argument, BOOL-returning code block. + @return Returns the object if found, `nil` otherwise. + @see select: + */ +- (id)match:(BKValidationBlock)block; + +/** Loops through a set to find the objects matching the block. + + @param block A single-argument, BOOL-returning code block. + @return Returns a set of the objects found. + @see match: + */ +- (NSSet *)select:(BKValidationBlock)block; + +/** Loops through a set to find the objects not matching the block. + + This selector performs *literally* the exact same function as select, but in reverse. + + This is useful, as one may expect, for removing objects from a set: + NSSet *new = [reusableWebViews reject:^BOOL(id obj) { + return ([obj isLoading]); + }]; + + @param block A single-argument, BOOL-returning code block. + @return Returns an array of all objects not found. + */ +- (NSSet *)reject:(BKValidationBlock)block; + +/** Call the block once for each object and create a set of the return values. + + This is sometimes referred to as a transform, mutating one of each object: + NSSet *new = [mimeTypes map:^id(id obj) { + return [@"x-company-" stringByAppendingString:obj]); + }]; + + @param block A single-argument, object-returning code block. + @return Returns a set of the objects returned by the block. + */ +- (NSSet *)map:(BKTransformBlock)block; + +/** Arbitrarily accumulate objects using a block. + + The concept of this selector is difficult to illustrate in words. The sum can + be any NSObject, including (but not limited to) a string, number, or value. + + You can also do something like summing the count of an item: + NSUInteger numberOfBodyParts = [[bodyList reduce:nil withBlock:^id(id sum, id obj) { + return @([sum integerValue] + obj.numberOfAppendages); + }] unsignedIntegerValue]; + + @param initial The value of the reduction at its start. + @param block A block that takes the current sum and the next object to return the new sum. + @return An accumulated value. + */ +- (id)reduce:(id)initial withBlock:(BKAccumulationBlock)block; + +/** Loops through a set to find whether any object matches the block. + + This method is similar to the Scala list `exists`. It is functionally + identical to match: but returns a `BOOL` instead. It is not recommended + to use any: as a check condition before executing match:, since it would + require two loops through the array. + + @param block A single-argument, BOOL-returning code block. + @return YES for the first time the block returns YES for an object, NO otherwise. + */ +- (BOOL)any:(BKValidationBlock)block; + +/** Loops through a set to find whether no objects match the block. + + This selector performs *literally* the exact same function as all: but in reverse. + + @param block A single-argument, BOOL-returning code block. + @return YES if the block returns NO for all objects in the set, NO otherwise. + */ +- (BOOL)none:(BKValidationBlock)block; + +/** Loops through a set to find whether all objects match the block. + + @param block A single-argument, BOOL-returning code block. + @return YES if the block returns YES for all objects in the set, NO otherwise. + */ +- (BOOL)all:(BKValidationBlock)block; + +@end \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSTimer+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSTimer+BlocksKit.h new file mode 100755 index 000000000..62628d294 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSTimer+BlocksKit.h @@ -0,0 +1,36 @@ +// +// NSTimer+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Simple category on NSTimer to give it blocks capability. + + Created by [Jiva DeVoe](https://github.com/jivadevoe) as `NSTimer-Blocks`. +*/ +@interface NSTimer (BlocksKit) + +/** Creates and returns a block-based NSTimer object and schedules it on the current run loop. + + @param inTimeInterval The number of seconds between firings of the timer. + @param inBlock The block that the NSTimer fires. + @param inRepeats If YES, the timer will repeatedly reschedule itself until invalidated. If NO, the timer will be invalidated after it fires. + @return A new NSTimer object, configured according to the specified parameters. + */ ++ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)inTimeInterval block:(BKTimerBlock)inBlock repeats:(BOOL)inRepeats; + +/** Creates and returns a block-based NSTimer initialized with the specified block. + + You must add the new timer to a run loop, using `-addTimer:forMode:`. Then, + after seconds seconds have elapsed, the timer fires the block. If the timer + is configured to repeat, there is no need to subsequently re-add the timer. + + @param inTimeInterval The number of seconds between firings of the timer. + @param inBlock The block that the NSTimer fires. + @param inRepeats If YES, the timer will repeatedly reschedule itself until invalidated. If NO, the timer will be invalidated after it fires. + @return A new NSTimer object, configured according to the specified parameters. + */ ++ (NSTimer *)timerWithTimeInterval:(NSTimeInterval)inTimeInterval block:(BKTimerBlock)inBlock repeats:(BOOL)inRepeats; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSURLConnection+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSURLConnection+BlocksKit.h new file mode 100644 index 000000000..423223dcd --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/NSURLConnection+BlocksKit.h @@ -0,0 +1,139 @@ +// +// NSURLConnection+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** NSURLConnection with both delegate and block callback support. + + It also adds useful block handlers for tracking upload and download progress. + + Here is a small example: + - (void)downloadImage:(id)sender { + self.downloadButton.enabled = NO; + self.progressView.progress = 0.0f; + NSURL *imageURL = [NSURL URLWithString:@"http://icanhascheezburger.files.wordpress.com/2011/06/funny-pictures-nyan-cat-wannabe1.jpg"]; + NSURLRequest *request = [NSURLRequest requestWithURL:imageURL]; + NSURLConnection *connection = [NSURLConnection connectionWithRequest:request]; + connection.delegate = self; + connection.failureBlock = ^(NSURLConnection *connection, NSError *error){ + [[UIAlertView alertViewWithTitle:@"Download error" message:[error localizedDescription]] show]; + + self.downloadButton.enabled = YES; + self.progressView.progress = 0.0f; + }; + connection.successBlock = ^(NSURLConnection *connection, NSURLResponse *response, NSData *responseData){ + self.imageView.image = [UIImage imageWithData:responseData]; + self.downloadButton.enabled = YES; + }; + connection.downloadBlock = ^(CGFloat progress){ + self.progressView.progress = progress; + }; + + [connection start]; + } + + //these methods will be called too! + - (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite { + NSLog(@"%s",__PRETTY_FUNCTION__); + } + + - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { + NSLog(@"%s",__PRETTY_FUNCTION__); + } + + Created by Igor Evsukov as + [IEURLConnection](https://github.com/evsukov89/IEURLConnection) and contributed + to BlocksKit. +*/ + +@interface NSURLConnection (BlocksKit) + +/** A mutable delegate that implements the NSURLConnectionDelegate protocol. + + This property allows for both use of block callbacks and delegate methods + in an instance of NSURLConnection. It only works on block-backed + NSURLConnection instances. + */ +@property (nonatomic, weak) id delegate; + +/** The block fired once the connection recieves a response from the server. + + This block corresponds to the connection:didReceiveResponse: method + of NSURLConnectionDelegate. */ +@property (nonatomic, copy) void(^responseBlock)(NSURLConnection *, NSURLResponse *); + +/** The block fired upon the failure of the connection. + + This block corresponds to the connection:didFailWithError: + method of NSURLConnectionDelegate. */ +@property (nonatomic, copy) void (^failureBlock)(NSURLConnection *, NSError *); + +/** The block that upon the successful completion of the connection. + + This block corresponds to the connectionDidFinishLoading: + method of NSURLConnectionDelegate. + + @warning If the delegate implements connection:didRecieveData:, then this + block will *not* include the data recieved by the connection and appending + the recieved data to an instance NSMutableData is left up to the user due + to the behavior of frameworks that use NSURLConnection. + */ +@property (nonatomic, copy) void (^successBlock)(NSURLConnection *, NSURLResponse *, NSData *); + +/** The block fired every time new data is sent to the server, + representing the current percentage of completion. + + This block corresponds to the + connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite: + method of NSURLConnectionDelegate. + */ +@property (nonatomic, copy) void (^uploadBlock)(CGFloat); + +/** The block fired every time new data is recieved from the server, + representing the current percentage of completion. + + This block corresponds to the connection:didRecieveData: + method of NSURLConnectionDelegate. + */ +@property (nonatomic, copy) void (^downloadBlock)(CGFloat); + +/** Creates and returns an initialized block-backed URL connection that does not begin to load the data for the URL request. + + @param request The URL request to load. + @return An autoreleased NSURLConnection for the specified URL request. + */ ++ (NSURLConnection *)connectionWithRequest:(NSURLRequest *)request; + +/** Creates, starts, and returns an asynchronous, block-backed URL connection + + @return New and running NSURLConnection with the specified properties. + @param request The URL request to load. + @param success A code block that acts on instances of NSURLResponse and NSData in the event of a successful connection. + @param failure A code block that acts on instances of NSURLResponse and NSError in the event of a failed connection. + */ ++ (NSURLConnection *)startConnectionWithRequest:(NSURLRequest *)request successHandler:(void(^)(NSURLConnection *urlConnection, NSURLResponse *urlResponse, NSData *data))success failureHandler:(void(^)(NSURLConnection *urlConnection, NSError *error))failure; + +/** Returns an initialized block-backed URL connection. + + @return Newly initialized NSURLConnection with the specified properties. + @param request The URL request to load. + */ +- (id)initWithRequest:(NSURLRequest *)request; + +/** Returns an initialized URL connection with the specified completion handler. + + @return Newly initialized NSURLConnection with the specified properties. + @param request The URL request to load. + @param block A code block that acts on instances of NSURLResponse and NSData in the event of a successful connection. + */ +- (id)initWithRequest:(NSURLRequest *)request completionHandler:(void(^)(NSURLConnection *urlConnection, NSURLResponse *urlResponse, NSData *data))block; + +/** Causes the connection to begin loading data, if it has not already, with the specified block to be fired on successful completion. + + @param block A code block that acts on instances of NSURLResponse and NSData in the event of a successful connection. + */ +- (void)startWithCompletionBlock:(void(^)(NSURLConnection *urlConnection, NSURLResponse *urlResponse, NSData *data))block; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIActionSheet+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIActionSheet+BlocksKit.h new file mode 100755 index 000000000..b0cbe4932 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIActionSheet+BlocksKit.h @@ -0,0 +1,128 @@ +// +// UIActionSheet+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** UIActionSheet without delegates! + + This set of extensions and convenience classes allows + for an instance of UIAlertView without the implementation + of a delegate. Any time you instantiate a UIAlertView + using the methods here, you must add buttons using + addButtonWithTitle:handler: to make sure nothing breaks. + + A typical invocation might go like this: + UIActionSheet *testSheet = [UIActionSheet actionSheetWithTitle:@"Please select one."]; + [testSheet addButtonWithTitle:@"Zip" handler:^{ NSLog(@"Zip!"); }]; + [testSheet addButtonWithTitle:@"Zap" handler:^{ NSLog(@"Zap!"); }]; + [testSheet addButtonWithTitle:@"Zop" handler:^{ NSLog(@"Zop!"); }]; + [testSheet setDestructiveButtonWithTitle:@"No!" handler:^{ NSLog(@"Fine!"); }]; + [testSheet setCancelButtonWithTitle:nil handler:^{ NSLog(@"Never mind, then!"); }]; + [testSheet showInView:self.view]; + + Includes code by the following: + + - [Landon Fuller](http://landonf.bikemonkey.org), "Using Blocks". + - [Peter Steinberger](https://github.com/steipete) + - [Zach Waldowski](https://github.com/zwaldowski) + + @warning UIActionSheet is only available on a platform with UIKit. + */ +@interface UIActionSheet (BlocksKit) + +///----------------------------------- +/// @name Creating action sheets +///----------------------------------- + +/** Creates and returns a new action sheet with only a title and cancel button. + + @param title The header of the action sheet. + @return A newly created action sheet. + */ ++ (id)actionSheetWithTitle:(NSString *)title; + +/** Returns a configured action sheet with only a title and cancel button. + + @param title The header of the action sheet. + @return An instantiated actionSheet. + */ +- (id)initWithTitle:(NSString *)title; + +///----------------------------------- +/// @name Adding buttons +///----------------------------------- + +/** Add a new button with an associated code block. + + @param title The text of the button. + @param block A block of code. + */ +- (NSInteger)addButtonWithTitle:(NSString *)title handler:(BKBlock)block; + +/** Set the destructive (red) button with an associated code block. + + @warning Because buttons cannot be removed from an action sheet, + be aware that the effects of calling this method are cumulative. + Previously added destructive buttons will become normal buttons. + + @param title The text of the button. + @param block A block of code. + */ +- (NSInteger)setDestructiveButtonWithTitle:(NSString *)title handler:(BKBlock)block; + +/** Set the title and trigger of the cancel button. + + `block` can be set to `nil`, but this is generally useless as + the cancel button is configured already to do nothing. + + iPhone users will have the button shown regardless; if the title is + set to `nil`, it will automatically be localized. + + @param title The text of the button. + @param block A block of code. + */ +- (NSInteger)setCancelButtonWithTitle:(NSString *)title handler:(BKBlock)block; + +///----------------------------------- +/// @name Altering actions +///----------------------------------- + +/** Sets the block that is to be fired when a button is pressed. + + @param block A code block, or nil to set no response. + @param index The index of a button already added to the action sheet. +*/ +- (void)setHandler:(BKBlock)block forButtonAtIndex:(NSInteger)index; + +/** The block that is to be fired when a button is pressed. + + @param index The index of a button already added to the action sheet. + @return A code block, or nil if no block is assigned. + */ +- (BKBlock)handlerForButtonAtIndex:(NSInteger)index; + +/** The block to be fired when the action sheet is dismissed with the cancel + button and/or action. + + This property performs the same action as setCancelButtonWithTitle:handler: + but with `title` set to nil. Contrary to setCancelButtonWithTitle:handler:, + you can set this property multiple times and multiple cancel buttons will + not be generated. + */ +@property (nonatomic, copy) BKBlock cancelBlock; + +/** The block to be fired before the action sheet will show. */ +@property (nonatomic, copy) void (^willShowBlock)(UIActionSheet *); + +/** The block to be fired when the action sheet shows. */ +@property (nonatomic, copy) void (^didShowBlock)(UIActionSheet *); + +/** The block to be fired before the action sheet will dismiss. */ +@property (nonatomic, copy) void (^willDismissBlock)(UIActionSheet *, NSInteger); + +/** The block to be fired after the action sheet dismisses. */ +@property (nonatomic, copy) void (^didDismissBlock)(UIActionSheet *, NSInteger); + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIAlertView+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIAlertView+BlocksKit.h new file mode 100755 index 000000000..c2b2f5627 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIAlertView+BlocksKit.h @@ -0,0 +1,134 @@ +// +// UIAlertView+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** UIAlertView without delegates! + + This set of extensions and convenience classes allows + for an instance of UIAlertView without the implementation + of a delegate. Any time you instantiate a UIAlertView + using the methods here, you must add buttons using + addButtonWithTitle:handler: otherwise nothing will happen. + + A typical invocation will go like this: + UIAlertView *testView = [UIAlertView alertViewWithTitle:@"Application Alert" message:@"This app will explode in 42 seconds."]; + [testView setCancelButtonWithTitle:@"Oh No!" handler:^{ NSLog(@"Boom!"); }]; + [testView show]; + + A more traditional, and more useful, modal dialog looks like so: + UIAlertView *testView = [UIAlertView alertViewWithTitle:@"Very important!" message:@"Do you like chocolate?"]; + [testView addButtonWithTitle:@"Yes" handler:^{ NSLog(@"Yay!"); }]; + [testView addButtonWithTitle:@"No" handler:^{ NSLog(@"We hate you."); }]; + [testView show]; + + Includes code by the following: + + - [Landon Fuller](http://landonf.bikemonkey.org), "Using Blocks". + - [Peter Steinberger](https://github.com/steipete) + - [Zach Waldowski](https://github.com/zwaldowski) + + @warning UIAlertView is only available on a platform with UIKit. + */ +@interface UIAlertView (BlocksKit) + +///----------------------------------- +/// @name Creating alert views +///----------------------------------- + +/** Creates and shows a new alert view with only a title, message, and cancel button. + + @param title The title of the alert view. + @param message The message content of the alert. + @param cancelButtonTitle The title of the cancel button. If both cancelButtonTitle and otherButtonTitles are empty or nil, defaults to a + @param otherButtonTitles Titles of additional buttons to add to the receiver. + @param block A block of code to be fired on the dismissal of the alert view. + */ ++ (void) showAlertViewWithTitle: (NSString *) title message: (NSString *) message cancelButtonTitle: (NSString *) cancelButtonTitle otherButtonTitles: (NSArray *) otherButtonTitles handler: (void (^)(UIAlertView *alertView, NSInteger buttonIndex)) block; + +/** Creates and returns a new alert view with only a title and cancel button. + + @param title The title of the alert view. + @return A newly created alert view. + */ ++ (id)alertViewWithTitle:(NSString *)title; + +/** Creates and returns a new alert view with only a title, message, and cancel button. + + @param title The title of the alert view. + @param message The message content of the alert. + @return A newly created alert view. + */ ++ (id)alertViewWithTitle:(NSString *)title message:(NSString *)message; + +/** Returns a configured alert view with only a title, message, and cancel button. + + @param title The title of the alert view. + @param message The message content of the alert. + @return An instantiated alert view. + */ +- (id)initWithTitle:(NSString *)title message:(NSString *)message; + +///----------------------------------- +/// @name Adding buttons +///----------------------------------- + +/** Add a new button with an associated code block. + + @param title The text of the button. + @param block A block of code. + */ +- (NSInteger)addButtonWithTitle:(NSString *)title handler:(BKBlock)block; + +/** Set the title and trigger of the cancel button. + + @param title The text of the button. + @param block A block of code. + */ +- (NSInteger)setCancelButtonWithTitle:(NSString *)title handler:(BKBlock)block; + +///----------------------------------- +/// @name Altering actions +///----------------------------------- + +/** Sets the block that is to be fired when a button is pressed. + + @param block A code block, or nil to set no response. + @param index The index of a button already added to the action sheet. + */ +- (void)setHandler:(BKBlock)block forButtonAtIndex:(NSInteger)index; + +/** The block that is to be fired when a button is pressed. + + @param index The index of the button already added to the alert view. + @return A code block, or nil if no block yet assigned. + */ +- (BKBlock)handlerForButtonAtIndex:(NSInteger)index; + +/** The block to be fired when the action sheet is dismissed with the cancel + button. + + Contrary to setCancelButtonWithTitle:handler:, you can set this + property multiple times but multiple cancel buttons will + not be generated. + */ +@property (nonatomic, copy) BKBlock cancelBlock; + +/** The block to be fired before the alert view will show. */ +@property (nonatomic, copy) void (^willShowBlock)(UIAlertView *); + +/** The block to be fired when the alert view shows. */ +@property (nonatomic, copy) void (^didShowBlock)(UIAlertView *); + +/** The block to be fired before the alert view will dismiss. */ +@property (nonatomic, copy) void (^willDismissBlock)(UIAlertView *, NSInteger); + +/** The block to be fired after the alert view dismisses. */ +@property (nonatomic, copy) void (^didDismissBlock)(UIAlertView *, NSInteger); + +/** The block to be fired to determine whether the first non-cancel should be enabled */ +@property (nonatomic, copy) BOOL (^shouldEnableFirstOtherButtonBlock)(UIAlertView *) NS_AVAILABLE_IOS(5_0); + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIBarButtonItem+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIBarButtonItem+BlocksKit.h new file mode 100755 index 000000000..bbd1b8dcb --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIBarButtonItem+BlocksKit.h @@ -0,0 +1,51 @@ +// +// UIBarButtonItem+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block event initialization for UIBarButtonItem. + + This set of extensions has near-drop-in replacements + for the standard set of UIBarButton item initializations, + using a block handler instead of a target/selector. + + Includes code by the following: + + - [Kevin O'Neill](https://github.com/kevinoneill) + - [Zach Waldowski](https://github.com/zwaldowski) + + @warning UIBarButtonItem is only available on a platform with UIKit. + */ +@interface UIBarButtonItem (BlocksKit) + +/** Creates and returns a configured item containing the specified system item. + + @return Newly initialized item with the specified properties. + @param systemItem The system item to use as the item representation. One of the constants defined in UIBarButtonSystemItem. + @param action The block that gets fired on the button press. + */ +- (id)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItem handler:(BKSenderBlock)action; + +/** Creates and returns a configured item using the specified image and style. + + @return Newly initialized item with the specified properties. + @param image The item’s image. If nil an image is not displayed. + If this image is too large to fit on the bar, it is scaled to fit + The size of a toolbar and navigation bar image is 20 x 20 points. + @param style The style of the item. One of the constants defined in UIBarButtonItemStyle. + @param action The block that gets fired on the button press. + */ +- (id)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style handler:(BKSenderBlock)action; + +/** Creates and returns a configured item using the specified text and style. + + @return Newly initialized item with the specified properties. + @param title The text displayed on the button item. + @param style The style of the item. One of the constants defined in UIBarButtonItemStyle. + @param action The block that gets fired on the button press. + */ +- (id)initWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style handler:(BKSenderBlock)action; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIControl+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIControl+BlocksKit.h new file mode 100755 index 000000000..c7c7af644 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIControl+BlocksKit.h @@ -0,0 +1,44 @@ +// +// UIControl+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block control event handling for UIControl. + + Includes code by the following: + + - [Kevin O'Neill](https://github.com/kevinoneill) + - [Zach Waldowski](https://github.com/zwaldowski) + + @warning UIControl is only available on a platform with UIKit. + */ +@interface UIControl (BlocksKit) + +///----------------------------------- +/// @name Block event handling +///----------------------------------- + +/** Adds a block for a particular event to an internal dispatch table. + + @param handler A block representing an action message, with an argument for the sender. + @param controlEvents A bitmask specifying the control events for which the action message is sent. + @see removeEventHandlersForControlEvents: + */ +- (void)addEventHandler:(BKSenderBlock)handler forControlEvents:(UIControlEvents)controlEvents; + +/** Removes all blocks for a particular event combination. + @param controlEvents A bitmask specifying the control events for which the block will be removed. + @see addEventHandler:forControlEvents: + */ +- (void)removeEventHandlersForControlEvents:(UIControlEvents)controlEvents; + +/** Checks to see if the control has any blocks for a particular event combination. + @param controlEvents A bitmask specifying the control events for which to check for blocks. + @see addEventHandler:forControlEvents: + @return Returns YES if there are blocks for these control events, NO otherwise. + */ +- (BOOL)hasEventHandlersForControlEvents:(UIControlEvents)controlEvents; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIGestureRecognizer+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIGestureRecognizer+BlocksKit.h new file mode 100755 index 000000000..b8b95ea33 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIGestureRecognizer+BlocksKit.h @@ -0,0 +1,114 @@ +// +// UIGestureRecognizer+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block functionality for UIGestureRecognizer. + + Use of the delay property is pretty straightforward, although + cancellation might be a little harder to swallow. An example + follows: + UITapGestureRecognizer *singleTap = [UITapGestureRecognizer recognizerWithHandler:^(id sender) { + NSLog(@"Single tap."); + } delay:0.18]; + [self addGestureRecognizer:singleTap]; + + UITapGestureRecognizer *doubleTap = [UITapGestureRecognizer recognizerWithHandler:^(id sender) { + [singleTap cancel]; + NSLog(@"Double tap."); + }]; + doubleTap.numberOfTapsRequired = 2; + [self addGestureRecognizer:doubleTap]; + + Believe it or not, the above code is fully memory-safe and efficient. Eagle-eyed coders + will notice that this setup emulates UIGestureRecognizer's requireGestureRecognizerToFail:, + and, yes, it totally apes it. Not only is this setup much faster on the user's end of + things, it is more flexible and allows for much more complicated setups. + + Includes code by the following: + + - [Kevin O'Neill](https://github.com/kevinoneill) + - [Zach Waldowski](https://github.com/zwaldowski) + + @warning UIGestureRecognizer is only available on a platform with UIKit. + + @warning It is not recommended to use the Apple-supplied locationInView and state + methods on a *delayed* block-backed gesture recognizer, as these properties are + likely to have been cleared by the time by the block fires. It is instead recommended + to use the arguments provided to the block. + */ + +@interface UIGestureRecognizer (BlocksKit) + +/** An autoreleased gesture recognizer that will, on firing, call + the given block asynchronously after a number of seconds. + + @return An autoreleased instance of a concrete UIGestureRecognizer subclass, or `nil`. + @param block The block which handles an executed gesture. + @param delay A number of seconds after which the block will fire. + */ ++ (id)recognizerWithHandler:(BKGestureRecognizerBlock)block delay:(NSTimeInterval)delay; + +/** Initializes an allocated gesture recognizer that will call the given block + after a given delay. + + An alternative to the designated initializer. + + @return An initialized instance of a concrete UIGestureRecognizer subclass or `nil`. + @param block The block which handles an executed gesture. + @param delay A number of seconds after which the block will fire. + */ +- (id)initWithHandler:(BKGestureRecognizerBlock)block delay:(NSTimeInterval)delay; + +/** An autoreleased gesture recognizer that will call the given block. + + For convenience and compatibility reasons, this method is indentical + to using recognizerWithHandler:delay: with a delay of 0.0. + + @return An initialized and autoreleased instance of a concrete UIGestureRecognizer + subclass, or `nil`. + @param block The block which handles an executed gesture. + */ ++ (id)recognizerWithHandler:(BKGestureRecognizerBlock)block; + +/** Initializes an allocated gesture recognizer that will call the given block. + + This method is indentical to calling initWithHandler:delay: with a delay of 0.0. + + @return An initialized instance of a concrete UIGestureRecognizer subclass or `nil`. + @param block The block which handles an executed gesture. + */ +- (id)initWithHandler:(BKGestureRecognizerBlock)block; + +/** Allows the block that will be fired by the gesture recognizer + to be modified after the fact. + */ +@property (nonatomic, copy) BKGestureRecognizerBlock handler; + +/** Allows the length of the delay after which the gesture + recognizer will be fired to modify. */ +@property (nonatomic) NSTimeInterval handlerDelay; + +/** Allows the length of the delay after which the gesture + recognizer will be fired to modify. + + @warning Due to a collision with an internal method in + UILongPressGestureRecognizer, this method was replaced + with handlerDelay starting in BlocksKit 1.0.5. + + */ +@property (nonatomic) NSTimeInterval delay DEPRECATED_ATTRIBUTE_M("Use handlerDelay"); + +/** If the recognizer happens to be fired, calling this method + will stop it from firing, but only if a delay is set. + + @warning This method is not for arbitrarily canceling the + firing of a recognizer, but will only function for a block + handler *after the recognizer has already been fired*. Be + sure to make your delay times accomodate this likelihood. + */ +- (void)cancel; + +@end \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIPopoverController+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIPopoverController+BlocksKit.h new file mode 100644 index 000000000..266b34cc1 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIPopoverController+BlocksKit.h @@ -0,0 +1,22 @@ +// +// UIPopoverController+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block functionality for UIPopoverController. + + Created by [Alexsander Akers](https://github.com/a2) and contributed to BlocksKit. + + @warning UIPopovercontroller is only available on a platform with UIKit. + */ +@interface UIPopoverController (BlocksKit) + +/** The block to be called when the popover controller will dismiss the popover. Return NO to prevent the dismissal of the view. */ +@property (nonatomic, copy) BOOL (^shouldDismissBlock)(UIPopoverController *); + +/** The block to be called when the user has taken action to dismiss the popover. This is not called when -dismissPopoverAnimated: is called directly. */ +@property (nonatomic, copy) void (^didDismissBlock)(UIPopoverController *); + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIView+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIView+BlocksKit.h new file mode 100755 index 000000000..7f976b45a --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIView+BlocksKit.h @@ -0,0 +1,92 @@ +// +// UIView+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Convenience on-touch methods for UIView. + + Includes code by the following: + + - Kevin O'Neill. . 2011. BSD. + - Jake Marsh. . 2011. + - Zach Waldowski. . 2011. + + @warning UIView is only available on a platform with UIKit. + */ +@interface UIView (BlocksKit) + +/** Abstract creation of a block-backed UITapGestureRecognizer. + + This method allows for the recognition of any arbitrary number + of fingers tapping any number of times on a view. An instance + of UITapGesture recognizer is allocated for the block and added + to the recieving view. + + @warning This method has an _additive_ effect. Do not call it multiple + times to set-up or tear-down. The view will discard the gesture recognizer + on release. + + @param numberOfTouches The number of fingers tapping that will trigger the block. + @param numberOfTaps The number of taps required to trigger the block. + @param block The handler for the UITapGestureRecognizer + @see whenTapped: + @see whenDoubleTapped: + */ +- (void)whenTouches:(NSUInteger)numberOfTouches tapped:(NSUInteger)numberOfTaps handler:(BKBlock)block; + +/** Adds a recognizer for one finger tapping once. + + @warning This method has an _additive_ effect. Do not call it multiple + times to set-up or tear-down. The view will discard the gesture recognizer + on release. + + @param block The handler for the tap recognizer + @see whenDoubleTapped: + @see whenTouches:tapped:handler: + */ +- (void)whenTapped:(BKBlock)block; + +/** Adds a recognizer for one finger tapping twice. + + @warning This method has an _additive_ effect. Do not call it multiple + times to set-up or tear-down. The view will discard the gesture recognizer + on release. + + @param block The handler for the tap recognizer + @see whenTapped: + @see whenTouches:tapped:handler: + */ +- (void)whenDoubleTapped:(BKBlock)block; + +/** A convenience wrapper that non-recursively loops through the subviews of a view. + + @param block A code block that interacts with a UIView sender. + */ +- (void)eachSubview:(void(^)(UIView *))block; + +/** The block that gets called on a finger down. + + Internally, this method overrides the touchesBegan:withEvent: + selector of UIView and is mechanically similar to + UIControlEventTouchDown. + */ +@property (nonatomic, copy) BKTouchBlock onTouchDownBlock; + +/** The block that gets called on a finger drag. + + Internally, this method overrides the touchesMoved:withEvent: + selector of UIView. + */ +@property (nonatomic, copy) BKTouchBlock onTouchMoveBlock; + +/** The block that gets called on a finger up. + + Internally, this method overrides the touchesBegan:withEvent: + selector of UIView and is mechanically similar to + UIControlEventTouchCancel. + */ +@property (nonatomic, copy) BKTouchBlock onTouchUpBlock; + +@end diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIWebView+BlocksKit.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIWebView+BlocksKit.h new file mode 100755 index 000000000..64247c200 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/UIWebView+BlocksKit.h @@ -0,0 +1,31 @@ +// +// UIWebView+BlocksKit.h +// BlocksKit +// + +#import "BKGlobals.h" + +/** Block callbacks for UIWebView. + + @warning UIWebView is only available on a platform with UIKit. +*/ + +@interface UIWebView (BlocksKit) + +/** The block to be decide whether a URL will be loaded. + + @warning If the delegate implements webView:shouldStartLoadWithRequest:navigationType:, + the return values of both the delegate method and the block will be considered. +*/ +@property (nonatomic, copy) BOOL(^shouldStartLoadBlock)(UIWebView *, NSURLRequest *, UIWebViewNavigationType); + +/** The block that is fired when the web view starts loading. */ +@property (nonatomic, copy) void(^didStartLoadBlock)(UIWebView *); + +/** The block that is fired when the web view finishes loading. */ +@property (nonatomic, copy) void(^didFinishLoadBlock)(UIWebView *); + +/** The block that is fired when the web view stops loading due to an error. */ +@property (nonatomic, copy) void(^didFinishWithErrorBlock)(UIWebView *, NSError *); + +@end \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffi.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffi.h new file mode 100644 index 000000000..31d7449a1 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffi.h @@ -0,0 +1,2 @@ +#include +#include diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffi_armv7.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffi_armv7.h new file mode 100644 index 000000000..f7e936f8f --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffi_armv7.h @@ -0,0 +1,476 @@ +#ifdef __arm__ + +/* -----------------------------------------------------------------*-C-*- + libffi 3.0.11 - Copyright (c) 2011 Anthony Green + - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the ``Software''), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +/* ------------------------------------------------------------------- + The basic API is described in the README file. + + The raw API is designed to bypass some of the argument packing + and unpacking on architectures for which it can be avoided. + + The closure API allows interpreted functions to be packaged up + inside a C function pointer, so that they can be called as C functions, + with no understanding on the client side that they are interpreted. + It can also be used in other cases in which it is necessary to package + up a user specified parameter and a function pointer as a single + function pointer. + + The closure API must be implemented in order to get its functionality, + e.g. for use by gij. Routines are provided to emulate the raw API + if the underlying platform doesn't allow faster implementation. + + More details on the raw and cloure API can be found in: + + http://gcc.gnu.org/ml/java/1999-q3/msg00138.html + + and + + http://gcc.gnu.org/ml/java/1999-q3/msg00174.html + -------------------------------------------------------------------- */ + +#ifndef LIBFFI_H +#define LIBFFI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Specify which architecture libffi is configured for. */ +#ifndef ARM +#define ARM +#endif + +/* ---- System configuration information --------------------------------- */ + +#include + +#ifndef LIBFFI_ASM + +#ifdef _MSC_VER +#define __attribute__(X) +#endif + +#include +#include + +/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). + But we can find it either under the correct ANSI name, or under GNU + C's internal name. */ + +#define FFI_64_BIT_MAX 9223372036854775807 + +#ifdef LONG_LONG_MAX +# define FFI_LONG_LONG_MAX LONG_LONG_MAX +#else +# ifdef LLONG_MAX +# define FFI_LONG_LONG_MAX LLONG_MAX +# ifdef _AIX52 /* or newer has C99 LLONG_MAX */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif /* _AIX52 or newer */ +# else +# ifdef __GNUC__ +# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ +# endif +# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ +# ifndef __PPC64__ +# if defined (__IBMC__) || defined (__IBMCPP__) +# define FFI_LONG_LONG_MAX LONGLONG_MAX +# endif +# endif /* __PPC64__ */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif +# endif +#endif + +/* The closure code assumes that this works on pointers, i.e. a size_t */ +/* can hold a pointer. */ + +typedef struct _ffi_type +{ + size_t size; + unsigned short alignment; + unsigned short type; + struct _ffi_type **elements; +} ffi_type; + +#ifndef LIBFFI_HIDE_BASIC_TYPES +#if SCHAR_MAX == 127 +# define ffi_type_uchar ffi_type_uint8 +# define ffi_type_schar ffi_type_sint8 +#else + #error "char size not supported" +#endif + +#if SHRT_MAX == 32767 +# define ffi_type_ushort ffi_type_uint16 +# define ffi_type_sshort ffi_type_sint16 +#elif SHRT_MAX == 2147483647 +# define ffi_type_ushort ffi_type_uint32 +# define ffi_type_sshort ffi_type_sint32 +#else + #error "short size not supported" +#endif + +#if INT_MAX == 32767 +# define ffi_type_uint ffi_type_uint16 +# define ffi_type_sint ffi_type_sint16 +#elif INT_MAX == 2147483647 +# define ffi_type_uint ffi_type_uint32 +# define ffi_type_sint ffi_type_sint32 +#elif INT_MAX == 9223372036854775807 +# define ffi_type_uint ffi_type_uint64 +# define ffi_type_sint ffi_type_sint64 +#else + #error "int size not supported" +#endif + +#if LONG_MAX == 2147483647 +# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX + #error "no 64-bit data type supported" +# endif +#elif LONG_MAX != FFI_64_BIT_MAX + #error "long size not supported" +#endif + +#if LONG_MAX == 2147483647 +# define ffi_type_ulong ffi_type_uint32 +# define ffi_type_slong ffi_type_sint32 +#elif LONG_MAX == FFI_64_BIT_MAX +# define ffi_type_ulong ffi_type_uint64 +# define ffi_type_slong ffi_type_sint64 +#else + #error "long size not supported" +#endif + +/* Need minimal decorations for DLLs to works on Windows. */ +/* GCC has autoimport and autoexport. Rely on Libtool to */ +/* help MSVC export from a DLL, but always declare data */ +/* to be imported for MSVC clients. This costs an extra */ +/* indirection for MSVC clients using the static version */ +/* of the library, but don't worry about that. Besides, */ +/* as a workaround, they can define FFI_BUILDING if they */ +/* *know* they are going to link with the static library. */ +#if defined _MSC_VER && !defined FFI_BUILDING +#define FFI_EXTERN extern __declspec(dllimport) +#else +#define FFI_EXTERN extern +#endif + +/* These are defined in types.c */ +FFI_EXTERN ffi_type ffi_type_void; +FFI_EXTERN ffi_type ffi_type_uint8; +FFI_EXTERN ffi_type ffi_type_sint8; +FFI_EXTERN ffi_type ffi_type_uint16; +FFI_EXTERN ffi_type ffi_type_sint16; +FFI_EXTERN ffi_type ffi_type_uint32; +FFI_EXTERN ffi_type ffi_type_sint32; +FFI_EXTERN ffi_type ffi_type_uint64; +FFI_EXTERN ffi_type ffi_type_sint64; +FFI_EXTERN ffi_type ffi_type_float; +FFI_EXTERN ffi_type ffi_type_double; +FFI_EXTERN ffi_type ffi_type_pointer; + +#if 0 +FFI_EXTERN ffi_type ffi_type_longdouble; +#else +#define ffi_type_longdouble ffi_type_double +#endif +#endif /* LIBFFI_HIDE_BASIC_TYPES */ + +typedef enum { + FFI_OK = 0, + FFI_BAD_TYPEDEF, + FFI_BAD_ABI +} ffi_status; + +typedef unsigned FFI_TYPE; + +typedef struct { + ffi_abi abi; + unsigned nargs; + ffi_type **arg_types; + ffi_type *rtype; + unsigned bytes; + unsigned flags; +#ifdef FFI_EXTRA_CIF_FIELDS + FFI_EXTRA_CIF_FIELDS; +#endif +} ffi_cif; + +/* Used internally, but overridden by some architectures */ +ffi_status ffi_prep_cif_core(ffi_cif *cif, + ffi_abi abi, + unsigned int isvariadic, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, + ffi_type **atypes); + +/* ---- Definitions for the raw API -------------------------------------- */ + +#ifndef FFI_SIZEOF_ARG +# if LONG_MAX == 2147483647 +# define FFI_SIZEOF_ARG 4 +# elif LONG_MAX == FFI_64_BIT_MAX +# define FFI_SIZEOF_ARG 8 +# endif +#endif + +#ifndef FFI_SIZEOF_JAVA_RAW +# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG +#endif + +typedef union { + ffi_sarg sint; + ffi_arg uint; + float flt; + char data[FFI_SIZEOF_ARG]; + void* ptr; +} ffi_raw; + +#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 +/* This is a special case for mips64/n32 ABI (and perhaps others) where + sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ +typedef union { + signed int sint; + unsigned int uint; + float flt; + char data[FFI_SIZEOF_JAVA_RAW]; + void* ptr; +} ffi_java_raw; +#else +typedef ffi_raw ffi_java_raw; +#endif + + +void ffi_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_raw *avalue); + +void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); +void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); +size_t ffi_raw_size (ffi_cif *cif); + +/* This is analogous to the raw API, except it uses Java parameter */ +/* packing, even on 64-bit machines. I.e. on 64-bit machines */ +/* longs and doubles are followed by an empty 64-bit word. */ + +void ffi_java_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_java_raw *avalue); + +void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); +void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); +size_t ffi_java_raw_size (ffi_cif *cif); + +/* ---- Definitions for closures ----------------------------------------- */ + +#if FFI_CLOSURES + +#ifdef _MSC_VER +__declspec(align(8)) +#endif +typedef struct { +#if 1 + void *trampoline_table; + void *trampoline_table_entry; +#else + char tramp[FFI_TRAMPOLINE_SIZE]; +#endif + ffi_cif *cif; + void (*fun)(ffi_cif*,void*,void**,void*); + void *user_data; +#ifdef __GNUC__ +} ffi_closure __attribute__((aligned (8))); +#else +} ffi_closure; +# ifdef __sgi +# pragma pack 0 +# endif +#endif + +void *ffi_closure_alloc (size_t size, void **code); +void ffi_closure_free (void *); + +ffi_status +ffi_prep_closure (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data); + +ffi_status +ffi_prep_closure_loc (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void*codeloc); + +#ifdef __sgi +# pragma pack 8 +#endif +typedef struct { +#if 1 + void *trampoline_table; + void *trampoline_table_entry; +#else + char tramp[FFI_TRAMPOLINE_SIZE]; +#endif + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_raw*,void*); + void *user_data; + +} ffi_raw_closure; + +typedef struct { +#if 1 + void *trampoline_table; + void *trampoline_table_entry; +#else + char tramp[FFI_TRAMPOLINE_SIZE]; +#endif + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); + void *user_data; + +} ffi_java_raw_closure; + +ffi_status +ffi_prep_raw_closure (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc); + +ffi_status +ffi_prep_java_raw_closure (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data, + void *codeloc); + +#endif /* FFI_CLOSURES */ + +/* ---- Public interface definition -------------------------------------- */ + +ffi_status ffi_prep_cif(ffi_cif *cif, + ffi_abi abi, + unsigned int nargs, + ffi_type *rtype, + ffi_type **atypes); + +ffi_status ffi_prep_cif_var(ffi_cif *cif, + ffi_abi abi, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, + ffi_type **atypes); + +void ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, + void **avalue); + +/* Useful for eliminating compiler warnings */ +#define FFI_FN(f) ((void (*)(void))f) + +/* ---- Definitions shared with assembly code ---------------------------- */ + +#endif + +/* If these change, update src/mips/ffitarget.h. */ +#define FFI_TYPE_VOID 0 +#define FFI_TYPE_INT 1 +#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_DOUBLE 3 +#if 0 +#define FFI_TYPE_LONGDOUBLE 4 +#else +#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE +#endif +#define FFI_TYPE_UINT8 5 +#define FFI_TYPE_SINT8 6 +#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_SINT16 8 +#define FFI_TYPE_UINT32 9 +#define FFI_TYPE_SINT32 10 +#define FFI_TYPE_UINT64 11 +#define FFI_TYPE_SINT64 12 +#define FFI_TYPE_STRUCT 13 +#define FFI_TYPE_POINTER 14 + +/* This should always refer to the last type code (for sanity checks) */ +#define FFI_TYPE_LAST FFI_TYPE_POINTER + +#ifdef __cplusplus +} +#endif + +#endif + + +#endif \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffi_common.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffi_common.h new file mode 100644 index 000000000..c179d6815 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffi_common.h @@ -0,0 +1,128 @@ +/* ----------------------------------------------------------------------- + ffi_common.h - Copyright (C) 2011, 2012 Anthony Green + Copyright (C) 2007 Free Software Foundation, Inc + Copyright (c) 1996 Red Hat, Inc. + + Common internal definitions and macros. Only necessary for building + libffi. + ----------------------------------------------------------------------- */ + +#ifndef FFI_COMMON_H +#define FFI_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Do not move this. Some versions of AIX are very picky about where + this is positioned. */ +#ifdef __GNUC__ +/* mingw64 defines this already in malloc.h. */ +#ifndef alloca +# define alloca __builtin_alloca +#endif +# define MAYBE_UNUSED __attribute__((__unused__)) +#else +# define MAYBE_UNUSED +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +# ifdef _MSC_VER +# define alloca _alloca +# else +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +/* Check for the existence of memcpy. */ +#if STDC_HEADERS +# include +#else +# ifndef HAVE_MEMCPY +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# endif +#endif + +#if defined(FFI_DEBUG) +#include +#endif + +#ifdef FFI_DEBUG +void ffi_assert(char *expr, char *file, int line); +void ffi_stop_here(void); +void ffi_type_test(ffi_type *a, char *file, int line); + +#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) +#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) +#define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) +#else +#define FFI_ASSERT(x) +#define FFI_ASSERT_AT(x, f, l) +#define FFI_ASSERT_VALID_TYPE(x) +#endif + +#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) +#define ALIGN_DOWN(v, a) (((size_t) (v)) & -a) + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif); +ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif, + unsigned int nfixedargs, unsigned int ntotalargs); + +/* Extended cif, used in callback from assembly routine */ +typedef struct +{ + ffi_cif *cif; + void *rvalue; + void **avalue; +} extended_cif; + +/* Terse sized type definitions. */ +#if defined(_MSC_VER) || defined(__sgi) +typedef unsigned char UINT8; +typedef signed char SINT8; +typedef unsigned short UINT16; +typedef signed short SINT16; +typedef unsigned int UINT32; +typedef signed int SINT32; +# ifdef _MSC_VER +typedef unsigned __int64 UINT64; +typedef signed __int64 SINT64; +# else +# include +typedef uint64_t UINT64; +typedef int64_t SINT64; +# endif +#else +typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); +typedef signed int SINT8 __attribute__((__mode__(__QI__))); +typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); +typedef signed int SINT16 __attribute__((__mode__(__HI__))); +typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); +typedef signed int SINT32 __attribute__((__mode__(__SI__))); +typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); +typedef signed int SINT64 __attribute__((__mode__(__DI__))); +#endif + +typedef float FLOAT32; + +#ifndef __GNUC__ +#define __builtin_expect(x, expected_value) (x) +#endif +#define LIKELY(x) __builtin_expect(!!(x),1) +#define UNLIKELY(x) __builtin_expect((x)!=0,0) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffi_i386.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffi_i386.h new file mode 100644 index 000000000..3b723a976 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffi_i386.h @@ -0,0 +1,476 @@ +#if !defined(__arm__) && defined(__i386__) + +/* -----------------------------------------------------------------*-C-*- + libffi 3.0.11 - Copyright (c) 2011 Anthony Green + - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the ``Software''), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +/* ------------------------------------------------------------------- + The basic API is described in the README file. + + The raw API is designed to bypass some of the argument packing + and unpacking on architectures for which it can be avoided. + + The closure API allows interpreted functions to be packaged up + inside a C function pointer, so that they can be called as C functions, + with no understanding on the client side that they are interpreted. + It can also be used in other cases in which it is necessary to package + up a user specified parameter and a function pointer as a single + function pointer. + + The closure API must be implemented in order to get its functionality, + e.g. for use by gij. Routines are provided to emulate the raw API + if the underlying platform doesn't allow faster implementation. + + More details on the raw and cloure API can be found in: + + http://gcc.gnu.org/ml/java/1999-q3/msg00138.html + + and + + http://gcc.gnu.org/ml/java/1999-q3/msg00174.html + -------------------------------------------------------------------- */ + +#ifndef LIBFFI_H +#define LIBFFI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Specify which architecture libffi is configured for. */ +#ifndef X86_DARWIN +#define X86_DARWIN +#endif + +/* ---- System configuration information --------------------------------- */ + +#include + +#ifndef LIBFFI_ASM + +#ifdef _MSC_VER +#define __attribute__(X) +#endif + +#include +#include + +/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). + But we can find it either under the correct ANSI name, or under GNU + C's internal name. */ + +#define FFI_64_BIT_MAX 9223372036854775807 + +#ifdef LONG_LONG_MAX +# define FFI_LONG_LONG_MAX LONG_LONG_MAX +#else +# ifdef LLONG_MAX +# define FFI_LONG_LONG_MAX LLONG_MAX +# ifdef _AIX52 /* or newer has C99 LLONG_MAX */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif /* _AIX52 or newer */ +# else +# ifdef __GNUC__ +# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ +# endif +# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ +# ifndef __PPC64__ +# if defined (__IBMC__) || defined (__IBMCPP__) +# define FFI_LONG_LONG_MAX LONGLONG_MAX +# endif +# endif /* __PPC64__ */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif +# endif +#endif + +/* The closure code assumes that this works on pointers, i.e. a size_t */ +/* can hold a pointer. */ + +typedef struct _ffi_type +{ + size_t size; + unsigned short alignment; + unsigned short type; + struct _ffi_type **elements; +} ffi_type; + +#ifndef LIBFFI_HIDE_BASIC_TYPES +#if SCHAR_MAX == 127 +# define ffi_type_uchar ffi_type_uint8 +# define ffi_type_schar ffi_type_sint8 +#else + #error "char size not supported" +#endif + +#if SHRT_MAX == 32767 +# define ffi_type_ushort ffi_type_uint16 +# define ffi_type_sshort ffi_type_sint16 +#elif SHRT_MAX == 2147483647 +# define ffi_type_ushort ffi_type_uint32 +# define ffi_type_sshort ffi_type_sint32 +#else + #error "short size not supported" +#endif + +#if INT_MAX == 32767 +# define ffi_type_uint ffi_type_uint16 +# define ffi_type_sint ffi_type_sint16 +#elif INT_MAX == 2147483647 +# define ffi_type_uint ffi_type_uint32 +# define ffi_type_sint ffi_type_sint32 +#elif INT_MAX == 9223372036854775807 +# define ffi_type_uint ffi_type_uint64 +# define ffi_type_sint ffi_type_sint64 +#else + #error "int size not supported" +#endif + +#if LONG_MAX == 2147483647 +# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX + #error "no 64-bit data type supported" +# endif +#elif LONG_MAX != FFI_64_BIT_MAX + #error "long size not supported" +#endif + +#if LONG_MAX == 2147483647 +# define ffi_type_ulong ffi_type_uint32 +# define ffi_type_slong ffi_type_sint32 +#elif LONG_MAX == FFI_64_BIT_MAX +# define ffi_type_ulong ffi_type_uint64 +# define ffi_type_slong ffi_type_sint64 +#else + #error "long size not supported" +#endif + +/* Need minimal decorations for DLLs to works on Windows. */ +/* GCC has autoimport and autoexport. Rely on Libtool to */ +/* help MSVC export from a DLL, but always declare data */ +/* to be imported for MSVC clients. This costs an extra */ +/* indirection for MSVC clients using the static version */ +/* of the library, but don't worry about that. Besides, */ +/* as a workaround, they can define FFI_BUILDING if they */ +/* *know* they are going to link with the static library. */ +#if defined _MSC_VER && !defined FFI_BUILDING +#define FFI_EXTERN extern __declspec(dllimport) +#else +#define FFI_EXTERN extern +#endif + +/* These are defined in types.c */ +FFI_EXTERN ffi_type ffi_type_void; +FFI_EXTERN ffi_type ffi_type_uint8; +FFI_EXTERN ffi_type ffi_type_sint8; +FFI_EXTERN ffi_type ffi_type_uint16; +FFI_EXTERN ffi_type ffi_type_sint16; +FFI_EXTERN ffi_type ffi_type_uint32; +FFI_EXTERN ffi_type ffi_type_sint32; +FFI_EXTERN ffi_type ffi_type_uint64; +FFI_EXTERN ffi_type ffi_type_sint64; +FFI_EXTERN ffi_type ffi_type_float; +FFI_EXTERN ffi_type ffi_type_double; +FFI_EXTERN ffi_type ffi_type_pointer; + +#if 1 +FFI_EXTERN ffi_type ffi_type_longdouble; +#else +#define ffi_type_longdouble ffi_type_double +#endif +#endif /* LIBFFI_HIDE_BASIC_TYPES */ + +typedef enum { + FFI_OK = 0, + FFI_BAD_TYPEDEF, + FFI_BAD_ABI +} ffi_status; + +typedef unsigned FFI_TYPE; + +typedef struct { + ffi_abi abi; + unsigned nargs; + ffi_type **arg_types; + ffi_type *rtype; + unsigned bytes; + unsigned flags; +#ifdef FFI_EXTRA_CIF_FIELDS + FFI_EXTRA_CIF_FIELDS; +#endif +} ffi_cif; + +/* Used internally, but overridden by some architectures */ +ffi_status ffi_prep_cif_core(ffi_cif *cif, + ffi_abi abi, + unsigned int isvariadic, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, + ffi_type **atypes); + +/* ---- Definitions for the raw API -------------------------------------- */ + +#ifndef FFI_SIZEOF_ARG +# if LONG_MAX == 2147483647 +# define FFI_SIZEOF_ARG 4 +# elif LONG_MAX == FFI_64_BIT_MAX +# define FFI_SIZEOF_ARG 8 +# endif +#endif + +#ifndef FFI_SIZEOF_JAVA_RAW +# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG +#endif + +typedef union { + ffi_sarg sint; + ffi_arg uint; + float flt; + char data[FFI_SIZEOF_ARG]; + void* ptr; +} ffi_raw; + +#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 +/* This is a special case for mips64/n32 ABI (and perhaps others) where + sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ +typedef union { + signed int sint; + unsigned int uint; + float flt; + char data[FFI_SIZEOF_JAVA_RAW]; + void* ptr; +} ffi_java_raw; +#else +typedef ffi_raw ffi_java_raw; +#endif + + +void ffi_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_raw *avalue); + +void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); +void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); +size_t ffi_raw_size (ffi_cif *cif); + +/* This is analogous to the raw API, except it uses Java parameter */ +/* packing, even on 64-bit machines. I.e. on 64-bit machines */ +/* longs and doubles are followed by an empty 64-bit word. */ + +void ffi_java_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_java_raw *avalue); + +void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); +void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); +size_t ffi_java_raw_size (ffi_cif *cif); + +/* ---- Definitions for closures ----------------------------------------- */ + +#if FFI_CLOSURES + +#ifdef _MSC_VER +__declspec(align(8)) +#endif +typedef struct { +#if 0 + void *trampoline_table; + void *trampoline_table_entry; +#else + char tramp[FFI_TRAMPOLINE_SIZE]; +#endif + ffi_cif *cif; + void (*fun)(ffi_cif*,void*,void**,void*); + void *user_data; +#ifdef __GNUC__ +} ffi_closure __attribute__((aligned (8))); +#else +} ffi_closure; +# ifdef __sgi +# pragma pack 0 +# endif +#endif + +void *ffi_closure_alloc (size_t size, void **code); +void ffi_closure_free (void *); + +ffi_status +ffi_prep_closure (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data); + +ffi_status +ffi_prep_closure_loc (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void*codeloc); + +#ifdef __sgi +# pragma pack 8 +#endif +typedef struct { +#if 0 + void *trampoline_table; + void *trampoline_table_entry; +#else + char tramp[FFI_TRAMPOLINE_SIZE]; +#endif + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_raw*,void*); + void *user_data; + +} ffi_raw_closure; + +typedef struct { +#if 0 + void *trampoline_table; + void *trampoline_table_entry; +#else + char tramp[FFI_TRAMPOLINE_SIZE]; +#endif + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); + void *user_data; + +} ffi_java_raw_closure; + +ffi_status +ffi_prep_raw_closure (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc); + +ffi_status +ffi_prep_java_raw_closure (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data, + void *codeloc); + +#endif /* FFI_CLOSURES */ + +/* ---- Public interface definition -------------------------------------- */ + +ffi_status ffi_prep_cif(ffi_cif *cif, + ffi_abi abi, + unsigned int nargs, + ffi_type *rtype, + ffi_type **atypes); + +ffi_status ffi_prep_cif_var(ffi_cif *cif, + ffi_abi abi, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, + ffi_type **atypes); + +void ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, + void **avalue); + +/* Useful for eliminating compiler warnings */ +#define FFI_FN(f) ((void (*)(void))f) + +/* ---- Definitions shared with assembly code ---------------------------- */ + +#endif + +/* If these change, update src/mips/ffitarget.h. */ +#define FFI_TYPE_VOID 0 +#define FFI_TYPE_INT 1 +#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_DOUBLE 3 +#if 1 +#define FFI_TYPE_LONGDOUBLE 4 +#else +#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE +#endif +#define FFI_TYPE_UINT8 5 +#define FFI_TYPE_SINT8 6 +#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_SINT16 8 +#define FFI_TYPE_UINT32 9 +#define FFI_TYPE_SINT32 10 +#define FFI_TYPE_UINT64 11 +#define FFI_TYPE_SINT64 12 +#define FFI_TYPE_STRUCT 13 +#define FFI_TYPE_POINTER 14 + +/* This should always refer to the last type code (for sanity checks) */ +#define FFI_TYPE_LAST FFI_TYPE_POINTER + +#ifdef __cplusplus +} +#endif + +#endif + + +#endif \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/fficonfig.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/fficonfig.h new file mode 100644 index 000000000..8dd088568 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/fficonfig.h @@ -0,0 +1,2 @@ +#include +#include diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/fficonfig_armv7.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/fficonfig_armv7.h new file mode 100644 index 000000000..8840c6de0 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/fficonfig_armv7.h @@ -0,0 +1,208 @@ +#ifdef __arm__ + +/* fficonfig.h. Generated from fficonfig.h.in by configure. */ +/* fficonfig.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to the flags needed for the .section .eh_frame directive. */ +#define EH_FRAME_FLAGS "aw" + +/* Define this if you want extra debugging. */ +/* #undef FFI_DEBUG */ + +/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ +#define FFI_EXEC_TRAMPOLINE_TABLE 1 + +/* Cannot use malloc on this target, so, we revert to alternative means */ +/* #undef FFI_MMAP_EXEC_WRIT */ + +/* Define this is you do not want support for the raw API. */ +/* #undef FFI_NO_RAW_API */ + +/* Define this is you do not want support for aggregate types. */ +/* #undef FFI_NO_STRUCTS */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define if your assembler supports .ascii. */ +/* #undef HAVE_AS_ASCII_PSEUDO_OP */ + +/* Define if your assembler supports .cfi_* directives. */ +/* #undef HAVE_AS_CFI_PSEUDO_OP */ + +/* Define if your assembler supports .register. */ +/* #undef HAVE_AS_REGISTER_PSEUDO_OP */ + +/* Define if your assembler and linker support unaligned PC relative relocs. + */ +/* #undef HAVE_AS_SPARC_UA_PCREL */ + +/* Define if your assembler supports .string. */ +/* #undef HAVE_AS_STRING_PSEUDO_OP */ + +/* Define if your assembler supports unwind section type. */ +/* #undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE */ + +/* Define if your assembler supports PC relative relocs. */ +/* #undef HAVE_AS_X86_PCREL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define if __attribute__((visibility("hidden"))) is supported. */ +/* #undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have the long double type and it is bigger than a double */ +/* #undef HAVE_LONG_DOUBLE */ + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mmap' function. */ +#define HAVE_MMAP 1 + +/* Define if mmap with MAP_ANON(YMOUS) works. */ +#define HAVE_MMAP_ANON 1 + +/* Define if mmap of /dev/zero works. */ +/* #undef HAVE_MMAP_DEV_ZERO */ + +/* Define if read-only mmap of a plain file works. */ +#define HAVE_MMAP_FILE 1 + +/* Define if .eh_frame sections should be read-only. */ +/* #undef HAVE_RO_EH_FRAME */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Name of package */ +#define PACKAGE "libffi" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "http://github.com/atgreen/libffi/issues" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libffi" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libffi 3.0.11" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libffi" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.0.11" + +/* The size of `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 8 + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if symbols are underscored. */ +/* #undef SYMBOL_UNDERSCORE */ + +/* Define this if you are using Purify and want to suppress spurious messages. + */ +/* #undef USING_PURIFY */ + +/* Version number of package */ +#define VERSION "3.0.11" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + + +#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) .hidden name +#else +#define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) +#endif +#else +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) +#else +#define FFI_HIDDEN +#endif +#endif + + + +#endif \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/fficonfig_i386.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/fficonfig_i386.h new file mode 100644 index 000000000..7cd25dca8 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/fficonfig_i386.h @@ -0,0 +1,208 @@ +#if !defined(__arm__) && defined(__i386__) + +/* fficonfig.h. Generated from fficonfig.h.in by configure. */ +/* fficonfig.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to the flags needed for the .section .eh_frame directive. */ +#define EH_FRAME_FLAGS "aw" + +/* Define this if you want extra debugging. */ +/* #undef FFI_DEBUG */ + +/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ +/* #undef FFI_EXEC_TRAMPOLINE_TABLE */ + +/* Cannot use malloc on this target, so, we revert to alternative means */ +#define FFI_MMAP_EXEC_WRIT 1 + +/* Define this is you do not want support for the raw API. */ +/* #undef FFI_NO_RAW_API */ + +/* Define this is you do not want support for aggregate types. */ +/* #undef FFI_NO_STRUCTS */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define if your assembler supports .ascii. */ +/* #undef HAVE_AS_ASCII_PSEUDO_OP */ + +/* Define if your assembler supports .cfi_* directives. */ +#define HAVE_AS_CFI_PSEUDO_OP 1 + +/* Define if your assembler supports .register. */ +/* #undef HAVE_AS_REGISTER_PSEUDO_OP */ + +/* Define if your assembler and linker support unaligned PC relative relocs. + */ +/* #undef HAVE_AS_SPARC_UA_PCREL */ + +/* Define if your assembler supports .string. */ +/* #undef HAVE_AS_STRING_PSEUDO_OP */ + +/* Define if your assembler supports unwind section type. */ +/* #undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE */ + +/* Define if your assembler supports PC relative relocs. */ +/* #undef HAVE_AS_X86_PCREL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define if __attribute__((visibility("hidden"))) is supported. */ +/* #undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have the long double type and it is bigger than a double */ +#define HAVE_LONG_DOUBLE 1 + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mmap' function. */ +#define HAVE_MMAP 1 + +/* Define if mmap with MAP_ANON(YMOUS) works. */ +#define HAVE_MMAP_ANON 1 + +/* Define if mmap of /dev/zero works. */ +/* #undef HAVE_MMAP_DEV_ZERO */ + +/* Define if read-only mmap of a plain file works. */ +#define HAVE_MMAP_FILE 1 + +/* Define if .eh_frame sections should be read-only. */ +/* #undef HAVE_RO_EH_FRAME */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Name of package */ +#define PACKAGE "libffi" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "http://github.com/atgreen/libffi/issues" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libffi" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libffi 3.0.11" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libffi" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.0.11" + +/* The size of `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 16 + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if symbols are underscored. */ +/* #undef SYMBOL_UNDERSCORE */ + +/* Define this if you are using Purify and want to suppress spurious messages. + */ +/* #undef USING_PURIFY */ + +/* Version number of package */ +#define VERSION "3.0.11" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + + +#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) .hidden name +#else +#define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) +#endif +#else +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) +#else +#define FFI_HIDDEN +#endif +#endif + + + +#endif \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffitarget.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffitarget.h new file mode 100644 index 000000000..cedaaf4c1 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffitarget.h @@ -0,0 +1,2 @@ +#include +#include diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffitarget_armv7.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffitarget_armv7.h new file mode 100644 index 000000000..1a42b2d36 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffitarget_armv7.h @@ -0,0 +1,76 @@ +#ifdef __arm__ + +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 2010 CodeSourcery + Copyright (c) 1996-2003 Red Hat, Inc. + + Target configuration macros for ARM. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_VFP, + FFI_LAST_ABI, +#ifdef __ARM_PCS_VFP + FFI_DEFAULT_ABI = FFI_VFP, +#else + FFI_DEFAULT_ABI = FFI_SYSV, +#endif +} ffi_abi; +#endif + +#define FFI_EXTRA_CIF_FIELDS \ + int vfp_used; \ + short vfp_reg_free, vfp_nargs; \ + signed char vfp_args[16] \ + +/* Internally used. */ +#define FFI_TYPE_STRUCT_VFP_FLOAT (FFI_TYPE_LAST + 1) +#define FFI_TYPE_STRUCT_VFP_DOUBLE (FFI_TYPE_LAST + 2) + +#define FFI_TARGET_SPECIFIC_VARIADIC + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 20 +#define FFI_NATIVE_RAW_API 0 + +#endif + + +#endif \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffitarget_i386.h b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffitarget_i386.h new file mode 100644 index 000000000..42af810e0 --- /dev/null +++ b/DerivedData/BlocksKit/Build/Products/BlocksKit/BlocksKit/ffitarget_i386.h @@ -0,0 +1,144 @@ +#if !defined(__arm__) && defined(__i386__) + +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003, 2010 Red Hat, Inc. + Copyright (C) 2008 Free Software Foundation, Inc. + + Target configuration macros for x86 and x86-64. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +/* ---- System specific configurations ----------------------------------- */ + +/* For code common to all platforms on x86 and x86_64. */ +#define X86_ANY + +#if defined (X86_64) && defined (__i386__) +#undef X86_64 +#define X86 +#endif + +#ifdef X86_WIN64 +#define FFI_SIZEOF_ARG 8 +#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ +#endif + +/* ---- Generic type definitions ----------------------------------------- */ + +#ifndef LIBFFI_ASM +#ifdef X86_WIN64 +#ifdef _MSC_VER +typedef unsigned __int64 ffi_arg; +typedef __int64 ffi_sarg; +#else +typedef unsigned long long ffi_arg; +typedef long long ffi_sarg; +#endif +#else +#if defined __x86_64__ && !defined __LP64__ +#define FFI_SIZEOF_ARG 8 +typedef unsigned long long ffi_arg; +typedef long long ffi_sarg; +#else +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; +#endif +#endif + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + + /* ---- Intel x86 Win32 ---------- */ +#ifdef X86_WIN32 + FFI_SYSV, + FFI_STDCALL, + FFI_THISCALL, + FFI_FASTCALL, + FFI_MS_CDECL, + FFI_LAST_ABI, +#ifdef _MSC_VER + FFI_DEFAULT_ABI = FFI_MS_CDECL +#else + FFI_DEFAULT_ABI = FFI_SYSV +#endif + +#elif defined(X86_WIN64) + FFI_WIN64, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_WIN64 + +#else + /* ---- Intel x86 and AMD x86-64 - */ + FFI_SYSV, + FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ + FFI_LAST_ABI, +#if defined(__i386__) || defined(__i386) + FFI_DEFAULT_ABI = FFI_SYSV +#else + FFI_DEFAULT_ABI = FFI_UNIX64 +#endif +#endif +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) +#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) +#define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) +#define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4) + +#if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) +#define FFI_TRAMPOLINE_SIZE 24 +#define FFI_NATIVE_RAW_API 0 +#else +#ifdef X86_WIN32 +#define FFI_TRAMPOLINE_SIZE 52 +#else +#ifdef X86_WIN64 +#define FFI_TRAMPOLINE_SIZE 29 +#define FFI_NATIVE_RAW_API 0 +#define FFI_NO_RAW_API 1 +#else +#define FFI_TRAMPOLINE_SIZE 10 +#endif +#endif +#ifndef X86_WIN64 +#define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ +#endif +#endif + +#endif + + + +#endif \ No newline at end of file diff --git a/DerivedData/BlocksKit/Build/Products/Release-iphoneos/libBlocksKit.a b/DerivedData/BlocksKit/Build/Products/Release-iphoneos/libBlocksKit.a new file mode 100644 index 000000000..489de61a1 Binary files /dev/null and b/DerivedData/BlocksKit/Build/Products/Release-iphoneos/libBlocksKit.a differ