diff --git a/ChangeLog b/ChangeLog index 3bdabee21..708a4e81b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2001-07-10 Richard Frith-Macdonald + + * Source/NSUserDefaults.m: Update date/time designations to arrays + * Source/NSDate.m: Update to use date/time designation arrays. 2001-07-09 Richard Frith-Macdonald * Source/objc-load.m: Remove bogus include of objc-load.h diff --git a/Source/NSDate.m b/Source/NSDate.m index 6d924c602..60dbf2027 100644 --- a/Source/NSDate.m +++ b/Source/NSDate.m @@ -264,30 +264,30 @@ GSTimeNow() */ if (hadDay == NO) { - NSString *tdd = [locale objectForKey: NSThisDayDesignations]; - NSString *ndd = [locale objectForKey: NSNextDayDesignations]; - NSString *pdd = [locale objectForKey: NSPriorDayDesignations]; - NSString *nndd = [locale objectForKey: NSNextNextDayDesignations]; + NSArray *tdd = [locale objectForKey: NSThisDayDesignations]; + NSArray *ndd = [locale objectForKey: NSNextDayDesignations]; + NSArray *pdd = [locale objectForKey: NSPriorDayDesignations]; + NSArray *nndd = [locale objectForKey: NSNextNextDayDesignations]; for (index = 0; hadDay == NO && index < [words count]; index++) { tmp = [words objectAtIndex: index]; - if ([tmp caseInsensitiveCompare: tdd] == NSOrderedSame) + if (findInArray(tdd, 0 ,tmp) != nil) { hadDay = YES; } - else if ([tmp caseInsensitiveCompare: ndd] == NSOrderedSame) + else if (findInArray(ndd, 0 ,tmp) != nil) { modDay++; hadDay = YES; } - else if ([tmp caseInsensitiveCompare: nndd] == NSOrderedSame) + else if (findInArray(nndd, 0 ,tmp) != nil) { modDay += 2; hadDay = YES; } - else if ([tmp caseInsensitiveCompare: pdd] == NSOrderedSame) + else if (findInArray(pdd, 0 ,tmp) != nil) { modDay--; hadDay = YES; diff --git a/Source/NSUserDefaults.m b/Source/NSUserDefaults.m index bc8afea03..ff4526865 100644 --- a/Source/NSUserDefaults.m +++ b/Source/NSUserDefaults.m @@ -144,89 +144,92 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */ NSArray *ymw_names; ampm = [NSArray arrayWithObjects: @"AM", @"PM", nil]; + short_month = [NSArray arrayWithObjects: - @"Jan", - @"Feb", - @"Mar", - @"Apr", - @"May", - @"Jun", - @"Jul", - @"Aug", - @"Sep", - @"Oct", - @"Nov", - @"Dec", - nil]; + @"Jan", + @"Feb", + @"Mar", + @"Apr", + @"May", + @"Jun", + @"Jul", + @"Aug", + @"Sep", + @"Oct", + @"Nov", + @"Dec", + nil]; + long_month = [NSArray arrayWithObjects: - @"January", - @"February", - @"March", - @"April", - @"May", - @"June", - @"July", - @"August", - @"September", - @"October", - @"November", - @"December", - nil]; + @"January", + @"February", + @"March", + @"April", + @"May", + @"June", + @"July", + @"August", + @"September", + @"October", + @"November", + @"December", + nil]; + short_day = [NSArray arrayWithObjects: - @"Sun", - @"Mon", - @"Tue", - @"Wed", - @"Thu", - @"Fri", - @"Sat", - nil]; + @"Sun", + @"Mon", + @"Tue", + @"Wed", + @"Thu", + @"Fri", + @"Sat", + nil]; + long_day = [NSArray arrayWithObjects: - @"Sunday", - @"Monday", - @"Tuesday", - @"Wednesday", - @"Thursday", - @"Friday", - @"Saturday", - nil]; + @"Sunday", + @"Monday", + @"Tuesday", + @"Wednesday", + @"Thursday", + @"Friday", + @"Saturday", + nil]; + earlyt = [NSArray arrayWithObjects: - @"prior", - @"last", - @"past", - @"ago", - nil]; - latert = [NSArray arrayWithObjects: - @"next", - nil]; - ymw_names = [NSArray arrayWithObjects: - @"year", - @"month", - @"week", - nil]; + @"prior", + @"last", + @"past", + @"ago", + nil]; + + latert = [NSArray arrayWithObjects: @"next", nil]; + + ymw_names = [NSArray arrayWithObjects: @"year", @"month", @"week", nil]; + hour_names = [NSArray arrayWithObjects: - [NSArray arrayWithObjects: @"0", @"midnight", nil], - [NSArray arrayWithObjects: @"12", @"noon", @"lunch", nil], - [NSArray arrayWithObjects: @"10", @"morning", nil], - [NSArray arrayWithObjects: @"14", @"afternoon", nil], - [NSArray arrayWithObjects: @"19", @"dinner", nil], - nil]; + [NSArray arrayWithObjects: @"0", @"midnight", nil], + [NSArray arrayWithObjects: @"12", @"noon", @"lunch", nil], + [NSArray arrayWithObjects: @"10", @"morning", nil], + [NSArray arrayWithObjects: @"14", @"afternoon", nil], + [NSArray arrayWithObjects: @"19", @"dinner", nil], + nil]; + registrationDefaults = [NSDictionary dictionaryWithObjectsAndKeys: - ampm, NSAMPMDesignation, - long_month, NSMonthNameArray, - long_day, NSWeekDayNameArray, - short_month, NSShortMonthNameArray, - short_day, NSShortWeekDayNameArray, - @"DMYH", NSDateTimeOrdering, - @"tomorrow", NSNextDayDesignations, - @"nextday", NSNextNextDayDesignations, - @"yesterday", NSPriorDayDesignations, - @"today", NSThisDayDesignations, - earlyt, NSEarlierTimeDesignations, - latert, NSLaterTimeDesignations, - hour_names, NSHourNameDesignations, - ymw_names, NSYearMonthWeekDesignations, - nil]; + ampm, NSAMPMDesignation, + long_month, NSMonthNameArray, + long_day, NSWeekDayNameArray, + short_month, NSShortMonthNameArray, + short_day, NSShortWeekDayNameArray, + @"DMYH", NSDateTimeOrdering, + [NSArray arrayWithObject: @"tomorrow"], NSNextDayDesignations, + [NSArray arrayWithObject: @"nextday"], NSNextNextDayDesignations, + [NSArray arrayWithObject: @"yesterday"], NSPriorDayDesignations, + [NSArray arrayWithObject: @"today"], NSThisDayDesignations, + earlyt, NSEarlierTimeDesignations, + latert, NSLaterTimeDesignations, + hour_names, NSHourNameDesignations, + ymw_names, NSYearMonthWeekDesignations, + nil]; return registrationDefaults; }