C NO false
C NULL null
-: applicationDidFinishLaunching: v12@0:4@8
-
T id @
T Class #
T SEL :
# UINavigationControllerDelegate
-: navigationController:willShowViewController:animated: v20@0:4@8@12B16
-: navigationController:didShowViewController:animated: v20@0:4@8@12B16
-
# UIScrollView
C UIScrollViewIndicatorStyleDefault 0
# UIScrollViewDelegate
-: scrollViewDidScroll: v12@0:4@8
-: scrollViewWillBeginDragging: v12@0:4@8
-: scrollViewDidEndDragging:willDecelerate: v16@0:4@8B12
-: scrollViewShouldScrollToTop: B12@0:4@8
-: scrollViewDidScrollToTop: v12@0:4@8
-: scrollViewWillBeginDecelerating: v12@0:4@8
-: scrollViewDidEndDecelerating: v12@0:4@8
-
-: viewForZoomingInScrollView: @12@0:4@8
-: scrollViewDidEndZooming:withView:atScale: v20@0:4@8@12f16
-
-: scrollViewDidEndScrollingAnimation: v12@0:4@8
-
# UITabBar
# UITabBarDelegate
-: tabBar:willBeginCustomizingItems: v16@0:4@8@12
-: tabBar:didBeginCustomizingItems: v16@0:4@8@12
-: tabBar:willBeginCustomizingItems:changed: v20@0:4@8@12B16
-: tabBar:didBeginCustomizingItems:changed: v20@0:4@8@12B16
-: tabBar:didSelectItem: v16@0:4@8@12
-
# UITableView
C UITableViewStylePlain 0
# UITableViewDataSource
-: tableView:numberOfRowsInSection: i16@0:4@8i12
-: numberOfSectionsInTableView: i12@0:4@8
-: tableView:cellForRowAtIndexPath: @16@0:4@8@12
-: sectionIndexTitlesForTableView: @12@0:4@8
-: tableView:sectionForSectionIndexTitle:atIndex: i20@0:4@8@12i16
-: tableView:titleForHeaderInSection: @16@0:4@8i12
-: tableView:titleForFooterInSection: @16@0:4@8i12
-
-: tableView:commitEditingStyle:forRowAtIndexPath: v20@0:4@8i12@16
-: tableView:canEditRowAtIndexPath: B16@0:4@8@12
-
-: tableView:canMoveRowAtIndexPath: B16@0:4@8@12
-: tableView:moveRowAtIndexPath:toIndexPath: v20@0:4@8@12@16
-
# UIToolbar
# UIView
# UIWebViewDelegate
-: webView:shouldStartLoadWithRequest:navigationType: B20@0:4@8@12I16
-: webViewDidStartLoad: v12@0:4@8
-: webViewDidFinishLoad: v12@0:4@8
-: webView:didFailLoadWithError: v16@0:4@8@12
-
# UIWindow
V UIWindowLevelNormal f
grep '^[CFV]' "$1" | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$/\1\2, "\3", NULL/';
grep '^[EST]' "$1" | sed -e 's/^S/3/;s/^T/4/;s/^E/5/' | sed -e 's/^5\(.*\)$/4\1 i/;s/"/\\"/g' | sed -e 's/^\([^ ]*\) \([^ ]*\) \(.*\)$/\1\2, "\3", NULL/';
-grep '^:' "$1" | sed -e 's/^: \([^ ]*\) \(.*\)/6\1, "\2", NULL/';
#define _assert(test) \
_assert_("assert", (test), #test, "")
+#define _require(expr) ({ \
+ __typeof__(expr) _value = (expr); \
+ _assert_("require", _value != NULL, #expr, ""); \
+_value; })
+
#define _trace() do { \
fprintf(stderr, "_trace():%u\n", __LINE__); \
} while (false)
return false;
}
-static const char *CYPoolTypeEncoding(CYPool &pool, JSContextRef context, SEL sel, objc_method *method) {
- if (method != NULL)
- return method_getTypeEncoding(method);
-
- const char *name(sel_getName(sel));
- size_t length(strlen(name));
-
- char keyed[length + 2];
- keyed[0] = '6';
- keyed[length + 1] = '\0';
- memcpy(keyed + 1, name, length);
-
- if (CYBridgeEntry *entry = CYBridgeHash(keyed, length + 1))
- return entry->value_;
-
- return NULL;
-}
-
static JSValueRef MessageAdapter_(JSContextRef context, size_t count, JSValueRef values[], JSObjectRef function) {
JSObjectRef _this(CYCastJSObject(context, values[0]));
return CYCallAsFunction(context, function, _this, count - 2, values + 2);
Message_privateData *message(reinterpret_cast<Message_privateData *>(JSObjectGetPrivate((JSObjectRef) value)));
type = sig::Unparse(pool, &message->signature_);
imp = reinterpret_cast<IMP>(message->GetValue());
- } else {
- objc_method *method(class_getInstanceMethod(_class, sel));
- type = CYPoolTypeEncoding(pool, context, sel, method);
+ } else if (objc_method *method = class_getInstanceMethod(_class, sel)) {
+ type = method_getTypeEncoding(method);
imp = CYMakeMessage(context, value, type);
- }
+ } else _assert(false);
objc_method *method(NULL);
#if OBJC_API_VERSION >= 2
Selector_privateData *internal(reinterpret_cast<Selector_privateData *>(JSObjectGetPrivate(_this)));
SEL sel(internal->GetValue());
- objc_method *method;
- if (Class _class = CYCastClass(pool, context, arguments[0]))
- method = class_getInstanceMethod(_class, sel);
- else
- method = NULL;
-
- const char *encoding(CYPoolTypeEncoding(pool, context, sel, method));
- if (encoding == NULL)
- return CYJSNull(context);
+ Class _class(_require(CYCastClass(pool, context, arguments[0])));
+ objc_method *method(_require(class_getInstanceMethod(_class, sel)));
+ const char *encoding(method_getTypeEncoding(method));
sig::Signature signature;
sig::Parse(pool, &signature, encoding, &Structor_);