diff --git a/ChangeLog b/ChangeLog index 1544ce1f3..240ce72bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-02-25 Richard Frith-Macdonald + + * Headers/Foundation/NSObject.h: Moved some headers to NSObjCRuntime.h + * Headers/Foundation/NSObjCRuntime.h: Added NSInbteger and NSUInteger + for MacOSX compatibiulity. + * Headers/Additions/GNUstep/GSVersionMacros.h: Don't declare constants + which should be set by the user to say which MacOSX version they want. + * Headers/Foundation/NSPointerFunctions.h: New MacOSX declarations ... + no definitions yet. + 2008-02-23 Richard Frith-Macdonald * Source/NSKeyValueObserving.m: diff --git a/Headers/Additions/GNUstepBase/GSVersionMacros.h b/Headers/Additions/GNUstepBase/GSVersionMacros.h index b13f1cd53..e4c2cbffa 100644 --- a/Headers/Additions/GNUstepBase/GSVersionMacros.h +++ b/Headers/Additions/GNUstepBase/GSVersionMacros.h @@ -61,13 +61,6 @@ #endif /* MAC_OS_X_VERSION_MIN_ALLOWED */ #endif /* GS_OPENSTEP_V */ -#ifndef MAC_OS_X_VERSION_MIN_ALLOWED -#define MAC_OS_X_VERSION_MIN_ALLOWED GS_OPENSTEP_V -#endif -#ifndef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MAX_ALLOWED GS_OPENSTEP_V -#endif - /* * NB. The version values below must be integers ... by convention these are * made up of two digits each for major, minor and subminor version numbers diff --git a/Headers/Foundation/NSObjCRuntime.h b/Headers/Foundation/NSObjCRuntime.h index 7598bafe2..a23ad7a8d 100644 --- a/Headers/Foundation/NSObjCRuntime.h +++ b/Headers/Foundation/NSObjCRuntime.h @@ -29,13 +29,17 @@ #ifndef __NSObjCRuntime_h_GNUSTEP_BASE_INCLUDE #define __NSObjCRuntime_h_GNUSTEP_BASE_INCLUDE #import - +#import +#import #import #if defined(__cplusplus) extern "C" { #endif +typedef gsaddr NSInteger; +typedef gsuaddr NSUInteger; + GS_EXPORT NSString *NSStringFromSelector(SEL aSelector); GS_EXPORT SEL NSSelectorFromString(NSString *aSelectorName); GS_EXPORT Class NSClassFromString(NSString *aClassName); diff --git a/Headers/Foundation/NSObject.h b/Headers/Foundation/NSObject.h index 6f7a13965..bcbf68cf6 100644 --- a/Headers/Foundation/NSObject.h +++ b/Headers/Foundation/NSObject.h @@ -27,13 +27,9 @@ #ifndef __NSObject_h_GNUSTEP_BASE_INCLUDE #define __NSObject_h_GNUSTEP_BASE_INCLUDE -#import - #import -#import -#include -#include -#include +#import +#import #import #if defined(__cplusplus) diff --git a/Headers/Foundation/NSPointerFunctions.h b/Headers/Foundation/NSPointerFunctions.h new file mode 100644 index 000000000..2ecc4c9c9 --- /dev/null +++ b/Headers/Foundation/NSPointerFunctions.h @@ -0,0 +1,152 @@ +/**Interface for NSPointerFunctions for GNUStep + Copyright (C) 2008 Free Software Foundation, Inc. + + Written by: Richard Frith-Macdonald + Date: 2008 + + 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 3 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 __NSPointerFunctions_h_GNUSTEP_BASE_INCLUDE +#define __NSPointerFunctions_h_GNUSTEP_BASE_INCLUDE + +#import + +#if OS_API_VERSION(100500, GS_API_LATEST) + +#if defined(__cplusplus) +extern "C" { +#endif + +/** Options flags come in three groups ...
+ * Memory management options (only one of which may be set)
+ * Personality options (only one of which may be set)
+ * Others. + */ +enum { + /** Garbage collected strong references , or retain counting if GC + * is not active. */ + NSPointerFunctionsStrongMemory = (0<<0), + + /** Garbage collected weak references */ + NSPointerFunctionsZeroingWeakgMemory = (1<<0), + + /** Non-GC memory */ + NSPointerFunctionsOpaqueMemory = (2<<0), + + /** Heap (calloc/free) memory */ + NSPointerFunctionsMallocMemory = (3<<0), + + /** MACH virtual memory (not implemented) */ + NSPointerFunctionsMachVirtualMemory = (4<<0), + + + /** Use the -hash and -isEqual: methods for storing objects, and the + * -description method to describe them. */ + NSPointerFunctionsObjectPersonality = (0<<8), + + /** Use the pointer (shifted) as a hash, and compare for bitwise quality. + */ + NSPointerFunctionsOpaquePersonality = (1<<8), + + /** Use the pointer (shifted) as a hash, and compare for bitwise quality, + * but use -description to desribe the objects. + */ + NSPointerFunctionsObjectPointerPersonality = (2<<8), + + /** Use strcmp for comparison and a hash of the string contents. Describe + * assuming that the string contains UTF-8 data. + */ + NSPointerFunctionsCStringPersonality = (3<<8), + + /** Use memcmp for comparison and a hash of the sructure contents. + * A size function must be set so that the size of the memcmp and hash + * are known, + */ + NSPointerFunctionsStructPersonality = (4<<8), + + /** Use unmodified integer value for both hash and equality test. + */ + NSPointerFunctionsIntegerPersonality = (5<<8), + + + /** Request the memory aquire function to allocate/copy items. + */ + NSPointerFunctionsCopyIn = (1<<16) +}; + +/** An integer value containing memory option, personality option, + * and copying option. + */ +typedef NSUInteger NSPointerFunctionsOptions; + +@interface NSPointerFunctions : NSObject + ++ (id) pointerFunctionsWithOptions: (NSPointerFunctionsOptions)options; + +- (id) initWithOptions: (NSPointerFunctionsOptions)options; + +- (void* (*)(const void *item, + NSUInteger (*size)(const void *item), BOOL shouldCopy)) aquireFunction; + +- (NSString (*)(const void *item)) descriptionFunction; + +- (NSUInteger (*)(const void *item, + NSUInteger (*size)(const void *item))) hashFunction; + +- (BOOL (*)(const void *item1, const void *item2, + NSUInteger (*size)(const void *item))) isEqualFunction; + +- (void (*)(const void *item, + NSUInteger (*size)(const void *item))) relinquishFunction; + +- (void) setAcquireFunction: (void* (*)(const void *item, + NSUInteger (*size)(const void *item), BOOL shouldCopy))func; + +- (void) setDescriptionFunction: (NSString (*)(const void *item))func; + +- (void) setHashFunction: (NSUInteger (*)(const void *item, + NSUInteger (*size)(const void *item)))func; + +- (void) setIsEqualFunction: (BOOL (*)(const void *item1, const void *item2, + NSUInteger (*size)(const void *item)))func; + +- (void) setRelinquishFunction: (NSUInteger (*)(const void *item, + NSUInteger (*size)(const void *item)))func; + +- (void) setSizeFunction: (NSUInteger (*)(const void *item))func; + +- (void) setUsesStrongWriteBarrier: (BOOL)flag; + +- (void) setUsesWeakReadAndWriteBarriers: (BOOL)flag; + +- (NSUInteger (*)(const void *item)) sizeFunction; + +- (BOOL) usesStrongWriteBarrier; + +- (BOOL) usesWeak ReadAndWriteBarriers; + +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* OS_API_VERSION(100500, GS_API_LATEST) */ +#endif /* __NSPointerFunctions_h_GNUSTEP_BASE_INCLUDE */