mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Port baseadd to MacOSX
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@15199 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
74a7312255
commit
4667c84855
18 changed files with 808 additions and 580 deletions
68
Source/Additions/GSCompatibility.m
Normal file
68
Source/Additions/GSCompatibility.m
Normal file
|
@ -0,0 +1,68 @@
|
|||
/* GSCompatibility - Extra definitions for compiling on MacOSX
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Adam Fedor <fedor@gnu.org>
|
||||
|
||||
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
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "GSCompatibility.h"
|
||||
|
||||
/* FIXME: Need to initialize this */
|
||||
NSRecursiveLock *gnustep_global_lock = NULL;
|
||||
|
||||
@implementation NSArray (GSCompatibility)
|
||||
|
||||
/**
|
||||
* Initialize the receiver with the contents of array.
|
||||
* The order of array is preserved.<br />
|
||||
* If shouldCopy is YES then the objects are copied
|
||||
* rather than simply retained.<br />
|
||||
* Invokes -initWithObjects:count:
|
||||
*/
|
||||
- (id) initWithArray: (NSArray*)array copyItems: (BOOL)shouldCopy
|
||||
{
|
||||
unsigned c = [array count];
|
||||
id objects[c];
|
||||
|
||||
[array getObjects: objects];
|
||||
if (shouldCopy == YES)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < c; i++)
|
||||
{
|
||||
objects[i] = [objects[i] copy];
|
||||
}
|
||||
self = [self initWithObjects: objects count: c];
|
||||
#if GS_WITH_GC == 0
|
||||
while (i > 0)
|
||||
{
|
||||
[objects[--i] release];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
self = [self initWithObjects: objects count: c];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue