mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Various minor modifications.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8245 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7961c760c9
commit
a1d9d92494
5 changed files with 121 additions and 84 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2000-12-02 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSDate.m: GSTime() added millisecond info.
|
||||||
|
* Source/NSCalendarDate.m: GSTime() added millisecond info.
|
||||||
|
* Headers/Foundation/NSDate.h: GSTime() added millisecond info.
|
||||||
|
* Source/NSObject.m: key-value-coding restructured to simplify
|
||||||
|
future implementation for non-object values.
|
||||||
|
|
||||||
2000-11-30 Richard Frith-Macdonald <rfm@gnu.org>
|
2000-11-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSCalendarDate.m: ([-initWithString:calendarFormat:locale:])
|
* Source/NSCalendarDate.m: ([-initWithString:calendarFormat:locale:])
|
||||||
|
|
|
@ -107,7 +107,7 @@ typedef double NSTimeInterval;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NSTimeInterval GSTimeNow(); /* Get time since reference date*/
|
NSTimeInterval GSTimeNow(); /* Get time since reference date*/
|
||||||
NSTimeInterval GSTime(int day, int mon, int year, int hour, int min, int sec);
|
NSTimeInterval GSTime(int d, int m, int y, int hh, int mm, int ss, int mil);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ absoluteGregorianDay(int day, int month, int year)
|
||||||
* External - so NSDate can use it.
|
* External - so NSDate can use it.
|
||||||
*/
|
*/
|
||||||
NSTimeInterval
|
NSTimeInterval
|
||||||
GSTime(int day, int month, int year, int h, int m, int s)
|
GSTime(int day, int month, int year, int h, int m, int s, int mil)
|
||||||
{
|
{
|
||||||
NSTimeInterval a;
|
NSTimeInterval a;
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ GSTime(int day, int month, int year, int h, int m, int s)
|
||||||
a += h * 3600;
|
a += h * 3600;
|
||||||
a += m * 60;
|
a += m * 60;
|
||||||
a += s;
|
a += s;
|
||||||
|
a += mil/1000.0;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,7 +933,7 @@ static inline int getDigits(const char *from, char *to, int limit)
|
||||||
NSTimeInterval s;
|
NSTimeInterval s;
|
||||||
|
|
||||||
// Calculate date as GMT
|
// Calculate date as GMT
|
||||||
s = GSTime(day, month, year, hour, minute, second);
|
s = GSTime(day, month, year, hour, minute, second, 0);
|
||||||
|
|
||||||
// Assign time zone detail
|
// Assign time zone detail
|
||||||
_time_zone = RETAIN([aTimeZone
|
_time_zone = RETAIN([aTimeZone
|
||||||
|
|
|
@ -147,8 +147,8 @@ GSTimeNow()
|
||||||
* Get current GMT time, convert to NSTimeInterval since reference date,
|
* Get current GMT time, convert to NSTimeInterval since reference date,
|
||||||
*/
|
*/
|
||||||
GetSystemTime(&sys_time);
|
GetSystemTime(&sys_time);
|
||||||
t = GSTime(sys_time.wDay, sys_time.wMonth, sys_time.wYear,
|
t = GSTime(sys_time.wDay, sys_time.wMonth, sys_time.wYear, sys_time.wHour,
|
||||||
sys_time.wHour, sys_time.wMinute, sys_time.wSecond);
|
sys_time.wMinute, sys_time.wSecond, sys_time.wMilliseconds);
|
||||||
#endif
|
#endif
|
||||||
return t + sys_time.wMilliseconds / 1000.0;
|
return t + sys_time.wMilliseconds / 1000.0;
|
||||||
#endif /* __MINGW__ */
|
#endif /* __MINGW__ */
|
||||||
|
|
|
@ -1375,7 +1375,9 @@ static BOOL deallocNotifications = NO;
|
||||||
|
|
||||||
- (void) takeStoredValue: (id)anObject forKey: (NSString*)aKey
|
- (void) takeStoredValue: (id)anObject forKey: (NSString*)aKey
|
||||||
{
|
{
|
||||||
SEL sel;
|
SEL sel = 0;
|
||||||
|
const char *type = 0;
|
||||||
|
NSString *name;
|
||||||
|
|
||||||
if ([[self class] useStoredAccessor] == NO)
|
if ([[self class] useStoredAccessor] == NO)
|
||||||
{
|
{
|
||||||
|
@ -1383,72 +1385,87 @@ static BOOL deallocNotifications = NO;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sel = NSSelectorFromString([NSString stringWithFormat: @"_set%@:",
|
name = [NSString stringWithFormat: @"_set%@:", [aKey capitalizedString]];
|
||||||
[aKey capitalizedString]]);
|
sel = NSSelectorFromString(name);
|
||||||
if ([self respondsToSelector: sel] == YES)
|
if ([self respondsToSelector: sel] == NO)
|
||||||
{
|
{
|
||||||
[self performSelector: sel withObject: anObject];
|
sel = 0;
|
||||||
return;
|
if ([[self class] accessInstanceVariablesDirectly] == YES)
|
||||||
}
|
|
||||||
|
|
||||||
if ([[self class] accessInstanceVariablesDirectly] == YES)
|
|
||||||
{
|
|
||||||
if (GSSetInstanceVariable(self, [NSString stringWithFormat: @"_%@", aKey],
|
|
||||||
(void*)&anObject) == YES)
|
|
||||||
{
|
{
|
||||||
return;
|
name = [NSString stringWithFormat: @"_%@", aKey];
|
||||||
|
type = GSInstanceVariableType(self, name);
|
||||||
|
if (type == 0)
|
||||||
|
{
|
||||||
|
name = aKey;
|
||||||
|
type = GSInstanceVariableType(self, name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (GSSetInstanceVariable(self, aKey, (void*)&anObject) == YES)
|
if (type == 0)
|
||||||
{
|
{
|
||||||
return;
|
name = [NSString stringWithFormat: @"set%@:",
|
||||||
|
[aKey capitalizedString]];
|
||||||
|
sel = NSSelectorFromString(name);
|
||||||
|
if ([self respondsToSelector: sel] == NO)
|
||||||
|
{
|
||||||
|
sel = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sel = NSSelectorFromString([NSString stringWithFormat: @"set%@:",
|
if (sel != 0)
|
||||||
[aKey capitalizedString]]);
|
|
||||||
if ([self respondsToSelector: sel] == YES)
|
|
||||||
{
|
{
|
||||||
[self performSelector: sel withObject: anObject];
|
[self performSelector: sel withObject: anObject];
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (type != 0)
|
||||||
[self handleTakeValue: anObject forUnboundKey: aKey];
|
{
|
||||||
|
GSSetInstanceVariable(self, name, (void*)&anObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self handleTakeValue: anObject forUnboundKey: aKey];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) takeValue: (id)anObject forKey: (NSString*)aKey
|
- (void) takeValue: (id)anObject forKey: (NSString*)aKey
|
||||||
{
|
{
|
||||||
SEL sel;
|
SEL sel = 0;
|
||||||
|
const char *type = 0;
|
||||||
|
NSString *name = nil;
|
||||||
|
|
||||||
sel = NSSelectorFromString([NSString stringWithFormat: @"set%@:",
|
name = [NSString stringWithFormat: @"set%@:", [aKey capitalizedString]];
|
||||||
[aKey capitalizedString]]);
|
sel = NSSelectorFromString(name);
|
||||||
if ([self respondsToSelector: sel] == YES)
|
if ([self respondsToSelector: sel] == NO)
|
||||||
{
|
{
|
||||||
[self performSelector: sel withObject: anObject];
|
name = [NSString stringWithFormat: @"_set%@:", [aKey capitalizedString]];
|
||||||
return;
|
sel = NSSelectorFromString(name);
|
||||||
}
|
if ([self respondsToSelector: sel] == NO)
|
||||||
|
|
||||||
sel = NSSelectorFromString([NSString stringWithFormat: @"_set%@:",
|
|
||||||
[aKey capitalizedString]]);
|
|
||||||
if ([self respondsToSelector: sel] == YES)
|
|
||||||
{
|
|
||||||
[self performSelector: sel withObject: anObject];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([[self class] accessInstanceVariablesDirectly] == YES)
|
|
||||||
{
|
|
||||||
if (GSSetInstanceVariable(self, [NSString stringWithFormat: @"_%@", aKey],
|
|
||||||
(void*)&anObject) == YES)
|
|
||||||
{
|
{
|
||||||
return;
|
sel = 0;
|
||||||
}
|
if ([[self class] accessInstanceVariablesDirectly] == YES)
|
||||||
if (GSSetInstanceVariable(self, aKey, (void*)&anObject) == YES)
|
{
|
||||||
{
|
name = [NSString stringWithFormat: @"_%@", aKey];
|
||||||
return;
|
type = GSInstanceVariableType(self, name);
|
||||||
|
if (type == 0)
|
||||||
|
{
|
||||||
|
name = aKey;
|
||||||
|
type = GSInstanceVariableType(self, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[self handleTakeValue: anObject forUnboundKey: aKey];
|
if (sel != 0)
|
||||||
|
{
|
||||||
|
[self performSelector: sel withObject: anObject];
|
||||||
|
}
|
||||||
|
else if (type != 0)
|
||||||
|
{
|
||||||
|
GSSetInstanceVariable(self, name, (void*)&anObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self handleTakeValue: anObject forUnboundKey: aKey];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) takeValue: (id)anObject forKeyPath: (NSString*)aKey
|
- (void) takeValue: (id)anObject forKeyPath: (NSString*)aKey
|
||||||
|
@ -1494,49 +1511,60 @@ static BOOL deallocNotifications = NO;
|
||||||
|
|
||||||
- (id) valueForKey: (NSString*)aKey
|
- (id) valueForKey: (NSString*)aKey
|
||||||
{
|
{
|
||||||
SEL sel;
|
SEL sel = 0;
|
||||||
|
NSString *name = nil;
|
||||||
|
const char *type = 0;
|
||||||
|
|
||||||
sel = NSSelectorFromString([NSString stringWithFormat: @"get%@",
|
name = [NSString stringWithFormat: @"get%@", [aKey capitalizedString]];
|
||||||
[aKey capitalizedString]]);
|
sel = NSSelectorFromString(name);
|
||||||
if ([self respondsToSelector: sel] == YES)
|
if ([self respondsToSelector: sel] == NO)
|
||||||
{
|
{
|
||||||
return [self performSelector: sel];
|
name = aKey;
|
||||||
}
|
sel = NSSelectorFromString(name);
|
||||||
sel = NSSelectorFromString(aKey);
|
if ([self respondsToSelector: sel] == NO)
|
||||||
if ([self respondsToSelector: sel] == YES)
|
{
|
||||||
{
|
name = [NSString stringWithFormat: @"_get%@",
|
||||||
return [self performSelector: sel];
|
[aKey capitalizedString]];
|
||||||
|
sel = NSSelectorFromString(name);
|
||||||
|
if ([self respondsToSelector: sel] == NO)
|
||||||
|
{
|
||||||
|
name = [NSString stringWithFormat: @"_%@", aKey];
|
||||||
|
sel = NSSelectorFromString(name);
|
||||||
|
if ([self respondsToSelector: sel] == NO)
|
||||||
|
{
|
||||||
|
sel = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sel = NSSelectorFromString([NSString stringWithFormat: @"_get%@",
|
if (sel == 0 && [[self class] accessInstanceVariablesDirectly] == YES)
|
||||||
[aKey capitalizedString]]);
|
|
||||||
if ([self respondsToSelector: sel] == YES)
|
|
||||||
{
|
{
|
||||||
return [self performSelector: sel];
|
name = [NSString stringWithFormat: @"_%@", aKey];
|
||||||
}
|
type = GSInstanceVariableType(self, name);
|
||||||
sel = NSSelectorFromString([NSString stringWithFormat: @"_%@", aKey]);
|
if (type == 0)
|
||||||
if ([self respondsToSelector: sel] == YES)
|
{
|
||||||
{
|
name = aKey;
|
||||||
return [self performSelector: sel];
|
type = GSInstanceVariableType(self, name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[self class] accessInstanceVariablesDirectly] == YES)
|
if (sel != 0)
|
||||||
|
{
|
||||||
|
return [self performSelector: sel];
|
||||||
|
}
|
||||||
|
else if (type != 0)
|
||||||
{
|
{
|
||||||
id v;
|
id v;
|
||||||
|
|
||||||
if (GSGetInstanceVariable(self, [NSString stringWithFormat: @"_%@", aKey],
|
GSGetInstanceVariable(self, name, (void*)&v);
|
||||||
(void*)&v) == YES)
|
return v;
|
||||||
{
|
}
|
||||||
return v;
|
else
|
||||||
}
|
{
|
||||||
if (GSGetInstanceVariable(self, aKey, (void*)&v) == YES)
|
[self handleTakeValue: nil forUnboundKey: aKey];
|
||||||
{
|
return nil;
|
||||||
return v;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[self handleTakeValue: nil forUnboundKey: aKey];
|
|
||||||
return nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) valueForKeyPath: (NSString*)aKey
|
- (id) valueForKeyPath: (NSString*)aKey
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue