separate out various non-cocoa methods

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/reorg@29524 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-02-09 15:49:33 +00:00
parent 8863b9ddeb
commit 37f2144c1b
55 changed files with 2100 additions and 1219 deletions

View file

@ -38,7 +38,20 @@
#import <GSXML.h>
#import <Unicode.h>
#import <GNUstepBase/NSMutableString+GNUstepBase.h>
#import <GNUstepBase/NSTask+GNUstepBase.h>
#import <NSArray+GNUstepBase.h>
#import <NSAttributedString+GNUstepBase.h>
#import <NSBundle+GNUstepBase.h>
#import <NSCalendarDate+GNUstepBase.h>
#import <NSData+GNUstepBase.h>
#import <NSFileHandle+GNUstepBase.h>
#import <NSInvocation+GNUstepBase.h>
#import <NSLock+GNUstepBase.h>
#import <NSMutableString+GNUstepBase.h>
#import <NSNumber+GNUstepBase.h>
#import <NSObject+GNUstepBase.h>
#import <NSProcessInfo+GNUstepBase.h>
#import <NSString+GNUstepBase.h>
#import <NSTask+GNUstepBase.h>
#import <NSURL+GNUstepBase.h>
#endif /* __Additions_h_GNUSTEP_BASE_INCLUDE */

View file

@ -206,42 +206,6 @@ typedef enum _NSGNUstepStringEncoding
for both gnustep-base and gnustep-baseadd.
*/
@interface NSCalendarDate (GSCategories)
- (NSInteger) weekOfYear;
@end
@interface NSData (GSCategories)
- (NSString*) hexadecimalRepresentation;
- (id) initWithHexadecimalRepresentation: (NSString*)string;
- (NSData*) md5Digest;
- (BOOL) uudecodeInto: (NSMutableData*)decoded
name: (NSString**)namePtr
mode: (NSInteger*)modePtr;
- (BOOL) uuencodeInto: (NSMutableData*)encoded
name: (NSString*)name
mode: (NSInteger)mode;
@end
@interface NSNumber(GSCategories)
+ (NSValue*) valueFromString: (NSString *)string;
@end
@interface NSObject (GSCategories)
- notImplemented:(SEL)aSel;
- (id) subclassResponsibility: (SEL)aSel;
- (id) shouldNotImplement: (SEL)aSel;
/*
WARNING: The -compare: method for NSObject is deprecated
due to subclasses declaring the same selector with
conflicting signatures.
Comparision of arbitrary objects is not just meaningless
but also dangerous as most concrete implementations
expect comparable objects as arguments often accessing
instance variables directly.
This method will be removed in a future release.
*/
- (NSComparisonResult) compare: (id)anObject;
@end
/*
GSCompatibility methods are implemented in
@ -251,67 +215,6 @@ typedef enum _NSGNUstepStringEncoding
corresponding source files of -base.
*/
@interface NSArray (GSCompatibility)
- (id) initWithArray: (NSArray*)array copyItems: (BOOL)shouldCopy;
- (NSUInteger) insertionPosition: (id)item
usingFunction: (NSComparisonResult (*)(id, id, void *))sorter
context: (void *)context;
- (NSUInteger) insertionPosition: (id)item
usingSelector: (SEL)comp;
@end
@interface NSAttributedString (GSCategories)
- (NSAttributedString*) attributedSubstringWithRange: (NSRange)aRange;
@end
@interface NSBundle(GSCompatibility)
+ (NSString *) pathForLibraryResource: (NSString *)name
ofType: (NSString *)ext
inDirectory: (NSString *)bundlePath;
@end
@interface NSDistantObject (GSCompatibility)
+ (void) setDebug: (NSInteger)val;
@end
@interface NSFileHandle(GSCompatibility)
+ (id) fileHandleAsServerAtAddress: (NSString*)address
service: (NSString*)service
protocol: (NSString*)protocol;
- (NSString*) socketAddress;
@end
// Used only in EOFault.m, -[EOFault forward::], for Object compatibility
@interface NSInvocation(GSCompatibility)
- (retval_t) returnFrame:(arglist_t)args;
- (id) initWithArgframe:(arglist_t)args selector:(SEL)selector;
@end
@interface NSObject (GSCompatibility)
+ (id) notImplemented:(SEL)selector;
- (BOOL) isInstance;
@end
@interface NSString (GSCompatibility)
- (BOOL) boolValue;
- (NSString*) substringFromRange:(NSRange)range;
@end
@interface NSProcessInfo(GSCompatibility)
- (NSMutableSet *) debugSet;
@end
@interface NSLock (GSCategories)
+ (id) newLockAt: (id *)location;
@end
@interface NSRecursiveLock (GSCategories)
+ (id)newLockAt:(id *)location;
@end
@interface NSURL (GSCategories)
- (NSString*) fullPath;
@end
/* ------------------------------------------------------------------------
* Functions

View file

@ -0,0 +1,55 @@
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
and: 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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef INCLUDED_NSArray_GNUstepBase_h
#define INCLUDED_NSArray_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSArray (GNUstepBase)
- (id) initWithArray: (NSArray*)array copyItems: (BOOL)shouldCopy;
- (NSUInteger) insertionPosition: (id)item
usingFunction: (NSComparisonResult (*)(id, id, void *))sorter
context: (void *)context;
- (NSUInteger) insertionPosition: (id)item
usingSelector: (SEL)comp;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSArray_GNUstepBase_h */

View file

@ -0,0 +1,50 @@
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
and: 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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef INCLUDED_NSAttributedString_GNUstepBase_h
#define INCLUDED_NSAttributedString_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSAttributedString (GNUstepBase)
- (NSAttributedString*) attributedSubstringWithRange: (NSRange)aRange;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSAttributedString_GNUstepBase_h */

View file

@ -0,0 +1,52 @@
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
and: 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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef INCLUDED_NSBundle_GNUstepBase_h
#define INCLUDED_NSBundle_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSBundle(GNUstepBase)
+ (NSString *) pathForLibraryResource: (NSString *)name
ofType: (NSString *)ext
inDirectory: (NSString *)bundlePath;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSBundle_GNUstepBase_h */

View file

@ -0,0 +1,51 @@
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
and: 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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef INCLUDED_NSCalendarDate_GNUstepBase_h
#define INCLUDED_NSCalendarDate_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSCalendarDate (GNUstepBase)
- (NSInteger) weekOfYear;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSCalendarDate_GNUstepBase_h */

View file

@ -0,0 +1,58 @@
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
and: 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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef INCLUDED_NSData_GNUstepBase_h
#define INCLUDED_NSData_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSData (GNUstepBase)
- (NSString*) hexadecimalRepresentation;
- (id) initWithHexadecimalRepresentation: (NSString*)string;
- (NSData*) md5Digest;
- (BOOL) uudecodeInto: (NSMutableData*)decoded
name: (NSString**)namePtr
mode: (NSInteger*)modePtr;
- (BOOL) uuencodeInto: (NSMutableData*)encoded
name: (NSString*)name
mode: (NSInteger)mode;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSData_GNUstepBase_h */

View file

@ -0,0 +1,53 @@
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
and: 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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef INCLUDED_NSFileHandle_GNUstepBase_h
#define INCLUDED_NSFileHandle_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSFileHandle(GNUstepBase)
+ (id) fileHandleAsServerAtAddress: (NSString*)address
service: (NSString*)service
protocol: (NSString*)protocol;
- (NSString*) socketAddress;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSFileHandle_GNUstepBase_h */

View file

@ -0,0 +1,51 @@
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
and: 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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef INCLUDED_NSInvocation_GNUstepBase_h
#define INCLUDED_NSInvocation_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSInvocation(GNUstepBase)
- (retval_t) returnFrame:(arglist_t)args;
- (id) initWithArgframe:(arglist_t)args selector:(SEL)selector;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSInvocation_GNUstepBase_h */

View file

@ -0,0 +1,54 @@
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
and: 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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef INCLUDED_NSLock_GNUstepBase_h
#define INCLUDED_NSLock_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSLock (GNUstepBase)
+ (id) newLockAt: (id *)location;
@end
@interface NSRecursiveLock (GNUstepBase)
+ (id) newLockAt: (id *)location;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSLock_GNUstepBase_h */

View file

@ -1,4 +1,4 @@
/** Declaration of extension methods and for NSMutableString
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
@ -28,7 +28,6 @@
#define INCLUDED_NSMutableString_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)

View file

@ -0,0 +1,50 @@
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
and: 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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef INCLUDED_NSNumber_GNUstepBase_h
#define INCLUDED_NSNumber_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSNumber(GNUstepBase)
+ (NSValue*) valueFromString: (NSString *)string;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSNumber_GNUstepBase_h */

View file

@ -0,0 +1,63 @@
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
and: 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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef INCLUDED_NSObject_GNUstepBase_h
#define INCLUDED_NSObject_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSObject (GNUstepBase)
- (id) notImplemented: (SEL)aSel;
- (id) subclassResponsibility: (SEL)aSel;
- (id) shouldNotImplement: (SEL)aSel;
/**
WARNING: The -compare: method for NSObject is deprecated
due to subclasses declaring the same selector with
conflicting signatures.
Comparision of arbitrary objects is not just meaningless
but also dangerous as most concrete implementations
expect comparable objects as arguments often accessing
instance variables directly.
This method will be removed in a future release.
*/
- (NSComparisonResult) compare: (id)anObject;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSObject_GNUstepBase_h */

View file

@ -0,0 +1,73 @@
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
and: 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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef INCLUDED_NSProcessInfo_GNUstepBase_h
#define INCLUDED_NSProcessInfo_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSProcessInfo(GNUstepBase)
/**
* Returns a indication of whether debug logging is enabled.
* This returns YES unless a call to -setDebugLoggingEnabled: has
* been used to turn logging off.
*/
- (BOOL) debugLoggingEnabled;
/**
* This method returns a set of debug levels set using the
* --GNU-Debug=... command line option and/or the GNU-Debug
* user default.<br />
* You can modify this set to change the debug logging under
* your programs control ... but such modifications are not
* thread-safe.
*/
- (NSMutableSet*) debugSet;
/**
* This method permits you to turn all debug logging on or off
* without modifying the set of debug levels in use.
*/
- (void) setDebugLoggingEnabled: (BOOL)flag;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSProcessInfo_GNUstepBase_h */

View file

@ -41,6 +41,7 @@ extern "C" {
* Provides some additional (non-standard) utility methods.
*/
@interface NSString (GNUstepBase)
/**
* Alternate way to invoke <code>stringWithFormat</code> if you have or wish
* to build an explicit <code>va_list</code> structure.
@ -87,6 +88,12 @@ extern "C" {
*/
- (NSString*) stringByReplacingString: (NSString*)replace
withString: (NSString*)by;
/**
* An obsolete name for -substringWithRange: ... deprecated.
*/
- (NSString*) substringFromRange: (NSRange)aRange;
@end
#endif /* OS_API_VERSION */

View file

@ -1,4 +1,4 @@
/** Declaration of additional methods for NSTask
/** Declaration of additional methods for base additions
Copyright (C) 2008 Free Software Foundation, Inc.

View file

@ -0,0 +1,50 @@
/** Declaration of extension methods for base additions
Copyright (C) 2003-2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
and: 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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef INCLUDED_NSURL_GNUstepBase_h
#define INCLUDED_NSURL_GNUstepBase_h
#include <GNUstepBase/GSVersionMacros.h>
#include <Foundation/Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSURL (GNUstepBase)
- (NSString*) fullPath;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSURL_GNUstepBase_h */

View file

@ -207,29 +207,6 @@ enum {
*/
@interface NSProcessInfo (GNUstep)
/**
* Returns a indication of whether debug logging is enabled.
* This returns YES unless a call to -setDebugLoggingEnabled: has
* been used to turn logging off.
*/
- (BOOL) debugLoggingEnabled;
/**
* This method returns a set of debug levels set using the
* --GNU-Debug=... command line option and/or the GNU-Debug
* user default.<br />
* You can modify this set to change the debug logging under
* your programs control ... but such modifications are not
* thread-safe.
*/
- (NSMutableSet*) debugSet;
/**
* This method permits you to turn all debug logging on or off
* without modifying the set of debug levels in use.
*/
- (void) setDebugLoggingEnabled: (BOOL)flag;
/**
* Set the file to which NSLog output should be directed.<br />
* Returns YES on success, NO on failure.<br />

View file

@ -32,7 +32,6 @@ include ../../config.mak
SUBPROJECT_NAME = Additions
Additions_OBJC_FILES =\
GSCategories.m \
GSObjCRuntime.m \
GCObject.m \
GCArray.m \
@ -42,9 +41,22 @@ Additions_OBJC_FILES =\
GSXML.m \
GSFunctions.m \
GSInsensitiveDictionary.m \
NSArray+GNUstepBase.m \
NSAttributedString+GNUstepBase.m \
NSBundle+GNUstepBase.m \
NSCalendarDate+GNUstepBase.m \
NSData+GNUstepBase.m \
NSError+GNUstepBase.m \
NSFileHandle+GNUstepBase.m \
NSInvocation+GNUstepBase.m \
NSLock+GNUstepBase.m \
NSMutableString+GNUstepBase.m \
NSNumber+GNUstepBase.m \
NSObject+GNUstepBase.m \
NSProcessInfo+GNUstepBase.m \
NSString+GNUstepBase.m \
NSTask+GNUstepBase.m \
NSURL+GNUstepBase.m \
behavior.m
ifneq ($(OBJC_RUNTIME_LIB), gnu)

View file

@ -88,429 +88,3 @@ GSDebugFunctionMsg(const char *func, const char *file, int line, NSString *fmt)
return message;
}
@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];
if ([array isProxy])
{
unsigned i;
for (i = 0; i < c; i++)
{
objects[i] = [array objectAtIndex: i];
}
}
else
{
[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
@interface NSDistantObject (GSCategoriesRevealed)
// This method is implemented in MacOS X 10.2.4, but is not public
+ (void) _enableLogging:(BOOL)flag;
@end
@implementation NSDistantObject (GSCompatibility)
+ (void) setDebug: (int)val
{
if ([self respondsToSelector:@selector(_enableLogging:)])
[self _enableLogging:!!val];
}
@end
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
@implementation NSFileHandle(GSCompatibility)
// From GSFileHandle.m
static BOOL
getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
{
const char *proto = "tcp";
struct servent *sp;
if (pcl)
{
proto = [pcl lossyCString];
}
memset(sin, '\0', sizeof(*sin));
sin->sin_family = AF_INET;
/*
* If we were given a hostname, we use any address for that host.
* Otherwise we expect the given name to be an address unless it is
* a null (any address).
*/
if (name)
{
NSHost* host = [NSHost hostWithName: name];
if (host != nil)
{
name = [host address];
}
#ifndef HAVE_INET_ATON
sin->sin_addr.s_addr = inet_addr([name lossyCString]);
if (sin->sin_addr.s_addr == INADDR_NONE)
#else
if (inet_aton([name lossyCString], &sin->sin_addr) == 0)
#endif
{
return NO;
}
}
else
{
sin->sin_addr.s_addr = NSSwapHostIntToBig(INADDR_ANY);
}
if (svc == nil)
{
sin->sin_port = 0;
return YES;
}
else if ((sp = getservbyname([svc lossyCString], proto)) == 0)
{
const char* ptr = [svc lossyCString];
int val = atoi(ptr);
while (isdigit(*ptr))
{
ptr++;
}
if (*ptr == '\0' && val <= 0xffff)
{
unsigned short v = val;
sin->sin_port = NSSwapHostShortToBig(v);
return YES;
}
else if (strcmp(ptr, "gdomap") == 0)
{
unsigned short v;
#ifdef GDOMAP_PORT_OVERRIDE
v = GDOMAP_PORT_OVERRIDE;
#else
v = 538; // IANA allocated port
#endif
sin->sin_port = NSSwapHostShortToBig(v);
return YES;
}
else
{
return NO;
}
}
else
{
sin->sin_port = sp->s_port;
return YES;
}
}
- (id) initAsServerAtAddress: (NSString*)a
service: (NSString*)s
protocol: (NSString*)p
{
#ifndef BROKEN_SO_REUSEADDR
int status = 1;
#endif
int net;
struct sockaddr_in sin;
int size = sizeof(sin);
if (getAddr(a, s, p, &sin) == NO)
{
RELEASE(self);
NSLog(@"bad address-service-protocol combination");
return nil;
}
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) < 0)
{
NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self);
return nil;
}
#ifndef BROKEN_SO_REUSEADDR
/*
* Under decent systems, SO_REUSEADDR means that the port can be reused
* immediately that this process exits. Under some it means
* that multiple processes can serve the same port simultaneously.
* We don't want that broken behavior!
*/
setsockopt(net, SOL_SOCKET, SO_REUSEADDR, (char *)&status, sizeof(status));
#endif
if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) < 0)
{
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
NSSwapBigShortToHost(sin.sin_port), [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
}
if (listen(net, 5) < 0)
{
NSLog(@"unable to listen on port - %@", [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
}
if (getsockname(net, (struct sockaddr*)&sin, &size) < 0)
{
NSLog(@"unable to get socket name - %@", [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
}
self = [self initWithFileDescriptor: net closeOnDealloc: YES];
return self;
}
+ (id) fileHandleAsServerAtAddress: (NSString*)address
service: (NSString*)service
protocol: (NSString*)protocol
{
id o = [self allocWithZone: NSDefaultMallocZone()];
return AUTORELEASE([o initAsServerAtAddress: address
service: service
protocol: protocol]);
}
- (NSString*) socketAddress
{
struct sockaddr_in sin;
int size = sizeof(sin);
if (getsockname([self fileDescriptor], (struct sockaddr*)&sin, &size) < 0)
{
NSLog(@"unable to get socket name - %@", [NSError _last]);
return nil;
}
return [[[NSString alloc] initWithCString: (char*)inet_ntoa(sin.sin_addr)]
autorelease];
}
@end
@implementation NSProcessInfo(GSCompatibility)
static NSMutableSet *_debug_set = nil;
BOOL GSDebugSet(NSString *level)
// From GNUStep's
{
static IMP debugImp = 0;
static SEL debugSel;
if (debugImp == 0)
{
debugSel = @selector(member:);
if (_debug_set == nil)
{
[[NSProcessInfo processInfo] debugSet];
}
debugImp = [_debug_set methodForSelector: debugSel];
}
if ((*debugImp)(_debug_set, debugSel, level) == nil)
{
return NO;
}
return YES;
}
- (NSMutableSet *) debugSet
// Derived from GNUStep's
{
if (_debug_set == nil)
{
int argc = [[self arguments] count];
NSMutableSet *mySet;
int i;
mySet = [NSMutableSet new];
for (i = 0; i < argc; i++)
{
NSString *str = [[self arguments] objectAtIndex:i];
if ([str hasPrefix: @"--GNU-Debug="])
[mySet addObject: [str substringFromIndex: 12]];
}
_debug_set = mySet;
}
return _debug_set;
}
@end
@implementation NSString(GSCompatibility)
#ifndef MAC_OS_X_VERSION_10_5
/**
* Returns YES when scanning the receiver's text from left to right finds a
* digit in the range 1-9 or a letter in the set ('Y', 'y', 'T', 't').<br />
* Any trailing characters are ignored.<br />
* Any leading whitespace or zeros or signs are also ignored.<br />
* Returns NO if the above conditions are not met.
*/
- (BOOL) boolValue
{
static NSCharacterSet *yes = nil;
if (yes == nil)
{
yes = RETAIN([NSCharacterSet characterSetWithCharactersInString:
@"123456789yYtT"]);
}
if ([self rangeOfCharacterFromSet: yes].length > 0)
{
return YES;
}
return NO;
}
#endif
- (NSString*) substringFromRange:(NSRange)range
{
return [self substringWithRange:range];
}
@end
@implementation NSInvocation(GSCompatibility)
- (retval_t) returnFrame:(arglist_t)args
{
#warning (stephane@sente.ch) Not implemented
return (retval_t)[self notImplemented:_cmd];
}
- (id) initWithArgframe:(arglist_t)args selector:(SEL)selector
{
#warning (stephane@sente.ch) Not implemented
return [self notImplemented:_cmd];
}
@end
@implementation NSObject(GSCompatibility)
+ (id) notImplemented:(SEL)selector
{
[NSException raise: NSGenericException
format: @"method %s not implemented in %s(class)",
selector ? GSNameFromSelector(selector) : "(null)",
GSClassNameFromObject(self)];
return nil;
}
// In NSObject.m, category GNU
- (BOOL) isInstance
{
return GSObjCIsInstance(self);
}
@end
@implementation NSBundle(GSCompatibility)
// In NSBundle.m
+ (NSString *) pathForLibraryResource: (NSString *)name
ofType: (NSString *)ext
inDirectory: (NSString *)bundlePath
{
NSString *path = nil;
NSString *bundle_path = nil;
NSArray *paths;
NSBundle *bundle;
NSEnumerator *enumerator;
/* Gather up the paths */
paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSAllDomainsMask, YES);
enumerator = [paths objectEnumerator];
while ((path == nil) && (bundle_path = [enumerator nextObject]))
{
bundle = [self bundleWithPath: bundle_path];
path = [bundle pathForResource: name
ofType: ext
inDirectory: bundlePath];
}
return path;
}
@end
@implementation NSURL (GSCompatibility)
- (NSString*) fullPath
{
NSRange r;
NSString *s;
s = [self absoluteString];
if ((r = [s rangeOfString: @";"]).length > 0)
{
s = [s substringToIndex: r.location];
}
else if ((r = [s rangeOfString: @"?"]).length > 0)
{
s = [s substringToIndex: r.location];
}
r = [s rangeOfString: @"//"];
s = [s substringFromIndex: NSMaxRange(r)];
r = [s rangeOfString: @"/"];
s = [s substringFromIndex: r.location];
return s;
}
@end

View file

@ -58,7 +58,7 @@
#import <Foundation/Foundation.h>
#import "GNUstepBase/GSMime.h"
#import "GNUstepBase/GSXML.h"
#import "GNUstepBase/GSCategories.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#import "GNUstepBase/Unicode.h"
#include "../GSPrivate.h"

View file

@ -0,0 +1,201 @@
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "config.h"
#include "Foundation/Foundation.h"
#include "GNUstepBase/NSArray+GNUstepBase.h"
#include "GSPrivate.h"
@implementation NSArray (GNUstepBase)
/**
* 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];
GS_BEGINIDBUF(objects, c);
if ([array isProxy])
{
unsigned i;
for (i = 0; i < c; i++)
{
objects[i] = [array objectAtIndex: i];
}
}
else
{
[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];
}
GS_ENDIDBUF();
return self;
}
- (NSUInteger) insertionPosition: (id)item
usingFunction: (NSComparisonResult (*)(id, id, void *))sorter
context: (void *)context
{
unsigned count = [self count];
unsigned upper = count;
unsigned lower = 0;
unsigned index;
SEL oaiSel;
IMP oai;
if (item == nil)
{
[NSException raise: NSGenericException
format: @"Attempt to find position for nil object in array"];
}
if (sorter == 0)
{
[NSException raise: NSGenericException
format: @"Attempt to find position with null comparator"];
}
oaiSel = @selector(objectAtIndex:);
oai = [self methodForSelector: oaiSel];
/*
* Binary search for an item equal to the one to be inserted.
*/
for (index = upper/2; upper != lower; index = lower+(upper-lower)/2)
{
NSComparisonResult comparison;
comparison = (*sorter)(item, (*oai)(self, oaiSel, index), context);
if (comparison == NSOrderedAscending)
{
upper = index;
}
else if (comparison == NSOrderedDescending)
{
lower = index + 1;
}
else
{
break;
}
}
/*
* Now skip past any equal items so the insertion point is AFTER any
* items that are equal to the new one.
*/
while (index < count && (*sorter)(item, (*oai)(self, oaiSel, index), context)
!= NSOrderedAscending)
{
index++;
}
return index;
}
- (NSUInteger) insertionPosition: (id)item
usingSelector: (SEL)comp
{
unsigned count = [self count];
unsigned upper = count;
unsigned lower = 0;
unsigned index;
NSComparisonResult (*imp)(id, SEL, id);
SEL oaiSel;
IMP oai;
if (item == nil)
{
[NSException raise: NSGenericException
format: @"Attempt to find position for nil object in array"];
}
if (comp == 0)
{
[NSException raise: NSGenericException
format: @"Attempt to find position with null comparator"];
}
imp = (NSComparisonResult (*)(id, SEL, id))[item methodForSelector: comp];
if (imp == 0)
{
[NSException raise: NSGenericException
format: @"Attempt to find position with unknown method"];
}
oaiSel = @selector(objectAtIndex:);
oai = [self methodForSelector: oaiSel];
/*
* Binary search for an item equal to the one to be inserted.
*/
for (index = upper/2; upper != lower; index = lower+(upper-lower)/2)
{
NSComparisonResult comparison;
comparison = (*imp)(item, comp, (*oai)(self, oaiSel, index));
if (comparison == NSOrderedAscending)
{
upper = index;
}
else if (comparison == NSOrderedDescending)
{
lower = index + 1;
}
else
{
break;
}
}
/*
* Now skip past any equal items so the insertion point is AFTER any
* items that are equal to the new one.
*/
while (index < count
&& (*imp)(item, comp, (*oai)(self, oaiSel, index)) != NSOrderedAscending)
{
index++;
}
return index;
}
@end

View file

@ -0,0 +1,35 @@
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "config.h"
#include "Foundation/Foundation.h"
#include "GNUstepBase/NSAttributedString+GNUstepBase.h"
@implementation NSAttributedString (GNUstepBase)
- (NSAttributedString*) attributedSubstringWithRange: (NSRange)aRange
{
GSOnceMLog(@"This method is deprecated, use -attributedSubstringFromRange:");
return [self attributedSubstringFromRange: aRange];
}
@end

View file

View file

@ -0,0 +1,61 @@
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "config.h"
#include "Foundation/Foundation.h"
#include "GNUstepBase/NSBundle+GNUstepBase.h"
@implementation NSBundle(GNUstepBase)
// In NSBundle.m
+ (NSString *) pathForLibraryResource: (NSString *)name
ofType: (NSString *)ext
inDirectory: (NSString *)bundlePath
{
NSString *path = nil;
NSString *bundle_path = nil;
NSArray *paths;
NSBundle *bundle;
NSEnumerator *enumerator;
/* Gather up the paths */
paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSAllDomainsMask, YES);
enumerator = [paths objectEnumerator];
while ((path == nil) && (bundle_path = [enumerator nextObject]))
{
bundle = [self bundleWithPath: bundle_path];
path = [bundle pathForResource: name
ofType: ext
inDirectory: bundlePath];
}
return path;
}
@end

View file

@ -0,0 +1,90 @@
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "config.h"
#include "Foundation/Foundation.h"
#include "GNUstepBase/NSCalendarDate+GNUstepBase.h"
/**
* Extension methods for the NSCalendarDate class
*/
@implementation NSCalendarDate (GSCategories)
/**
* The ISO standard week of the year is based on the first week of the
* year being that week (starting on monday) for which the thursday
* is on or after the first of january.<br />
* This has the effect that, if january first is a friday, saturday or
* sunday, the days of that week (up to and including the sunday) are
* considered to be in week 53 of the preceding year. Similarly if the
* last day of the year is a monday tuesday or wednesday, these days are
* part of week 1 of the next year.
*/
- (NSInteger) weekOfYear
{
NSInteger dayOfWeek = [self dayOfWeek];
NSInteger dayOfYear;
/*
* Whether a week is considered to be in a year or not depends on its
* thursday ... so find thursday for the receivers week.
* NB. this may result in a date which is not in the same year as the
* receiver.
*/
if (dayOfWeek != 4)
{
CREATE_AUTORELEASE_POOL(arp);
NSCalendarDate *thursday;
/*
* A week starts on monday ... so adjust from 0 to 7 so that a
* sunday is counted as the last day of the week.
*/
if (dayOfWeek == 0)
{
dayOfWeek = 7;
}
thursday = [self dateByAddingYears: 0
months: 0
days: 4 - dayOfWeek
hours: 0
minutes: 0
seconds: 0];
dayOfYear = [thursday dayOfYear];
RELEASE(arp);
}
else
{
dayOfYear = [self dayOfYear];
}
/*
* Round up to a week boundary, so that when we divide by seven we
* get a result in the range 1 to 53 as mandated by the ISO standard.
*/
dayOfYear += (7 - dayOfYear % 7);
return dayOfYear / 7;
}
@end

View file

@ -1,6 +1,6 @@
/* Implementation of extension methods to standard classes
/* Implementation of extension methods to base additions
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
@ -23,215 +23,14 @@
*/
#include "config.h"
#include <string.h>
#include "Foundation/Foundation.h"
#include "GNUstepBase/GSCategories.h"
#include "GNUstepBase/GSLock.h"
#include "GSPrivate.h"
/* Test for ASCII whitespace which is safe for unicode characters */
#define space(C) ((C) > 127 ? NO : isspace(C))
@implementation NSArray (GSCategories)
- (NSUInteger) insertionPosition: (id)item
usingFunction: (NSComparisonResult (*)(id, id, void *))sorter
context: (void *)context
{
unsigned count = [self count];
unsigned upper = count;
unsigned lower = 0;
unsigned index;
SEL oaiSel;
IMP oai;
if (item == nil)
{
[NSException raise: NSGenericException
format: @"Attempt to find position for nil object in array"];
}
if (sorter == 0)
{
[NSException raise: NSGenericException
format: @"Attempt to find position with null comparator"];
}
oaiSel = @selector(objectAtIndex:);
oai = [self methodForSelector: oaiSel];
/*
* Binary search for an item equal to the one to be inserted.
*/
for (index = upper/2; upper != lower; index = lower+(upper-lower)/2)
{
NSComparisonResult comparison;
comparison = (*sorter)(item, (*oai)(self, oaiSel, index), context);
if (comparison == NSOrderedAscending)
{
upper = index;
}
else if (comparison == NSOrderedDescending)
{
lower = index + 1;
}
else
{
break;
}
}
/*
* Now skip past any equal items so the insertion point is AFTER any
* items that are equal to the new one.
*/
while (index < count && (*sorter)(item, (*oai)(self, oaiSel, index), context)
!= NSOrderedAscending)
{
index++;
}
return index;
}
- (NSUInteger) insertionPosition: (id)item
usingSelector: (SEL)comp
{
unsigned count = [self count];
unsigned upper = count;
unsigned lower = 0;
unsigned index;
NSComparisonResult (*imp)(id, SEL, id);
SEL oaiSel;
IMP oai;
if (item == nil)
{
[NSException raise: NSGenericException
format: @"Attempt to find position for nil object in array"];
}
if (comp == 0)
{
[NSException raise: NSGenericException
format: @"Attempt to find position with null comparator"];
}
imp = (NSComparisonResult (*)(id, SEL, id))[item methodForSelector: comp];
if (imp == 0)
{
[NSException raise: NSGenericException
format: @"Attempt to find position with unknown method"];
}
oaiSel = @selector(objectAtIndex:);
oai = [self methodForSelector: oaiSel];
/*
* Binary search for an item equal to the one to be inserted.
*/
for (index = upper/2; upper != lower; index = lower+(upper-lower)/2)
{
NSComparisonResult comparison;
comparison = (*imp)(item, comp, (*oai)(self, oaiSel, index));
if (comparison == NSOrderedAscending)
{
upper = index;
}
else if (comparison == NSOrderedDescending)
{
lower = index + 1;
}
else
{
break;
}
}
/*
* Now skip past any equal items so the insertion point is AFTER any
* items that are equal to the new one.
*/
while (index < count
&& (*imp)(item, comp, (*oai)(self, oaiSel, index)) != NSOrderedAscending)
{
index++;
}
return index;
}
@end
@implementation NSAttributedString (GSCategories)
- (NSAttributedString*) attributedSubstringWithRange: (NSRange)aRange
{
GSOnceMLog(@"This method is deprecated, use -attributedSubstringFromRange:");
return [self attributedSubstringFromRange: aRange];
}
@end
/**
* Extension methods for the NSCalendarDate class
*/
@implementation NSCalendarDate (GSCategories)
/**
* The ISO standard week of the year is based on the first week of the
* year being that week (starting on monday) for which the thursday
* is on or after the first of january.<br />
* This has the effect that, if january first is a friday, saturday or
* sunday, the days of that week (up to and including the sunday) are
* considered to be in week 53 of the preceding year. Similarly if the
* last day of the year is a monday tuesday or wednesday, these days are
* part of week 1 of the next year.
*/
- (NSInteger) weekOfYear
{
NSInteger dayOfWeek = [self dayOfWeek];
NSInteger dayOfYear;
/*
* Whether a week is considered to be in a year or not depends on its
* thursday ... so find thursday for the receivers week.
* NB. this may result in a date which is not in the same year as the
* receiver.
*/
if (dayOfWeek != 4)
{
CREATE_AUTORELEASE_POOL(arp);
NSCalendarDate *thursday;
/*
* A week starts on monday ... so adjust from 0 to 7 so that a
* sunday is counted as the last day of the week.
*/
if (dayOfWeek == 0)
{
dayOfWeek = 7;
}
thursday = [self dateByAddingYears: 0
months: 0
days: 4 - dayOfWeek
hours: 0
minutes: 0
seconds: 0];
dayOfYear = [thursday dayOfYear];
RELEASE(arp);
}
else
{
dayOfYear = [self dayOfYear];
}
/*
* Round up to a week boundary, so that when we divide by seven we
* get a result in the range 1 to 53 as mandated by the ISO standard.
*/
dayOfYear += (7 - dayOfYear % 7);
return dayOfYear / 7;
}
@end
#include "GNUstepBase/NSData+GNUstepBase.h"
#include "GNUstepBase/NSString+GNUstepBase.h"
/**
* Extension methods for the NSData class.
*/
@implementation NSData (GSCategories)
@implementation NSData (GNUstepBase)
/**
* Returns an NSString object containing an ASCII hexadecimal representation
@ -903,302 +702,3 @@ static void MD5Transform (uint32_t buf[4], uint32_t const in[16])
return YES;
}
@end
/**
* GNUstep specific (non-standard) additions to the NSError class.
* Possibly to be made public
*/
@implementation NSError(GSCategories)
#if !defined(__MINGW32__)
#if !defined(HAVE_STRERROR_R)
#if defined(HAVE_STRERROR)
static int
strerror_r(int eno, char *buf, int len)
{
const char *ptr;
int result;
[gnustep_global_lock lock];
ptr = strerror(eno);
if (ptr == 0)
{
strncpy(buf, "unknown error number", len);
result = -1;
}
else
{
strncpy(buf, strerror(eno), len);
result = 0;
}
[gnustep_global_lock unlock];
return result;
}
#else
static int
strerror_r(int eno, char *buf, int len)
{
extern char *sys_errlist[];
extern int sys_nerr;
if (eno < 0 || eno >= sys_nerr)
{
strncpy(buf, "unknown error number", len);
return -1;
}
strncpy(buf, sys_errlist[eno], len);
return 0;
}
#endif
#endif
#endif
/*
* Returns an NSError instance encapsulating the last system error.
* The user info dictionary of this object will be mutable, so that
* additional information can be placed in it by higher level code.
*/
+ (NSError*) _last
{
extern int errno;
int eno;
#if defined(__MINGW32__)
eno = GetLastError();
if (eno == 0) eno = errno;
#else
eno = errno;
#endif
return [self _systemError: eno];
}
+ (NSError*) _systemError: (long)code
{
NSError *error;
NSString *domain;
NSDictionary *info;
#if defined(__MINGW32__)
LPVOID lpMsgBuf;
NSString *message;
domain = NSOSStatusErrorDomain;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR) &lpMsgBuf, 0, NULL );
message = [NSString stringWithCharacters: lpMsgBuf length: wcslen(lpMsgBuf)];
LocalFree(lpMsgBuf);
info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, NSLocalizedDescriptionKey,
nil];
#else
NSString *message;
char buf[BUFSIZ];
/* FIXME ... not all are POSIX, should we use NSMachErrorDomain for some? */
domain = NSPOSIXErrorDomain;
if (strerror_r(code, buf, BUFSIZ) < 0)
{
sprintf(buf, "%ld", code);
}
message = [NSString stringWithCString: buf
encoding: [NSString defaultCStringEncoding]];
/* FIXME ... can we do better localisation? */
info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, NSLocalizedDescriptionKey,
nil];
#endif
/* NB we use a mutable dictionary so that calling code can add extra
* information to the dictionary before passing it up to higher level
* code.
*/
error = [self errorWithDomain: domain code: code userInfo: info];
return error;
}
@end
/**
* GNUstep specific (non-standard) additions to the NSNumber class.
*/
@implementation NSNumber(GSCategories)
+ (NSValue*) valueFromString: (NSString*)string
{
/* FIXME: implement this better */
const char *str;
str = [string cString];
if (strchr(str, '.') >= 0 || strchr(str, 'e') >= 0
|| strchr(str, 'E') >= 0)
return [NSNumber numberWithDouble: atof(str)];
else if (strchr(str, '-') >= 0)
return [NSNumber numberWithInt: atoi(str)];
else
return [NSNumber numberWithUnsignedInt: atoi(str)];
return [NSNumber numberWithInt: 0];
}
@end
/**
* Extension methods for the NSObject class
*/
@implementation NSObject (GSCategories)
- (id) notImplemented: (SEL)aSel
{
[NSException
raise: NSGenericException
format: @"method %s not implemented in %s(%s)",
aSel ? GSNameFromSelector(aSel) : "(null)",
GSClassNameFromObject(self),
GSObjCIsInstance(self) ? "instance" : "class"];
return nil;
}
- (id) shouldNotImplement: (SEL)aSel
{
[NSException
raise: NSGenericException
format: @"%s(%s) should not implement %s",
GSClassNameFromObject(self),
GSObjCIsInstance(self) ? "instance" : "class",
aSel ? GSNameFromSelector(aSel) : "(null)"];
return nil;
}
- (id) subclassResponsibility: (SEL)aSel
{
[NSException raise: NSInvalidArgumentException
format: @"subclass %s(%s) should override %s",
GSClassNameFromObject(self),
GSObjCIsInstance(self) ? "instance" : "class",
aSel ? GSNameFromSelector(aSel) : "(null)"];
return nil;
}
/**
* WARNING: The -compare: method for NSObject is deprecated
* due to subclasses declaring the same selector with
* conflicting signatures.
* Comparison of arbitrary objects is not just meaningless
* but also dangerous as most concrete implementations
* expect comparable objects as arguments often accessing
* instance variables directly.
* This method will be removed in a future release.
*/
- (NSComparisonResult) compare: (id)anObject
{
NSLog(@"WARNING: The -compare: method for NSObject is deprecated.");
if (anObject == self)
{
return NSOrderedSame;
}
if (anObject == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"nil argument for compare:"];
}
if ([self isEqual: anObject])
{
return NSOrderedSame;
}
/*
* Ordering objects by their address is pretty useless,
* so subclasses should override this is some useful way.
*/
if ((id)self > anObject)
{
return NSOrderedDescending;
}
else
{
return NSOrderedAscending;
}
}
@end
/**
* GNUstep specific (non-standard) additions to the NSLock class.
*/
static GSLazyRecursiveLock *local_lock = nil;
/*
This class only exists to provide
a thread safe mechanism to initialize local_lock
as +initialize is called under a lock in ObjC runtimes.
User code should resort to GS_INITIALIZED_LOCK(),
which uses the +newLockAt: extension.
*/
@interface _GSLockInitializer : NSObject
@end
@implementation _GSLockInitializer
+ (void) initialize
{
if (local_lock == nil)
{
/* As we do not know whether creating custom locks
may implicitly create other locks,
we use a recursive lock. */
local_lock = [GSLazyRecursiveLock new];
}
}
@end
GS_STATIC_INLINE id
newLockAt(Class self, SEL _cmd, id *location)
{
if (location == 0)
{
[NSException raise: NSInvalidArgumentException
format: @"'%@' called with nil location",
NSStringFromSelector(_cmd)];
}
if (*location == nil)
{
if (local_lock == nil)
{
[_GSLockInitializer class];
}
[local_lock lock];
if (*location == nil)
{
*location = [[(id)self alloc] init];
}
[local_lock unlock];
}
return *location;
}
@implementation NSLock (GSCategories)
+ (id) newLockAt: (id *)location
{
return newLockAt(self, _cmd, location);
}
@end
@implementation NSRecursiveLock (GSCategories)
+ (id) newLockAt: (id *)location
{
return newLockAt(self, _cmd, location);
}
@end

View file

@ -0,0 +1,140 @@
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "config.h"
#include "Foundation/Foundation.h"
#include "GSPrivate.h"
/**
* GNUstep specific (non-standard) additions to the NSError class.
* Possibly to be made public
*/
@implementation NSError(GSCategories)
#if !defined(__MINGW32__)
#if !defined(HAVE_STRERROR_R)
#if defined(HAVE_STRERROR)
static int
strerror_r(int eno, char *buf, int len)
{
const char *ptr;
int result;
[gnustep_global_lock lock];
ptr = strerror(eno);
if (ptr == 0)
{
strncpy(buf, "unknown error number", len);
result = -1;
}
else
{
strncpy(buf, strerror(eno), len);
result = 0;
}
[gnustep_global_lock unlock];
return result;
}
#else
static int
strerror_r(int eno, char *buf, int len)
{
extern char *sys_errlist[];
extern int sys_nerr;
if (eno < 0 || eno >= sys_nerr)
{
strncpy(buf, "unknown error number", len);
return -1;
}
strncpy(buf, sys_errlist[eno], len);
return 0;
}
#endif
#endif
#endif
/*
* Returns an NSError instance encapsulating the last system error.
* The user info dictionary of this object will be mutable, so that
* additional information can be placed in it by higher level code.
*/
+ (NSError*) _last
{
extern int errno;
int eno;
#if defined(__MINGW32__)
eno = GetLastError();
if (eno == 0) eno = errno;
#else
eno = errno;
#endif
return [self _systemError: eno];
}
+ (NSError*) _systemError: (long)code
{
NSError *error;
NSString *domain;
NSDictionary *info;
#if defined(__MINGW32__)
LPVOID lpMsgBuf;
NSString *message;
domain = NSOSStatusErrorDomain;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR) &lpMsgBuf, 0, NULL );
message = [NSString stringWithCharacters: lpMsgBuf length: wcslen(lpMsgBuf)];
LocalFree(lpMsgBuf);
info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, NSLocalizedDescriptionKey,
nil];
#else
NSString *message;
char buf[BUFSIZ];
/* FIXME ... not all are POSIX, should we use NSMachErrorDomain for some? */
domain = NSPOSIXErrorDomain;
if (strerror_r(code, buf, BUFSIZ) < 0)
{
sprintf(buf, "%ld", code);
}
message = [NSString stringWithCString: buf
encoding: [NSString defaultCStringEncoding]];
/* FIXME ... can we do better localisation? */
info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, NSLocalizedDescriptionKey,
nil];
#endif
/* NB we use a mutable dictionary so that calling code can add extra
* information to the dictionary before passing it up to higher level
* code.
*/
error = [self errorWithDomain: domain code: code userInfo: info];
return error;
}
@end

View file

@ -0,0 +1,217 @@
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "config.h"
#include "Foundation/Foundation.h"
#include "GSPrivate.h"
#include "GNUstepBase/NSFileHandle+GNUstepBase.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
@implementation NSFileHandle(GNUstepBase)
// From GSFileHandle.m
static BOOL
getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
{
const char *proto = "tcp";
struct servent *sp;
if (pcl)
{
proto = [pcl lossyCString];
}
memset(sin, '\0', sizeof(*sin));
sin->sin_family = AF_INET;
/*
* If we were given a hostname, we use any address for that host.
* Otherwise we expect the given name to be an address unless it is
* a null (any address).
*/
if (name)
{
NSHost* host = [NSHost hostWithName: name];
if (host != nil)
{
name = [host address];
}
#ifndef HAVE_INET_ATON
sin->sin_addr.s_addr = inet_addr([name lossyCString]);
if (sin->sin_addr.s_addr == INADDR_NONE)
#else
if (inet_aton([name lossyCString], &sin->sin_addr) == 0)
#endif
{
return NO;
}
}
else
{
sin->sin_addr.s_addr = NSSwapHostIntToBig(INADDR_ANY);
}
if (svc == nil)
{
sin->sin_port = 0;
return YES;
}
else if ((sp = getservbyname([svc lossyCString], proto)) == 0)
{
const char* ptr = [svc lossyCString];
int val = atoi(ptr);
while (isdigit(*ptr))
{
ptr++;
}
if (*ptr == '\0' && val <= 0xffff)
{
unsigned short v = val;
sin->sin_port = NSSwapHostShortToBig(v);
return YES;
}
else if (strcmp(ptr, "gdomap") == 0)
{
unsigned short v;
#ifdef GDOMAP_PORT_OVERRIDE
v = GDOMAP_PORT_OVERRIDE;
#else
v = 538; // IANA allocated port
#endif
sin->sin_port = NSSwapHostShortToBig(v);
return YES;
}
else
{
return NO;
}
}
else
{
sin->sin_port = sp->s_port;
return YES;
}
}
- (id) initAsServerAtAddress: (NSString*)a
service: (NSString*)s
protocol: (NSString*)p
{
#ifndef BROKEN_SO_REUSEADDR
int status = 1;
#endif
int net;
struct sockaddr_in sin;
unsigned int size = sizeof(sin);
if (getAddr(a, s, p, &sin) == NO)
{
RELEASE(self);
NSLog(@"bad address-service-protocol combination");
return nil;
}
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) < 0)
{
NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self);
return nil;
}
#ifndef BROKEN_SO_REUSEADDR
/*
* Under decent systems, SO_REUSEADDR means that the port can be reused
* immediately that this process exits. Under some it means
* that multiple processes can serve the same port simultaneously.
* We don't want that broken behavior!
*/
setsockopt(net, SOL_SOCKET, SO_REUSEADDR, (char *)&status, sizeof(status));
#endif
if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) < 0)
{
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
NSSwapBigShortToHost(sin.sin_port), [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
}
if (listen(net, 5) < 0)
{
NSLog(@"unable to listen on port - %@", [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
}
if (getsockname(net, (struct sockaddr*)&sin, &size) < 0)
{
NSLog(@"unable to get socket name - %@", [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
}
self = [self initWithFileDescriptor: net closeOnDealloc: YES];
return self;
}
+ (id) fileHandleAsServerAtAddress: (NSString*)address
service: (NSString*)service
protocol: (NSString*)protocol
{
id o = [self allocWithZone: NSDefaultMallocZone()];
return AUTORELEASE([o initAsServerAtAddress: address
service: service
protocol: protocol]);
}
- (NSString*) socketAddress
{
struct sockaddr_in sin;
unsigned int size = sizeof(sin);
if (getsockname([self fileDescriptor], (struct sockaddr*)&sin, &size) < 0)
{
NSLog(@"unable to get socket name - %@", [NSError _last]);
return nil;
}
return [[[NSString alloc] initWithCString: (char*)inet_ntoa(sin.sin_addr)]
autorelease];
}
@end

View file

@ -0,0 +1,42 @@
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "config.h"
#include "Foundation/Foundation.h"
#include "GNUstepBase/NSInvocation+GNUstepBase.h"
@implementation NSInvocation(GSCompatibility)
- (retval_t) returnFrame:(arglist_t)args
{
#warning (stephane@sente.ch) Not implemented
return (retval_t)[self notImplemented:_cmd];
}
- (id) initWithArgframe:(arglist_t)args selector:(SEL)selector
{
#warning (stephane@sente.ch) Not implemented
return [self notImplemented:_cmd];
}
@end

View file

@ -0,0 +1,104 @@
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "config.h"
#include "Foundation/Foundation.h"
#include "GNUstepBase/NSLock+GNUstepBase.h"
#include "GNUstepBase/GSLock.h"
/**
* GNUstep specific (non-standard) additions to the NSLock class.
*/
static GSLazyRecursiveLock *local_lock = nil;
/*
This class only exists to provide
a thread safe mechanism to initialize local_lock
as +initialize is called under a lock in ObjC runtimes.
User code should resort to GS_INITIALIZED_LOCK(),
which uses the +newLockAt: extension.
*/
@interface _GSLockInitializer : NSObject
@end
@implementation _GSLockInitializer
+ (void) initialize
{
if (local_lock == nil)
{
/* As we do not know whether creating custom locks
may implicitly create other locks,
we use a recursive lock. */
local_lock = [GSLazyRecursiveLock new];
}
}
@end
GS_STATIC_INLINE id
newLockAt(Class self, SEL _cmd, id *location)
{
if (location == 0)
{
[NSException raise: NSInvalidArgumentException
format: @"'%@' called with nil location",
NSStringFromSelector(_cmd)];
}
if (*location == nil)
{
if (local_lock == nil)
{
[_GSLockInitializer class];
}
[local_lock lock];
if (*location == nil)
{
*location = [[(id)self alloc] init];
}
[local_lock unlock];
}
return *location;
}
@implementation NSLock (GSCategories)
+ (id) newLockAt: (id *)location
{
return newLockAt(self, _cmd, location);
}
@end
@implementation NSRecursiveLock (GSCategories)
+ (id) newLockAt: (id *)location
{
return newLockAt(self, _cmd, location);
}
@end

View file

@ -1,4 +1,4 @@
/* Implementation of extension methods to NSMutableStrings
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.

View file

@ -0,0 +1,50 @@
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "config.h"
#include "Foundation/Foundation.h"
#include "GNUstepBase/NSNumber+GNUstepBase.h"
/**
* GNUstep specific (non-standard) additions to the NSNumber class.
*/
@implementation NSNumber(GNUstepBase)
+ (NSValue*) valueFromString: (NSString*)string
{
/* FIXME: implement this better */
const char *str;
str = [string cString];
if (strchr(str, '.') >= 0 || strchr(str, 'e') >= 0
|| strchr(str, 'E') >= 0)
return [NSNumber numberWithDouble: atof(str)];
else if (strchr(str, '-') >= 0)
return [NSNumber numberWithInt: atoi(str)];
else
return [NSNumber numberWithUnsignedInt: atoi(str)];
return [NSNumber numberWithInt: 0];
}
@end

View file

@ -0,0 +1,121 @@
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "config.h"
#include "Foundation/Foundation.h"
#include "GNUstepBase/NSObject+GNUstepBase.h"
/**
* Extension methods for the NSObject class
*/
@implementation NSObject (GNUstepBase)
+ (id) notImplemented: (SEL)selector
{
[NSException raise: NSGenericException
format: @"method %@ not implemented in %s(class)",
selector ? (id)NSStringFromSelector(selector) : (id)@"(null)",
NSStringFromClass(self)];
return nil;
}
- (BOOL) isInstance
{
return GSObjCIsInstance(self);
}
- (id) notImplemented: (SEL)aSel
{
[NSException
raise: NSGenericException
format: @"method %@ not implemented in %@(%s)",
aSel ? (id)NSStringFromSelector(aSel) : (id)@"(null)",
NSStringFromClass([self class]),
GSObjCIsInstance(self) ? "instance" : "class"];
return nil;
}
- (id) shouldNotImplement: (SEL)aSel
{
[NSException
raise: NSGenericException
format: @"%@(%s) should not implement %@",
NSStringFromClass([self class]),
GSObjCIsInstance(self) ? "instance" : "class",
aSel ? (id)NSStringFromSelector(aSel) : (id)@"(null)"];
return nil;
}
- (id) subclassResponsibility: (SEL)aSel
{
[NSException raise: NSInvalidArgumentException
format: @"subclass %@(%s) should override %@",
NSStringFromClass([self class]),
GSObjCIsInstance(self) ? "instance" : "class",
aSel ? (id)NSStringFromSelector(aSel) : (id)@"(null)"];
return nil;
}
/**
* WARNING: The -compare: method for NSObject is deprecated
* due to subclasses declaring the same selector with
* conflicting signatures.
* Comparison of arbitrary objects is not just meaningless
* but also dangerous as most concrete implementations
* expect comparable objects as arguments often accessing
* instance variables directly.
* This method will be removed in a future release.
*/
- (NSComparisonResult) compare: (id)anObject
{
NSLog(@"WARNING: The -compare: method for NSObject is deprecated.");
if (anObject == self)
{
return NSOrderedSame;
}
if (anObject == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"nil argument for compare:"];
}
if ([self isEqual: anObject])
{
return NSOrderedSame;
}
/*
* Ordering objects by their address is pretty useless,
* so subclasses should override this is some useful way.
*/
if ((id)self > anObject)
{
return NSOrderedDescending;
}
else
{
return NSOrderedAscending;
}
}
@end

View file

@ -0,0 +1,113 @@
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "config.h"
#include "Foundation/Foundation.h"
#include "GNUstepBase/NSProcessInfo+GNUstepBase.h"
@implementation NSProcessInfo(GNUstepBase)
static NSMutableSet *_debug_set = nil;
static BOOL debugTemporarilyDisabled = NO;
BOOL GSDebugSet(NSString *level)
{
static IMP debugImp = 0;
static SEL debugSel;
if (debugTemporarilyDisabled == YES)
{
return NO;
}
if (debugImp == 0)
{
debugSel = @selector(member:);
if (_debug_set == nil)
{
[[NSProcessInfo processInfo] debugSet];
}
debugImp = [_debug_set methodForSelector: debugSel];
if (debugImp == 0)
{
fprintf(stderr, "Unable to set up with [NSProcessInfo-debugSet]\n");
return NO;
}
}
if ((*debugImp)(_debug_set, debugSel, level) == nil)
{
return NO;
}
return YES;
}
- (BOOL) debugLoggingEnabled
{
if (debugTemporarilyDisabled == YES)
{
return NO;
}
else
{
return YES;
}
}
- (NSMutableSet *) debugSet
{
if (_debug_set == nil)
{
int argc = [[self arguments] count];
NSMutableSet *mySet;
int i;
mySet = [NSMutableSet new];
for (i = 0; i < argc; i++)
{
NSString *str = [[self arguments] objectAtIndex:i];
if ([str hasPrefix: @"--GNU-Debug="])
[mySet addObject: [str substringFromIndex: 12]];
}
_debug_set = mySet;
}
return _debug_set;
}
- (void) setDebugLoggingEnabled: (BOOL)flag
{
if (flag == NO)
{
debugTemporarilyDisabled = YES;
}
else
{
debugTemporarilyDisabled = NO;
}
}
@end

View file

@ -1,4 +1,4 @@
/* Implementation of extension methods to NSStrings
/* Implementation of extension methods for base additions
Copyright (C) 2010 Free Software Foundation, Inc.
@ -26,6 +26,7 @@
#include <string.h>
#include "Foundation/Foundation.h"
#include "GNUstepBase/NSString+GNUstepBase.h"
#include "GNUstepBase/NSMutableString+GNUstepBase.h"
/* Test for ASCII whitespace which is safe for unicode characters */
#define space(C) ((C) > 127 ? NO : isspace(C))
@ -45,6 +46,31 @@
initWithFormat: format arguments: argList]);
}
#ifndef MAC_OS_X_VERSION_10_5
/**
* Returns YES when scanning the receiver's text from left to right finds a
* digit in the range 1-9 or a letter in the set ('Y', 'y', 'T', 't').<br />
* Any trailing characters are ignored.<br />
* Any leading whitespace or zeros or signs are also ignored.<br />
* Returns NO if the above conditions are not met.
*/
- (BOOL) boolValue
{
static NSCharacterSet *yes = nil;
if (yes == nil)
{
yes = RETAIN([NSCharacterSet characterSetWithCharactersInString:
@"123456789yYtT"]);
}
if ([self rangeOfCharacterFromSet: yes].length > 0)
{
return YES;
}
return NO;
}
#endif
/**
* Returns a string formed by removing the prefix string from the
* receiver. Raises an exception if the prefix is not present.
@ -195,4 +221,9 @@
return self;
}
- (NSString*) substringFromRange:(NSRange)range
{
return [self substringWithRange:range];
}
@end

View file

@ -1,4 +1,4 @@
/* Implementation of extension methods to NSTask
/* Implementation of extension methods for base additions
Copyright (C) 2010 Free Software Foundation, Inc.

View file

@ -0,0 +1,56 @@
/* Implementation of extension methods to base additions
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@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 Lesser 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 Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef GNUSTEP
#include "config.h"
#include "Foundation/Foundation.h"
#include "GNUstepBase/NSURL+GNUstepBase.h"
@implementation NSURL (GNUstepBase)
- (NSString*) fullPath
{
NSRange r;
NSString *s;
s = [self absoluteString];
if ((r = [s rangeOfString: @";"]).length > 0)
{
s = [s substringToIndex: r.location];
}
else if ((r = [s rangeOfString: @"?"]).length > 0)
{
s = [s substringToIndex: r.location];
}
r = [s rangeOfString: @"//"];
s = [s substringFromIndex: NSMaxRange(r)];
r = [s rangeOfString: @"/"];
s = [s substringFromIndex: r.location];
return s;
}
@end
#endif

View file

@ -126,9 +126,22 @@ GSFunctions.h \
GSMime.h \
GSXML.h \
GSLocale.h \
NSArray+GNUstepBase.h \
NSAttributedString+GNUstepBase.h \
NSBundle+GNUstepBase.h \
NSCalendarDate+GNUstepBase.h \
NSData+GNUstepBase.h \
NSFileHandle+GNUstepBase.h \
NSInvocation+GNUstepBase.h \
NSLock+GNUstepBase.h \
NSMutableString+GNUstepBase.h \
NSNumber+GNUstepBase.h \
NSObject+GNUstepBase.h \
NSProcessInfo+GNUstepBase.h \
NSRecursiveLock+GNUstepBase.h \
NSString+GNUstepBase.h \
NSTask+GNUstepBase.h \
NSURL+GNUstepBase.h \
Unicode.h \
GNUstep.h \
behavior.h \

View file

@ -45,6 +45,7 @@
#import "Foundation/NSValue.h"
#import "GNUstepBase/GSMime.h"
#import "GNUstepBase/GSLock.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#import "NSCallBacks.h"
#import "GSURLPrivate.h"
#import "GSPrivate.h"

View file

@ -52,6 +52,7 @@
#include "Foundation/NSPathUtilities.h"
#include "Foundation/NSData.h"
#include "Foundation/NSValue.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#include "GSPrivate.h"

View file

@ -39,6 +39,7 @@
#import "Foundation/NSLock.h"
#import "Foundation/NSDictionary.h"
#import "Foundation/NSValue.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#include <stdio.h>
#ifdef HAVE_BACKTRACE

View file

@ -37,6 +37,7 @@
#include "Foundation/NSAutoreleasePool.h"
#include "Foundation/NSData.h"
#include "Foundation/NSThread.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#ifdef HAVE_SYSLOG_H
#include <syslog.h>

View file

@ -74,7 +74,7 @@
#include "Foundation/NSValue.h"
#include "Foundation/NSLock.h"
#include "Foundation/NSUserDefaults.h"
#include "GNUstepBase/GSCategories.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#include "GSPrivate.h"

View file

@ -103,20 +103,21 @@
#undef id
#endif
#include "GNUstepBase/GSConfig.h"
#include "Foundation/NSString.h"
#include "Foundation/NSArray.h"
#include "Foundation/NSBundle.h"
#include "Foundation/NSSet.h"
#include "Foundation/NSDictionary.h"
#include "Foundation/NSDate.h"
#include "Foundation/NSException.h"
#include "Foundation/NSProcessInfo.h"
#include "Foundation/NSAutoreleasePool.h"
#include "Foundation/NSHost.h"
#include "Foundation/NSLock.h"
#include "Foundation/NSDebug.h"
#include "GNUstepBase/GSCategories.h"
#import "GNUstepBase/GSConfig.h"
#import "Foundation/NSString.h"
#import "Foundation/NSArray.h"
#import "Foundation/NSBundle.h"
#import "Foundation/NSSet.h"
#import "Foundation/NSDictionary.h"
#import "Foundation/NSDate.h"
#import "Foundation/NSException.h"
#import "Foundation/NSProcessInfo.h"
#import "Foundation/NSAutoreleasePool.h"
#import "Foundation/NSHost.h"
#import "Foundation/NSLock.h"
#import "Foundation/NSDebug.h"
#import "GNUstepBase/NSProcessInfo+GNUstepBase.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#include "GSPrivate.h"
@ -218,12 +219,10 @@ static unsigned int _operatingSystem = 0;
static NSString *_operatingSystemName = nil;
static NSString *_operatingSystemVersion = nil;
// Array of debug levels set.
static NSMutableSet *_debug_set = nil;
// Flag to indicate that fallbackInitialisation was executed.
static BOOL fallbackInitialisation = NO;
static NSMutableSet *mySet = nil;
/*************************************************************************
*** Implementing the gnustep_base_user_main function
*************************************************************************/
@ -310,15 +309,14 @@ _gnu_process_args(int argc, char *argv[], char *env[])
{
unichar **argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
NSString *str;
NSMutableSet *mySet;
id obj_argv[argc];
int added = 1;
mySet = [NSMutableSet new];
/* Copy the zero'th argument to the argument list */
obj_argv[0] = arg0;
if (mySet == nil) mySet = [NSMutableSet new];
for (i = 1; i < argc; i++)
{
str = [NSString stringWithCharacters: argvw[i] length: wcslen(argvw[i])];
@ -334,24 +332,21 @@ _gnu_process_args(int argc, char *argv[], char *env[])
IF_NO_GC(RELEASE(_gnu_arguments));
_gnu_arguments = [[NSArray alloc] initWithObjects: obj_argv count: added];
IF_NO_GC(RELEASE(_debug_set));
_debug_set = mySet;
RELEASE(arg0);
}
#else
if (argv)
{
NSString *str;
NSMutableSet *mySet;
id obj_argv[argc];
int added = 1;
NSStringEncoding enc = GSPrivateDefaultCStringEncoding();
mySet = [NSMutableSet new];
/* Copy the zero'th argument to the argument list */
obj_argv[0] = arg0;
if (mySet == nil) mySet = [NSMutableSet new];
for (i = 1; i < argc; i++)
{
str = [NSString stringWithCString: argv[i] encoding: enc];
@ -364,8 +359,6 @@ _gnu_process_args(int argc, char *argv[], char *env[])
IF_NO_GC(RELEASE(_gnu_arguments));
_gnu_arguments = [[NSArray alloc] initWithObjects: obj_argv count: added];
IF_NO_GC(RELEASE(_debug_set));
_debug_set = mySet;
RELEASE(arg0);
}
#endif
@ -939,7 +932,23 @@ int main(int argc, char *argv[], char *env[])
if (!_gnu_sharedProcessInfoObject)
{
_gnu_sharedProcessInfoObject = [[_NSConcreteProcessInfo alloc] init];
[gnustep_global_lock lock];
if (mySet != nil)
{
NSEnumerator *e = [mySet objectEnumerator];
NSMutableSet *s = [_gnu_sharedProcessInfoObject debugSet];
id o;
while ((o = [e nextObject]) != nil)
{
[s addObject: o];
}
[mySet release];
mySet = nil;
}
[gnustep_global_lock unlock];
}
return _gnu_sharedProcessInfoObject;
}
@ -1374,8 +1383,6 @@ GSInitializeProcess(int argc, char **argv, char **envp)
@implementation NSProcessInfo (GNUstep)
static BOOL debugTemporarilyDisabled = NO;
+ (void) initializeWithArguments: (char**)argv
count: (int)argc
environment: (char**)env
@ -1383,35 +1390,6 @@ static BOOL debugTemporarilyDisabled = NO;
GSInitializeProcess(argc, argv, env);
}
- (BOOL) debugLoggingEnabled
{
if (debugTemporarilyDisabled == YES)
{
return NO;
}
else
{
return YES;
}
}
- (NSMutableSet*) debugSet
{
return _debug_set;
}
- (void) setDebugLoggingEnabled: (BOOL)flag
{
if (flag == NO)
{
debugTemporarilyDisabled = YES;
}
else
{
debugTemporarilyDisabled = NO;
}
}
- (BOOL) setLogFile: (NSString*)path
{
extern int _NSLogDescriptor;
@ -1435,36 +1413,6 @@ static BOOL debugTemporarilyDisabled = NO;
}
@end
BOOL GSDebugSet(NSString *level)
{
static IMP debugImp = 0;
static SEL debugSel;
if (debugTemporarilyDisabled == YES)
{
return NO;
}
if (debugImp == 0)
{
debugSel = @selector(member:);
if (_debug_set == nil)
{
[[NSProcessInfo processInfo] debugSet];
}
debugImp = [_debug_set methodForSelector: debugSel];
if (debugImp == 0)
{
fprintf(stderr, "Unable to set up with [NSProcessInfo-debugSet]\n");
return NO;
}
}
if ((*debugImp)(_debug_set, debugSel, level) == nil)
{
return NO;
}
return YES;
}
BOOL
GSPrivateEnvironmentFlag(const char *name, BOOL def)
{

View file

@ -48,6 +48,8 @@
#import "Foundation/NSNull.h"
#import "Foundation/NSXMLParser.h"
#import "GNUstepBase/Unicode.h"
#import "GNUstepBase/NSProcessInfo+GNUstepBase.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#import "GSPrivate.h"

View file

@ -78,6 +78,8 @@
// For private method _decodePropertyListForKey:
#include "Foundation/NSKeyedArchiver.h"
#include "GNUstepBase/GSMime.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#import "GNUstepBase/NSMutableString+GNUstepBase.h"
#include "GSPrivate.h"
#ifdef HAVE_LIMITS_H
#include <limits.h>

View file

@ -77,37 +77,37 @@
FIXME?: use leap seconds? */
#include "config.h"
#include "GNUstepBase/preface.h"
#include "GNUstepBase/GSLock.h"
#import "GNUstepBase/preface.h"
#import "GNUstepBase/GSLock.h"
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "Foundation/NSArray.h"
#include "Foundation/NSCoder.h"
#include "Foundation/NSData.h"
#include "Foundation/NSDate.h"
#include "Foundation/NSDictionary.h"
#include "Foundation/NSException.h"
#include "Foundation/NSFileManager.h"
#include "Foundation/NSLock.h"
#include "Foundation/NSObject.h"
#include "Foundation/NSProcessInfo.h"
#include "Foundation/NSString.h"
#include "Foundation/NSUserDefaults.h"
#include "Foundation/NSZone.h"
#include "Foundation/NSBundle.h"
#include "Foundation/NSMapTable.h"
#include "Foundation/NSThread.h"
#include "Foundation/NSNotification.h"
#include "Foundation/NSPortCoder.h"
#include "Foundation/NSTimeZone.h"
#include "Foundation/NSByteOrder.h"
#include "Foundation/NSDebug.h"
#include "GNUstepBase/GSCategories.h"
#include "GNUstepBase/GSConfig.h"
#include "GSPrivate.h"
#import "Foundation/NSArray.h"
#import "Foundation/NSCoder.h"
#import "Foundation/NSData.h"
#import "Foundation/NSDate.h"
#import "Foundation/NSDictionary.h"
#import "Foundation/NSException.h"
#import "Foundation/NSFileManager.h"
#import "Foundation/NSLock.h"
#import "Foundation/NSObject.h"
#import "Foundation/NSProcessInfo.h"
#import "Foundation/NSString.h"
#import "Foundation/NSUserDefaults.h"
#import "Foundation/NSZone.h"
#import "Foundation/NSBundle.h"
#import "Foundation/NSMapTable.h"
#import "Foundation/NSThread.h"
#import "Foundation/NSNotification.h"
#import "Foundation/NSPortCoder.h"
#import "Foundation/NSTimeZone.h"
#import "Foundation/NSByteOrder.h"
#import "Foundation/NSDebug.h"
#import "GNUstepBase/GSConfig.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#import "GSPrivate.h"
#ifdef HAVE_TZHEAD
#include <tzfile.h>

View file

@ -34,6 +34,7 @@
#import "GSPrivate.h"
#import "GSURLPrivate.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
/* Define to 1 for experimental (net yet working) compression support
*/

View file

@ -33,28 +33,30 @@
#include <sys/types.h>
#include <errno.h>
#include "Foundation/NSUserDefaults.h"
#include "Foundation/NSArchiver.h"
#include "Foundation/NSArray.h"
#include "Foundation/NSData.h"
#include "Foundation/NSDate.h"
#include "Foundation/NSDictionary.h"
#include "Foundation/NSDistributedLock.h"
#include "Foundation/NSException.h"
#include "Foundation/NSFileManager.h"
#include "Foundation/NSLock.h"
#include "Foundation/NSNotification.h"
#include "Foundation/NSPathUtilities.h"
#include "Foundation/NSProcessInfo.h"
#include "Foundation/NSPropertyList.h"
#include "Foundation/NSRunLoop.h"
#include "Foundation/NSSet.h"
#include "Foundation/NSThread.h"
#include "Foundation/NSTimer.h"
#include "Foundation/NSValue.h"
#include "Foundation/NSDebug.h"
#include "GNUstepBase/GSLocale.h"
#include "GNUstepBase/GSLock.h"
#import "Foundation/NSUserDefaults.h"
#import "Foundation/NSArchiver.h"
#import "Foundation/NSArray.h"
#import "Foundation/NSData.h"
#import "Foundation/NSDate.h"
#import "Foundation/NSDictionary.h"
#import "Foundation/NSDistributedLock.h"
#import "Foundation/NSException.h"
#import "Foundation/NSFileManager.h"
#import "Foundation/NSLock.h"
#import "Foundation/NSNotification.h"
#import "Foundation/NSPathUtilities.h"
#import "Foundation/NSProcessInfo.h"
#import "Foundation/NSPropertyList.h"
#import "Foundation/NSRunLoop.h"
#import "Foundation/NSSet.h"
#import "Foundation/NSThread.h"
#import "Foundation/NSTimer.h"
#import "Foundation/NSValue.h"
#import "Foundation/NSDebug.h"
#import "GNUstepBase/GSLocale.h"
#import "GNUstepBase/GSLock.h"
#import "GNUstepBase/NSProcessInfo+GNUstepBase.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#if defined(__MINGW32__)
@class NSUserDefaultsWin32;

View file

@ -21,9 +21,10 @@
*/
#include <Foundation/Foundation.h>
#include "AGSHtml.h"
#include "GNUstepBase/GNUstep.h"
#include "GNUstepBase/GSCategories.h"
#import "AGSHtml.h"
#import "GNUstepBase/GNUstep.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#import "GNUstepBase/NSMutableString+GNUstepBase.h"
/*
* Define constants for use if we are built with apple Foundation

View file

@ -20,10 +20,11 @@
*/
#include <Foundation/Foundation.h>
#include "AGSIndex.h"
#include "GNUstepBase/GNUstep.h"
#include "GNUstepBase/GSCategories.h"
#import <Foundation/Foundation.h>
#import "AGSIndex.h"
#import "GNUstepBase/GNUstep.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#import "GNUstepBase/NSMutableString+GNUstepBase.h"
static int XML_ELEMENT_NODE;
static int XML_TEXT_NODE;

View file

@ -20,9 +20,10 @@
*/
#include "AGSOutput.h"
#include "GNUstepBase/GNUstep.h"
#include "GNUstepBase/GSCategories.h"
#import "AGSOutput.h"
#import "GNUstepBase/GNUstep.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#import "GNUstepBase/NSMutableString+GNUstepBase.h"
@interface AGSOutput (Private)
- (NSString*) mergeMarkup: (NSString*)markup

View file

@ -18,9 +18,10 @@
*/
#include "AGSParser.h"
#include "GNUstepBase/GNUstep.h"
#include "GNUstepBase/GSCategories.h"
#import "AGSParser.h"
#import "GNUstepBase/GNUstep.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#import "GNUstepBase/NSMutableString+GNUstepBase.h"
/**
* The AGSParser class parses Objective-C header and source files

View file

@ -599,14 +599,13 @@
#include <config.h>
#include "AGSParser.h"
#include "AGSOutput.h"
#include "AGSIndex.h"
#include "AGSHtml.h"
#include "GNUstepBase/GNUstep.h"
#ifdef NeXT_Foundation_LIBRARY
#include "GNUstepBase/GSCategories.h"
#endif
#import "AGSParser.h"
#import "AGSOutput.h"
#import "AGSIndex.h"
#import "AGSHtml.h"
#import "GNUstepBase/GNUstep.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#import "GNUstepBase/NSMutableString+GNUstepBase.h"
/** Invokes the autogsdoc tool. */
int