diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-02-28 19:42:16 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-07 02:41:30 -0800 |
commit | 819a0ab15627e670431ba80fffab8b745dab89da (patch) | |
tree | 1a8592b15247893890e7de78f6fad608738e057c | |
parent | 092a6bbbf0dd2b34e213bed09eb2469f8a93e5f5 (diff) |
Rename UICaboodle to CyteKit.
-rw-r--r-- | CyteKit/CyteLocalize.h | 51 | ||||
-rw-r--r-- | CyteKit/CyteViewController.h | 84 | ||||
-rw-r--r-- | CyteKit/CyteViewController.mm | 122 | ||||
-rw-r--r-- | CyteKit/CyteWebViewController.h (renamed from UICaboodle/BrowserView.h) | 52 | ||||
-rw-r--r-- | CyteKit/CyteWebViewController.mm (renamed from UICaboodle/BrowserView.mm) | 14 | ||||
-rw-r--r-- | CyteKit/NSString-Cyte.h (renamed from UICaboodle/NSString-UICaboodle.h) | 8 | ||||
-rw-r--r-- | CyteKit/PerlCompatibleRegEx.hpp (renamed from UICaboodle/PerlCompatibleRegEx.hpp) | 2 | ||||
-rw-r--r-- | CyteKit/UCInternal.h (renamed from UICaboodle/UCInternal.h) | 0 | ||||
-rw-r--r-- | CyteKit/UCPlatform.h | 106 | ||||
-rw-r--r-- | MobileCydia.mm | 10 | ||||
-rw-r--r-- | UICaboodle/RVPage.h | 40 | ||||
-rw-r--r-- | UICaboodle/RVPage.mm | 83 | ||||
-rw-r--r-- | UICaboodle/UCLocalize.h | 12 | ||||
-rw-r--r-- | UICaboodle/UCPlatform.h | 62 | ||||
-rw-r--r-- | UICaboodle/UCString.h | 42 | ||||
-rw-r--r-- | makefile | 2 |
16 files changed, 429 insertions, 261 deletions
diff --git a/CyteKit/CyteLocalize.h b/CyteKit/CyteLocalize.h new file mode 100644 index 0000000..a06bb0a --- /dev/null +++ b/CyteKit/CyteLocalize.h @@ -0,0 +1,51 @@ +/* Cydia - iPhone UIKit Front-End for Debian APT + * Copyright (C) 2008-2011 Jay Freeman (saurik) +*/ + +/* Modified BSD License {{{ */ +/* + * Redistribution and use in source and binary + * forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the + * above copyright notice, this list of conditions + * and the following disclaimer. + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions + * and the following disclaimer in the documentation + * and/or other materials provided with the + * distribution. + * 3. The name of the author may not be used to endorse + * or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. +*/ +/* }}} */ + +#ifndef CyteKit_CyteLocalize_H +#define CyteKit_CyteLocalize_H + +#include <Foundation/Foundation.h> + +static inline NSString *UCLocalizeEx(NSString *key, NSString *value = nil) { + return [[NSBundle mainBundle] localizedStringForKey:key value:value table:nil]; +} + +#define UCLocalize(key) UCLocalizeEx(@ key) + +#endif//CyteKit_CyteLocalize_H diff --git a/CyteKit/CyteViewController.h b/CyteKit/CyteViewController.h new file mode 100644 index 0000000..fb5d202 --- /dev/null +++ b/CyteKit/CyteViewController.h @@ -0,0 +1,84 @@ +/* Cydia - iPhone UIKit Front-End for Debian APT + * Copyright (C) 2008-2011 Jay Freeman (saurik) +*/ + +/* Modified BSD License {{{ */ +/* + * Redistribution and use in source and binary + * forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the + * above copyright notice, this list of conditions + * and the following disclaimer. + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions + * and the following disclaimer in the documentation + * and/or other materials provided with the + * distribution. + * 3. The name of the author may not be used to endorse + * or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. +*/ +/* }}} */ + +#ifndef CyteKit_CyteViewController_H +#define CyteKit_CyteViewController_H + +#include <CyteKit/UCPlatform.h> + +#include <UIKit/UIKit.h> + +@interface UIViewController (Cydia) +- (BOOL) hasLoaded; +- (void) reloadData; +- (void) unloadData; +@end + +@interface CYViewController : UIViewController { + _transient id delegate_; + BOOL loaded_; +} + +// The default implementation of this method is essentially a no-op, +// but calling the superclass implementation is *required*. +- (void) reloadData; + +- (void) unloadData; + +// This URL is used to save the state of the view controller. Return +// nil if you cannot or should not save the URL for this page. +- (NSURL *) navigationURL; + +// By default, this delegate is unused. However, it's provided here in case +// you need some kind of delegate in a subclass. +- (void) setDelegate:(id)delegate; +- (id) delegate; + +// Override this in subclasses if you manage the "has seen first load" state yourself. +- (BOOL) hasLoaded; + +// This is called when the view managed by the view controller is released. +// That is not always when the controller itself is released: it also can +// happen when more memory is needed by the system or whenever the controller +// just happens not to be visible. +- (void) releaseSubviews; + +@end + +#endif//CyteKit_CyteViewController_H diff --git a/CyteKit/CyteViewController.mm b/CyteKit/CyteViewController.mm new file mode 100644 index 0000000..73e1630 --- /dev/null +++ b/CyteKit/CyteViewController.mm @@ -0,0 +1,122 @@ +/* Cydia - iPhone UIKit Front-End for Debian APT + * Copyright (C) 2008-2011 Jay Freeman (saurik) +*/ + +/* Modified BSD License {{{ */ +/* + * Redistribution and use in source and binary + * forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the + * above copyright notice, this list of conditions + * and the following disclaimer. + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions + * and the following disclaimer in the documentation + * and/or other materials provided with the + * distribution. + * 3. The name of the author may not be used to endorse + * or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. +*/ +/* }}} */ + +#include "CyteKit/CyteViewController.h" + +#include <Foundation/Foundation.h> +#include <UIKit/UIKit.h> + +extern bool IsWildcat_; + +@implementation UIViewController (Cydia) + +- (BOOL) hasLoaded { + return YES; +} + +- (void) reloadData { +} + +- (void) unloadData { + if (UIViewController *modal = [self modalViewController]) + [modal unloadData]; +} + +@end + +@implementation CYViewController + +- (void) setDelegate:(id)delegate { + delegate_ = delegate; +} + +- (id) delegate { + return delegate_; +} + +- (void) viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + // Load on first appearance. We don't need to set the loaded flag here + // because it is set for us the first time -reloadData is called. + if (![self hasLoaded]) + [self reloadData]; +} + +- (BOOL) hasLoaded { + return loaded_; +} + +- (void) releaseSubviews { + // Do nothing. +} + +- (void) setView:(UIView *)view { + // Nasty hack for 2.x-compatibility. In 3.0+, we can and + // should just override -viewDidUnload instead. + if (view == nil) + [self releaseSubviews]; + + [super setView:view]; +} + +- (void) reloadData { + [super reloadData]; + + // This is called automatically on the first appearance of a controller, + // or any other time it needs to reload the information shown. However (!), + // this is not called by any tab bar or navigation controller's -reloadData + // method unless this controller returns YES from -hadLoaded. + loaded_ = YES; +} + +- (void) unloadData { + loaded_ = NO; + [super unloadData]; +} + +- (NSURL *) navigationURL { + return nil; +} + +- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { + return IsWildcat_ || orientation == UIInterfaceOrientationPortrait; +} + +@end diff --git a/UICaboodle/BrowserView.h b/CyteKit/CyteWebViewController.h index 1d87d61..f4ba3e3 100644 --- a/UICaboodle/BrowserView.h +++ b/CyteKit/CyteWebViewController.h @@ -1,13 +1,55 @@ -#import <UICaboodle/RVPage.h> - -#import <UIKit/UIKit.h> +/* Cydia - iPhone UIKit Front-End for Debian APT + * Copyright (C) 2008-2011 Jay Freeman (saurik) +*/ + +/* Modified BSD License {{{ */ +/* + * Redistribution and use in source and binary + * forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the + * above copyright notice, this list of conditions + * and the following disclaimer. + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions + * and the following disclaimer in the documentation + * and/or other materials provided with the + * distribution. + * 3. The name of the author may not be used to endorse + * or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. +*/ +/* }}} */ + +#ifndef CyteKit_CydiaBrowserController_H +#define CyteKit_CydiaBrowserController_H + +#include "CyteKit/CyteViewController.h" + +#include <UIKit/UIKit.h> #include <WebKit/DOMNodeList.h> #include <WebKit/WebFrame.h> #include <WebKit/WebScriptObject.h> #include <WebKit/WebView.h> -#import <JavaScriptCore/JavaScriptCore.h> +#include <JavaScriptCore/JavaScriptCore.h> #include "substrate.h" @@ -137,3 +179,5 @@ - (void) setViewportWidthOnMainThread:(float)value; @end + +#endif//CyteKit_CydiaBrowserController_H diff --git a/UICaboodle/BrowserView.mm b/CyteKit/CyteWebViewController.mm index 4168de9..4cbdfd2 100644 --- a/UICaboodle/BrowserView.mm +++ b/CyteKit/CyteWebViewController.mm @@ -1,11 +1,11 @@ +#include "CyteKit/UCPlatform.h" + #include <UIKit/UIKit.h> #include "iPhonePrivate.h" -#include "UCPlatform.h" - -#include <UICaboodle/BrowserView.h> -#include "UICaboodle/PerlCompatibleRegEx.hpp" -#include <UICaboodle/UCLocalize.h> +#include "CyteKit/CyteLocalize.h" +#include "CyteKit/CyteWebViewController.h" +#include "CyteKit/PerlCompatibleRegEx.hpp" //#include <QuartzCore/CALayer.h> // XXX: fix the minimum requirement @@ -222,7 +222,7 @@ enum CYWebPolicyDecision { @implementation CYWebView : UIWebView #if ShowInternals -#include "UICaboodle/UCInternal.h" +#include "CyteKit/UCInternal.h" #endif - (id) initWithFrame:(CGRect)frame { @@ -449,7 +449,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se @implementation BrowserController #if ShowInternals -#include "UICaboodle/UCInternal.h" +#include "CyteKit/UCInternal.h" #endif + (void) _initialize { diff --git a/UICaboodle/NSString-UICaboodle.h b/CyteKit/NSString-Cyte.h index f09f1c3..ae370c0 100644 --- a/UICaboodle/NSString-UICaboodle.h +++ b/CyteKit/NSString-Cyte.h @@ -37,12 +37,12 @@ */ /* }}} */ -#ifndef UICaboodle_NSString_Cydia_H -#define UICaboodle_NSString_Cydia_H +#ifndef CyteKit_NSString_Cydia_H +#define CyteKit_NSString_Cydia_H -@interface NSString (UICaboodle) +@interface NSString (Cyte) + (NSString *) stringWithUTF8BytesNoCopy:(const char *)bytes length:(int)length; + (NSString *) stringWithUTF8Bytes:(const char *)bytes length:(int)length; @end -#endif//UICaboodle_NSString_Cydia_H +#endif//CyteKit_NSString_Cydia_H diff --git a/UICaboodle/PerlCompatibleRegEx.hpp b/CyteKit/PerlCompatibleRegEx.hpp index f91c338..3bd5e76 100644 --- a/UICaboodle/PerlCompatibleRegEx.hpp +++ b/CyteKit/PerlCompatibleRegEx.hpp @@ -42,7 +42,7 @@ #include <pcre.h> -#include "UICaboodle/NSString-UICaboodle.h" +#include "CyteKit/NSString-Cyte.h" class Pcre { private: diff --git a/UICaboodle/UCInternal.h b/CyteKit/UCInternal.h index 62b46e2..62b46e2 100644 --- a/UICaboodle/UCInternal.h +++ b/CyteKit/UCInternal.h diff --git a/CyteKit/UCPlatform.h b/CyteKit/UCPlatform.h new file mode 100644 index 0000000..963fb1d --- /dev/null +++ b/CyteKit/UCPlatform.h @@ -0,0 +1,106 @@ +/* Cydia - iPhone UIKit Front-End for Debian APT + * Copyright (C) 2008-2011 Jay Freeman (saurik) +*/ + +/* Modified BSD License {{{ */ +/* + * Redistribution and use in source and binary + * forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the + * above copyright notice, this list of conditions + * and the following disclaimer. + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions + * and the following disclaimer in the documentation + * and/or other materials provided with the + * distribution. + * 3. The name of the author may not be used to endorse + * or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. +*/ +/* }}} */ + +#ifndef CyteKit_UCPlatform_H +#define CyteKit_UCPlatform_H + +#define __STDC_LIMIT_MACROS +#include <stdint.h> + +#include <objc/objc.h> + +#include <sys/time.h> +#include <time.h> + +#define _forever \ + for (;;) + +extern struct timeval _ltv; +extern bool _itv; + +#define _trace() do { \ + struct timeval _ctv; \ + gettimeofday(&_ctv, NULL); \ + if (!_itv) { \ + _itv = true; \ + _ltv = _ctv; \ + } \ + fprintf(stderr, "%lu.%.6u[%f]:_trace()@%s:%u[%s]\n", \ + _ctv.tv_sec, _ctv.tv_usec, \ + (_ctv.tv_sec - _ltv.tv_sec) + (_ctv.tv_usec - _ltv.tv_usec) / 1000000.0, \ + __FILE__, __LINE__, __FUNCTION__\ + ); \ + _ltv = _ctv; \ +} while (false) + +#define _assert(test) do \ + if (!(test)) { \ + fprintf(stderr, "_assert(%d:%s)@%s:%u[%s]\n", errno, #test, __FILE__, __LINE__, __FUNCTION__); \ + exit(-1); \ + } \ +while (false) + +#define _not(type) ((type) ~ (type) 0) + +#define _transient + +#define _label__(x) _label ## x +#define _label_(y) _label__(y) +#define _label _label_(__LINE__) + +#define _packed \ + __attribute__((__packed__)) +#define _finline \ + inline __attribute__((__always_inline__)) + +#define _assume(e) \ + _assert(e) + +#define _nodefault \ + default: \ + _assume(false); \ + throw; + +#define _likely(expr) \ + __builtin_expect(expr, 1) + +#define _unlikely(expr) \ + __builtin_expect(expr, 0) + +#endif//CyteKit_UCPlatform_H diff --git a/MobileCydia.mm b/MobileCydia.mm index 1e5e0f6..26c7920 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -41,8 +41,8 @@ #define USE_SYSTEM_MALLOC 1 /* #include Directives {{{ */ -#include "UICaboodle/UCPlatform.h" -#include "UICaboodle/UCLocalize.h" +#include "CyteKit/UCPlatform.h" +#include "CyteKit/CyteLocalize.h" #include <objc/objc.h> #include <objc/runtime.h> @@ -120,9 +120,9 @@ extern "C" { #include <Cytore.hpp> -#include "UICaboodle/BrowserView.h" -#include "UICaboodle/NSString-UICaboodle.h" -#include "UICaboodle/PerlCompatibleRegEx.hpp" +#include "CyteKit/CyteWebViewController.h" +#include "CyteKit/NSString-Cyte.h" +#include "CyteKit/PerlCompatibleRegEx.hpp" #include "SDURLCache/SDURLCache.h" diff --git a/UICaboodle/RVPage.h b/UICaboodle/RVPage.h deleted file mode 100644 index be2331d..0000000 --- a/UICaboodle/RVPage.h +++ /dev/null @@ -1,40 +0,0 @@ -#import <UICaboodle/UCPlatform.h> - -#import <UIKit/UIKit.h> - -@interface UIViewController (Cydia) -- (BOOL) hasLoaded; -- (void) reloadData; -- (void) unloadData; -@end - -@interface CYViewController : UIViewController { - _transient id delegate_; - BOOL loaded_; -} - -// The default implementation of this method is essentially a no-op, -// but calling the superclass implementation is *required*. -- (void) reloadData; - -- (void) unloadData; - -// This URL is used to save the state of the view controller. Return -// nil if you cannot or should not save the URL for this page. -- (NSURL *) navigationURL; - -// By default, this delegate is unused. However, it's provided here in case -// you need some kind of delegate in a subclass. -- (void) setDelegate:(id)delegate; -- (id) delegate; - -// Override this in subclasses if you manage the "has seen first load" state yourself. -- (BOOL) hasLoaded; - -// This is called when the view managed by the view controller is released. -// That is not always when the controller itself is released: it also can -// happen when more memory is needed by the system or whenever the controller -// just happens not to be visible. -- (void) releaseSubviews; - -@end diff --git a/UICaboodle/RVPage.mm b/UICaboodle/RVPage.mm deleted file mode 100644 index 28123ee..0000000 --- a/UICaboodle/RVPage.mm +++ /dev/null @@ -1,83 +0,0 @@ -#import "RVPage.h" - -#import <Foundation/Foundation.h> -#import <UIKit/UIKit.h> - -extern bool IsWildcat_; - -@implementation UIViewController (Cydia) - -- (BOOL) hasLoaded { - return YES; -} - -- (void) reloadData { -} - -- (void) unloadData { - if (UIViewController *modal = [self modalViewController]) - [modal unloadData]; -} - -@end - -@implementation CYViewController - -- (void) setDelegate:(id)delegate { - delegate_ = delegate; -} - -- (id) delegate { - return delegate_; -} - -- (void) viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - // Load on first appearance. We don't need to set the loaded flag here - // because it is set for us the first time -reloadData is called. - if (![self hasLoaded]) - [self reloadData]; -} - -- (BOOL) hasLoaded { - return loaded_; -} - -- (void) releaseSubviews { - // Do nothing. -} - -- (void) setView:(UIView *)view { - // Nasty hack for 2.x-compatibility. In 3.0+, we can and - // should just override -viewDidUnload instead. - if (view == nil) - [self releaseSubviews]; - - [super setView:view]; -} - -- (void) reloadData { - [super reloadData]; - - // This is called automatically on the first appearance of a controller, - // or any other time it needs to reload the information shown. However (!), - // this is not called by any tab bar or navigation controller's -reloadData - // method unless this controller returns YES from -hadLoaded. - loaded_ = YES; -} - -- (void) unloadData { - loaded_ = NO; - [super unloadData]; -} - -- (NSURL *) navigationURL { - return nil; -} - -- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { - return IsWildcat_ || orientation == UIInterfaceOrientationPortrait; -} - -@end diff --git a/UICaboodle/UCLocalize.h b/UICaboodle/UCLocalize.h deleted file mode 100644 index ba66655..0000000 --- a/UICaboodle/UCLocalize.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef UICABOODLE_UCLOCALIZE_H -#define UICABOODLE_UCLOCALIZE_H - -#import <Foundation/Foundation.h> - -static inline NSString *UCLocalizeEx(NSString *key, NSString *value = nil) { - return [[NSBundle mainBundle] localizedStringForKey:key value:value table:nil]; -} - -#define UCLocalize(key) UCLocalizeEx(@ key) - -#endif/*UICABOODLE_UCLOCALIZE_H*/ diff --git a/UICaboodle/UCPlatform.h b/UICaboodle/UCPlatform.h deleted file mode 100644 index c241232..0000000 --- a/UICaboodle/UCPlatform.h +++ /dev/null @@ -1,62 +0,0 @@ -#define __STDC_LIMIT_MACROS -#include <stdint.h> - -#include <objc/objc.h> - -#include <sys/time.h> -#include <time.h> - -#define _forever \ - for (;;) - -extern struct timeval _ltv; -extern bool _itv; - -#define _trace() do { \ - struct timeval _ctv; \ - gettimeofday(&_ctv, NULL); \ - if (!_itv) { \ - _itv = true; \ - _ltv = _ctv; \ - } \ - fprintf(stderr, "%lu.%.6u[%f]:_trace()@%s:%u[%s]\n", \ - _ctv.tv_sec, _ctv.tv_usec, \ - (_ctv.tv_sec - _ltv.tv_sec) + (_ctv.tv_usec - _ltv.tv_usec) / 1000000.0, \ - __FILE__, __LINE__, __FUNCTION__\ - ); \ - _ltv = _ctv; \ -} while (false) - -#define _assert(test) do \ - if (!(test)) { \ - fprintf(stderr, "_assert(%d:%s)@%s:%u[%s]\n", errno, #test, __FILE__, __LINE__, __FUNCTION__); \ - exit(-1); \ - } \ -while (false) - -#define _not(type) ((type) ~ (type) 0) - -#define _transient - -#define _label__(x) _label ## x -#define _label_(y) _label__(y) -#define _label _label_(__LINE__) - -#define _packed \ - __attribute__((__packed__)) -#define _finline \ - inline __attribute__((__always_inline__)) - -#define _assume(e) \ - _assert(e) - -#define _nodefault \ - default: \ - _assume(false); \ - throw; - -#define _likely(expr) \ - __builtin_expect(expr, 1) - -#define _unlikely(expr) \ - __builtin_expect(expr, 0) diff --git a/UICaboodle/UCString.h b/UICaboodle/UCString.h deleted file mode 100644 index 13bb51f..0000000 --- a/UICaboodle/UCString.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef UICABOODLE_UCSTRING_H -#define UICABOODLE_UCSTRING_H - -#import <Foundation/NSString.h> - -@interface NSString (UIKit) -- (NSString *) stringByAddingPercentEscapes; -- (NSString *) stringByReplacingCharacter:(unsigned short)arg0 withCharacter:(unsigned short)arg1; -@end - -@interface NSString (UICaboodle) -+ (NSString *) stringWithDataSize:(double)size; -- (NSString *) stringByAddingPercentEscapesIncludingReserved; -@end - -@implementation NSString (UICaboodle) - -+ (NSString *) stringWithDataSize:(double)size { - unsigned power = 0; - while (size > 1024) { - size /= 1024; - ++power; - } - - static const char *powers_[] = {"B", "KiB", "MiB", "GiB"}; - - return [NSString stringWithFormat:@"%.1f%s", size, powers_[power]]; -} - -- (NSString *) stringByAddingPercentEscapesIncludingReserved { - return [(id)CFURLCreateStringByAddingPercentEscapes( - kCFAllocatorDefault, - (CFStringRef) self, - NULL, - CFSTR(";/?:@&=+$,"), - kCFStringEncodingUTF8 - ) autorelease]; -} - -@end - -#endif/*UICABOODLE_UCSTRING_H*/ @@ -70,7 +70,7 @@ sysroot: @echo 1>&2 @exit 1 -MobileCydia: sysroot MobileCydia.mm UICaboodle/*.h UICaboodle/*.mm SDURLCache/SDURLCache.h SDURLCache/SDURLCache.m iPhonePrivate.h lookup3.o Cytore.hpp +MobileCydia: sysroot MobileCydia.mm CyteKit/*.h CyteKit/*.mm SDURLCache/SDURLCache.h SDURLCache/SDURLCache.m iPhonePrivate.h lookup3.o Cytore.hpp $(cycc) $(filter %.mm,$^) $(filter %.o,$^) $(foreach m,$(filter %.m,$^),-x objective-c++ $(m)) $(flags) $(link) $(uikit) -DCYDIA_VERSION='"$(version)"' ldid -Slaunch.xml $@ || { rm -f $@ && false; } |