Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -100,42 +100,10 @@ * * \return The implementation for the specified selector */ - (IMP)methodFor: (SEL)selector; -/** - * This method is called when a method was called which isn't implemented. - * It's possible to override it so the method call cann be forwarded to another - * object. - * - * \param selector The selector which was called - * \param args The arguments with which the selector was called - * \return The return value of the call - */ -#ifdef __objc_INCLUDE_GNU -- (retval_t)forward: (SEL)selector - : (arglist_t)args; -#else -- (id)forward: (SEL)selector - : (marg_list)args; -#endif - -/** - * Perform the given selector with the given arguments. - * - * \param selector The selector to perform - * \param args The arguments with which the selector is performed - * \return The return value of the performed selector - */ -#ifdef __objc_INCLUDE_GNU -- (retval_t)performv: (SEL)selector - : (arglist_t)args; -#else -- performv: (SEL)selector - : (marg_list)args; -#endif - /** * Compare two objects. * Classes containing data (like strings, arrays, lists etc.) should reimplement * this! * Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -7,16 +7,10 @@ * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ -/* - * Get rid of the stupid warnings until we have our own implementation for - * objc_msgSendv. - */ -#define OBJC2_UNAVAILABLE - #import "config.h" #include #include #include @@ -185,85 +179,10 @@ #else return class_getMethodImplementation(isa, selector); #endif } -#ifdef __objc_INCLUDE_GNU -- (retval_t)forward: (SEL)selector - : (arglist_t)args -#else -- (id)forward: (SEL)selector - : (marg_list)args -#endif -{ - @throw [OFNotImplementedException newWithClass: [self class] - andSelector: _cmd]; - return self; -} - -#ifdef __objc_INCLUDE_GNU -- (retval_t)performv: (SEL)selector - : (arglist_t)args -{ - return objc_msg_sendv(self, selector, args); -} -#else -- performv: (SEL)selector - : (marg_list)args -{ - Method m; - char *encoding, rettype; - size_t depth, argsize; - - if ((m = class_getInstanceMethod(isa, selector)) == NULL || - (encoding = (char*)method_getTypeEncoding(m)) == NULL) - @throw [OFInvalidArgumentException newWithClass: [self class] - andSelector: _cmd]; - - rettype = *encoding; - - /* Skip the return type */ - switch (*encoding) { - case '{': - for (depth = 0; *encoding; encoding++) { - if (OF_UNLIKELY(*encoding == '{')) - depth++; - else if (OF_UNLIKELY(*encoding == '}') && - OF_LIKELY(!--depth)) - break; - } - break; - case '(': - for (depth = 0; *encoding; encoding++) { - if (OF_UNLIKELY(*encoding == '(')) - depth++; - else if (OF_UNLIKELY(*encoding == ')') && - OF_LIKELY(!--depth)) - break; - } - break; - } - encoding++; - - for (argsize = 0; *encoding >= '0' && *encoding <= '9'; encoding++) - argsize = argsize * 10 + (*encoding - '0'); - - /* We don't support returning structs or unions yet */ - if (rettype == '{' || rettype == '(') - @throw [OFNotImplementedException newWithClass: [self class] - andSelector: _cmd]; - -#if __OBJC2__ - @throw [OFNotImplementedException newWithClass: [self class] - andSelector: _cmd]; - return self; -#else - return objc_msgSendv(self, selector, argsize, args); -#endif -} -#endif - - (BOOL)isEqual: (id)obj { /* Classes containing data should reimplement this! */ return (self == obj ? YES : NO); }