Commit graph

54 commits

Author SHA1 Message Date
Hugo Melder
6681a3da47
Initial port of WinObjC's KVO implementation to GNUstep (#420)
* GSAtomic: Add prefix to macro definitions

* NSKVOSupport: Import

* NSKVOSupport: Add test cases

* NSKVOSwizzling: Ugly C Rewrite

* NSKeyValueObserving: Use old implementation as fallback

* NSKeyValueObserving: Rename TypeEncodingCases header

* NSKVOSupport: Fix new objects not being added to NSKeyValueChangeNew set on set mutation

* NSKeyValueMutableSet: Fix will and didChange notifications for set operations

* NSKeyValueMutableSet: Document Accessor Search Patterns

* NSKVOSupport: Add toMany test

* NSKeyValueCoding: Change notifications when changing value via setValue:forKey:

* NSKVOSupport: Add more tests

* NSKVOSupport: Do not wrap block in try/finally to avoid crash in windows

* NSKVOSwizzling: use _alloca on Windows

* NSKVOSupport: Do not autorelease newWithObservee:

* NSKVOSupport: Do not leak Observee and TestFacade objects

* Improve runtime detection in makefile

* Add file extension of source file in GNUMakefile

* NSKVOSupport: Remove @status comments

* NSKVOSupport: Implement private notify method

* NSUserDefaults: KVO Support and fix macOS incompatibilities

* NSKeyValueObserving: Set old to null if nil

* NSKeyValueObserving: Remove cached new value

* NSMethodSignature: Add signature cache

* NSKVOSupport: Remove ObjC2 features and mark tests failing on GCC as hopeful

* Call class method instead of private _keyPathsForValuesAffectingValueForKey

* Move _keyPathsForValuesAffectingValueForKey body into class method and statically construct empty NSSet

* NSUserDefaults: Change notification should contain old value from other domains aswell

* NSUserDefaults: Fetch new value from all domains

* NSKVOInternal: Fixup filename in header

* NSUserDefaults: Go through search list instead of only one domain in KVO change

* Making indentation a bit less worse

* Add NSUserDefaults KVO tests

* NSKVOSupport: NSUserDefaults test small fixes

* Add autoreleasepool

* NSUserDefaults: Only emit change notifications if value changed

* Avoid compiler warnings and tidy some of the whitespace/formatting

---------

Co-authored-by: Frederik Seiffert <frederik@algoriddim.com>
Co-authored-by: rfm <richardfrithmacdonald@gmail.com>
Co-authored-by: rfm <rfm@gnu.org>
2024-11-10 17:05:23 +01:00
rfm
6667842dd5 Update FSF address as requested by Gregory 2024-11-07 13:37:59 +00:00
Hugo Melder
6eef1c3289
NSKeyValueCoding: Safe-Caching for -[NSObject valueForKey:] (#445)
* KVC Caching Implementation

* Do not ignore struct name when comparing type encoding as NSPoint and NSSize have the same layout

* Use fast-path when using Objective-C 2

* Guard old ValueForKey function when using the fast-path

* Add basic NSKeyValueCoding tests

* Update Copyright Years

* NSKeyValueCoding+Caching: Add Versioning to IVar Slot

* safe_caching: Remove Guards

* Add type encoding helper header

* Rename geometry structs (NSRect, NSPoint, NSSize) for toll-free bridging with CoreGraphics

* Move CG struct definitions to CFCGTypes.h

* Update known struct encoding prefixes

* Windows 64-bit is LLP64 and not LP64

* Re-order to avoid complier warning

---------

Co-authored-by: rfm <richardfrithmacdonald@gmail.com>
2024-10-29 14:12:34 +01:00
Frederik Seiffert
0582eddd96 Export string constants and annotate exported function implementations
Moves scattered string constants to externs.m, and removes obsolete code replacing constant strings.
2021-03-27 17:36:15 +01:00
Richard Frith-Macdonald
379f5f0040 use memcpy rather than strncpy to avoid compiler warnings 2020-12-03 11:59:37 -05:00
Gregory John Casamento
753c907938 Fix address for FSF and License name in all headers in base 2019-12-09 18:36:00 -05:00
Richard Frith-MacDonald
6297efeec9 optimisation and compatiblity tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38524 72102866-910b-0410-8b05-ffd578937521
2015-05-22 15:34:25 +00:00
Manuel Guesdon
188ac8a232 Fix exception msg in setValue:forUndefinedKey:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37814 72102866-910b-0410-8b05-ffd578937521
2014-04-26 18:39:34 +00:00
Richard Frith-MacDonald
da4f7056ca printf style format tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36799 72102866-910b-0410-8b05-ffd578937521
2013-07-02 15:46:26 +00:00
Richard Frith-MacDonald
8e79a9764f avoid a few warnings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34665 72102866-910b-0410-8b05-ffd578937521
2012-01-30 11:31:40 +00:00
Richard Frith-MacDonald
41a929293c remove redundant code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32510 72102866-910b-0410-8b05-ffd578937521
2011-03-09 10:32:48 +00:00
Richard Frith-MacDonald
96e48988fc avoid compiler/linker warnings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32483 72102866-910b-0410-8b05-ffd578937521
2011-03-07 11:34:17 +00:00
Richard Frith-MacDonald
8177a34a8f tweaks to avoid clang warnings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31293 72102866-910b-0410-8b05-ffd578937521
2010-09-10 12:47:04 +00:00
Richard Frith-MacDonald
802800537a use new runtime api directly to lookup selectors
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31182 72102866-910b-0410-8b05-ffd578937521
2010-08-18 10:45:27 +00:00
Quentin Mathe
8633b7d611 Added missing support to ValueForKey() as described in Apple Key-Value-Coding guide.
-isKey is now treated as a KVC-compliant getter, and _isKey and isKey as 
KVC-compliant ivars.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30464 72102866-910b-0410-8b05-ffd578937521
2010-05-28 12:05:07 +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
c8a6832349 cosmetic tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29657 72102866-910b-0410-8b05-ffd578937521
2010-02-17 11:47:06 +00:00
Richard Frith-MacDonald
f2a516bf74 fix for bug #25720 as suggested by Michael Johnston
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27995 72102866-910b-0410-8b05-ffd578937521
2009-02-27 12:54:15 +00:00
Richard Frith-MacDonald
1674ac3746 Attempt fix for bug #24978
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27183 72102866-910b-0410-8b05-ffd578937521
2008-12-01 18:38:58 +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
3ccc51710e Fix for MacOS-X compatibility accessing ivars directly
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26312 72102866-910b-0410-8b05-ffd578937521
2008-03-16 07:34:25 +00:00
Richard Frith-MacDonald
bd6cb46651 Make keypath evaluation recursive.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26296 72102866-910b-0410-8b05-ffd578937521
2008-03-13 12:10:01 +00:00
David Ayers
5ecf865b39 * Source/NSKeyValueCoding.m ([-setValue:forKey:]): Pass value
to takeValue:forKey:.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26200 72102866-910b-0410-8b05-ffd578937521
2008-03-05 12:26:13 +00:00
Richard Frith-MacDonald
166b8e5082 Avoid calling depreceted methods just because KVO has overridden them.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26170 72102866-910b-0410-8b05-ffd578937521
2008-03-02 08:23:51 +00:00
Richard Frith-MacDonald
35c51c72a3 Backward compatibility fix.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25639 72102866-910b-0410-8b05-ffd578937521
2007-11-29 20:56:11 +00:00
Richard Frith-MacDonald
d6cfc0e91c Improve MacOS-X compatibility of headers.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25638 72102866-910b-0410-8b05-ffd578937521
2007-11-29 20:53:26 +00:00
Richard Frith-MacDonald
444b1723e0 Remove erroneous check
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25629 72102866-910b-0410-8b05-ffd578937521
2007-11-29 08:59:14 +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
Riccardo Mottola
d09e2096de code tidyup and c-99ism fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25341 72102866-910b-0410-8b05-ffd578937521
2007-07-19 21:38:14 +00:00
Richard Frith-MacDonald
f6a57d5fba Varous tidyups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25330 72102866-910b-0410-8b05-ffd578937521
2007-07-14 04:34:00 +00:00
Nicola Pero
6848cb6de9 Review of KVC and improvements by Chris Farber
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25313 72102866-910b-0410-8b05-ffd578937521
2007-07-10 17:16:31 +00:00
Richard Frith-MacDonald
dd723fd60e Fix backward compatibility issue
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25230 72102866-910b-0410-8b05-ffd578937521
2007-06-08 08:04:14 +00:00
Richard Frith-MacDonald
d91962866d Fix bug getting cstring from literal containing illegal characters.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25227 72102866-910b-0410-8b05-ffd578937521
2007-06-08 06:00:11 +00:00
Richard Frith-MacDonald
fb633a8a16 Use utf8 rather than ascii
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25222 72102866-910b-0410-8b05-ffd578937521
2007-06-06 09:18:54 +00:00
Richard Frith-MacDonald
f69d5c44b4 Minor backward compatibility fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25210 72102866-910b-0410-8b05-ffd578937521
2007-05-31 06:27:39 +00:00
Richard Frith-MacDonald
546aa0c854 Avoid some gcc-4.1 compiler warnings.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22932 72102866-910b-0410-8b05-ffd578937521
2006-05-15 12:07:35 +00:00
Richard Frith-MacDonald
9989d955b5 Fix bug #16386
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22823 72102866-910b-0410-8b05-ffd578937521
2006-04-26 12:24:03 +00:00
Richard Frith-MacDonald
6557439b89 Hopefully fix semantics for key path handling
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22647 72102866-910b-0410-8b05-ffd578937521
2006-03-13 07:00:49 +00:00
Richard Frith-MacDonald
854cd456b0 Various bugfixes, portability fixes, and optimisations.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22576 72102866-910b-0410-8b05-ffd578937521
2006-02-27 09:35:19 +00:00
Richard Frith-Macdonald
ac5ecec04f Fix for bug #13482
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21341 72102866-910b-0410-8b05-ffd578937521
2005-06-22 09:09:40 +00:00
Adam Fedor
fcc13ccd0f * Update FSF Address.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21245 72102866-910b-0410-8b05-ffd578937521
2005-05-22 03:32:16 +00:00
Richard Frith-Macdonald
55b01ec39a Make fixes suggested by David Ayers
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20829 72102866-910b-0410-8b05-ffd578937521
2005-03-02 13:39:33 +00:00
Richard Frith-Macdonald
826de16ee7 KVC updates
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20828 72102866-910b-0410-8b05-ffd578937521
2005-03-02 11:46:21 +00:00
Richard Frith-Macdonald
db7b22a4fb Tidy up use of white space so we have it after if/for/while and not after (
or before ) or padding at end of line.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20773 72102866-910b-0410-8b05-ffd578937521
2005-02-22 11:22:44 +00:00
Adrian Robert
7d6e6c476c comment cleanups to improve documentation output
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20094 72102866-910b-0410-8b05-ffd578937521
2004-09-19 23:24:36 +00:00
Manuel Guesdon
d670561aaf * Source/NSKeyValueCoding.m: fix exception userInfo
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19544 72102866-910b-0410-8b05-ffd578937521
2004-06-18 18:09:19 +00:00
Adam Fedor
d228cba99b Change syntax of includes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16874 72102866-910b-0410-8b05-ffd578937521
2003-06-07 01:24:41 +00:00
David Ayers
7d885b66c8 * Source/NSKeyValueCoding.m: Added documentation.
* Source/NSKeyValueCoding.m ([NSObject -takeValue:forKey:]),
        ([NSObject -valueForKey:]): Corrected search order of instance
        variables.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16271 72102866-910b-0410-8b05-ffd578937521
2003-03-27 08:57:14 +00:00
Richard Frith-Macdonald
5c49ef401a Merged in 1.6.0 branch
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16228 72102866-910b-0410-8b05-ffd578937521
2003-03-23 07:06:27 +00:00
David Ayers
e6e695d2b1 * Source/NSKeyValueCoding.m ([-takeStoredValuesFromDictionary:]):
Implemented.
        * Headers/gnustep/base/NSKeyValueCoding.h: Ditto.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16012 72102866-910b-0410-8b05-ffd578937521
2003-02-19 14:42:07 +00:00