Commit graph

108 commits

Author SHA1 Message Date
Richard Frith-Macdonald
7380e850e4 minor whitespace tidyups 2018-12-04 11:09:18 +00:00
Richard Frith-MacDonald
dbe7cef25d avoid compiler warnings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39683 72102866-910b-0410-8b05-ffd578937521
2016-04-19 08:07:53 +00:00
Richard Frith-MacDonald
8a57dc7e10 Avoid spurious compiler warnings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39673 72102866-910b-0410-8b05-ffd578937521
2016-04-17 15:14:34 +00:00
Richard Frith-MacDonald
31aef40e46 Add -getValue: implementation for BOOL number
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39644 72102866-910b-0410-8b05-ffd578937521
2016-04-08 08:17:00 +00:00
Richard Frith-MacDonald
bc7634464d Check for corrupt archive or unsupported number types as suggested by Fred
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39609 72102866-910b-0410-8b05-ffd578937521
2016-03-25 11:42:23 +00:00
Richard Frith-MacDonald
f04167c678 attempt to fix archiving endianness issue
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39604 72102866-910b-0410-8b05-ffd578937521
2016-03-25 08:37:36 +00:00
Richard Frith-MacDonald
ed09c55959 leak detection improvements
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37003 72102866-910b-0410-8b05-ffd578937521
2013-08-22 15:44:54 +00:00
Richard Frith-MacDonald
b2d5fd280c Changes for 64bit clean printf format strings.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36810 72102866-910b-0410-8b05-ffd578937521
2013-07-03 06:46:41 +00:00
David Chisnall
6f84df52c2 Add missing retainCount methods for small objects.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36034 72102866-910b-0410-8b05-ffd578937521
2013-01-29 18:42:23 +00:00
Niels Grewe
490dfca739 Add special small object class for floats. Previously, NSSmallRepeatableDouble
would be used which resulted in the float being printed as a double when calling
-stringValue or -description.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35022 72102866-910b-0410-8b05-ffd578937521
2012-04-01 07:33:38 +00:00
David Chisnall
93dd8e8f57 Fix small int -> string conversion on 64-bit.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34229 72102866-910b-0410-8b05-ffd578937521
2011-11-29 18:19:37 +00:00
Richard Frith-MacDonald
bc4151c775 get base to compile again, and improve readability/consistency
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34184 72102866-910b-0410-8b05-ffd578937521
2011-11-17 06:11:36 +00:00
David Chisnall
b553578663 Implement the double boxing techniques used by Smalltalk/X and Cincom Smalltalk. Now we can conceal most doubles inside a pointer. This is most useful for LanguageKit, but should save some memory / malloc overhead / heap fragmentation in any code that uses a lot of NSNumbers (e.g. anything that deals with big plists). OS X 10.7 employs a similar trick.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34179 72102866-910b-0410-8b05-ffd578937521
2011-11-16 17:29:15 +00:00
Richard Frith-MacDonald
70f63cc91a fix alignment error
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34108 72102866-910b-0410-8b05-ffd578937521
2011-11-02 15:46:02 +00:00
Fred Kiefer
80c8a7ff06 Temporary revert David's change to use PRIxPTR, PRIuPTR and
PRIdPTR. Old compilers don't handled these well. (That change
didn't have a ChangeLog entry)


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33766 72102866-910b-0410-8b05-ffd578937521
2011-08-20 13:05:37 +00:00
David Chisnall
ca12a84e3f Use the word-size-agnostic printf specifier.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33755 72102866-910b-0410-8b05-ffd578937521
2011-08-16 14:47:35 +00:00
David Chisnall
2d364a86ca Bracket the runtime.h include in a check.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33696 72102866-910b-0410-8b05-ffd578937521
2011-08-05 17:34:47 +00:00
David Chisnall
b85364de7e Cleanup:
- (void)release;
to
- (oneway void)release;
so everything implementing -release actually implements the one declared in the NSObject protocol.

Start marking things that are unavailable in ARC mode as unavailable in ARC mode.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33660 72102866-910b-0410-8b05-ffd578937521
2011-07-31 15:31:39 +00:00
David Chisnall
a124b3a52a Fix the 64-bit bug that Fred spotted.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33649 72102866-910b-0410-8b05-ffd578937521
2011-07-27 08:46:31 +00:00
David Chisnall
7698b8d176 64-bit fix in last commit.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33641 72102866-910b-0410-8b05-ffd578937521
2011-07-26 19:16:14 +00:00
David Chisnall
c0f08f202a Use the small object support in libobjc2 trunk for 31 / 61-bit signed NSNumbers on 32 / 64-bit platforms respectively. Still to do: add an NSSmallFloat equivalent for 64-bit platforms, storing a float.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33639 72102866-910b-0410-8b05-ffd578937521
2011-07-26 19:05:43 +00:00
Richard Frith-MacDonald
497cb2af93 ssh handshake improvements and consmetic tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33535 72102866-910b-0410-8b05-ffd578937521
2011-07-12 11:40:15 +00:00
David Chisnall
26b91d9bcd [NSNumber -init] should not destroy itself when called as [super init]. This behaviour was breaking anything that subclassed NSNumber in user code (e.g. PyObjC).
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33517 72102866-910b-0410-8b05-ffd578937521
2011-07-11 12:36:04 +00:00
Richard Frith-MacDonald
ee798647d7 fixup for signedness ... charValue always returns a signed char
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32777 72102866-910b-0410-8b05-ffd578937521
2011-04-04 16:35:20 +00:00
Richard Frith-MacDonald
0241a4347b double comparison fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32375 72102866-910b-0410-8b05-ffd578937521
2011-02-26 06:29:57 +00:00
Richard Frith-MacDonald
b463bba090 fix error in float comparison
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32361 72102866-910b-0410-8b05-ffd578937521
2011-02-25 00:25:43 +00:00
Richard Frith-MacDonald
2f6264e1cb quick hack for NaN comparison
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32200 72102866-910b-0410-8b05-ffd578937521
2011-02-17 18:04:17 +00:00
David Chisnall
ec239ebfaf Simplify the KVC getter code and make it return structs boxed in NSValues
(Apple-compatible).  This is currently slow, because we go via NSInvocation.
We could probably make it faster, but I am not inclined to optimise for
something that I sincerely hope is a very unusual use case.

Richard: Please check I haven't done something silly here...



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31411 72102866-910b-0410-8b05-ffd578937521
2010-09-24 19:20:16 +00:00
Richard Frith-MacDonald
a4f869f7e5 fix some return type errors
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31338 72102866-910b-0410-8b05-ffd578937521
2010-09-12 17:05:30 +00:00
Richard Frith-MacDonald
683414ae8b Fix for NOB generation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31183 72102866-910b-0410-8b05-ffd578937521
2010-08-18 12:34:56 +00:00
Richard Frith-MacDonald
cdd3ef3c76 Number rewrite broke subclasses ... fix to check for that.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30693 72102866-910b-0410-8b05-ffd578937521
2010-06-12 19:13:23 +00:00
Richard Frith-MacDonald
74736d8ef4 Fix for isEqual: and NaN comparison
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29781 72102866-910b-0410-8b05-ffd578937521
2010-02-26 11:20:21 +00:00
Richard Frith-MacDonald
14b91c9052 fixups for libobjc2
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29753 72102866-910b-0410-8b05-ffd578937521
2010-02-25 18:49:31 +00:00
Fred Kiefer
36da53fca3 Small bug fix for NSNumber to prevent memory leaks.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29706 72102866-910b-0410-8b05-ffd578937521
2010-02-22 23:49:33 +00:00
Richard Frith-MacDonald
dd42cc24ba Move includes to NSObjCRuntime.h to match OSX
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29692 72102866-910b-0410-8b05-ffd578937521
2010-02-20 18:32:07 +00:00
Richard Frith-MacDonald
d819b3a645 remove useless calls to zone of class
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29677 72102866-910b-0410-8b05-ffd578937521
2010-02-19 19:37:04 +00:00
Richard Frith-MacDonald
012fa8e513 Make NSNumber more like OSX ... retain for copy, and return YES/NO as BOOL
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29676 72102866-910b-0410-8b05-ffd578937521
2010-02-19 19:23:03 +00:00
Richard Frith-MacDonald
7cc69dfaae Simplify header inclusion
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29669 72102866-910b-0410-8b05-ffd578937521
2010-02-19 08:12:46 +00:00
Richard Frith-MacDonald
746afbcb53 Update integer limits code.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29661 72102866-910b-0410-8b05-ffd578937521
2010-02-18 07:06:42 +00:00
Richard Frith-MacDonald
7cd2a7551b fix typo
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29660 72102866-910b-0410-8b05-ffd578937521
2010-02-17 22:27:53 +00:00
Richard Frith-MacDonald
92bceae15f standardise on using c99 limits (define old values to the new ones)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29658 72102866-910b-0410-8b05-ffd578937521
2010-02-17 12:07:48 +00:00
Richard Frith-MacDonald
5297a2e32b Rewrite NSNumber code to compile on most systems and to mostly conform to
style/coding standards.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29639 72102866-910b-0410-8b05-ffd578937521
2010-02-15 10:58:34 +00:00
Richard Frith-MacDonald
d2f84d8995 Restore working NSNumber pending fixes to new version to get it to compile
and conform to coding standards/style.  Should get svn trunk working again.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29629 72102866-910b-0410-8b05-ffd578937521
2010-02-14 16:32:02 +00:00
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
Richard Frith-MacDonald
21d597e740 merge back reorganisation branch
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29615 72102866-910b-0410-8b05-ffd578937521
2010-02-14 10:48:10 +00:00
Richard Frith-MacDonald
a15a02db18 Quick hack to try to fix initialisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29393 72102866-910b-0410-8b05-ffd578937521
2010-01-24 17:54:31 +00:00
Richard Frith-MacDonald
24d43481a8 Updates for 10.5 API changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27962 72102866-910b-0410-8b05-ffd578937521
2009-02-23 20:42:32 +00:00
Richard Frith-MacDonald
b2b14398d2 allow developers more time to adapt to LGPLv3
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26606 72102866-910b-0410-8b05-ffd578937521
2008-06-08 10:38:33 +00:00
Richard Frith-MacDonald
62559023b9 Update to GPL3 and LGPL3
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25482 72102866-910b-0410-8b05-ffd578937521
2007-09-14 11:36:11 +00:00
Richard Frith-MacDonald
da789a0c2b Fix bug #20168
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25254 72102866-910b-0410-8b05-ffd578937521
2007-06-14 05:03:35 +00:00