2001-12-17 14:31:42 +00:00
|
|
|
/** Implementation of NSPortMessage for GNUstep
|
2000-02-27 09:35:24 +00:00
|
|
|
Copyright (C) 1998,2000 Free Software Foundation, Inc.
|
1998-10-21 13:56:18 +00:00
|
|
|
|
|
|
|
Written by: Richard frith-Macdonald <richard@brainstorm.co.Ik>
|
|
|
|
Created: October 1998
|
|
|
|
|
|
|
|
This file is part of the GNUstep Base Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
1999-09-09 02:56:20 +00:00
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
2001-12-18 16:54:15 +00:00
|
|
|
|
|
|
|
<title>NSPortMessage class reference</title>
|
|
|
|
$Date$ $Revision$
|
1998-10-21 13:56:18 +00:00
|
|
|
*/
|
|
|
|
|
2003-06-07 01:24:41 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "Foundation/NSAutoreleasePool.h"
|
|
|
|
#include "Foundation/NSData.h"
|
|
|
|
#include "Foundation/NSException.h"
|
|
|
|
#include "Foundation/NSPortMessage.h"
|
|
|
|
#include "Foundation/NSObjCRuntime.h"
|
1998-10-21 13:56:18 +00:00
|
|
|
|
|
|
|
@implementation NSPortMessage
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
2000-02-27 09:35:24 +00:00
|
|
|
RELEASE(_recv);
|
|
|
|
RELEASE(_send);
|
1999-09-16 07:21:34 +00:00
|
|
|
RELEASE(_components);
|
1999-03-02 08:58:30 +00:00
|
|
|
[super dealloc];
|
1998-10-21 13:56:18 +00:00
|
|
|
}
|
|
|
|
|
2000-02-27 09:35:24 +00:00
|
|
|
- (NSString*) description
|
|
|
|
{
|
|
|
|
return [NSString stringWithFormat:
|
2000-07-04 14:37:18 +00:00
|
|
|
@"NSPortMessage 0x%x (Id %u)\n Send: %@\n Recv: %@\n Components -\n%@",
|
|
|
|
self, _msgid, _send, _recv, _components];
|
2000-02-27 09:35:24 +00:00
|
|
|
}
|
|
|
|
|
1998-10-21 13:56:18 +00:00
|
|
|
/* PortMessages MUST be initialised with ports and data. */
|
|
|
|
- (id) init
|
|
|
|
{
|
1999-03-02 08:58:30 +00:00
|
|
|
[self shouldNotImplement: _cmd];
|
|
|
|
return nil;
|
1998-10-21 13:56:18 +00:00
|
|
|
}
|
|
|
|
|
2000-02-27 09:35:24 +00:00
|
|
|
/* PortMessages MUST be initialised with ports and data. */
|
1998-10-21 13:56:18 +00:00
|
|
|
- (id) initWithMachMessage: (void*)buffer
|
|
|
|
{
|
1999-03-02 08:58:30 +00:00
|
|
|
[self shouldNotImplement: _cmd];
|
|
|
|
return nil;
|
1998-10-21 13:56:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This is the designated initialiser. */
|
|
|
|
- (id) initWithSendPort: (NSPort*)aPort
|
|
|
|
receivePort: (NSPort*)anotherPort
|
|
|
|
components: (NSArray*)items
|
|
|
|
{
|
1999-03-02 08:58:30 +00:00
|
|
|
self = [super init];
|
2000-02-27 09:35:24 +00:00
|
|
|
if (self != nil)
|
1999-03-02 08:58:30 +00:00
|
|
|
{
|
2000-02-27 09:35:24 +00:00
|
|
|
_send = RETAIN(aPort);
|
|
|
|
_recv = RETAIN(anotherPort);
|
1999-09-16 07:21:34 +00:00
|
|
|
_components = [[NSMutableArray allocWithZone: [self zone]]
|
2000-02-27 09:35:24 +00:00
|
|
|
initWithArray: items];
|
1998-10-21 13:56:18 +00:00
|
|
|
}
|
1999-03-02 08:58:30 +00:00
|
|
|
return self;
|
1998-10-21 13:56:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray*) components
|
|
|
|
{
|
2000-02-27 09:35:24 +00:00
|
|
|
return AUTORELEASE([_components copy]);
|
1998-10-21 13:56:18 +00:00
|
|
|
}
|
|
|
|
|
1999-03-02 08:58:30 +00:00
|
|
|
- (unsigned) msgid
|
1998-10-21 13:56:18 +00:00
|
|
|
{
|
1999-09-16 07:21:34 +00:00
|
|
|
return _msgid;
|
1998-10-21 13:56:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSPort*) receivePort
|
|
|
|
{
|
2000-02-27 09:35:24 +00:00
|
|
|
return _recv;
|
1998-10-21 13:56:18 +00:00
|
|
|
}
|
|
|
|
|
1999-09-09 02:56:20 +00:00
|
|
|
- (BOOL) sendBeforeDate: (NSDate*)when
|
1999-03-02 08:58:30 +00:00
|
|
|
{
|
2000-02-27 09:35:24 +00:00
|
|
|
return [_send sendBeforeDate: when
|
|
|
|
components: _components
|
|
|
|
from: _recv
|
|
|
|
reserved: 0];
|
1999-03-02 08:58:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSPort*) sendPort
|
1998-10-21 13:56:18 +00:00
|
|
|
{
|
2000-02-27 09:35:24 +00:00
|
|
|
return _send;
|
1998-10-21 13:56:18 +00:00
|
|
|
}
|
|
|
|
|
1999-03-02 08:58:30 +00:00
|
|
|
- (void) setMsgid: (unsigned)anId
|
1998-10-21 13:56:18 +00:00
|
|
|
{
|
1999-09-16 07:21:34 +00:00
|
|
|
_msgid = anId;
|
1998-10-21 13:56:18 +00:00
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
2000-06-30 11:59:59 +00:00
|
|
|
@implementation NSPortMessage (Private)
|
|
|
|
- (NSMutableArray*) _components
|
|
|
|
{
|
|
|
|
return _components;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|