libs-base/Source
David Chisnall 99cb20ae16 Rewritten NSNumber implementation. This fixes several OS X-compatibility issues:
The -pointerValue method now returns the value cast to a pointer, not some random value, as the documentation says it should.  This is a change from OpenStep, which said:

> It's an error to send this message to an NSValue that doesn't store a pointer.

The OS X docs now say:

> The receiver's value as a pointer to void. If the receiver was not created to hold a pointer-sized data item, the result is undefined.

This means that any NSNumber created with a word-sized integer should return the same value.

Fixed a number of corner-cases in the compare: implementation caused by incorrect type promotion.  The OS X docs say:

> The compare: method follows the standard C rules for type conversion.

The OS X implementation does not do this.  We now match Apple's conversion rules bug-for-bug: Every value is stored in the smallest signed type that will hold it, unless there is no unsigned type that can hold it, in which case it is stored in an `unsigned long long`, comparisons between integer and floating point values cast both to a double, comparisons between integer types perform a real comparison (so an unsigned long long is always greater than any negative number, at any precision).  The Apple implementation is actually quite sane, it is just completely unrelated to the documentation in any way.

We now use the same range of reusable objects.  Note that there is an error in Cocoa Design Patterns in the description of how Apple's implementation works.  Do not use this as a reference.

We now return `nil` when an NSNumber is sent an -init message.  This is consistent with Apple's implementation but breaks some things in the GNUstep test suite (which RFM said he will fix).

There is a small change in NSValue.h so that the locale parameter is now an `id` not an `NSString*`.  This is because, under recent OS X, it may also be an `NSLocale` instance.  I am not sure how much GNUstep supports `NSLocale`, but this change shouldn't affect anything.

The new (private) GSNumberTypes.h file lets you define macros that are instantiated with each of the names of primitive C types.  These might be useful for simplifying other classes that have -intValue, -floatValue, and so on methods, such as the `NSCell` family.

The old NSConcreteNumberTemplate and NSConcreteNumber stuff has been removed.  The code is now a bit more than 10% of the size of the old NSNumber code, and is hopefully maintainable now, so the next change won't require a complete rewrite.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29618 72102866-910b-0410-8b05-ffd578937521
2010-02-14 12:57:44 +00:00
..
Additions minor include fixups 2010-02-14 11:01:08 +00:00
pathconfig Fix typo 2009-02-16 06:50:00 +00:00
unix merge back reorganisation branch 2010-02-14 10:48:10 +00:00
win32 merge back reorganisation branch 2010-02-14 10:48:10 +00:00
.cvsignore Header reorganizsateion - Please refer to ChangeLog 2003-07-31 23:49:32 +00:00
callframe.h a bit step towards removing obsolete mframe code. 2009-10-04 15:26:07 +00:00
callframe.m lrge changes to remove mframe 2009-10-05 16:00:28 +00:00
cifframe.h a bit step towards removing obsolete mframe code. 2009-10-04 15:26:07 +00:00
cifframe.m Avoid memory leak and improve performance for common structures. 2009-11-02 18:32:35 +00:00
CompatibilityHeaders.make allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
dld-load.h allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
DocMakefile merge back reorganisation branch 2010-02-14 10:48:10 +00:00
externs.m Updates for MacOS-X compatibility 2008-06-23 07:15:10 +00:00
GNUmakefile Rewritten NSNumber implementation. This fixes several OS X-compatibility issues: 2010-02-14 12:57:44 +00:00
GSArray.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSAttributedString.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSConcreteValue.m allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
GSConcreteValueTemplate.m Updates for 10.5 API changes 2009-02-23 20:42:32 +00:00
GSCountedSet.m Refactored last two commits so that all of the real code is in GSIMap.h and is just called from the relevant classes, rather than copied and pasted everywhere. Also added fast enumeration support to GSCountedSet. 2009-12-29 16:49:07 +00:00
GSDictionary.m Refactored last two commits so that all of the real code is in GSIMap.h and is just called from the relevant classes, rather than copied and pasted everywhere. Also added fast enumeration support to GSCountedSet. 2009-12-29 16:49:07 +00:00
GSeq.h simplify for older compilers 2009-10-13 09:59:34 +00:00
GSFastEnumeration.h Tidied up some compiler warnings in last commit. 2009-12-27 14:41:15 +00:00
GSFFCallInvocation.m Apply patch to switch completely to using pthreads 2010-01-23 17:00:13 +00:00
GSFFIInvocation.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSFileHandle.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSFormat.m Tweaks for building with clang 2010-01-10 14:38:16 +00:00
GSFTPURLHandle.m implement support for multiline responses 2009-04-26 13:45:47 +00:00
GSHTTPAuthentication.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSHTTPURLHandle.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSInternal.h merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSInvocation.h lrge changes to remove mframe 2009-10-05 16:00:28 +00:00
GSLocale.m locale fixes 2009-09-30 20:44:41 +00:00
GSNetwork.h merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSNumberTypes.h Rewritten NSNumber implementation. This fixes several OS X-compatibility issues: 2010-02-14 12:57:44 +00:00
GSPortPrivate.h allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
GSPrivate.h merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSPThread.h Apply patch to switch completely to using pthreads 2010-01-23 17:00:13 +00:00
GSRunLoopCtxt.h Add warning logs 2009-09-07 09:53:27 +00:00
GSRunLoopWatcher.h Add some missing comments 2009-02-26 11:09:05 +00:00
GSRunLoopWatcher.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSSet.m Refactored last two commits so that all of the real code is in GSIMap.h and is just called from the relevant classes, rather than copied and pasted everywhere. Also added fast enumeration support to GSCountedSet. 2009-12-29 16:49:07 +00:00
GSSocketStream.h simplify memory usage 2009-03-24 10:46:53 +00:00
GSSocketStream.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSStream.h Updates for 10.5 API changes 2009-02-23 20:42:32 +00:00
GSStream.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSString.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
GSURLPrivate.h * Source/GSURLPrivate.h: Addition of private method to NSURLProtocol 2009-04-18 14:22:54 +00:00
GSValue.m allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
hpux-load.h allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
inet_ntop.c Applied patch #6677 2008-11-17 13:45:32 +00:00
inet_pton.c bugfix for old systems without stdint.h 2008-10-15 05:10:55 +00:00
libgnustep-base-entry.m allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
Makefile.postamble Removed obsolete manual dependency rules in gnustep-base Makefile.postamble 2010-02-11 22:40:35 +00:00
Makefile.preamble allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
NSAffineTransform.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSArchiver.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSArray.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSAssertionHandler.m Updates for 10.5 API changes 2009-02-23 20:42:32 +00:00
NSAttributedString.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSAutoreleasePool.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSBundle.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSCache.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSCachedURLResponse.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSCalendarDate.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSCallBacks.h allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
NSCallBacks.m allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
NSCharacterSet.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSCharacterSetData.h OSX compatibility update for newline character set. 2010-01-09 07:45:18 +00:00
NSClassDescription.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSCoder.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSConcreteHashTable.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSConcreteMapTable.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSConcretePointerFunctions.h more gc fixups 2009-04-17 08:12:52 +00:00
NSConcretePointerFunctions.m more gc fixups 2009-04-17 08:12:52 +00:00
NSConnection.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSCopyObject.m Updates for 10.5 API changes 2009-02-23 20:42:32 +00:00
NSCountedSet.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSData.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSDate.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSDateFormatter.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSDebug.m try using sigsetjmp 2009-03-21 15:31:52 +00:00
NSDecimal.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSDecimalNumber.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSDictionary.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSDistantObject.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSDistributedLock.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSDistributedNotificationCenter.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSEnumerator.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSError.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSException.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSFileHandle.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSFileManager.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSFormatter.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSGarbageCollector.m MacOS-X compatibility fix for GC 2009-02-11 10:11:33 +00:00
NSGeometry.m Updates for 10.5 API changes 2009-02-23 20:42:32 +00:00
NSHashTable.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSHost.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSHTTPCookie.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSHTTPCookieStorage.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSIndexPath.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSIndexSet.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSInvocation.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSKeyedArchiver.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSKeyedUnarchiver.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSKeyValueCoding.m fix for bug #25720 as suggested by Michael Johnston 2009-02-27 12:54:15 +00:00
NSKeyValueMutableArray.m Applied patch #6677 2008-11-17 13:45:32 +00:00
NSKeyValueMutableSet.m allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
NSKeyValueObserving.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSLock.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSLog.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSMapTable.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSMessagePort.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSMessagePortNameServer.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSMethodSignature.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSNetServices.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSNotification.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSNotificationCenter.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSNotificationQueue.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSNull.m allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
NSNumber.m Rewritten NSNumber implementation. This fixes several OS X-compatibility issues: 2010-02-14 12:57:44 +00:00
NSNumberFormatter.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSNumberMethods.h Rewritten NSNumber implementation. This fixes several OS X-compatibility issues: 2010-02-14 12:57:44 +00:00
NSObjCRuntime.m a bit step towards removing obsolete mframe code. 2009-10-04 15:26:07 +00:00
NSObject+NSComparisonMethods.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSObject.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSOperation.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSPage.m revert last change, instead set define to say we support win2000 and up 2008-11-13 13:55:21 +00:00
NSPathUtilities.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSPipe.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSPointerArray.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSPointerFunctions.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSPort.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSPortCoder.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSPortMessage.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSPortNameServer.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSPredicate.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSProcessInfo.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSPropertyList.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSProtocolChecker.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSProxy.m Updates for 10.5 API changes 2009-02-23 20:42:32 +00:00
NSRange.m allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
NSRunLoop.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSScanner.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSSerializer.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSSet.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSSocketPort.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSSocketPortNameServer.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSSortDescriptor.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSSpellServer.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSString.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSTask.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSThread.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSTimer.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSTimeZone.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
nstzfile.h * configure.ac: Check for tzfile.h 2004-10-11 03:08:54 +00:00
NSUnarchiver.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSUndoManager.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSURL.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSURLAuthenticationChallenge.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSURLCache.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSURLConnection.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSURLCredential.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSURLCredentialStorage.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSURLDownload.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSURLHandle.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSURLProtectionSpace.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSURLProtocol.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSURLRequest.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSURLResponse.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSUserDefaults.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSValue.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSValueTransformer.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSXMLDocument.m Add skeletal NSXML work as requested. 2009-02-09 16:16:11 +00:00
NSXMLDTD.m Add skeletal NSXML work as requested. 2009-02-09 16:16:11 +00:00
NSXMLDTDNode.m Add skeletal NSXML work as requested. 2009-02-09 16:16:11 +00:00
NSXMLElement.m Add skeletal NSXML work as requested. 2009-02-09 16:16:11 +00:00
NSXMLNode.m Add skeletal NSXML work as requested. 2009-02-09 16:16:11 +00:00
NSXMLParser.m merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSXMLPrivate.h merge back reorganisation branch 2010-02-14 10:48:10 +00:00
NSZone.m Apply patch to switch completely to using pthreads 2010-01-23 17:00:13 +00:00
null-load.h allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
objc-load.h allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
objc-load.m allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
preface.m allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
simple-load.h allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
synchronization.m Apply patch to switch completely to using pthreads 2010-01-23 17:00:13 +00:00
win32-def.top allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00
win32-load.h allow developers more time to adapt to LGPLv3 2008-06-08 10:38:33 +00:00