mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-03 13:21:00 +00:00
Protocol fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17105 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
383e71072f
commit
fae9c67382
3 changed files with 98 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2003-07-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSDistributedNotificationCenter.m: Use -setProtocolForProxy:
|
||||||
|
and implement dummy class to work around bug in old compilers.
|
||||||
|
* Tools/gdnc.m: ditto
|
||||||
|
|
||||||
2003-07-04 Richard Frith-Macdonald <rfm@gnu.org>
|
2003-07-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/Source/GSFFCallInvocation.m: Modify to use local type
|
* Source/Source/GSFFCallInvocation.m: Modify to use local type
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/** Implementation of NSDistributedNotificationCenter class
|
/**
|
||||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
Copyright (C) 1998-2003 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
Created: October 1998
|
Created: October 1998
|
||||||
|
@ -482,6 +482,67 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following dummy class is here solely as a workaround for pre 3.3
|
||||||
|
* versions of gcc where protocols didn't work properly unless implemented
|
||||||
|
* in the source where the '@protocol()' directiver is used.
|
||||||
|
*/
|
||||||
|
@interface NSDistributedNotificationCenterDummy : NSObject <GDNCProtocol>
|
||||||
|
- (void) addObserver: (unsigned long)anObserver
|
||||||
|
selector: (NSString*)aSelector
|
||||||
|
name: (NSString*)notificationname
|
||||||
|
object: (NSString*)anObject
|
||||||
|
suspensionBehavior: (NSNotificationSuspensionBehavior)suspensionBehavior
|
||||||
|
for: (id<GDNCClient>)client;
|
||||||
|
- (oneway void) postNotificationName: (NSString*)notificationName
|
||||||
|
object: (NSString*)anObject
|
||||||
|
userInfo: (NSData*)d
|
||||||
|
deliverImmediately: (BOOL)deliverImmediately
|
||||||
|
for: (id<GDNCClient>)client;
|
||||||
|
- (void) registerClient: (id<GDNCClient>)client;
|
||||||
|
- (void) removeObserver: (unsigned long)anObserver
|
||||||
|
name: (NSString*)notificationname
|
||||||
|
object: (NSString*)anObject
|
||||||
|
for: (id<GDNCClient>)client;
|
||||||
|
- (void) setSuspended: (BOOL)flag
|
||||||
|
for: (id<GDNCClient>)client;
|
||||||
|
- (void) unregisterClient: (id<GDNCClient>)client;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation NSDistributedNotificationCenterDummy
|
||||||
|
- (void) addObserver: (unsigned long)anObserver
|
||||||
|
selector: (NSString*)aSelector
|
||||||
|
name: (NSString*)notificationname
|
||||||
|
object: (NSString*)anObject
|
||||||
|
suspensionBehavior: (NSNotificationSuspensionBehavior)suspensionBehavior
|
||||||
|
for: (id<GDNCClient>)client
|
||||||
|
{
|
||||||
|
}
|
||||||
|
- (oneway void) postNotificationName: (NSString*)notificationName
|
||||||
|
object: (NSString*)anObject
|
||||||
|
userInfo: (NSData*)d
|
||||||
|
deliverImmediately: (BOOL)deliverImmediately
|
||||||
|
for: (id<GDNCClient>)client
|
||||||
|
{
|
||||||
|
}
|
||||||
|
- (void) registerClient: (id<GDNCClient>)client
|
||||||
|
{
|
||||||
|
}
|
||||||
|
- (void) removeObserver: (unsigned long)anObserver
|
||||||
|
name: (NSString*)notificationname
|
||||||
|
object: (NSString*)anObject
|
||||||
|
for: (id<GDNCClient>)client
|
||||||
|
{
|
||||||
|
}
|
||||||
|
- (void) setSuspended: (BOOL)flag
|
||||||
|
for: (id<GDNCClient>)client
|
||||||
|
{
|
||||||
|
}
|
||||||
|
- (void) unregisterClient: (id<GDNCClient>)client
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation NSDistributedNotificationCenter (Private)
|
@implementation NSDistributedNotificationCenter (Private)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -575,11 +636,9 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
||||||
if (_remote != nil)
|
if (_remote != nil)
|
||||||
{
|
{
|
||||||
NSConnection *c = [_remote connectionForProxy];
|
NSConnection *c = [_remote connectionForProxy];
|
||||||
#if 0 // When all compilers support this
|
|
||||||
Protocol *p = @protocol(GDNCProtocol);
|
Protocol *p = @protocol(GDNCProtocol);
|
||||||
|
|
||||||
[_remote setProtocolForProxy: p];
|
[_remote setProtocolForProxy: p];
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensure that this center can be used safely from different
|
* Ensure that this center can be used safely from different
|
||||||
|
|
29
Tools/gdnc.m
29
Tools/gdnc.m
|
@ -90,6 +90,29 @@ ihandler(int sig)
|
||||||
|
|
||||||
#include "gdnc.h"
|
#include "gdnc.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following dummy class is here solely as a workaround for pre 3.3
|
||||||
|
* versions of gcc where protocols didn't work properly unless implemented
|
||||||
|
* in the source where the '@protocol()' directiver is used.
|
||||||
|
*/
|
||||||
|
@interface NSDistributedNotificationCenterDummy : NSObject <GDNCClient>
|
||||||
|
- (oneway void) postNotificationName: (NSString*)name
|
||||||
|
object: (NSString*)object
|
||||||
|
userInfo: (NSData*)info
|
||||||
|
selector: (NSString*)aSelector
|
||||||
|
to: (unsigned long)observer;
|
||||||
|
@end
|
||||||
|
@implementation NSDistributedNotificationCenterDummy
|
||||||
|
- (oneway void) postNotificationName: (NSString*)name
|
||||||
|
object: (NSString*)object
|
||||||
|
userInfo: (NSData*)info
|
||||||
|
selector: (NSString*)aSelector
|
||||||
|
to: (unsigned long)observer
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
@interface GDNCNotification : NSObject
|
@interface GDNCNotification : NSObject
|
||||||
{
|
{
|
||||||
@public
|
@public
|
||||||
|
@ -517,6 +540,12 @@ ihandler(int sig)
|
||||||
format: @"registration with registered client"];
|
format: @"registration with registered client"];
|
||||||
}
|
}
|
||||||
info = [GDNCClient new];
|
info = [GDNCClient new];
|
||||||
|
if ([(id)client isProxy] == YES)
|
||||||
|
{
|
||||||
|
Protocol *p = @protocol(GDNCClient);
|
||||||
|
|
||||||
|
[(id)client setProtocolForProxy: p];
|
||||||
|
}
|
||||||
info->client = client;
|
info->client = client;
|
||||||
NSMapInsert(table, client, info);
|
NSMapInsert(table, client, info);
|
||||||
RELEASE(info);
|
RELEASE(info);
|
||||||
|
|
Loading…
Reference in a new issue