mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Minor modification for Apple runtime
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7933 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c6ae88eece
commit
7310a9148b
23 changed files with 294 additions and 111 deletions
|
@ -50,31 +50,46 @@
|
|||
@interface NSMutableArrayNonCore : NSMutableArray
|
||||
@end
|
||||
|
||||
@class NSGInlineArray;
|
||||
|
||||
static Class NSArray_abstract_class;
|
||||
static Class NSArray_concrete_class;
|
||||
static Class NSMutableArray_abstract_class;
|
||||
static Class NSMutableArray_concrete_class;
|
||||
|
||||
static SEL addSel = @selector(addObject:);
|
||||
static SEL appSel = @selector(appendString:);
|
||||
static SEL countSel = @selector(count);
|
||||
static SEL eqSel = @selector(isEqual:);
|
||||
static SEL oaiSel = @selector(objectAtIndex:);
|
||||
static SEL remSel = @selector(removeObjectAtIndex:);
|
||||
static SEL rlSel = @selector(removeLastObject);
|
||||
static Class NSGInlineArrayClass;
|
||||
|
||||
|
||||
@implementation NSArray
|
||||
|
||||
static SEL addSel;
|
||||
static SEL appSel;
|
||||
static SEL countSel;
|
||||
static SEL eqSel;
|
||||
static SEL oaiSel;
|
||||
static SEL remSel;
|
||||
static SEL rlSel;
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSArray class])
|
||||
{
|
||||
[self setVersion: 1];
|
||||
|
||||
addSel = @selector(addObject:);
|
||||
appSel = @selector(appendString:);
|
||||
countSel = @selector(count);
|
||||
eqSel = @selector(isEqual:);
|
||||
oaiSel = @selector(objectAtIndex:);
|
||||
remSel = @selector(removeObjectAtIndex:);
|
||||
rlSel = @selector(removeLastObject);
|
||||
|
||||
NSArray_abstract_class = [NSArray class];
|
||||
behavior_class_add_class (self, [NSArrayNonCore class]);
|
||||
NSMutableArray_abstract_class = [NSMutableArray class];
|
||||
NSArray_concrete_class = [NSGArray class];
|
||||
NSMutableArray_concrete_class = [NSGMutableArray class];
|
||||
behavior_class_add_class (self, [NSArrayNonCore class]);
|
||||
NSMutableArray_concrete_class = [NSGMutableArray class];
|
||||
NSGInlineArrayClass = [NSGInlineArray class];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,13 +122,16 @@ static SEL rlSel = @selector(removeLastObject);
|
|||
initWithContentsOfFile: file]);
|
||||
}
|
||||
|
||||
+ (id) arrayWithObject: anObject
|
||||
+ (id) arrayWithObject: (id)anObject
|
||||
{
|
||||
id o;
|
||||
|
||||
if (anObject == nil)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to add nil"];
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: &anObject count: 1]);
|
||||
o = NSAllocateObject(NSGInlineArrayClass, sizeof(id), NSDefaultMallocZone());
|
||||
o = [o initWithObjects: &anObject count: 1];
|
||||
return AUTORELEASE(o);
|
||||
}
|
||||
|
||||
/* This is the designated initializer for NSArray. */
|
||||
|
@ -807,6 +825,14 @@ static NSString *indentStrings[] = {
|
|||
}
|
||||
}
|
||||
|
||||
+ (id) arrayWithObject: (id)anObject
|
||||
{
|
||||
NSMutableArray *obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||
|
||||
obj = [obj initWithObjects: &anObject count: 1];
|
||||
return AUTORELEASE(self);
|
||||
}
|
||||
|
||||
- (Class) classForCoder
|
||||
{
|
||||
return NSMutableArray_abstract_class;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue