mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
* Headers/Additions/GNUstepBase/GSCategories.h: Move
declarations from Source/Additions/GSCompatibility.h to here. ([NSObject -compare:]): Deprecate. * Source/Additions/GSCompatibility.h: Move contents from here to Headers/Additions/GNUstepBase/GSCategories.h. * Source/Additions/GSCategories.m: ([NSObject -compare:]): Deprecate. * Headers/Foundation/NSObject.h ([NSObject -compare:]): Deprecate. * Source/Additions/GCDictionary.m: Include GNUstepBase/GSCategories.h rather than GSCompatibility.h. * Source/Additions/GCObject.m: Ditto. * Source/Additions/GSMime.m: Ditto. * Source/Additions/GSObjCRuntime.m: Ditto. * Source/Additions/GSXML.m: Ditto. * Source/Additions/Unicode.m: Ditto. * macosx/GNUstepBase/preface.h: Update include for new header structure. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17664 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
03b62c3e6f
commit
cb5b1310d0
13 changed files with 290 additions and 239 deletions
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
||||||
|
2003-09-13 David Ayers <d.ayers@inode.at>
|
||||||
|
|
||||||
|
* Headers/Additions/GNUstepBase/GSCategories.h: Move declarations
|
||||||
|
from Source/Additions/GSCompatibility.h to here.
|
||||||
|
([NSObject -compare:]): Deprecate.
|
||||||
|
* Source/Additions/GSCompatibility.h: Move contents from here to
|
||||||
|
Headers/Additions/GNUstepBase/GSCategories.h.
|
||||||
|
|
||||||
|
* Source/Additions/GSCategories.m:
|
||||||
|
([NSObject -compare:]): Deprecate.
|
||||||
|
|
||||||
|
* Headers/Foundation/NSObject.h
|
||||||
|
([NSObject -compare:]): Deprecate.
|
||||||
|
|
||||||
|
* Source/Additions/GCDictionary.m: Include
|
||||||
|
GNUstepBase/GSCategories.h rather than GSCompatibility.h.
|
||||||
|
* Source/Additions/GCObject.m: Ditto.
|
||||||
|
* Source/Additions/GSMime.m: Ditto.
|
||||||
|
* Source/Additions/GSObjCRuntime.m: Ditto.
|
||||||
|
* Source/Additions/GSXML.m: Ditto.
|
||||||
|
* Source/Additions/Unicode.m: Ditto.
|
||||||
|
|
||||||
|
* macosx/GNUstepBase/preface.h: Update include for new header
|
||||||
|
structure.
|
||||||
|
|
||||||
2003-09-11 Adam Fedor <fedor@gnu.org>
|
2003-09-11 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* macosx/preface.h: Removed
|
* macosx/preface.h: Removed
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
#ifndef INCLUDED_GS_CATEGORIES_H
|
|
||||||
#define INCLUDED_GS_CATEGORIES_H
|
|
||||||
/** Declaration of extension methods and functions for standard classes
|
/** Declaration of extension methods and functions for standard classes
|
||||||
|
|
||||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
and: Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
This file is part of the GNUstep Base Library.
|
This file is part of the GNUstep Base Library.
|
||||||
|
|
||||||
|
@ -26,6 +25,8 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef INCLUDED_GS_CATEGORIES_H
|
||||||
|
#define INCLUDED_GS_CATEGORIES_H
|
||||||
|
|
||||||
/* The following ifndef prevents the categories declared in this file being
|
/* The following ifndef prevents the categories declared in this file being
|
||||||
* seen in GNUstep code. This is necessary because those category
|
* seen in GNUstep code. This is necessary because those category
|
||||||
|
@ -34,10 +35,150 @@
|
||||||
* are only needed for software using the GNUstep Additions library
|
* are only needed for software using the GNUstep Additions library
|
||||||
* without the main GNUstep base library.
|
* without the main GNUstep base library.
|
||||||
*/
|
*/
|
||||||
#ifndef GNUSTEP
|
#ifndef GNUSTEP
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
#include <Foundation/Foundation.h>
|
#include <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
#ifdef NeXT_Foundation_LIBRARY
|
||||||
|
#include <CoreFoundation/CFString.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "GNUstepBase/preface.h"
|
||||||
|
#include "GNUstepBase/GSObjCRuntime.h"
|
||||||
|
#include "GNUstepBase/GNUstep.h"
|
||||||
|
|
||||||
|
@class NSMutableSet;
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
* Macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Following are also defined in base/Headers/Foundation/NSObject.h
|
||||||
|
#define IF_NO_GC(x) \
|
||||||
|
x
|
||||||
|
|
||||||
|
// Following are also defined in base/Headers/Foundation/NSDebug.h
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define NSDebugLLog(level, format, args...) \
|
||||||
|
do { if (GSDebugSet(level) == YES) \
|
||||||
|
NSLog(format , ## args); } while (0)
|
||||||
|
|
||||||
|
#define NSDebugLog(format, args...) \
|
||||||
|
do { if (GSDebugSet(@"dflt") == YES) \
|
||||||
|
NSLog(format , ## args); } while (0)
|
||||||
|
|
||||||
|
#define NSDebugFLLog(level, format, args...) \
|
||||||
|
do { if (GSDebugSet(level) == YES) { \
|
||||||
|
NSString *fmt = GSDebugFunctionMsg( \
|
||||||
|
__PRETTY_FUNCTION__, __FILE__, __LINE__, format); \
|
||||||
|
NSLog(fmt , ## args); }} while (0)
|
||||||
|
|
||||||
|
#define NSDebugFLog(format, args...) \
|
||||||
|
do { if (GSDebugSet(@"dflt") == YES) { \
|
||||||
|
NSString *fmt = GSDebugFunctionMsg( \
|
||||||
|
__PRETTY_FUNCTION__, __FILE__, __LINE__, format); \
|
||||||
|
NSLog(fmt , ## args); }} while (0)
|
||||||
|
|
||||||
|
#define NSDebugMLLog(level, format, args...) \
|
||||||
|
do { if (GSDebugSet(level) == YES) { \
|
||||||
|
NSString *fmt = GSDebugMethodMsg( \
|
||||||
|
self, _cmd, __FILE__, __LINE__, format); \
|
||||||
|
NSLog(fmt , ## args); }} while (0)
|
||||||
|
|
||||||
|
#define NSDebugMLog(format, args...) \
|
||||||
|
do { if (GSDebugSet(@"dflt") == YES) { \
|
||||||
|
NSString *fmt = GSDebugMethodMsg( \
|
||||||
|
self, _cmd, __FILE__, __LINE__, format); \
|
||||||
|
NSLog(fmt , ## args); }} while (0)
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define NSDebugLLog(level, format, args...)
|
||||||
|
#define NSDebugLog(format, args...)
|
||||||
|
#define NSDebugFLLog(level, format, args...)
|
||||||
|
#define NSDebugFLog(format, args...)
|
||||||
|
#define NSDebugMLLog(level, format, args...)
|
||||||
|
#define NSDebugMLog(format, args...)
|
||||||
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
#ifdef GSWARN
|
||||||
|
#define NSWarnLog(format, args...) \
|
||||||
|
do { if (GSDebugSet(@"NoWarn") == NO) { \
|
||||||
|
NSLog(format , ## args); }} while (0)
|
||||||
|
|
||||||
|
#define NSWarnFLog(format, args...) \
|
||||||
|
do { if (GSDebugSet(@"NoWarn") == NO) { \
|
||||||
|
NSString *fmt = GSDebugFunctionMsg( \
|
||||||
|
__PRETTY_FUNCTION__, __FILE__, __LINE__, format); \
|
||||||
|
NSLog(fmt , ## args); }} while (0)
|
||||||
|
|
||||||
|
#define NSWarnMLog(format, args...) \
|
||||||
|
do { if (GSDebugSet(@"NoWarn") == NO) { \
|
||||||
|
NSString *fmt = GSDebugMethodMsg( \
|
||||||
|
self, _cmd, __FILE__, __LINE__, format); \
|
||||||
|
NSLog(fmt , ## args); }} while (0)
|
||||||
|
#else
|
||||||
|
#define NSWarnLog(format, args...)
|
||||||
|
#define NSWarnFLog(format, args...)
|
||||||
|
#define NSWarnMLog(format, args...)
|
||||||
|
#endif /* GSWARN */
|
||||||
|
|
||||||
|
#define GS_RANGE_CHECK(RANGE, SIZE) \
|
||||||
|
if (RANGE.location > SIZE || RANGE.length > (SIZE - RANGE.location)) \
|
||||||
|
[NSException raise: NSRangeException \
|
||||||
|
format: @"in %s, range { %u, %u } extends beyond size (%u)", \
|
||||||
|
GSNameFromSelector(_cmd), RANGE.location, RANGE.length, SIZE]
|
||||||
|
|
||||||
|
/* Taken from base/Headers/Foundation/NSString.h */
|
||||||
|
typedef enum _NSGNUstepStringEncoding
|
||||||
|
{
|
||||||
|
/* NB. Must not have an encoding with value zero - so we can use zero to
|
||||||
|
tell that a variable that should contain an encoding has not yet been
|
||||||
|
initialised */
|
||||||
|
GSUndefinedEncoding = 0,
|
||||||
|
|
||||||
|
// GNUstep additions
|
||||||
|
NSKOI8RStringEncoding = 50, // Russian/Cyrillic
|
||||||
|
NSISOLatin3StringEncoding = 51, // ISO-8859-3; South European
|
||||||
|
NSISOLatin4StringEncoding = 52, // ISO-8859-4; North European
|
||||||
|
NSISOCyrillicStringEncoding = 22, // ISO-8859-5
|
||||||
|
NSISOArabicStringEncoding = 53, // ISO-8859-6
|
||||||
|
NSISOGreekStringEncoding = 54, // ISO-8859-7
|
||||||
|
NSISOHebrewStringEncoding = 55, // ISO-8859-8
|
||||||
|
NSISOLatin5StringEncoding = 57, // ISO-8859-9; Turkish
|
||||||
|
NSISOLatin6StringEncoding = 58, // ISO-8859-10; Nordic
|
||||||
|
NSISOThaiStringEncoding = 59, // ISO-8859-11
|
||||||
|
/* Possible future ISO-8859 additions
|
||||||
|
// ISO-8859-12
|
||||||
|
*/
|
||||||
|
NSISOLatin7StringEncoding = 61, // ISO-8859-13
|
||||||
|
NSISOLatin8StringEncoding = 62, // ISO-8859-14
|
||||||
|
NSISOLatin9StringEncoding = 63, // ISO-8859-15; Replaces ISOLatin1
|
||||||
|
NSGB2312StringEncoding = 56,
|
||||||
|
NSUTF7StringEncoding = 64, // RFC 2152
|
||||||
|
NSGSM0338StringEncoding, // GSM (mobile phone) default alphabet
|
||||||
|
NSBIG5StringEncoding // Traditional chinese
|
||||||
|
} NSGNUstepStringEncoding;
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
* Variables
|
||||||
|
*/
|
||||||
|
|
||||||
|
GS_EXPORT NSRecursiveLock *gnustep_global_lock;
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
* Class/Method Extensions
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
GSCategory extensions are implemented in
|
||||||
|
Source/Additions/GSCategory.m
|
||||||
|
for both gnustep-base and gnustep-baseadd.
|
||||||
|
*/
|
||||||
|
|
||||||
@interface NSCalendarDate (GSCategories)
|
@interface NSCalendarDate (GSCategories)
|
||||||
- (int) weekOfYear;
|
- (int) weekOfYear;
|
||||||
@end
|
@end
|
||||||
|
@ -76,10 +217,100 @@
|
||||||
- notImplemented:(SEL)aSel;
|
- notImplemented:(SEL)aSel;
|
||||||
- (id) subclassResponsibility: (SEL)aSel;
|
- (id) subclassResponsibility: (SEL)aSel;
|
||||||
- (id) shouldNotImplement: (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;
|
- (NSComparisonResult) compare: (id)anObject;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
/*
|
||||||
|
GSCompatibility methods are implemented in
|
||||||
|
Source/Additions/GSCompatibility.m
|
||||||
|
for gnustep-baseadd only.
|
||||||
|
The implementations for gnustep-base reside in the
|
||||||
|
corresponding source files of -base.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@interface NSArray (GSCompatibility)
|
||||||
|
- (id) initWithArray: (NSArray*)array copyItems: (BOOL)shouldCopy;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSBundle(GSCompatibility)
|
||||||
|
+ (NSString *) pathForLibraryResource: (NSString *)name
|
||||||
|
ofType: (NSString *)ext
|
||||||
|
inDirectory: (NSString *)bundlePath;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSDistantObject (GSCompatibility)
|
||||||
|
+ (void) setDebug: (int)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
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
* Functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Similar to the GSCompatibility methods,
|
||||||
|
these functions are implemented in
|
||||||
|
Source/Additions/GSCompatibility.m
|
||||||
|
for gnustep-baseadd only.
|
||||||
|
The implementations for gnustep-base reside in the
|
||||||
|
corresponding source files of -base.
|
||||||
|
*/
|
||||||
|
GS_EXPORT NSArray *NSStandardLibraryPaths();
|
||||||
|
GS_EXPORT void NSDecimalFromComponents(NSDecimal *result,
|
||||||
|
unsigned long long mantissa,
|
||||||
|
short exponent, BOOL negative);
|
||||||
|
|
||||||
|
GS_EXPORT BOOL GSDebugSet(NSString *level);
|
||||||
|
|
||||||
|
GS_EXPORT NSString *GetEncodingName(NSStringEncoding availableEncodingValue);
|
||||||
|
GS_EXPORT NSString *GSEncodingName(NSStringEncoding availableEncodingValue);
|
||||||
|
|
||||||
|
GS_EXPORT NSMutableDictionary *GSCurrentThreadDictionary();
|
||||||
|
|
||||||
|
GS_EXPORT NSString *GSDebugMethodMsg(id obj, SEL sel, const char *file,
|
||||||
|
int line, NSString *fmt);
|
||||||
|
GS_EXPORT NSString *GSDebugFunctionMsg(const char *func, const char *file,
|
||||||
|
int line, NSString *fmt);
|
||||||
|
|
||||||
#endif /* GNUSTEP */
|
#endif /* GNUSTEP */
|
||||||
|
|
||||||
#endif /* INCLUDED_GS_CATEGORIES_H */
|
#endif /* INCLUDED_GS_CATEGORIES_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -295,6 +295,16 @@ GS_EXPORT NSRecursiveLock *gnustep_global_lock;
|
||||||
- notImplemented:(SEL)aSel;
|
- notImplemented:(SEL)aSel;
|
||||||
- (id) subclassResponsibility: (SEL)aSel;
|
- (id) subclassResponsibility: (SEL)aSel;
|
||||||
- (id) shouldNotImplement: (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;
|
- (NSComparisonResult) compare: (id)anObject;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#include "GNUstepBase/GSObjCRuntime.h"
|
#include "GNUstepBase/GSObjCRuntime.h"
|
||||||
#include "GNUstepBase/GCObject.h"
|
#include "GNUstepBase/GCObject.h"
|
||||||
#include "GSCompatibility.h"
|
#include "GNUstepBase/GSCategories.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
id object;
|
id object;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "GNUstepBase/GCObject.h"
|
#include "GNUstepBase/GCObject.h"
|
||||||
#include "GSCompatibility.h"
|
#include "GNUstepBase/GSCategories.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The head of a linked list of all garbage collecting objects is a
|
* The head of a linked list of all garbage collecting objects is a
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <Foundation/Foundation.h>
|
#include <Foundation/Foundation.h>
|
||||||
#include "GNUstepBase/GSCategories.h"
|
#include "GNUstepBase/GSCategories.h"
|
||||||
#include "GSCompatibility.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension methods for the NSCalendarDate class
|
* Extension methods for the NSCalendarDate class
|
||||||
|
@ -570,11 +569,19 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare the receiver with anObject to see which is greater.
|
* WARNING: The -compare: method for NSObject is deprecated
|
||||||
* The default implementation orders by memory location.
|
* 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.
|
||||||
*/
|
*/
|
||||||
- (int) compare: (id)anObject
|
- (NSComparisonResult) compare: (id)anObject
|
||||||
{
|
{
|
||||||
|
NSLog(@"WARNING: The -compare: method for NSObject is deprecated.");
|
||||||
|
|
||||||
if (anObject == self)
|
if (anObject == self)
|
||||||
{
|
{
|
||||||
return NSOrderedSame;
|
return NSOrderedSame;
|
||||||
|
@ -582,21 +589,21 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
|
||||||
if (anObject == nil)
|
if (anObject == nil)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"nil argument for compare:"];
|
format: @"nil argument for compare:"];
|
||||||
}
|
}
|
||||||
if ([self isEqual: anObject])
|
if ([self isEqual: anObject])
|
||||||
{
|
{
|
||||||
return NSOrderedSame;
|
return NSOrderedSame;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Ordering objects by their address is pretty useless,
|
* Ordering objects by their address is pretty useless,
|
||||||
* so subclasses should override this is some useful way.
|
* so subclasses should override this is some useful way.
|
||||||
*/
|
*/
|
||||||
if (self > anObject)
|
if (self > anObject)
|
||||||
{
|
{
|
||||||
return NSOrderedDescending;
|
return NSOrderedDescending;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return NSOrderedAscending;
|
return NSOrderedAscending;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,221 +1 @@
|
||||||
/* GSCompatibility - Extra definitions for compiling on MacOSX
|
#error This file is obsolete.
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef GSCompatibility_H_INCLUDE
|
|
||||||
#define GSCompatibility_H_INCLUDE
|
|
||||||
|
|
||||||
#ifdef NeXT_Foundation_LIBRARY
|
|
||||||
#include <string.h>
|
|
||||||
#include <Foundation/Foundation.h>
|
|
||||||
#include <CoreFoundation/CFString.h>
|
|
||||||
#include "GNUstepBase/preface.h"
|
|
||||||
#include "GNUstepBase/GSObjCRuntime.h"
|
|
||||||
#include "GNUstepBase/GNUstep.h"
|
|
||||||
|
|
||||||
@class NSMutableSet;
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
* Macros
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Following are also defined in base/Headers/Foundation/NSObject.h
|
|
||||||
#define IF_NO_GC(x) \
|
|
||||||
x
|
|
||||||
|
|
||||||
// Following are also defined in base/Headers/Foundation/NSDebug.h
|
|
||||||
#ifdef DEBUG
|
|
||||||
#define NSDebugLLog(level, format, args...) \
|
|
||||||
do { if (GSDebugSet(level) == YES) \
|
|
||||||
NSLog(format , ## args); } while (0)
|
|
||||||
|
|
||||||
#define NSDebugLog(format, args...) \
|
|
||||||
do { if (GSDebugSet(@"dflt") == YES) \
|
|
||||||
NSLog(format , ## args); } while (0)
|
|
||||||
|
|
||||||
#define NSDebugFLLog(level, format, args...) \
|
|
||||||
do { if (GSDebugSet(level) == YES) { \
|
|
||||||
NSString *fmt = GSDebugFunctionMsg( \
|
|
||||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, format); \
|
|
||||||
NSLog(fmt , ## args); }} while (0)
|
|
||||||
|
|
||||||
#define NSDebugFLog(format, args...) \
|
|
||||||
do { if (GSDebugSet(@"dflt") == YES) { \
|
|
||||||
NSString *fmt = GSDebugFunctionMsg( \
|
|
||||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, format); \
|
|
||||||
NSLog(fmt , ## args); }} while (0)
|
|
||||||
|
|
||||||
#define NSDebugMLLog(level, format, args...) \
|
|
||||||
do { if (GSDebugSet(level) == YES) { \
|
|
||||||
NSString *fmt = GSDebugMethodMsg( \
|
|
||||||
self, _cmd, __FILE__, __LINE__, format); \
|
|
||||||
NSLog(fmt , ## args); }} while (0)
|
|
||||||
|
|
||||||
#define NSDebugMLog(format, args...) \
|
|
||||||
do { if (GSDebugSet(@"dflt") == YES) { \
|
|
||||||
NSString *fmt = GSDebugMethodMsg( \
|
|
||||||
self, _cmd, __FILE__, __LINE__, format); \
|
|
||||||
NSLog(fmt , ## args); }} while (0)
|
|
||||||
|
|
||||||
#else
|
|
||||||
#define NSDebugLLog(level, format, args...)
|
|
||||||
#define NSDebugLog(format, args...)
|
|
||||||
#define NSDebugFLLog(level, format, args...)
|
|
||||||
#define NSDebugFLog(format, args...)
|
|
||||||
#define NSDebugMLLog(level, format, args...)
|
|
||||||
#define NSDebugMLog(format, args...)
|
|
||||||
#endif /* DEBUG */
|
|
||||||
|
|
||||||
#ifdef GSWARN
|
|
||||||
#define NSWarnLog(format, args...) \
|
|
||||||
do { if (GSDebugSet(@"NoWarn") == NO) { \
|
|
||||||
NSLog(format , ## args); }} while (0)
|
|
||||||
|
|
||||||
#define NSWarnFLog(format, args...) \
|
|
||||||
do { if (GSDebugSet(@"NoWarn") == NO) { \
|
|
||||||
NSString *fmt = GSDebugFunctionMsg( \
|
|
||||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, format); \
|
|
||||||
NSLog(fmt , ## args); }} while (0)
|
|
||||||
|
|
||||||
#define NSWarnMLog(format, args...) \
|
|
||||||
do { if (GSDebugSet(@"NoWarn") == NO) { \
|
|
||||||
NSString *fmt = GSDebugMethodMsg( \
|
|
||||||
self, _cmd, __FILE__, __LINE__, format); \
|
|
||||||
NSLog(fmt , ## args); }} while (0)
|
|
||||||
#else
|
|
||||||
#define NSWarnLog(format, args...)
|
|
||||||
#define NSWarnFLog(format, args...)
|
|
||||||
#define NSWarnMLog(format, args...)
|
|
||||||
#endif /* GSWARN */
|
|
||||||
|
|
||||||
#define GS_RANGE_CHECK(RANGE, SIZE) \
|
|
||||||
if (RANGE.location > SIZE || RANGE.length > (SIZE - RANGE.location)) \
|
|
||||||
[NSException raise: NSRangeException \
|
|
||||||
format: @"in %s, range { %u, %u } extends beyond size (%u)", \
|
|
||||||
GSNameFromSelector(_cmd), RANGE.location, RANGE.length, SIZE]
|
|
||||||
|
|
||||||
/* Taken from base/Headers/Foundation/NSString.h */
|
|
||||||
typedef enum _NSGNUstepStringEncoding
|
|
||||||
{
|
|
||||||
/* NB. Must not have an encoding with value zero - so we can use zero to
|
|
||||||
tell that a variable that should contain an encoding has not yet been
|
|
||||||
initialised */
|
|
||||||
GSUndefinedEncoding = 0,
|
|
||||||
|
|
||||||
// GNUstep additions
|
|
||||||
NSKOI8RStringEncoding = 50, // Russian/Cyrillic
|
|
||||||
NSISOLatin3StringEncoding = 51, // ISO-8859-3; South European
|
|
||||||
NSISOLatin4StringEncoding = 52, // ISO-8859-4; North European
|
|
||||||
NSISOCyrillicStringEncoding = 22, // ISO-8859-5
|
|
||||||
NSISOArabicStringEncoding = 53, // ISO-8859-6
|
|
||||||
NSISOGreekStringEncoding = 54, // ISO-8859-7
|
|
||||||
NSISOHebrewStringEncoding = 55, // ISO-8859-8
|
|
||||||
NSISOLatin5StringEncoding = 57, // ISO-8859-9; Turkish
|
|
||||||
NSISOLatin6StringEncoding = 58, // ISO-8859-10; Nordic
|
|
||||||
NSISOThaiStringEncoding = 59, // ISO-8859-11
|
|
||||||
/* Possible future ISO-8859 additions
|
|
||||||
// ISO-8859-12
|
|
||||||
*/
|
|
||||||
NSISOLatin7StringEncoding = 61, // ISO-8859-13
|
|
||||||
NSISOLatin8StringEncoding = 62, // ISO-8859-14
|
|
||||||
NSISOLatin9StringEncoding = 63, // ISO-8859-15; Replaces ISOLatin1
|
|
||||||
NSGB2312StringEncoding = 56,
|
|
||||||
NSUTF7StringEncoding = 64, // RFC 2152
|
|
||||||
NSGSM0338StringEncoding, // GSM (mobile phone) default alphabet
|
|
||||||
NSBIG5StringEncoding, // Traditional chinese
|
|
||||||
NSKoreanEUCEncoding // Korean
|
|
||||||
} NSGNUstepStringEncoding;
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
* Variables
|
|
||||||
*/
|
|
||||||
GS_EXPORT NSRecursiveLock *gnustep_global_lock;
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
* Class/Method Extensions
|
|
||||||
*/
|
|
||||||
|
|
||||||
@interface NSObject(GSCompatibility)
|
|
||||||
+ (id) notImplemented:(SEL)selector;
|
|
||||||
- (BOOL) isInstance;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface NSArray (GSCompatibility)
|
|
||||||
- (id) initWithArray: (NSArray*)array copyItems: (BOOL)shouldCopy;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface NSBundle(GSCompatibility)
|
|
||||||
+ (NSString *) pathForLibraryResource: (NSString *)name
|
|
||||||
ofType: (NSString *)ext
|
|
||||||
inDirectory: (NSString *)bundlePath;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface NSDistantObject (GSCompatibility)
|
|
||||||
+ (void) setDebug: (int)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 NSString(GSCompatibility)
|
|
||||||
- (BOOL) boolValue;
|
|
||||||
- (NSString*) substringFromRange:(NSRange)range;
|
|
||||||
@end
|
|
||||||
|
|
||||||
GS_EXPORT BOOL GSDebugSet(NSString *level);
|
|
||||||
@interface NSProcessInfo(GSCompatibility)
|
|
||||||
- (NSMutableSet *) debugSet;
|
|
||||||
@end
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
* Functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
GS_EXPORT NSArray *NSStandardLibraryPaths();
|
|
||||||
GS_EXPORT void NSDecimalFromComponents(NSDecimal *result,
|
|
||||||
unsigned long long mantissa,
|
|
||||||
short exponent, BOOL negative);
|
|
||||||
GS_EXPORT NSString *GetEncodingName(NSStringEncoding availableEncodingValue);
|
|
||||||
GS_EXPORT NSString *GSEncodingName(NSStringEncoding availableEncodingValue);
|
|
||||||
|
|
||||||
GS_EXPORT NSMutableDictionary *GSCurrentThreadDictionary();
|
|
||||||
|
|
||||||
GS_EXPORT NSString *GSDebugMethodMsg(id obj, SEL sel, const char *file,
|
|
||||||
int line, NSString *fmt);
|
|
||||||
GS_EXPORT NSString *GSDebugFunctionMsg(const char *func, const char *file,
|
|
||||||
int line, NSString *fmt);
|
|
||||||
|
|
||||||
#endif /* NexT_FOUNDATION_LIB */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <objc/objc-class.h>
|
#include <objc/objc-class.h>
|
||||||
#include "GSCompatibility.h"
|
|
||||||
#include "GNUstepBase/GSCategories.h"
|
#include "GNUstepBase/GSCategories.h"
|
||||||
#include "GNUstepBase/GCObject.h"
|
#include "GNUstepBase/GCObject.h"
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,6 @@
|
||||||
#include "GNUstepBase/GSCategories.h"
|
#include "GNUstepBase/GSCategories.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "GSCompatibility.h"
|
|
||||||
|
|
||||||
static NSCharacterSet *whitespace = nil;
|
static NSCharacterSet *whitespace = nil;
|
||||||
static NSCharacterSet *rfc822Specials = nil;
|
static NSCharacterSet *rfc822Specials = nil;
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "GNUstepBase/GSObjCRuntime.h"
|
#include "GNUstepBase/GSObjCRuntime.h"
|
||||||
#include "GNUstepBase/GNUstep.h"
|
#include "GNUstepBase/GNUstep.h"
|
||||||
#include "GSCompatibility.h"
|
#include "GNUstepBase/GSCategories.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@class NSNull;
|
@class NSNull;
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "GSCompatibility.h"
|
#include "GNUstepBase/GSCategories.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIBXML
|
#ifdef HAVE_LIBXML
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#else
|
#else
|
||||||
#include <Foundation/Foundation.h>
|
#include <Foundation/Foundation.h>
|
||||||
#endif
|
#endif
|
||||||
#include "GSCompatibility.h"
|
#include "GNUstepBase/GSCategories.h"
|
||||||
#include "GNUstepBase/Unicode.h"
|
#include "GNUstepBase/Unicode.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <gnustep/base/objc-gnu2next.h>
|
#include <GNUstepBase/objc-gnu2next.h>
|
||||||
|
|
||||||
#if defined(__WIN32__) || defined(_WIN32) || defined(__MS_WIN32__)
|
#if defined(__WIN32__) || defined(_WIN32) || defined(__MS_WIN32__)
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue