From 819a0ab15627e670431ba80fffab8b745dab89da Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 28 Feb 2011 19:42:16 -0800 Subject: [PATCH] Rename UICaboodle to CyteKit. --- CyteKit/CyteLocalize.h | 51 ++++++++ CyteKit/CyteViewController.h | 84 ++++++++++++ CyteKit/CyteViewController.mm | 122 ++++++++++++++++++ .../CyteWebViewController.h | 52 +++++++- .../CyteWebViewController.mm | 14 +- .../NSString-Cyte.h | 8 +- .../PerlCompatibleRegEx.hpp | 2 +- {UICaboodle => CyteKit}/UCInternal.h | 0 CyteKit/UCPlatform.h | 106 +++++++++++++++ MobileCydia.mm | 10 +- UICaboodle/RVPage.h | 40 ------ UICaboodle/RVPage.mm | 83 ------------ UICaboodle/UCLocalize.h | 12 -- UICaboodle/UCPlatform.h | 62 --------- UICaboodle/UCString.h | 42 ------ makefile | 2 +- 16 files changed, 429 insertions(+), 261 deletions(-) create mode 100644 CyteKit/CyteLocalize.h create mode 100644 CyteKit/CyteViewController.h create mode 100644 CyteKit/CyteViewController.mm rename UICaboodle/BrowserView.h => CyteKit/CyteWebViewController.h (71%) rename UICaboodle/BrowserView.mm => CyteKit/CyteWebViewController.mm (99%) rename UICaboodle/NSString-UICaboodle.h => CyteKit/NSString-Cyte.h (92%) rename {UICaboodle => CyteKit}/PerlCompatibleRegEx.hpp (98%) rename {UICaboodle => CyteKit}/UCInternal.h (100%) create mode 100644 CyteKit/UCPlatform.h delete mode 100644 UICaboodle/RVPage.h delete mode 100644 UICaboodle/RVPage.mm delete mode 100644 UICaboodle/UCLocalize.h delete mode 100644 UICaboodle/UCPlatform.h delete mode 100644 UICaboodle/UCString.h diff --git a/CyteKit/CyteLocalize.h b/CyteKit/CyteLocalize.h new file mode 100644 index 00000000..a06bb0a9 --- /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 + +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 00000000..fb5d202c --- /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 + +#include + +@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 00000000..73e1630b --- /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 +#include + +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 similarity index 71% rename from UICaboodle/BrowserView.h rename to CyteKit/CyteWebViewController.h index 1d87d614..f4ba3e3f 100644 --- a/UICaboodle/BrowserView.h +++ b/CyteKit/CyteWebViewController.h @@ -1,13 +1,55 @@ -#import - -#import +/* 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 #include #include #include #include -#import +#include #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 similarity index 99% rename from UICaboodle/BrowserView.mm rename to CyteKit/CyteWebViewController.mm index 4168de91..4cbdfd25 100644 --- a/UICaboodle/BrowserView.mm +++ b/CyteKit/CyteWebViewController.mm @@ -1,11 +1,11 @@ +#include "CyteKit/UCPlatform.h" + #include #include "iPhonePrivate.h" -#include "UCPlatform.h" - -#include -#include "UICaboodle/PerlCompatibleRegEx.hpp" -#include +#include "CyteKit/CyteLocalize.h" +#include "CyteKit/CyteWebViewController.h" +#include "CyteKit/PerlCompatibleRegEx.hpp" //#include // 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 similarity index 92% rename from UICaboodle/NSString-UICaboodle.h rename to CyteKit/NSString-Cyte.h index f09f1c30..ae370c03 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 similarity index 98% rename from UICaboodle/PerlCompatibleRegEx.hpp rename to CyteKit/PerlCompatibleRegEx.hpp index f91c3382..3bd5e765 100644 --- a/UICaboodle/PerlCompatibleRegEx.hpp +++ b/CyteKit/PerlCompatibleRegEx.hpp @@ -42,7 +42,7 @@ #include -#include "UICaboodle/NSString-UICaboodle.h" +#include "CyteKit/NSString-Cyte.h" class Pcre { private: diff --git a/UICaboodle/UCInternal.h b/CyteKit/UCInternal.h similarity index 100% rename from UICaboodle/UCInternal.h rename to CyteKit/UCInternal.h diff --git a/CyteKit/UCPlatform.h b/CyteKit/UCPlatform.h new file mode 100644 index 00000000..963fb1d5 --- /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 + +#include + +#include +#include + +#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 1e5e0f69..26c7920f 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 #include @@ -120,9 +120,9 @@ extern "C" { #include -#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 be2331de..00000000 --- a/UICaboodle/RVPage.h +++ /dev/null @@ -1,40 +0,0 @@ -#import - -#import - -@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 28123ee3..00000000 --- a/UICaboodle/RVPage.mm +++ /dev/null @@ -1,83 +0,0 @@ -#import "RVPage.h" - -#import -#import - -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 ba66655a..00000000 --- a/UICaboodle/UCLocalize.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef UICABOODLE_UCLOCALIZE_H -#define UICABOODLE_UCLOCALIZE_H - -#import - -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 c2412329..00000000 --- a/UICaboodle/UCPlatform.h +++ /dev/null @@ -1,62 +0,0 @@ -#define __STDC_LIMIT_MACROS -#include - -#include - -#include -#include - -#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 13bb51f3..00000000 --- a/UICaboodle/UCString.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef UICABOODLE_UCSTRING_H -#define UICABOODLE_UCSTRING_H - -#import - -@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*/ diff --git a/makefile b/makefile index eae4fd3a..ee64dc90 100644 --- a/makefile +++ b/makefile @@ -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; } -- 2.47.2