Commit 0efbd66e by Iain Sandoe Committed by Iain Sandoe

[objective-c/c++, testsuite, 1/3] Workaround for PR90709.

Since we cannot parse the current NeXT headers, because of PR90709 and its
dependents, we have a large amount of testsuite noise for Darwin platforms.
In order to restore the usefulness of the testsuite, we are going add headers
without the modern syntax elements that trigger the bug, and use these for
test runs on newer Darwin.

The headers are imported from GNUStep, with some local modifications to make
sure that __BLOCKS__ is honoured as a gate for Apple-style blocks closures.

CF-CFString.h, F-NS*.h are proxy headers that use the installed CoreFoundation
or Foundation headers on systems <= Darwin12 and the GNUStep headers for newer.

2019-06-15  Iain Sandoe  <iain@sandoe.co.uk>

	PR objc/90709
	* objc-obj-c++-shared/CF-CFString.h: New.
	* objc-obj-c++-shared/F-NSArray.h: New.
	* objc-obj-c++-shared/F-NSAutoreleasePool.h: New.
	* objc-obj-c++-shared/F-NSObject.h: New.
	* objc-obj-c++-shared/F-NSString.h: New.
	* objc-obj-c++-shared/F-NSValue.h: New.
	* objc-obj-c++-shared/GNUStep/CoreFoundation/CFArray.h: New.
	* objc-obj-c++-shared/GNUStep/CoreFoundation/CFAvailability.h: New.
	* objc-obj-c++-shared/GNUStep/CoreFoundation/CFBase.h: New.
	* objc-obj-c++-shared/GNUStep/CoreFoundation/CFCharacterSet.h: New.
	* objc-obj-c++-shared/GNUStep/CoreFoundation/CFData.h: New.
	* objc-obj-c++-shared/GNUStep/CoreFoundation/CFDictionary.h: New.
	* objc-obj-c++-shared/GNUStep/CoreFoundation/CFLocale.h: New.
	* objc-obj-c++-shared/GNUStep/CoreFoundation/CFString.h: New.
	* objc-obj-c++-shared/GNUStep/Foundation/NSArray.h: New.
	* objc-obj-c++-shared/GNUStep/Foundation/NSAutoreleasePool.h: New.
	* objc-obj-c++-shared/GNUStep/Foundation/NSDate.h: New.
	* objc-obj-c++-shared/GNUStep/Foundation/NSEnumerator.h: New.
	* objc-obj-c++-shared/GNUStep/Foundation/NSGeometry.h: New.
	* objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h: New.
	* objc-obj-c++-shared/GNUStep/Foundation/NSObject.h: New.
	* objc-obj-c++-shared/GNUStep/Foundation/NSRange.h: New.
	* objc-obj-c++-shared/GNUStep/Foundation/NSString.h: New.
	* objc-obj-c++-shared/GNUStep/Foundation/NSValue.h: New.
	* objc-obj-c++-shared/GNUStep/Foundation/NSZone.h: New.
	* objc-obj-c++-shared/GNUStep/GNUstepBase/GNUstep.h: New.
	* objc-obj-c++-shared/GNUStep/GNUstepBase/GSBlocks.h: New.
	* objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h: New.
	* objc-obj-c++-shared/GNUStep/GNUstepBase/GSObjCRuntime.h: New.
	* objc-obj-c++-shared/GNUStep/GNUstepBase/GSVersionMacros.h: New.
	* objc-obj-c++-shared/GNUStep/GNUstepBase/NSArray+GNUstepBase.h: New.
	* objc-obj-c++-shared/GNUStep/GNUstepBase/NSMutableString+GNUstepBase.h:
	New.
	* objc-obj-c++-shared/GNUStep/GNUstepBase/NSNumber+GNUstepBase.h: New.
	* objc-obj-c++-shared/GNUStep/GNUstepBase/NSObject+GNUstepBase.h: New.
	* objc-obj-c++-shared/GNUStep/GNUstepBase/NSString+GNUstepBase.h: New.

From-SVN: r272325
parent 00908992
2019-06-15 Iain Sandoe <iain@sandoe.co.uk>
PR objc/90709
* objc-obj-c++-shared/CF-CFString.h: New.
* objc-obj-c++-shared/F-NSArray.h: New.
* objc-obj-c++-shared/F-NSAutoreleasePool.h: New.
* objc-obj-c++-shared/F-NSObject.h: New.
* objc-obj-c++-shared/F-NSString.h: New.
* objc-obj-c++-shared/F-NSValue.h: New.
* objc-obj-c++-shared/GNUStep/CoreFoundation/CFArray.h: New.
* objc-obj-c++-shared/GNUStep/CoreFoundation/CFAvailability.h: New.
* objc-obj-c++-shared/GNUStep/CoreFoundation/CFBase.h: New.
* objc-obj-c++-shared/GNUStep/CoreFoundation/CFCharacterSet.h: New.
* objc-obj-c++-shared/GNUStep/CoreFoundation/CFData.h: New.
* objc-obj-c++-shared/GNUStep/CoreFoundation/CFDictionary.h: New.
* objc-obj-c++-shared/GNUStep/CoreFoundation/CFLocale.h: New.
* objc-obj-c++-shared/GNUStep/CoreFoundation/CFString.h: New.
* objc-obj-c++-shared/GNUStep/Foundation/NSArray.h: New.
* objc-obj-c++-shared/GNUStep/Foundation/NSAutoreleasePool.h: New.
* objc-obj-c++-shared/GNUStep/Foundation/NSDate.h: New.
* objc-obj-c++-shared/GNUStep/Foundation/NSEnumerator.h: New.
* objc-obj-c++-shared/GNUStep/Foundation/NSGeometry.h: New.
* objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h: New.
* objc-obj-c++-shared/GNUStep/Foundation/NSObject.h: New.
* objc-obj-c++-shared/GNUStep/Foundation/NSRange.h: New.
* objc-obj-c++-shared/GNUStep/Foundation/NSString.h: New.
* objc-obj-c++-shared/GNUStep/Foundation/NSValue.h: New.
* objc-obj-c++-shared/GNUStep/Foundation/NSZone.h: New.
* objc-obj-c++-shared/GNUStep/GNUstepBase/GNUstep.h: New.
* objc-obj-c++-shared/GNUStep/GNUstepBase/GSBlocks.h: New.
* objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h: New.
* objc-obj-c++-shared/GNUStep/GNUstepBase/GSObjCRuntime.h: New.
* objc-obj-c++-shared/GNUStep/GNUstepBase/GSVersionMacros.h: New.
* objc-obj-c++-shared/GNUStep/GNUstepBase/NSArray+GNUstepBase.h: New.
* objc-obj-c++-shared/GNUStep/GNUstepBase/NSMutableString+GNUstepBase.h:
New.
* objc-obj-c++-shared/GNUStep/GNUstepBase/NSNumber+GNUstepBase.h: New.
* objc-obj-c++-shared/GNUStep/GNUstepBase/NSObject+GNUstepBase.h: New.
* objc-obj-c++-shared/GNUStep/GNUstepBase/NSString+GNUstepBase.h: New.
2019-06-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/90779
......
/* Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef _OBJC_CF_CFSTRING_H_
#define _OBJC_CF_CFSTRING_H_
/* This is a workaround to PR90709 for the NeXT runtime.
If we're on a system version that has headers with items we can't
consume, then use the GNUStep header instead.
*/
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090
# import "GNUStep/CoreFoundation/CFString.h"
#else
# import <CoreFoundation/CFString.h>
#endif
#endif /* _OBJC_CF_CFSTRING_H_ */
/* Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef _OBJC_F_NSARRAY_H_
#define _OBJC_F_NSARRAY_H_
/* This is a workaround to PR90709 for the NeXT runtime.
If we're on a system version that has headers with items we can't
consume, then use the GNUStep header instead.
*/
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090
# import "GNUStep/Foundation/NSArray.h"
#else
# import <Foundation/NSArray.h>
#endif
#endif /* _OBJC_F_NSARRAY_H_ */
/* Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef _OBJC_F_NSAUTORELEASEPOOL_H_
#define _OBJC_F_NSAUTORELEASEPOOL_H_
/* This is a workaround to PR90709 for the NeXT runtime.
If we're on a system version that has headers with items we can't
consume, then use the GNUStep header instead.
*/
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090
# import "GNUStep/Foundation/NSAutoreleasePool.h"
#else
# import <Foundation/NSAutoreleasePool.h>
#endif
#endif /* _OBJC_F_NSAUTORELEASEPOOL_H_ */
/* Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef _OBJC_F_NSOBJECT_H_
#define _OBJC_F_NSOBJECT_H_
/* This is a workaround to PR90709 for the NeXT runtime.
If we're on a system version that has headers with items we can't
consume, then use the GNUStep header instead.
*/
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090
# import "GNUStep/Foundation/NSObject.h"
#else
# import <Foundation/NSObject.h>
#endif
#endif /* _OBJC_F_NSOBJECT_H_ */
/* Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef _OBJC_F_NSSTRING_H_
#define _OBJC_F_NSSTRING_H_
/* This is a workaround to PR90709 for the NeXT runtime.
If we're on a system version that has headers with items we can't
consume, then use the GNUStep header instead.
*/
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090
# import "GNUStep/Foundation/NSString.h"
#else
# import <Foundation/NSString.h>
#endif
#endif /* _OBJC_F_NSSTRING_H_ */
/* Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef _OBJC_F_NSSTRING_H_
#define _OBJC_F_NSSTRING_H_
/* This is a workaround to PR90709 for the NeXT runtime.
If we're on a system version that has headers with items we can't
consume, then use the GNUStep header instead.
*/
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090
# import "GNUStep/Foundation/NSValue.h"
#else
# import <Foundation/NSValue.h>
#endif
#endif /* _OBJC_F_NSSTRING_H_ */
/* CFArray.h
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Stefan Bidigaray
Date: January, 2010
This file is part of CoreBase.
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.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __COREFOUNDATION_CFARRAY_H__
#define __COREFOUNDATION_CFARRAY_H__
#include "CFBase.h"
CF_EXTERN_C_BEGIN
/** \ingroup CFArrayRef
\brief Reference to an immutable array object.
*/
typedef const struct __CFArray *CFArrayRef;
/**
\ingroup CFMutableArrayRef
\brief Reference to a mutable array object.
*/
typedef struct __CFArray *CFMutableArrayRef;
/** \defgroup CFArrayRef CFArray Reference
\brief A CFArray and its mutable type, \ref CFMutableArrayRef
"CFMutableArray", are simple, low overhead, ordered containers for
objects.
\details
<code>\#include <CoreFoundation/CFArray.h></code>
\{
*/
/** \name Callbacks
\{
*/
typedef void (*CFArrayApplierFunction) (const void *value, void *context);
typedef CFStringRef (*CFArrayCopyDescriptionCallBack) (const void *value);
typedef void (*CFArrayReleaseCallBack) (CFAllocatorRef allocator,
const void *value);
typedef const void *(*CFArrayRetainCallBack) (CFAllocatorRef allocator,
const void *value);
typedef Boolean (*CFArrayEqualCallBack) (const void *value1,
const void *value2);
/** \} */
/** \brief Structure with CFArray callbacks.
*/
typedef struct _CFArrayCallBacks CFArrayCallBacks;
struct _CFArrayCallBacks
{
CFIndex version; /**< Structure's version number. Current version is 0. */
CFArrayRetainCallBack retain;
/**< The callback used to retain values added to the array. If NULL,
values are not retained. */
CFArrayReleaseCallBack release;
CFArrayCopyDescriptionCallBack copyDescription;
CFArrayEqualCallBack equal;
};
/** \name Predefined Callback Structures
\{
*/
CF_EXPORT const CFArrayCallBacks kCFTypeArrayCallBacks;
/** \} */
/** \name Creating an Array
\{
*/
CF_EXPORT CFArrayRef
CFArrayCreate (CFAllocatorRef allocator, const void **values,
CFIndex numValues, const CFArrayCallBacks * callBacks);
CF_EXPORT CFArrayRef
CFArrayCreateCopy (CFAllocatorRef allocator, CFArrayRef theArray);
/** \} */
/** \name Examining an Array
\{
*/
CF_EXPORT CFIndex
CFArrayBSearchValues (CFArrayRef theArray, CFRange range, const void *value,
CFComparatorFunction comparator, void *context);
CF_EXPORT Boolean
CFArrayContainsValue (CFArrayRef theArray, CFRange range, const void *value);
CF_EXPORT CFIndex CFArrayGetCount (CFArrayRef theArray);
CF_EXPORT CFIndex
CFArrayGetCountOfValue (CFArrayRef theArray, CFRange range, const void *value);
CF_EXPORT CFIndex
CFArrayGetFirstIndexOfValue (CFArrayRef theArray, CFRange range,
const void *value);
CF_EXPORT CFIndex
CFArrayGetLastIndexOfValue (CFArrayRef theArray, CFRange range,
const void *value);
CF_EXPORT void
CFArrayGetValues (CFArrayRef theArray, CFRange range, const void **values);
CF_EXPORT const void *CFArrayGetValueAtIndex (CFArrayRef theArray, CFIndex idx);
/** \} */
/** \name Applying a Function to Elements
\{
*/
CF_EXPORT void
CFArrayApplyFunction (CFArrayRef theArray, CFRange range,
CFArrayApplierFunction applier, void *context);
/** \} */
/** \name Getting the CFArray Type ID
\{
*/
CF_EXPORT CFTypeID CFArrayGetTypeID (void);
/** \} */
/** \} */
/** \defgroup CFMutableArrayRef CFMutableArray Reference
\details <code>\#include <CoreFoundation/CFArray.h></code>
\{
*/
CF_EXPORT void
CFArrayAppendArray (CFMutableArrayRef theArray, CFArrayRef otherArray,
CFRange otherRange);
CF_EXPORT void
CFArrayAppendValue (CFMutableArrayRef theArray, const void *value);
CF_EXPORT CFMutableArrayRef
CFArrayCreateMutable (CFAllocatorRef allocator, CFIndex capacity,
const CFArrayCallBacks * callBacks);
CF_EXPORT CFMutableArrayRef
CFArrayCreateMutableCopy (CFAllocatorRef allocator, CFIndex capacity,
CFArrayRef theArray);
CF_EXPORT void
CFArrayExchangeValuesAtIndices (CFMutableArrayRef theArray, CFIndex idx1,
CFIndex idx2);
CF_EXPORT void
CFArrayInsertValueAtIndex (CFMutableArrayRef theArray, CFIndex idx,
const void *value);
CF_EXPORT void CFArrayRemoveAllValues (CFMutableArrayRef theArray);
CF_EXPORT void
CFArrayRemoveValueAtIndex (CFMutableArrayRef theArray, CFIndex idx);
CF_EXPORT void
CFArrayReplaceValues (CFMutableArrayRef theArray, CFRange range,
const void **newValues, CFIndex newCount);
CF_EXPORT void
CFArraySetValueAtIndex (CFMutableArrayRef theArray, CFIndex idx,
const void *value);
CF_EXPORT void
CFArraySortValues (CFMutableArrayRef theArray, CFRange range,
CFComparatorFunction comparator, void *context);
/** \} */
CF_EXTERN_C_END
#endif /* __COREFOUNDATION_CFARRAY_H__ */
/* CFAvailability.h
Copyright (C) 2017 Free Software Foundation, Inc.
Written by: Stefan Bidigaray
Date: August, 2017
This file is part of the GNUstep CoreBase 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.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __COREFOUNDATION_CFAVAILABILITY_H__
#define __COREFOUNDATION_CFAVAILABILITY_H__
/* Compiler features */
#ifndef __has_feature
#define __has_feature(x) 0
#endif
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif
#ifndef __has_extension
#define __has_extension(x) __has_feature
#endif
/* CFEnum macro for type definitions */
#if (__cplusplus && __cplusplus >= 201103L)
#define CF_ENUM(_type, _name) _type _name; enum : _type
#define CF_OPTIONS(_type, _name) _type _name; enum : _type
#else
#define CF_ENUM(_type, _name) _type _name; enum
#define CF_OPTIONS(_type, _name) _type _name; enum
#endif
#endif /* __COREFOUNDATION_CFAVAILABILITY_H__ */
/* CFCharacterSet.h
Copyright (C) 2012 Free Software Foundation, Inc.
Written by: Stefan Bidigaray
Date: January, 2012
This file is part of the GNUstep CoreBase 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.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __COREFOUNDATION_CFCHARACTERSET_H__
#define __COREFOUNDATION_CFCHARACTERSET_H__
#include "CFBase.h"
#include "CFData.h"
CF_EXTERN_C_BEGIN
/** \ingroup CFCharacterSetRef */
typedef const struct __CFCharacterSet * CFCharacterSetRef;
/** \ingroup CFMutableCharacterSetRef */
typedef struct __CFCharacterSet * CFMutableCharacterSetRef;
/** \defgroup CFCharacterSetRef CFCharacterSet Reference
\{
*/
typedef enum
{
kCFCharacterSetControl = 1,
kCFCharacterSetWhitespace,
kCFCharacterSetWhitespaceAndNewline,
kCFCharacterSetDecimalDigit,
kCFCharacterSetLetter,
kCFCharacterSetLowercaseLetter,
kCFCharacterSetUppercaseLetter,
kCFCharacterSetNonBase,
kCFCharacterSetDecomposable,
kCFCharacterSetAlphaNumeric,
kCFCharacterSetPunctuation,
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)
kCFCharacterSetCapitalizedLetter = 13,
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
kCFCharacterSetSymbol = 14,
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
kCFCharacterSetNewline = 15,
#endif
kCFCharacterSetIllegal = 12
} CFCharacterSetPredefinedSet;
/** \name Creating Character Sets
\{
*/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
CF_EXPORT CFCharacterSetRef
CFCharacterSetCreateCopy (CFAllocatorRef alloc, CFCharacterSetRef set);
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)
CF_EXPORT CFCharacterSetRef
CFCharacterSetCreateInvertedSet (CFAllocatorRef alloc, CFCharacterSetRef set);
#endif
CF_EXPORT CFCharacterSetRef
CFCharacterSetCreateWithCharactersInRange (CFAllocatorRef alloc,
CFRange range);
CF_EXPORT CFCharacterSetRef
CFCharacterSetCreateWithCharactersInString (CFAllocatorRef alloc,
CFStringRef string);
CF_EXPORT CFCharacterSetRef
CFCharacterSetCreateWithBitmapRepresentation (CFAllocatorRef alloc,
CFDataRef data);
/** \} */
/** \name Getting Predefined Character Sets
\{
*/
CF_EXPORT CFCharacterSetRef
CFCharacterSetGetPredefined (CFCharacterSetPredefinedSet setIdentifier);
/** \} */
/** \name Querying Character Sets
\{
*/
CF_EXPORT CFDataRef
CFCharacterSetCreateBitmapRepresentation (CFAllocatorRef alloc,
CFCharacterSetRef set);
CF_EXPORT Boolean
CFCharacterSetIsCharacterMember (CFCharacterSetRef set, UniChar c);
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)
CF_EXPORT Boolean
CFCharacterSetHasMemberInPlane (CFCharacterSetRef set, CFIndex plane);
CF_EXPORT Boolean
CFCharacterSetIsLongCharacterMember (CFCharacterSetRef set, UTF32Char c);
CF_EXPORT Boolean
CFCharacterSetIsSupersetOfSet (CFCharacterSetRef set,
CFCharacterSetRef otherSet);
#endif
/** \} */
/** \name Getting the Character Set Type Identifier
\{
*/
CF_EXPORT CFTypeID
CFCharacterSetGetTypeID (void);
/** \} */
/** \} */
/** \defgroup CFMutableCharacterSetRef CFMutableCharacterSet Reference
\{
*/
CF_EXPORT CFMutableCharacterSetRef
CFCharacterSetCreateMutable (CFAllocatorRef alloc);
CF_EXPORT CFMutableCharacterSetRef
CFCharacterSetCreateMutableCopy (CFAllocatorRef alloc, CFCharacterSetRef set);
CF_EXPORT void
CFCharacterSetAddCharactersInRange (CFMutableCharacterSetRef set,
CFRange range);
CF_EXPORT void
CFCharacterSetAddCharactersInString (CFMutableCharacterSetRef set,
CFStringRef string);
CF_EXPORT void
CFCharacterSetRemoveCharactersInRange (CFMutableCharacterSetRef set,
CFRange range);
CF_EXPORT void
CFCharacterSetRemoveCharactersInString (CFMutableCharacterSetRef set,
CFStringRef string);
CF_EXPORT void
CFCharacterSetIntersect (CFMutableCharacterSetRef set,
CFCharacterSetRef otherSet);
CF_EXPORT void
CFCharacterSetInvert (CFMutableCharacterSetRef set);
CF_EXPORT void
CFCharacterSetUnion (CFMutableCharacterSetRef set, CFCharacterSetRef otherSet);
/** \} */
CF_EXTERN_C_END
#endif /* __COREFOUNDATION_CFCHARACTERSET_H__ */
/* CFData.h
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Stefan Bidigaray
Date: January, 2010
This file is part of CoreBase.
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.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __COREFOUNDATION_CFDATA_H__
#define __COREFOUNDATION_CFDATA_H__
#include "CFBase.h"
CF_EXTERN_C_BEGIN
/** \ingroup CFDataRef */
typedef const struct __CFData *CFDataRef;
/** \ingroup CFMutableDataRef */
typedef struct __CFData *CFMutableDataRef;
/** \defgroup CFDataRef CFData Reference
\{
*/
/** \name Creating a CFData Object
\{
*/
CF_EXPORT CFDataRef
CFDataCreate (CFAllocatorRef allocator, const UInt8 * bytes, CFIndex length);
CF_EXPORT CFDataRef
CFDataCreateCopy (CFAllocatorRef allocator, CFDataRef theData);
CF_EXPORT CFDataRef
CFDataCreateWithBytesNoCopy (CFAllocatorRef allocator, const UInt8 * bytes,
CFIndex length, CFAllocatorRef bytesDeallocator);
/** \} */
/** \name Examining a CFData Object
\{
*/
CF_EXPORT const UInt8 *CFDataGetBytePtr (CFDataRef theData);
CF_EXPORT void
CFDataGetBytes (CFDataRef theData, CFRange range, UInt8 * buffer);
CF_EXPORT CFIndex CFDataGetLength (CFDataRef theData);
/** \} */
/** \name Getting the CFData Type ID
\{
*/
CF_EXPORT CFTypeID CFDataGetTypeID (void);
/** \} */
/** \} */
/** \defgroup CFMutableDataRef CFMutableData Reference
\{
*/
/** \name Creating a Mutable Data Object
\{
*/
CF_EXPORT CFMutableDataRef
CFDataCreateMutable (CFAllocatorRef allocator, CFIndex capacity);
CF_EXPORT CFMutableDataRef
CFDataCreateMutableCopy (CFAllocatorRef allocator, CFIndex capacity,
CFDataRef theData);
/** \} */
/** \name Accessing Mutable Data
\{
*/
CF_EXPORT UInt8 *CFDataGetMutableBytePtr (CFMutableDataRef theData);
/** \} */
/** \name Modifying a Mutable Data Object
\{
*/
CF_EXPORT void
CFDataAppendBytes (CFMutableDataRef theData, const UInt8 * bytes,
CFIndex length);
CF_EXPORT void CFDataDeleteBytes (CFMutableDataRef theData, CFRange range);
CF_EXPORT void
CFDataReplaceBytes (CFMutableDataRef theData, CFRange range,
const UInt8 * newBytes, CFIndex newLength);
CF_EXPORT void
CFDataIncreaseLength (CFMutableDataRef theData, CFIndex extraLength);
CF_EXPORT void CFDataSetLength (CFMutableDataRef theData, CFIndex length);
/** \} */
/** \} */
CF_EXTERN_C_END
#endif /* __COREFOUNDATION_CFDATA_H__ */
/* CFDictionary.h
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Stefan Bidigaray
Date: January, 2010
This file is part of the GNUstep CoreBase 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.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __COREFOUNDATION_CFDICTIONARY_H__
#define __COREFOUNDATION_CFDICTIONARY_H__ 1
#include "CFBase.h"
CF_EXTERN_C_BEGIN
/** \ingroup CFDictionaryRef */
typedef const struct __CFDictionary *CFDictionaryRef;
/** \ingroup CFMutableDictionaryRef */
typedef struct __CFDictionary *CFMutableDictionaryRef;
/** \defgroup CFDictionaryRef CFDictionary Reference
\{
*/
typedef void (*CFDictionaryApplierFunction) (const void *key,
const void *value, void *context);
typedef CFStringRef (*CFDictionaryCopyDescriptionCallBack) (const void *value);
typedef Boolean (*CFDictionaryEqualCallBack) (const void *value1,
const void *value2);
typedef CFHashCode (*CFDictionaryHashCallBack) (const void *value);
typedef void (*CFDictionaryReleaseCallBack) (CFAllocatorRef allocator,
const void *value);
typedef const void *(*CFDictionaryRetainCallBack) (CFAllocatorRef allocator,
const void *value);
typedef struct _CFDictionaryKeyCallBacks CFDictionaryKeyCallBacks;
struct _CFDictionaryKeyCallBacks
{
CFIndex version;
CFDictionaryRetainCallBack retain;
CFDictionaryReleaseCallBack release;
CFDictionaryCopyDescriptionCallBack copyDescription;
CFDictionaryEqualCallBack equal;
CFDictionaryHashCallBack hash;
};
typedef struct _CFDictionaryValueCallBacks CFDictionaryValueCallBacks;
struct _CFDictionaryValueCallBacks
{
CFIndex version;
CFDictionaryRetainCallBack retain;
CFDictionaryReleaseCallBack release;
CFDictionaryCopyDescriptionCallBack copyDescription;
CFDictionaryEqualCallBack equal;
};
CF_EXPORT const CFDictionaryKeyCallBacks kCFCopyStringDictionaryKeyCallBacks;
CF_EXPORT const CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks;
CF_EXPORT const CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks;
/** \name Creating a dictionary
\{
*/
CF_EXPORT CFDictionaryRef
CFDictionaryCreate (CFAllocatorRef allocator, const void **keys,
const void **values, CFIndex numValues,
const CFDictionaryKeyCallBacks * keyCallBacks,
const CFDictionaryValueCallBacks * valueCallBacks);
CF_EXPORT CFDictionaryRef
CFDictionaryCreateCopy (CFAllocatorRef allocator, CFDictionaryRef theDict);
/** \} */
/** \name Examining a dictionary
\{
*/
CF_EXPORT Boolean
CFDictionaryContainsKey (CFDictionaryRef theDict, const void *key);
CF_EXPORT Boolean
CFDictionaryContainsValue (CFDictionaryRef theDict, const void *value);
CF_EXPORT CFIndex CFDictionaryGetCount (CFDictionaryRef theDict);
CF_EXPORT CFIndex
CFDictionaryGetCountOfKey (CFDictionaryRef theDict, const void *key);
CF_EXPORT CFIndex
CFDictionaryGetCountOfValue (CFDictionaryRef theDict, const void *value);
CF_EXPORT void
CFDictionaryGetKeysAndValues (CFDictionaryRef theDict, const void **keys,
const void **values);
CF_EXPORT const void *CFDictionaryGetValue (CFDictionaryRef theDict,
const void *key);
CF_EXPORT Boolean
CFDictionaryGetValueIfPresent (CFDictionaryRef theDict, const void *key,
const void **value);
/** \} */
/** \name Applying a funcation to a dictionary
\{
*/
CF_EXPORT void
CFDictionaryApplyFunction (CFDictionaryRef theDict,
CFDictionaryApplierFunction applier, void *context);
/** \} */
/** \name Getting the CFDictionary type ID
\{
*/
CF_EXPORT CFTypeID CFDictionaryGetTypeID (void);
/** \} */
/** \} */
/** \defgroup CFMutableDictionaryRef CFMutableDictionary Reference
\{
*/
/** \name Creating a Mutable Dictionary
\{
*/
CF_EXPORT CFMutableDictionaryRef
CFDictionaryCreateMutable (CFAllocatorRef allocator, CFIndex capacity,
const CFDictionaryKeyCallBacks * keyCallBacks,
const CFDictionaryValueCallBacks * valueCallBacks);
CF_EXPORT CFMutableDictionaryRef
CFDictionaryCreateMutableCopy (CFAllocatorRef allocator, CFIndex capacity,
CFDictionaryRef theDict);
/** \} */
/** \name Modifying a Dictionary
\{
*/
CF_EXPORT void
CFDictionaryAddValue (CFMutableDictionaryRef theDict, const void *key,
const void *value);
CF_EXPORT void CFDictionaryRemoveAllValues (CFMutableDictionaryRef theDict);
CF_EXPORT void
CFDictionaryRemoveValue (CFMutableDictionaryRef theDict, const void *key);
CF_EXPORT void
CFDictionaryReplaceValue (CFMutableDictionaryRef theDict, const void *key,
const void *value);
CF_EXPORT void
CFDictionarySetValue (CFMutableDictionaryRef theDict, const void *key,
const void *value);
/** \} */
/** \} */
CF_EXTERN_C_END
#endif /* __COREFOUNDATION_CFDICTIONARY_H__ */
/* CFLocale.h
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Stefan Bidigaray
Date: March, 2011
This file is part of the GNUstep CoreBase 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.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __COREFOUNDATION_CFLOCALE__
#define __COREFOUNDATION_CFLOCALE__ 1
#include "CFBase.h"
#include "CFArray.h"
#include "CFDictionary.h"
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
CF_EXTERN_C_BEGIN
/** \defgroup CFLocaleRef CFLocale Reference
\brief CFLocale provides basic functionality for language and/or region
specific operations.
Locale-sensitive operations, such as collation, calendars and
capitalization, may use CFLocale objects to provide language and/or region
specific functionality.
CFLocale is "toll-free bridged" to NSLocale.
\{
*/
typedef const struct __CFLocale *CFLocaleRef;
/**
*/
enum
{
kCFLocaleLanguageDirectionUnknown = 0,
kCFLocaleLanguageDirectionLeftToRight = 1,
kCFLocaleLanguageDirectionRightToLeft = 2,
kCFLocaleLanguageDirectionTopToBottom = 3,
kCFLocaleLanguageDirectionBottomToTop = 4
};
typedef CFIndex CFLocaleLanguageDirection;
/** \name CFLocale Property Keys
\{
*/
CF_EXPORT const CFStringRef kCFLocaleMeasurementSystem; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleDecimalSeparator; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleGroupingSeparator; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleCurrencySymbol; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleCurrencyCode; /* CFString */
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
CF_EXPORT const CFStringRef kCFLocaleIdentifier; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleLanguageCode; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleCountryCode; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleScriptCode; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleVariantCode; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleExemplarCharacterSet; /* CFCharacterSet */
CF_EXPORT const CFStringRef kCFLocaleCalendarIdentifier; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleCalendar; /* CFCalendar */
CF_EXPORT const CFStringRef kCFLocaleCollationIdentifier; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleUsesMetricSystem; /* CFBoolean */
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
CF_EXPORT const CFStringRef kCFLocaleCollatorIdentifier; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleQuotationBeginDelimiterKey; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleQuotationEndDelimiterKey; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleAlternateQuotationBeginDelimiterKey; /* CFString */
CF_EXPORT const CFStringRef kCFLocaleAlternateQuotationEndDelimiterKey; /* CFString */
#endif
/** \} */
/** \name CFCalendar Identifiers
\{
*/
CF_EXPORT const CFStringRef kCFGregorianCalendar;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
CF_EXPORT const CFStringRef kCFBuddhistCalendar;
CF_EXPORT const CFStringRef kCFChineseCalendar;
CF_EXPORT const CFStringRef kCFHebrewCalendar;
CF_EXPORT const CFStringRef kCFIslamicCalendar;
CF_EXPORT const CFStringRef kCFIslamicCivilCalendar;
CF_EXPORT const CFStringRef kCFJapaneseCalendar;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
CF_EXPORT const CFStringRef kCFRepublicOfChinaCalendar;
CF_EXPORT const CFStringRef kCFPersianCalendar;
CF_EXPORT const CFStringRef kCFIndianCalendar;
CF_EXPORT const CFStringRef kCFISO8601Calendar;
#endif
/** \} */
/** CFLocale Change Notification
*/
CF_EXPORT const CFStringRef kCFLocaleCurrentLocaleDidChangeNotification;
/** \name Creating a Locale
\{
*/
CF_EXPORT CFLocaleRef
CFLocaleCopyCurrent (void);
CF_EXPORT CFLocaleRef
CFLocaleCreate (CFAllocatorRef allocator,
CFStringRef localeIdent);
CF_EXPORT CFLocaleRef
CFLocaleCreateCopy (CFAllocatorRef allocator,
CFLocaleRef locale);
CF_EXPORT CFLocaleRef
CFLocaleGetSystem (void);
/** \} */
/** \name Getting System Locale Information
\{
*/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
CF_EXPORT CFArrayRef
CFLocaleCopyAvailableLocaleIdentifiers (void);
#endif
/** \} */
/** \name Getting ISO Information
\{
*/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
CF_EXPORT CFArrayRef
CFLocaleCopyISOCountryCodes (void);
CF_EXPORT CFArrayRef
CFLocaleCopyISOLanguageCodes (void);
CF_EXPORT CFArrayRef
CFLocaleCopyISOCurrencyCodes (void);
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
CF_EXPORT CFArrayRef
CFLocaleCopyCommonISOCurrencyCodes (void);
#endif
/** \{ */
/** \name Accessing Language Information
\{
*/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
CF_EXPORT CFArrayRef
CFLocaleCopyPreferredLanguages (void);
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
CF_EXPORT CFLocaleLanguageDirection
CFLocaleGetLanguageCharacterDirection (CFStringRef isoLangCode);
CF_EXPORT CFLocaleLanguageDirection
CFLocaleGetLanguageLineDirection (CFStringRef isoLangCode);
#endif
/** \} */
/** \name Getting Information About a Locale
\{
*/
CF_EXPORT CFStringRef
CFLocaleCopyDisplayNameForPropertyValue (CFLocaleRef displayLocale,
CFStringRef key,
CFStringRef value);
CF_EXPORT CFTypeRef
CFLocaleGetValue (CFLocaleRef locale,
CFStringRef key);
CF_EXPORT CFStringRef
CFLocaleGetIdentifier (CFLocaleRef locale);
/** \} */
/** \name Getting and Creating Locale Identifiers
\{
*/
CF_EXPORT CFStringRef
CFLocaleCreateCanonicalLocaleIdentifierFromString (CFAllocatorRef allocator,
CFStringRef localeIdent);
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
CF_EXPORT CFStringRef
CFLocaleCreateCanonicalLanguageIdentifierFromString (CFAllocatorRef allocator,
CFStringRef localeIdent);
CF_EXPORT CFDictionaryRef
CFLocaleCreateComponentsFromLocaleIdentifier (CFAllocatorRef allocator,
CFStringRef localeIdent);
CF_EXPORT CFStringRef
CFLocaleCreateLocaleIdentifierFromComponents (CFAllocatorRef allocator,
CFDictionaryRef dictionary);
#endif
/** \} */
/** \name Windows Locale Codes
\{
*/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
CF_EXPORT CFStringRef
CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode (CFAllocatorRef allocator,
UInt32 lcid);
CF_EXPORT UInt32
CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier (CFStringRef localeIdent);
#endif
/** \} */
/** \name Getting the CFLocale Type ID
\{
*/
CF_EXPORT CFTypeID
CFLocaleGetTypeID (void);
/** \} */
/** \} */
CF_EXTERN_C_END
#endif /* OS_API_VERSION >= MAC_OS_X_VERSION_10_3 */
#endif /* __COREFOUNDATION_CFLOCALE__ */
/*
NSEnumerator.h
Copyright (C) 1998 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com>
Date: January 1998
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU 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 __NSEnumerator_h_GNUSTEP_BASE_INCLUDE
#define __NSEnumerator_h_GNUSTEP_BASE_INCLUDE
#import "../GNUstepBase/GSVersionMacros.h"
#import "NSObject.h"
#if defined(__cplusplus)
extern "C" {
#endif
@class GS_GENERIC_CLASS(NSArray, ElementT);
typedef struct
{
unsigned long state;
__unsafe_unretained id *itemsPtr;
unsigned long *mutationsPtr;
unsigned long extra[5];
} NSFastEnumerationState;
@protocol NSFastEnumeration
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState *)state
objects: (__unsafe_unretained id[])stackbuf
count: (NSUInteger)len;
@end
@interface GS_GENERIC_CLASS(NSEnumerator, IterT) : NSObject <NSFastEnumeration>
- (GS_GENERIC_CLASS(NSArray, IterT) *) allObjects;
- (GS_GENERIC_TYPE(IterT)) nextObject;
@end
#if defined(__cplusplus)
}
#endif
#endif /* __NSEnumerator_h_GNUSTEP_BASE_INCLUDE */
/** Interface to ObjC runtime for GNUStep
Copyright (C) 1995, 1997, 2000 Free Software Foundation, Inc.
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
Date: 1995
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.
AutogsdocSource: NSObjCRuntime.m
AutogsdocSource: NSLog.m
*/
#ifndef __NSObjCRuntime_h_GNUSTEP_BASE_INCLUDE
#define __NSObjCRuntime_h_GNUSTEP_BASE_INCLUDE
#ifdef __cplusplus
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif
#endif
#import "../GNUstepBase/GSVersionMacros.h"
#import "../GNUstepBase/GSConfig.h"
#import "../GNUstepBase/GNUstep.h"
#if __BLOCKS__
#import "../GNUstepBase/GSBlocks.h"
#endif
#include <stdarg.h>
#include <limits.h>
#include <float.h>
/* PA HP-UX kludge. */
#if defined(__hppa__) && defined(__hpux__) && !defined(PRIuPTR)
#define PRIuPTR "lu"
#endif
/* IRIX kludge. */
#if defined(__sgi)
/* IRIX 6.5 <inttypes.h> provides all definitions, but only for C99
compilations. */
#define PRId8 "hhd"
#define PRIu8 "hhu"
#if (_MIPS_SZLONG == 32)
#define PRId64 "lld"
#define PRIu64 "llu"
#endif
/* This doesn't match <inttypes.h>, which always has "lld" here, but the
arguments are uint64_t, int64_t, which are unsigned long, long for
64-bit in <sgidefs.h>. */
#if (_MIPS_SZLONG == 64)
#define PRId64 "ld"
#define PRIu64 "lu"
#endif
/* This doesn't match <inttypes.h>, which has "u" here, but the arguments
are uintptr_t, which is always unsigned long. */
#define PRIuPTR "lu"
#endif
/* Solaris < 10 kludge. */
#if defined(__sun__) && defined(__svr4__) && !defined(PRIuPTR)
#if defined(__arch64__) || defined (__x86_64__)
#define PRIuPTR "lu"
#define PRIdPTR "ld"
#define PRIxPTR "lx"
#else
#define PRIuPTR "u"
#define PRIdPTR "d"
#define PRIxPTR "x"
#endif
#endif
/* These typedefs must be in place before GSObjCRuntime.h is imported.
*/
#if !defined(NSINTEGER_DEFINED)
typedef intptr_t NSInteger;
typedef uintptr_t NSUInteger;
# define NSIntegerMax INTPTR_MAX
# define NSIntegerMin INTPTR_MIN
# define NSUIntegerMax UINTPTR_MAX
#endif /* !defined(NSINTEGER_DEFINED) */
#if !defined(CGFLOAT_DEFINED)
#if GS_SIZEOF_VOIDP == 8
#define CGFLOAT_IS_DBL 1
typedef double CGFloat;
#define CGFLOAT_MIN DBL_MIN
#define CGFLOAT_MAX DBL_MAX
#else
typedef float CGFloat;
#define CGFLOAT_MIN FLT_MIN
#define CGFLOAT_MAX FLT_MAX
#endif
#endif /* !defined(CGFLOAT_DEFINED) */
#define NSINTEGER_DEFINED 1
#define CGFLOAT_DEFINED 1
#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE
# if __has_feature(objc_arc)
# define NS_AUTOMATED_REFCOUNT_UNAVAILABLE \
__attribute__((unavailable("Not available with automatic reference counting")))
# else
# define NS_AUTOMATED_REFCOUNT_UNAVAILABLE
# endif
#endif
#if defined(__cplusplus)
extern "C" {
#endif
/*
* We can have strongly typed enums in C++11 mode or when the objc_fixed_enum
* feature is availble.
*/
#if (__has_feature(objc_fixed_enum) || (__cplusplus && (__cplusplus > 199711L) && __has_extension(cxx_strong_enums)))
# define _GS_NAMED_ENUM(ty, name) enum name : ty name; enum name : ty
# define _GS_ANON_ENUM(ty) enum : ty
# if __cplusplus
# define NS_OPTIONS(ty,name) ty name; enum : ty
# else
# define NS_OPTIONS(ty,name) NS_ENUM(ty,name)
# endif
#else // this provides less information, but works with older compilers
# define _GS_NAMED_ENUM(ty, name) ty name; enum
# define _GS_ANON_ENUM(ty) enum
# define NS_OPTIONS(ty, name) NS_ENUM(ty, name)
#endif
// A bit of fairy dust to expand NS_ENUM to the correct variant
#define _GS_GET_ENUM_MACRO(_first,_second,NAME,...) NAME
/* The trick here is that placing the variadic args first will push the name
* that the _GS_GET_ENUM_MACRO expands to into the correct position.
*/
#define NS_ENUM(...) _GS_GET_ENUM_MACRO(__VA_ARGS__,_GS_NAMED_ENUM,_GS_ANON_ENUM)(__VA_ARGS__)
/*
* If the compiler supports nullability qualifiers, we define the macros for
* non-null sections.
*/
#if __has_feature(nullability)
# define NS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
# define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
#else
# define NS_ASSUME_NONNULL_BEGIN
# define NS_ASSUME_NONNULL_END
#endif
/*
* Backwards compatibility macro for instance type.
*/
#if !__has_feature(objc_instancetype)
# define instancetype id
#endif
/*
* Backwards compatibility macros for Objective-C lightweight generics.
*/
#if __has_feature(objc_generics)
# define GS_GENERIC_CLASS(clz, ...) clz<__VA_ARGS__>
# define GS_GENERIC_TYPE_F(typeRef, fallback) typeRef
#else
# define GS_GENERIC_CLASS(clz, ...) clz
# define GS_GENERIC_TYPE_F(typeRef, fallback) fallback
#endif
#define GS_GENERIC_TYPE(typeRef) GS_GENERIC_TYPE_F(typeRef, id)
/**
* Backwards compatibility macro for the objc_designated_initializer attribute
*/
#if __has_attribute(objc_designated_initializer)
# define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
#else
# define NS_DESIGNATED_INITIALIZER
#endif
/** Bitfield used to specify options to control enumeration over collections.
*/
typedef NS_OPTIONS(NSUInteger, NSEnumerationOptions)
{
NSEnumerationConcurrent = (1UL << 0), /** Specifies that the enumeration
* is concurrency-safe. Note that this does not mean that it will be
* carried out in a concurrent manner, only that it can be.
*/
NSEnumerationReverse = (1UL << 1) /** Specifies that the enumeration should
* happen in the opposite of the natural order of the collection.
*/
};
/** Bitfield used to specify options to control the sorting of collections.
*/
typedef NS_OPTIONS(NSUInteger, NSSortOptions)
{
NSSortConcurrent = (1UL << 0), /** Specifies that the sort
* is concurrency-safe. Note that this does not mean that it will be
* carried out in a concurrent manner, only that it can be.
*/
NSSortStable = (1UL << 4) /** Specifies that the sort should keep
* equal objects in the same order in the collection.
*/
};
#import "../GNUstepBase/GSObjCRuntime.h"
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST)
GS_EXPORT NSString *NSStringFromProtocol(Protocol *aProtocol);
GS_EXPORT Protocol *NSProtocolFromString(NSString *aProtocolName);
#endif
GS_EXPORT SEL NSSelectorFromString(NSString *aSelectorName);
GS_EXPORT NSString *NSStringFromSelector(SEL aSelector);
GS_EXPORT SEL NSSelectorFromString(NSString *aSelectorName);
GS_EXPORT Class NSClassFromString(NSString *aClassName);
GS_EXPORT NSString *NSStringFromClass(Class aClass);
GS_EXPORT const char *NSGetSizeAndAlignment(const char *typePtr,
NSUInteger *sizep, NSUInteger *alignp);
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
/* Logging */
/**
* OpenStep spec states that log messages go to stderr, but just in case
* someone wants them to go somewhere else, they can implement a function
* like this and assign a pointer to it to _NSLog_printf_handler.
*/
typedef void NSLog_printf_handler (NSString* message);
GS_EXPORT NSLog_printf_handler *_NSLog_printf_handler;
GS_EXPORT int _NSLogDescriptor;
@class NSRecursiveLock;
GS_EXPORT NSRecursiveLock *GSLogLock(void);
#endif
GS_EXPORT void NSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
GS_EXPORT void NSLogv(NSString *format, va_list args) NS_FORMAT_FUNCTION(1,0);
#ifndef YES
#define YES 1
#endif
#ifndef NO
#define NO 0
#endif
#ifndef nil
#define nil 0
#endif
/**
* Contains values <code>NSOrderedSame</code>, <code>NSOrderedAscending</code>
* <code>NSOrderedDescending</code>, for left hand side equals, less than, or
* greater than right hand side.
*/
typedef NS_ENUM(NSInteger, NSComparisonResult)
{
NSOrderedAscending = (NSInteger)-1, NSOrderedSame, NSOrderedDescending
};
enum {NSNotFound = NSIntegerMax};
#if __BLOCKS__
DEFINE_BLOCK_TYPE(NSComparator, NSComparisonResult, id, id);
#endif
/**
* Declare the foundation export macro as an alias to GS_EXPORT
*/
#define FOUNDATION_EXPORT GS_EXPORT
#if defined(__cplusplus)
}
#endif
/**
* Declare Apple availability macros for compatibility purposes as no-ops.
*/
#define NS_CLASS_AVAILABLE(...)
#define NS_AVAILABLE(...)
#define NS_AVAILABLE_MAC(...)
#define NS_DEPRECATED(...)
#define NS_DEPRECATED_MAC(...)
#define NS_ENUM_AVAILABLE(...)
#define NS_ENUM_AVAILABLE_MAC(...)
#define NS_ENUM_DEPRECATED(...)
#define NS_ENUM_DEPRECATED_MAC(...)
#define NS_CLASS_AVAILABLE(...)
#define NS_CLASS_DEPRECATED(...)
#define NS_CLASS_AVAILABLE_MAC(...)
#define NS_CLASS_DEPRECATED_MAC(...)
#define NS_UNAVAILABLE
/* Define root class NS macro */
#ifndef NS_ROOT_CLASS
#if __has_attribute(objc_root_class)
#define NS_ROOT_CLASS __attribute__((objc_root_class))
#else
#define NS_ROOT_CLASS
#endif
#endif
#endif /* __NSObjCRuntime_h_GNUSTEP_BASE_INCLUDE */
/*
* Copyright (C) 1995,1999 Free Software Foundation, Inc.
*
* Written by: Adam Fedor <fedor@boulder.colorado.edu>
* Date: 1995
*
* 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 __NSRange_h_GNUSTEP_BASE_INCLUDE
#define __NSRange_h_GNUSTEP_BASE_INCLUDE
#import "../GNUstepBase/GSVersionMacros.h"
/**** Included Headers *******************************************************/
#import "NSObject.h"
#if defined(__cplusplus)
extern "C" {
#endif
@class NSException;
@class NXConstantString;
/**** Type, Constant, and Macro Definitions **********************************/
#ifndef MAX
#define MAX(a,b) \
({__typeof__(a) _MAX_a = (a); __typeof__(b) _MAX_b = (b); \
_MAX_a > _MAX_b ? _MAX_a : _MAX_b; })
#define GS_DEFINED_MAX
#endif
#ifndef MIN
#define MIN(a,b) \
({__typeof__(a) _MIN_a = (a); __typeof__(b) _MIN_b = (b); \
_MIN_a < _MIN_b ? _MIN_a : _MIN_b; })
#define GS_DEFINED_MIN
#endif
/**
* <example>
{
NSUInteger location;
NSUInteger length;
}</example>
* <p>
* The NSRange type is used to specify ranges of locations,
* typically items in an array, characters in a string, and bytes
* in a data object.
* </p>
* <p>
* As 'boundary' or 'fencepost' errors are a particularly common
* problem in programming, it is important that you understand
* how an NSRange works.
* </p>
* <p>
* An NSRange consists of a <em>location</em> and a <em>length</em>. The
* points that are considered to lie in a range are the integers from
* the location to the location plus the length, so the number
* of points in a range is the length of the range plus one.<br />
* However, if you consider these points like the marks on a
* ruler, you can only store information <strong>between</strong>
* points. So the number of items that can be stored in a range
* is the length of the range.
* </p>
*/
typedef struct _NSRange NSRange;
struct _NSRange
{
NSUInteger location;
NSUInteger length;
};
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
/** Pointer to an NSRange structure. */
typedef NSRange *NSRangePointer;
#endif
/**** Function Prototypes ****************************************************/
/*
* All but the most complex functions are declared static inline in this
* header file so that they are maximally efficient. In order to provide
* true functions (for code modules that don't have this header) this
* header is included in NSRange.m where the functions are no longer
* declared inline.
*/
#ifdef IN_NSRANGE_M
#define GS_RANGE_SCOPE extern
#define GS_RANGE_ATTR
#else
#define GS_RANGE_SCOPE static inline
#define GS_RANGE_ATTR __attribute__((unused))
#endif
GS_RANGE_SCOPE NSUInteger
NSMaxRange(NSRange range) GS_RANGE_ATTR;
/** Returns top end of range (location + length). */
GS_RANGE_SCOPE NSUInteger
NSMaxRange(NSRange range)
{
return range.location + range.length;
}
GS_RANGE_SCOPE BOOL
NSLocationInRange(NSUInteger location, NSRange range) GS_RANGE_ATTR;
/** Returns whether location is greater than or equal to range's location
* and less than its max.
*/
GS_RANGE_SCOPE BOOL
NSLocationInRange(NSUInteger location, NSRange range)
{
return (location >= range.location) && (location < NSMaxRange(range));
}
/** Convenience method for raising an NSRangeException. */
GS_EXPORT void _NSRangeExceptionRaise (void);
/* NB: The implementation of _NSRangeExceptionRaise is:
[NSException raise: NSRangeException
format: @"Range location + length too great"];
_NSRangeExceptionRaise is defined in NSRange.m so that this
file (NSRange.h) can be included without problems in the
implementation of the base classes themselves. */
GS_RANGE_SCOPE NSRange
NSMakeRange(NSUInteger location, NSUInteger length) GS_RANGE_ATTR;
/** Creates new range starting at location and of given length. */
GS_RANGE_SCOPE NSRange
NSMakeRange(NSUInteger location, NSUInteger length)
{
NSRange range;
NSUInteger end = location + length;
if (end < location || end < length)
{
_NSRangeExceptionRaise ();
}
range.location = location;
range.length = length;
return range;
}
GS_RANGE_SCOPE BOOL
NSEqualRanges(NSRange range1, NSRange range2) GS_RANGE_ATTR;
/** Returns whether range1 and range2 have same location and length. */
GS_RANGE_SCOPE BOOL
NSEqualRanges(NSRange range1, NSRange range2)
{
return ((range1.location == range2.location)
&& (range1.length == range2.length));
}
GS_RANGE_SCOPE NSRange
NSUnionRange(NSRange range1, NSRange range2) GS_RANGE_ATTR;
/** Returns range going from minimum of aRange's and bRange's locations to
maximum of their two max's. */
GS_RANGE_SCOPE NSRange
NSUnionRange(NSRange aRange, NSRange bRange)
{
NSRange range;
range.location = MIN(aRange.location, bRange.location);
range.length = MAX(NSMaxRange(aRange), NSMaxRange(bRange))
- range.location;
return range;
}
GS_RANGE_SCOPE NSRange
NSIntersectionRange(NSRange range1, NSRange range2) GS_RANGE_ATTR;
/** Returns range containing indices existing in both aRange and bRange. If
* the returned length is 0, the location is undefined and should be ignored.
*/
GS_RANGE_SCOPE NSRange
NSIntersectionRange (NSRange aRange, NSRange bRange)
{
NSRange range;
if (NSMaxRange(aRange) < bRange.location
|| NSMaxRange(bRange) < aRange.location)
return NSMakeRange(0, 0);
range.location = MAX(aRange.location, bRange.location);
range.length = MIN(NSMaxRange(aRange), NSMaxRange(bRange))
- range.location;
return range;
}
@class NSString;
/** Returns string of form {location=a, length=b}. */
GS_EXPORT NSString *NSStringFromRange(NSRange range);
/** Parses range from string of form {location=a, length=b}; returns range
with 0 location and length if this fails. */
GS_EXPORT NSRange NSRangeFromString(NSString *aString);
#ifdef GS_DEFINED_MAX
#undef GS_DEFINED_MAX
#undef MAX
#endif
#ifdef GS_DEFINED_MIN
#undef GS_DEFINED_MIN
#undef MIN
#endif
#if defined(__cplusplus)
}
#endif
#endif /* __NSRange_h_GNUSTEP_BASE_INCLUDE */
/** Definitions for block support for GNUStep
Copyright (C) 2011 Free Software Foundation, Inc.
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 __GSBlocks_h_GNUSTEP_BASE_INCLUDE
#define __GSBlocks_h_GNUSTEP_BASE_INCLUDE
/* Define the has_feature pseudo-macro for GCC. */
#ifndef __has_feature
#define __has_feature(x) 0
#endif
#ifndef GCC_VERSION
#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
#endif
#if __has_feature(blocks)
#define BLOCK_SCOPE __block
/**
* Defines a block type. Will work whether or not the compiler natively
* supports blocks.
*/
#define DEFINE_BLOCK_TYPE(name, retTy, argTys, ...) \
typedef retTy(^name)(argTys, ## __VA_ARGS__)
#define DEFINE_BLOCK_TYPE_NO_ARGS(name, retTy) \
typedef retTy(^name)()
/**
* Calls a block. Works irrespective of whether the compiler supports blocks.
*/
#define CALL_BLOCK(block, args, ...) block(args, ## __VA_ARGS__)
/**
* Calls a block without arguments.
*/
#define CALL_BLOCK_NO_ARGS(block) block()
#else
/* Fall-back versions for when the compiler doesn't have native blocks support.
*/
#if (GCC_VERSION >= 3000)
#define DEFINE_BLOCK_TYPE(name, retTy, argTys, ...) \
typedef struct {\
void *isa;\
int flags;\
int reserved;\
retTy (*invoke)(void*, argTys, ## __VA_ARGS__);\
} *name
#define DEFINE_BLOCK_TYPE_NO_ARGS(name, retTy) \
typedef struct {\
void *isa;\
int flags;\
int reserved;\
retTy (*invoke)(void*);\
} *name
#define CALL_BLOCK(block, args, ...) block->invoke(block, args, ## __VA_ARGS__)
#define CALL_BLOCK_NO_ARGS(block) block->invoke(block)
#define BLOCK_SCOPE
#else /* GCC_VERSION >= 3000 */
#define DEFINE_BLOCK_TYPE(name, retTy, argTys...) \
typedef struct {\
void *isa;\
int flags;\
int reserved;\
retTy (*invoke)(void*, argTys);\
} *name
#define DEFINE_BLOCK_TYPE_NO_ARGS(name, retTy) \
typedef struct {\
void *isa;\
int flags;\
int reserved;\
retTy (*invoke)(void*);\
} *name
#define CALL_BLOCK(block, args...) block->invoke(block, args)
#define CALL_BLOCK_NO_ARGS(block) block->invoke(block)
#define BLOCK_SCOPE
#endif /* GCC_VERSION >= 3000 */
#endif /* __has_feature(blocks) */
#if __has_include(<objc/blocks_runtime.h>)
# include <objc/blocks_runtime.h>
#else
#ifdef __cplusplus
extern "C" {
#endif
/**
* _Block_copy and _Block_release are weakly imported, but can be assumed
* to be available whenever a feature using blocks is accessed
* by an application.
*/
/* weak attributed supported only with ELF, MINGW is COFF */
#ifndef __MINGW32__
void *_Block_copy(const void *) __attribute__((weak));
void _Block_release(const void *) __attribute__((weak));
#endif /* __MINGW32__ */
#ifdef __cplusplus
}
#endif
#ifndef Block_copy
# define Block_copy(x) ((__typeof(x))_Block_copy((const void *)(x)))
#endif
#ifndef Block_release
# define Block_release(x) _Block_release((const void *)(x))
#endif
#endif /* __has_include(<objc/blocks_runtime.h>) */
#endif /* __GSBlocks_h_GNUSTEP_BASE_INCLUDE */
/** 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
#import "../GNUstepBase/GSVersionMacros.h"
#import "../Foundation/NSArray.h"
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSArray (GNUstepBase)
/** <p>Method for working with sorted arrays - use a binary chop
* to determine the insertion location for an object. If equal objects
* already exist in the array, they will be located immediately before
* the insertion position.
* </p>
* <p>The comparator function takes two items as arguments, the first is the
* item to be added, the second is the item already in the array.
* The function should return NSOrderedAscending if the item to be
* added is 'less than' the item in the array, NSOrderedDescending
* if it is greater, and NSOrderedSame if it is equal.
* </p>
*/
- (NSUInteger) insertionPosition: (id)item
usingFunction: (NSComparisonResult (*)(id, id, void *))sorter
context: (void *)context;
/* <p>Method for working with sorted arrays - use a binary chop
* to determine the insertion location for an object. If equal objects
* already exist in the array, they will be located immediately before
* the insertion position.
* </p>
* <p>The selector identifies a method returning NSOrderedAscending if
* the receiver is 'less than' the argument, and NSOrderedDescending if
* it is greate.
* </p>
*/
- (NSUInteger) insertionPosition: (id)item
usingSelector: (SEL)comp;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSArray_GNUstepBase_h */
/** 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_NSMutableString_GNUstepBase_h
#define INCLUDED_NSMutableString_GNUstepBase_h
#import "GSVersionMacros.h"
#import "../Foundation/NSString.h"
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSMutableString (GNUstepBase)
- (void) deleteSuffix: (NSString*)suffix;
- (void) deletePrefix: (NSString*)prefix;
- (NSString*) immutableProxy;
- (void) replaceString: (NSString*)replace
withString: (NSString*)by;
- (void) trimLeadSpaces;
- (void) trimTailSpaces;
- (void) trimSpaces;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSMutableString_GNUstepBase_h */
/** 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
#import "GSVersionMacros.h"
#import "../Foundation/NSValue.h"
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@interface NSNumber(GNUstepBase)
/**
* Parses string as a <code>double</code>, <code>int</code>, or <code>unsigned
* int</code> depending on what characters are present. Uses
* <code>atof</code> and <code>atoi</code> which don't report errors, so be
* careful if the string might contain an invalid value.
*/
+ (NSValue*) valueFromString: (NSString *)string;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSNumber_GNUstepBase_h */
/** 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
#import "GSVersionMacros.h"
#import "../Foundation/NSObject.h"
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
@class NSHashTable;
@interface NSObject (GNUstepBase)
/**
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;
/** For backward compatibility only ... use class_isMetaClass() on the
* class of the receiver instead.
*/
- (BOOL) isInstance;
/** DEPRECATED ... do not use.
* Transmutes the receiver into an immutable version of the same object
* and returns the result.<br />
* If the receiver is not a mutable object or cannot be simply transmuted,
* then this method either returns the receiver unchanged or,
* if the force flag is set to YES, returns an autoreleased copy of the
* receiver.<br />
* Mutable classes should override this default implementation.<br />
* This method is used in methods which are declared to return immutable
* objects (eg. an NSArray), but which create and build mutable ones
* internally.
*/
- (id) makeImmutableCopyOnFail: (BOOL)force;
/** Transmutes the receiver into an immutable version of the same object.
* Returns YES if the receiver has become immutable, NO otherwise.<br />
* The default implementation returns NO.<br />
* Mutable classes which have an immutable counterpart they can efficiently
* change into, should override to transmute themselves and return YES.<br />
* Immutable classes should override this to simply return YES with no
* further action.<br />
* This method is used in methods which are declared to return immutable
* objects (eg. an NSArray), but which create and build mutable ones
* internally.
*/
- (BOOL) makeImmutable;
/**
* Message sent when an implementation wants to explicitly exclude a method
* (but cannot due to compiler constraint), and wants to make sure it is not
* called by mistake. Default implementation raises an exception at runtime.
*/
- (id) notImplemented: (SEL)aSel GS_NORETURN_METHOD;
/**
* Message sent when an implementation wants to explicitly require a subclass
* to implement a method (but cannot at compile time since there is no
* <code>abstract</code> keyword in Objective-C). Default implementation
* raises an exception at runtime to alert developer that he/she forgot to
* override a method.
*/
- (id) subclassResponsibility: (SEL)aSel GS_NORETURN_METHOD;
/**
* Message sent when an implementation wants to explicitly exclude a method
* (but cannot due to compiler constraint) and forbid that subclasses
* implement it. Default implementation raises an exception at runtime. If a
* subclass <em>does</em> implement this method, however, the superclass's
* implementation will not be called, so this is not a perfect mechanism.
*/
- (id) shouldNotImplement: (SEL)aSel GS_NORETURN_METHOD;
@end
/** This is an informal protocol ... classes may implement the method to
* report how much memory is used by the instance and any objects it acts
* as a container for.
*/
@interface NSObject(MemoryFootprint)
/* This method returns the memory usage of the receiver, excluding any
* objects already present in the exclude table.<br />
* The argument is a hash table configured to hold non-retained pointer
* objects and is used to inform the receiver that its size should not
* be counted again if it's already in the table.<br />
* The NSObject implementation returns zero if the receiver is in the
* table, but otherwise adds itself to the table and returns its memory
* footprint (the sum of all of its instance variables, but not any
* memory pointed to by those variables).<br />
* Subclasses should override this method by calling the superclass
* implementation, and either return the result (if it was zero) or
* return that value plus the sizes of any memory owned by the receiver
* (eg found by calling the same method on objects pointed to by the
* receiver's instance variables).
*/
- (NSUInteger) sizeInBytesExcluding: (NSHashTable*)exclude;
@end
/** This is an informal protocol ... classes may implement the method and
* register themselves to have it called on process exit.
*/
@interface NSObject(GSAtExit)
/** This method is called on exit for any class which implements it and which
* has called +registerAtExit to register it to be called.<br />
* The order in which methods for different classes is called is the reverse
* of the order in which the classes were registered, but it's best to assume
* the method can not depend on any other class being in a usable state
* at the point when the method is called (rather like +load).<br />
* Typical use would be to release memory occupied by class data structures
* so that memory usage analysis software will not think the memory has
* been leaked.
*/
+ (void) atExit;
@end
/** Category for methods handling leaked memory cleanup on exit of process
* (for use when debugging memory leaks).<br />
* You enable this by calling the +setShouldCleanUp: method (done implicitly
* by gnustep-base if the GNUSTEP_SHOULD_CLEAN_UP environment variable is
* set to YES).<br />
* Your class then has two options for performing cleanup when the process
* ends:
* <p>1. Use the +leak: method to register objects which are simply to be
* retained until the process ends, and then either ignored or released
* depending on the cleanup setting in force. This mechanism is simple
* and should be sufficient for many classes.
* </p>
* <p>2. Implement a +atExit method to be run when the process ends and,
* within your +initialize implementation, call +shouldCleanUp to determine
* whether cleanup should be done, and if it returns YES then call
* +registerAtExit to have your +atExit method called when the process
* terminates.
* </p>
* <p>The order in which 'leaked' objects are released and +atExit methods
* are called on process exist is the reverse of the order in which they
* werse set up suing this API.
* </p>
*/
@interface NSObject(GSCleanup)
/** This method simply retains its argument so that it will never be
* deallocated during normal operation, but keeps track of it so that
* it is released during process exit if cleanup is enabled.<br />
* Returns its argument.
*/
+ (id) NS_RETURNS_RETAINED leak: (id)anObject;
/** This method retains the object at *anAddress so that it will never be
* deallocated during normal operation, but keeps track of the address
* so that the object is released and the address is zeroed during process
* exit if cleanup is enabled.<br />
* Returns the object at *anAddress.
*/
+ (id) NS_RETURNS_RETAINED leakAt: (id*)anAddress;
/** Sets the receiver to have its +atExit method called at the point when
* the process terminates.<br />
* Returns YES on success and NO on failure (if the class does not implement
* the method or if it is already registered to call it).<br />
* Implemented as a call to +registerAtExit: with the selector for the +atExit
* method as its argument.
*/
+ (BOOL) registerAtExit;
/** Sets the receiver to have the specified method called at the point when
* the process terminates.<br />
* Returns YES on success and NO on failure (if the class does not implement
* the method ir if it is already registered to call it).
*/
+ (BOOL) registerAtExit: (SEL)aSelector;
/** Specifies the default cleanup behavior on process exit ... the value
* returned by the NSObject implementation of the +shouldClanUp method.<br />
* Calling this method with a YES argument implicitly calls the +enableAtExit
* method as well.<br />
* The GNUstep Base library calls this method with the value obtained from
* the GNUSTEP_SHOULD_CLEAN_UP environment variable when NSObject is
* initialised.
*/
+ (void) setShouldCleanUp: (BOOL)aFlag;
/** Returns a flag indicating whether the receiver should clean up
* its data structures etc at process exit.<br />
* The NSObject implementation returns the value set by the +setShouldCleanUp:
* method but subclasses may override this.
*/
+ (BOOL) shouldCleanUp;
@end
/* Macro to take an autoreleased object and either make it immutable or
* create an autoreleased copy of the original.
*/
#define GS_IMMUTABLE(O) ([O makeImmutable] == YES ? O : AUTORELEASE([O copy]))
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSObject_GNUstepBase_h */
/** 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_NSString_GNUstepBase_h
#define INCLUDED_NSString_GNUstepBase_h
#import "GSVersionMacros.h"
#import "../Foundation/NSString.h"
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
/**
* 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.
*/
+ (id) stringWithFormat: (NSString*)format
arguments: (va_list)argList NS_FORMAT_FUNCTION(1,0);
/**
* Returns a string formed by removing the prefix string from the
* receiver. Raises an exception if the prefix is not present.
*/
- (NSString*) stringByDeletingPrefix: (NSString*)prefix;
/**
* Returns a string formed by removing the suffix string from the
* receiver. Raises an exception if the suffix is not present.
*/
- (NSString*) stringByDeletingSuffix: (NSString*)suffix;
/**
* Returns a string formed by removing leading white space from the
* receiver.
*/
- (NSString*) stringByTrimmingLeadSpaces;
/**
* Returns a string formed by removing trailing white space from the
* receiver.
*/
- (NSString*) stringByTrimmingTailSpaces;
/**
* Returns a string formed by removing both leading and trailing
* white space from the receiver.
*/
- (NSString*) stringByTrimmingSpaces;
/**
* Returns a string in which any (and all) occurrences of
* replace in the receiver have been replaced with by.
* Returns the receiver if replace
* does not occur within the receiver. NB. an empty string is
* not considered to exist within the receiver.
*/
- (NSString*) stringByReplacingString: (NSString*)replace
withString: (NSString*)by;
/**
* An obsolete name for -substringWithRange: ... deprecated.
*/
- (NSString*) substringFromRange: (NSRange)aRange;
@end
#endif /* OS_API_VERSION */
#if defined(__cplusplus)
}
#endif
#endif /* INCLUDED_NSString_GNUstepBase_h */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment