Permalink
Browse files

MuiKit can now be built for use on Mac OS X. This is useful if you wa…

…nt to run MuiKit-relying code on OS X, like the new "tool" test approach in Mover's 3/Network library.
  • Loading branch information...
millenomi committed Sep 12, 2009
1 parent 63b5c41 commit d23eaab462f720891d691849105734a7cbdc5ace
View
@@ -6,8 +6,9 @@
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
-#import <UIKit/UIKit.h>
+#if TARGET_OS_IPHONE
+#import <UIKit/UIKit.h>
@interface L0ActionSheet : UIActionSheet {
NSMutableArray* buttonIdentifiers;
@@ -20,3 +21,5 @@
// Also a generic KVO container.
@end
+
+#endif
View
@@ -6,6 +6,8 @@
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
+#if TARGET_OS_IPHONE
+
#import "L0ActionSheet.h"
@@ -69,3 +71,5 @@ - (void) setValue:(id) v forUndefinedKey:(NSString*) k;
}
@end
+
+#endif
View
@@ -6,6 +6,8 @@
// Copyright 2009 Emanuele Vulcano. All rights reserved.
//
+#if TARGET_OS_IPHONE
+
#import <UIKit/UIKit.h>
@protocol L0DraggableViewDelegate;
@@ -154,3 +156,5 @@
- (void) draggableView:(L0DraggableView*) view didEndAttractionByFinishing:(BOOL) finished;
@end
+
+#endif
View
@@ -6,6 +6,8 @@
// Copyright 2009 Emanuele Vulcano. All rights reserved.
//
+#if TARGET_OS_IPHONE
+
#import "L0DraggableView.h"
static inline BOOL L0VectorHasPointWithinAbsolute(CGPoint vector, CGFloat rangeAbs) {
@@ -481,3 +483,5 @@ - (void) setDelegate:(id <L0DraggableViewDelegate>) d;
}
@end
+
+#endif
View
@@ -6,6 +6,8 @@
// Copyright 2009 Emanuele Vulcano. All rights reserved.
//
+#if TARGET_OS_IPHONE
+
#import <UIKit/UIKit.h>
@interface L0FlipViewController : UIViewController {
@@ -32,3 +34,5 @@
- (IBAction) showBack;
@end
+
+#endif
View
@@ -6,6 +6,8 @@
// Copyright 2009 Emanuele Vulcano. All rights reserved.
//
+#if TARGET_OS_IPHONE
+
#import "L0FlipViewController.h"
@interface L0FlipViewController ()
@@ -131,3 +133,5 @@ - (void) didReceiveMemoryWarning;
}
@end
+
+#endif
View
43 L0Map.h
@@ -0,0 +1,43 @@
+//
+// L0Map.h
+// MuiKit
+//
+// Created by ∞ on 12/09/09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface L0Map : NSObject {
+ CFMutableDictionaryRef dict;
+}
+
+// Designated init.
+- (id) initWithKeyCallbacks:(const CFDictionaryKeyCallBacks*) kcbs valueCallbacks:(const CFDictionaryValueCallBacks*) vcbs;
+
+// Makes a map whose keys and values are objects that get retained and released.
+- (id) init;
++ map;
+
+- (NSUInteger) count;
+
+- (id) objectForKey:(id) k;
+- (void*) pointerForPointerKey:(void*) k;
+
+- (void) setObject:(id) o forKey:(id) k;
+- (void) setPointer:(void*) o forPointerKey:(void*) k;
+
+- (void) removeObjectForKey:(id) k;
+- (void) removeObjectForPointerKey:(void*) k;
+- (void) removeAllObjects;
+
+// Neither can be NULL.
+- (void) getKeys:(void**) keys values:(void**) objects;
+
+// Either can be NULL.
+- (void) getEnumeratorForKeys:(NSEnumerator**) keys values:(NSEnumerator**) objects;
+
+- (NSEnumerator*) allValues;
+- (NSEnumerator*) allKeys;
+
+@end
View
121 L0Map.m
@@ -0,0 +1,121 @@
+//
+// L0Map.m
+// MuiKit
+//
+// Created by ∞ on 12/09/09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+#import "L0Map.h"
+
+
+@implementation L0Map
+
+- (id) initWithKeyCallbacks:(const CFDictionaryKeyCallBacks*) kcbs valueCallbacks:(const CFDictionaryValueCallBacks*) vcbs;
+{
+ if (self = [super init])
+ dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, kcbs, vcbs);
+
+ return self;
+}
+
+
+- (id) init;
+{
+ return [self initWithKeyCallbacks:&kCFTypeDictionaryKeyCallBacks valueCallbacks:&kCFTypeDictionaryValueCallBacks];
+}
+
+- (void) dealloc;
+{
+ CFRelease(dict);
+ [super dealloc];
+}
+
++ map;
+{
+ return [[self new] autorelease];
+}
+
+#pragma mark -
+#pragma mark Accessors
+
+- (NSUInteger) count;
+{
+ return CFDictionaryGetCount(dict);
+}
+
+- (void) setObject:(id) o forKey:(id) k;
+{
+ [self setPointer:o forPointerKey:k];
+}
+
+- (id) objectForKey:(id) k;
+{
+ return (id) [self pointerForPointerKey:k];
+}
+
+- (void) removeObjectForKey:(id) k;
+{
+ [self removeObjectForPointerKey:k];
+}
+
+- (void) setPointer:(void*) o forPointerKey:(void*) k;
+{
+ CFDictionarySetValue(dict, k, o);
+}
+
+- (void*) pointerForPointerKey:(void*) k;
+{
+ return (void*) CFDictionaryGetValue(dict, k);
+}
+
+- (void) removeObjectForPointerKey:(void*) k;
+{
+ CFDictionaryRemoveValue(dict, (const void*) k);
+}
+
+- (void) removeAllObjects;
+{
+ CFDictionaryRemoveAllValues(dict);
+}
+
+- (void) getKeys:(void **)keys values:(void **)objects;
+{
+ CFDictionaryGetKeysAndValues(dict, (const void**) keys, (const void**) objects);
+}
+
+- (void) getEnumeratorForKeys:(NSEnumerator**) keysEnu values:(NSEnumerator**) valuesEnu;
+{
+ NSUInteger c = [self count];
+ void* values = malloc(c * sizeof(void*));
+ void* keys = malloc(c * sizeof(void*));
+
+ [self getKeys:&keys values:&values];
+
+ if (keysEnu) {
+ NSArray* a = [NSArray arrayWithObjects:(const id*) keys count:c];
+ *keysEnu = [a objectEnumerator];
+ }
+
+ if (valuesEnu) {
+ NSArray* a = [NSArray arrayWithObjects:(const id*) values count:c];
+ *valuesEnu = [a objectEnumerator];
+ }
+
+ free(values);
+ free(keys);
+}
+
+- (NSEnumerator*) allValues;
+{
+ NSEnumerator* vals; [self getEnumeratorForKeys:NULL values:&vals];
+ return vals;
+}
+
+- (NSEnumerator*) allKeys;
+{
+ NSEnumerator* vals; [self getEnumeratorForKeys:&vals values:NULL];
+ return vals;
+}
+
+@end
@@ -16,6 +16,8 @@
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#if TARGET_OS_IPHONE
+
#import <UIKit/UIKit.h>
/*
@@ -184,3 +186,5 @@
- (void) solicit;
@end
+
+#endif
@@ -16,6 +16,8 @@
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#if TARGET_OS_IPHONE
+
#import "L0SolicitReviewController.h"
#import "UIAlertView+L0Alert.h"
@@ -167,3 +169,5 @@ - (NSBundle*) _resourcesBundle {
}
@end
+
+#endif
View
@@ -2,20 +2,26 @@
#error MuiKit requires Objective-C
#endif
+#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
-#import "L0ExternalURLOpeningDetection.h"
#import "L0SolicitReviewController.h"
#import "UIImage+L0RenderingAdditions.h"
#import "L0DraggableView.h"
#import "UIAlertView+L0Alert.h"
-#import "L0UUID.h"
#import "L0FlipViewController.h"
#import "UIDevice+L0ModelDetection.h"
#import "L0ActionSheet.h"
+#import "UIApplication+L0NetworkIndicator.h"
+#endif
+
+#import <Foundation/Foundation.h>
+
+#import "L0ExternalURLOpeningDetection.h"
+#import "L0UUID.h"
#import "NSURL+L0URLParsing.h"
#import "NSURL+L0URLResolvingRedirects.h"
#import "L0KVODictionaryAdditions.h"
-#import "UIApplication+L0NetworkIndicator.h"
#import "L0KVODispatcher.h"
-#import "NSData+L0IPAddressTools.h"
+#import "NSData+L0IPAddressTools.h"
+#import "L0Map.h"
View
@@ -5,9 +5,12 @@ BASE_BUILD_FOLDER = $(SRCROOT)
SYMROOT = $(BASE_BUILD_FOLDER)/Build
OBJROOT = $(BASE_BUILD_FOLDER)/TemporaryItems
-SDKROOT = iphoneos3.0
-IPHONEOS_DEPLOYMENT_TARGET = 2.2
+MUIKIT_IPHONE_SDKROOT = iphoneos3.0
+MUIKIT_IPHONEOS_DEPLOYMENT_TARGET = 2.2
-ARCHS = $(ARCHS_STANDARD_32_BIT)
+MUIKIT_IPHONE_ARCHS = $(ARCHS_STANDARD_32_BIT)
+
+MUIKIT_MACOSX_SDKROOT = macosx10.5
+MUIKIT_MACOSX_ARCHS = $(ARCHS_STANDARD_32_64_BIT)
#include "Local.xcconfig"
Oops, something went wrong.

0 comments on commit d23eaab

Please sign in to comment.