Re: Fix, Base/GDL2 GSCompatibility.m (-boolValue)
Am Montag, den 27.07.2009, 11:39 +0800 schrieb Georg Fleischmann: Hi, #ifndef MAC_OS_X_VERSION_10_5 - (BOOL) boolValue { ... } #endif Well that version will work for the current version but will compile it again for future versions. My best bet would be something like the attached patch. Richard, is this usage of the API macros legitimate? From my understanding it should continue to work. MAC_OS_X_VERSION_10_5 is supposed to be defined on Apple 10.5 systems and later, but not before. Ah... OK, Thanks! I did not know/understand that... So I committed you original suggestion. Let me know if works as expected. Cheers, David -- David Ayers Fellow of the Free Software Foundation Europe http://www.fsfe.org http://fellowship.fsfe.org ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix, Base/GDL2 GSCompatibility.m (-boolValue)
Hey, Am Sonntag, den 26.07.2009, 11:10 +0800 schrieb Georg Fleischmann: I believe this is not correct. -boolValue is documented in Cocoa to do pretty much what the compatibility implementation does. So I believe the correct fix would be to simply remove our compatibility category. [NSString boolValue] has just been added in Mac OS 10.5, but basically the method does the same thing. I feel it still makes sense to have this method in GSCompatibility, since Mac OS 10.4 is good. It would be great if someone who understands the macro magic wrt. OS X versions could compile the category conditionally and sync the implementation. The following does it: #ifndef MAC_OS_X_VERSION_10_5 - (BOOL) boolValue { ... } #endif Well that version will work for the current version but will compile it again for future versions. My best bet would be something like the attached patch. Richard, is this usage of the API macros legitimate? Cheers, David PS: The patch is untested since I do not have an Cocoa version. -- David Ayers Fellow of the Free Software Foundation Europe http://www.fsfe.org http://fellowship.fsfe.org Index: Source/Additions/GSCompatibility.m === --- Source/Additions/GSCompatibility.m (Revision 28408) +++ Source/Additions/GSCompatibility.m (Arbeitskopie) @@ -394,6 +394,7 @@ @implementation NSString(GSCompatibility) +#if OS_API_VERSION (MAC_OS_X_VERSION_10_2,MAC_OS_X_VERSION_10_5) // From GNUStep /** * If the string consists of the words 'true' or 'yes' (case insensitive) @@ -402,16 +403,20 @@ */ - (BOOL) boolValue { - if ([self caseInsensitiveCompare: @YES] == NSOrderedSame) + static NSCharacterSet *yes = nil; + + if (yes == nil) { -return YES; + yes = RETAIN([NSCharacterSet characterSetWithCharactersInString: + @123456789yYtT]); } - if ([self caseInsensitiveCompare: @true] == NSOrderedSame) + if ([self rangeOfCharacterFromSet: yes].length 0) { -return YES; + return YES; } - return [self intValue] != 0 ? YES : NO; + return NO; } +#endif - (NSString*) substringFromRange:(NSRange)range { ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix, Base/GDL2 GSCompatibility.m (-boolValue)
Hi, #ifndef MAC_OS_X_VERSION_10_5 - (BOOL) boolValue { ... } #endif Well that version will work for the current version but will compile it again for future versions. My best bet would be something like the attached patch. Richard, is this usage of the API macros legitimate? From my understanding it should continue to work. MAC_OS_X_VERSION_10_5 is supposed to be defined on Apple 10.5 systems and later, but not before. #if OS_API_VERSION (MAC_OS_X_VERSION_10_2,MAC_OS_X_VERSION_10_5) Looks like your patch does work also but I don't understand why, for in my test on 10.4.11, MAC_OS_X_VERSION_10_5 is clearly undefined. And the macro and the values look like this: #define OS_API_VERSION(ADD,REM) \ (!defined(GS_OPENSTEP_V) || (GS_OPENSTEP_V = ADD GS_OPENSTEP_V REM)) MAC_OS_X_VERSION_MAX_ALLOWED = 1040, so GS_OPENSTEP_V would be 1040. ADD = 1020 REM is undefined Maybe, to make it fail-safe add a test if MAC_OS_X_VERSION_10_5 is defined? #if !defined(MAC_OS_X_VERSION_10_5) || OS_API_VERSION (MAC_OS_X_VERSION_10_2,MAC_OS_X_VERSION_10_5) ... #endif I tested this on 10.4 and it works. Best wishes, Georg On 26.07.2009, at 21:01, David Ayers wrote: Hey, Am Sonntag, den 26.07.2009, 11:10 +0800 schrieb Georg Fleischmann: I believe this is not correct. -boolValue is documented in Cocoa to do pretty much what the compatibility implementation does. So I believe the correct fix would be to simply remove our compatibility category. [NSString boolValue] has just been added in Mac OS 10.5, but basically the method does the same thing. I feel it still makes sense to have this method in GSCompatibility, since Mac OS 10.4 is good. It would be great if someone who understands the macro magic wrt. OS X versions could compile the category conditionally and sync the implementation. The following does it: #ifndef MAC_OS_X_VERSION_10_5 - (BOOL) boolValue { ... } #endif Well that version will work for the current version but will compile it again for future versions. My best bet would be something like the attached patch. Richard, is this usage of the API macros legitimate? Cheers, David PS: The patch is untested since I do not have an Cocoa version. -- David Ayers Fellow of the Free Software Foundation Europe http://www.fsfe.org http://fellowship.fsfe.org base.patch ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix, Base/GDL2 GSCompatibility.m (-boolValue)
Hi, I believe this is not correct. -boolValue is documented in Cocoa to do pretty much what the compatibility implementation does. So I believe the correct fix would be to simply remove our compatibility category. [NSString boolValue] has just been added in Mac OS 10.5, but basically the method does the same thing. I feel it still makes sense to have this method in GSCompatibility, since Mac OS 10.4 is good. It would be great if someone who understands the macro magic wrt. OS X versions could compile the category conditionally and sync the implementation. The following does it: #ifndef MAC_OS_X_VERSION_10_5 - (BOOL) boolValue { ... } #endif Best wishes, Georg On 25.07.2009, at 01:28, David Ayers wrote: Hello Georg, Am Freitag, den 17.07.2009, 10:50 +0800 schrieb Georg Fleischmann: here is a patch for Base to make GDL2 on Cocoa work with boolean values from EOModels. The boolean values in my EOModel files are stored as Y only, not a complete Yes ( allowsNull = Y; ). This (Y) works fine on a complete GNUstep system, but fails with the Compatibility code that is only allowing a complete YES (or TRUE). The attached patch makes this work for me with Cocoa. I tried to make it similar to the latest boolValue method in GSString, testing for 123456789yYtT. Best wishes, Georg PS: I am still using Base-Version 1.15.0 on Apple, because the current base-versions doesn't seem to compile any more with Mac OS 10.4.11. Anyway, [GSCompatibility -boolValue] didn't change since then. I believe this is not correct. -boolValue is documented in Cocoa to do pretty much what the compatibility implementation does. So I believe the correct fix would be to simply remove our compatibility category. I could commit that patch right now, but I had second thoughts that the category would still be useful for older Cocoa/OS X versions. But even then, it should be synchronized with current implementation of -base. It would be great if someone who understands the macro magic wrt. OS X versions could compile the category conditionally and sync the implementation. Cheers, David *** Source/Additions/GSCompatibility.m.old Thu Apr 12 22:27:47 2007 --- Source/Additions/GSCompatibility.m Fri Jul 17 10:29:29 2009 *** *** 390,404 */ - (BOOL) boolValue { ! if ([self caseInsensitiveCompare: @YES] == NSOrderedSame) { ! return YES; ! } ! if ([self caseInsensitiveCompare: @true] == NSOrderedSame) ! { ! return YES; } ! return [self intValue] != 0 ? YES : NO; } - (NSString*) substringFromRange:(NSRange)range --- 390,405 */ - (BOOL) boolValue { ! if ([self length]) { ! unichar uc = [self characterAtIndex:0]; ! ! if (uc = 0x7F strchr(123456789yYtT, (char)uc) != 0) ! { ! return YES; ! } } ! return NO; } - (NSString*) substringFromRange:(NSRange)range ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep -- David Ayers Fellow of the Free Software Foundation Europe http://www.fsfe.org http://fellowship.fsfe.org ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep
Re: Fix, Base/GDL2 GSCompatibility.m (-boolValue)
Hello Georg, Am Freitag, den 17.07.2009, 10:50 +0800 schrieb Georg Fleischmann: here is a patch for Base to make GDL2 on Cocoa work with boolean values from EOModels. The boolean values in my EOModel files are stored as Y only, not a complete Yes ( allowsNull = Y; ). This (Y) works fine on a complete GNUstep system, but fails with the Compatibility code that is only allowing a complete YES (or TRUE). The attached patch makes this work for me with Cocoa. I tried to make it similar to the latest boolValue method in GSString, testing for 123456789yYtT. Best wishes, Georg PS: I am still using Base-Version 1.15.0 on Apple, because the current base-versions doesn't seem to compile any more with Mac OS 10.4.11. Anyway, [GSCompatibility -boolValue] didn't change since then. I believe this is not correct. -boolValue is documented in Cocoa to do pretty much what the compatibility implementation does. So I believe the correct fix would be to simply remove our compatibility category. I could commit that patch right now, but I had second thoughts that the category would still be useful for older Cocoa/OS X versions. But even then, it should be synchronized with current implementation of -base. It would be great if someone who understands the macro magic wrt. OS X versions could compile the category conditionally and sync the implementation. Cheers, David *** Source/Additions/GSCompatibility.m.oldThu Apr 12 22:27:47 2007 --- Source/Additions/GSCompatibility.mFri Jul 17 10:29:29 2009 *** *** 390,404 */ - (BOOL) boolValue { ! if ([self caseInsensitiveCompare: @YES] == NSOrderedSame) { ! return YES; ! } ! if ([self caseInsensitiveCompare: @true] == NSOrderedSame) ! { ! return YES; } ! return [self intValue] != 0 ? YES : NO; } - (NSString*) substringFromRange:(NSRange)range --- 390,405 */ - (BOOL) boolValue { ! if ([self length]) { ! unichar uc = [self characterAtIndex:0]; ! ! if (uc = 0x7F strchr(123456789yYtT, (char)uc) != 0) ! { ! return YES; ! } } ! return NO; } - (NSString*) substringFromRange:(NSRange)range ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep -- David Ayers Fellow of the Free Software Foundation Europe http://www.fsfe.org http://fellowship.fsfe.org ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep
Fix, Base/GDL2 GSCompatibility.m (-boolValue)
here is a patch for Base to make GDL2 on Cocoa work with boolean values from EOModels. The boolean values in my EOModel files are stored as Y only, not a complete Yes ( allowsNull = Y; ). This (Y) works fine on a complete GNUstep system, but fails with the Compatibility code that is only allowing a complete YES (or TRUE). The attached patch makes this work for me with Cocoa. I tried to make it similar to the latest boolValue method in GSString, testing for 123456789yYtT. Best wishes, Georg PS: I am still using Base-Version 1.15.0 on Apple, because the current base-versions doesn't seem to compile any more with Mac OS 10.4.11. Anyway, [GSCompatibility -boolValue] didn't change since then. *** Source/Additions/GSCompatibility.m.old Thu Apr 12 22:27:47 2007 --- Source/Additions/GSCompatibility.m Fri Jul 17 10:29:29 2009 *** *** 390,404 */ - (BOOL) boolValue { ! if ([self caseInsensitiveCompare: @YES] == NSOrderedSame) { ! return YES; ! } ! if ([self caseInsensitiveCompare: @true] == NSOrderedSame) ! { ! return YES; } ! return [self intValue] != 0 ? YES : NO; } - (NSString*) substringFromRange:(NSRange)range --- 390,405 */ - (BOOL) boolValue { ! if ([self length]) { ! unichar uc = [self characterAtIndex:0]; ! ! if (uc = 0x7F strchr(123456789yYtT, (char)uc) != 0) ! { ! return YES; ! } } ! return NO; } - (NSString*) substringFromRange:(NSRange)range ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep