Darwin ifdef. Use designated init on Invocation methods

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/freeze-1_4_0@14181 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-07-21 03:08:29 +00:00
parent c59d7ae9c4
commit 522763277f
3 changed files with 39 additions and 19 deletions

View file

@ -1,3 +1,11 @@
2002-07-20 Adam Fedor <fedor@gnu.org>
* Source/NSDecimal.m: ifdef for compiling on Darwin (report
from Carl Eugen).
* Source/NSInvocation.m ([-initWithSelector:): Rewrite to use
designated initializer.
(-initWithTarget:selector:): Idem.
2002-07-18 Adam Fedor <fedor@gnu.org>
* Tools/gdomap.c (main): Write the pidfile before switching away

View file

@ -26,7 +26,9 @@
*/
#include <math.h>
#if !defined(__APPLE__) || !defined(GNU_RUNTIME)
#include <ctype.h>
#endif
#include <Foundation/NSDecimal.h>
#include <Foundation/NSString.h>
#include <Foundation/NSDictionary.h>

View file

@ -631,19 +631,44 @@ _arg_addr(NSInvocation *inv, int index)
- (id) initWithSelector: (SEL)aSelector
{
return [self initWithArgframe: 0 selector: aSelector];
const char *types;
NSMethodSignature *newSig;
types = sel_get_type(aSelector);
if (types == 0)
{
types = sel_get_type(sel_get_any_typed_uid(sel_get_name(aSelector)));
}
if (types == 0)
{
NSLog(@"Couldn't find encoding type for selector %s.",
sel_get_name(aSelector));
return nil;
}
newSig = [NSMethodSignature signatureWithObjCTypes: types];
return [self initWithMethodSignature: newSig];
}
- (id) initWithTarget: anObject selector: (SEL)aSelector, ...
{
va_list ap;
va_list ap;
NSMethodSignature *newSig;
self = [self initWithArgframe: 0 selector: aSelector];
if (anObject)
{
newSig = [anObject methodSignatureForSelector: aSelector];
self = [self initWithMethodSignature: newSig];
}
else
{
self = [self initWithSelector: aSelector];
}
if (self)
{
int i;
[self setTarget: anObject];
[self setSelector: aSelector];
va_start (ap, aSelector);
for (i = 3; i <= _numArgs; i++)
{
@ -758,22 +783,7 @@ _arg_addr(NSInvocation *inv, int index)
- (id) initWithArgframe: (arglist_t)frame selector: (SEL)aSelector
{
const char *types;
NSMethodSignature *newSig;
types = sel_get_type(aSelector);
if (types == 0)
{
types = sel_get_type(sel_get_any_typed_uid(sel_get_name(aSelector)));
}
if (types == 0)
{
[NSException raise: NSInvalidArgumentException
format: @"Couldn't find encoding type for selector %s.",
sel_get_name(aSelector)];
}
newSig = [NSMethodSignature signatureWithObjCTypes: types];
self = [self initWithMethodSignature: newSig];
self = [self initWithSelector: aSelector];
if (self)
{
[self setSelector: aSelector];