mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
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
This commit is contained in:
parent
99ef2bbdf7
commit
db7b22a4fb
180 changed files with 2181 additions and 2156 deletions
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
|||
2005-02-22 11:12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSFFCallInvocation.m:
|
||||
* Source/GSFormat.m:
|
||||
* Source/GSString.m:
|
||||
* Source/GSTemplateValue.m:
|
||||
* Source/NSAutoreleasePool.m:
|
||||
* Source/NSData.m:
|
||||
* Source/NSDebug.m:
|
||||
* Source/NSDecimal.m:
|
||||
* Source/NSInvocation.m:
|
||||
* Source/NSMethodSignature.m:
|
||||
* Source/NSScanner.m:
|
||||
* Source/NSThread.m:
|
||||
* Source/NSTimeZone.m:
|
||||
* Source/NSUserDefaults.m:
|
||||
* Source/libgnustep-base-entry.m:
|
||||
* Source/thr-mach.m:
|
||||
* Source/thr-pthread.m:
|
||||
* Source/Additions/GSCategories.m:
|
||||
* Source/Additions/GSObjCRuntime.m:
|
||||
* Source/Additions/Unicode.m:
|
||||
* Source/Additions/behavior.m:
|
||||
Tidy up use of white space a little.
|
||||
|
||||
2005-02-21 20:30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSFormat.m: Modified code to rewrite output to use correct
|
||||
|
|
|
@ -24,10 +24,10 @@ main()
|
|||
[d setObject: [NSNumber numberWithInt: 4] forKey: @"four"];
|
||||
[d setObject: [NSNumber numberWithInt: 5] forKey: @"five"];
|
||||
[d setObject: [NSNumber numberWithInt: 6] forKey: @"six"];
|
||||
|
||||
|
||||
NSLog(@"There are %u elements stored in the dictionary\n", [d count]);
|
||||
|
||||
NSLog(@"Element %d is stored at \"%s\"\n",
|
||||
NSLog(@"Element %d is stored at \"%s\"\n",
|
||||
[[d objectForKey: @"three"] intValue], "three");
|
||||
|
||||
NSLog(@"Removing element stored at \"three\"\n");
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -75,7 +75,7 @@ static Class gcClass = 0;
|
|||
}
|
||||
result = [[GCArray allocWithZone: zone] initWithObjects: objects count: c];
|
||||
NSZoneFree(zone, objects);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ static Class gcClass = 0;
|
|||
GCArray *result;
|
||||
id *objects;
|
||||
unsigned i, c = [self count];
|
||||
|
||||
|
||||
objects = NSZoneMalloc(zone, c * sizeof(id));
|
||||
/* FIXME: Check if malloc return 0 */
|
||||
[self getObjects: objects];
|
||||
|
@ -260,7 +260,7 @@ static Class gcClass = 0;
|
|||
}
|
||||
result = [[GCArray allocWithZone: zone] initWithObjects: objects count: c];
|
||||
NSZoneFree(zone, objects);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ static Class gcClass = 0;
|
|||
_isGCObject = (BOOL*)&_contents[_maxCount];
|
||||
memmove(_isGCObject, optr, sizeof(BOOL)*old);
|
||||
}
|
||||
for(i = _count; i > index; i--)
|
||||
for (i = _count; i > index; i--)
|
||||
{
|
||||
_contents[i] = _contents[i - 1];
|
||||
_isGCObject[i] = _isGCObject[i - 1];
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -69,7 +69,7 @@ typedef struct {
|
|||
GCInfo *keyStruct;
|
||||
GCInfo *valueStruct;
|
||||
|
||||
return NSNextMapEnumeratorPair(&enumerator,
|
||||
return NSNextMapEnumeratorPair(&enumerator,
|
||||
(void**)&keyStruct, (void**)&valueStruct) ? keyStruct->object : nil;
|
||||
}
|
||||
@end
|
||||
|
@ -80,7 +80,7 @@ typedef struct {
|
|||
GCInfo *keyStruct;
|
||||
GCInfo *valueStruct;
|
||||
|
||||
return NSNextMapEnumeratorPair(&enumerator,
|
||||
return NSNextMapEnumeratorPair(&enumerator,
|
||||
(void**)&keyStruct, (void**)&valueStruct) ? valueStruct->object : nil;
|
||||
}
|
||||
@end
|
||||
|
@ -139,13 +139,13 @@ static const NSMapTableKeyCallBacks GCInfoMapKeyCallBacks = {
|
|||
(void (*)(NSMapTable *, void *))_GCReleaseObjects,
|
||||
(NSString *(*)(NSMapTable *, const void *))_GCDescribeObjects,
|
||||
(const void *)NULL
|
||||
};
|
||||
};
|
||||
|
||||
static const NSMapTableValueCallBacks GCInfoValueCallBacks = {
|
||||
(void (*)(NSMapTable *, const void *))_GCRetainObjects,
|
||||
(void (*)(NSMapTable *, void *))_GCReleaseObjects,
|
||||
(NSString *(*)(NSMapTable *, const void *))_GCDescribeObjects
|
||||
};
|
||||
};
|
||||
|
||||
static Class gcClass = 0;
|
||||
|
||||
|
@ -257,12 +257,12 @@ static Class gcClass = 0;
|
|||
valueStruct->isGCObject = [value isKindOfClass: gcClass];
|
||||
NSMapInsert(_map, keyStruct, valueStruct);
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithObjects: (id*)objects
|
||||
forKeys: (id*)keys
|
||||
forKeys: (id*)keys
|
||||
count: (unsigned int)count
|
||||
{
|
||||
unsigned int size = (count * 4) / 3;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -381,7 +381,7 @@ static objc_mutex_t allocationLock = NULL;
|
|||
* </p>
|
||||
* <p>All container subclasses should override this method to call the super
|
||||
* implementation then, if the method returns YES, increment the reference
|
||||
* count of any contained objects and send the
|
||||
* count of any contained objects and send the
|
||||
* -gcIncrementRefCountOfContainedObjects
|
||||
* to each of the contained objects too.
|
||||
* </p>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -82,7 +82,7 @@
|
|||
{
|
||||
dayOfYear = [self dayOfYear];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Round up to a week boundary, so that when we divide by seven we
|
||||
* get a result in the range 1 to 53 as mandated by the ISO standard.
|
||||
|
@ -149,7 +149,7 @@
|
|||
* lower case hexadecimal digits (the -hexadecimalRepresentation method
|
||||
* produces a string using only uppercase digits with no white spaqce).<br />
|
||||
* If the string does not contain one or more pairs of hexadecimal digits
|
||||
* then an exception is raised.
|
||||
* then an exception is raised.
|
||||
*/
|
||||
- (id) initWithHexadecimalRepresentation: (NSString*)string
|
||||
{
|
||||
|
@ -336,7 +336,7 @@ static void MD5Update (struct MD5Context *ctx, unsigned char const *buf,
|
|||
}
|
||||
|
||||
/*
|
||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
static void MD5Final (unsigned char digest[16], struct MD5Context *ctx)
|
||||
|
@ -393,7 +393,7 @@ static void MD5Final (unsigned char digest[16], struct MD5Context *ctx)
|
|||
|
||||
/* This is the central step in the MD5 algorithm. */
|
||||
#define MD5STEP(f, w, x, y, z, data, s) \
|
||||
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
||||
(w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x)
|
||||
|
||||
/*
|
||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||
|
@ -619,7 +619,7 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
|
|||
if (end > off && bytes[end-1] == '\r')
|
||||
{
|
||||
end--;
|
||||
}
|
||||
}
|
||||
while (off < end && bytes[off] >= '0' && bytes[off] <= '7')
|
||||
{
|
||||
mode *= 8;
|
||||
|
@ -769,7 +769,7 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
|
|||
const char *str;
|
||||
|
||||
str = [string cString];
|
||||
if (strchr(str, '.') >= 0 || strchr(str, 'e') >= 0
|
||||
if (strchr(str, '.') >= 0 || strchr(str, 'e') >= 0
|
||||
|| strchr(str, 'E') >= 0)
|
||||
return [NSNumber numberWithDouble: atof(str)];
|
||||
else if (strchr(str, '-') >= 0)
|
||||
|
@ -783,7 +783,7 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
|
|||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Extension methods for the NSObject class
|
||||
*/
|
||||
@implementation NSObject (GSCategories)
|
||||
|
@ -793,7 +793,7 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
|
|||
[NSException
|
||||
raise: NSGenericException
|
||||
format: @"method %s not implemented in %s(%s)",
|
||||
aSel ? GSNameFromSelector(aSel) : "(null)",
|
||||
aSel ? GSNameFromSelector(aSel) : "(null)",
|
||||
GSClassNameFromObject(self),
|
||||
GSObjCIsInstance(self) ? "instance" : "class"];
|
||||
return nil;
|
||||
|
@ -803,8 +803,8 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
|
|||
{
|
||||
[NSException
|
||||
raise: NSGenericException
|
||||
format: @"%s(%s) should not implement %s",
|
||||
GSClassNameFromObject(self),
|
||||
format: @"%s(%s) should not implement %s",
|
||||
GSClassNameFromObject(self),
|
||||
GSObjCIsInstance(self) ? "instance" : "class",
|
||||
aSel ? GSNameFromSelector(aSel) : "(null)"];
|
||||
return nil;
|
||||
|
@ -813,7 +813,7 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
|
|||
- (id) subclassResponsibility: (SEL)aSel
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"subclass %s(%s) should override %s",
|
||||
format: @"subclass %s(%s) should override %s",
|
||||
GSClassNameFromObject(self),
|
||||
GSObjCIsInstance(self) ? "instance" : "class",
|
||||
aSel ? GSNameFromSelector(aSel) : "(null)"];
|
||||
|
@ -1180,8 +1180,8 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
|
|||
|
||||
static GSLazyRecursiveLock *local_lock = nil;
|
||||
|
||||
/*
|
||||
This class only exists to provide
|
||||
/*
|
||||
This class only exists to provide
|
||||
a thread safe mechanism to initialize local_lock
|
||||
as +initialize is called under a lock in ObjC runtimes.
|
||||
User code should resort to GS_INITIALIZED_LOCK(),
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -59,7 +59,7 @@ void NSDecimalFromComponents(NSDecimal *result,
|
|||
unsigned long long mantissa,
|
||||
short exponent, BOOL negative)
|
||||
{
|
||||
*result = [[NSDecimalNumber decimalNumberWithMantissa:mantissa
|
||||
*result = [[NSDecimalNumber decimalNumberWithMantissa:mantissa
|
||||
exponent:exponent
|
||||
isNegative:negative] decimalValue];
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ GSDebugFunctionMsg(const char *func, const char *file, int line, NSString *fmt)
|
|||
|
||||
+ (void) setDebug: (int)val
|
||||
{
|
||||
if([self respondsToSelector:@selector(_enableLogging:)])
|
||||
if ([self respondsToSelector:@selector(_enableLogging:)])
|
||||
[self _enableLogging:!!val];
|
||||
}
|
||||
@end
|
||||
|
@ -250,21 +250,21 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
int net;
|
||||
struct sockaddr_in sin;
|
||||
int size = sizeof(sin);
|
||||
|
||||
|
||||
if (getAddr(a, s, p, &sin) == NO)
|
||||
{
|
||||
RELEASE(self);
|
||||
NSLog(@"bad address-service-protocol combination");
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) < 0)
|
||||
{
|
||||
NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
#ifndef BROKEN_SO_REUSEADDR
|
||||
/*
|
||||
* Under decent systems, SO_REUSEADDR means that the port can be reused
|
||||
|
@ -274,7 +274,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
*/
|
||||
setsockopt(net, SOL_SOCKET, SO_REUSEADDR, (char *)&status, sizeof(status));
|
||||
#endif
|
||||
|
||||
|
||||
if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) < 0)
|
||||
{
|
||||
NSLog(@"unable to bind to port %s:%d - %s", inet_ntoa(sin.sin_addr),
|
||||
|
@ -283,7 +283,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
if (listen(net, 5) < 0)
|
||||
{
|
||||
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
|
||||
|
@ -291,7 +291,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
if (getsockname(net, (struct sockaddr*)&sin, &size) < 0)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
|
@ -299,9 +299,9 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
self = [self initWithFileDescriptor: net closeOnDealloc: YES];
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
protocol: (NSString*)protocol
|
||||
{
|
||||
id o = [self allocWithZone: NSDefaultMallocZone()];
|
||||
|
||||
|
||||
return AUTORELEASE([o initAsServerAtAddress: address
|
||||
service: service
|
||||
protocol: protocol]);
|
||||
|
@ -320,14 +320,14 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
{
|
||||
struct sockaddr_in sin;
|
||||
int size = sizeof(sin);
|
||||
|
||||
|
||||
if (getsockname([self fileDescriptor], (struct sockaddr*)&sin, &size) < 0)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [[[NSString alloc] initWithCString: (char*)inet_ntoa(sin.sin_addr)]
|
||||
|
||||
return [[[NSString alloc] initWithCString: (char*)inet_ntoa(sin.sin_addr)]
|
||||
autorelease];
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ BOOL GSDebugSet(NSString *level)
|
|||
- (NSMutableSet *) debugSet
|
||||
// Derived from GNUStep's
|
||||
{
|
||||
if(_debug_set == nil){
|
||||
if (_debug_set == nil){
|
||||
int argc = [[self arguments] count];
|
||||
NSMutableSet *mySet;
|
||||
int i;
|
||||
|
@ -409,7 +409,7 @@ BOOL GSDebugSet(NSString *level)
|
|||
{
|
||||
return [self substringWithRange:range];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSInvocation(GSCompatibility)
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: October 2003
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
Written by: Richard frith-Macdonald <rfm@gnu.org>
|
||||
Date: October 2000
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -1173,7 +1173,7 @@ wordData(NSString *word)
|
|||
* NSString.<br />
|
||||
* If a document has no content type specified, it will be treated as
|
||||
* <em>text</em>, unless it is identifiable as a <em>file</em>
|
||||
* (eg. t has a content-disposition header containing a filename parameter).
|
||||
* (eg. t has a content-disposition header containing a filename parameter).
|
||||
* </p>
|
||||
*/
|
||||
- (BOOL) parse: (NSData*)d
|
||||
|
@ -1392,7 +1392,7 @@ wordData(NSString *word)
|
|||
*/
|
||||
[info setName: name];
|
||||
name = [info name];
|
||||
|
||||
|
||||
/*
|
||||
* Break header fields out into info dictionary.
|
||||
*/
|
||||
|
@ -1715,7 +1715,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
{
|
||||
[info setValue: value];
|
||||
}
|
||||
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -2045,7 +2045,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
|
||||
src += 2;
|
||||
tmp = src;
|
||||
src = (unsigned char*)strchr((char*)src, '?');
|
||||
src = (unsigned char*)strchr((char*)src, '?');
|
||||
if (src == 0)
|
||||
{
|
||||
NSLog(@"Bad encoded word - character set terminator missing");
|
||||
|
@ -2361,11 +2361,11 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
if (found == NO)
|
||||
{
|
||||
done = YES; /* Needs more data. */
|
||||
}
|
||||
}
|
||||
else if (child == nil)
|
||||
{
|
||||
NSString *cset;
|
||||
|
||||
|
||||
/*
|
||||
* Found boundary at the start of the first section.
|
||||
* Set sectionStart to point immediately after boundary.
|
||||
|
@ -3565,7 +3565,7 @@ static NSCharacterSet *tokenSet = nil;
|
|||
* matches the specified key. Recursively descend into other documents.<br />
|
||||
* Wraps the supplied key in angle brackets if they are not present.<br />
|
||||
* Return nil if no match is found, the matching GSMimeDocument otherwise.
|
||||
*/
|
||||
*/
|
||||
- (id) contentByID: (NSString*)key
|
||||
{
|
||||
if ([key hasPrefix: @"<"] == NO)
|
||||
|
@ -3598,7 +3598,7 @@ static NSCharacterSet *tokenSet = nil;
|
|||
* matches the specified key. Recursively descend into other documents.<br />
|
||||
* Wraps the supplied key in angle brackets if they are not present.<br />
|
||||
* Return nil if no match is found, the matching GSMimeDocument otherwise.
|
||||
*/
|
||||
*/
|
||||
- (id) contentByLocation: (NSString*)key
|
||||
{
|
||||
if ([content isKindOfClass: NSArrayClass] == YES)
|
||||
|
@ -3627,7 +3627,7 @@ static NSCharacterSet *tokenSet = nil;
|
|||
* name or content-disposition name matches the specified key.
|
||||
* Recursively descend into other documents.<br />
|
||||
* Return nil if no match is found, the matching GSMimeDocument otherwise.
|
||||
*/
|
||||
*/
|
||||
- (id) contentByName: (NSString*)key
|
||||
{
|
||||
|
||||
|
@ -3779,7 +3779,7 @@ static NSCharacterSet *tokenSet = nil;
|
|||
* Do <em>NOT</em> recurse into other documents.<br />
|
||||
* Return nil if no match is found, an array of matching GSMimeDocument
|
||||
* instances otherwise.
|
||||
*/
|
||||
*/
|
||||
- (NSArray*) contentsByName: (NSString*)key
|
||||
{
|
||||
NSMutableArray *a = nil;
|
||||
|
@ -4015,7 +4015,7 @@ static NSCharacterSet *tokenSet = nil;
|
|||
{
|
||||
[array addObject: info];
|
||||
}
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
|
@ -4199,7 +4199,7 @@ static NSCharacterSet *tokenSet = nil;
|
|||
{
|
||||
GSMimeDocument *part = [content objectAtIndex: i];
|
||||
|
||||
[partData addObject: [part rawMimeData: NO]];
|
||||
[partData addObject: [part rawMimeData: NO]];
|
||||
|
||||
/*
|
||||
* If any part of a multipart document is not 7bit then
|
||||
|
@ -4207,7 +4207,7 @@ static NSCharacterSet *tokenSet = nil;
|
|||
* It is important to check this *after* the part has been
|
||||
* processed by -rawMimeData:, so we know that the encoding
|
||||
* set for the part is valid.
|
||||
*/
|
||||
*/
|
||||
if (contentIs7bit == YES)
|
||||
{
|
||||
NSString *v;
|
||||
|
@ -4846,7 +4846,7 @@ static NSCharacterSet *tokenSet = nil;
|
|||
{
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -20,7 +20,7 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
/*
|
||||
return the size of an object specified by type
|
||||
return the size of an object specified by type
|
||||
*/
|
||||
|
||||
int
|
||||
|
@ -54,7 +54,7 @@ objc_sizeof_type(const char* type)
|
|||
case _C_CHR:
|
||||
return sizeof(char);
|
||||
break;
|
||||
|
||||
|
||||
case _C_UCHR:
|
||||
return sizeof(unsigned char);
|
||||
break;
|
||||
|
@ -103,7 +103,7 @@ objc_sizeof_type(const char* type)
|
|||
while (isdigit(*++type));
|
||||
return len*objc_aligned_size (type);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case _C_STRUCT_B:
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ objc_sizeof_type(const char* type)
|
|||
}
|
||||
return max_size;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ objc_sizeof_type(const char* type)
|
|||
|
||||
|
||||
/*
|
||||
Return the alignment of an object specified by type
|
||||
Return the alignment of an object specified by type
|
||||
*/
|
||||
|
||||
int
|
||||
|
@ -163,7 +163,7 @@ objc_alignof_type(const char* type)
|
|||
case _C_CLASS:
|
||||
return __alignof__(Class);
|
||||
break;
|
||||
|
||||
|
||||
case _C_SEL:
|
||||
return __alignof__(SEL);
|
||||
break;
|
||||
|
@ -171,7 +171,7 @@ objc_alignof_type(const char* type)
|
|||
case _C_CHR:
|
||||
return __alignof__(char);
|
||||
break;
|
||||
|
||||
|
||||
case _C_UCHR:
|
||||
return __alignof__(unsigned char);
|
||||
break;
|
||||
|
@ -216,11 +216,11 @@ objc_alignof_type(const char* type)
|
|||
case _C_ARY_B:
|
||||
while (isdigit(*++type)) /* do nothing */;
|
||||
return objc_alignof_type (type);
|
||||
|
||||
|
||||
case _C_STRUCT_B:
|
||||
{
|
||||
struct { int x; double y; } fooalign;
|
||||
while(*type != _C_STRUCT_E && *type++ != '=') /* do nothing */;
|
||||
while (*type != _C_STRUCT_E && *type++ != '=') /* do nothing */;
|
||||
if (*type != _C_STRUCT_E)
|
||||
return MAX (objc_alignof_type (type), __alignof__ (fooalign));
|
||||
else
|
||||
|
@ -238,7 +238,7 @@ objc_alignof_type(const char* type)
|
|||
}
|
||||
return maxalign;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ objc_aligned_size (const char* type)
|
|||
to be the size of a void*.
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
objc_promoted_size (const char* type)
|
||||
{
|
||||
int size = objc_sizeof_type (type);
|
||||
|
@ -295,9 +295,9 @@ const char*
|
|||
objc_skip_type_qualifiers (const char* type)
|
||||
{
|
||||
while (*type == _C_CONST
|
||||
|| *type == _C_IN
|
||||
|| *type == _C_IN
|
||||
|| *type == _C_INOUT
|
||||
|| *type == _C_OUT
|
||||
|| *type == _C_OUT
|
||||
|| *type == _C_BYCOPY
|
||||
#ifdef _C_BYREF
|
||||
|| *type == _C_BYREF
|
||||
|
@ -312,17 +312,17 @@ objc_skip_type_qualifiers (const char* type)
|
|||
return type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Skip one typespec element. If the typespec is prepended by type
|
||||
qualifiers, these are skipped as well.
|
||||
*/
|
||||
|
||||
const char*
|
||||
const char*
|
||||
objc_skip_typespec (const char* type)
|
||||
{
|
||||
type = objc_skip_type_qualifiers (type);
|
||||
|
||||
|
||||
switch (*type) {
|
||||
|
||||
case _C_ID:
|
||||
|
@ -358,8 +358,8 @@ objc_skip_typespec (const char* type)
|
|||
|
||||
case _C_ARY_B:
|
||||
/* skip digits, typespec and closing ']' */
|
||||
|
||||
while(isdigit(*++type));
|
||||
|
||||
while (isdigit(*++type));
|
||||
type = objc_skip_typespec(type);
|
||||
if (*type == _C_ARY_E)
|
||||
return ++type;
|
||||
|
@ -368,23 +368,23 @@ objc_skip_typespec (const char* type)
|
|||
|
||||
case _C_STRUCT_B:
|
||||
/* skip name, and elements until closing '}' */
|
||||
|
||||
|
||||
while (*type != _C_STRUCT_E && *type++ != '=');
|
||||
while (*type != _C_STRUCT_E) { type = objc_skip_typespec (type); }
|
||||
return ++type;
|
||||
|
||||
case _C_UNION_B:
|
||||
/* skip name, and elements until closing ')' */
|
||||
|
||||
|
||||
while (*type != _C_UNION_E && *type++ != '=');
|
||||
while (*type != _C_UNION_E) { type = objc_skip_typespec (type); }
|
||||
return ++type;
|
||||
|
||||
case _C_PTR:
|
||||
/* Just skip the following typespec */
|
||||
|
||||
|
||||
return objc_skip_typespec (++type);
|
||||
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
@ -394,12 +394,12 @@ objc_skip_typespec (const char* type)
|
|||
Skip an offset as part of a method encoding. This is prepended by a
|
||||
'+' if the argument is passed in registers.
|
||||
*/
|
||||
inline const char*
|
||||
inline const char*
|
||||
objc_skip_offset (const char* type)
|
||||
{
|
||||
if (*type == '+') type++;
|
||||
if (*type == '-') type++;
|
||||
while(isdigit(*++type));
|
||||
while (isdigit(*++type));
|
||||
return type;
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,7 @@ void *
|
|||
objc_malloc(size_t size)
|
||||
{
|
||||
void* res = (void*) (*_objc_malloc)(size);
|
||||
if(!res)
|
||||
if (!res)
|
||||
objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
|
||||
return res;
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ void *
|
|||
objc_atomic_malloc(size_t size)
|
||||
{
|
||||
void* res = (void*) (*_objc_atomic_malloc)(size);
|
||||
if(!res)
|
||||
if (!res)
|
||||
objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
|
||||
return res;
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ void *
|
|||
objc_valloc(size_t size)
|
||||
{
|
||||
void* res = (void*) (*_objc_valloc)(size);
|
||||
if(!res)
|
||||
if (!res)
|
||||
objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
|
||||
return res;
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ void *
|
|||
objc_realloc(void *mem, size_t size)
|
||||
{
|
||||
void* res = (void*) (*_objc_realloc)(mem, size);
|
||||
if(!res)
|
||||
if (!res)
|
||||
objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
|
||||
return res;
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ void *
|
|||
objc_calloc(size_t nelem, size_t size)
|
||||
{
|
||||
void* res = (void*) (*_objc_calloc)(nelem, size);
|
||||
if(!res)
|
||||
if (!res)
|
||||
objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
|
||||
return res;
|
||||
}
|
||||
|
@ -632,20 +632,20 @@ int
|
|||
objc_mutex_lock(objc_mutex_t mutex)
|
||||
{
|
||||
pthread_mutex_t *p = (pthread_mutex_t *)mutex;
|
||||
return pthread_mutex_lock(p);
|
||||
return pthread_mutex_lock(p);
|
||||
}
|
||||
|
||||
int
|
||||
objc_mutex_unlock (objc_mutex_t mutex)
|
||||
{
|
||||
pthread_mutex_t *p = (pthread_mutex_t *)mutex;
|
||||
return pthread_mutex_unlock(p);
|
||||
return pthread_mutex_unlock(p);
|
||||
}
|
||||
|
||||
int
|
||||
objc_mutex_trylock (objc_mutex_t mutex)
|
||||
{
|
||||
pthread_mutex_t *p = (pthread_mutex_t *)mutex;
|
||||
return pthread_mutex_trylock(p);
|
||||
return pthread_mutex_trylock(p);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,26 +7,26 @@
|
|||
Date: Nov 2002
|
||||
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
Date: Nov 2002
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>GSObjCRuntime function and macro reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -96,10 +96,10 @@ GSAllocateMutexAt(objc_mutex_t *request)
|
|||
{
|
||||
if (request == NULL)
|
||||
{
|
||||
/* This could be called very early in process
|
||||
initialization so many things may not have
|
||||
/* This could be called very early in process
|
||||
initialization so many things may not have
|
||||
been setup correctly yet. */
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"Error: GSAllocateMutexAt() called with NULL pointer.\n");
|
||||
abort();
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ GSObjCFindVariable(id obj, const char *name,
|
|||
}
|
||||
|
||||
/**
|
||||
* This method returns an array listing the names of all the
|
||||
* This method returns an array listing the names of all the
|
||||
* instance methods available to obj, whether they
|
||||
* belong to the class of obj or one of its superclasses.<br />
|
||||
* If obj is a class, this returns the class methods.<br />
|
||||
|
@ -206,7 +206,7 @@ GSObjCMethodNames(id obj)
|
|||
{
|
||||
void *iterator = 0;
|
||||
|
||||
while ((methods = class_nextMethodList(class, &iterator)) )
|
||||
while ((methods = class_nextMethodList(class, &iterator)))
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -235,7 +235,7 @@ GSObjCMethodNames(id obj)
|
|||
}
|
||||
|
||||
/**
|
||||
* This method returns an array listing the names of all the
|
||||
* This method returns an array listing the names of all the
|
||||
* instance variables present in the instance obj, whether they
|
||||
* belong to the class of obj or one of its superclasses.<br />
|
||||
* Returns nil if obj is nil.
|
||||
|
@ -361,8 +361,8 @@ GSClassList(Class *buffer, unsigned int max, BOOL clearCache)
|
|||
}
|
||||
cache = objc_malloc(sizeof(Class) * (cacheClassCount + 1));
|
||||
/* Be extra careful as another thread may be loading classes. */
|
||||
for (i = 0, iterator = 0, cls = objc_next_class(&iterator);
|
||||
i < cacheClassCount && cls != NULL;
|
||||
for (i = 0, iterator = 0, cls = objc_next_class(&iterator);
|
||||
i < cacheClassCount && cls != NULL;
|
||||
i++, cls = objc_next_class(&iterator))
|
||||
{
|
||||
cache[i] = cls;
|
||||
|
@ -412,7 +412,7 @@ ObjcRuntimeUtilities.m by Nicola Pero
|
|||
NSValue *
|
||||
GSObjCMakeClass(NSString *name, NSString *superName, NSDictionary *iVars)
|
||||
{
|
||||
Class newClass;
|
||||
Class newClass;
|
||||
Class classSuperClass;
|
||||
const char *classNameCString;
|
||||
const char *superClassNameCString;
|
||||
|
@ -448,10 +448,10 @@ GSObjCMakeClass(NSString *name, NSString *superName, NSDictionary *iVars)
|
|||
/*
|
||||
* Create new class and meta class structure storage
|
||||
*
|
||||
* From Nicola: NB: There is a trick here.
|
||||
* From Nicola: NB: There is a trick here.
|
||||
* The runtime system will look up the name in the following string,
|
||||
* and replace it with a pointer to the actual superclass structure.
|
||||
* This also means the type of pointer will change, that's why we
|
||||
* This also means the type of pointer will change, that's why we
|
||||
* need to cast it.
|
||||
*/
|
||||
newMetaClass = objc_malloc(sizeof(struct objc_class));
|
||||
|
@ -462,7 +462,7 @@ GSObjCMakeClass(NSString *name, NSString *superName, NSDictionary *iVars)
|
|||
newMetaClass->version = 0;
|
||||
newMetaClass->info = _CLS_META; // this is a Meta Class
|
||||
|
||||
|
||||
|
||||
newClass = objc_malloc(sizeof(struct objc_class));
|
||||
memset(newClass, 0, sizeof(struct objc_class));
|
||||
newClass->class_pointer = newMetaClass; // Points to the class's meta class.
|
||||
|
@ -470,7 +470,7 @@ GSObjCMakeClass(NSString *name, NSString *superName, NSDictionary *iVars)
|
|||
newClass->name = classNameCString;
|
||||
newClass->version = 0;
|
||||
newClass->info = _CLS_CLASS; // this is a Class
|
||||
|
||||
|
||||
// work on instances variables
|
||||
iVarSize = classSuperClass->instance_size; // super class ivar size
|
||||
if ([iVars count] > 0)
|
||||
|
@ -480,15 +480,15 @@ GSObjCMakeClass(NSString *name, NSString *superName, NSDictionary *iVars)
|
|||
unsigned int iVarsCount = [iVars count];
|
||||
NSEnumerator *enumerator = [iVars keyEnumerator];
|
||||
NSString *key;
|
||||
|
||||
|
||||
// ivars list is 1 objc_ivar_list followed by (iVarsCount-1) ivar_list
|
||||
iVarsStructsSize = sizeof(struct objc_ivar_list)
|
||||
+ (iVarsCount-1)*sizeof(struct objc_ivar);
|
||||
|
||||
|
||||
// Allocate for all ivars
|
||||
newClass->ivars = (struct objc_ivar_list*)objc_malloc(iVarsStructsSize);
|
||||
newClass->ivars = (struct objc_ivar_list*)objc_malloc(iVarsStructsSize);
|
||||
memset(newClass->ivars, 0, iVarsStructsSize);
|
||||
|
||||
|
||||
// Set ivars count
|
||||
newClass->ivars->ivar_count = iVarsCount;
|
||||
|
||||
|
@ -519,7 +519,7 @@ GSObjCMakeClass(NSString *name, NSString *superName, NSDictionary *iVars)
|
|||
* and all super class definitions.
|
||||
*/
|
||||
newClass->instance_size = iVarSize;
|
||||
|
||||
|
||||
// Meta Class instance size is superclass instance size.
|
||||
newMetaClass->instance_size = classSuperClass->class_pointer->instance_size;
|
||||
|
||||
|
@ -572,13 +572,13 @@ GSObjCAddClasses(NSArray *classes)
|
|||
strcpy ((char*)module->name, "GNUstep-Proxy-");
|
||||
strcat ((char*)module->name, c->name);
|
||||
module->symtab = objc_malloc(sizeof(Symtab) + numClasses * sizeof(void *));
|
||||
|
||||
|
||||
symtab = module->symtab;
|
||||
symtab->sel_ref_cnt = 0;
|
||||
symtab->refs = 0;
|
||||
symtab->cls_def_cnt = numClasses; // We are defining numClasses classes.
|
||||
symtab->cat_def_cnt = 0; // But no categories
|
||||
|
||||
symtab->cat_def_cnt = 0; // But no categories
|
||||
|
||||
for (i = 0; i < numClasses; i++)
|
||||
{
|
||||
symtab->defs[i] = (Class)[[classes objectAtIndex: i] pointerValue];
|
||||
|
@ -604,7 +604,7 @@ GSObjCBehaviorDebug(int i)
|
|||
|
||||
static GSMethod search_for_method_in_class (Class cls, SEL op);
|
||||
|
||||
void
|
||||
void
|
||||
GSObjCAddMethods (Class cls, GSMethodList methods)
|
||||
{
|
||||
static SEL initialize_sel = 0;
|
||||
|
@ -621,7 +621,7 @@ GSObjCAddMethods (Class cls, GSMethodList methods)
|
|||
|
||||
counter = mlist->method_count ? mlist->method_count - 1 : 1;
|
||||
|
||||
/* This is a little wasteful of memory, since not necessarily
|
||||
/* This is a little wasteful of memory, since not necessarily
|
||||
all methods will go in here. */
|
||||
new_list = (GSMethodList)
|
||||
objc_malloc (sizeof(struct objc_method_list) +
|
||||
|
@ -632,7 +632,7 @@ GSObjCAddMethods (Class cls, GSMethodList methods)
|
|||
{
|
||||
GSMethod method = &(mlist->method_list[counter]);
|
||||
|
||||
BDBGPrintf(" processing method [%s] ... ",
|
||||
BDBGPrintf(" processing method [%s] ... ",
|
||||
GSNameFromSelector(method->method_name));
|
||||
|
||||
if (!search_for_method_in_class(cls, method->method_name)
|
||||
|
@ -644,11 +644,11 @@ GSObjCAddMethods (Class cls, GSMethodList methods)
|
|||
new_list->method_list[new_list->method_count] = *method;
|
||||
(new_list->method_count)++;
|
||||
|
||||
BDBGPrintf("added.\n");
|
||||
BDBGPrintf("added.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
BDBGPrintf("ignored.\n");
|
||||
BDBGPrintf("ignored.\n");
|
||||
}
|
||||
counter -= 1;
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ search_for_method_in_class (Class cls, SEL op)
|
|||
return NULL;
|
||||
|
||||
/* If not found then we'll search the list. */
|
||||
while ( (method_list = class_nextMethodList(cls, &iterator)) )
|
||||
while ((method_list = class_nextMethodList(cls, &iterator)))
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -724,7 +724,7 @@ GSObjCAddMethods (Class cls, GSMethodList methods)
|
|||
|
||||
counter = mlist->method_count ? mlist->method_count - 1 : 1;
|
||||
|
||||
/* This is a little wasteful of memory, since not necessarily
|
||||
/* This is a little wasteful of memory, since not necessarily
|
||||
all methods will go in here. */
|
||||
new_list = (GSMethodList)
|
||||
objc_malloc (sizeof(struct objc_method_list) +
|
||||
|
@ -756,11 +756,11 @@ GSObjCAddMethods (Class cls, GSMethodList methods)
|
|||
= (SEL)name;
|
||||
(new_list->method_count)++;
|
||||
|
||||
BDBGPrintf("added.\n");
|
||||
BDBGPrintf("added.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
BDBGPrintf("ignored.\n");
|
||||
BDBGPrintf("ignored.\n");
|
||||
}
|
||||
counter -= 1;
|
||||
}
|
||||
|
@ -810,7 +810,7 @@ GSGetMethod(Class cls, SEL sel,
|
|||
{
|
||||
/*
|
||||
We do not rely on the mapping supplied in objc_gnu2next.h
|
||||
because we want to be explicit about the fact
|
||||
because we want to be explicit about the fact
|
||||
that the expected parameters are different.
|
||||
Therefor we refrain from simply using class_getClassMethod().
|
||||
*/
|
||||
|
@ -856,9 +856,9 @@ GSAppendMethodToList (GSMethodList list,
|
|||
num = (list->method_count)++;
|
||||
|
||||
#ifdef GNU_RUNTIME
|
||||
/*
|
||||
/*
|
||||
Deal with typed selectors: No matter what kind of selector we get
|
||||
convert it into a c-string. Cache that c-string incase the
|
||||
convert it into a c-string. Cache that c-string incase the
|
||||
selector isn't found, then search for cooresponding typed selector.
|
||||
If none is found use the cached name to register an new selector
|
||||
with the cooresponding types.
|
||||
|
@ -953,13 +953,13 @@ GSMethodListForSelector(Class cls,
|
|||
cls = cls->class_pointer;
|
||||
}
|
||||
|
||||
if(sel_is_mapped(selector))
|
||||
if (sel_is_mapped(selector))
|
||||
{
|
||||
void **iterator_pointer;
|
||||
GSMethodList method_list;
|
||||
|
||||
iterator_pointer = (iterator == 0 ? &local_iterator : iterator);
|
||||
while((method_list = class_nextMethodList(cls, iterator_pointer)))
|
||||
while ((method_list = class_nextMethodList(cls, iterator_pointer)))
|
||||
{
|
||||
/* Search the method in the current list. */
|
||||
if (GSMethodFromList(method_list, selector, NO) != 0)
|
||||
|
@ -975,7 +975,7 @@ GSMethodListForSelector(Class cls,
|
|||
/* See header for documentation. */
|
||||
GSMethod
|
||||
GSMethodFromList(GSMethodList list,
|
||||
SEL sel,
|
||||
SEL sel,
|
||||
BOOL isFree)
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -989,7 +989,7 @@ GSMethodFromList(GSMethodList list,
|
|||
isFree = NO;
|
||||
#endif
|
||||
|
||||
for(i = 0; i < list->method_count; ++i)
|
||||
for (i = 0; i < list->method_count; ++i)
|
||||
{
|
||||
GSMethod method = &list->method_list[i];
|
||||
SEL method_name = method->method_name;
|
||||
|
@ -1204,7 +1204,7 @@ gs_string_hash(const char *s)
|
|||
}
|
||||
|
||||
GS_STATIC_INLINE pcl
|
||||
gs_find_protocol_named_in_protocol_list(const char *name,
|
||||
gs_find_protocol_named_in_protocol_list(const char *name,
|
||||
struct objc_protocol_list *pcllist)
|
||||
{
|
||||
pcl p = NULL;
|
||||
|
@ -1241,7 +1241,7 @@ gs_find_protocol_named(const char *name)
|
|||
|
||||
clsListStart = clsList;
|
||||
|
||||
while(p == NULL && (cls = *clsList++))
|
||||
while (p == NULL && (cls = *clsList++))
|
||||
{
|
||||
p = gs_find_protocol_named_in_protocol_list(name, cls->protocols);
|
||||
}
|
||||
|
@ -1251,7 +1251,7 @@ gs_find_protocol_named(const char *name)
|
|||
#else
|
||||
void *iterator = NULL;
|
||||
|
||||
while(p == NULL && (cls = objc_next_class(&iterator)))
|
||||
while (p == NULL && (cls = objc_next_class(&iterator)))
|
||||
{
|
||||
p = gs_find_protocol_named_in_protocol_list(name, cls->protocols);
|
||||
}
|
||||
|
@ -1305,7 +1305,7 @@ GSRegisterProtocol(Protocol *proto)
|
|||
{
|
||||
gs_init_protocol_lock();
|
||||
}
|
||||
|
||||
|
||||
if (proto != nil)
|
||||
{
|
||||
GSIMapNode node;
|
||||
|
@ -1317,7 +1317,7 @@ GSRegisterProtocol(Protocol *proto)
|
|||
(GSIMapKey) p->protocol_name);
|
||||
if (node == 0)
|
||||
{
|
||||
GSIMapAddPairNoRetain(&protocol_by_name,
|
||||
GSIMapAddPairNoRetain(&protocol_by_name,
|
||||
(GSIMapKey) (void *) p->protocol_name,
|
||||
(GSIMapVal) (void *) p);
|
||||
}
|
||||
|
@ -1355,9 +1355,9 @@ GSProtocolFromName(const char *name)
|
|||
p = gs_find_protocol_named(name);
|
||||
if (p)
|
||||
{
|
||||
/* Use the protocol's name to save us from allocating
|
||||
/* Use the protocol's name to save us from allocating
|
||||
a copy of the parameter 'name'. */
|
||||
GSIMapAddPairNoRetain(&protocol_by_name,
|
||||
GSIMapAddPairNoRetain(&protocol_by_name,
|
||||
(GSIMapKey) (void *) p->protocol_name,
|
||||
(GSIMapVal) (void *) p);
|
||||
}
|
||||
|
@ -1390,7 +1390,7 @@ GSProtocolFromName(const char *name)
|
|||
* </p>
|
||||
* <p>This function should be called in the +initialize method of the receiver.
|
||||
* </p>
|
||||
* <p>If you add several behaviors to a class, be aware that the order of
|
||||
* <p>If you add several behaviors to a class, be aware that the order of
|
||||
* the additions is significant.
|
||||
* </p>
|
||||
*/
|
||||
|
@ -1780,7 +1780,7 @@ GSObjCGetValue(NSObject *self, NSString *key, SEL sel,
|
|||
{
|
||||
void (*imp)(id, SEL) =
|
||||
(void (*)(id, SEL))[self methodForSelector: sel];
|
||||
|
||||
|
||||
(*imp)(self, sel);
|
||||
}
|
||||
val = nil;
|
||||
|
@ -2124,7 +2124,7 @@ GSObjCSetValue(NSObject *self, NSString *key, id val, SEL sel,
|
|||
}
|
||||
|
||||
|
||||
/** Returns an autoreleased array of subclasses of Class cls, including
|
||||
/** Returns an autoreleased array of subclasses of Class cls, including
|
||||
* subclasses of subclasses. */
|
||||
NSArray *GSObjCAllSubclassesOfClass(Class cls)
|
||||
{
|
||||
|
@ -2164,7 +2164,7 @@ NSArray *GSObjCDirectSubclassesOfClass(Class cls)
|
|||
{
|
||||
NSMutableArray *result=[[NSMutableArray alloc] init];
|
||||
Class aClass;
|
||||
|
||||
|
||||
#ifdef GNU_RUNTIME
|
||||
for (aClass = cls->subclass_list;aClass;aClass=aClass->sibling_class)
|
||||
{
|
||||
|
|
|
@ -1548,7 +1548,7 @@ static NSMapTable *nodeNames = 0;
|
|||
*/
|
||||
- (void) setNamespace: (GSXMLNamespace *)space
|
||||
{
|
||||
xmlSetNs (lib, [space lib]);
|
||||
xmlSetNs (lib, [space lib]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -2389,7 +2389,7 @@ static NSString *endMarker = @"At end of incremental parse";
|
|||
* </p>
|
||||
* <p>
|
||||
* If you create a GSXMLParser passing nil as the GSSAXHandler,
|
||||
* the parser will parse data to create a [GSXMLDocument] instance
|
||||
* the parser will parse data to create a [GSXMLDocument] instance
|
||||
* which you can then examine as a whole ... this is generally the
|
||||
* preferred mechanism for parsing as it permits the parser to
|
||||
* validate the parsed document againts a DTD, and your software
|
||||
|
@ -3384,10 +3384,10 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
|
|||
xmlSAXVersion(LIB, 2); // Set SAX2
|
||||
SETCB(startElementNs, startElement:prefix:href:attributes:);
|
||||
SETCB(endElementNs, endElement:prefix:href:);
|
||||
#else
|
||||
#else
|
||||
SETCB(startElement, startElement:attributes:);
|
||||
SETCB(endElement, endElement:);
|
||||
#endif
|
||||
#endif
|
||||
SETCB(internalSubset, internalSubset:externalID:systemID:);
|
||||
SETCB(externalSubset, externalSubset:externalID:systemID:);
|
||||
SETCB(isStandalone, isStandalone);
|
||||
|
@ -3400,7 +3400,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
|
|||
SETCB(elementDecl, elementDecl:type:);
|
||||
SETCB(unparsedEntityDecl, unparsedEntityDecl:public:system:notationName:);
|
||||
SETCB(startDocument, startDocument);
|
||||
SETCB(endDocument, endDocument);
|
||||
SETCB(endDocument, endDocument);
|
||||
SETCB(reference, reference:);
|
||||
SETCB(characters, characters:);
|
||||
SETCB(ignorableWhitespace, ignoreWhitespace:);
|
||||
|
@ -3526,7 +3526,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
|
|||
context: context];
|
||||
break;
|
||||
default:
|
||||
/* This includes:
|
||||
/* This includes:
|
||||
case XPATH_UNDEFINED:
|
||||
case XPATH_POINT:
|
||||
case XPATH_RANGE:
|
||||
|
@ -3681,7 +3681,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
|
|||
ASSIGN (_document, d);
|
||||
_lib = xmlXPathNewContext ([_document lib]);
|
||||
((xmlXPathContext*)_lib)->node = xmlDocGetRootElement ([_document lib]);
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -3694,9 +3694,9 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
|
|||
xmlXPathCompExpr *comp;
|
||||
xmlXPathObject *res;
|
||||
GSXPathObject *result;
|
||||
|
||||
|
||||
comp = xmlXPathCompile ([XPathExpression UTF8String]);
|
||||
if (comp == NULL)
|
||||
if (comp == NULL)
|
||||
{
|
||||
/* Maybe an exception would be better ? */
|
||||
return nil;
|
||||
|
@ -3719,7 +3719,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
xmlXPathFreeContext (_lib);
|
||||
xmlXPathFreeContext (_lib);
|
||||
RELEASE (_document);
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -3784,7 +3784,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
params: (NSDictionary*)params
|
||||
{
|
||||
GSXMLDocument *newdoc;
|
||||
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
NSData *xml;
|
||||
|
@ -3798,7 +3798,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
}
|
||||
else
|
||||
{
|
||||
newdoc = [GSXMLDocument xsltTransformXml: xml
|
||||
newdoc = [GSXMLDocument xsltTransformXml: xml
|
||||
stylesheet: ss
|
||||
params: params];
|
||||
}
|
||||
|
@ -3808,7 +3808,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
newdoc = nil;
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
|
||||
return newdoc;
|
||||
}
|
||||
/**
|
||||
|
@ -3825,7 +3825,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
stylesheet: xsltStylesheet
|
||||
params: nil];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Performs an XSLT transformation on the specified file using the
|
||||
* stylesheet and parameters provided.See the libxslt documentation
|
||||
|
@ -3839,7 +3839,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
params: (NSDictionary*)params
|
||||
{
|
||||
GSXMLDocument *newdoc;
|
||||
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
GSXMLParser *xmlParser;
|
||||
|
@ -3860,7 +3860,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
newdoc = nil;
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
|
||||
return newdoc;
|
||||
}
|
||||
|
||||
|
@ -3887,7 +3887,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
- (GSXMLDocument*) xsltTransform: (GSXMLDocument*)xsltStylesheet
|
||||
params: (NSDictionary*)params
|
||||
{
|
||||
GSXMLDocument *newdoc = nil;
|
||||
GSXMLDocument *newdoc = nil;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
|
@ -3913,7 +3913,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
}
|
||||
}
|
||||
parameters[pNum] = NULL;
|
||||
|
||||
|
||||
ss = xsltParseStylesheetDoc(ssXml);
|
||||
if (xsltStylesheet != NULL)
|
||||
{
|
||||
|
@ -3924,14 +3924,14 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
{
|
||||
newdoc = [GSXMLDocument alloc];
|
||||
newdoc = [newdoc _initFrom: res
|
||||
parent: self
|
||||
parent: self
|
||||
ownsLib: YES];
|
||||
AUTORELEASE(newdoc);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* N.B. We don't want to call xsltFreeStylesheet() to free the
|
||||
* stylesheet xmlDocPtr because that will destroy the lib which
|
||||
* N.B. We don't want to call xsltFreeStylesheet() to free the
|
||||
* stylesheet xmlDocPtr because that will destroy the lib which
|
||||
* is owned by the xsltStylesheet object.
|
||||
*/
|
||||
xsltCleanupGlobals();
|
||||
|
@ -3951,14 +3951,14 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
NSLog(@"libxslt is not available");
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
+ (GSXMLDocument*) xsltTransformFile: (NSString*)xmlFile
|
||||
stylesheet: (NSString*)xsltStylesheet
|
||||
{
|
||||
NSLog(@"libxslt is not available");
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
+ (GSXMLDocument*) xsltTransformXml: (NSData*)xmlData
|
||||
stylesheet: (NSData*)xsltStylesheet
|
||||
params: (NSDictionary*)params
|
||||
|
@ -3973,7 +3973,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
NSLog(@"libxslt is not available");
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
- (GSXMLDocument*) xsltTransform: (GSXMLDocument*)xsltStylesheet
|
||||
params: (NSDictionary*)params
|
||||
{
|
||||
|
@ -4027,7 +4027,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
+ (void) forwardInvocation: (NSInvocation*)anInvocation
|
||||
{
|
||||
NSLog(@"Not built with libxml ... %@ unusable in %@",
|
||||
NSStringFromClass([self class]),
|
||||
NSStringFromClass([self class]),
|
||||
NSStringFromSelector([anInvocation selector]));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -25,7 +25,7 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#ifndef NeXT_Foundation_LIBRARY
|
||||
|
@ -124,7 +124,7 @@ internal_unicode_enc(void)
|
|||
return unicode_enc;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static GSLazyLock *local_lock = nil;
|
||||
|
||||
|
@ -241,7 +241,7 @@ static void GSSetupEncodingTable(void)
|
|||
{
|
||||
fprintf(stderr, "ERROR ... illegal NSStringEncoding "
|
||||
"value in str_encoding_table. Ignored\n");
|
||||
}
|
||||
}
|
||||
else if (tmp > encTableSize)
|
||||
{
|
||||
encTableSize = tmp;
|
||||
|
@ -457,7 +457,7 @@ GSEncodingForRegistry (NSString *registry, NSString *encoding)
|
|||
return NSKoreanEUCStringEncoding;
|
||||
}
|
||||
else if ([registry isEqualToString:@"utf8"]
|
||||
|| [registry isEqualToString:@"utf-8"] )
|
||||
|| [registry isEqualToString:@"utf-8"])
|
||||
{
|
||||
return NSUTF8StringEncoding;
|
||||
}
|
||||
|
@ -482,8 +482,8 @@ GSEncodingFromLocale(const char *clocale)
|
|||
NSStringEncoding encoding = GSUndefinedEncoding;
|
||||
NSString *encodstr;
|
||||
|
||||
if (clocale == NULL || strcmp(clocale, "C") == 0
|
||||
|| strcmp(clocale, "POSIX") == 0)
|
||||
if (clocale == NULL || strcmp(clocale, "C") == 0
|
||||
|| strcmp(clocale, "POSIX") == 0)
|
||||
{
|
||||
/* Don't make any assumptions. Let caller handle that */
|
||||
return encoding;
|
||||
|
@ -509,7 +509,7 @@ GSEncodingFromLocale(const char *clocale)
|
|||
{
|
||||
encodstr = @"0";
|
||||
}
|
||||
|
||||
|
||||
encoding = GSEncodingForRegistry(registry, encodstr);
|
||||
}
|
||||
else
|
||||
|
@ -521,14 +521,14 @@ GSEncodingFromLocale(const char *clocale)
|
|||
gbundle = [NSBundle bundleForLibrary: @"gnustep-base"];
|
||||
table = [gbundle pathForResource: @"Locale"
|
||||
ofType: @"encodings"
|
||||
inDirectory: @"Languages"];
|
||||
inDirectory: @"Languages"];
|
||||
if (table != nil)
|
||||
{
|
||||
unsigned count;
|
||||
NSDictionary *dict;
|
||||
|
||||
|
||||
dict = [NSDictionary dictionaryWithContentsOfFile: table];
|
||||
encodstr = [dict objectForKey:
|
||||
encodstr = [dict objectForKey:
|
||||
[NSString stringWithCString: clocale]];
|
||||
if (encodstr == nil)
|
||||
return GSUndefinedEncoding;
|
||||
|
@ -551,7 +551,7 @@ GSEncodingFromLocale(const char *clocale)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return encoding;
|
||||
}
|
||||
|
||||
|
@ -593,7 +593,7 @@ GetDefEncoding(void)
|
|||
{
|
||||
fprintf(stderr,
|
||||
"WARNING: %s - encoding not supported.\n", encoding);
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
" NSISOLatin1StringEncoding set as default.\n");
|
||||
defEnc = NSISOLatin1StringEncoding;
|
||||
}
|
||||
|
@ -873,7 +873,7 @@ uni_tolower(unichar ch)
|
|||
|
||||
return result ? result : ch;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Uses direct access into a two-level table to map cases.<br />
|
||||
* The two-level table method is less space efficient (but still not bad) than
|
||||
|
@ -1001,7 +1001,7 @@ uni_is_decomp(unichar u)
|
|||
* <strong>deprecated</strong>
|
||||
* See GSToUnicode() and GSFromUnicode()
|
||||
*/
|
||||
int encode_ustrtocstr(char *dst, int dl, const unichar *src, int sl,
|
||||
int encode_ustrtocstr(char *dst, int dl, const unichar *src, int sl,
|
||||
NSStringEncoding enc, BOOL strict)
|
||||
{
|
||||
BOOL result;
|
||||
|
@ -1021,7 +1021,7 @@ int encode_ustrtocstr(char *dst, int dl, const unichar *src, int sl,
|
|||
* <strong>deprecated</strong>
|
||||
* See GSToUnicode() and GSFromUnicode()
|
||||
*/
|
||||
int encode_cstrtoustr(unichar *dst, int dl, const char *src, int sl,
|
||||
int encode_cstrtoustr(unichar *dst, int dl, const char *src, int sl,
|
||||
NSStringEncoding enc)
|
||||
{
|
||||
BOOL result;
|
||||
|
@ -1341,12 +1341,12 @@ GSToUnicode(unichar **dst, unsigned int *size, const unsigned char *src,
|
|||
base = Thai_conv_base;
|
||||
table = Thai_char_to_uni_table;
|
||||
goto tables;
|
||||
|
||||
|
||||
#if 0
|
||||
case NSSymbolStringEncoding:
|
||||
base = Symbol_conv_base;
|
||||
table = Symbol_char_to_uni_table;
|
||||
goto tables;
|
||||
goto tables;
|
||||
#endif
|
||||
|
||||
tables:
|
||||
|
@ -1430,7 +1430,7 @@ tables:
|
|||
cd = iconv_open(UNICODE_ENC, estr);
|
||||
if (cd == (iconv_t)-1)
|
||||
{
|
||||
NSLog(@"No iconv for encoding %@ tried to use %s",
|
||||
NSLog(@"No iconv for encoding %@ tried to use %s",
|
||||
GetEncodingName(enc), estr);
|
||||
result = NO;
|
||||
break;
|
||||
|
@ -1473,9 +1473,9 @@ tables:
|
|||
// close the converter
|
||||
iconv_close(cd);
|
||||
}
|
||||
#else
|
||||
#else
|
||||
result = NO;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2081,7 +2081,7 @@ tables:
|
|||
cd = iconv_open(estr, UNICODE_ENC);
|
||||
if (cd == (iconv_t)-1)
|
||||
{
|
||||
NSLog(@"No iconv for encoding %@ tried to use %s",
|
||||
NSLog(@"No iconv for encoding %@ tried to use %s",
|
||||
GetEncodingName(enc), estr);
|
||||
result = NO;
|
||||
break;
|
||||
|
@ -2159,7 +2159,7 @@ tables:
|
|||
#else
|
||||
result = NO;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -19,7 +19,7 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
/* A Behavior can be seen as a "Protocol with an implementation" or a
|
||||
"Class without any instance variables". A key feature of behaviors
|
||||
|
@ -28,7 +28,7 @@
|
|||
Behavior methods, when added to a class, override the class's
|
||||
superclass methods, but not the class's methods.
|
||||
|
||||
xxx not necessarily on the "no instance vars". The behavior just has
|
||||
xxx not necessarily on the "no instance vars". The behavior just has
|
||||
to have the same layout as the class.
|
||||
|
||||
The following function is a sneaky hack way that provides Behaviors
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
This function should be called in CLASS's +initialize method.
|
||||
|
||||
If you add several behaviors to a class, be aware that the order of
|
||||
If you add several behaviors to a class, be aware that the order of
|
||||
the additions is significant.
|
||||
|
||||
McCallum talking to himself:
|
||||
|
@ -113,7 +113,7 @@ behavior_class_add_class (Class class, Class behavior)
|
|||
void *iterator = 0;
|
||||
struct objc_method_list *method_list;
|
||||
|
||||
while ( (method_list = class_nextMethodList(behavior, &iterator)) )
|
||||
while ((method_list = class_nextMethodList(behavior, &iterator)))
|
||||
behavior_class_add_methods (class, method_list);
|
||||
}
|
||||
#else
|
||||
|
@ -131,12 +131,12 @@ behavior_class_add_class (Class class, Class behavior)
|
|||
void *iterator = 0;
|
||||
struct objc_method_list *method_list;
|
||||
|
||||
while ( (method_list =
|
||||
class_nextMethodList(behavior->class_pointer, &iterator)) )
|
||||
while ((method_list =
|
||||
class_nextMethodList(behavior->class_pointer, &iterator)))
|
||||
behavior_class_add_methods (class->class_pointer, method_list);
|
||||
}
|
||||
#else
|
||||
behavior_class_add_methods (class->class_pointer,
|
||||
behavior_class_add_methods (class->class_pointer,
|
||||
behavior->class_pointer->methods);
|
||||
#endif
|
||||
|
||||
|
@ -152,9 +152,9 @@ behavior_class_add_class (Class class, Class behavior)
|
|||
void
|
||||
behavior_class_add_category (Class class, struct objc_category *category)
|
||||
{
|
||||
behavior_class_add_methods (class,
|
||||
behavior_class_add_methods (class,
|
||||
category->instance_methods);
|
||||
behavior_class_add_methods (class->class_pointer,
|
||||
behavior_class_add_methods (class->class_pointer,
|
||||
category->class_methods);
|
||||
/* xxx Add the protocols (category->protocols) too. */
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ behavior_class_add_category (Class class, struct objc_category *category)
|
|||
|
||||
static struct objc_method *search_for_method_in_list (Class class, SEL op);
|
||||
|
||||
void
|
||||
void
|
||||
behavior_class_add_methods (Class class, struct objc_method_list *methods)
|
||||
{
|
||||
static SEL initialize_sel = 0;
|
||||
|
@ -180,7 +180,7 @@ behavior_class_add_methods (Class class, struct objc_method_list *methods)
|
|||
|
||||
counter = mlist->method_count ? mlist->method_count - 1 : 1;
|
||||
|
||||
/* This is a little wasteful of memory, since not necessarily
|
||||
/* This is a little wasteful of memory, since not necessarily
|
||||
all methods will go in here. */
|
||||
new_list = (struct objc_method_list *)
|
||||
objc_malloc (sizeof(struct objc_method_list) +
|
||||
|
@ -193,7 +193,7 @@ behavior_class_add_methods (Class class, struct objc_method_list *methods)
|
|||
|
||||
if (behavior_debug)
|
||||
{
|
||||
fprintf(stderr, " processing method [%s] ... ",
|
||||
fprintf(stderr, " processing method [%s] ... ",
|
||||
sel_get_name(method->method_name));
|
||||
}
|
||||
|
||||
|
@ -207,12 +207,12 @@ behavior_class_add_methods (Class class, struct objc_method_list *methods)
|
|||
(new_list->method_count)++;
|
||||
if (behavior_debug)
|
||||
{
|
||||
fprintf(stderr, "added.\n");
|
||||
fprintf(stderr, "added.\n");
|
||||
}
|
||||
}
|
||||
else if (behavior_debug)
|
||||
{
|
||||
fprintf(stderr, "ignored.\n");
|
||||
fprintf(stderr, "ignored.\n");
|
||||
}
|
||||
counter -= 1;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ search_for_method_in_list (Class class, SEL op)
|
|||
return NULL;
|
||||
|
||||
/* If not found then we'll search the list. */
|
||||
while ( (method_list = class_nextMethodList(class, &iterator)) )
|
||||
while ((method_list = class_nextMethodList(class, &iterator)))
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -269,7 +269,7 @@ extern Method_t search_for_method_in_list(MethodList_t list, SEL op);
|
|||
extern void class_add_method_list(Class, MethodList_t);
|
||||
|
||||
void
|
||||
behavior_class_add_methods (Class class,
|
||||
behavior_class_add_methods (Class class,
|
||||
struct objc_method_list *methods)
|
||||
{
|
||||
static SEL initialize_sel = 0;
|
||||
|
@ -286,7 +286,7 @@ behavior_class_add_methods (Class class,
|
|||
|
||||
counter = mlist->method_count ? mlist->method_count - 1 : 1;
|
||||
|
||||
/* This is a little wasteful of memory, since not necessarily
|
||||
/* This is a little wasteful of memory, since not necessarily
|
||||
all methods will go in here. */
|
||||
new_list = (struct objc_method_list *)
|
||||
objc_malloc (sizeof(struct objc_method_list) +
|
||||
|
@ -321,12 +321,12 @@ behavior_class_add_methods (Class class,
|
|||
(new_list->method_count)++;
|
||||
if (behavior_debug)
|
||||
{
|
||||
fprintf(stderr, "added.\n");
|
||||
fprintf(stderr, "added.\n");
|
||||
}
|
||||
}
|
||||
else if (behavior_debug)
|
||||
{
|
||||
fprintf(stderr, "ignored.\n");
|
||||
fprintf(stderr, "ignored.\n");
|
||||
}
|
||||
counter -= 1;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/** Concrete implementation of NSArray
|
||||
/** Concrete implementation of NSArray
|
||||
Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: March 1995
|
||||
Rewrite by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -87,7 +87,7 @@ static Class GSInlineArrayClass;
|
|||
[NSNumber numberWithUnsignedInt: index], @"Index",
|
||||
[NSNumber numberWithUnsignedInt: _count], @"Count",
|
||||
self, @"Array", nil, nil];
|
||||
|
||||
|
||||
reason = [NSString stringWithFormat: @"Index %d is out of range %d (in '%@')",
|
||||
index, _count, NSStringFromSelector(sel)];
|
||||
|
||||
|
@ -276,7 +276,7 @@ static Class GSInlineArrayClass;
|
|||
- (BOOL) isEqualToArray: (NSArray*)otherArray
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
||||
if (self == (id)otherArray)
|
||||
{
|
||||
return YES;
|
||||
|
@ -452,7 +452,7 @@ static Class GSInlineArrayClass;
|
|||
return [copy initWithObjects: _contents_array count: _count];
|
||||
}
|
||||
|
||||
- (void) exchangeObjectAtIndex: (unsigned int)i1
|
||||
- (void) exchangeObjectAtIndex: (unsigned int)i1
|
||||
withObjectAtIndex: (unsigned int)i2
|
||||
{
|
||||
if (i1 >= _count)
|
||||
|
@ -493,7 +493,7 @@ static Class GSInlineArrayClass;
|
|||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
NSArray *array = [(NSKeyedUnarchiver*)aCoder _decodeArrayOfObjectsForKey:
|
||||
NSArray *array = [(NSKeyedUnarchiver*)aCoder _decodeArrayOfObjectsForKey:
|
||||
@"NS.objects"];
|
||||
|
||||
[self initWithArray: array];
|
||||
|
@ -735,7 +735,7 @@ static Class GSInlineArrayClass;
|
|||
RELEASE(obj);
|
||||
}
|
||||
|
||||
- (void) sortUsingFunction: (NSComparisonResult(*)(id,id,void*))compare
|
||||
- (void) sortUsingFunction: (NSComparisonResult(*)(id,id,void*))compare
|
||||
context: (void*)context
|
||||
{
|
||||
/* Shell sort algorithm taken from SortingInAction - a NeXT example */
|
||||
|
@ -754,7 +754,7 @@ static Class GSInlineArrayClass;
|
|||
{
|
||||
stride = stride * STRIDE_FACTOR + 1;
|
||||
}
|
||||
|
||||
|
||||
while (stride > (STRIDE_FACTOR - 1))
|
||||
{
|
||||
// loop to sort for each value of stride
|
||||
|
@ -1034,7 +1034,7 @@ static Class GSInlineArrayClass;
|
|||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
NSArray *array = [(NSKeyedUnarchiver*)aCoder _decodeArrayOfObjectsForKey:
|
||||
NSArray *array = [(NSKeyedUnarchiver*)aCoder _decodeArrayOfObjectsForKey:
|
||||
@"NS.objects"];
|
||||
|
||||
return array;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/**
|
||||
GSAttributedString.m
|
||||
|
||||
Implementation of concrete subclass of a string class with attributes
|
||||
|
@ -9,14 +9,14 @@
|
|||
Date: November 1997
|
||||
Rewrite by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Date: April 1999
|
||||
|
||||
|
||||
This file is part of GNUStep-base
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
If you are interested in a warranty or support for this source code,
|
||||
contact Scott Christley <scottc@net-community.com> for more information.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -379,7 +379,7 @@ _attributesAtIndexEffectiveRange(
|
|||
format: @"index is out of range in function "
|
||||
@"_attributesAtIndexEffectiveRange()"];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Binary search for efficiency in huge attributed strings
|
||||
*/
|
||||
|
@ -679,7 +679,7 @@ SANITY();
|
|||
{
|
||||
arrayIndex = arraySize - 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Remove any ranges completely within ours
|
||||
*/
|
||||
|
@ -724,7 +724,7 @@ SANITY();
|
|||
INSOBJECT(info, arrayIndex);
|
||||
RELEASE(info);
|
||||
}
|
||||
|
||||
|
||||
SANITY();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
/** Runtime MacOSX compatibility functionality
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Richard frith-Macdonald <rfm@gnu.org>
|
||||
Date: August 2000
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "Foundation/Foundation.h"
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/** Concrete implementation of NSCountedSet based on GNU Set class
|
||||
Copyright (C) 1998,2000 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Richard frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Created: October 1998
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
/** Implementation of GSFFCallInvocation for GNUStep
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written: Adam Fedor <fedor@gnu.org>
|
||||
Date: Nov 2000
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
*/
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSCoder.h"
|
||||
#include "Foundation/NSDistantObject.h"
|
||||
|
@ -58,7 +58,7 @@ typedef struct _vacallReturnTypeInfo_t
|
|||
unsigned structSplit;
|
||||
} vacallReturnTypeInfo;
|
||||
|
||||
/*
|
||||
/*
|
||||
Create the map table for the forwarding functions
|
||||
*/
|
||||
#define GSI_MAP_KTYPES GSUNION_PTR
|
||||
|
@ -85,8 +85,8 @@ static INLINE unsigned int
|
|||
ReturnTypeHash (vacallReturnTypeInfo *ret_type)
|
||||
{
|
||||
return ret_type->type
|
||||
^ ret_type->structSplit << 4
|
||||
^ ret_type->structAlign << 5
|
||||
^ ret_type->structSplit << 4
|
||||
^ ret_type->structAlign << 5
|
||||
^ ret_type->structSize << 8;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ static GSIMapTable_t ff_callback_map;
|
|||
|
||||
static objc_mutex_t ff_callback_map_lock = NULL;
|
||||
|
||||
/* Static pre-computed return type info */
|
||||
/* Static pre-computed return type info */
|
||||
|
||||
static vacallReturnTypeInfo returnTypeInfo [STATIC_CALLBACK_LIST_SIZE];
|
||||
|
||||
|
@ -152,7 +152,7 @@ gs_offset(const char *type, int index)
|
|||
{
|
||||
int offset;
|
||||
const char *subtype;
|
||||
|
||||
|
||||
if (index == 0)
|
||||
return 0;
|
||||
subtype = type;
|
||||
|
@ -173,7 +173,7 @@ gs_splittable (const char *type)
|
|||
int i, numtypes;
|
||||
const char *subtype;
|
||||
int result;
|
||||
|
||||
|
||||
subtype = type;
|
||||
while (*subtype != _C_STRUCT_E && *subtype++ != '='); /* skip "<name>=" */
|
||||
numtypes = 0;
|
||||
|
@ -188,8 +188,8 @@ gs_splittable (const char *type)
|
|||
result = 1;
|
||||
for (i = 0; i < numtypes; i++)
|
||||
{
|
||||
result = result
|
||||
&& (gs_offset(type, i)/sizeof(__avword)
|
||||
result = result
|
||||
&& (gs_offset(type, i)/sizeof(__avword)
|
||||
== (gs_offset(type, i)+objc_sizeof_type(&subtype[i])-1)
|
||||
/ sizeof(__avword));
|
||||
}
|
||||
|
@ -222,8 +222,8 @@ gs_method_for_receiver_and_selector (id receiver, SEL sel)
|
|||
return METHOD_NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* Selectors are not unique, and not all selectors have
|
||||
* type information. This method tries to find the
|
||||
* best equivalent selector with type information.
|
||||
|
@ -231,21 +231,21 @@ gs_method_for_receiver_and_selector (id receiver, SEL sel)
|
|||
* the conversion sel -> name -> sel
|
||||
* is not what we want. However
|
||||
* I can not see a way to dispose of the
|
||||
* name, except if we can access the
|
||||
* name, except if we can access the
|
||||
* internal data structures of the runtime.
|
||||
*
|
||||
*
|
||||
* If we can access the private data structures
|
||||
* we can also check for incompatible
|
||||
* return types between all equivalent selectors.
|
||||
*/
|
||||
|
||||
static INLINE SEL
|
||||
static INLINE SEL
|
||||
gs_find_best_typed_sel (SEL sel)
|
||||
{
|
||||
if (!sel_get_type (sel))
|
||||
{
|
||||
const char *name = GSNameFromSelector(sel);
|
||||
|
||||
|
||||
if (name)
|
||||
{
|
||||
SEL tmp_sel = sel_get_any_typed_uid (name);
|
||||
|
@ -265,7 +265,7 @@ gs_find_best_typed_sel (SEL sel)
|
|||
*
|
||||
* In all other cases fallback
|
||||
* to gs_find_best_typed_sel ().
|
||||
*/
|
||||
*/
|
||||
static INLINE SEL
|
||||
gs_find_by_receiver_best_typed_sel (id receiver, SEL sel)
|
||||
{
|
||||
|
@ -295,9 +295,9 @@ gs_find_by_receiver_best_typed_sel (id receiver, SEL sel)
|
|||
Convert objc selector type to a vacallReturnTypeInfo.
|
||||
Only passes the first part. Is used for determining
|
||||
the return type for the vacall macros.
|
||||
*/
|
||||
void
|
||||
gs_sel_type_to_callback_type (const char *sel_type,
|
||||
*/
|
||||
void
|
||||
gs_sel_type_to_callback_type (const char *sel_type,
|
||||
vacallReturnTypeInfo *vatype)
|
||||
{
|
||||
switch (*sel_type)
|
||||
|
@ -306,44 +306,44 @@ gs_sel_type_to_callback_type (const char *sel_type,
|
|||
case _C_CLASS:
|
||||
case _C_SEL:
|
||||
case _C_PTR:
|
||||
case _C_CHARPTR:
|
||||
case _C_CHARPTR:
|
||||
vatype->type = __VAvoidp;
|
||||
break;
|
||||
case _C_CHR:
|
||||
vatype->type = __VAchar;
|
||||
case _C_CHR:
|
||||
vatype->type = __VAchar;
|
||||
break;
|
||||
case _C_UCHR:
|
||||
vatype->type = __VAuchar;
|
||||
vatype->type = __VAuchar;
|
||||
break;
|
||||
case _C_SHT:
|
||||
vatype->type = __VAshort;
|
||||
vatype->type = __VAshort;
|
||||
break;
|
||||
case _C_USHT:
|
||||
vatype->type = __VAushort;
|
||||
vatype->type = __VAushort;
|
||||
break;
|
||||
case _C_INT:
|
||||
vatype->type = __VAint;
|
||||
vatype->type = __VAint;
|
||||
break;
|
||||
case _C_UINT:
|
||||
vatype->type = __VAuint;
|
||||
vatype->type = __VAuint;
|
||||
break;
|
||||
case _C_LNG:
|
||||
vatype->type = __VAlong;
|
||||
vatype->type = __VAlong;
|
||||
break;
|
||||
case _C_ULNG:
|
||||
vatype->type = __VAulong;
|
||||
vatype->type = __VAulong;
|
||||
break;
|
||||
case _C_LNG_LNG:
|
||||
vatype->type = __VAlonglong;
|
||||
vatype->type = __VAlonglong;
|
||||
break;
|
||||
case _C_ULNG_LNG:
|
||||
vatype->type = __VAulonglong;
|
||||
vatype->type = __VAulonglong;
|
||||
break;
|
||||
case _C_FLT:
|
||||
vatype->type = __VAfloat;
|
||||
vatype->type = __VAfloat;
|
||||
break;
|
||||
case _C_DBL:
|
||||
vatype->type = __VAdouble;
|
||||
vatype->type = __VAdouble;
|
||||
break;
|
||||
case _C_STRUCT_B:
|
||||
vatype->structSize = objc_sizeof_type (sel_type);
|
||||
|
@ -385,7 +385,7 @@ static IMP gs_objc_msg_forward (SEL sel)
|
|||
|
||||
sel_type = objc_skip_type_qualifiers (sel_type);
|
||||
gs_sel_type_to_callback_type (sel_type, &returnInfo);
|
||||
|
||||
|
||||
/*
|
||||
* 2. Check if we have already a callback
|
||||
*/
|
||||
|
@ -399,13 +399,13 @@ static IMP gs_objc_msg_forward (SEL sel)
|
|||
{
|
||||
// 2.b Or do we have it already in our hash table
|
||||
GSIMapNode node;
|
||||
|
||||
|
||||
// Lock
|
||||
objc_mutex_lock (ff_callback_map_lock);
|
||||
|
||||
node = GSIMapNodeForKey (&ff_callback_map,
|
||||
(GSIMapKey) ((void *) &returnInfo));
|
||||
|
||||
|
||||
if (node)
|
||||
{
|
||||
// 2.b.1 YES, we have it in our cache
|
||||
|
@ -417,12 +417,12 @@ static IMP gs_objc_msg_forward (SEL sel)
|
|||
vacallReturnTypeInfo *ret_info;
|
||||
|
||||
ret_info = objc_malloc (sizeof (vacallReturnTypeInfo));
|
||||
*ret_info = returnInfo;
|
||||
|
||||
*ret_info = returnInfo;
|
||||
|
||||
forwarding_callback
|
||||
= alloc_callback (&GSInvocationCallback, ret_info);
|
||||
|
||||
GSIMapAddPairNoRetain (&ff_callback_map,
|
||||
GSIMapAddPairNoRetain (&ff_callback_map,
|
||||
(GSIMapKey) (void *) ret_info,
|
||||
(GSIMapVal) forwarding_callback);
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ static IMP gs_objc_msg_forward (SEL sel)
|
|||
ff_callback[index] = alloc_callback (&GSInvocationCallback,
|
||||
&returnTypeInfo [index]);
|
||||
}
|
||||
|
||||
|
||||
GSIMapInitWithZoneAndCapacity (&ff_callback_map, NSDefaultMallocZone(), 9);
|
||||
|
||||
__objc_msg_forward = gs_objc_msg_forward;
|
||||
|
@ -512,7 +512,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
case _C_CHARPTR:
|
||||
av_start_ptr(alist, imp, char *, retval);
|
||||
break;
|
||||
|
||||
|
||||
CASE_TYPE(_C_CHR, char, av_start_char)
|
||||
CASE_TYPE(_C_UCHR, unsigned char, av_start_uchar)
|
||||
CASE_TYPE(_C_SHT, short, av_start_short)
|
||||
|
@ -542,7 +542,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
av_start_void(alist, imp);
|
||||
break;
|
||||
default:
|
||||
NSCAssert1(0, @"GSFFCallInvocation: Return Type '%s' not implemented",
|
||||
NSCAssert1(0, @"GSFFCallInvocation: Return Type '%s' not implemented",
|
||||
inv->_info[0].type);
|
||||
break;
|
||||
}
|
||||
|
@ -607,7 +607,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
av_ptr(alist, char *, ptr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
CASE_TYPE(_C_CHR, char, av_char)
|
||||
CASE_TYPE(_C_UCHR, unsigned char, av_uchar)
|
||||
CASE_TYPE(_C_SHT, short, av_short)
|
||||
|
@ -620,7 +620,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
CASE_TYPE(_C_ULNG_LNG, unsigned long long, av_ulonglong)
|
||||
CASE_TYPE(_C_FLT, float, av_float)
|
||||
CASE_TYPE(_C_DBL, double, av_double)
|
||||
|
||||
|
||||
case _C_STRUCT_B:
|
||||
_av_struct(alist, size, inv->_info[i+1].align, datum);
|
||||
break;
|
||||
|
@ -642,7 +642,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
|
||||
CLEAR_RETURN_VALUE_IF_OBJECT;
|
||||
_validReturn = NO;
|
||||
|
||||
|
||||
/*
|
||||
* A message to a nil object returns nil.
|
||||
*/
|
||||
|
@ -656,7 +656,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NSAssert(_selector != 0, @"you must set the selector before invoking");
|
||||
|
||||
/*
|
||||
|
@ -701,7 +701,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
|
||||
[self setTarget: old_target];
|
||||
RELEASE(old_target);
|
||||
|
||||
|
||||
GSFFCallInvokeWithTargetAndImp(self, anObject, imp);
|
||||
|
||||
RETAIN_RETURN_VALUE;
|
||||
|
@ -726,7 +726,7 @@ gs_protocol_selector(const char *types)
|
|||
}
|
||||
while (*types != '\0')
|
||||
{
|
||||
if (*types == '-' )
|
||||
if (*types == '-')
|
||||
{
|
||||
types++;
|
||||
}
|
||||
|
@ -766,11 +766,11 @@ gs_protocol_selector(const char *types)
|
|||
*
|
||||
* TODO:
|
||||
* Add a check that the return type the selector
|
||||
* expects matches the the `callback_data'
|
||||
* expects matches the the `callback_data'
|
||||
* information.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
GSInvocationCallback (void *callback_data, va_alist args)
|
||||
{
|
||||
id obj;
|
||||
|
@ -783,16 +783,16 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
GSFFCallInvocation *invocation;
|
||||
NSMethodSignature *sig;
|
||||
GSMethod fwdInvMethod;
|
||||
|
||||
|
||||
typeinfo = (vacallReturnTypeInfo *) callback_data;
|
||||
|
||||
|
||||
if (typeinfo->type != __VAstruct)
|
||||
{
|
||||
__va_start (args, typeinfo->type);
|
||||
}
|
||||
else
|
||||
{
|
||||
_va_start_struct (args, typeinfo->structSize,
|
||||
_va_start_struct (args, typeinfo->structSize,
|
||||
typeinfo->structAlign, typeinfo->structSplit);
|
||||
}
|
||||
|
||||
|
@ -801,7 +801,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
|
||||
fwdInvMethod = gs_method_for_receiver_and_selector
|
||||
(obj, @selector (forwardInvocation:));
|
||||
|
||||
|
||||
if (!fwdInvMethod)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
|
@ -812,7 +812,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
GSObjCIsInstance(obj) ? "instance" : "class",
|
||||
selector ? GSNameFromSelector(selector) : "(null)"];
|
||||
}
|
||||
|
||||
|
||||
sig = nil;
|
||||
if (gs_protocol_selector(sel_get_type(selector)) == YES)
|
||||
{
|
||||
|
@ -861,7 +861,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (sig == nil)
|
||||
{
|
||||
selector = gs_find_best_typed_sel (selector);
|
||||
|
@ -880,7 +880,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
GSClassNameFromObject(obj),
|
||||
selector ? GSNameFromSelector(selector) : "(null)"];
|
||||
}
|
||||
|
||||
|
||||
invocation = [[GSFFCallInvocation alloc] initWithMethodSignature: sig];
|
||||
AUTORELEASE(invocation);
|
||||
[invocation setTarget: obj];
|
||||
|
@ -888,7 +888,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
|
||||
/* Set the rest of the arguments */
|
||||
num_args = [sig numberOfArguments];
|
||||
info = [sig methodInfo];
|
||||
info = [sig methodInfo];
|
||||
for (i = 2; i < num_args; i++)
|
||||
{
|
||||
const char *type = info[i+1].type;
|
||||
|
@ -935,7 +935,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
[invocation setArgument: &ptr atIndex: i];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
CASE_TYPE(_C_CHR, char, va_arg_char)
|
||||
CASE_TYPE(_C_UCHR, unsigned char, va_arg_uchar)
|
||||
CASE_TYPE(_C_SHT, short, va_arg_short)
|
||||
|
@ -948,7 +948,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
CASE_TYPE(_C_ULNG_LNG, unsigned long long, va_arg_ulonglong)
|
||||
CASE_TYPE(_C_FLT, float, va_arg_float)
|
||||
CASE_TYPE(_C_DBL, double, va_arg_double)
|
||||
|
||||
|
||||
case _C_STRUCT_B:
|
||||
{
|
||||
/* Here we actually get a ptr to the struct */
|
||||
|
@ -962,7 +962,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Now do it.
|
||||
* The next line is equivalent to
|
||||
|
@ -973,7 +973,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
* so the line below is somewhat faster. */
|
||||
fwdInvMethod->method_imp (obj, fwdInvMethod->method_name, invocation);
|
||||
|
||||
/* Return the proper type */
|
||||
/* Return the proper type */
|
||||
retval = [invocation returnFrame: NULL];
|
||||
|
||||
#undef CASE_TYPE
|
||||
|
@ -991,7 +991,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
case _C_CHARPTR:
|
||||
va_return_ptr(args, void *, *(void **)retval);
|
||||
break;
|
||||
|
||||
|
||||
CASE_TYPE(_C_CHR, char, va_return_char)
|
||||
CASE_TYPE(_C_UCHR, unsigned char, va_return_uchar)
|
||||
CASE_TYPE(_C_SHT, short, va_return_short)
|
||||
|
@ -1049,7 +1049,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
int flags = _info[i+1].qual;
|
||||
const char *type = _info[i+1].type;
|
||||
void *datum;
|
||||
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
datum = &_target;
|
||||
|
@ -1073,7 +1073,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
|
||||
switch (*type)
|
||||
{
|
||||
case _C_ID:
|
||||
case _C_ID:
|
||||
if (flags & _F_BYCOPY)
|
||||
{
|
||||
[coder encodeBycopyObject: *(id*)datum];
|
||||
|
@ -1125,14 +1125,14 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
{
|
||||
out_parameters = YES;
|
||||
}
|
||||
if (passp)
|
||||
if (passp)
|
||||
{
|
||||
if ((flags & _F_IN) || !(flags & _F_OUT))
|
||||
{
|
||||
[coder encodeValueOfObjCType: type at: datum];
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Handle an argument that is a pointer to a non-char. But
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
/** Implementation of GSFFIInvocation for GNUStep
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written: Adam Fedor <fedor@gnu.org>
|
||||
Date: Apr 2002
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
*/
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSCoder.h"
|
||||
#include "Foundation/NSDistantObject.h"
|
||||
|
@ -69,8 +69,8 @@ gs_method_for_receiver_and_selector (id receiver, SEL sel)
|
|||
return METHOD_NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* Selectors are not unique, and not all selectors have
|
||||
* type information. This method tries to find the
|
||||
* best equivalent selector with type information.
|
||||
|
@ -78,21 +78,21 @@ gs_method_for_receiver_and_selector (id receiver, SEL sel)
|
|||
* the conversion sel -> name -> sel
|
||||
* is not what we want. However
|
||||
* I can not see a way to dispose of the
|
||||
* name, except if we can access the
|
||||
* name, except if we can access the
|
||||
* internal data structures of the runtime.
|
||||
*
|
||||
*
|
||||
* If we can access the private data structures
|
||||
* we can also check for incompatible
|
||||
* return types between all equivalent selectors.
|
||||
*/
|
||||
|
||||
static INLINE SEL
|
||||
static INLINE SEL
|
||||
gs_find_best_typed_sel (SEL sel)
|
||||
{
|
||||
if (!sel_get_type (sel))
|
||||
{
|
||||
const char *name = GSNameFromSelector(sel);
|
||||
|
||||
|
||||
if (name)
|
||||
{
|
||||
SEL tmp_sel = sel_get_any_typed_uid (name);
|
||||
|
@ -112,7 +112,7 @@ gs_find_best_typed_sel (SEL sel)
|
|||
*
|
||||
* In all other cases fallback
|
||||
* to gs_find_best_typed_sel ().
|
||||
*/
|
||||
*/
|
||||
static INLINE SEL
|
||||
gs_find_by_receiver_best_typed_sel (id receiver, SEL sel)
|
||||
{
|
||||
|
@ -154,7 +154,7 @@ static IMP gs_objc_msg_forward (SEL sel)
|
|||
*/
|
||||
sel_type = sel_get_type (sel);
|
||||
sig = nil;
|
||||
|
||||
|
||||
if (sel_type)
|
||||
{
|
||||
sig = [NSMethodSignature signatureWithObjCTypes: sel_type];
|
||||
|
@ -186,7 +186,7 @@ static IMP gs_objc_msg_forward (SEL sel)
|
|||
{
|
||||
[NSException raise: NSMallocException format: @"Allocating closure"];
|
||||
}
|
||||
if (ffi_prep_closure(cclosure, &(cframe->cif),
|
||||
if (ffi_prep_closure(cclosure, &(cframe->cif),
|
||||
GSFFIInvocationCallback, cframe) != FFI_OK)
|
||||
{
|
||||
[NSException raise: NSGenericException format: @"Preping closure"];
|
||||
|
@ -229,7 +229,7 @@ static IMP gs_objc_msg_forward (SEL sel)
|
|||
/* Initializer used when we get a callback. uses the data provided by
|
||||
the callback. The cifframe was allocated by the forwarding function,
|
||||
but we own it now so we can free it */
|
||||
- (id) initWithCallback: (ffi_cif *)cif
|
||||
- (id) initWithCallback: (ffi_cif *)cif
|
||||
returnp: (void *)retp
|
||||
values: (void **)vals
|
||||
frame: (cifframe_t *)frame
|
||||
|
@ -242,7 +242,7 @@ static IMP gs_objc_msg_forward (SEL sel)
|
|||
_cframe = frame;
|
||||
((cifframe_t *)_cframe)->cif = *cif;
|
||||
|
||||
#if MFRAME_STRUCT_BYREF
|
||||
#if MFRAME_STRUCT_BYREF
|
||||
/* Fix up some of the values. Do this on all processors that pass
|
||||
structs by reference. Is there an automatic way to determine this? */
|
||||
for (i = 0; i < ((cifframe_t *)_cframe)->nargs; i++)
|
||||
|
@ -251,12 +251,12 @@ static IMP gs_objc_msg_forward (SEL sel)
|
|||
|
||||
if (*t == _C_STRUCT_B || *t == _C_UNION_B || *t == _C_ARY_B)
|
||||
{
|
||||
memcpy(((cifframe_t *)_cframe)->values[i], *(void **)vals[i],
|
||||
memcpy(((cifframe_t *)_cframe)->values[i], *(void **)vals[i],
|
||||
((cifframe_t *)_cframe)->arg_types[i]->size);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(((cifframe_t *)_cframe)->values[i], vals[i],
|
||||
memcpy(((cifframe_t *)_cframe)->values[i], vals[i],
|
||||
((cifframe_t *)_cframe)->arg_types[i]->size);
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ GSFFIInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
NSInvocation_t *inv = (NSInvocation_t*)_inv;
|
||||
|
||||
/* Do it */
|
||||
ffi_call(inv->_cframe, (f_fun)imp, (inv->_retval),
|
||||
ffi_call(inv->_cframe, (f_fun)imp, (inv->_retval),
|
||||
((cifframe_t *)inv->_cframe)->values);
|
||||
|
||||
/* Don't decode the return value here (?) */
|
||||
|
@ -298,7 +298,7 @@ GSFFIInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
{
|
||||
if (_retval)
|
||||
memset(_retval, '\0', _info[0].size); /* Clear return value */
|
||||
_validReturn = YES;
|
||||
_validReturn = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -346,14 +346,14 @@ GSFFIInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
|
||||
[self setTarget: old_target];
|
||||
RELEASE(old_target);
|
||||
|
||||
|
||||
GSFFIInvokeWithTargetAndImp(self, anObject, imp);
|
||||
|
||||
/* Decode the return value */
|
||||
if (*_info[0].type != _C_VOID)
|
||||
cifframe_decode_arg(_info[0].type, _retval);
|
||||
|
||||
RETAIN_RETURN_VALUE;
|
||||
RETAIN_RETURN_VALUE;
|
||||
_validReturn = YES;
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ gs_protocol_selector(const char *types)
|
|||
return NO;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
||||
{
|
||||
id obj;
|
||||
|
@ -413,13 +413,13 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
GSFFIInvocation *invocation;
|
||||
NSMethodSignature *sig;
|
||||
GSMethod fwdInvMethod;
|
||||
|
||||
|
||||
obj = *(id *)args[0];
|
||||
selector = *(SEL *)args[1];
|
||||
|
||||
fwdInvMethod = gs_method_for_receiver_and_selector
|
||||
(obj, @selector (forwardInvocation:));
|
||||
|
||||
|
||||
if (!fwdInvMethod)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
|
@ -429,7 +429,7 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
GSObjCIsInstance(obj) ? "instance" : "class",
|
||||
selector ? GSNameFromSelector(selector) : "(null)"];
|
||||
}
|
||||
|
||||
|
||||
sig = nil;
|
||||
if (gs_protocol_selector(sel_get_type(selector)) == YES)
|
||||
{
|
||||
|
@ -474,7 +474,7 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (sig == nil)
|
||||
{
|
||||
selector = gs_find_best_typed_sel (selector);
|
||||
|
@ -493,7 +493,7 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
GSClassNameFromObject(obj),
|
||||
selector ? GSNameFromSelector(selector) : "(null)"];
|
||||
}
|
||||
|
||||
|
||||
invocation = [[GSFFIInvocation alloc] initWithCallback: cif
|
||||
returnp: retp
|
||||
values: args
|
||||
|
@ -547,7 +547,7 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
int flags = _info[i+1].qual;
|
||||
const char *type = _info[i+1].type;
|
||||
void *datum;
|
||||
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
datum = &_target;
|
||||
|
@ -571,7 +571,7 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
|
||||
switch (*type)
|
||||
{
|
||||
case _C_ID:
|
||||
case _C_ID:
|
||||
if (flags & _F_BYCOPY)
|
||||
{
|
||||
[coder encodeBycopyObject: *(id*)datum];
|
||||
|
@ -623,14 +623,14 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
{
|
||||
out_parameters = YES;
|
||||
}
|
||||
if (passp)
|
||||
if (passp)
|
||||
{
|
||||
if ((flags & _F_IN) || !(flags & _F_OUT))
|
||||
{
|
||||
[coder encodeValueOfObjCType: type at: datum];
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Handle an argument that is a pointer to a non-char. But
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/** GSFTPURLHandle.m - Class GSFTPURLHandle
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: June 2002
|
||||
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -36,7 +36,7 @@
|
|||
#include "Foundation/NSFileHandle.h"
|
||||
#include "Foundation/NSDebug.h"
|
||||
#include "GNUstepBase/GSMime.h"
|
||||
|
||||
|
||||
GS_EXPORT NSString * const GSTelnetNotification;
|
||||
GS_EXPORT NSString * const GSTelnetErrorKey;
|
||||
GS_EXPORT NSString * const GSTelnetTextKey;
|
||||
|
@ -607,7 +607,7 @@ static NSLock *urlLock = nil;
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (state == cConnect)
|
||||
{
|
||||
if ([line hasPrefix: @"2"] == YES)
|
||||
|
@ -748,7 +748,7 @@ static NSLock *urlLock = nil;
|
|||
else if ([line hasPrefix: @"1"] == NO && [line hasPrefix: @"2"] == NO)
|
||||
{
|
||||
e = line;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (state == list)
|
||||
{
|
||||
|
@ -787,7 +787,7 @@ static NSLock *urlLock = nil;
|
|||
else if ([line hasPrefix: @"1"] == NO && [line hasPrefix: @"2"] == NO)
|
||||
{
|
||||
e = line;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -464,7 +464,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
/*
|
||||
* Connect command is ten bytes -
|
||||
* socks version
|
||||
* connect command
|
||||
* connect command
|
||||
* reserved byte
|
||||
* address type
|
||||
* address 4 bytes (big endian)
|
||||
|
@ -577,7 +577,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
else if (bytes[3] == 1)
|
||||
{
|
||||
len = 4; // Fixed size (IPV4) address
|
||||
len = 4; // Fixed size (IPV4) address
|
||||
}
|
||||
else if (bytes[3] == 3)
|
||||
{
|
||||
|
@ -585,7 +585,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
else if (bytes[3] == 4)
|
||||
{
|
||||
len = 16; // Fixed size (IPV6) address
|
||||
len = 16; // Fixed size (IPV6) address
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2369,7 +2369,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
NSString *str = nil;
|
||||
struct sockaddr_in sin;
|
||||
int size = sizeof(sin);
|
||||
|
||||
|
||||
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
|
|
|
@ -1700,7 +1700,7 @@ NSDictionary *locale)
|
|||
--width; /* Account for the character itself. */
|
||||
if (!left)
|
||||
PAD (' ');
|
||||
outchar ( ((unsigned char)
|
||||
outchar (((unsigned char)
|
||||
args_value[specs[nspecs_done].data_arg].pa_char));
|
||||
if (left)
|
||||
PAD (' ');
|
||||
|
@ -1980,7 +1980,7 @@ printf_unknown (GSStr s, const struct printf_info *info,
|
|||
static unichar *
|
||||
group_number (unichar *w, unichar *rear_ptr, const char *grouping,
|
||||
NSString *thousands_sep
|
||||
)
|
||||
)
|
||||
{
|
||||
int len;
|
||||
unichar *src, *s;
|
||||
|
@ -2017,7 +2017,7 @@ group_number (unichar *w, unichar *rear_ptr, const char *grouping,
|
|||
#if CHAR_MIN < 0
|
||||
|| *grouping < 0
|
||||
#endif
|
||||
)
|
||||
)
|
||||
{
|
||||
/* No further grouping to be done.
|
||||
Copy the rest of the number. */
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/** GSHTTPURLHandle.m - Class GSHTTPURLHandle
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Mark Allison <mark@brainstorm.co.uk>
|
||||
Integrated by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: November 2000
|
||||
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -105,7 +105,7 @@ static NSString *httpVersion = @"1.1";
|
|||
* <p>
|
||||
* Header information from the current page may be obtained using
|
||||
* -propertyForKey and -propertyForKeyIfAvailable. <code>HTTP</code>
|
||||
* status information can be retrieved as by calling either of these
|
||||
* status information can be retrieved as by calling either of these
|
||||
* methods specifying one of the following keys:
|
||||
* </p>
|
||||
* <list>
|
||||
|
@ -147,7 +147,7 @@ static NSString *httpVersion = @"1.1";
|
|||
* "GET" method when fetching a page, and the
|
||||
* "POST" method when using -writeData:.
|
||||
* This can be over-ridden by calling -writeProperty:forKey: with
|
||||
* the key name "GSHTTPPropertyMethodKey" and specifying an
|
||||
* the key name "GSHTTPPropertyMethodKey" and specifying an
|
||||
* alternative method (i.e "PUT").
|
||||
* </p>
|
||||
* <p>
|
||||
|
@ -183,7 +183,7 @@ static void debugRead(GSHTTPURLHandle *handle, NSData *data)
|
|||
int d;
|
||||
|
||||
[debugLock lock];
|
||||
d = open([debugFile fileSystemRepresentation],
|
||||
d = open([debugFile fileSystemRepresentation],
|
||||
O_WRONLY|O_CREAT|O_APPEND, 0644);
|
||||
if (d >= 0)
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
int d;
|
||||
|
||||
[debugLock lock];
|
||||
d = open([debugFile fileSystemRepresentation],
|
||||
d = open([debugFile fileSystemRepresentation],
|
||||
O_WRONLY|O_CREAT|O_APPEND, 0644);
|
||||
if (d >= 0)
|
||||
{
|
||||
|
@ -241,7 +241,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
urlCache = [NSMutableDictionary new];
|
||||
urlLock = [GSLazyLock new];
|
||||
debugLock = [GSLazyLock new];
|
||||
debugFile = [NSString stringWithFormat: @"%@/GSHTTP.%d",
|
||||
debugFile = [NSString stringWithFormat: @"%@/GSHTTP.%d",
|
||||
NSTemporaryDirectory(),
|
||||
[[NSProcessInfo processInfo] processIdentifier]];
|
||||
RETAIN(debugFile);
|
||||
|
@ -323,7 +323,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
if (version == nil)
|
||||
{
|
||||
version = httpVersion;
|
||||
}
|
||||
}
|
||||
[s appendFormat: @" HTTP/%@\r\n", version];
|
||||
|
||||
if ([wProperties objectForKey: @"host"] == nil)
|
||||
|
@ -351,8 +351,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
NSString *auth;
|
||||
|
||||
if ([[u password] length] > 0)
|
||||
{
|
||||
auth = [NSString stringWithFormat: @"%@:%@",
|
||||
{
|
||||
auth = [NSString stringWithFormat: @"%@:%@",
|
||||
[u user], [u password]];
|
||||
}
|
||||
else
|
||||
|
@ -597,7 +597,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
- (void) bgdConnect: (NSNotification*)notification
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
|
||||
NSDictionary *userInfo = [notification userInfo];
|
||||
NSMutableString *s;
|
||||
NSString *e;
|
||||
|
@ -610,7 +610,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
if ([path length] == 0)
|
||||
{
|
||||
path = @"/";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* See if the connection attempt caused an error.
|
||||
|
@ -636,7 +636,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
* Build HTTP request.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* If SSL via proxy, set up tunnel first
|
||||
*/
|
||||
if ([[u scheme] isEqualToString: @"https"]
|
||||
|
@ -655,7 +655,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
if (version == nil)
|
||||
{
|
||||
version = httpVersion;
|
||||
}
|
||||
}
|
||||
if ([u port] == nil)
|
||||
{
|
||||
cmd = [NSString stringWithFormat: @"CONNECT %@:443 HTTP/%@\r\n\r\n",
|
||||
|
@ -666,7 +666,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
cmd = [NSString stringWithFormat: @"CONNECT %@:%@ HTTP/%@\r\n\r\n",
|
||||
[u host], [u port], version];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set up default status for if connection is lost.
|
||||
*/
|
||||
|
@ -683,7 +683,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
|
||||
buf = [cmd dataUsingEncoding: NSASCIIStringEncoding];
|
||||
if (debug == YES) debugWrite(self, buf);
|
||||
[sock writeInBackgroundAndNotify: buf];
|
||||
[sock writeInBackgroundAndNotify: buf];
|
||||
|
||||
when = [NSDate alloc];
|
||||
while (tunnel == YES)
|
||||
|
@ -742,18 +742,18 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
{
|
||||
if ([u port] == nil)
|
||||
{
|
||||
s = [[NSMutableString alloc] initWithFormat: @"%@ http://%@%@",
|
||||
s = [[NSMutableString alloc] initWithFormat: @"%@ http://%@%@",
|
||||
method, [u host], path];
|
||||
}
|
||||
else
|
||||
{
|
||||
s = [[NSMutableString alloc] initWithFormat: @"%@ http://%@:%@%@",
|
||||
s = [[NSMutableString alloc] initWithFormat: @"%@ http://%@:%@%@",
|
||||
method, [u host], [u port], path];
|
||||
}
|
||||
}
|
||||
else // no proxy
|
||||
{
|
||||
s = [[NSMutableString alloc] initWithFormat: @"%@ %@",
|
||||
s = [[NSMutableString alloc] initWithFormat: @"%@ %@",
|
||||
method, path];
|
||||
}
|
||||
|
||||
|
@ -766,7 +766,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
NSNotificationCenter *nc;
|
||||
NSDictionary *userInfo = [notification userInfo];
|
||||
NSString *e;
|
||||
|
||||
|
||||
if (debug == YES) NSLog(@"%@", NSStringFromSelector(_cmd));
|
||||
e = [userInfo objectForKey: GSFileHandleNotificationError];
|
||||
if (e != nil)
|
||||
|
@ -1023,7 +1023,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
}
|
||||
host = [request objectForKey: GSHTTPPropertyProxyHostKey];
|
||||
port = [request objectForKey: GSHTTPPropertyProxyPortKey];
|
||||
sock = [sslClass fileHandleAsClientInBackgroundAtAddress: host
|
||||
sock = [sslClass fileHandleAsClientInBackgroundAtAddress: host
|
||||
service: port
|
||||
protocol: s];
|
||||
}
|
||||
|
@ -1032,7 +1032,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
host = [request objectForKey: GSHTTPPropertyProxyHostKey];
|
||||
port = [request objectForKey: GSHTTPPropertyProxyPortKey];
|
||||
sock = [NSFileHandle
|
||||
fileHandleAsClientInBackgroundAtAddress: host
|
||||
fileHandleAsClientInBackgroundAtAddress: host
|
||||
service: port
|
||||
protocol: s];
|
||||
}
|
||||
|
@ -1080,7 +1080,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
if ([path length] == 0)
|
||||
{
|
||||
path = @"/";
|
||||
}
|
||||
}
|
||||
basic = [NSString stringWithFormat: @"%@ %@", method, path];
|
||||
[self bgdApply: basic];
|
||||
}
|
||||
|
@ -1118,7 +1118,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
* of a host to proxy through.
|
||||
* </item>
|
||||
* <item>
|
||||
* GSHTTPPropertyProxyPortKey - specify the port number to
|
||||
* GSHTTPPropertyProxyPortKey - specify the port number to
|
||||
* connect to on the proxy host. If not give, this defaults
|
||||
* to 8080 for <code>http</code> and 4430 for <code>https</code>.
|
||||
* </item>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/** GSLocale - various functions for localization
|
||||
|
||||
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Adam Fedor <fedor@gnu.org>
|
||||
|
@ -11,7 +11,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -66,8 +66,8 @@ GSSetLocale(int category, NSString *locale)
|
|||
}
|
||||
clocale = GSSetLocaleC(category, clocale);
|
||||
|
||||
if (clocale == NULL || strcmp(clocale, "C") == 0
|
||||
|| strcmp(clocale, "POSIX") == 0)
|
||||
if (clocale == NULL || strcmp(clocale, "C") == 0
|
||||
|| strcmp(clocale, "POSIX") == 0)
|
||||
{
|
||||
clocale = NULL;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ GSDomainFromDefaultLocale(void)
|
|||
forKey: NSThousandsSeparator];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* FIXME: Get currency format from localeconv */
|
||||
|
||||
#ifdef LC_MESSAGES
|
||||
|
@ -241,7 +241,7 @@ GSLanguageFromLocale(NSString *locale)
|
|||
gbundle = [NSBundle bundleForLibrary: @"gnustep-base"];
|
||||
aliases = [gbundle pathForResource: @"Locale"
|
||||
ofType: @"aliases"
|
||||
inDirectory: @"Languages"];
|
||||
inDirectory: @"Languages"];
|
||||
if (aliases != nil)
|
||||
{
|
||||
NSDictionary *dict;
|
||||
|
@ -259,6 +259,6 @@ GSLanguageFromLocale(NSString *locale)
|
|||
language = [dict objectForKey: locale];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return language;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/** Concrete implementation of NSSet based on GNU Set class
|
||||
Copyright (C) 1995, 1996, 1998, 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: September 1995
|
||||
Rewrite by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -223,7 +223,7 @@ static Class mutableSetClass;
|
|||
SEL sel = @selector(decodeValueOfObjCType:at:);
|
||||
IMP imp = [aCoder methodForSelector: sel];
|
||||
const char *type = @encode(id);
|
||||
|
||||
|
||||
(*imp)(aCoder, sel, @encode(unsigned), &count);
|
||||
|
||||
GSIMapInitWithZoneAndCapacity(&map, [self zone], count);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/** Implementation for GNUStep of NSString concrete subclasses
|
||||
Copyright (C) 1997,1998,2000 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Base on code written by Stevo Crvenkovski <stevo@btinternet.com>
|
||||
Date: February 1997
|
||||
|
||||
|
||||
Based on NSGCString and NSString
|
||||
Written by: Andrew Kachites McCallum
|
||||
<mccallum@gnu.ai.mit.edu>
|
||||
|
@ -21,7 +21,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -30,7 +30,7 @@
|
|||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -691,7 +691,7 @@ UTF8String_c(GSStr self)
|
|||
}
|
||||
NSZoneFree(NSDefaultMallocZone(), u);
|
||||
}
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -1069,7 +1069,7 @@ dataUsingEncoding_c(GSStr self, NSStringEncoding encoding, BOOL flag)
|
|||
}
|
||||
|
||||
if ((encoding == intEnc)
|
||||
|| ((intEnc == NSASCIIStringEncoding)
|
||||
|| ((intEnc == NSASCIIStringEncoding)
|
||||
&& ((encoding == NSISOLatin1StringEncoding)
|
||||
|| (encoding == NSISOLatin2StringEncoding)
|
||||
|| (encoding == NSNEXTSTEPStringEncoding)
|
||||
|
@ -1570,7 +1570,7 @@ lossyCString_c(GSStr self)
|
|||
}
|
||||
NSZoneFree(NSDefaultMallocZone(), u);
|
||||
}
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -1774,7 +1774,7 @@ rangeOfSequence_u(GSStr self, unsigned anIndex)
|
|||
start--;
|
||||
end = start + 1;
|
||||
if (end < self->_count)
|
||||
while ((end < self->_count) && (uni_isnonsp(self->_contents.u[end])) )
|
||||
while ((end < self->_count) && (uni_isnonsp(self->_contents.u[end])))
|
||||
end++;
|
||||
return (NSRange){start, end-start};
|
||||
}
|
||||
|
@ -2054,7 +2054,7 @@ transmute(GSStr self, NSString *aString)
|
|||
* -copyWithZone:, none of its memory management related methods
|
||||
* (initializers and -dealloc) should ever be called. We guard against
|
||||
* this happening.
|
||||
*/
|
||||
*/
|
||||
@implementation GSString
|
||||
|
||||
+ (void) initialize
|
||||
|
@ -2297,7 +2297,7 @@ transmute(GSStr self, NSString *aString)
|
|||
- (int) _baseLength
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Default copy implementation. Retain if we own the buffer and the zones
|
||||
|
@ -2625,7 +2625,7 @@ agree, create a new GSCInlineString otherwise.
|
|||
if (!uni_isnonsp(_contents.u[count++]))
|
||||
blen++;
|
||||
return blen;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Default -copy implementation. Retain if we own the buffer and the zones
|
||||
|
@ -2642,7 +2642,7 @@ agree, create a new GSUnicodeInlineString otherwise.
|
|||
obj = [obj initWithCharacters: _contents.u length: _count];
|
||||
return obj;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
return RETAIN(self);
|
||||
}
|
||||
|
@ -3321,7 +3321,7 @@ agree, create a new GSUnicodeInlineString otherwise.
|
|||
* CString methods to get the characters into our buffer,
|
||||
* or may even be able to copy from another string directly.
|
||||
*
|
||||
* Since getCString appends a '\0' terminator, we must handle
|
||||
* Since getCString appends a '\0' terminator, we must handle
|
||||
* that problem in copying data into our buffer. Either by
|
||||
* saving and restoring the character which would be
|
||||
* overwritten by the nul, or by getting a character less,
|
||||
|
@ -3336,7 +3336,7 @@ agree, create a new GSUnicodeInlineString otherwise.
|
|||
_contents.c[aRange.location + length] = tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
unsigned int l = length - 1;
|
||||
unsigned int size = 1;
|
||||
unichar u;
|
||||
|
@ -3476,7 +3476,7 @@ agree, create a new GSUnicodeInlineString otherwise.
|
|||
else
|
||||
{
|
||||
sub = (NSString*)NSAllocateObject(GSCInlineStringClass,
|
||||
aRange.length,
|
||||
aRange.length,
|
||||
NSDefaultMallocZone());
|
||||
sub = [sub initWithCString: self->_contents.c + aRange.location
|
||||
length: aRange.length];
|
||||
|
@ -3500,7 +3500,7 @@ agree, create a new GSUnicodeInlineString otherwise.
|
|||
}
|
||||
else
|
||||
return _count;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
/** Implementation of network port object based on TCP sockets
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Based on code by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -123,7 +123,7 @@ static gsu32 maxDataLength = 10 * 1024 * 1024;
|
|||
/*
|
||||
* Theory of operation
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
@ -276,7 +276,7 @@ decodePort(NSData *data, NSString *defaultAddress)
|
|||
gsu32 length;
|
||||
NSHost *host;
|
||||
unichar c;
|
||||
|
||||
|
||||
pih = (GSPortItemHeader*)[data bytes];
|
||||
NSCAssert(GSSwapBigI32ToHost(pih->type) == GSP_PORT,
|
||||
NSInternalInconsistencyException);
|
||||
|
@ -286,7 +286,7 @@ decodePort(NSData *data, NSString *defaultAddress)
|
|||
if (strncmp(pi->addr, "VER", 3) == 0)
|
||||
{
|
||||
NSLog(@"Remote version of GNUstep at %s:%d is more recent than this one",
|
||||
pi->addr, pnum);
|
||||
pi->addr, pnum);
|
||||
return nil;
|
||||
}
|
||||
addr = [NSString stringWithCString: pi->addr];
|
||||
|
@ -326,7 +326,7 @@ newDataWithEncodedPort(GSTcpPort *port)
|
|||
unsigned plen;
|
||||
NSString *addr;
|
||||
gsu16 pnum;
|
||||
|
||||
|
||||
pnum = [port portNumber];
|
||||
addr = [port address];
|
||||
if (addr == nil)
|
||||
|
@ -661,7 +661,7 @@ static Class runLoopClass;
|
|||
{
|
||||
M_LOCK(myLock);
|
||||
if (valid == YES)
|
||||
{
|
||||
{
|
||||
NSRunLoop *l;
|
||||
|
||||
valid = NO;
|
||||
|
@ -1480,7 +1480,7 @@ static unsigned wordAlign;
|
|||
* we did the 'bind' call.
|
||||
*/
|
||||
port->listener = desc;
|
||||
port->portNum = GSSwapBigI16ToHost(sockaddr.sin_port);
|
||||
port->portNum = GSSwapBigI16ToHost(sockaddr.sin_port);
|
||||
/*
|
||||
* Make sure we have the map table for this port.
|
||||
*/
|
||||
|
@ -1491,7 +1491,7 @@ static unsigned wordAlign;
|
|||
/*
|
||||
* No known ports with this port number -
|
||||
* create the map table to add the new port to.
|
||||
*/
|
||||
*/
|
||||
thePorts = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
NSMapInsert(tcpPortMap, (void*)(gsaddr)port->portNum,
|
||||
|
@ -1516,7 +1516,7 @@ static unsigned wordAlign;
|
|||
/*
|
||||
* No known ports within this port number -
|
||||
* create the map table to add the new port to.
|
||||
*/
|
||||
*/
|
||||
thePorts = NSCreateMapTable(NSIntMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
NSMapInsert(tcpPortMap, (void*)(gsaddr)number, (void*)thePorts);
|
||||
|
@ -1991,7 +1991,7 @@ static unsigned wordAlign;
|
|||
[header setLength: rl];
|
||||
[components insertObject: header atIndex: 0];
|
||||
RELEASE(header);
|
||||
}
|
||||
}
|
||||
|
||||
header = [components objectAtIndex: 0];
|
||||
/*
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -99,7 +99,7 @@
|
|||
[self setVersion: [super version]];
|
||||
}
|
||||
|
||||
// Allocating and Initializing
|
||||
// Allocating and Initializing
|
||||
|
||||
- (id) initWithBytes: (const void *)value
|
||||
objCType: (const char *)type
|
||||
|
@ -110,7 +110,7 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
// Accessing Data
|
||||
// Accessing Data
|
||||
- (void) getValue: (void *)value
|
||||
{
|
||||
if (!value)
|
||||
|
@ -119,7 +119,7 @@
|
|||
format: @"Cannot copy value into NULL buffer"];
|
||||
/* NOT REACHED */
|
||||
}
|
||||
memcpy( value, &data, objc_sizeof_type([self objCType]) );
|
||||
memcpy(value, &data, objc_sizeof_type([self objCType]));
|
||||
}
|
||||
|
||||
- (BOOL) isEqual: (id)other
|
||||
|
@ -227,7 +227,7 @@
|
|||
typedef __typeof__(data) _dt;
|
||||
return @encode(_dt);
|
||||
}
|
||||
|
||||
|
||||
- (TYPE_NAME)TYPE_METHOD
|
||||
{
|
||||
return data;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -75,12 +75,12 @@ typeSize(const char* type)
|
|||
}
|
||||
}
|
||||
|
||||
// Allocating and Initializing
|
||||
// Allocating and Initializing
|
||||
|
||||
- (id) initWithBytes: (const void *)value
|
||||
objCType: (const char *)type
|
||||
{
|
||||
if (!value || !type)
|
||||
if (!value || !type)
|
||||
{
|
||||
NSLog(@"Tried to create NSValue with NULL value or NULL type");
|
||||
RELEASE(self);
|
||||
|
@ -91,8 +91,8 @@ typeSize(const char* type)
|
|||
if (self != nil)
|
||||
{
|
||||
int size = typeSize(type);
|
||||
|
||||
if (size < 0)
|
||||
|
||||
if (size < 0)
|
||||
{
|
||||
NSLog(@"Tried to create NSValue with invalid Objective-C type");
|
||||
RELEASE(self);
|
||||
|
@ -118,7 +118,7 @@ typeSize(const char* type)
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
// Accessing Data
|
||||
// Accessing Data
|
||||
- (void) getValue: (void *)value
|
||||
{
|
||||
unsigned size;
|
||||
|
@ -170,7 +170,7 @@ typeSize(const char* type)
|
|||
{
|
||||
return objctype;
|
||||
}
|
||||
|
||||
|
||||
- (id) nonretainedObjectValue
|
||||
{
|
||||
unsigned size = (unsigned)typeSize(objctype);
|
||||
|
@ -182,7 +182,7 @@ typeSize(const char* type)
|
|||
}
|
||||
return *((id *)data);
|
||||
}
|
||||
|
||||
|
||||
- (NSPoint) pointValue
|
||||
{
|
||||
unsigned size = (unsigned)typeSize(objctype);
|
||||
|
@ -218,7 +218,7 @@ typeSize(const char* type)
|
|||
}
|
||||
return *((NSRect *)data);
|
||||
}
|
||||
|
||||
|
||||
- (NSSize) sizeValue
|
||||
{
|
||||
unsigned size = (unsigned)typeSize(objctype);
|
||||
|
@ -230,7 +230,7 @@ typeSize(const char* type)
|
|||
}
|
||||
return *((NSSize *)data);
|
||||
}
|
||||
|
||||
|
||||
- (NSString *) description
|
||||
{
|
||||
unsigned size;
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/** Implementation of NSArchiver for GNUstep
|
||||
Copyright (C) 1998,1999 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Created: October 1998
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -62,7 +62,7 @@ NSString * const NSInconsistentArchiveException =
|
|||
* methods for saving to and restoring from a serial archive (usually a file
|
||||
* on disk, but can be an [NSData] object) as well as methods that can be
|
||||
* used by objects that need to write/restore themselves.</p>
|
||||
*
|
||||
*
|
||||
* <p>Note, the sibling class [NSKeyedArchiver] supports a form of archive
|
||||
* that is more robust to class changes, and is recommended over this one.</p>
|
||||
*/
|
||||
|
@ -424,7 +424,7 @@ static Class NSMutableDataMallocClass;
|
|||
BOOL done = NO;
|
||||
|
||||
node = GSIMapNodeForKey(_clsMap, (GSIMapKey)(void*)c);
|
||||
|
||||
|
||||
if (node != 0)
|
||||
{
|
||||
(*_xRefImp)(_dst, xRefSel, _GSC_CLASS | _GSC_XREF,
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
/** NSArray - Array object to hold other objects.
|
||||
Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
From skeleton by: Adam Fedor <fedor@boulder.colorado.edu>
|
||||
Created: March 1995
|
||||
|
||||
|
||||
Rewrite by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
January 1998 - new methods and changes as documented for Rhapsody plus
|
||||
January 1998 - new methods and changes as documented for Rhapsody plus
|
||||
changes of array indices to type unsigned, plus major efficiency hacks.
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -242,7 +242,7 @@ static SEL rlSel;
|
|||
id a = [self allocWithZone: NSDefaultMallocZone()];
|
||||
|
||||
GS_USEIDLIST(firstObject,
|
||||
a = [a initWithObjects: __objects count: __count]);
|
||||
a = [a initWithObjects: __objects count: __count]);
|
||||
return AUTORELEASE(a);
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ static SEL rlSel;
|
|||
{
|
||||
id na;
|
||||
unsigned c = [self count];
|
||||
|
||||
|
||||
if (anObject == nil)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Attempt to add nil to an array"];
|
||||
|
@ -612,7 +612,7 @@ static SEL rlSel;
|
|||
{
|
||||
id array;
|
||||
|
||||
array = [(NSKeyedUnarchiver*)aCoder _decodeArrayOfObjectsForKey:
|
||||
array = [(NSKeyedUnarchiver*)aCoder _decodeArrayOfObjectsForKey:
|
||||
@"NS.objects"];
|
||||
if (array == nil)
|
||||
{
|
||||
|
@ -677,7 +677,7 @@ static SEL rlSel;
|
|||
* will be released, the method will return nil, and a warning may be logged.
|
||||
* </p>
|
||||
* <p>Works by invoking [NSString-initWithContentsOfFile:] and
|
||||
* [NSString-propertyList] then checking that the result is an array.
|
||||
* [NSString-propertyList] then checking that the result is an array.
|
||||
* </p>
|
||||
*/
|
||||
- (id) initWithContentsOfFile: (NSString*)file
|
||||
|
@ -729,7 +729,7 @@ static SEL rlSel;
|
|||
* will be released, the method will return nil, and a warning may be logged.
|
||||
* </p>
|
||||
* <p>Works by invoking [NSString-initWithContentsOfURL:] and
|
||||
* [NSString-propertyList] then checking that the result is an array.
|
||||
* [NSString-propertyList] then checking that the result is an array.
|
||||
* </p>
|
||||
*/
|
||||
- (id) initWithContentsOfURL: (NSURL*)aURL
|
||||
|
@ -789,7 +789,7 @@ static SEL rlSel;
|
|||
- (id) initWithObjects: firstObject, ...
|
||||
{
|
||||
GS_USEIDLIST(firstObject,
|
||||
self = [self initWithObjects: __objects count: __count]);
|
||||
self = [self initWithObjects: __objects count: __count]);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -832,7 +832,7 @@ static SEL rlSel;
|
|||
- (BOOL) isEqualToArray: (NSArray*)otherArray
|
||||
{
|
||||
unsigned i, c;
|
||||
|
||||
|
||||
if (self == (id)otherArray)
|
||||
return YES;
|
||||
c = [self count];
|
||||
|
@ -955,7 +955,7 @@ compare(id elem1, id elem2, void* context)
|
|||
* according to a sort with comparator. This invokes
|
||||
* -sortedArrayUsingFunction:context:hint: with a nil hint.
|
||||
*/
|
||||
- (NSArray*) sortedArrayUsingFunction: (NSComparisonResult(*)(id,id,void*))comparator
|
||||
- (NSArray*) sortedArrayUsingFunction: (NSComparisonResult(*)(id,id,void*))comparator
|
||||
context: (void*)context
|
||||
{
|
||||
return [self sortedArrayUsingFunction: comparator context: context hint: nil];
|
||||
|
@ -976,7 +976,7 @@ compare(id elem1, id elem2, void* context)
|
|||
* is passed two objects to compare, and the context as the third
|
||||
* argument. The hint argument is currently ignored, and may be nil.
|
||||
*/
|
||||
- (NSArray*) sortedArrayUsingFunction: (NSComparisonResult(*)(id,id,void*))comparator
|
||||
- (NSArray*) sortedArrayUsingFunction: (NSComparisonResult(*)(id,id,void*))comparator
|
||||
context: (void*)context
|
||||
hint: (NSData*)hint
|
||||
{
|
||||
|
@ -997,7 +997,7 @@ compare(id elem1, id elem2, void* context)
|
|||
{
|
||||
unsigned int c = [self count];
|
||||
NSMutableString *s = [[NSMutableString alloc] initWithCapacity: c];
|
||||
|
||||
|
||||
if (c > 0)
|
||||
{
|
||||
unsigned l = [separator length];
|
||||
|
@ -1091,9 +1091,9 @@ compare(id elem1, id elem2, void* context)
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an enumerator describing the array sequentially
|
||||
* Returns an enumerator describing the array sequentially
|
||||
* from the first to the last element.<br/>
|
||||
* If you use a mutable subclass of NSArray,
|
||||
* If you use a mutable subclass of NSArray,
|
||||
* you should not modify the array during enumeration.
|
||||
*/
|
||||
- (NSEnumerator*) objectEnumerator
|
||||
|
@ -1106,9 +1106,9 @@ compare(id elem1, id elem2, void* context)
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an enumerator describing the array sequentially
|
||||
* Returns an enumerator describing the array sequentially
|
||||
* from the last to the first element.<br/>
|
||||
* If you use a mutable subclass of NSArray,
|
||||
* If you use a mutable subclass of NSArray,
|
||||
* you should not modify the array during enumeration.
|
||||
*/
|
||||
- (NSEnumerator*) reverseObjectEnumerator
|
||||
|
@ -1229,8 +1229,8 @@ compare(id elem1, id elem2, void* context)
|
|||
|
||||
/**
|
||||
* This overrides NSObjects implementation of this method.
|
||||
* This method returns an array of objects returned by
|
||||
* invoking -valueForKey: for each item in the receiver,
|
||||
* This method returns an array of objects returned by
|
||||
* invoking -valueForKey: for each item in the receiver,
|
||||
* substituting NSNull for nil.
|
||||
* A special case: the key "count" is not forwarded to each object
|
||||
* of the receiver but returns the number of objects of the receiver.<br/>
|
||||
|
@ -1250,13 +1250,13 @@ compare(id elem1, id elem2, void* context)
|
|||
unsigned i;
|
||||
unsigned count = [self count];
|
||||
volatile id object = nil;
|
||||
|
||||
|
||||
results = [NSMutableArray array];
|
||||
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
id result;
|
||||
|
||||
|
||||
object = [self objectAtIndex: i];
|
||||
result = [object valueForKey: key];
|
||||
if (result == nil)
|
||||
|
@ -1267,10 +1267,10 @@ compare(id elem1, id elem2, void* context)
|
|||
}
|
||||
result = null;
|
||||
}
|
||||
|
||||
|
||||
[results addObject: result];
|
||||
}
|
||||
|
||||
|
||||
result = results;
|
||||
}
|
||||
return result;
|
||||
|
@ -1343,7 +1343,7 @@ compare(id elem1, id elem2, void* context)
|
|||
* Swaps the positions of two objects in the array. Raises an exception
|
||||
* if either array index is out of bounds.
|
||||
*/
|
||||
- (void) exchangeObjectAtIndex: (unsigned int)i1
|
||||
- (void) exchangeObjectAtIndex: (unsigned int)i1
|
||||
withObjectAtIndex: (unsigned int)i2
|
||||
{
|
||||
id tmp = [self objectAtIndex: i1];
|
||||
|
@ -1689,10 +1689,10 @@ compare(id elem1, id elem2, void* context)
|
|||
/**
|
||||
* Supplied with a C array of indices containing count values, this method
|
||||
* removes all corresponding objects from the receiver. The objects are
|
||||
* removed in such a way that the removal is <em>safe</em> irrespective
|
||||
* removed in such a way that the removal is <em>safe</em> irrespective
|
||||
* of the order in which they are specified in the indices array.
|
||||
*/
|
||||
- (void) removeObjectsFromIndices: (unsigned*)indices
|
||||
- (void) removeObjectsFromIndices: (unsigned*)indices
|
||||
numIndices: (unsigned)count
|
||||
{
|
||||
if (count > 0)
|
||||
|
@ -1801,7 +1801,7 @@ compare(id elem1, id elem2, void* context)
|
|||
* Sorts the array according to the supplied compare function
|
||||
* with the context information.
|
||||
*/
|
||||
- (void) sortUsingFunction: (NSComparisonResult (*)(id,id,void*))compare
|
||||
- (void) sortUsingFunction: (NSComparisonResult (*)(id,id,void*))compare
|
||||
context: (void*)context
|
||||
{
|
||||
/* Shell sort algorithm taken from SortingInAction - a NeXT example */
|
||||
|
@ -1820,7 +1820,7 @@ compare(id elem1, id elem2, void* context)
|
|||
{
|
||||
stride = stride * STRIDE_FACTOR + 1;
|
||||
}
|
||||
|
||||
|
||||
while (stride > (STRIDE_FACTOR - 1))
|
||||
{
|
||||
// loop to sort for each value of stride
|
||||
|
@ -1880,7 +1880,7 @@ compare(id elem1, id elem2, void* context)
|
|||
}
|
||||
|
||||
/**
|
||||
* Call setValue:forKey: on each of the receiver's items
|
||||
* Call setValue:forKey: on each of the receiver's items
|
||||
* with the value and key.
|
||||
*/
|
||||
- (void) setValue: (id)value forKey: (NSString*)key
|
||||
|
@ -1888,7 +1888,7 @@ compare(id elem1, id elem2, void* context)
|
|||
unsigned i;
|
||||
unsigned count = [self count];
|
||||
volatile id object = nil;
|
||||
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
object = [self objectAtIndex: i];
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/** NSAssertionHandler - Object encapsulation of assertions
|
||||
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Adam Fedor <fedor@boulder.colorado.edu>
|
||||
Date: Apr 1995
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -86,9 +86,9 @@ static NSString *dict_key = @"NSAssertionHandler";
|
|||
* message built from the supplied arguments, and then raising an
|
||||
* NSInternalInconsistencyException
|
||||
*/
|
||||
- (void) handleFailureInFunction: (NSString*)functionName
|
||||
file: (NSString*)fileName
|
||||
lineNumber: (int)line
|
||||
- (void) handleFailureInFunction: (NSString*)functionName
|
||||
file: (NSString*)fileName
|
||||
lineNumber: (int)line
|
||||
description: (NSString*)format,...
|
||||
{
|
||||
id message;
|
||||
|
@ -125,12 +125,12 @@ static NSString *dict_key = @"NSAssertionHandler";
|
|||
message =
|
||||
[NSString
|
||||
stringWithFormat: @"%@:%d Assertion failed in %@(%@), method %@. %@",
|
||||
fileName, line, NSStringFromClass([object class]),
|
||||
fileName, line, NSStringFromClass([object class]),
|
||||
[object isInstance] ? @"instance" : @"class",
|
||||
NSStringFromSelector(aSelector), format];
|
||||
NSLogv(message, ap);
|
||||
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: message arguments: ap];
|
||||
va_end(ap);
|
||||
/* NOT REACHED */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/**
|
||||
NSAttributedString.m
|
||||
|
||||
Implementation of string class with attributes
|
||||
|
@ -9,14 +9,14 @@
|
|||
Date: November 1997
|
||||
Rewrite by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Date: April 1999
|
||||
|
||||
|
||||
This file is part of GNUstep-base
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
If you are interested in a warranty or support for this source code,
|
||||
contact Scott Christley <scottc@net-community.com> for more information.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -90,7 +90,7 @@ static IMP remDictImp;
|
|||
* be associated to ranges of characters. Used for text rendering by the
|
||||
* GUI/AppKit framework, in which fonts, sizes, etc. are stored under standard
|
||||
* attributes in the dictionaries.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@implementation NSAttributedString
|
||||
|
||||
|
@ -167,10 +167,10 @@ static Class GSMutableAttributedStringClass;
|
|||
{
|
||||
NSString *string = [aDecoder decodeObjectForKey: @"NSString"];
|
||||
NSDictionary *attributes = [aDecoder decodeObjectForKey: @"NSAttributes"];
|
||||
|
||||
|
||||
self = [self initWithString: string attributes: attributes];
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
NSString *string = [aDecoder decodeObject];
|
||||
unsigned length = [string length];
|
||||
|
@ -183,7 +183,7 @@ static Class GSMutableAttributedStringClass;
|
|||
{
|
||||
unsigned index;
|
||||
NSDictionary *attrs;
|
||||
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &index];
|
||||
attrs = [aDecoder decodeObject];
|
||||
if (index == length)
|
||||
|
@ -195,7 +195,7 @@ static Class GSMutableAttributedStringClass;
|
|||
NSRange r = NSMakeRange(0, index);
|
||||
unsigned last = index;
|
||||
NSMutableAttributedString *m;
|
||||
|
||||
|
||||
m = [NSMutableAttributedString alloc];
|
||||
m = [m initWithString: string attributes: nil];
|
||||
[m setAttributes: attrs range: r];
|
||||
|
@ -349,7 +349,7 @@ static Class GSMutableAttributedStringClass;
|
|||
attrDictionary = (*getImp)(self, getSel, index, aRange);
|
||||
if (aRange == 0)
|
||||
return attrDictionary;
|
||||
|
||||
|
||||
while (aRange->location > rangeLimit.location)
|
||||
{
|
||||
//Check extend range backwards
|
||||
|
@ -407,7 +407,7 @@ static Class GSMutableAttributedStringClass;
|
|||
}
|
||||
return nil;
|
||||
}
|
||||
attrValue = [tmpDictionary objectForKey: attributeName];
|
||||
attrValue = [tmpDictionary objectForKey: attributeName];
|
||||
return attrValue;
|
||||
}
|
||||
|
||||
|
@ -436,7 +436,7 @@ static Class GSMutableAttributedStringClass;
|
|||
|
||||
if (attributeName == nil)
|
||||
return nil;
|
||||
|
||||
|
||||
attrValue = [self attribute: attributeName
|
||||
atIndex: index
|
||||
effectiveRange: aRange];
|
||||
|
@ -449,7 +449,7 @@ static Class GSMutableAttributedStringClass;
|
|||
*/
|
||||
eImp = (BOOL(*)(id,SEL,id))[attrValue methodForSelector: eqSel];
|
||||
getImp = [self methodForSelector: getSel];
|
||||
|
||||
|
||||
while (aRange->location > rangeLimit.location)
|
||||
{
|
||||
//Check extend range backwards
|
||||
|
@ -501,7 +501,7 @@ static Class GSMutableAttributedStringClass;
|
|||
return NO;
|
||||
if (![[otherString string] isEqual: [self string]])
|
||||
return NO;
|
||||
|
||||
|
||||
length = [otherString length];
|
||||
if (length<=0)
|
||||
return YES;
|
||||
|
@ -511,7 +511,7 @@ static Class GSMutableAttributedStringClass;
|
|||
otherDictionary = [otherString attributesAtIndex: 0
|
||||
effectiveRange: &otherEffectiveRange];
|
||||
result = YES;
|
||||
|
||||
|
||||
while (YES)
|
||||
{
|
||||
if (NSIntersectionRange(ownEffectiveRange, otherEffectiveRange).length > 0
|
||||
|
@ -562,7 +562,7 @@ static Class GSMutableAttributedStringClass;
|
|||
unsigned len = [self length];
|
||||
|
||||
GS_RANGE_CHECK(aRange, len);
|
||||
|
||||
|
||||
newSubstring = [[self string] substringWithRange: aRange];
|
||||
|
||||
attrs = [self attributesAtIndex: aRange.location effectiveRange: &range];
|
||||
|
@ -707,7 +707,7 @@ static Class GSMutableAttributedStringClass;
|
|||
|
||||
tmpLength = [self length];
|
||||
GS_RANGE_CHECK(aRange, tmpLength);
|
||||
|
||||
|
||||
getImp = [self methodForSelector: getSel];
|
||||
attrDict = (*getImp)(self, getSel, aRange.location, &effectiveRange);
|
||||
|
||||
|
@ -721,14 +721,14 @@ static Class GSMutableAttributedStringClass;
|
|||
while (effectiveRange.location < NSMaxRange(aRange))
|
||||
{
|
||||
effectiveRange = NSIntersectionRange(aRange, effectiveRange);
|
||||
|
||||
|
||||
newDict = (*allocDictImp)(dictionaryClass, allocDictSel,
|
||||
NSDefaultMallocZone());
|
||||
newDict = (*initDictImp)(newDict, initDictSel, attrDict);
|
||||
(*setDictImp)(newDict, setDictSel, value, name);
|
||||
(*setImp)(self, setSel, newDict, effectiveRange);
|
||||
IF_NO_GC((*relDictImp)(newDict, relDictSel));
|
||||
|
||||
|
||||
if (NSMaxRange(effectiveRange) >= NSMaxRange(aRange))
|
||||
{
|
||||
effectiveRange.location = NSMaxRange(aRange);// stop the loop...
|
||||
|
@ -753,7 +753,7 @@ static Class GSMutableAttributedStringClass;
|
|||
NSMutableDictionary *newDict;
|
||||
unsigned int tmpLength;
|
||||
IMP getImp;
|
||||
|
||||
|
||||
if (!attributes)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
|
@ -767,7 +767,7 @@ static Class GSMutableAttributedStringClass;
|
|||
format: @"RangeError in method -addAttribute:value:range: "
|
||||
@"in class NSMutableAttributedString"];
|
||||
}
|
||||
|
||||
|
||||
getImp = [self methodForSelector: getSel];
|
||||
attrDict = (*getImp)(self, getSel, aRange.location, &effectiveRange);
|
||||
|
||||
|
@ -781,14 +781,14 @@ static Class GSMutableAttributedStringClass;
|
|||
while (effectiveRange.location < NSMaxRange(aRange))
|
||||
{
|
||||
effectiveRange = NSIntersectionRange(aRange,effectiveRange);
|
||||
|
||||
|
||||
newDict = (*allocDictImp)(dictionaryClass, allocDictSel,
|
||||
NSDefaultMallocZone());
|
||||
newDict = (*initDictImp)(newDict, initDictSel, attrDict);
|
||||
(*addDictImp)(newDict, addDictSel, attributes);
|
||||
(*setImp)(self, setSel, newDict, effectiveRange);
|
||||
IF_NO_GC((*relDictImp)(newDict, relDictSel));
|
||||
|
||||
|
||||
if (NSMaxRange(effectiveRange) >= NSMaxRange(aRange))
|
||||
{
|
||||
effectiveRange.location = NSMaxRange(aRange);// stop the loop...
|
||||
|
@ -813,10 +813,10 @@ static Class GSMutableAttributedStringClass;
|
|||
NSMutableDictionary *newDict;
|
||||
unsigned int tmpLength;
|
||||
IMP getImp;
|
||||
|
||||
|
||||
tmpLength = [self length];
|
||||
GS_RANGE_CHECK(aRange, tmpLength);
|
||||
|
||||
|
||||
getImp = [self methodForSelector: getSel];
|
||||
attrDict = (*getImp)(self, getSel, aRange.location, &effectiveRange);
|
||||
|
||||
|
@ -830,14 +830,14 @@ static Class GSMutableAttributedStringClass;
|
|||
while (effectiveRange.location < NSMaxRange(aRange))
|
||||
{
|
||||
effectiveRange = NSIntersectionRange(aRange,effectiveRange);
|
||||
|
||||
|
||||
newDict = (*allocDictImp)(dictionaryClass, allocDictSel,
|
||||
NSDefaultMallocZone());
|
||||
newDict = (*initDictImp)(newDict, initDictSel, attrDict);
|
||||
(*remDictImp)(newDict, remDictSel, name);
|
||||
(*setImp)(self, setSel, newDict, effectiveRange);
|
||||
IF_NO_GC((*relDictImp)(newDict, relDictSel));
|
||||
|
||||
|
||||
if (NSMaxRange(effectiveRange) >= NSMaxRange(aRange))
|
||||
{
|
||||
effectiveRange.location = NSMaxRange(aRange);// stop the loop...
|
||||
|
@ -881,7 +881,7 @@ static Class GSMutableAttributedStringClass;
|
|||
NSDictionary *attrDict;
|
||||
NSString *tmpStr;
|
||||
unsigned max;
|
||||
|
||||
|
||||
if (attributedString == nil)
|
||||
{
|
||||
[self replaceCharactersInRange: aRange withString: nil];
|
||||
|
@ -1025,7 +1025,7 @@ static Class GSMutableAttributedStringClass;
|
|||
- (int) _baseLength
|
||||
{
|
||||
return [[_owner string] _baseLength];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
|
@ -1040,7 +1040,7 @@ static Class GSMutableAttributedStringClass;
|
|||
- (void) replaceCharactersInRange: (NSRange)aRange
|
||||
withString: (NSString*)aString
|
||||
{
|
||||
[_owner replaceCharactersInRange: aRange withString: aString];
|
||||
[_owner replaceCharactersInRange: aRange withString: aString];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
/** Implementation of auto release pool for delayed disposal
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: January 1995
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSAutoreleasePool class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -58,7 +58,7 @@ static unsigned pool_count_warning_threshhold = UINT_MAX;
|
|||
|
||||
|
||||
/* Functions for managing a per-thread cache of NSAutoreleasedPool's
|
||||
already alloc'ed. The cache is kept in the autorelease_thread_var
|
||||
already alloc'ed. The cache is kept in the autorelease_thread_var
|
||||
structure, which is an ivar of NSThread. */
|
||||
|
||||
static id pop_pool_from_cache (struct autorelease_thread_vars *tv);
|
||||
|
@ -290,7 +290,7 @@ static IMP initImp;
|
|||
/* We are at the end of the chain, and need to allocate a new one. */
|
||||
struct autorelease_array_list *new_released;
|
||||
unsigned new_size = _released->size * 2;
|
||||
|
||||
|
||||
new_released = (struct autorelease_array_list*)
|
||||
NSZoneMalloc(NSDefaultMallocZone(),
|
||||
sizeof(struct autorelease_array_list) + (new_size * sizeof(id)));
|
||||
|
@ -401,7 +401,7 @@ static IMP initImp;
|
|||
- (void) _reallyDealloc
|
||||
{
|
||||
struct autorelease_array_list *a;
|
||||
for (a = _released_head; a; )
|
||||
for (a = _released_head; a;)
|
||||
{
|
||||
void *n = a->next;
|
||||
NSZoneFree(NSDefaultMallocZone(), a);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
|
|
@ -80,7 +80,7 @@ static NSDictionary *_emptyTable = nil;
|
|||
/* When we are linking in an object file, objc_load_modules calls our
|
||||
callback routine for every Class and Category loaded. The following
|
||||
variable stores the bundle that is currently doing the loading so we know
|
||||
where to store the class names.
|
||||
where to store the class names.
|
||||
*/
|
||||
static NSBundle *_loadingBundle = nil;
|
||||
static NSBundle *_gnustep_bundle = nil;
|
||||
|
@ -91,25 +91,25 @@ static BOOL _strip_after_loading = NO;
|
|||
static NSMutableArray *_loadingFrameworks = nil;
|
||||
static NSString *_currentFrameworkName = nil;
|
||||
|
||||
static NSString *gnustep_target_dir =
|
||||
static NSString *gnustep_target_dir =
|
||||
#ifdef GNUSTEP_TARGET_DIR
|
||||
@GNUSTEP_TARGET_DIR;
|
||||
#else
|
||||
nil;
|
||||
#endif
|
||||
static NSString *gnustep_target_cpu =
|
||||
static NSString *gnustep_target_cpu =
|
||||
#ifdef GNUSTEP_TARGET_CPU
|
||||
@GNUSTEP_TARGET_CPU;
|
||||
#else
|
||||
nil;
|
||||
#endif
|
||||
static NSString *gnustep_target_os =
|
||||
static NSString *gnustep_target_os =
|
||||
#ifdef GNUSTEP_TARGET_OS
|
||||
@GNUSTEP_TARGET_OS;
|
||||
#else
|
||||
nil;
|
||||
#endif
|
||||
static NSString *library_combo =
|
||||
static NSString *library_combo =
|
||||
#ifdef LIBRARY_COMBO
|
||||
@LIBRARY_COMBO;
|
||||
#else
|
||||
|
@ -121,7 +121,7 @@ static NSString *library_combo =
|
|||
const char *
|
||||
objc_executable_location (void)
|
||||
{
|
||||
return [[_executable_path stringByDeletingLastPathComponent]
|
||||
return [[_executable_path stringByDeletingLastPathComponent]
|
||||
fileSystemRepresentation];
|
||||
}
|
||||
|
||||
|
@ -187,13 +187,13 @@ bundle_object_name(NSString *path, NSString* executable)
|
|||
}
|
||||
|
||||
/* Construct a path from components */
|
||||
static NSString *
|
||||
static NSString *
|
||||
_bundle_resource_path(NSString *primary, NSString* bundlePath, NSString *lang)
|
||||
{
|
||||
if (bundlePath)
|
||||
primary = [primary stringByAppendingPathComponent: bundlePath];
|
||||
if (lang)
|
||||
primary = [primary stringByAppendingPathComponent:
|
||||
primary = [primary stringByAppendingPathComponent:
|
||||
[NSString stringWithFormat: @"%@.lproj", lang]];
|
||||
return primary;
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ _bundle_name_first_match(NSString* directory, NSString* name)
|
|||
NSString *cleanname;
|
||||
|
||||
/* name might have a directory in it also, so account for this */
|
||||
path = [[directory stringByAppendingPathComponent: name]
|
||||
path = [[directory stringByAppendingPathComponent: name]
|
||||
stringByDeletingLastPathComponent];
|
||||
cleanname = [[name lastPathComponent] stringByDeletingPathExtension];
|
||||
filelist = [[mgr directoryContentsAtPath: path] objectEnumerator];
|
||||
|
@ -316,7 +316,7 @@ _bundle_name_first_match(NSString* directory, NSString* name)
|
|||
*/
|
||||
bundlePath = nil;
|
||||
}
|
||||
|
||||
|
||||
if (bundlePath != nil)
|
||||
{
|
||||
NSString *pathComponent;
|
||||
|
@ -365,8 +365,8 @@ _bundle_name_first_match(NSString* directory, NSString* name)
|
|||
{
|
||||
bundlePath = [bundlePath stringByDeletingLastPathComponent];
|
||||
pathComponent = [bundlePath lastPathComponent];
|
||||
|
||||
if ([pathComponent isEqualToString:
|
||||
|
||||
if ([pathComponent isEqualToString:
|
||||
[NSString stringWithFormat: @"%@%@",
|
||||
name, @".framework"]])
|
||||
{
|
||||
|
@ -374,7 +374,7 @@ _bundle_name_first_match(NSString* directory, NSString* name)
|
|||
bundle = [[self alloc] initWithPath: bundlePath];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Failed - buu - try the fallback trick. */
|
||||
if (bundle == nil)
|
||||
{
|
||||
|
@ -394,7 +394,7 @@ _bundle_name_first_match(NSString* directory, NSString* name)
|
|||
* ... :-)
|
||||
*/
|
||||
NSString *varEnv, *path;
|
||||
|
||||
|
||||
/* varEnv is something like GNUSTEP_LOCAL_ROOT. */
|
||||
varEnv = [frameworkClass frameworkEnv];
|
||||
if (varEnv != nil && [varEnv length] > 0)
|
||||
|
@ -404,14 +404,14 @@ _bundle_name_first_match(NSString* directory, NSString* name)
|
|||
bundlePath = [[[NSProcessInfo processInfo] environment]
|
||||
objectForKey: varEnv];
|
||||
}
|
||||
|
||||
|
||||
/* FIXME - path is something like ?. */
|
||||
path = [frameworkClass frameworkPath];
|
||||
if (path && [path length])
|
||||
{
|
||||
if (bundlePath)
|
||||
{
|
||||
bundlePath = [bundlePath stringByAppendingPathComponent:
|
||||
bundlePath = [bundlePath stringByAppendingPathComponent:
|
||||
path];
|
||||
}
|
||||
else
|
||||
|
@ -421,19 +421,19 @@ _bundle_name_first_match(NSString* directory, NSString* name)
|
|||
}
|
||||
else
|
||||
{
|
||||
bundlePath = [bundlePath stringByAppendingPathComponent:
|
||||
bundlePath = [bundlePath stringByAppendingPathComponent:
|
||||
@"Library/Frameworks"];
|
||||
}
|
||||
|
||||
|
||||
bundlePath = [bundlePath stringByAppendingPathComponent:
|
||||
[NSString stringWithFormat:
|
||||
@"%@.framework",
|
||||
[NSString stringWithFormat:
|
||||
@"%@.framework",
|
||||
name]];
|
||||
|
||||
/* Try creating the bundle. */
|
||||
bundle = [[self alloc] initWithPath: bundlePath];
|
||||
}
|
||||
|
||||
|
||||
if (bundle == nil)
|
||||
{
|
||||
/* TODO: We couldn't locate the framework in the expected
|
||||
|
@ -443,13 +443,13 @@ _bundle_name_first_match(NSString* directory, NSString* name)
|
|||
NSLog (@"Problem locating framework %@", name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bundle->_bundleType = NSBUNDLE_FRAMEWORK;
|
||||
bundle->_codeLoaded = YES;
|
||||
/* frameworkVersion is something like 'A'. */
|
||||
bundle->_frameworkVersion = RETAIN([frameworkClass frameworkVersion]);
|
||||
bundle->_bundleClasses = RETAIN([NSMutableArray arrayWithCapacity: 2]);
|
||||
|
||||
|
||||
/* A NULL terminated list of class names - the classes contained
|
||||
in the framework. */
|
||||
fmClasses = [frameworkClass frameworkClasses];
|
||||
|
@ -460,9 +460,9 @@ _bundle_name_first_match(NSString* directory, NSString* name)
|
|||
Class class = NSClassFromString(*fmClasses);
|
||||
|
||||
value = [NSValue valueWithNonretainedObject: class];
|
||||
|
||||
|
||||
[(NSMutableArray *)[bundle _bundleClasses] addObject: value];
|
||||
|
||||
|
||||
fmClasses++;
|
||||
}
|
||||
|
||||
|
@ -513,7 +513,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
|
||||
/* Don't store the internal NSFramework_xxx class into the list of
|
||||
bundle classes, but store the linked frameworks in _loadingFrameworks */
|
||||
if (strlen (theClass->name) > 12 && !strncmp ("NSFramework_",
|
||||
if (strlen (theClass->name) > 12 && !strncmp ("NSFramework_",
|
||||
theClass->name, 12))
|
||||
{
|
||||
if (_currentFrameworkName)
|
||||
|
@ -528,7 +528,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
|
||||
[_loadingFrameworks
|
||||
addObject: [NSValue valueWithNonretainedObject: (id)theClass]];
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Store classes (but don't store categories) */
|
||||
|
@ -610,7 +610,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
tmp = [_executable_path UTF8String];
|
||||
_executable_path = [[NSFileManager defaultManager]
|
||||
stringWithFileSystemRepresentation: tmp length: strlen(tmp)];
|
||||
_executable_path =
|
||||
_executable_path =
|
||||
[self _absolutePathOfExecutable: _executable_path];
|
||||
NSAssert(_executable_path, NSInternalInconsistencyException);
|
||||
}
|
||||
|
@ -695,7 +695,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
NSMutableArray *array = [NSMutableArray arrayWithCapacity: 2];
|
||||
|
||||
[load_lock lock];
|
||||
if (!_mainBundle)
|
||||
if (!_mainBundle)
|
||||
{
|
||||
[self mainBundle];
|
||||
}
|
||||
|
@ -752,20 +752,20 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
* For an application, returns the main bundle of the application.<br />
|
||||
* For a tool, returns the main bundle associated with the tool.<br />
|
||||
* <br />
|
||||
* For an application, the structure is as follows -
|
||||
* <p>
|
||||
* For an application, the structure is as follows -
|
||||
* <p>
|
||||
* The executable is Gomoku.app/ix86/linux-gnu/gnu-gnu-gnu/Gomoku
|
||||
* and the main bundle directory is Gomoku.app/.
|
||||
* </p>
|
||||
* For a tool, the structure is as follows -
|
||||
* </p>
|
||||
* For a tool, the structure is as follows -
|
||||
* <p>
|
||||
* The executable is xxx/Tools/ix86/linux-gnu/gnu-gnu-gnu/Control
|
||||
* and the main bundle directory is xxx/Tools/Resources/Control.
|
||||
* </p>
|
||||
* <p>(when the tool has not yet been installed, it's similar -
|
||||
* </p>
|
||||
* <p>(when the tool has not yet been installed, it's similar -
|
||||
* xxx/shared_obj/ix86/linux-gnu/gnu-gnu-gnu/Control
|
||||
* and the main bundle directory is xxx/Resources/Control).
|
||||
* </p>
|
||||
* </p>
|
||||
* <p>(For a flattened structure, the structure is the same without the
|
||||
* ix86/linux-gnu/gnu-gnu-gnu directories).
|
||||
* </p>
|
||||
|
@ -773,7 +773,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
+ (NSBundle *) mainBundle
|
||||
{
|
||||
[load_lock lock];
|
||||
if (!_mainBundle)
|
||||
if (!_mainBundle)
|
||||
{
|
||||
/* We figure out the main bundle directory by examining the location
|
||||
of the executable on disk. */
|
||||
|
@ -790,7 +790,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
#if defined(__WIN32__)
|
||||
toolName = [toolName stringByDeletingPathExtension];
|
||||
#endif
|
||||
|
||||
|
||||
/* Strip off the name of the program */
|
||||
path = [_executable_path stringByDeletingLastPathComponent];
|
||||
|
||||
|
@ -829,7 +829,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
if (isApplication == YES)
|
||||
{
|
||||
s = [path lastPathComponent];
|
||||
|
||||
|
||||
if ((([s hasSuffix: @".app"] == NO)
|
||||
&& ([s hasSuffix: @".debug"] == NO)
|
||||
&& ([s hasSuffix: @".profile"] == NO))
|
||||
|
@ -840,7 +840,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
isApplication = NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isApplication == NO)
|
||||
{
|
||||
path = [path stringByAppendingPathComponent: @"Resources"];
|
||||
|
@ -856,7 +856,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
_mainBundle = [_mainBundle initWithPath: path];
|
||||
NSAssert(_mainBundle != nil, NSInternalInconsistencyException);
|
||||
}
|
||||
|
||||
|
||||
[load_lock unlock];
|
||||
return _mainBundle;
|
||||
}
|
||||
|
@ -896,7 +896,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
bundle = nil;
|
||||
}
|
||||
[load_lock unlock];
|
||||
if (!bundle)
|
||||
if (!bundle)
|
||||
{
|
||||
/* Is it in the main bundle? */
|
||||
if (class_is_class(aClass))
|
||||
|
@ -915,7 +915,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
{
|
||||
self = [super init];
|
||||
|
||||
if (!path || [path length] == 0)
|
||||
if (!path || [path length] == 0)
|
||||
{
|
||||
NSLog(@"No path specified for bundle");
|
||||
[self dealloc];
|
||||
|
@ -1006,9 +1006,9 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
int i, j;
|
||||
Class theClass = Nil;
|
||||
|
||||
if (!_codeLoaded)
|
||||
if (!_codeLoaded)
|
||||
{
|
||||
if (self != _mainBundle && ![self load])
|
||||
if (self != _mainBundle && ![self load])
|
||||
{
|
||||
NSLog(@"No classes in bundle");
|
||||
return Nil;
|
||||
|
@ -1020,8 +1020,8 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
theClass = NSClassFromString(className);
|
||||
if (theClass && [[self class] bundleForClass:theClass] != _mainBundle)
|
||||
theClass = Nil;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL found = NO;
|
||||
|
||||
|
@ -1032,7 +1032,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
{
|
||||
Class c = [[_bundleClasses objectAtIndex: i] nonretainedObjectValue];
|
||||
|
||||
if (c == theClass)
|
||||
if (c == theClass)
|
||||
{
|
||||
found = YES;
|
||||
}
|
||||
|
@ -1043,7 +1043,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
theClass = Nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return theClass;
|
||||
}
|
||||
|
||||
|
@ -1057,8 +1057,8 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
}
|
||||
|
||||
class_name = [[self infoDictionary] objectForKey: @"NSPrincipalClass"];
|
||||
|
||||
if (self == _mainBundle || self == _gnustep_bundle)
|
||||
|
||||
if (self == _mainBundle || self == _gnustep_bundle)
|
||||
{
|
||||
_codeLoaded = YES;
|
||||
if (class_name)
|
||||
|
@ -1125,7 +1125,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
_codeLoaded before loading the bundle. */
|
||||
_codeLoaded = YES;
|
||||
|
||||
if (objc_load_module([object fileSystemRepresentation],
|
||||
if (objc_load_module([object fileSystemRepresentation],
|
||||
stderr, _bundle_load_callback, NULL, NULL))
|
||||
{
|
||||
_codeLoaded = NO;
|
||||
|
@ -1154,7 +1154,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
|
||||
DESTROY(_loadingFrameworks);
|
||||
DESTROY(_currentFrameworkName);
|
||||
|
||||
|
||||
classNames = [NSMutableArray arrayWithCapacity: [_bundleClasses count]];
|
||||
classEnumerator = [_bundleClasses objectEnumerator];
|
||||
while ((class = [classEnumerator nextObject]) != nil)
|
||||
|
@ -1166,7 +1166,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
[load_lock unlock];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSBundleDidLoadNotification
|
||||
postNotificationName: NSBundleDidLoadNotification
|
||||
object: self
|
||||
userInfo: [NSDictionary dictionaryWithObject: classNames
|
||||
forKey: NSLoadedClasses]];
|
||||
|
@ -1203,7 +1203,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
enumerate = [languages objectEnumerator];
|
||||
while ((language = [enumerate nextObject]))
|
||||
[array addObject: _bundle_resource_path(primary, bundlePath, language)];
|
||||
|
||||
|
||||
primary = rootPath;
|
||||
[array addObject: _bundle_resource_path(primary, bundlePath, nil)];
|
||||
enumerate = [languages objectEnumerator];
|
||||
|
@ -1221,8 +1221,8 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
{
|
||||
NSString *path, *fullpath;
|
||||
NSEnumerator* pathlist;
|
||||
|
||||
if (!name || [name length] == 0)
|
||||
|
||||
if (!name || [name length] == 0)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"No resource name specified."];
|
||||
|
@ -1247,7 +1247,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
{
|
||||
NSString* platpath;
|
||||
platpath = [path stringByAppendingPathComponent:
|
||||
[NSString stringWithFormat: @"%@-%@.%@",
|
||||
[NSString stringWithFormat: @"%@-%@.%@",
|
||||
name, gnustep_target_os, ext]];
|
||||
if (bundle_file_readable(platpath))
|
||||
fullpath = platpath;
|
||||
|
@ -1263,8 +1263,8 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
{
|
||||
NSString *platpath;
|
||||
|
||||
platpath = _bundle_name_first_match(path,
|
||||
[NSString stringWithFormat: @"%@-%@",
|
||||
platpath = _bundle_name_first_match(path,
|
||||
[NSString stringWithFormat: @"%@-%@",
|
||||
name, gnustep_target_os]);
|
||||
if (platpath != nil)
|
||||
fullpath = platpath;
|
||||
|
@ -1304,7 +1304,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
ofType: (NSString *)ext
|
||||
{
|
||||
return [self pathForResource: name
|
||||
ofType: ext
|
||||
ofType: ext
|
||||
inDirectory: nil];
|
||||
}
|
||||
|
||||
|
@ -1342,15 +1342,15 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
NSMutableArray *resources;
|
||||
NSEnumerator *pathlist;
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
|
||||
/* Not sure if this is correct since it will only search in
|
||||
|
||||
/* Not sure if this is correct since it will only search in
|
||||
lprojs that are user preferences. FIXME. */
|
||||
pathlist = [[NSBundle _bundleResourcePathsWithRootPath: [self bundlePath]
|
||||
subPath: bundlePath] objectEnumerator];
|
||||
resources = [NSMutableArray arrayWithCapacity: 2];
|
||||
allfiles = (extension == nil || [extension length] == 0);
|
||||
|
||||
while((path = [pathlist nextObject]))
|
||||
while ((path = [pathlist nextObject]))
|
||||
{
|
||||
NSEnumerator *filelist;
|
||||
NSString *match;
|
||||
|
@ -1389,7 +1389,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
forPreferences: [NSUserDefaults userLanguages]];
|
||||
}
|
||||
|
||||
+ (NSArray *) preferredLocalizationsFromArray: (NSArray *)localizationsArray
|
||||
+ (NSArray *) preferredLocalizationsFromArray: (NSArray *)localizationsArray
|
||||
forPreferences: (NSArray *)preferencesArray
|
||||
{
|
||||
NSString *locale;
|
||||
|
@ -1419,9 +1419,9 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
locales = [self preferredLocalizations];
|
||||
if ([locales count] > 0)
|
||||
locale = [locales objectAtIndex: 0];
|
||||
path = [self pathForResource: @"Info-gnustep"
|
||||
path = [self pathForResource: @"Info-gnustep"
|
||||
ofType: @"plist"
|
||||
inDirectory: nil
|
||||
inDirectory: nil
|
||||
forLocalization: locale];
|
||||
if (path)
|
||||
{
|
||||
|
@ -1429,9 +1429,9 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
}
|
||||
else
|
||||
{
|
||||
path = [self pathForResource: @"Info"
|
||||
path = [self pathForResource: @"Info"
|
||||
ofType: @"plist"
|
||||
inDirectory: nil
|
||||
inDirectory: nil
|
||||
forLocalization: locale];
|
||||
if (path)
|
||||
{
|
||||
|
@ -1507,7 +1507,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
tableContent = [NSString stringWithContentsOfFile: tablePath];
|
||||
NS_DURING
|
||||
{
|
||||
table = [tableContent propertyListFromStringsFileFormat];
|
||||
table = [tableContent propertyListFromStringsFileFormat];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
|
@ -1550,7 +1550,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
if (newString == nil)
|
||||
newString = @"";
|
||||
}
|
||||
|
||||
|
||||
return newString;
|
||||
}
|
||||
|
||||
|
@ -1563,7 +1563,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
{
|
||||
NSString *object, *path;
|
||||
|
||||
if (!_mainBundle)
|
||||
if (!_mainBundle)
|
||||
{
|
||||
[NSBundle mainBundle];
|
||||
}
|
||||
|
@ -1579,7 +1579,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
if (_bundleType == NSBUNDLE_FRAMEWORK)
|
||||
{
|
||||
path = [_path stringByAppendingPathComponent:@"Versions/Current"];
|
||||
|
||||
|
||||
_currentFrameworkName = RETAIN(([NSString stringWithFormat:
|
||||
@"NSFramework_%@",
|
||||
object]));
|
||||
|
@ -1588,7 +1588,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
{
|
||||
path = _path;
|
||||
}
|
||||
|
||||
|
||||
object = bundle_object_name(path, object);
|
||||
return object;
|
||||
}
|
||||
|
@ -1603,7 +1603,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
if (_bundleType == NSBUNDLE_FRAMEWORK)
|
||||
{
|
||||
return [_path stringByAppendingPathComponent:
|
||||
[NSString stringWithFormat:@"Versions/%@/Resources",
|
||||
[NSString stringWithFormat:@"Versions/%@/Resources",
|
||||
version]];
|
||||
}
|
||||
else
|
||||
|
@ -1649,7 +1649,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
if (_bundleType == NSBUNDLE_FRAMEWORK)
|
||||
{
|
||||
return [_path stringByAppendingPathComponent:
|
||||
[NSString stringWithFormat:@"Versions/%@/PlugIns",
|
||||
[NSString stringWithFormat:@"Versions/%@/PlugIns",
|
||||
version]];
|
||||
}
|
||||
else
|
||||
|
@ -1677,7 +1677,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
|
||||
@implementation NSBundle (GNUstep)
|
||||
|
||||
/** Return a bundle which accesses the first existing directory from the list
|
||||
/** Return a bundle which accesses the first existing directory from the list
|
||||
GNUSTEP_USER_ROOT/Libraries/Resources/libraryName/
|
||||
GNUSTEP_NETWORK_ROOT/Libraries/Resources/libraryName/
|
||||
GNUSTEP_LOCAL_ROOT/Libraries/Resources/libraryName/
|
||||
|
@ -1690,29 +1690,29 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
NSString *path;
|
||||
NSString *tail;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
|
||||
if (libraryName == nil)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
tail = [@"Resources" stringByAppendingPathComponent: libraryName];
|
||||
|
||||
paths = NSSearchPathForDirectoriesInDomains (GSLibrariesDirectory,
|
||||
NSAllDomainsMask, YES);
|
||||
|
||||
|
||||
enumerator = [paths objectEnumerator];
|
||||
while ((path = [enumerator nextObject]))
|
||||
{
|
||||
BOOL isDir;
|
||||
path = [path stringByAppendingPathComponent: tail];
|
||||
|
||||
|
||||
if ([fm fileExistsAtPath: path isDirectory: &isDir] && isDir)
|
||||
{
|
||||
return [self bundleWithPath: path];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -1816,7 +1816,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
{
|
||||
NSLog(@"Warning: Deprecated method %@ called. Use +pathForLibraryResource:ofType:inDirectory: or +bundleForLibrary: instead",
|
||||
NSStringFromSelector(_cmd));
|
||||
return [self pathForLibraryResource: name ofType: ext
|
||||
return [self pathForLibraryResource: name ofType: ext
|
||||
inDirectory: bundlePath];
|
||||
}
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ absoluteGregorianDay(int day, int month, int year)
|
|||
|
||||
/* Should be static, but temporarily changed to non-static until
|
||||
WIndows fixes are done. */
|
||||
int
|
||||
int
|
||||
dayOfCommonEra(NSTimeInterval when)
|
||||
{
|
||||
double a;
|
||||
|
@ -356,7 +356,7 @@ GSBreakTime(NSTimeInterval when, int *year, int *month, int *day,
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates and returns an NSCalendarDate from the specified values
|
||||
* Creates and returns an NSCalendarDate from the specified values
|
||||
* by calling -initWithYear:month:day:hour:minute:second:timeZone:
|
||||
*/
|
||||
+ (id) dateWithYear: (int)year
|
||||
|
@ -564,7 +564,7 @@ static inline int getDigits(const char *from, char *to, int limit)
|
|||
* %X time with time representation for locale
|
||||
* </item>
|
||||
* <item>
|
||||
* %y year as a decimal number without century
|
||||
* %y year as a decimal number without century
|
||||
* </item>
|
||||
* <item>
|
||||
* %Y year as a decimal number with century
|
||||
|
@ -585,7 +585,7 @@ static inline int getDigits(const char *from, char *to, int limit)
|
|||
* If no millisecond is specified in the format, 0 is assumed.<br />
|
||||
* If no timezone is specified in the format, the local timezone is assumed.
|
||||
*/
|
||||
- (id) initWithString: (NSString*)description
|
||||
- (id) initWithString: (NSString*)description
|
||||
calendarFormat: (NSString*)fmt
|
||||
locale: (NSDictionary*)locale
|
||||
{
|
||||
|
@ -598,7 +598,7 @@ static inline int getDigits(const char *from, char *to, int limit)
|
|||
int sec = 0;
|
||||
NSTimeZone *tz = nil;
|
||||
BOOL ampm = NO;
|
||||
BOOL twelveHrClock = NO;
|
||||
BOOL twelveHrClock = NO;
|
||||
int julianWeeks = -1, weekStartsMonday = 0, dayOfWeek = -1;
|
||||
const char *source = [description cString];
|
||||
unsigned sourceLen = strlen(source);
|
||||
|
@ -614,7 +614,7 @@ static inline int getDigits(const char *from, char *to, int limit)
|
|||
NSMutableData *fd;
|
||||
BOOL changedFormat = NO;
|
||||
BOOL error = NO;
|
||||
|
||||
|
||||
if (locale == nil)
|
||||
{
|
||||
locale = GSUserDefaultsDictionaryRepresentation();
|
||||
|
@ -836,7 +836,7 @@ static inline int getDigits(const char *from, char *to, int limit)
|
|||
}
|
||||
else
|
||||
{
|
||||
dayOfWeek = tmpIdx;
|
||||
dayOfWeek = tmpIdx;
|
||||
had |= hadw;
|
||||
}
|
||||
RELEASE(currDay);
|
||||
|
@ -1108,7 +1108,7 @@ static inline int getDigits(const char *from, char *to, int limit)
|
|||
{
|
||||
zone *= 100; // Convert 2 digits to 4
|
||||
}
|
||||
tz = [NSTimeZone timeZoneForSecondsFromGMT:
|
||||
tz = [NSTimeZone timeZoneForSecondsFromGMT:
|
||||
sign * ((zone / 100) * 60 + (zone % 100)) * 60];
|
||||
}
|
||||
}
|
||||
|
@ -1149,7 +1149,7 @@ static inline int getDigits(const char *from, char *to, int limit)
|
|||
@"specifier %c not recognized in format %@",
|
||||
format[formatIdx], fmt];
|
||||
}
|
||||
}
|
||||
}
|
||||
formatIdx++;
|
||||
}
|
||||
RELEASE(fd);
|
||||
|
@ -1682,7 +1682,7 @@ static void Grow(DescriptionInfo *info, unsigned size)
|
|||
*/
|
||||
f = (unichar*)NSZoneMalloc(NSDefaultMallocZone(), lf*sizeof(unichar));
|
||||
}
|
||||
[fmt getCharacters: f];
|
||||
[fmt getCharacters: f];
|
||||
|
||||
while (i < lf)
|
||||
{
|
||||
|
@ -1692,7 +1692,7 @@ static void Grow(DescriptionInfo *info, unsigned size)
|
|||
BOOL mname = NO;
|
||||
BOOL dname = NO;
|
||||
BOOL twelve = NO;
|
||||
|
||||
|
||||
// Only care about a format specifier
|
||||
if (f[i] == '%')
|
||||
{
|
||||
|
@ -1790,7 +1790,7 @@ static void Grow(DescriptionInfo *info, unsigned size)
|
|||
else
|
||||
{
|
||||
NSString *name;
|
||||
|
||||
|
||||
name = [months objectAtIndex: info->md-1];
|
||||
v = [name length];
|
||||
Grow(info, v);
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/** GNUStep callback functions. Implicitly required by the standard.
|
||||
* Copyright(C) 1996 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* Author: Albin L. Jones <Albin.L.Jones@Dartmouth.EDU>
|
||||
* Created: Tue Feb 13 23:10:29 EST 1996
|
||||
* Updated: Wed Mar 20 19:53:48 EST 1996
|
||||
* Updated: Mon Feb 7 10:25:00 GMT 2000
|
||||
* Serial: 96.03.20.02
|
||||
*
|
||||
*
|
||||
* This file is part of the GNUstep Base Library.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or(at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
|
||||
<title>NSCallBacks class reference</title>
|
||||
$Date$ $Revision$
|
||||
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
|
||||
/**** Included Headers *******************************************************/
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -99,7 +99,7 @@ static Class abstractClass = nil;
|
|||
|
||||
/* Load the character set file */
|
||||
data = [NSData dataWithContentsOfFile: set_path];
|
||||
set = [NSCharacterSet characterSetWithBitmapRepresentation:
|
||||
set = [NSCharacterSet characterSetWithBitmapRepresentation:
|
||||
data];
|
||||
}
|
||||
NS_HANDLER
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/** NSClassDescription
|
||||
/** NSClassDescription
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
@ -75,7 +75,7 @@ static NSMapTable *classMap;
|
|||
}
|
||||
RETAIN(description);
|
||||
[mapLock unlock];
|
||||
|
||||
|
||||
return AUTORELEASE(description);
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ static Class NSClassDescriptionClass = 0;
|
|||
if (NSClassDescriptionClass == 0)
|
||||
{
|
||||
NSClassDescriptionClass = [NSClassDescription class];
|
||||
}
|
||||
}
|
||||
return [NSClassDescriptionClass classDescriptionForClass: [self class]];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/** NSCoder - coder object for serialization and persistance.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
From skeleton by: Adam Fedor <fedor@boulder.colorado.edu>
|
||||
Date: Mar 1995
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -324,37 +324,37 @@
|
|||
}
|
||||
|
||||
- (double) decodeDoubleForKey: (NSString*)aKey
|
||||
{
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
- (float) decodeFloatForKey: (NSString*)aKey
|
||||
{
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
- (int) decodeIntForKey: (NSString*)aKey
|
||||
{
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (int32_t) decodeInt32ForKey: (NSString*)aKey
|
||||
{
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (int64_t) decodeInt64ForKey: (NSString*)aKey
|
||||
{
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (id) decodeObjectForKey: (NSString*)aKey
|
||||
{
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# line 1 "NSConcreteNumber.m" /* So gdb knows which file we are in */
|
||||
/* NSConcreteNumber - Object encapsulation of numbers
|
||||
|
||||
|
||||
Copyright (C) 1993, 1994, 1996, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Adam Fedor <fedor@boulder.colorado.edu>
|
||||
|
@ -14,7 +14,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -215,7 +215,7 @@
|
|||
(*(info->getValue))(other, @selector(getValue:), (void*)&oData);
|
||||
#undef PT
|
||||
#if (TYPE_ORDER & 1) == 1
|
||||
#if GS_SIZEOF_CHAR < GS_SIZEOF_SHORT && TYPE_ORDER < 3
|
||||
#if GS_SIZEOF_CHAR < GS_SIZEOF_SHORT && TYPE_ORDER < 3
|
||||
#define PT (short)
|
||||
#elif GS_SIZEOF_CHAR < GS_SIZEOF_INT && TYPE_ORDER < 5
|
||||
#define PT (int)
|
||||
|
@ -572,7 +572,7 @@
|
|||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Cannot copy value into NULL pointer"];
|
||||
/* NOT REACHED */
|
||||
/* NOT REACHED */
|
||||
}
|
||||
memcpy(value, &data, objc_sizeof_type(@encode(TYPE_TYPE)));
|
||||
}
|
||||
|
|
|
@ -505,7 +505,7 @@ static NSLock *cached_proxies_gate = nil;
|
|||
|
||||
dummyObject = [NSObject new];
|
||||
|
||||
connection_table =
|
||||
connection_table =
|
||||
NSCreateHashTable(NSNonRetainedObjectHashCallBacks, 0);
|
||||
|
||||
targetToCached =
|
||||
|
@ -567,7 +567,7 @@ static NSLock *cached_proxies_gate = nil;
|
|||
{
|
||||
proxy = [connection rootProxy];
|
||||
}
|
||||
|
||||
|
||||
return proxy;
|
||||
}
|
||||
|
||||
|
@ -592,7 +592,7 @@ static NSLock *cached_proxies_gate = nil;
|
|||
{
|
||||
proxy = [connection rootProxy];
|
||||
}
|
||||
|
||||
|
||||
return proxy;
|
||||
}
|
||||
|
||||
|
@ -720,7 +720,7 @@ static NSLock *cached_proxies_gate = nil;
|
|||
}
|
||||
|
||||
/** <init />
|
||||
* Initialises an NSConnection with the receive port r and the
|
||||
* Initialises an NSConnection with the receive port r and the
|
||||
* send port s.<br />
|
||||
* Behavior varies with the port values as follows -
|
||||
* <deflist>
|
||||
|
@ -913,8 +913,8 @@ static NSLock *cached_proxies_gate = nil;
|
|||
loop = GSRunLoopForThread(nil);
|
||||
_runLoops = [[NSMutableArray alloc] initWithObjects: &loop count: 1];
|
||||
_requestModes = [[NSMutableArray alloc] initWithCapacity: 2];
|
||||
[self addRequestMode: NSDefaultRunLoopMode];
|
||||
[self addRequestMode: NSConnectionReplyMode];
|
||||
[self addRequestMode: NSDefaultRunLoopMode];
|
||||
[self addRequestMode: NSConnectionReplyMode];
|
||||
|
||||
/*
|
||||
* If we have no parent, we must handle incoming packets on our
|
||||
|
@ -970,7 +970,7 @@ static NSLock *cached_proxies_gate = nil;
|
|||
name: NSPortDidBecomeInvalidNotification
|
||||
object: s];
|
||||
}
|
||||
|
||||
|
||||
/* In order that connections may be deallocated - there is an
|
||||
implementation of [-release] to automatically remove the connection
|
||||
from this array when it is the only thing retaining it. */
|
||||
|
@ -1723,7 +1723,7 @@ static void retEncoder (DOContext *ctxt)
|
|||
{
|
||||
switch (*ctxt->type)
|
||||
{
|
||||
case _C_ID:
|
||||
case _C_ID:
|
||||
if (ctxt->flags & _F_BYCOPY)
|
||||
{
|
||||
[ctxt->encoder encodeBycopyObject: *(id*)ctxt->datum];
|
||||
|
@ -1739,7 +1739,7 @@ static void retEncoder (DOContext *ctxt)
|
|||
[ctxt->encoder encodeObject: *(id*)ctxt->datum];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
[ctxt->encoder encodeValueOfObjCType: ctxt->type at: ctxt->datum];
|
||||
}
|
||||
}
|
||||
|
@ -1762,7 +1762,7 @@ static void retEncoder (DOContext *ctxt)
|
|||
|
||||
memset(&ctxt, 0, sizeof(ctxt));
|
||||
ctxt.connection = self;
|
||||
|
||||
|
||||
/* Encode the method on an RMC, and send it. */
|
||||
|
||||
NSParameterAssert (_isValid);
|
||||
|
@ -1893,8 +1893,8 @@ static void retEncoder (DOContext *ctxt)
|
|||
* NSDistantObject's -forwardInvocation: method calls this to send the message
|
||||
* over the wire.
|
||||
*/
|
||||
- (void) forwardInvocation: (NSInvocation*)inv
|
||||
forProxy: (NSDistantObject*)object
|
||||
- (void) forwardInvocation: (NSInvocation*)inv
|
||||
forProxy: (NSDistantObject*)object
|
||||
{
|
||||
NSPortCoder *op;
|
||||
BOOL outParams;
|
||||
|
@ -1916,7 +1916,7 @@ static void retEncoder (DOContext *ctxt)
|
|||
[self addRunLoop: runLoop];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Encode the method on an RMC, and send it. */
|
||||
|
||||
NSParameterAssert (_isValid);
|
||||
|
@ -2136,19 +2136,19 @@ static void retEncoder (DOContext *ctxt)
|
|||
|
||||
switch (type)
|
||||
{
|
||||
case ROOTPROXY_REQUEST:
|
||||
case ROOTPROXY_REQUEST:
|
||||
/* It won't take much time to handle this, so go ahead and service
|
||||
it, even if we are waiting for a reply. */
|
||||
[conn _service_rootObject: rmc];
|
||||
break;
|
||||
|
||||
case METHODTYPE_REQUEST:
|
||||
case METHODTYPE_REQUEST:
|
||||
/* It won't take much time to handle this, so go ahead and service
|
||||
it, even if we are waiting for a reply. */
|
||||
[conn _service_typeForSelector: rmc];
|
||||
break;
|
||||
|
||||
case METHOD_REQUEST:
|
||||
case METHOD_REQUEST:
|
||||
/*
|
||||
* We just got a new request; we need to decide whether to queue
|
||||
* it or service it now.
|
||||
|
@ -2190,10 +2190,10 @@ static void retEncoder (DOContext *ctxt)
|
|||
* store it in a map using thee sequence number as the key. That way
|
||||
* it's easy for the connection to find replies by their numbers.
|
||||
*/
|
||||
case ROOTPROXY_REPLY:
|
||||
case METHOD_REPLY:
|
||||
case METHODTYPE_REPLY:
|
||||
case RETAIN_REPLY:
|
||||
case ROOTPROXY_REPLY:
|
||||
case METHOD_REPLY:
|
||||
case METHODTYPE_REPLY:
|
||||
case RETAIN_REPLY:
|
||||
{
|
||||
int sequence;
|
||||
GSIMapNode node;
|
||||
|
@ -2224,22 +2224,22 @@ static void retEncoder (DOContext *ctxt)
|
|||
}
|
||||
break;
|
||||
|
||||
case CONNECTION_SHUTDOWN:
|
||||
case CONNECTION_SHUTDOWN:
|
||||
{
|
||||
[conn _service_shutdown: rmc];
|
||||
break;
|
||||
}
|
||||
case PROXY_RELEASE:
|
||||
case PROXY_RELEASE:
|
||||
{
|
||||
[conn _service_release: rmc];
|
||||
break;
|
||||
}
|
||||
case PROXY_RETAIN:
|
||||
case PROXY_RETAIN:
|
||||
{
|
||||
[conn _service_retain: rmc];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
default:
|
||||
[NSException raise: NSGenericException
|
||||
format: @"unrecognized NSPortCoder identifier"];
|
||||
}
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/** Implementation of NSCopyObject() for GNUStep
|
||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: August 1994
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSCopyObject class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -31,7 +31,7 @@
|
|||
NSObject *NSCopyObject(NSObject *anObject, unsigned extraBytes, NSZone *zone)
|
||||
{
|
||||
id copy = NSAllocateObject(((id)anObject)->class_pointer, extraBytes, zone);
|
||||
memcpy(copy, anObject,
|
||||
memcpy(copy, anObject,
|
||||
((id)anObject)->class_pointer->instance_size + extraBytes);
|
||||
return copy;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/** NSCountedSet - CountedSet object
|
||||
/** NSCountedSet - CountedSet object
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: Sep 1995
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -60,7 +60,7 @@ static BOOL uniquing = NO;
|
|||
* easier.
|
||||
* </p>
|
||||
*/
|
||||
@implementation NSCountedSet
|
||||
@implementation NSCountedSet
|
||||
|
||||
static Class NSCountedSet_abstract_class;
|
||||
static Class NSCountedSet_concrete_class;
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/**
|
||||
Copyright (C) 1995, 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: March 1995
|
||||
Rewritten by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Date: September 1997
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -228,7 +228,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
}
|
||||
if (tmp == 0)
|
||||
{
|
||||
NSLog(@"Malloc failed for file (%@) of length %d - %s",localPath,
|
||||
NSLog(@"Malloc failed for file (%@) of length %d - %s",localPath,
|
||||
fileLength + c, GSLastErrorStr(errno));
|
||||
goto failure;
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
tmp = NSZoneMalloc(zone, fileLength);
|
||||
if (tmp == 0)
|
||||
{
|
||||
NSLog(@"Malloc failed for file (%@) of length %d - %s",localPath,
|
||||
NSLog(@"Malloc failed for file (%@) of length %d - %s",localPath,
|
||||
fileLength, GSLastErrorStr(errno));
|
||||
goto failure;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
c = fread(tmp, 1, fileLength, theFile);
|
||||
if (c != (int)fileLength)
|
||||
{
|
||||
NSWarnFLog(@"read of file (%@) contents failed - %s",localPath,
|
||||
NSWarnFLog(@"read of file (%@) contents failed - %s",localPath,
|
||||
GSLastErrorStr(errno));
|
||||
goto failure;
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ failure:
|
|||
unsigned capacity;
|
||||
unsigned growth;
|
||||
}
|
||||
/* Increase capacity to at least the specified minimum value. */
|
||||
/* Increase capacity to at least the specified minimum value. */
|
||||
- (void) _grow: (unsigned int)minimum;
|
||||
@end
|
||||
|
||||
|
@ -407,7 +407,7 @@ static unsigned gsu32Align;
|
|||
/**
|
||||
* Returns an autoreleased data object encapsulating the data at bytes
|
||||
* and with the specified length. Invokes
|
||||
* -initWithBytesNoCopy:length:freeWhenDone: with YES
|
||||
* -initWithBytesNoCopy:length:freeWhenDone: with YES
|
||||
*/
|
||||
+ (id) dataWithBytesNoCopy: (void*)bytes
|
||||
length: (unsigned int)length
|
||||
|
@ -649,7 +649,7 @@ static unsigned gsu32Align;
|
|||
}
|
||||
|
||||
|
||||
// Accessing Data
|
||||
// Accessing Data
|
||||
|
||||
/** <override-subclass>
|
||||
* Returns a pointer to the data encapsulated by the receiver.
|
||||
|
@ -748,7 +748,7 @@ static unsigned gsu32Align;
|
|||
unsigned char buf[64];
|
||||
unsigned l = [self length];
|
||||
unsigned ret =0;
|
||||
|
||||
|
||||
l = MIN(l,64);
|
||||
|
||||
/*
|
||||
|
@ -758,12 +758,12 @@ static unsigned gsu32Align;
|
|||
{
|
||||
return 0xfffffffe;
|
||||
}
|
||||
|
||||
|
||||
[self getBytes: &buf range: NSMakeRange(0, l)];
|
||||
|
||||
while (l-- > 0)
|
||||
{
|
||||
ret = (ret << 5 ) + ret + buf[l];
|
||||
ret = (ret << 5) + ret + buf[l];
|
||||
}
|
||||
// Again, match NSString
|
||||
if (ret == 0)
|
||||
|
@ -842,7 +842,7 @@ static unsigned gsu32Align;
|
|||
{
|
||||
const char *local_c_path = [localPath cString];
|
||||
if (local_c_path != NULL && strlen(local_c_path) < (BUFSIZ*2))
|
||||
{
|
||||
{
|
||||
strcpy(theRealPath,local_c_path);
|
||||
error_BadPath = NO;
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ static unsigned gsu32Align;
|
|||
wcscat(wthePath, L"XXXXXX");
|
||||
if (_wmktemp(wthePath) == 0)
|
||||
{
|
||||
NSWarnMLog(@"mktemp (%@) failed - %s",
|
||||
NSWarnMLog(@"mktemp (%@) failed - %s",
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
GSLastErrorStr(errno));
|
||||
goto failure;
|
||||
|
@ -930,8 +930,8 @@ static unsigned gsu32Align;
|
|||
* even able to open the file. */
|
||||
{
|
||||
#if defined(__MINGW__)
|
||||
NSWarnMLog(@"Open (%@) failed - %s",
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
NSWarnMLog(@"Open (%@) failed - %s",
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
GSLastErrorStr(errno));
|
||||
#else
|
||||
NSWarnMLog(@"Open (%s) failed - %s", thePath, GSLastErrorStr(errno));
|
||||
|
@ -948,8 +948,8 @@ static unsigned gsu32Align;
|
|||
* some reason. */
|
||||
{
|
||||
#if defined(__MINGW__)
|
||||
NSWarnMLog(@"Fwrite (%@) failed - %s",
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
NSWarnMLog(@"Fwrite (%@) failed - %s",
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
GSLastErrorStr(errno));
|
||||
#else
|
||||
NSWarnMLog(@"Fwrite (%s) failed - %s", thePath, GSLastErrorStr(errno));
|
||||
|
@ -965,8 +965,8 @@ static unsigned gsu32Align;
|
|||
* so we need to deal with it. */
|
||||
{
|
||||
#if defined(__MINGW__)
|
||||
NSWarnMLog(@"Fclose (%@) failed - %s",
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
NSWarnMLog(@"Fclose (%@) failed - %s",
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
GSLastErrorStr(errno));
|
||||
#else
|
||||
NSWarnMLog(@"Fclose (%s) failed - %s", thePath, GSLastErrorStr(errno));
|
||||
|
@ -1022,7 +1022,7 @@ static unsigned gsu32Align;
|
|||
{
|
||||
#if defined(__MINGW__)
|
||||
NSWarnMLog(@"Rename ('%@' to '%@') failed - %s",
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
[NSString stringWithCharacters:wtheRealPath length:wcslen(wtheRealPath)],
|
||||
GSLastErrorStr(errno));
|
||||
#else
|
||||
|
@ -1562,7 +1562,7 @@ failure:
|
|||
atCursor: (unsigned int*)cursor
|
||||
{
|
||||
[self deserializeDataAt: (void*)tag
|
||||
ofObjCType: @encode(gsu8)
|
||||
ofObjCType: @encode(gsu8)
|
||||
atCursor: cursor
|
||||
context: nil];
|
||||
if (*tag & _GSC_MAYX)
|
||||
|
@ -1578,7 +1578,7 @@ failure:
|
|||
gsu8 x;
|
||||
|
||||
[self deserializeDataAt: (void*)&x
|
||||
ofObjCType: @encode(gsu8)
|
||||
ofObjCType: @encode(gsu8)
|
||||
atCursor: cursor
|
||||
context: nil];
|
||||
*ref = (unsigned int)x;
|
||||
|
@ -1589,7 +1589,7 @@ failure:
|
|||
gsu16 x;
|
||||
|
||||
[self deserializeDataAt: (void*)&x
|
||||
ofObjCType: @encode(gsu16)
|
||||
ofObjCType: @encode(gsu16)
|
||||
atCursor: cursor
|
||||
context: nil];
|
||||
*ref = (unsigned int)x;
|
||||
|
@ -1600,7 +1600,7 @@ failure:
|
|||
gsu32 x;
|
||||
|
||||
[self deserializeDataAt: (void*)&x
|
||||
ofObjCType: @encode(gsu32)
|
||||
ofObjCType: @encode(gsu32)
|
||||
atCursor: cursor
|
||||
context: nil];
|
||||
*ref = (unsigned int)x;
|
||||
|
@ -1925,7 +1925,7 @@ failure:
|
|||
{
|
||||
unsigned size = [self length];
|
||||
unsigned end = NSMaxRange(aRange);
|
||||
int shift = length - aRange.length;
|
||||
int shift = length - aRange.length;
|
||||
unsigned need = size + shift;
|
||||
void *buf;
|
||||
|
||||
|
@ -2863,7 +2863,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
#else
|
||||
const char *thePath;
|
||||
thePath = [localPath fileSystemRepresentation];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (thePath == NULL)
|
||||
{
|
||||
|
@ -2872,9 +2872,9 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
return nil;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(__MINGW__)
|
||||
fd = _wopen(thePath, _O_RDONLY);
|
||||
fd = _wopen(thePath, _O_RDONLY);
|
||||
#else
|
||||
fd = open(thePath, O_RDONLY);
|
||||
#endif
|
||||
|
@ -2888,7 +2888,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
length = lseek(fd, 0, SEEK_END);
|
||||
if (length < 0)
|
||||
{
|
||||
NSWarnMLog(@"unable to seek to eof %@ - %s",localPath,
|
||||
NSWarnMLog(@"unable to seek to eof %@ - %s",localPath,
|
||||
GSLastErrorStr(errno));
|
||||
close(fd);
|
||||
RELEASE(self);
|
||||
|
@ -2897,7 +2897,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
/* Position at start of file. */
|
||||
if (lseek(fd, 0, SEEK_SET) != 0)
|
||||
{
|
||||
NSWarnMLog(@"unable to seek to sof %@ - %s", localPath,
|
||||
NSWarnMLog(@"unable to seek to sof %@ - %s", localPath,
|
||||
GSLastErrorStr(errno));
|
||||
close(fd);
|
||||
RELEASE(self);
|
||||
|
|
|
@ -161,7 +161,7 @@ GSTimeNow(void)
|
|||
*/
|
||||
GetSystemTime(&sys_time);
|
||||
t = GSTime(sys_time.wDay, sys_time.wMonth, sys_time.wYear, sys_time.wHour,
|
||||
sys_time.wMinute, sys_time.wSecond, sys_time.wMilliseconds);
|
||||
sys_time.wMinute, sys_time.wSecond, sys_time.wMilliseconds);
|
||||
#endif
|
||||
return t;
|
||||
#endif /* __MINGW__ */
|
||||
|
|
|
@ -84,7 +84,7 @@ void (*_GSDebugAllocationRemoveFunc)(Class c, id o) = _GSDebugAllocationRemove;
|
|||
* This functions allows to set own function backcalls for debugging allocation
|
||||
* of objects. Useful if you intend to write your own objectalloc.
|
||||
*/
|
||||
void
|
||||
void
|
||||
GSSetDebugAllocationFunctions(void (*newAddObjectFunc)(Class c, id o),
|
||||
void (*newRemoveObjectFunc)(Class c, id o))
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ GSSetDebugAllocationFunctions(void (*newAddObjectFunc)(Class c, id o),
|
|||
_GSDebugAllocationAddFunc = _GSDebugAllocationAdd;
|
||||
_GSDebugAllocationRemoveFunc = _GSDebugAllocationRemove;
|
||||
}
|
||||
|
||||
|
||||
[uniqueLock unlock];
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ void
|
|||
GSDebugAllocationActiveRecordingObjects(Class c)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
||||
GSDebugAllocationActive(YES);
|
||||
|
||||
for (i = 0; i < num_classes; i++)
|
||||
|
@ -165,9 +165,9 @@ GSDebugAllocationActiveRecordingObjects(Class c)
|
|||
{
|
||||
int more = table_size + 128;
|
||||
table_entry *tmp;
|
||||
|
||||
|
||||
tmp = NSZoneMalloc(NSDefaultMallocZone(), more * sizeof(table_entry));
|
||||
|
||||
|
||||
if (tmp == 0)
|
||||
{
|
||||
[uniqueLock unlock];
|
||||
|
@ -227,8 +227,8 @@ _GSDebugAllocationAdd(Class c, id o)
|
|||
int more = the_table[i].stack_size + 128;
|
||||
id *tmp;
|
||||
id *tmp1;
|
||||
|
||||
tmp = NSZoneMalloc(NSDefaultMallocZone(),
|
||||
|
||||
tmp = NSZoneMalloc(NSDefaultMallocZone(),
|
||||
more * sizeof(id));
|
||||
if (tmp == 0)
|
||||
{
|
||||
|
@ -236,7 +236,7 @@ _GSDebugAllocationAdd(Class c, id o)
|
|||
return;
|
||||
}
|
||||
|
||||
tmp1 = NSZoneMalloc(NSDefaultMallocZone(),
|
||||
tmp1 = NSZoneMalloc(NSDefaultMallocZone(),
|
||||
more * sizeof(id));
|
||||
if (tmp1 == 0)
|
||||
{
|
||||
|
@ -248,22 +248,22 @@ _GSDebugAllocationAdd(Class c, id o)
|
|||
|
||||
if (the_table[i].recorded_objects != NULL)
|
||||
{
|
||||
memcpy(tmp, the_table[i].recorded_objects,
|
||||
the_table[i].num_recorded_objects
|
||||
memcpy(tmp, the_table[i].recorded_objects,
|
||||
the_table[i].num_recorded_objects
|
||||
* sizeof(id));
|
||||
NSZoneFree(NSDefaultMallocZone(),
|
||||
NSZoneFree(NSDefaultMallocZone(),
|
||||
the_table[i].recorded_objects);
|
||||
memcpy(tmp1, the_table[i].recorded_tags,
|
||||
the_table[i].num_recorded_objects
|
||||
memcpy(tmp1, the_table[i].recorded_tags,
|
||||
the_table[i].num_recorded_objects
|
||||
* sizeof(id));
|
||||
NSZoneFree(NSDefaultMallocZone(),
|
||||
NSZoneFree(NSDefaultMallocZone(),
|
||||
the_table[i].recorded_tags);
|
||||
}
|
||||
the_table[i].recorded_objects = tmp;
|
||||
the_table[i].recorded_tags = tmp1;
|
||||
the_table[i].stack_size = more;
|
||||
}
|
||||
|
||||
|
||||
(the_table[i].recorded_objects)
|
||||
[the_table[i].num_recorded_objects] = o;
|
||||
(the_table[i].recorded_tags)
|
||||
|
@ -279,9 +279,9 @@ _GSDebugAllocationAdd(Class c, id o)
|
|||
{
|
||||
unsigned int more = table_size + 128;
|
||||
table_entry *tmp;
|
||||
|
||||
|
||||
tmp = NSZoneMalloc(NSDefaultMallocZone(), more * sizeof(table_entry));
|
||||
|
||||
|
||||
if (tmp == 0)
|
||||
{
|
||||
[uniqueLock unlock];
|
||||
|
@ -323,7 +323,7 @@ _GSDebugAllocationAdd(Class c, id o)
|
|||
* allocate so many objects as to eat up all your system's
|
||||
* memory ...
|
||||
* </p>
|
||||
* <p>
|
||||
* <p>
|
||||
* This function, like the ones below, returns the number of
|
||||
* objects allocated/released from the time when
|
||||
* GSDebugAllocationActive() was first called. A negative
|
||||
|
@ -424,7 +424,7 @@ GSDebugAllocationClassList()
|
|||
unsigned int i;
|
||||
|
||||
[uniqueLock lock];
|
||||
|
||||
|
||||
siz = sizeof(Class) * (num_classes + 1);
|
||||
ans = NSZoneMalloc(NSDefaultMallocZone(), siz);
|
||||
|
||||
|
@ -653,13 +653,13 @@ _GSDebugAllocationRemove(Class c, id o)
|
|||
}
|
||||
if (j < the_table[i].num_recorded_objects)
|
||||
{
|
||||
for (k = j;
|
||||
k + 1 < the_table[i].num_recorded_objects;
|
||||
for (k = j;
|
||||
k + 1 < the_table[i].num_recorded_objects;
|
||||
k++)
|
||||
{
|
||||
(the_table[i].recorded_objects)[k] =
|
||||
(the_table[i].recorded_objects)[k] =
|
||||
(the_table[i].recorded_objects)[k + 1];
|
||||
(the_table[i].recorded_tags)[k] =
|
||||
(the_table[i].recorded_tags)[k] =
|
||||
(the_table[i].recorded_tags)[k + 1];
|
||||
}
|
||||
the_table[i].num_recorded_objects--;
|
||||
|
@ -700,7 +700,7 @@ GSDebugAllocationTagRecordedObject(id object, id tag)
|
|||
return nil;
|
||||
}
|
||||
[uniqueLock lock];
|
||||
|
||||
|
||||
for (i = 0; i < num_classes; i++)
|
||||
{
|
||||
if (the_table[i].class == c)
|
||||
|
@ -708,7 +708,7 @@ GSDebugAllocationTagRecordedObject(id object, id tag)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (i == num_classes
|
||||
|| the_table[i].is_recording == NO
|
||||
|| the_table[i].num_recorded_objects == 0)
|
||||
|
@ -754,7 +754,7 @@ GSDebugAllocationListRecordedObjects(Class c)
|
|||
}
|
||||
|
||||
[uniqueLock lock];
|
||||
|
||||
|
||||
for (i = 0; i < num_classes; i++)
|
||||
{
|
||||
if (the_table[i].class == c)
|
||||
|
@ -762,7 +762,7 @@ GSDebugAllocationListRecordedObjects(Class c)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (i == num_classes)
|
||||
{
|
||||
[uniqueLock unlock];
|
||||
|
@ -781,16 +781,16 @@ GSDebugAllocationListRecordedObjects(Class c)
|
|||
return [NSArray array];
|
||||
}
|
||||
|
||||
tmp = NSZoneMalloc(NSDefaultMallocZone(),
|
||||
tmp = NSZoneMalloc(NSDefaultMallocZone(),
|
||||
the_table[i].num_recorded_objects * sizeof(id));
|
||||
if (tmp == 0)
|
||||
{
|
||||
[uniqueLock unlock];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
/* First, we copy the objects into a temporary buffer */
|
||||
memcpy(tmp, the_table[i].recorded_objects,
|
||||
memcpy(tmp, the_table[i].recorded_objects,
|
||||
the_table[i].num_recorded_objects * sizeof(id));
|
||||
|
||||
/* Retain all the objects - NB: if retaining one of the objects as a
|
||||
|
@ -802,12 +802,12 @@ GSDebugAllocationListRecordedObjects(Class c)
|
|||
|
||||
/* Then, we bravely unlock the lock */
|
||||
[uniqueLock unlock];
|
||||
|
||||
|
||||
/* Only then we create an array with them - this is now safe as we
|
||||
have copied the objects out, unlocked, and retained them. */
|
||||
answer = [NSArray arrayWithObjects: tmp
|
||||
answer = [NSArray arrayWithObjects: tmp
|
||||
count: the_table[i].num_recorded_objects];
|
||||
|
||||
|
||||
/* Now we release all the objects to balance the retain */
|
||||
for (k = 0; k < the_table[i].num_recorded_objects; k++)
|
||||
{
|
||||
|
@ -816,8 +816,8 @@ GSDebugAllocationListRecordedObjects(Class c)
|
|||
|
||||
/* And free the space used by them */
|
||||
NSZoneFree(NSDefaultMallocZone(), tmp);
|
||||
|
||||
return answer;
|
||||
|
||||
return answer;
|
||||
}
|
||||
|
||||
|
||||
|
@ -857,10 +857,10 @@ GSDebugMethodMsg(id obj, SEL sel, const char *file, int line, NSString *fmt)
|
|||
void *NSFrameAddress(int offset)
|
||||
{
|
||||
switch (offset) {
|
||||
_NS_FRAME_HACK( 0); _NS_FRAME_HACK( 1); _NS_FRAME_HACK( 2);
|
||||
_NS_FRAME_HACK( 3); _NS_FRAME_HACK( 4); _NS_FRAME_HACK( 5);
|
||||
_NS_FRAME_HACK( 6); _NS_FRAME_HACK( 7); _NS_FRAME_HACK( 8);
|
||||
_NS_FRAME_HACK( 9); _NS_FRAME_HACK(10); _NS_FRAME_HACK(11);
|
||||
_NS_FRAME_HACK(0); _NS_FRAME_HACK(1); _NS_FRAME_HACK(2);
|
||||
_NS_FRAME_HACK(3); _NS_FRAME_HACK(4); _NS_FRAME_HACK(5);
|
||||
_NS_FRAME_HACK(6); _NS_FRAME_HACK(7); _NS_FRAME_HACK(8);
|
||||
_NS_FRAME_HACK(9); _NS_FRAME_HACK(10); _NS_FRAME_HACK(11);
|
||||
_NS_FRAME_HACK(12); _NS_FRAME_HACK(13); _NS_FRAME_HACK(14);
|
||||
_NS_FRAME_HACK(15); _NS_FRAME_HACK(16); _NS_FRAME_HACK(17);
|
||||
_NS_FRAME_HACK(18); _NS_FRAME_HACK(19); _NS_FRAME_HACK(20);
|
||||
|
@ -908,10 +908,10 @@ unsigned NSCountFrames(void)
|
|||
void *NSReturnAddress(int offset)
|
||||
{
|
||||
switch (offset) {
|
||||
_NS_RETURN_HACK( 0); _NS_RETURN_HACK( 1); _NS_RETURN_HACK( 2);
|
||||
_NS_RETURN_HACK( 3); _NS_RETURN_HACK( 4); _NS_RETURN_HACK( 5);
|
||||
_NS_RETURN_HACK( 6); _NS_RETURN_HACK( 7); _NS_RETURN_HACK( 8);
|
||||
_NS_RETURN_HACK( 9); _NS_RETURN_HACK(10); _NS_RETURN_HACK(11);
|
||||
_NS_RETURN_HACK(0); _NS_RETURN_HACK(1); _NS_RETURN_HACK(2);
|
||||
_NS_RETURN_HACK(3); _NS_RETURN_HACK(4); _NS_RETURN_HACK(5);
|
||||
_NS_RETURN_HACK(6); _NS_RETURN_HACK(7); _NS_RETURN_HACK(8);
|
||||
_NS_RETURN_HACK(9); _NS_RETURN_HACK(10); _NS_RETURN_HACK(11);
|
||||
_NS_RETURN_HACK(12); _NS_RETURN_HACK(13); _NS_RETURN_HACK(14);
|
||||
_NS_RETURN_HACK(15); _NS_RETURN_HACK(16); _NS_RETURN_HACK(17);
|
||||
_NS_RETURN_HACK(18); _NS_RETURN_HACK(19); _NS_RETURN_HACK(20);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/**
|
||||
NSDecimal functions
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -35,33 +35,33 @@
|
|||
#include "Foundation/NSUserDefaults.h"
|
||||
|
||||
/*
|
||||
This file provides two implementations of the NSDecimal functions.
|
||||
One is based on pure simple decimal mathematics, as we all learned it
|
||||
This file provides two implementations of the NSDecimal functions.
|
||||
One is based on pure simple decimal mathematics, as we all learned it
|
||||
in school. This version is rather slow and may be inexact in the extreme
|
||||
cases.
|
||||
cases.
|
||||
THIS IS TESTED AND WORKING.
|
||||
|
||||
The second implemenation requires the GMP library, the GNU math package,
|
||||
to do the hard work. This is very fast and accurate. But as GMP is not
|
||||
to do the hard work. This is very fast and accurate. But as GMP is not
|
||||
available on all computers this has to be switched on at compile time.
|
||||
THIS IS STILL NOT IMPLEMENTED.
|
||||
|
||||
The data structure used for NSDecimals is a bit strange. It also does not
|
||||
correspond to the description in the OpenStep specification. But this is
|
||||
not consistent, so a decision had to be made.
|
||||
The mantissa part (I know D. Knuth does not like this term, but it is used
|
||||
in the specification so we stay with it) consists of up to 38 digits, this
|
||||
The mantissa part (I know D. Knuth does not like this term, but it is used
|
||||
in the specification so we stay with it) consists of up to 38 digits, this
|
||||
are stored as an integer (in decimal representation or limps depending on the
|
||||
USE_GMP flag). And the exponent is stored in a signed character. As a result
|
||||
the numbers that can be represented are the ranges from -9(38 times)*10**127
|
||||
to -1*10**-128, the number 0 and 1*10**-128 to 9(38 times)*10**127.
|
||||
This means we have more big numbers than one would expect (almost up to 10**165)
|
||||
but small numbers can only be represented with limited exactness (one digit
|
||||
for -128, two for -127 and so on).
|
||||
I think this is as close as possible to the specification, but other
|
||||
interpretations are also valid. (Changing the exponent either absolut
|
||||
for -128, two for -127 and so on).
|
||||
I think this is as close as possible to the specification, but other
|
||||
interpretations are also valid. (Changing the exponent either absolut
|
||||
[eg minus 38] or relative to the number of digits in the mantissa [minus length].)
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#if USE_GMP
|
||||
|
@ -78,8 +78,8 @@ typedef struct {
|
|||
static NSDecimal zero = {0, NO, YES, 0, {0}};
|
||||
static NSDecimal one = {0, NO, YES, 1, {1}};
|
||||
|
||||
#define NSDECIMAL_IS_ZERO(num) (0 == num->size)
|
||||
#define GSDECIMAL_IS_ZERO(num) (0 == num->length)
|
||||
#define NSDECIMAL_IS_ZERO(num) (0 == num->size)
|
||||
#define GSDECIMAL_IS_ZERO(num) (0 == num->length)
|
||||
|
||||
#else
|
||||
|
||||
|
@ -98,8 +98,8 @@ typedef NSDecimal GSDecimal;
|
|||
static NSDecimal zero = {0, NO, YES, 0, {0}};
|
||||
static NSDecimal one = {0, NO, YES, 1, {1}};
|
||||
|
||||
#define NSDECIMAL_IS_ZERO(num) (0 == num->length)
|
||||
#define GSDECIMAL_IS_ZERO(num) (0 == num->length)
|
||||
#define NSDECIMAL_IS_ZERO(num) (0 == num->length)
|
||||
#define GSDECIMAL_IS_ZERO(num) (0 == num->length)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -115,7 +115,7 @@ GSDecimalCompact(GSDecimal *number)
|
|||
{
|
||||
int i, j;
|
||||
|
||||
//NSLog(@"Compact start %@ ", NSDecimalString(number, nil));
|
||||
//NSLog(@"Compact start %@ ", NSDecimalString(number, nil));
|
||||
if (!number->validNumber)
|
||||
return;
|
||||
|
||||
|
@ -157,7 +157,7 @@ GSDecimalCompact(GSDecimal *number)
|
|||
number->exponent = 0;
|
||||
number->isNegative = NO;
|
||||
}
|
||||
//NSLog(@"Compact end %@ ", NSDecimalString(number, nil));
|
||||
//NSLog(@"Compact end %@ ", NSDecimalString(number, nil));
|
||||
}
|
||||
|
||||
static NSComparisonResult
|
||||
|
@ -177,26 +177,26 @@ GSDecimalCompare(const GSDecimal *leftOperand, const GSDecimal *rightOperand)
|
|||
|
||||
// Same sign, check size
|
||||
if (s1 < s2)
|
||||
{
|
||||
{
|
||||
if (rightOperand->isNegative)
|
||||
return NSOrderedDescending;
|
||||
else
|
||||
return NSOrderedAscending;
|
||||
}
|
||||
if (s1 > s2)
|
||||
{
|
||||
{
|
||||
if (rightOperand->isNegative)
|
||||
return NSOrderedAscending;
|
||||
else
|
||||
return NSOrderedDescending;
|
||||
}
|
||||
|
||||
|
||||
// Same size, check digits
|
||||
l = MIN(leftOperand->length, rightOperand->length);
|
||||
for (i = 0; i < l; i++)
|
||||
{
|
||||
int d = rightOperand->cMantissa[i] - leftOperand->cMantissa[i];
|
||||
|
||||
|
||||
if (d > 0)
|
||||
{
|
||||
if (rightOperand->isNegative)
|
||||
|
@ -269,29 +269,29 @@ GSDecimalRound(GSDecimal *result, int scale, NSRoundingMode mode)
|
|||
|
||||
switch (mode)
|
||||
{
|
||||
case NSRoundDown:
|
||||
case NSRoundDown:
|
||||
up = result->isNegative;
|
||||
break;
|
||||
case NSRoundUp:
|
||||
case NSRoundUp:
|
||||
up = !result->isNegative;
|
||||
break;
|
||||
case NSRoundPlain:
|
||||
case NSRoundPlain:
|
||||
n = result->cMantissa[l];
|
||||
up = (n >= 5);
|
||||
break;
|
||||
case NSRoundBankers:
|
||||
case NSRoundBankers:
|
||||
n = result->cMantissa[l];
|
||||
if (n > 5)
|
||||
up = YES;
|
||||
else if (n < 5)
|
||||
up = NO;
|
||||
else
|
||||
else
|
||||
{
|
||||
if (0 == l)
|
||||
c = 0;
|
||||
else
|
||||
c = result->cMantissa[l-1];
|
||||
up = ((c % 2) != 0);
|
||||
up = ((c % 2) != 0);
|
||||
}
|
||||
break;
|
||||
default: // No way to get here
|
||||
|
@ -324,8 +324,8 @@ GSDecimalRound(GSDecimal *result, int scale, NSRoundingMode mode)
|
|||
result->length++;
|
||||
}
|
||||
else
|
||||
result->exponent++;;
|
||||
}
|
||||
result->exponent++;;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,7 @@ GSDecimalNormalize(GSDecimal *n1, GSDecimal *n2, NSRoundingMode mode)
|
|||
}
|
||||
n2->length += l;
|
||||
n2->exponent -= l;
|
||||
|
||||
|
||||
if (l != e2 - e1)
|
||||
{
|
||||
// Round of some digits from n1 to increase exponent
|
||||
|
@ -374,7 +374,7 @@ GSDecimalNormalize(GSDecimal *n1, GSDecimal *n2, NSRoundingMode mode)
|
|||
{
|
||||
n1->cMantissa[(int)n1->length] = 0;
|
||||
n1->length++;
|
||||
}
|
||||
}
|
||||
n1->exponent = n2->exponent;
|
||||
}
|
||||
return NSCalculationLossOfPrecision;
|
||||
|
@ -384,11 +384,11 @@ GSDecimalNormalize(GSDecimal *n1, GSDecimal *n2, NSRoundingMode mode)
|
|||
}
|
||||
|
||||
static NSCalculationError
|
||||
GSSimpleAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
||||
GSSimpleAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
||||
NSRoundingMode mode);
|
||||
|
||||
NSCalculationError
|
||||
NSDecimalAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
||||
NSDecimalAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
||||
NSRoundingMode mode)
|
||||
{
|
||||
NSCalculationError error = NSCalculationNoError;
|
||||
|
@ -432,14 +432,14 @@ NSDecimalAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
|||
}
|
||||
}
|
||||
|
||||
NSDecimalCopy(&n1, left);
|
||||
NSDecimalCopy(&n2, right);
|
||||
NSDecimalCopy(&n1, left);
|
||||
NSDecimalCopy(&n2, right);
|
||||
error = NSDecimalNormalize(&n1, &n2, mode);
|
||||
comp = NSSimpleCompare(&n1, &n2);
|
||||
/*
|
||||
NSLog(@"Add left %@ right %@", NSDecimalString(left, nil),
|
||||
NSLog(@"Add left %@ right %@", NSDecimalString(left, nil),
|
||||
NSDecimalString(right, nil));
|
||||
NSLog(@"Add n1 %@ n2 %@ comp %d", NSDecimalString(&n1, nil),
|
||||
NSLog(@"Add n1 %@ n2 %@ comp %d", NSDecimalString(&n1, nil),
|
||||
NSDecimalString(&n2, nil), comp);
|
||||
*/
|
||||
// both negative, make positive
|
||||
|
@ -483,11 +483,11 @@ NSDecimalAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
|||
}
|
||||
|
||||
static NSCalculationError
|
||||
GSSimpleSubtract(NSDecimal *result, const NSDecimal *left,
|
||||
GSSimpleSubtract(NSDecimal *result, const NSDecimal *left,
|
||||
const NSDecimal *right, NSRoundingMode mode);
|
||||
|
||||
NSCalculationError
|
||||
NSDecimalSubtract(NSDecimal *result, const NSDecimal *left,
|
||||
NSDecimalSubtract(NSDecimal *result, const NSDecimal *left,
|
||||
const NSDecimal *right, NSRoundingMode mode)
|
||||
{
|
||||
NSCalculationError error = NSCalculationNoError;
|
||||
|
@ -537,20 +537,20 @@ NSDecimalSubtract(NSDecimal *result, const NSDecimal *left,
|
|||
}
|
||||
}
|
||||
|
||||
NSDecimalCopy(&n1, left);
|
||||
NSDecimalCopy(&n2, right);
|
||||
NSDecimalCopy(&n1, left);
|
||||
NSDecimalCopy(&n2, right);
|
||||
error = NSDecimalNormalize(&n1, &n2, mode);
|
||||
|
||||
comp = NSDecimalCompare(left, right);
|
||||
/*
|
||||
NSLog(@"Sub left %@ right %@", NSDecimalString(left, nil),
|
||||
NSLog(@"Sub left %@ right %@", NSDecimalString(left, nil),
|
||||
NSDecimalString(right, nil));
|
||||
NSLog(@"Sub n1 %@ n2 %@ comp %d", NSDecimalString(&n1, nil),
|
||||
NSLog(@"Sub n1 %@ n2 %@ comp %d", NSDecimalString(&n1, nil),
|
||||
NSDecimalString(&n2, nil), comp);
|
||||
*/
|
||||
|
||||
if (NSOrderedSame == comp)
|
||||
{
|
||||
{
|
||||
NSDecimalCopy(result, &zero);
|
||||
return NSCalculationNoError;
|
||||
}
|
||||
|
@ -592,11 +592,11 @@ NSDecimalSubtract(NSDecimal *result, const NSDecimal *left,
|
|||
}
|
||||
|
||||
static NSCalculationError
|
||||
GSSimpleMultiply(NSDecimal *result, NSDecimal *l, NSDecimal *r,
|
||||
GSSimpleMultiply(NSDecimal *result, NSDecimal *l, NSDecimal *r,
|
||||
NSRoundingMode mode);
|
||||
|
||||
NSCalculationError
|
||||
NSDecimalMultiply(NSDecimal *result, const NSDecimal *l, const NSDecimal *r,
|
||||
NSDecimalMultiply(NSDecimal *result, const NSDecimal *l, const NSDecimal *r,
|
||||
NSRoundingMode mode)
|
||||
{
|
||||
NSCalculationError error = NSCalculationNoError;
|
||||
|
@ -674,7 +674,7 @@ NSDecimalMultiply(NSDecimal *result, const NSDecimal *l, const NSDecimal *r,
|
|||
}
|
||||
|
||||
NSCalculationError
|
||||
GSSimpleDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *r,
|
||||
GSSimpleDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *r,
|
||||
NSRoundingMode mode);
|
||||
|
||||
NSCalculationError
|
||||
|
@ -787,7 +787,7 @@ NSDecimalMultiplyByPowerOf10(NSDecimal *result, const NSDecimal *n, short power,
|
|||
result->validNumber = NO;
|
||||
return NSCalculationOverflow;
|
||||
}
|
||||
if (p < -128)
|
||||
if (p < -128)
|
||||
{
|
||||
result->validNumber = NO;
|
||||
return NSCalculationUnderflow;
|
||||
|
@ -809,7 +809,7 @@ GSDecimalString(const GSDecimal *number, NSDictionary *locale)
|
|||
if (!number->validNumber)
|
||||
return @"NaN";
|
||||
|
||||
if ((nil == locale) ||
|
||||
if ((nil == locale) ||
|
||||
(sep = [locale objectForKey: NSDecimalSeparator]) == nil)
|
||||
sep = @".";
|
||||
|
||||
|
@ -858,7 +858,7 @@ GSDecimalString(const GSDecimal *number, NSDictionary *locale)
|
|||
d = number->cMantissa[i];
|
||||
s = [NSString stringWithFormat: @"%d", d];
|
||||
[string appendString: s];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -881,7 +881,7 @@ GSDecimalString(const GSDecimal *number, NSDictionary *locale)
|
|||
return string;
|
||||
}
|
||||
|
||||
// GNUstep extensions to make the implementation of NSDecimalNumber totaly
|
||||
// GNUstep extensions to make the implementation of NSDecimalNumber totaly
|
||||
// independent for NSDecimals internal representation
|
||||
|
||||
// Give back the biggest NSDecimal
|
||||
|
@ -932,7 +932,7 @@ GSDecimalDouble(GSDecimal *number)
|
|||
|
||||
// Create a NSDecimal with a cMantissa, exponent and a negative flag
|
||||
void
|
||||
GSDecimalFromComponents(GSDecimal *result, unsigned long long mantissa,
|
||||
GSDecimalFromComponents(GSDecimal *result, unsigned long long mantissa,
|
||||
short exponent, BOOL negative)
|
||||
{
|
||||
unsigned char digit;
|
||||
|
@ -964,7 +964,7 @@ GSDecimalFromComponents(GSDecimal *result, unsigned long long mantissa,
|
|||
|
||||
// Create a NSDecimal from a string using the local
|
||||
void
|
||||
GSDecimalFromString(GSDecimal *result, NSString *numberValue,
|
||||
GSDecimalFromString(GSDecimal *result, NSString *numberValue,
|
||||
NSDictionary *locale)
|
||||
{
|
||||
NSRange found;
|
||||
|
@ -995,7 +995,7 @@ GSDecimalFromString(GSDecimal *result, NSString *numberValue,
|
|||
{
|
||||
result->cMantissa[i++] = *s - '0';
|
||||
result->length++;
|
||||
s++;
|
||||
s++;
|
||||
}
|
||||
s = [[numberValue substringFromIndex: NSMaxRange(found)] lossyCString];
|
||||
while ((*s) && (isdigit(*s)))
|
||||
|
@ -1003,7 +1003,7 @@ GSDecimalFromString(GSDecimal *result, NSString *numberValue,
|
|||
result->cMantissa[i++] = *s - '0';
|
||||
result->length++;
|
||||
result->exponent--;
|
||||
s++;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1020,14 +1020,14 @@ GSDecimalFromString(GSDecimal *result, NSString *numberValue,
|
|||
{
|
||||
result->cMantissa[i++] = *s - '0';
|
||||
result->length++;
|
||||
s++;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((*s == 'e') || (*s == 'E'))
|
||||
{
|
||||
s++;
|
||||
result->exponent += atoi(s);
|
||||
s++;
|
||||
result->exponent += atoi(s);
|
||||
}
|
||||
|
||||
if (!result->length)
|
||||
|
@ -1040,7 +1040,7 @@ GSDecimalFromString(GSDecimal *result, NSString *numberValue,
|
|||
|
||||
static void CharvecToDecimal(const GSDecimal *m, NSDecimal *n)
|
||||
{
|
||||
// Convert from a GSDecimal to a NSDecimal
|
||||
// Convert from a GSDecimal to a NSDecimal
|
||||
n->exponent = m->exponent;
|
||||
n->isNegative = m->isNegative;
|
||||
n->validNumber = m->validNumber;
|
||||
|
@ -1055,7 +1055,7 @@ static void CharvecToDecimal(const GSDecimal *m, NSDecimal *n)
|
|||
|
||||
static void DecimalToCharvec(const NSDecimal *n, GSDecimal *m)
|
||||
{
|
||||
// Convert from a NSDecimal to a GSDecimal
|
||||
// Convert from a NSDecimal to a GSDecimal
|
||||
m->exponent = n->exponent;
|
||||
m->isNegative = n->isNegative;
|
||||
m->validNumber = n->validNumber;
|
||||
|
@ -1064,10 +1064,10 @@ static void DecimalToCharvec(const NSDecimal *n, GSDecimal *m)
|
|||
{
|
||||
m->length = 0;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
NSDecimal n1;
|
||||
|
||||
|
||||
NSDecimalCopy(&n1, n);
|
||||
m->length = mpn_get_str(m->cMantissa, 10, n1.lMantissa, n->size);
|
||||
// Do a compact only if the first digit is zero
|
||||
|
@ -1104,7 +1104,7 @@ NSDecimalCompare(const NSDecimal *leftOperand, const NSDecimal *rightOperand)
|
|||
static NSComparisonResult
|
||||
NSSimpleCompare(const NSDecimal *leftOperand, const NSDecimal *rightOperand)
|
||||
{
|
||||
// This only checks the size of the operands.
|
||||
// This only checks the size of the operands.
|
||||
if (leftOperand->size == rightOperand->size)
|
||||
return NSOrderedSame;
|
||||
else if (leftOperand->size > rightOperand->size)
|
||||
|
@ -1114,7 +1114,7 @@ NSSimpleCompare(const NSDecimal *leftOperand, const NSDecimal *rightOperand)
|
|||
}
|
||||
|
||||
void
|
||||
NSDecimalRound(NSDecimal *result, const NSDecimal *number, int scale,
|
||||
NSDecimalRound(NSDecimal *result, const NSDecimal *number, int scale,
|
||||
NSRoundingMode mode)
|
||||
{
|
||||
GSDecimal m;
|
||||
|
@ -1141,69 +1141,69 @@ NSDecimalNormalize(NSDecimal *n1, NSDecimal *n2, NSRoundingMode mode)
|
|||
DecimalToCharvec(n1, &m1);
|
||||
DecimalToCharvec(n2, &m2);
|
||||
/*
|
||||
NSLog(@"Normalize n1 %@ n2 %@", NSDecimalString(n1, nil),
|
||||
NSLog(@"Normalize n1 %@ n2 %@", NSDecimalString(n1, nil),
|
||||
NSDecimalString(n2, nil));
|
||||
NSLog(@"Normalize m1 %@ m2 %@", GSDecimalString(&m1, nil),
|
||||
NSLog(@"Normalize m1 %@ m2 %@", GSDecimalString(&m1, nil),
|
||||
GSDecimalString(&m2, nil));
|
||||
*/
|
||||
error = GSDecimalNormalize(&m1, &m2, mode);
|
||||
CharvecToDecimal(&m1, n1);
|
||||
CharvecToDecimal(&m2, n2);
|
||||
/*
|
||||
NSLog(@"Normalized m1 %@ m2 %@", GSDecimalString(&m1, nil),
|
||||
NSLog(@"Normalized m1 %@ m2 %@", GSDecimalString(&m1, nil),
|
||||
GSDecimalString(&m2, nil));
|
||||
NSLog(@"Normalized n1 %@ n2 %@", NSDecimalString(n1, nil),
|
||||
NSLog(@"Normalized n1 %@ n2 %@", NSDecimalString(n1, nil),
|
||||
NSDecimalString(n2, nil));
|
||||
*/
|
||||
}
|
||||
|
||||
NSCalculationError
|
||||
GSSimpleAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
||||
GSSimpleAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
||||
NSRoundingMode mode)
|
||||
{
|
||||
NSCalculationError error = NSCalculationNoError;
|
||||
mp_limb_t carry;
|
||||
|
||||
NSDecimalCopy(result, left);
|
||||
NSDecimalCopy(result, left);
|
||||
if (0 == right->size)
|
||||
return error;
|
||||
|
||||
carry = mpn_add(result->lMantissa, left->lMantissa, left->size,
|
||||
right->lMantissa, right->size);
|
||||
carry = mpn_add(result->lMantissa, left->lMantissa, left->size,
|
||||
right->lMantissa, right->size);
|
||||
result->size = left->size;
|
||||
|
||||
// check carry
|
||||
// check carry
|
||||
if (carry)
|
||||
{
|
||||
result->lMantissa[result->size] = carry;
|
||||
result->size++;
|
||||
result->size++;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static NSCalculationError
|
||||
GSSimpleSubtract(NSDecimal *result, const NSDecimal *left,
|
||||
GSSimpleSubtract(NSDecimal *result, const NSDecimal *left,
|
||||
const NSDecimal *right, NSRoundingMode mode)
|
||||
{
|
||||
NSCalculationError error = NSCalculationNoError;
|
||||
mp_limb_t borrow;
|
||||
/*
|
||||
NSLog(@"SimpleSub left %@ right %@ size %d", NSDecimalString(left, nil),
|
||||
NSLog(@"SimpleSub left %@ right %@ size %d", NSDecimalString(left, nil),
|
||||
NSDecimalString(right, nil), right->size);
|
||||
*/
|
||||
NSDecimalCopy(result, left);
|
||||
NSDecimalCopy(result, left);
|
||||
if (0 == right->size)
|
||||
return error;
|
||||
|
||||
borrow = mpn_sub(result->lMantissa, left->lMantissa, left->size,
|
||||
right->lMantissa, right->size);
|
||||
borrow = mpn_sub(result->lMantissa, left->lMantissa, left->size,
|
||||
right->lMantissa, right->size);
|
||||
result->size = left->size;
|
||||
|
||||
// check borrow
|
||||
if (borrow)
|
||||
NSLog(@"Impossible error in substraction");
|
||||
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -1213,13 +1213,13 @@ GSSimpleMultiply(NSDecimal *result, NSDecimal *left, NSDecimal *right, NSRoundin
|
|||
NSCalculationError error = NSCalculationNoError;
|
||||
mp_limb_t limb;
|
||||
/*
|
||||
NSLog(@"SimpleMul left %@ right %@ size %d", NSDecimalString(left, nil),
|
||||
NSLog(@"SimpleMul left %@ right %@ size %d", NSDecimalString(left, nil),
|
||||
NSDecimalString(right, nil), right->size);
|
||||
*/
|
||||
NSDecimalCopy(result, &zero);
|
||||
NSDecimalCopy(result, &zero);
|
||||
// FIXME: Make sure result is big enougth
|
||||
limb = mpn_mul(result->lMantissa, left->lMantissa, left->size,
|
||||
right->lMantissa, right->size);
|
||||
limb = mpn_mul(result->lMantissa, left->lMantissa, left->size,
|
||||
right->lMantissa, right->size);
|
||||
|
||||
if (limb)
|
||||
{
|
||||
|
@ -1230,25 +1230,25 @@ GSSimpleMultiply(NSDecimal *result, NSDecimal *left, NSDecimal *right, NSRoundin
|
|||
//NSLog(@"Limb not set");
|
||||
result->size = left->size + right->size - 1;
|
||||
}
|
||||
// NSLog(@"SimpleMul result %@", NSDecimalString(result, nil));
|
||||
// NSLog(@"SimpleMul result %@", NSDecimalString(result, nil));
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
NSCalculationError
|
||||
GSSimpleDivide(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
||||
GSSimpleDivide(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
||||
NSRoundingMode mode)
|
||||
{
|
||||
NSCalculationError error = NSCalculationNoError;
|
||||
mp_limb_t limb;
|
||||
mp_size_t x = 38 + right->size - left->size;
|
||||
NSDecimal n;
|
||||
|
||||
|
||||
NSDecimalCopy(&n, left);
|
||||
|
||||
// FIXME: I don't understand how to do this
|
||||
limb = mpn_divrem (result->lMantissa, x, n.lMantissa, left->size,
|
||||
right->lMantissa, right->size);
|
||||
right->lMantissa, right->size);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
@ -1272,7 +1272,7 @@ NSDecimalDouble(NSDecimal *number)
|
|||
}
|
||||
|
||||
void
|
||||
NSDecimalFromComponents(NSDecimal *result, unsigned long long mantissa,
|
||||
NSDecimalFromComponents(NSDecimal *result, unsigned long long mantissa,
|
||||
short exponent, BOOL negative)
|
||||
{
|
||||
GSDecimal n;
|
||||
|
@ -1288,7 +1288,7 @@ NSDecimalFromComponents(NSDecimal *result, unsigned long long mantissa,
|
|||
}
|
||||
|
||||
void
|
||||
NSDecimalFromString(NSDecimal *result, NSString *numberValue,
|
||||
NSDecimalFromString(NSDecimal *result, NSString *numberValue,
|
||||
NSDictionary *locale)
|
||||
{
|
||||
GSDecimal n;
|
||||
|
@ -1304,7 +1304,7 @@ NSDecimalFromString(NSDecimal *result, NSString *numberValue,
|
|||
void
|
||||
NSDecimalCompact(NSDecimal *number)
|
||||
{
|
||||
GSDecimalCompact(number);
|
||||
GSDecimalCompact(number);
|
||||
}
|
||||
|
||||
NSComparisonResult
|
||||
|
@ -1314,12 +1314,12 @@ NSDecimalCompare(const NSDecimal *leftOperand, const NSDecimal *rightOperand)
|
|||
}
|
||||
|
||||
void
|
||||
NSDecimalRound(NSDecimal *result, const NSDecimal *number, int scale,
|
||||
NSDecimalRound(NSDecimal *result, const NSDecimal *number, int scale,
|
||||
NSRoundingMode mode)
|
||||
{
|
||||
NSDecimalCopy(result, number);
|
||||
|
||||
GSDecimalRound(result, scale, mode);
|
||||
|
||||
GSDecimalRound(result, scale, mode);
|
||||
}
|
||||
|
||||
NSCalculationError
|
||||
|
@ -1338,7 +1338,7 @@ NSDecimalNormalize(NSDecimal *n1, NSDecimal *n2, NSRoundingMode mode)
|
|||
static NSComparisonResult
|
||||
NSSimpleCompare(const NSDecimal *leftOperand, const NSDecimal *rightOperand)
|
||||
{
|
||||
// This only checks the length of the operands.
|
||||
// This only checks the length of the operands.
|
||||
if (leftOperand->length == rightOperand->length)
|
||||
return NSOrderedSame;
|
||||
else if (leftOperand->length > rightOperand->length)
|
||||
|
@ -1348,17 +1348,17 @@ NSSimpleCompare(const NSDecimal *leftOperand, const NSDecimal *rightOperand)
|
|||
}
|
||||
|
||||
static NSCalculationError
|
||||
GSSimpleAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
||||
GSSimpleAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
||||
NSRoundingMode mode)
|
||||
{
|
||||
// left and right are both valid and positive, non-zero. The have been normalized and
|
||||
// left and right are both valid and positive, non-zero. The have been normalized and
|
||||
// left is bigger than right. result, left and right all point to different entities.
|
||||
// Result will not be compacted.
|
||||
NSCalculationError error = NSCalculationNoError;
|
||||
int i, j, l, d;
|
||||
int carry = 0;
|
||||
|
||||
NSDecimalCopy(result, left);
|
||||
NSDecimalCopy(result, left);
|
||||
j = left->length - right->length;
|
||||
l = right->length;
|
||||
|
||||
|
@ -1393,10 +1393,10 @@ GSSimpleAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
|||
if (carry)
|
||||
{
|
||||
// The number must be shifted to the right
|
||||
if (NSDecimalMaxDigit == result->length)
|
||||
if (NSDecimalMaxDigit == result->length)
|
||||
{
|
||||
NSDecimalRound(result, result,
|
||||
NSDecimalMaxDigit - 1 - result->exponent,
|
||||
NSDecimalRound(result, result,
|
||||
NSDecimalMaxDigit - 1 - result->exponent,
|
||||
mode);
|
||||
}
|
||||
|
||||
|
@ -1404,7 +1404,7 @@ GSSimpleAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
|||
{
|
||||
result->validNumber = NO;
|
||||
error = NSCalculationOverflow;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = result->length-1; i >= 0; i--)
|
||||
{
|
||||
|
@ -1413,16 +1413,16 @@ GSSimpleAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right,
|
|||
result->cMantissa[0] = 1;
|
||||
result->length++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static NSCalculationError
|
||||
GSSimpleSubtract(NSDecimal *result, const NSDecimal *left,
|
||||
GSSimpleSubtract(NSDecimal *result, const NSDecimal *left,
|
||||
const NSDecimal *right, NSRoundingMode mode)
|
||||
{
|
||||
// left and right are both valid and positive, non-zero. The have been normalized and
|
||||
// left and right are both valid and positive, non-zero. The have been normalized and
|
||||
// left is bigger than right. result, left and right all point to different entities.
|
||||
// Result will not be compacted.
|
||||
NSCalculationError error = NSCalculationNoError;
|
||||
|
@ -1430,7 +1430,7 @@ GSSimpleSubtract(NSDecimal *result, const NSDecimal *left,
|
|||
int borrow = 0;
|
||||
|
||||
j = left->length - right->length;
|
||||
NSDecimalCopy(result, left);
|
||||
NSDecimalCopy(result, left);
|
||||
l = right->length;
|
||||
|
||||
// Now subtract all digits
|
||||
|
@ -1462,7 +1462,7 @@ GSSimpleSubtract(NSDecimal *result, const NSDecimal *left,
|
|||
|
||||
if (-1 == i)
|
||||
{
|
||||
NSLog(@"Impossible error in substraction left: %@, right: %@",
|
||||
NSLog(@"Impossible error in substraction left: %@, right: %@",
|
||||
NSDecimalString(left, nil), NSDecimalString(right, nil));
|
||||
}
|
||||
}
|
||||
|
@ -1536,7 +1536,7 @@ GSSimpleMultiply(NSDecimal *result, NSDecimal *l, NSDecimal *r, NSRoundingMode m
|
|||
}
|
||||
|
||||
NSCalculationError
|
||||
GSSimpleDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *r,
|
||||
GSSimpleDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *r,
|
||||
NSRoundingMode mode)
|
||||
{
|
||||
NSCalculationError error = NSCalculationNoError;
|
||||
|
@ -1550,7 +1550,7 @@ GSSimpleDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *r,
|
|||
k = 0;
|
||||
used = 0;
|
||||
|
||||
while ((k < l->length ) || (n1.length))
|
||||
while ((k < l->length) || (n1.length))
|
||||
{
|
||||
while (NSOrderedAscending == NSDecimalCompare(&n1, r))
|
||||
{
|
||||
|
@ -1590,7 +1590,7 @@ GSSimpleDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *r,
|
|||
result->exponent--;
|
||||
}
|
||||
k++;
|
||||
result->cMantissa[k-1] = 0;
|
||||
result->cMantissa[k-1] = 0;
|
||||
result->length++;
|
||||
}
|
||||
}
|
||||
|
@ -1604,7 +1604,7 @@ GSSimpleDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *r,
|
|||
error1 = NSDecimalSubtract(&n1, &n1, r, mode);
|
||||
if (NSCalculationNoError != error1)
|
||||
error = error1;
|
||||
result->cMantissa[k-1]++;
|
||||
result->cMantissa[k-1]++;
|
||||
}
|
||||
|
||||
return error;
|
||||
|
@ -1616,7 +1616,7 @@ NSDecimalString(const NSDecimal *decimal, NSDictionary *locale)
|
|||
return GSDecimalString(decimal, locale);
|
||||
}
|
||||
|
||||
// GNUstep extensions to make the implementation of NSDecimalNumber totaly
|
||||
// GNUstep extensions to make the implementation of NSDecimalNumber totaly
|
||||
// independent for NSDecimals internal representation
|
||||
|
||||
double
|
||||
|
@ -1626,17 +1626,17 @@ NSDecimalDouble(NSDecimal *number)
|
|||
}
|
||||
|
||||
void
|
||||
NSDecimalFromComponents(NSDecimal *result, unsigned long long mantissa,
|
||||
NSDecimalFromComponents(NSDecimal *result, unsigned long long mantissa,
|
||||
short exponent, BOOL negative)
|
||||
{
|
||||
GSDecimalFromComponents(result, mantissa, exponent, negative);
|
||||
}
|
||||
|
||||
void
|
||||
NSDecimalFromString(NSDecimal *result, NSString *numberValue,
|
||||
NSDecimalFromString(NSDecimal *result, NSString *numberValue,
|
||||
NSDictionary *locale)
|
||||
{
|
||||
GSDecimalFromString(result, numberValue, locale);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/**
|
||||
NSDecimalNumber class
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
// shared default behavior for NSDecimalNumber class
|
||||
static NSDecimalNumberHandler *handler;
|
||||
|
||||
|
||||
@implementation NSDecimalNumberHandler
|
||||
|
||||
+ (id) defaultDecimalNumberHandler
|
||||
|
@ -48,47 +48,47 @@ static NSDecimalNumberHandler *handler;
|
|||
return handler;
|
||||
}
|
||||
|
||||
+ (id) decimalNumberHandlerWithRoundingMode: (NSRoundingMode)roundingMode
|
||||
+ (id) decimalNumberHandlerWithRoundingMode: (NSRoundingMode)roundingMode
|
||||
scale: (short)scale
|
||||
raiseOnExactness: (BOOL)raiseOnExactness
|
||||
raiseOnOverflow: (BOOL)raiseOnOverflow
|
||||
raiseOnExactness: (BOOL)raiseOnExactness
|
||||
raiseOnOverflow: (BOOL)raiseOnOverflow
|
||||
raiseOnUnderflow: (BOOL)raiseOnUnderflow
|
||||
raiseOnDivideByZero: (BOOL)raiseOnDivideByZero
|
||||
{
|
||||
return AUTORELEASE([[self alloc] initWithRoundingMode: roundingMode
|
||||
scale: scale
|
||||
return AUTORELEASE([[self alloc] initWithRoundingMode: roundingMode
|
||||
scale: scale
|
||||
raiseOnExactness: raiseOnExactness
|
||||
raiseOnOverflow: raiseOnOverflow
|
||||
raiseOnOverflow: raiseOnOverflow
|
||||
raiseOnUnderflow: raiseOnUnderflow
|
||||
raiseOnDivideByZero: raiseOnDivideByZero]);
|
||||
}
|
||||
|
||||
- (id) initWithRoundingMode: (NSRoundingMode)roundingMode
|
||||
scale: (short)scale
|
||||
- (id) initWithRoundingMode: (NSRoundingMode)roundingMode
|
||||
scale: (short)scale
|
||||
raiseOnExactness: (BOOL)raiseOnExactness
|
||||
raiseOnOverflow: (BOOL)raiseOnOverflow
|
||||
raiseOnOverflow: (BOOL)raiseOnOverflow
|
||||
raiseOnUnderflow: (BOOL)raiseOnUnderflow
|
||||
raiseOnDivideByZero: (BOOL)raiseOnDivideByZero
|
||||
{
|
||||
_roundingMode = roundingMode;
|
||||
_scale = scale;
|
||||
_raiseOnExactness = raiseOnExactness;
|
||||
_raiseOnOverflow = raiseOnOverflow;
|
||||
_raiseOnOverflow = raiseOnOverflow;
|
||||
_raiseOnUnderflow = raiseOnUnderflow;
|
||||
_raiseOnDivideByZero = raiseOnDivideByZero;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSDecimalNumber*) exceptionDuringOperation: (SEL)method
|
||||
error: (NSCalculationError)error
|
||||
leftOperand: (NSDecimalNumber*)leftOperand
|
||||
- (NSDecimalNumber*) exceptionDuringOperation: (SEL)method
|
||||
error: (NSCalculationError)error
|
||||
leftOperand: (NSDecimalNumber*)leftOperand
|
||||
rightOperand: (NSDecimalNumber*)rightOperand
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
case NSCalculationNoError: return nil;
|
||||
case NSCalculationUnderflow:
|
||||
case NSCalculationUnderflow:
|
||||
if (_raiseOnUnderflow)
|
||||
// FIXME: What exception to raise?
|
||||
[NSException raise: @"NSDecimalNumberException"
|
||||
|
@ -96,21 +96,21 @@ static NSDecimalNumberHandler *handler;
|
|||
else
|
||||
return [NSDecimalNumber minimumDecimalNumber];
|
||||
break;
|
||||
case NSCalculationOverflow:
|
||||
case NSCalculationOverflow:
|
||||
if (_raiseOnOverflow)
|
||||
[NSException raise: @"NSDecimalNumberException"
|
||||
format: @"Overflow"];
|
||||
else
|
||||
return [NSDecimalNumber maximumDecimalNumber];
|
||||
break;
|
||||
case NSCalculationLossOfPrecision:
|
||||
case NSCalculationLossOfPrecision:
|
||||
if (_raiseOnExactness)
|
||||
[NSException raise: @"NSDecimalNumberException"
|
||||
format: @"Loss of precision"];
|
||||
else
|
||||
return nil;
|
||||
break;
|
||||
case NSCalculationDivideByZero:
|
||||
case NSCalculationDivideByZero:
|
||||
if (_raiseOnDivideByZero)
|
||||
[NSException raise: @"NSDecimalNumberException"
|
||||
format: @"Divide by zero"];
|
||||
|
@ -170,7 +170,7 @@ static NSDecimalNumber *one;
|
|||
+ (void) setDefaultBehavior: (id <NSDecimalNumberBehaviors>)behavior
|
||||
{
|
||||
// Reuse the handler from the class NSDecimalNumberHandler
|
||||
// Might give interessting result on this class as behavior may came
|
||||
// Might give interessting result on this class as behavior may came
|
||||
// from a different class
|
||||
ASSIGN(handler, behavior);
|
||||
}
|
||||
|
@ -204,11 +204,11 @@ static NSDecimalNumber *one;
|
|||
return AUTORELEASE([[self alloc] initWithDecimal: decimal]);
|
||||
}
|
||||
|
||||
+ (NSDecimalNumber*) decimalNumberWithMantissa: (unsigned long long)mantissa
|
||||
+ (NSDecimalNumber*) decimalNumberWithMantissa: (unsigned long long)mantissa
|
||||
exponent: (short)exponent
|
||||
isNegative: (BOOL)isNegative
|
||||
{
|
||||
return AUTORELEASE([[self alloc] initWithMantissa: mantissa
|
||||
return AUTORELEASE([[self alloc] initWithMantissa: mantissa
|
||||
exponent: exponent
|
||||
isNegative: isNegative]);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ static NSDecimalNumber *one;
|
|||
return AUTORELEASE([[self alloc] initWithString: numericString]);
|
||||
}
|
||||
|
||||
+ (NSDecimalNumber*) decimalNumberWithString: (NSString*)numericString
|
||||
+ (NSDecimalNumber*) decimalNumberWithString: (NSString*)numericString
|
||||
locale: (NSDictionary*)locale
|
||||
{
|
||||
return AUTORELEASE([[self alloc] initWithString: numericString
|
||||
|
@ -247,8 +247,8 @@ static NSDecimalNumber *one;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithMantissa: (unsigned long long)mantissa
|
||||
exponent: (short)exponent
|
||||
- (id) initWithMantissa: (unsigned long long)mantissa
|
||||
exponent: (short)exponent
|
||||
isNegative: (BOOL)flag
|
||||
{
|
||||
NSDecimal decimal;
|
||||
|
@ -259,11 +259,11 @@ static NSDecimalNumber *one;
|
|||
|
||||
- (id) initWithString: (NSString*)numberValue
|
||||
{
|
||||
return [self initWithString: numberValue
|
||||
return [self initWithString: numberValue
|
||||
locale: GSUserDefaultsDictionaryRepresentation()];
|
||||
}
|
||||
|
||||
- (id) initWithString: (NSString*)numberValue
|
||||
- (id) initWithString: (NSString*)numberValue
|
||||
locale: (NSDictionary*)locale
|
||||
{
|
||||
NSDecimal decimal;
|
||||
|
@ -419,7 +419,7 @@ static NSDecimalNumber *one;
|
|||
- (NSDecimal) decimalValue
|
||||
{
|
||||
NSDecimal decimal;
|
||||
|
||||
|
||||
NSDecimalCopy(&decimal, &data);
|
||||
return decimal;
|
||||
}
|
||||
|
@ -455,11 +455,11 @@ static NSDecimalNumber *one;
|
|||
|
||||
- (NSDecimalNumber*) decimalNumberByAdding: (NSDecimalNumber*)decimalNumber
|
||||
{
|
||||
return [self decimalNumberByAdding: decimalNumber
|
||||
return [self decimalNumberByAdding: decimalNumber
|
||||
withBehavior: [isa defaultBehavior]];
|
||||
}
|
||||
|
||||
- (NSDecimalNumber*) decimalNumberByAdding: (NSDecimalNumber*)decimalNumber
|
||||
- (NSDecimalNumber*) decimalNumberByAdding: (NSDecimalNumber*)decimalNumber
|
||||
withBehavior: (id<NSDecimalNumberBehaviors>)behavior
|
||||
{
|
||||
NSDecimal result;
|
||||
|
@ -471,20 +471,20 @@ static NSDecimalNumber *one;
|
|||
error = NSDecimalAdd(&result, &d1, &d2, [behavior roundingMode]);
|
||||
if (error)
|
||||
{
|
||||
res = [behavior exceptionDuringOperation: _cmd
|
||||
error: error
|
||||
leftOperand: self
|
||||
res = [behavior exceptionDuringOperation: _cmd
|
||||
error: error
|
||||
leftOperand: self
|
||||
rightOperand: decimalNumber];
|
||||
if (res != nil)
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
return [NSDecimalNumber decimalNumberWithDecimal: result];
|
||||
}
|
||||
|
||||
- (NSDecimalNumber*) decimalNumberBySubtracting: (NSDecimalNumber*)decimalNumber
|
||||
{
|
||||
return [self decimalNumberBySubtracting: decimalNumber
|
||||
return [self decimalNumberBySubtracting: decimalNumber
|
||||
withBehavior: [isa defaultBehavior]];
|
||||
}
|
||||
|
||||
|
@ -500,26 +500,26 @@ static NSDecimalNumber *one;
|
|||
error = NSDecimalSubtract(&result, &d1, &d2, [behavior roundingMode]);
|
||||
if (error)
|
||||
{
|
||||
res = [behavior exceptionDuringOperation: _cmd
|
||||
error: error
|
||||
leftOperand: self
|
||||
res = [behavior exceptionDuringOperation: _cmd
|
||||
error: error
|
||||
leftOperand: self
|
||||
rightOperand: decimalNumber];
|
||||
if (res != nil)
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
return [NSDecimalNumber decimalNumberWithDecimal: result];
|
||||
}
|
||||
|
||||
- (NSDecimalNumber*) decimalNumberByMultiplyingBy:
|
||||
(NSDecimalNumber*)decimalNumber
|
||||
{
|
||||
return [self decimalNumberByMultiplyingBy: decimalNumber
|
||||
return [self decimalNumberByMultiplyingBy: decimalNumber
|
||||
withBehavior: [isa defaultBehavior]];
|
||||
}
|
||||
|
||||
- (NSDecimalNumber*) decimalNumberByMultiplyingBy:
|
||||
(NSDecimalNumber*)decimalNumber
|
||||
(NSDecimalNumber*)decimalNumber
|
||||
withBehavior: (id <NSDecimalNumberBehaviors>)behavior
|
||||
{
|
||||
NSDecimal result;
|
||||
|
@ -531,24 +531,24 @@ static NSDecimalNumber *one;
|
|||
error = NSDecimalMultiply(&result, &d1, &d2, [behavior roundingMode]);
|
||||
if (error)
|
||||
{
|
||||
res = [behavior exceptionDuringOperation: _cmd
|
||||
error: error
|
||||
leftOperand: self
|
||||
res = [behavior exceptionDuringOperation: _cmd
|
||||
error: error
|
||||
leftOperand: self
|
||||
rightOperand: decimalNumber];
|
||||
if (res != nil)
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
return [NSDecimalNumber decimalNumberWithDecimal: result];
|
||||
}
|
||||
|
||||
- (NSDecimalNumber*) decimalNumberByDividingBy: (NSDecimalNumber*)decimalNumber
|
||||
{
|
||||
return [self decimalNumberByDividingBy: decimalNumber
|
||||
return [self decimalNumberByDividingBy: decimalNumber
|
||||
withBehavior: [isa defaultBehavior]];
|
||||
}
|
||||
|
||||
- (NSDecimalNumber*) decimalNumberByDividingBy: (NSDecimalNumber*)decimalNumber
|
||||
- (NSDecimalNumber*) decimalNumberByDividingBy: (NSDecimalNumber*)decimalNumber
|
||||
withBehavior: (id <NSDecimalNumberBehaviors>)behavior
|
||||
{
|
||||
NSDecimal result;
|
||||
|
@ -560,24 +560,24 @@ static NSDecimalNumber *one;
|
|||
error = NSDecimalDivide(&result, &d1, &d2, [behavior roundingMode]);
|
||||
if (error)
|
||||
{
|
||||
res = [behavior exceptionDuringOperation: _cmd
|
||||
error: error
|
||||
leftOperand: self
|
||||
res = [behavior exceptionDuringOperation: _cmd
|
||||
error: error
|
||||
leftOperand: self
|
||||
rightOperand: decimalNumber];
|
||||
if (res != nil)
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
return [NSDecimalNumber decimalNumberWithDecimal: result];
|
||||
}
|
||||
|
||||
- (NSDecimalNumber*) decimalNumberByMultiplyingByPowerOf10: (short)power
|
||||
{
|
||||
return [self decimalNumberByMultiplyingByPowerOf10: power
|
||||
return [self decimalNumberByMultiplyingByPowerOf10: power
|
||||
withBehavior: [isa defaultBehavior]];
|
||||
}
|
||||
|
||||
- (NSDecimalNumber*) decimalNumberByMultiplyingByPowerOf10: (short)power
|
||||
- (NSDecimalNumber*) decimalNumberByMultiplyingByPowerOf10: (short)power
|
||||
withBehavior: (id <NSDecimalNumberBehaviors>)behavior
|
||||
{
|
||||
NSDecimal result;
|
||||
|
@ -585,28 +585,28 @@ static NSDecimalNumber *one;
|
|||
NSCalculationError error;
|
||||
NSDecimalNumber *res;
|
||||
|
||||
error = NSDecimalMultiplyByPowerOf10(&result, &d1,
|
||||
error = NSDecimalMultiplyByPowerOf10(&result, &d1,
|
||||
power, [behavior roundingMode]);
|
||||
if (error)
|
||||
{
|
||||
res = [behavior exceptionDuringOperation: _cmd
|
||||
error: error
|
||||
leftOperand: self
|
||||
res = [behavior exceptionDuringOperation: _cmd
|
||||
error: error
|
||||
leftOperand: self
|
||||
rightOperand: nil];
|
||||
if (res != nil)
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
return [NSDecimalNumber decimalNumberWithDecimal: result];
|
||||
}
|
||||
|
||||
- (NSDecimalNumber*) decimalNumberByRaisingToPower: (unsigned)power
|
||||
{
|
||||
return [self decimalNumberByRaisingToPower: power
|
||||
return [self decimalNumberByRaisingToPower: power
|
||||
withBehavior: [isa defaultBehavior]];
|
||||
}
|
||||
|
||||
- (NSDecimalNumber*) decimalNumberByRaisingToPower: (unsigned)power
|
||||
- (NSDecimalNumber*) decimalNumberByRaisingToPower: (unsigned)power
|
||||
withBehavior: (id <NSDecimalNumberBehaviors>)behavior
|
||||
{
|
||||
NSDecimal result;
|
||||
|
@ -614,18 +614,18 @@ static NSDecimalNumber *one;
|
|||
NSCalculationError error;
|
||||
NSDecimalNumber *res;
|
||||
|
||||
error = NSDecimalPower(&result, &d1,
|
||||
error = NSDecimalPower(&result, &d1,
|
||||
power, [behavior roundingMode]);
|
||||
if (error)
|
||||
{
|
||||
res = [behavior exceptionDuringOperation: _cmd
|
||||
error: error
|
||||
leftOperand: self
|
||||
res = [behavior exceptionDuringOperation: _cmd
|
||||
error: error
|
||||
leftOperand: self
|
||||
rightOperand: nil];
|
||||
if (res != nil)
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
return [NSDecimalNumber decimalNumberWithDecimal: result];
|
||||
}
|
||||
|
||||
|
@ -641,14 +641,14 @@ static NSDecimalNumber *one;
|
|||
|
||||
|
||||
// Methods for NSDecimalNumberBehaviors
|
||||
- (NSDecimalNumber*) exceptionDuringOperation: (SEL)method
|
||||
error: (NSCalculationError)error
|
||||
leftOperand: (NSDecimalNumber*)leftOperand
|
||||
- (NSDecimalNumber*) exceptionDuringOperation: (SEL)method
|
||||
error: (NSCalculationError)error
|
||||
leftOperand: (NSDecimalNumber*)leftOperand
|
||||
rightOperand: (NSDecimalNumber*)rightOperand
|
||||
{
|
||||
return [[isa defaultBehavior] exceptionDuringOperation: method
|
||||
error: error
|
||||
leftOperand: leftOperand
|
||||
return [[isa defaultBehavior] exceptionDuringOperation: method
|
||||
error: error
|
||||
leftOperand: leftOperand
|
||||
rightOperand: rightOperand];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/** NSDictionary - Dictionary object to store key/value pairs
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
From skeleton by: Adam Fedor <fedor@boulder.colorado.edu>
|
||||
Date: Mar 1995
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -65,7 +65,7 @@
|
|||
* accessed from multiple threads you should enclose critical operations
|
||||
* within locks (see [NSLock]).</p>
|
||||
*/
|
||||
@implementation NSDictionary
|
||||
@implementation NSDictionary
|
||||
|
||||
@class GSDictionary;
|
||||
@class GSMutableDictionary;
|
||||
|
@ -309,9 +309,9 @@ static SEL appSel;
|
|||
id keys;
|
||||
id objects;
|
||||
|
||||
keys = [(NSKeyedUnarchiver*)aCoder _decodeArrayOfObjectsForKey:
|
||||
keys = [(NSKeyedUnarchiver*)aCoder _decodeArrayOfObjectsForKey:
|
||||
@"NS.keys"];
|
||||
objects = [(NSKeyedUnarchiver*)aCoder _decodeArrayOfObjectsForKey:
|
||||
objects = [(NSKeyedUnarchiver*)aCoder _decodeArrayOfObjectsForKey:
|
||||
@"NS.objects"];
|
||||
if (keys == nil)
|
||||
{
|
||||
|
@ -348,7 +348,7 @@ static SEL appSel;
|
|||
id *vals = NSZoneMalloc(NSDefaultMallocZone(), sizeof(id)*count);
|
||||
unsigned i;
|
||||
IMP dec;
|
||||
|
||||
|
||||
dec = [aCoder methodForSelector: @selector(decodeObject)];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ static SEL appSel;
|
|||
* The n th element of the objects array is associated with the n th
|
||||
* element of the keys array.
|
||||
*/
|
||||
+ (id) dictionaryWithObjects: (id*)objects
|
||||
+ (id) dictionaryWithObjects: (id*)objects
|
||||
forKeys: (id*)keys
|
||||
count: (unsigned)count
|
||||
{
|
||||
|
@ -410,7 +410,7 @@ static SEL appSel;
|
|||
- (id) initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys
|
||||
{
|
||||
unsigned objectCount = [objects count];
|
||||
|
||||
|
||||
if (objectCount != [keys count])
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
|
@ -551,7 +551,7 @@ static SEL appSel;
|
|||
* will be released and the method will return nil.
|
||||
* </p>
|
||||
* <p>Works by invoking [NSString-initWithContentsOfFile:] and
|
||||
* [NSString-propertyList] then checking that the result is a dictionary.
|
||||
* [NSString-propertyList] then checking that the result is a dictionary.
|
||||
* </p>
|
||||
*/
|
||||
- (id) initWithContentsOfFile: (NSString*)path
|
||||
|
@ -604,7 +604,7 @@ static SEL appSel;
|
|||
* will be released and the method will return nil.
|
||||
* </p>
|
||||
* <p>Works by invoking [NSString-initWithContentsOfURL:] and
|
||||
* [NSString-propertyList] then checking that the result is a dictionary.
|
||||
* [NSString-propertyList] then checking that the result is a dictionary.
|
||||
* </p>
|
||||
*/
|
||||
- (id) initWithContentsOfURL: (NSURL*)aURL
|
||||
|
@ -826,7 +826,7 @@ static SEL appSel;
|
|||
}
|
||||
|
||||
struct foo { NSDictionary *d; SEL s; IMP i; };
|
||||
|
||||
|
||||
static int
|
||||
compareIt(id o1, id o2, void* context)
|
||||
{
|
||||
|
@ -1107,7 +1107,7 @@ compareIt(id o1, id o2, void* context)
|
|||
o[count + i] = (*objImp)(self, objSel, key);
|
||||
o[count + i] = [o[count + i] copyWithZone: z];
|
||||
}
|
||||
newDictionary = [[GSDictionaryClass allocWithZone: z]
|
||||
newDictionary = [[GSDictionaryClass allocWithZone: z]
|
||||
initWithObjects: o + count
|
||||
forKeys: o
|
||||
count: count];
|
||||
|
|
|
@ -280,7 +280,7 @@ enum proxyLocation
|
|||
/*
|
||||
# If there already exists a connection for talking to the
|
||||
* out port, we use that one rather than creating a new one from
|
||||
* our listening port.
|
||||
* our listening port.
|
||||
*
|
||||
* First we try for a connection from our receive port,
|
||||
* Then we try any connection to the send port
|
||||
|
|
|
@ -81,7 +81,7 @@ static NSFileManager *mgr = nil;
|
|||
attributes = [mgr fileAttributesAtPath: _lockPath traverseLink: YES];
|
||||
if ([modDate isEqual: [attributes fileModificationDate]] == YES)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Failed to remove lock directory '%@' - %s",
|
||||
_lockPath, err];
|
||||
}
|
||||
|
|
|
@ -644,7 +644,7 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
Protocol *p = @protocol(GDNCProtocol);
|
||||
|
||||
[_remote setProtocolForProxy: p];
|
||||
|
||||
|
||||
/*
|
||||
* Ensure that this center can be used safely from different
|
||||
* threads.
|
||||
|
@ -707,7 +707,7 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
recursion = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
recursion = NO;
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"unable to contact GDNC server -\n"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
|
|
@ -3,23 +3,23 @@
|
|||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: May 2004
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
|
|
@ -87,7 +87,7 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
}
|
||||
|
||||
// Allocating and Initializing a FileHandle Object
|
||||
/**
|
||||
/**
|
||||
* Returns an <code>NSFileHandle</code> object set up for reading from the
|
||||
* file listed at path. If the file does not exist or cannot
|
||||
* be opened for some other reason, nil is returned.
|
||||
|
@ -99,7 +99,7 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
return AUTORELEASE([o initForReadingAtPath: path]);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an <code>NSFileHandle</code> object set up for writing to the
|
||||
* file listed at path. If the file does not exist or cannot
|
||||
* be opened for some other reason, nil is returned.
|
||||
|
@ -111,7 +111,7 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
return AUTORELEASE([o initForWritingAtPath: path]);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an <code>NSFileHandle</code> object setup for updating (reading and
|
||||
* writing) from the file listed at path. If the file does not exist
|
||||
* or cannot be opened for some other reason, nil is returned.
|
||||
|
@ -123,7 +123,7 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
return AUTORELEASE([o initForUpdatingAtPath: path]);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an <code>NSFileHandle</code> object for the standard error
|
||||
* descriptor. The returned object is a shared instance as there can only be
|
||||
* one standard error per process.
|
||||
|
@ -135,7 +135,7 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
return AUTORELEASE([o initWithStandardError]);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an <code>NSFileHandle</code> object for the standard input
|
||||
* descriptor. The returned object is a shared instance as there can only be
|
||||
* one standard input per process.
|
||||
|
@ -147,7 +147,7 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
return AUTORELEASE([o initWithStandardInput]);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an <code>NSFileHandle</code> object for the standard output
|
||||
* descriptor. The returned object is a shared instance as there can only be
|
||||
* one standard output per process.
|
||||
|
@ -159,7 +159,7 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
return AUTORELEASE([o initWithStandardOutput]);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns a file handle object that is connected to the null device
|
||||
* (i.e. a device that does nothing.) It is typically used in arrays
|
||||
* and other collections of file handle objects as a place holder
|
||||
|
|
|
@ -1348,7 +1348,7 @@ static NSFileManager* defaultManager = nil;
|
|||
if ((statbuf.st_mode & S_IFMT) == S_IFDIR)
|
||||
{
|
||||
*isDirectory = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return YES;
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/** NSGeometry.m - geometry functions
|
||||
* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* Written by: Adam Fedor <fedor@boulder.colorado.edu>
|
||||
* Date: Mar 1995
|
||||
*
|
||||
*
|
||||
* This file is part of the GNUstep Base Library.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSGeometry class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define IN_NSGEOMETRY_M so that the Foundation/NSGeometry.h header can
|
||||
|
@ -98,12 +98,12 @@ NSDivideRect(NSRect aRect,
|
|||
{
|
||||
static NSRect sRect;
|
||||
static NSRect rRect;
|
||||
|
||||
|
||||
if (!slice)
|
||||
slice = &sRect;
|
||||
if (!remainder)
|
||||
remainder = &rRect;
|
||||
|
||||
|
||||
if (NSIsEmptyRect(aRect))
|
||||
{
|
||||
*slice = NSMakeRect(0,0,0,0);
|
||||
|
@ -118,7 +118,7 @@ NSDivideRect(NSRect aRect,
|
|||
{
|
||||
*slice = aRect;
|
||||
*remainder = NSMakeRect(NSMaxX(aRect),
|
||||
aRect.origin.y,
|
||||
aRect.origin.y,
|
||||
0,
|
||||
aRect.size.height);
|
||||
}
|
||||
|
@ -126,10 +126,10 @@ NSDivideRect(NSRect aRect,
|
|||
{
|
||||
*slice = NSMakeRect(aRect.origin.x,
|
||||
aRect.origin.y,
|
||||
amount,
|
||||
amount,
|
||||
aRect.size.height);
|
||||
*remainder = NSMakeRect(NSMaxX(*slice),
|
||||
aRect.origin.y,
|
||||
aRect.origin.y,
|
||||
NSMaxX(aRect) - NSMaxX(*slice),
|
||||
aRect.size.height);
|
||||
}
|
||||
|
@ -139,17 +139,17 @@ NSDivideRect(NSRect aRect,
|
|||
{
|
||||
*slice = aRect;
|
||||
*remainder = NSMakeRect(aRect.origin.x,
|
||||
NSMaxY(aRect),
|
||||
NSMaxY(aRect),
|
||||
aRect.size.width, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
*slice = NSMakeRect(aRect.origin.x,
|
||||
aRect.origin.y,
|
||||
aRect.origin.y,
|
||||
aRect.size.width,
|
||||
amount);
|
||||
*remainder = NSMakeRect(aRect.origin.x,
|
||||
NSMaxY(*slice),
|
||||
NSMaxY(*slice),
|
||||
aRect.size.width,
|
||||
NSMaxY(aRect) - NSMaxY(*slice));
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ NSDivideRect(NSRect aRect,
|
|||
{
|
||||
*slice = aRect;
|
||||
*remainder = NSMakeRect(aRect.origin.x,
|
||||
aRect.origin.y,
|
||||
aRect.origin.y,
|
||||
0,
|
||||
aRect.size.height);
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ NSDivideRect(NSRect aRect,
|
|||
amount,
|
||||
aRect.size.height);
|
||||
*remainder = NSMakeRect(aRect.origin.x,
|
||||
aRect.origin.y,
|
||||
aRect.origin.y,
|
||||
NSMinX(*slice) - aRect.origin.x,
|
||||
aRect.size.height);
|
||||
}
|
||||
|
@ -180,18 +180,18 @@ NSDivideRect(NSRect aRect,
|
|||
{
|
||||
*slice = aRect;
|
||||
*remainder = NSMakeRect(aRect.origin.x,
|
||||
aRect.origin.y,
|
||||
aRect.origin.y,
|
||||
aRect.size.width,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
*slice = NSMakeRect(aRect.origin.x,
|
||||
NSMaxY(aRect) - amount,
|
||||
NSMaxY(aRect) - amount,
|
||||
aRect.size.width,
|
||||
amount);
|
||||
*remainder = NSMakeRect(aRect.origin.x,
|
||||
aRect.origin.y,
|
||||
aRect.origin.y,
|
||||
aRect.size.width,
|
||||
NSMinY(*slice) - aRect.origin.y);
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ NSSizeFromString(NSString* string)
|
|||
{
|
||||
NSScanner *scanner;
|
||||
NSSize size;
|
||||
|
||||
|
||||
setupCache();
|
||||
scanner = (*scannerImp)(NSScannerClass, scannerSel, string);
|
||||
if ((*scanStringImp)(scanner, scanStringSel, @"{", NULL)
|
||||
|
@ -324,7 +324,7 @@ NSRectFromString(NSString* string)
|
|||
{
|
||||
NSScanner *scanner;
|
||||
NSRect rect;
|
||||
|
||||
|
||||
setupCache();
|
||||
scanner = (*scannerImp)(NSScannerClass, scannerSel, string);
|
||||
if ((*scanStringImp)(scanner, scanStringSel, @"{", NULL)
|
||||
|
@ -337,12 +337,12 @@ NSRectFromString(NSString* string)
|
|||
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
||||
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.origin.y)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @";", NULL)
|
||||
|
||||
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @"width", NULL)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
||||
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.size.width)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @";", NULL)
|
||||
|
||||
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @"height", NULL)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
||||
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.size.height)
|
||||
|
@ -361,11 +361,11 @@ NSRectFromString(NSString* string)
|
|||
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.origin.y)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @"}", NULL)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @",", NULL)
|
||||
|
||||
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @"{", NULL)
|
||||
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.size.width)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @",", NULL)
|
||||
|
||||
|
||||
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.size.height)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @"}", NULL)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @"}", NULL))
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
/** NSHashTable implementation for GNUStep.
|
||||
* Copyright (C) 1994, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* Author: Albin L. Jones <Albin.L.Jones@Dartmouth.EDU>
|
||||
* Created: Mon Dec 12 23:54:09 EST 1994
|
||||
* Updated: Mon Mar 11 01:48:31 EST 1996
|
||||
* Serial: 96.03.11.06
|
||||
* Rewrite by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
*
|
||||
*
|
||||
* This file is part of the GNUstep Base Library.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*
|
||||
* <title>NSHashTable class reference</title>
|
||||
* $Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
/**** Included Headers *******************************************************/
|
||||
|
||||
|
@ -147,7 +147,7 @@ NSCopyHashTableWithZone(NSHashTable *table, NSZone *zone)
|
|||
GSIMapTable t;
|
||||
GSIMapNode n;
|
||||
NSHashEnumerator enumerator;
|
||||
|
||||
|
||||
if (table == 0)
|
||||
{
|
||||
NSWarnFLog(@"Nul table argument supplied");
|
||||
|
@ -187,7 +187,7 @@ NSCountHashTable(NSHashTable *table)
|
|||
* the main implementation. See the NSHashTableCallbacks documentation
|
||||
* for more information.<br />
|
||||
* If capacity is small or 0, then the returned
|
||||
* table has a reasonable (but still small) capacity.
|
||||
* table has a reasonable (but still small) capacity.
|
||||
*/
|
||||
NSHashTable *
|
||||
NSCreateHashTable(
|
||||
|
@ -438,7 +438,7 @@ void *
|
|||
NSNextHashEnumeratorItem(NSHashEnumerator *enumerator)
|
||||
{
|
||||
GSIMapNode n;
|
||||
|
||||
|
||||
if (enumerator == 0)
|
||||
{
|
||||
NSWarnFLog(@"Nul enumerator argument supplied");
|
||||
|
@ -527,7 +527,7 @@ const NSHashTableCallBacks NSIntHashCallBacks =
|
|||
};
|
||||
|
||||
/** For sets of pointers hashed by address. */
|
||||
const NSHashTableCallBacks NSNonOwnedPointerHashCallBacks =
|
||||
const NSHashTableCallBacks NSNonOwnedPointerHashCallBacks =
|
||||
{
|
||||
(NSHT_hash_func_t) _NS_non_owned_void_p_hash,
|
||||
(NSHT_isEqual_func_t) _NS_non_owned_void_p_is_equal,
|
||||
|
@ -537,7 +537,7 @@ const NSHashTableCallBacks NSNonOwnedPointerHashCallBacks =
|
|||
};
|
||||
|
||||
/** For sets of objects without retaining and releasing. */
|
||||
const NSHashTableCallBacks NSNonRetainedObjectHashCallBacks =
|
||||
const NSHashTableCallBacks NSNonRetainedObjectHashCallBacks =
|
||||
{
|
||||
(NSHT_hash_func_t) _NS_non_retained_id_hash,
|
||||
(NSHT_isEqual_func_t) _NS_non_retained_id_is_equal,
|
||||
|
@ -547,7 +547,7 @@ const NSHashTableCallBacks NSNonRetainedObjectHashCallBacks =
|
|||
};
|
||||
|
||||
/** For sets of objects; similar to [NSSet]. */
|
||||
const NSHashTableCallBacks NSObjectHashCallBacks =
|
||||
const NSHashTableCallBacks NSObjectHashCallBacks =
|
||||
{
|
||||
(NSHT_hash_func_t) _NS_id_hash,
|
||||
(NSHT_isEqual_func_t) _NS_id_is_equal,
|
||||
|
@ -557,7 +557,7 @@ const NSHashTableCallBacks NSObjectHashCallBacks =
|
|||
};
|
||||
|
||||
/** For sets of pointers with transfer of ownership upon insertion. */
|
||||
const NSHashTableCallBacks NSOwnedPointerHashCallBacks =
|
||||
const NSHashTableCallBacks NSOwnedPointerHashCallBacks =
|
||||
{
|
||||
(NSHT_hash_func_t) _NS_owned_void_p_hash,
|
||||
(NSHT_isEqual_func_t) _NS_owned_void_p_is_equal,
|
||||
|
@ -568,7 +568,7 @@ const NSHashTableCallBacks NSOwnedPointerHashCallBacks =
|
|||
|
||||
/** For sets of pointers to structs when the first field of the
|
||||
* struct is the size of an int. */
|
||||
const NSHashTableCallBacks NSPointerToStructHashCallBacks =
|
||||
const NSHashTableCallBacks NSPointerToStructHashCallBacks =
|
||||
{
|
||||
(NSHT_hash_func_t) _NS_int_p_hash,
|
||||
(NSHT_isEqual_func_t) _NS_int_p_is_equal,
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
/** Implementation of NSInvocation for GNUStep
|
||||
Copyright (C) 1998,2003 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Date: August 1998
|
||||
Based on code by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSInvocation class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSCoder.h"
|
||||
|
@ -219,7 +219,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
|
||||
|
||||
CLEAR_RETURN_VALUE_IF_OBJECT;
|
||||
|
||||
|
||||
#if defined(USE_LIBFFI)
|
||||
if (_cframe)
|
||||
{
|
||||
|
@ -397,7 +397,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
type = _info[0].type;
|
||||
|
||||
CLEAR_RETURN_VALUE_IF_OBJECT;
|
||||
|
||||
|
||||
if (*type != _C_VOID)
|
||||
{
|
||||
int length = _info[0].size;
|
||||
|
@ -616,7 +616,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
self, \
|
||||
_selector ? GSNameFromSelector(_selector) : "nil", \
|
||||
_target ? GSNameFromClass([_target class]) : "nil" \
|
||||
);
|
||||
);
|
||||
|
||||
return [NSString stringWithCString: buffer];
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
const char *types;
|
||||
void *datum;
|
||||
unsigned int i;
|
||||
|
||||
|
||||
[aCoder decodeValueOfObjCType: @encode(char*) at: &types];
|
||||
newSig = [NSMethodSignature signatureWithObjCTypes: types];
|
||||
NSZoneFree(NSDefaultMallocZone(), (void*)types);
|
||||
|
@ -682,7 +682,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
RELEASE(self);
|
||||
self = [NSInvocation invocationWithMethodSignature: newSig];
|
||||
RETAIN(self);
|
||||
|
||||
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &_target];
|
||||
|
||||
[aCoder decodeValueOfObjCType: @encode(SEL) at: &_selector];
|
||||
|
@ -864,7 +864,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
#if !defined(USE_LIBFFI) && !defined(USE_FFCALL)
|
||||
#if defined(sparc) || defined(powerpc)
|
||||
/* FIXME: This only appears on sparc and ppc machines so far.
|
||||
structures appear to be aligned on word boundaries.
|
||||
structures appear to be aligned on word boundaries.
|
||||
Hopefully there is a more general way to figure this out */
|
||||
size = (size<sizeof(int))?4:size;
|
||||
#endif
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/** Implementation of KeyValueCoding for GNUStep
|
||||
Copyright (C) 2000,2002 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSKeyValueCoding informal protocol reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "Foundation/NSObject.h"
|
||||
|
@ -56,8 +56,8 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
|
|||
- (id) handleQueryWithUnboundKey: (NSString*)aKey
|
||||
{
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
self,
|
||||
@"NSTargetObjectUserInfoKey",
|
||||
self,
|
||||
@"NSTargetObjectUserInfoKey",
|
||||
(aKey ? aKey : @"(nil)"),
|
||||
@"NSUnknownUserInfoKey",
|
||||
nil];
|
||||
|
@ -72,8 +72,8 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
|
|||
- (void) handleTakeValue: (id)anObject forUnboundKey: (NSString*)aKey
|
||||
{
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
(anObject ? anObject : @"(nil)"),
|
||||
@"NSTargetObjectUserInfoKey",
|
||||
(anObject ? anObject : @"(nil)"),
|
||||
@"NSTargetObjectUserInfoKey",
|
||||
(aKey ? aKey : @"(nil)"),
|
||||
@"NSUnknownUserInfoKey",
|
||||
nil];
|
||||
|
@ -127,7 +127,7 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
|
|||
if (sel == 0 || [self respondsToSelector: sel] == NO)
|
||||
{
|
||||
sel = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sel == 0)
|
||||
{
|
||||
|
|
|
@ -3,24 +3,24 @@
|
|||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: January 2004
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSObject.h>
|
||||
|
@ -398,7 +398,7 @@ static NSDictionary *makeReference(unsigned ref)
|
|||
|
||||
/*
|
||||
* Return the dictionary identifying the encoded object.
|
||||
*/
|
||||
*/
|
||||
return refObject;
|
||||
}
|
||||
@end
|
||||
|
@ -456,7 +456,7 @@ static NSDictionary *makeReference(unsigned ref)
|
|||
{
|
||||
if (globalClassMap == 0)
|
||||
{
|
||||
globalClassMap =
|
||||
globalClassMap =
|
||||
NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks, 0);
|
||||
}
|
||||
|
@ -841,7 +841,7 @@ willReplaceObject: (id)anObject
|
|||
}
|
||||
@end
|
||||
|
||||
@implementation NSObject (NSKeyedArchiverObjectSubstitution)
|
||||
@implementation NSObject (NSKeyedArchiverObjectSubstitution)
|
||||
- (Class) classForKeyedArchiver
|
||||
{
|
||||
return [self classForArchiver];
|
||||
|
|
|
@ -3,24 +3,24 @@
|
|||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: January 2004
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSData.h>
|
||||
|
@ -187,7 +187,7 @@ static NSMapTable globalClassMap = 0;
|
|||
NSInvalidUnarchiveOperationException
|
||||
format: @"[%@ +%@]: no class for name '%@'",
|
||||
NSStringFromClass([self class]),
|
||||
NSStringFromSelector(_cmd),
|
||||
NSStringFromSelector(_cmd),
|
||||
classname];
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ static NSMapTable globalClassMap = 0;
|
|||
{
|
||||
if (globalClassMap == 0)
|
||||
{
|
||||
globalClassMap =
|
||||
globalClassMap =
|
||||
NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ static NSMapTable globalClassMap = 0;
|
|||
{
|
||||
[NSException raise: NSInvalidUnarchiveOperationException
|
||||
format: @"[%@ +%@]: value for key(%@) is '%@'",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
oldKey, o];
|
||||
}
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ static NSMapTable globalClassMap = 0;
|
|||
{
|
||||
[NSException raise: NSInvalidUnarchiveOperationException
|
||||
format: @"[%@ +%@]: value for key(%@) is '%@'",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
oldKey, o];
|
||||
}
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ static NSMapTable globalClassMap = 0;
|
|||
{
|
||||
[NSException raise: NSInvalidUnarchiveOperationException
|
||||
format: @"[%@ +%@]: value for key(%@) is '%@'",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
oldKey, o];
|
||||
}
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ static NSMapTable globalClassMap = 0;
|
|||
{
|
||||
[NSException raise: NSInvalidUnarchiveOperationException
|
||||
format: @"[%@ +%@]: value for key(%@) is '%@'",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
oldKey, o];
|
||||
}
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ static NSMapTable globalClassMap = 0;
|
|||
{
|
||||
[NSException raise: NSInvalidUnarchiveOperationException
|
||||
format: @"[%@ +%@]: value for key(%@) is '%@'",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
oldKey, o];
|
||||
}
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ static NSMapTable globalClassMap = 0;
|
|||
{
|
||||
[NSException raise: NSInvalidUnarchiveOperationException
|
||||
format: @"[%@ +%@]: value for key(%@) is '%@'",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
oldKey, o];
|
||||
}
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ static NSMapTable globalClassMap = 0;
|
|||
{
|
||||
[NSException raise: NSInvalidUnarchiveOperationException
|
||||
format: @"[%@ +%@]: value for key(%@) is '%@'",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
oldKey, o];
|
||||
}
|
||||
}
|
||||
|
@ -564,7 +564,7 @@ static NSMapTable globalClassMap = 0;
|
|||
{
|
||||
[NSException raise: NSInvalidUnarchiveOperationException
|
||||
format: @"[%@ +%@]: value for key(%@) is '%@'",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
key, o];
|
||||
}
|
||||
}
|
||||
|
@ -590,7 +590,7 @@ static NSMapTable globalClassMap = 0;
|
|||
{
|
||||
[NSException raise: NSInvalidUnarchiveOperationException
|
||||
format: @"[%@ +%@]: value for key(%@) is '%@'",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
oldKey, o];
|
||||
}
|
||||
}
|
||||
|
@ -795,7 +795,7 @@ static NSMapTable globalClassMap = 0;
|
|||
|
||||
@end
|
||||
|
||||
@implementation NSObject (NSKeyedUnarchiverDelegate)
|
||||
@implementation NSObject (NSKeyedUnarchiverDelegate)
|
||||
- (Class) unarchiver: (NSKeyedUnarchiver*)anUnarchiver
|
||||
cannotDecodeObjectOfClassName: (NSString*)aName
|
||||
originalClasses: (NSArray*)classNames
|
||||
|
@ -820,7 +820,7 @@ static NSMapTable globalClassMap = 0;
|
|||
}
|
||||
@end
|
||||
|
||||
@implementation NSObject (NSKeyedUnarchiverObjectSubstitution)
|
||||
@implementation NSObject (NSKeyedUnarchiverObjectSubstitution)
|
||||
+ (Class) classForKeyedUnarchiver
|
||||
{
|
||||
return self;
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
Author: Scott Christley <scottc@net-community.com>
|
||||
Created: 1996
|
||||
Author: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
||||
This file is part of the GNUstep Objective-C Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
@ -23,7 +23,7 @@
|
|||
|
||||
<title>NSLock class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <errno.h>
|
||||
|
@ -430,7 +430,7 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
|
|||
|
||||
// Acquiring the lock with a date condition
|
||||
- (BOOL) lockBeforeDate: (NSDate*)limit
|
||||
{
|
||||
{
|
||||
GSSleepInfo ctxt;
|
||||
|
||||
CHECK_RECURSIVE_CONDITION_LOCK(_MUTEX);
|
||||
|
@ -480,7 +480,7 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
|
|||
GSNameFromSelector(_cmd)];
|
||||
/* NOT REACHED */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (GSSleepOrFail(&ctxt) == YES);
|
||||
|
||||
|
@ -489,34 +489,34 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
|
|||
#else
|
||||
NSTimeInterval atimeinterval;
|
||||
struct timespec endtime;
|
||||
|
||||
|
||||
CHECK_RECURSIVE_CONDITION_LOCK(_MUTEX);
|
||||
|
||||
|
||||
if (-1 == objc_mutex_lock(_MUTEX))
|
||||
[NSException raise: NSConditionLockException
|
||||
[NSException raise: NSConditionLockException
|
||||
format: @"lockWhenCondition: failed to lock mutex"];
|
||||
|
||||
if (_condition_value == condition_to_meet)
|
||||
return YES;
|
||||
|
||||
|
||||
atimeinterval = [limitDate timeIntervalSince1970];
|
||||
endtime.tv_sec =(unsigned int)atimeinterval; // 941883028;//
|
||||
endtime.tv_nsec = (unsigned int)((atimeinterval - (float)endtime.tv_sec)
|
||||
* 1000000000.0);
|
||||
|
||||
|
||||
while (_condition_value != condition_to_meet)
|
||||
{
|
||||
switch (objc_condition_timedwait(_CONDITION, _MUTEX, &endtime))
|
||||
{
|
||||
case 0:
|
||||
case 0:
|
||||
break;
|
||||
case EINTR:
|
||||
case EINTR:
|
||||
break;
|
||||
case ETIMEDOUT :
|
||||
case ETIMEDOUT :
|
||||
[self unlock];
|
||||
return NO;
|
||||
default:
|
||||
[NSException raise: NSConditionLockException
|
||||
default:
|
||||
[NSException raise: NSConditionLockException
|
||||
format: @"objc_condition_timedwait failed"];
|
||||
[self unlock];
|
||||
return NO;
|
||||
|
|
|
@ -3,26 +3,26 @@
|
|||
|
||||
Written by: Adam Fedor <fedor@boulder.colorado.edu>
|
||||
Date: November 1996
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSLog reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -106,7 +106,7 @@ _NSLog_standard_printf_handler (NSString* message)
|
|||
buf = (const char*)[d bytes];
|
||||
len = [d length];
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_SYSLOG
|
||||
|
||||
if (GSUserDefaultsFlag(GSLogSyslog) == YES
|
||||
|
@ -193,7 +193,7 @@ NSLog_printf_handler *_NSLog_printf_handler = _NSLog_standard_printf_handler;
|
|||
* GSObjCRuntime.h.
|
||||
* </p>
|
||||
*/
|
||||
void
|
||||
void
|
||||
NSLog (NSString* format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -223,7 +223,7 @@ NSLog (NSString* format, ...)
|
|||
* <ref type="variable" id="_NSLog_printf_handler">_NSLog_printf_handler</ref>
|
||||
* </p>
|
||||
*/
|
||||
void
|
||||
void
|
||||
NSLogv (NSString* format, va_list args)
|
||||
{
|
||||
NSString *prefix;
|
||||
|
@ -247,7 +247,7 @@ NSLogv (NSString* format, va_list args)
|
|||
#endif
|
||||
prefix = [NSString
|
||||
stringWithFormat: @"%@ %@[%d] ",
|
||||
[[NSCalendarDate calendarDate]
|
||||
[[NSCalendarDate calendarDate]
|
||||
descriptionWithCalendarFormat: @"%Y-%m-%d %H:%M:%S.%F"],
|
||||
[[NSProcessInfo processInfo] processName],
|
||||
pid];
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
/** NSMapTable implementation for GNUStep.
|
||||
* Copyright (C) 1994, 1995, 1996, 2002 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* Author: Albin L. Jones <Albin.L.Jones@Dartmouth.EDU>
|
||||
* Created: Mon Dec 12 23:59:57 EST 1994
|
||||
* Updated: Sun Mar 17 18:37:12 EST 1996
|
||||
* Serial: 96.03.17.31
|
||||
* Rewrite by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
*
|
||||
*
|
||||
* This file is part of the GNUstep Base Library.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -199,7 +199,7 @@ NSCopyMapTableWithZone(NSMapTable *table, NSZone *zone)
|
|||
GSIMapTable t;
|
||||
GSIMapNode n;
|
||||
NSMapEnumerator enumerator;
|
||||
|
||||
|
||||
if (table == 0)
|
||||
{
|
||||
NSWarnFLog(@"Nul table argument supplied");
|
||||
|
@ -239,7 +239,7 @@ NSCountMapTable(NSMapTable *table)
|
|||
* NSDefaultMallocZone().<br />
|
||||
* Returns a (pointer to) an NSMapTable space for which is allocated
|
||||
* in the default zone. If capacity is small or 0, then the returned
|
||||
* table has a reasonable capacity.
|
||||
* table has a reasonable capacity.
|
||||
*/
|
||||
NSMapTable *
|
||||
NSCreateMapTable(
|
||||
|
@ -400,7 +400,7 @@ NSMapInsert(NSMapTable *table, const void *key, const void *value)
|
|||
n = GSIMapNodeForKey(t, (GSIMapKey)key);
|
||||
if (n == 0)
|
||||
{
|
||||
GSIMapAddPair(t, (GSIMapKey)key, (GSIMapVal)value);
|
||||
GSIMapAddPair(t, (GSIMapKey)key, (GSIMapVal)value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -438,7 +438,7 @@ NSMapInsertIfAbsent(NSMapTable *table, const void *key, const void *value)
|
|||
n = GSIMapNodeForKey(t, (GSIMapKey)key);
|
||||
if (n == 0)
|
||||
{
|
||||
GSIMapAddPair(t, (GSIMapKey)key, (GSIMapVal)value);
|
||||
GSIMapAddPair(t, (GSIMapKey)key, (GSIMapVal)value);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@ -472,7 +472,7 @@ NSMapInsertKnownAbsent(NSMapTable *table, const void *key, const void *value)
|
|||
n = GSIMapNodeForKey(t, (GSIMapKey)key);
|
||||
if (n == 0)
|
||||
{
|
||||
GSIMapAddPair(t, (GSIMapKey)key, (GSIMapVal)value);
|
||||
GSIMapAddPair(t, (GSIMapKey)key, (GSIMapVal)value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -546,7 +546,7 @@ NSNextMapEnumeratorPair(NSMapEnumerator *enumerator,
|
|||
void **key, void **value)
|
||||
{
|
||||
GSIMapNode n;
|
||||
|
||||
|
||||
if (enumerator == 0)
|
||||
{
|
||||
NSWarnFLog(@"Nul enumerator argument supplied");
|
||||
|
@ -646,7 +646,7 @@ typedef NSString *(*NSMT_describe_func_t)(NSMapTable *, const void *);
|
|||
|
||||
|
||||
/** For keys that are pointer-sized or smaller quantities. */
|
||||
const NSMapTableKeyCallBacks NSIntMapKeyCallBacks =
|
||||
const NSMapTableKeyCallBacks NSIntMapKeyCallBacks =
|
||||
{
|
||||
(NSMT_hash_func_t) _NS_int_hash,
|
||||
(NSMT_is_equal_func_t) _NS_int_is_equal,
|
||||
|
@ -657,7 +657,7 @@ const NSMapTableKeyCallBacks NSIntMapKeyCallBacks =
|
|||
};
|
||||
|
||||
/** For keys that are pointers not freed. */
|
||||
const NSMapTableKeyCallBacks NSNonOwnedPointerMapKeyCallBacks =
|
||||
const NSMapTableKeyCallBacks NSNonOwnedPointerMapKeyCallBacks =
|
||||
{
|
||||
(NSMT_hash_func_t) _NS_non_owned_void_p_hash,
|
||||
(NSMT_is_equal_func_t) _NS_non_owned_void_p_is_equal,
|
||||
|
@ -668,7 +668,7 @@ const NSMapTableKeyCallBacks NSNonOwnedPointerMapKeyCallBacks =
|
|||
};
|
||||
|
||||
/** For keys that are pointers not freed, or 0. */
|
||||
const NSMapTableKeyCallBacks NSNonOwnedPointerOrNullMapKeyCallBacks =
|
||||
const NSMapTableKeyCallBacks NSNonOwnedPointerOrNullMapKeyCallBacks =
|
||||
{
|
||||
(NSMT_hash_func_t) _NS_non_owned_void_p_hash,
|
||||
(NSMT_is_equal_func_t) _NS_non_owned_void_p_is_equal,
|
||||
|
@ -679,7 +679,7 @@ const NSMapTableKeyCallBacks NSNonOwnedPointerOrNullMapKeyCallBacks =
|
|||
};
|
||||
|
||||
/** For sets of objects without retaining and releasing. */
|
||||
const NSMapTableKeyCallBacks NSNonRetainedObjectMapKeyCallBacks =
|
||||
const NSMapTableKeyCallBacks NSNonRetainedObjectMapKeyCallBacks =
|
||||
{
|
||||
(NSMT_hash_func_t) _NS_non_retained_id_hash,
|
||||
(NSMT_is_equal_func_t) _NS_non_retained_id_is_equal,
|
||||
|
@ -690,7 +690,7 @@ const NSMapTableKeyCallBacks NSNonRetainedObjectMapKeyCallBacks =
|
|||
};
|
||||
|
||||
/** For keys that are objects. */
|
||||
const NSMapTableKeyCallBacks NSObjectMapKeyCallBacks =
|
||||
const NSMapTableKeyCallBacks NSObjectMapKeyCallBacks =
|
||||
{
|
||||
(NSMT_hash_func_t) _NS_id_hash,
|
||||
(NSMT_is_equal_func_t) _NS_id_is_equal,
|
||||
|
@ -701,7 +701,7 @@ const NSMapTableKeyCallBacks NSObjectMapKeyCallBacks =
|
|||
};
|
||||
|
||||
/** For keys that are pointers with transfer of ownership upon insertion. */
|
||||
const NSMapTableKeyCallBacks NSOwnedPointerMapKeyCallBacks =
|
||||
const NSMapTableKeyCallBacks NSOwnedPointerMapKeyCallBacks =
|
||||
{
|
||||
(NSMT_hash_func_t) _NS_owned_void_p_hash,
|
||||
(NSMT_is_equal_func_t) _NS_owned_void_p_is_equal,
|
||||
|
@ -712,7 +712,7 @@ const NSMapTableKeyCallBacks NSOwnedPointerMapKeyCallBacks =
|
|||
};
|
||||
|
||||
/** For values that are pointer-sized integer quantities. */
|
||||
const NSMapTableValueCallBacks NSIntMapValueCallBacks =
|
||||
const NSMapTableValueCallBacks NSIntMapValueCallBacks =
|
||||
{
|
||||
(NSMT_retain_func_t) _NS_int_retain,
|
||||
(NSMT_release_func_t) _NS_int_release,
|
||||
|
@ -720,7 +720,7 @@ const NSMapTableValueCallBacks NSIntMapValueCallBacks =
|
|||
};
|
||||
|
||||
/** For values that are pointers not freed. */
|
||||
const NSMapTableValueCallBacks NSNonOwnedPointerMapValueCallBacks =
|
||||
const NSMapTableValueCallBacks NSNonOwnedPointerMapValueCallBacks =
|
||||
{
|
||||
(NSMT_retain_func_t) _NS_non_owned_void_p_retain,
|
||||
(NSMT_release_func_t) _NS_non_owned_void_p_release,
|
||||
|
@ -728,7 +728,7 @@ const NSMapTableValueCallBacks NSNonOwnedPointerMapValueCallBacks =
|
|||
};
|
||||
|
||||
/** For sets of objects without retaining and releasing. */
|
||||
const NSMapTableValueCallBacks NSNonRetainedObjectMapValueCallBacks =
|
||||
const NSMapTableValueCallBacks NSNonRetainedObjectMapValueCallBacks =
|
||||
{
|
||||
(NSMT_retain_func_t) _NS_non_retained_id_retain,
|
||||
(NSMT_release_func_t) _NS_non_retained_id_release,
|
||||
|
@ -736,7 +736,7 @@ const NSMapTableValueCallBacks NSNonRetainedObjectMapValueCallBacks =
|
|||
};
|
||||
|
||||
/** For values that are objects. */
|
||||
const NSMapTableValueCallBacks NSObjectMapValueCallBacks =
|
||||
const NSMapTableValueCallBacks NSObjectMapValueCallBacks =
|
||||
{
|
||||
(NSMT_retain_func_t) _NS_id_retain,
|
||||
(NSMT_release_func_t) _NS_id_release,
|
||||
|
@ -744,7 +744,7 @@ const NSMapTableValueCallBacks NSObjectMapValueCallBacks =
|
|||
};
|
||||
|
||||
/** For values that are pointers with transfer of ownership upon insertion. */
|
||||
const NSMapTableValueCallBacks NSOwnedPointerMapValueCallBacks =
|
||||
const NSMapTableValueCallBacks NSOwnedPointerMapValueCallBacks =
|
||||
{
|
||||
(NSMT_retain_func_t) _NS_owned_void_p_retain,
|
||||
(NSMT_release_func_t) _NS_owned_void_p_release,
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
/** Implementation of network port object based on unix domain sockets
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Based on code by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -131,7 +131,7 @@ static gsu32 maxDataLength = 10 * 1024 * 1024;
|
|||
/*
|
||||
* Theory of operation
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
@ -244,7 +244,7 @@ decodePort(NSData *data)
|
|||
{
|
||||
GSPortItemHeader *pih;
|
||||
GSPortInfo *pi;
|
||||
|
||||
|
||||
pih = (GSPortItemHeader*)[data bytes];
|
||||
NSCAssert(GSSwapBigI32ToHost(pih->type) == GSP_PORT,
|
||||
NSInternalInconsistencyException);
|
||||
|
@ -272,7 +272,7 @@ newDataWithEncodedPort(NSMessagePort *port)
|
|||
const unsigned char *name = [port _name];
|
||||
|
||||
plen = 2 + strlen(name);
|
||||
|
||||
|
||||
data = [[NSMutableData alloc] initWithLength: sizeof(GSPortItemHeader)+plen];
|
||||
pih = (GSPortItemHeader*)[data mutableBytes];
|
||||
pih->type = GSSwapHostI32ToBig(GSP_PORT);
|
||||
|
@ -512,7 +512,7 @@ static Class runLoopClass;
|
|||
{
|
||||
M_LOCK(myLock);
|
||||
if (valid == YES)
|
||||
{
|
||||
{
|
||||
NSRunLoop *l;
|
||||
|
||||
valid = NO;
|
||||
|
@ -1782,7 +1782,7 @@ static int unique_index = 0;
|
|||
[header setLength: rl];
|
||||
[components insertObject: header atIndex: 0];
|
||||
RELEASE(header);
|
||||
}
|
||||
}
|
||||
|
||||
header = [components objectAtIndex: 0];
|
||||
/*
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/** Implementation of NSMethodSignature for GNUStep
|
||||
Copyright (C) 1994, 1995, 1996, 1998 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: August 1994
|
||||
Rewritten: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Date: August 1998
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSMethodSignature class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -47,7 +47,7 @@
|
|||
}
|
||||
newMs = AUTORELEASE([NSMethodSignature alloc]);
|
||||
newMs->_methodTypes = mframe_build_signature(t, &newMs->_argFrameLength,
|
||||
&newMs->_numArgs, 0);
|
||||
&newMs->_numArgs, 0);
|
||||
|
||||
return newMs;
|
||||
}
|
||||
|
@ -137,11 +137,11 @@
|
|||
{
|
||||
return NO;
|
||||
}
|
||||
isEqual = ([self numberOfArguments] == [other numberOfArguments]
|
||||
&& [self frameLength] == [other frameLength]
|
||||
&& *[self methodReturnType] == *[other methodReturnType]
|
||||
isEqual = ([self numberOfArguments] == [other numberOfArguments]
|
||||
&& [self frameLength] == [other frameLength]
|
||||
&& *[self methodReturnType] == *[other methodReturnType]
|
||||
&& [self isOneway] == [other isOneway]);
|
||||
if(isEqual == NO)
|
||||
if (isEqual == NO)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
@ -149,9 +149,9 @@
|
|||
{
|
||||
int i, n;
|
||||
n = [self numberOfArguments];
|
||||
for(i = 0; i < n; i++)
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
if ( (*[self getArgumentTypeAtIndex:i]
|
||||
if ((*[self getArgumentTypeAtIndex:i]
|
||||
== *[other getArgumentTypeAtIndex:i]) == NO)
|
||||
{
|
||||
return NO;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -115,7 +115,7 @@ static Class concreteClass = 0;
|
|||
RELEASE(self);
|
||||
self = (id)NSAllocateObject (concreteClass, 0, z);
|
||||
}
|
||||
return self;
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -193,12 +193,12 @@ static void obsFree(Observation *o);
|
|||
|
||||
#include "GNUstepBase/GSIArray.h"
|
||||
|
||||
#define GSI_MAP_RETAIN_KEY(M, X)
|
||||
#define GSI_MAP_RETAIN_KEY(M, X)
|
||||
#define GSI_MAP_RELEASE_KEY(M, X) ({if ((((gsaddr)X.obj) & 1) == 0) \
|
||||
RELEASE(X.obj);})
|
||||
#define GSI_MAP_HASH(M, X) doHash(X.obj)
|
||||
#define GSI_MAP_EQUAL(M, X,Y) doEqual(X.obj, Y.obj)
|
||||
#define GSI_MAP_RETAIN_VAL(M, X)
|
||||
#define GSI_MAP_RETAIN_VAL(M, X)
|
||||
#define GSI_MAP_RELEASE_VAL(M, X)
|
||||
|
||||
#define GSI_MAP_KTYPES GSUNION_OBJ|GSUNION_INT
|
||||
|
@ -637,7 +637,7 @@ static NSNotificationCenter *default_center = nil;
|
|||
* matching the notification, and after all of this is done, control returns
|
||||
* to the poster of the notification. Therefore the processing in the
|
||||
* selector implementation should be short.</p>
|
||||
*
|
||||
*
|
||||
* <p>The notification center does not retain observer or object. Therefore,
|
||||
* you should always send removeObserver: or removeObserver:name:object: to
|
||||
* the notification center before releasing these objects.</p>
|
||||
|
@ -925,7 +925,7 @@ static NSNotificationCenter *default_center = nil;
|
|||
{
|
||||
if (observer == nil)
|
||||
return;
|
||||
|
||||
|
||||
[self removeObserver: observer name: nil object: nil];
|
||||
}
|
||||
|
||||
|
@ -935,7 +935,7 @@ static NSNotificationCenter *default_center = nil;
|
|||
* Release the notification before returning, or before we raise
|
||||
* any exception ... to avoid leaks.
|
||||
*/
|
||||
- (void) _postAndRelease: (NSNotification*)notification
|
||||
- (void) _postAndRelease: (NSNotification*)notification
|
||||
{
|
||||
Observation *o;
|
||||
unsigned count;
|
||||
|
@ -1107,7 +1107,7 @@ static NSNotificationCenter *default_center = nil;
|
|||
* Creates and posts a notification using the
|
||||
* -postNotificationName:object:userInfo: passing a nil user info argument.
|
||||
*/
|
||||
- (void) postNotificationName: (NSString*)name
|
||||
- (void) postNotificationName: (NSString*)name
|
||||
object: (id)object
|
||||
{
|
||||
[self postNotificationName: name object: object userInfo: nil];
|
||||
|
@ -1120,7 +1120,7 @@ static NSNotificationCenter *default_center = nil;
|
|||
* message sent to an observer. This means that, if one observer raises
|
||||
* an exception, later observers in the lists will not get the notification.
|
||||
*/
|
||||
- (void) postNotificationName: (NSString*)name
|
||||
- (void) postNotificationName: (NSString*)name
|
||||
object: (id)object
|
||||
userInfo: (NSDictionary*)info
|
||||
{
|
||||
|
|
|
@ -254,7 +254,7 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
|
|||
[NSException raise: NSMallocException
|
||||
format: @"Unable to add to notification queue"];
|
||||
}
|
||||
|
||||
|
||||
item->notification = RETAIN(notification);
|
||||
item->name = [notification name];
|
||||
item->object = [notification object];
|
||||
|
@ -311,7 +311,7 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
|
|||
{
|
||||
item = (NSNotificationQueue*)NSAllocateObject(self,
|
||||
0, NSDefaultMallocZone());
|
||||
item = [item initWithNotificationCenter:
|
||||
item = [item initWithNotificationCenter:
|
||||
[NSNotificationCenter defaultCenter]];
|
||||
}
|
||||
return item;
|
||||
|
@ -319,7 +319,7 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
|
|||
|
||||
- (id) init
|
||||
{
|
||||
return [self initWithNotificationCenter:
|
||||
return [self initWithNotificationCenter:
|
||||
[NSNotificationCenter defaultCenter]];
|
||||
}
|
||||
|
||||
|
@ -516,13 +516,13 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
|
|||
}
|
||||
switch (postingStyle)
|
||||
{
|
||||
case NSPostNow:
|
||||
case NSPostNow:
|
||||
[self _postNotification: notification forModes: modes];
|
||||
break;
|
||||
case NSPostASAP:
|
||||
case NSPostASAP:
|
||||
add_to_queue(_asapQueue, notification, modes, _zone);
|
||||
break;
|
||||
case NSPostWhenIdle:
|
||||
case NSPostWhenIdle:
|
||||
add_to_queue(_idleQueue, notification, modes, _zone);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,26 +3,26 @@
|
|||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: 2000
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSNull class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "Foundation/NSNull.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/** NSNumber - Object encapsulation of numbers
|
||||
|
||||
|
||||
Copyright (C) 1993, 1994, 1996, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Adam Fedor <fedor@boulder.colorado.edu>
|
||||
|
@ -13,7 +13,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -276,7 +276,7 @@ static Class doubleNumberClass;
|
|||
}
|
||||
}
|
||||
|
||||
/* Returns the concrete class associated with the type encoding. Note
|
||||
/* Returns the concrete class associated with the type encoding. Note
|
||||
that we don't allow NSNumber to instantiate any class but its own
|
||||
concrete subclasses (see check at end of method) */
|
||||
+ (Class) valueClassWithObjCType: (const char*)type
|
||||
|
@ -307,7 +307,7 @@ static Class doubleNumberClass;
|
|||
return uLongLongNumberClass;
|
||||
case _C_FLT: return floatNumberClass;
|
||||
case _C_DBL: return doubleNumberClass;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/**
|
||||
NSNumberFormatter class
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -45,8 +45,8 @@
|
|||
withDefaultAttributes: (NSDictionary*)attr
|
||||
{
|
||||
// FIXME
|
||||
return AUTORELEASE([[NSAttributedString alloc] initWithString:
|
||||
[self editingStringForObjectValue: anObject] attributes: attr]);
|
||||
return AUTORELEASE([[NSAttributedString alloc] initWithString:
|
||||
[self editingStringForObjectValue: anObject] attributes: attr]);
|
||||
}
|
||||
|
||||
- (NSAttributedString*) attributedStringForNil
|
||||
|
@ -157,7 +157,7 @@
|
|||
/* Just assume nothing else has been setup and do a simple conversion. */
|
||||
if (anObject)
|
||||
{
|
||||
*anObject = [NSDecimalNumber decimalNumberWithString: string];
|
||||
*anObject = [NSDecimalNumber decimalNumberWithString: string];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
@ -258,7 +258,7 @@
|
|||
[decoder decodeValueOfObjCType: @encode(BOOL) at: &_localizesFormat];
|
||||
[decoder decodeValueOfObjCType: @encode(unichar) at: &_thousandSeparator];
|
||||
[decoder decodeValueOfObjCType: @encode(unichar) at: &_decimalSeparator];
|
||||
|
||||
|
||||
[decoder decodeValueOfObjCType: @encode(id) at: &_roundingBehavior];
|
||||
[decoder decodeValueOfObjCType: @encode(id) at: &_maximum];
|
||||
[decoder decodeValueOfObjCType: @encode(id) at: &_minimum];
|
||||
|
@ -304,7 +304,7 @@
|
|||
|
||||
- (NSDecimalNumber*) minimum
|
||||
{
|
||||
return _minimum;
|
||||
return _minimum;
|
||||
}
|
||||
|
||||
- (NSString*) negativeFormat
|
||||
|
|
|
@ -3,26 +3,26 @@
|
|||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: Aug 1995
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSObjCRuntime class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -111,4 +111,4 @@ NSGetSizeAndAlignment(const char *typePtr, unsigned *sizep, unsigned *alignp)
|
|||
*alignp = info.align;
|
||||
return typePtr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/** Implementation of NSObject for GNUStep
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: August 1994
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSObject class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -167,7 +167,7 @@ static void GSLogZombie(id o, SEL sel)
|
|||
/*
|
||||
* Define a structure to hold information that is held locally
|
||||
* (before the start) in each object.
|
||||
*/
|
||||
*/
|
||||
typedef struct obj_layout_unpadded {
|
||||
#if defined(REFCNT_LOCAL)
|
||||
unsigned retained;
|
||||
|
@ -874,7 +874,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
// See libgnustep-base-entry.m
|
||||
extern void gnustep_base_socket_init(void);
|
||||
gnustep_base_socket_init();
|
||||
#else
|
||||
#else
|
||||
|
||||
#ifdef SIGPIPE
|
||||
/*
|
||||
|
@ -917,7 +917,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
// Manipulate the FPU to add the exception mask. (Fixes SIGFPE
|
||||
// problems on *BSD)
|
||||
|
@ -980,7 +980,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
/**
|
||||
* This is the basic method to create a new instance. It
|
||||
* allocates a new instance of the receiver from the specified
|
||||
* memory zone.
|
||||
* memory zone.
|
||||
* <p>
|
||||
* Memory for an instance of the receiver is allocated; a
|
||||
* pointer to this newly created instance is returned. All
|
||||
|
@ -1032,7 +1032,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
* <p><code>
|
||||
* NSObject *object = [NSObject new];
|
||||
* </code></p>
|
||||
* is exactly the same as
|
||||
* is exactly the same as
|
||||
* <p><code>
|
||||
* NSObject *object = [[NSObject alloc] init];
|
||||
* </code></p>
|
||||
|
@ -1041,11 +1041,11 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
* methods are supposed to return a newly allocated and
|
||||
* initialized instance, as would be generated by an
|
||||
* <code>alloc</code> method followed by a corresponding
|
||||
* <code>init...</code> method. Please note that if you are
|
||||
* not using a garbage collector, this means that instances
|
||||
* generated by the <code>new...</code> methods are not
|
||||
* autoreleased, that is, you are responsible for releasing
|
||||
* (autoreleasing) the instances yourself. So when you use
|
||||
* <code>init...</code> method. Please note that if you are
|
||||
* not using a garbage collector, this means that instances
|
||||
* generated by the <code>new...</code> methods are not
|
||||
* autoreleased, that is, you are responsible for releasing
|
||||
* (autoreleasing) the instances yourself. So when you use
|
||||
* <code>new</code> you typically do something like:
|
||||
* </p>
|
||||
* <p>
|
||||
|
@ -1068,23 +1068,23 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
* </p>
|
||||
* <p>
|
||||
* <code>initWithName:</code>
|
||||
* </p>
|
||||
* </p>
|
||||
* <p>
|
||||
* it might be handy for you to have a class method
|
||||
* it might be handy for you to have a class method
|
||||
* </p>
|
||||
* <p>
|
||||
* <code>newWithName:</code>
|
||||
* </p>
|
||||
* </p>
|
||||
* <p>
|
||||
* which combines <code>alloc</code> and
|
||||
* <code>initWithName:</code>. You would implement it as follows:
|
||||
* </p>
|
||||
* <p>
|
||||
* <code>
|
||||
* + (id) newWithName: (NSString *)aName
|
||||
* {
|
||||
* return [[self alloc] initWithName: aName];
|
||||
* }
|
||||
* <code>
|
||||
* + (id) newWithName: (NSString *)aName
|
||||
* {
|
||||
* return [[self alloc] initWithName: aName];
|
||||
* }
|
||||
* </code>
|
||||
* </p>
|
||||
*/
|
||||
|
@ -1162,9 +1162,9 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
* release/autorelease mechanism determines that an object is
|
||||
* no longer needed (which happens when its retain count
|
||||
* reaches 0), it will call the <code>dealloc</code> method
|
||||
* to actually deallocate the object. This means that normally,
|
||||
* you should not need to call <code>dealloc</code> directly as
|
||||
* the gnustep base library automatically calls it for you when
|
||||
* to actually deallocate the object. This means that normally,
|
||||
* you should not need to call <code>dealloc</code> directly as
|
||||
* the gnustep base library automatically calls it for you when
|
||||
* the retain count of an object reaches 0.
|
||||
* </p>
|
||||
* <p>
|
||||
|
@ -1292,7 +1292,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
proto_list; proto_list = proto_list->next)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
||||
for (i = 0; i < proto_list->count; i++)
|
||||
{
|
||||
/* xxx We should add conformsToProtocol to Protocol class. */
|
||||
|
@ -1302,7 +1302,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ([self superclass])
|
||||
{
|
||||
return [[self superclass] conformsToProtocol: aProtocol];
|
||||
|
@ -1376,7 +1376,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
return mth ? [NSMethodSignature signatureWithObjCTypes:mth->method_types]
|
||||
: nil;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the method signature describing how the receiver would handle
|
||||
* a message with aSelector.
|
||||
|
@ -1491,7 +1491,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%s(%s) does not recognize %s",
|
||||
GSClassNameFromObject(self),
|
||||
GSClassNameFromObject(self),
|
||||
GSObjCIsInstance(self) ? "instance" : "class",
|
||||
aSelector ? GSNameFromSelector(aSelector) : "(null)"];
|
||||
}
|
||||
|
@ -1597,7 +1597,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
* The default implementation returns self if the receiver is being
|
||||
* sent <em>bycopy</em> and returns a proxy otherwise.<br />
|
||||
* Subclasses may override this method to change this behavior,
|
||||
* eg. to ensure that they are always copied.
|
||||
* eg. to ensure that they are always copied.
|
||||
*/
|
||||
- (id) replacementObjectForPortCoder: (NSPortCoder*)aCoder
|
||||
{
|
||||
|
@ -1773,7 +1773,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
if (aSelector == 0)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
|
||||
|
||||
|
||||
msg = get_imp(GSObjCClass(self), aSelector);
|
||||
if (!msg)
|
||||
{
|
||||
|
@ -1798,12 +1798,12 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
if (aSelector == 0)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
|
||||
|
||||
|
||||
msg = get_imp(GSObjCClass(self), aSelector);
|
||||
if (!msg)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"invalid selector passed to %s",
|
||||
format: @"invalid selector passed to %s",
|
||||
GSNameFromSelector(_cmd)];
|
||||
return nil;
|
||||
}
|
||||
|
@ -1826,7 +1826,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
if (aSelector == 0)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
|
||||
|
||||
|
||||
msg = get_imp(GSObjCClass(self), aSelector);
|
||||
if (!msg)
|
||||
{
|
||||
|
@ -2123,7 +2123,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"%s(%s) does not recognize %s",
|
||||
GSClassNameFromObject(self),
|
||||
GSClassNameFromObject(self),
|
||||
GSObjCIsInstance(self) ? "instance" : "class",
|
||||
aSel ? GSNameFromSelector(aSel) : "(null)"];
|
||||
return nil;
|
||||
|
@ -2136,7 +2136,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
|
||||
- (id) perform: (SEL)sel with: (id)anObject with: (id)anotherObject
|
||||
{
|
||||
return [self performSelector:sel withObject:anObject
|
||||
return [self performSelector:sel withObject:anObject
|
||||
withObject:anotherObject];
|
||||
}
|
||||
|
||||
|
@ -2267,7 +2267,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
|
||||
|
||||
return ((struct objc_method_description *)
|
||||
GSGetMethod((GSObjCIsInstance(self)
|
||||
GSGetMethod((GSObjCIsInstance(self)
|
||||
? GSObjCClass(self) : (Class)self),
|
||||
aSel,
|
||||
GSObjCIsInstance(self),
|
||||
|
@ -2338,7 +2338,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
*/
|
||||
- (id) read: (TypedStream*)aStream
|
||||
{
|
||||
// [super read: aStream];
|
||||
// [super read: aStream];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/** Implementation of page-related functions for GNUstep
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1996
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSPage class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -47,7 +47,7 @@
|
|||
|
||||
#ifdef __MINGW__
|
||||
#include <malloc.h>
|
||||
static size_t
|
||||
static size_t
|
||||
getpagesize(void)
|
||||
{
|
||||
SYSTEM_INFO info;
|
||||
|
@ -144,12 +144,12 @@ NSRealMemoryAvailable ()
|
|||
return (unsigned) info.freeram;
|
||||
#elif defined(__MINGW__)
|
||||
MEMORYSTATUS memory;
|
||||
|
||||
|
||||
GlobalMemoryStatus(&memory);
|
||||
return (unsigned)memory.dwAvailPhys;
|
||||
#elif defined(__BEOS__)
|
||||
system_info info;
|
||||
|
||||
|
||||
if (get_system_info(&info) != B_OK)
|
||||
return 0;
|
||||
return (unsigned)(info.max_pages - info.used_pages) * B_PAGE_SIZE;
|
||||
|
@ -161,7 +161,7 @@ NSRealMemoryAvailable ()
|
|||
|
||||
/**
|
||||
* Allocate memory for this process and return a pointer to it (or a null
|
||||
* pointer on failure).
|
||||
* pointer on failure).
|
||||
*/
|
||||
void *
|
||||
NSAllocateMemoryPages (unsigned bytes)
|
||||
|
|
|
@ -70,7 +70,7 @@ Class NSPort_concrete_class;
|
|||
#ifndef __MINGW__
|
||||
/* Must be kept in sync with [NSPortNameServer
|
||||
+systemDefaultPortNameServer]. */
|
||||
if (GSUserDefaultsFlag(GSMacOSXCompatible) == YES
|
||||
if (GSUserDefaultsFlag(GSMacOSXCompatible) == YES
|
||||
|| [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"NSPortIsMessagePort"])
|
||||
{
|
||||
|
|
|
@ -1444,7 +1444,7 @@ static IMP _xRefImp; /* Serialize a crossref. */
|
|||
BOOL done = NO;
|
||||
|
||||
node = GSIMapNodeForKey(_clsMap, (GSIMapKey)(void*)c);
|
||||
|
||||
|
||||
if (node != 0)
|
||||
{
|
||||
(*_xRefImp)(_dst, xRefSel, _GSC_CLASS | _GSC_XREF,
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/** Implementation of NSPortMessage for GNUstep
|
||||
Copyright (C) 1998,2000 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Richard frith-Macdonald <richard@brainstorm.co.Ik>
|
||||
Created: October 1998
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
+ (id) allocWithZone: (NSZone*)aZone
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"attempt to create extra port name server"];
|
||||
format: @"attempt to create extra port name server"];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@
|
|||
- (void) dealloc
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"attempt to deallocate default port name server"];
|
||||
format: @"attempt to deallocate default port name server"];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,51 +4,51 @@
|
|||
Written by: Georg Tuparev <Tuparev@EMBL-Heidelberg.de>
|
||||
Heidelberg, Germany
|
||||
Modified by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSProcessInfo class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
/*************************************************************************
|
||||
* File Name : NSProcessInfo.m
|
||||
* Date : 06-aug-1995
|
||||
*************************************************************************
|
||||
* Notes :
|
||||
* Notes :
|
||||
* 1) The class functionality depends on the following UNIX functions and
|
||||
* global variables: gethostname(), getpid(), and environ. For all system
|
||||
* I had the opportunity to test them they are defined and have the same
|
||||
* behavior. The same is true for the meaning of argv[0] (process name).
|
||||
* 2) The global variable _gnu_sharedProcessInfoObject should NEVER be
|
||||
* deallocate during the process runtime. Therefore I implemented a
|
||||
* deallocate during the process runtime. Therefore I implemented a
|
||||
* concrete NSProcessInfo subclass (_NSConcreteProcessInfo) with the only
|
||||
* purpose to override the autorelease, retain, and release methods.
|
||||
* To Do :
|
||||
* To Do :
|
||||
* 1) To test the class on more platforms;
|
||||
* Bugs : Not known
|
||||
* Last update: 07-aug-2002
|
||||
* History : 06-aug-1995 - Birth and the first beta version (v. 0.5);
|
||||
* 08-aug-1995 - V. 0.6 (tested on NS, SunOS, Solaris, OSF/1
|
||||
* The use of the environ global var was changed to more
|
||||
* The use of the environ global var was changed to more
|
||||
* conventional env[] (main function) so now the class could be
|
||||
* used on SunOS and Solaris. [GT]
|
||||
*************************************************************************
|
||||
* Acknowledgments:
|
||||
* Acknowledgments:
|
||||
* - Adam Fedor, Andrew McCallum, and Paul Kunz for their help;
|
||||
* - To the NEXTSTEP/GNUStep community
|
||||
*************************************************************************/
|
||||
|
@ -59,7 +59,7 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRERROR
|
||||
#ifdef HAVE_STRERROR
|
||||
#include <errno.h>
|
||||
#endif /* HAVE_STRERROR */
|
||||
|
||||
|
@ -164,7 +164,7 @@ Please report the error to bug-gnustep@gnu.org.\n\n"
|
|||
static NSProcessInfo *_gnu_sharedProcessInfoObject = nil;
|
||||
|
||||
// Host name of the CPU executing the process
|
||||
static NSString *_gnu_hostName = nil;
|
||||
static NSString *_gnu_hostName = nil;
|
||||
|
||||
static char *_gnu_arg_zero = 0;
|
||||
|
||||
|
@ -184,7 +184,7 @@ static NSMutableSet *_debug_set = nil;
|
|||
*** Implementing the gnustep_base_user_main function
|
||||
*************************************************************************/
|
||||
|
||||
void
|
||||
void
|
||||
_gnu_process_args(int argc, char *argv[], char *env[])
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(arp);
|
||||
|
@ -221,11 +221,11 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
free(buffer);
|
||||
}
|
||||
}
|
||||
#else
|
||||
fprintf(stderr, "Error: for some reason, argv not properly set up "
|
||||
#else
|
||||
fprintf(stderr, "Error: for some reason, argv not properly set up "
|
||||
"during GNUstep base initialization\n");
|
||||
abort();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Getting the process name */
|
||||
|
@ -247,8 +247,8 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
/* Copy the zero'th argument to the argument list */
|
||||
str = [NSString stringWithCString: _gnu_arg_zero];
|
||||
obj_argv[0] = str;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
str = [NSString stringWithCString: argv[i]];
|
||||
|
||||
|
@ -270,13 +270,13 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
NSMutableArray *values = [NSMutableArray new];
|
||||
|
||||
i = 0;
|
||||
while (env[i])
|
||||
while (env[i])
|
||||
{
|
||||
#if defined(__MINGW__)
|
||||
char buf[1024];
|
||||
char *cp;
|
||||
DWORD len;
|
||||
|
||||
|
||||
len = ExpandEnvironmentStrings(env[i], buf, 1022);
|
||||
if (len > 1022)
|
||||
{
|
||||
|
@ -310,7 +310,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
*cp++ = '\0';
|
||||
[keys addObject: [NSString stringWithCString: buf]];
|
||||
[values addObject: [NSString stringWithCString: cp]];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
i++;
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
/*
|
||||
* We have to save program arguments and environment before main () is
|
||||
* executed, because main () could modify their values before we get a
|
||||
* chance to read them
|
||||
* chance to read them
|
||||
*/
|
||||
static int _gnu_noobjc_argc = 0;
|
||||
static char **_gnu_noobjc_argv = NULL;
|
||||
|
@ -339,7 +339,7 @@ static char **_gnu_noobjc_env = NULL;
|
|||
* guaranteed if +load contains only pure C code, as we have here. The
|
||||
* code in here either uses libkvm if available, or else procfs.
|
||||
*/
|
||||
+ (void) load
|
||||
+ (void) load
|
||||
{
|
||||
#ifdef HAVE_KVM_ENV
|
||||
/*
|
||||
|
@ -389,7 +389,7 @@ static char **_gnu_noobjc_env = NULL;
|
|||
}
|
||||
|
||||
/* copy the environment strings */
|
||||
for(count = 0; vectors[count]; count++)
|
||||
for (count = 0; vectors[count]; count++)
|
||||
;
|
||||
_gnu_noobjc_env = (char**)malloc(sizeof(char*) * (count + 1));
|
||||
if (!_gnu_noobjc_env)
|
||||
|
@ -411,7 +411,7 @@ static char **_gnu_noobjc_env = NULL;
|
|||
}
|
||||
|
||||
/* copy the argument strings */
|
||||
for(_gnu_noobjc_argc = 0; vectors[_gnu_noobjc_argc]; _gnu_noobjc_argc++)
|
||||
for (_gnu_noobjc_argc = 0; vectors[_gnu_noobjc_argc]; _gnu_noobjc_argc++)
|
||||
;
|
||||
_gnu_noobjc_argv = (char**)malloc(sizeof(char*) * (_gnu_noobjc_argc + 1));
|
||||
if (!_gnu_noobjc_argv)
|
||||
|
@ -429,7 +429,7 @@ static char **_gnu_noobjc_env = NULL;
|
|||
/*
|
||||
* Now we have the problem of reading program arguments and
|
||||
* environment. We take the environment from extern char **environ, and
|
||||
* the program arguments from the /proc filesystem.
|
||||
* the program arguments from the /proc filesystem.
|
||||
*/
|
||||
extern char **environ;
|
||||
char *proc_file_name = NULL;
|
||||
|
@ -437,14 +437,14 @@ static char **_gnu_noobjc_env = NULL;
|
|||
int c;
|
||||
int argument;
|
||||
int length;
|
||||
int position;
|
||||
int position;
|
||||
int env_terms;
|
||||
BOOL stripTrailingNewline = NO;
|
||||
#ifdef HAVE_PROGRAM_INVOCATION_NAME
|
||||
extern char *program_invocation_name;
|
||||
#endif /* HAVE_PROGRAM_INVOCATION_NAME */
|
||||
|
||||
// Read environment
|
||||
|
||||
// Read environment
|
||||
|
||||
/* NB: This should *never* happen if your compiler tools are
|
||||
sane. But, if you are playing with them, you could break
|
||||
|
@ -452,7 +452,7 @@ static char **_gnu_noobjc_env = NULL;
|
|||
if (environ == NULL)
|
||||
{
|
||||
/* TODO: Try reading environment from /proc before aborting. */
|
||||
fprintf(stderr, "Error: for some reason, environ == NULL "
|
||||
fprintf(stderr, "Error: for some reason, environ == NULL "
|
||||
"during GNUstep base initialization\n"
|
||||
"Please check the linking process\n");
|
||||
abort();
|
||||
|
@ -473,15 +473,15 @@ static char **_gnu_noobjc_env = NULL;
|
|||
}
|
||||
_gnu_noobjc_env[c] = NULL;
|
||||
|
||||
// Read commandline
|
||||
// Read commandline
|
||||
proc_file_name = (char *)malloc(sizeof(char) * 2048);
|
||||
sprintf(proc_file_name, "/proc/%d/cmdline", (int) getpid());
|
||||
|
||||
/*
|
||||
* We read the /proc file thrice.
|
||||
* We read the /proc file thrice.
|
||||
* First, to know how many arguments there are and allocate memory for them.
|
||||
* Second, to know how long each argument is, and allocate memory accordingly.
|
||||
* Third, to actually copy the arguments into memory.
|
||||
* Third, to actually copy the arguments into memory.
|
||||
*/
|
||||
_gnu_noobjc_argc = 0;
|
||||
#ifdef HAVE_STRERROR
|
||||
|
@ -525,8 +525,8 @@ static char **_gnu_noobjc_env = NULL;
|
|||
{
|
||||
c = getc(ifp);
|
||||
length++;
|
||||
if ((c == EOF) || (c == 0)) // End of a parameter
|
||||
{
|
||||
if ((c == EOF) || (c == 0)) // End of a parameter
|
||||
{
|
||||
_gnu_noobjc_argv[argument] = (char*)malloc((sizeof(char))*length);
|
||||
if (_gnu_noobjc_argv[argument] == NULL)
|
||||
goto malloc_error;
|
||||
|
@ -551,8 +551,8 @@ static char **_gnu_noobjc_env = NULL;
|
|||
while (argument < _gnu_noobjc_argc)
|
||||
{
|
||||
c = getc(ifp);
|
||||
if ((c == EOF) || (c == 0)) // End of a parameter
|
||||
{
|
||||
if ((c == EOF) || (c == 0)) // End of a parameter
|
||||
{
|
||||
if (argument == 0 && position > 0
|
||||
&& _gnu_noobjc_argv[argument][position-1] == '\n')
|
||||
{
|
||||
|
@ -578,17 +578,17 @@ static char **_gnu_noobjc_env = NULL;
|
|||
free(proc_file_name);
|
||||
return;
|
||||
|
||||
proc_fs_error:
|
||||
proc_fs_error:
|
||||
#ifdef HAVE_STRERROR
|
||||
fprintf(stderr, "Couldn't open file %s when starting gnustep-base; %s\n",
|
||||
fprintf(stderr, "Couldn't open file %s when starting gnustep-base; %s\n",
|
||||
proc_file_name, strerror(errno));
|
||||
#else /* !HAVE_FUNCTION_STRERROR */
|
||||
fprintf(stderr, "Couldn't open file %s when starting gnustep-base.\n",
|
||||
#else /* !HAVE_FUNCTION_STRERROR */
|
||||
fprintf(stderr, "Couldn't open file %s when starting gnustep-base.\n",
|
||||
proc_file_name);
|
||||
#endif /* HAVE_FUNCTION_STRERROR */
|
||||
fprintf(stderr, "Your gnustep-base library is compiled for a kernel supporting the /proc filesystem, but it can't access it.\n");
|
||||
fprintf(stderr, "Your gnustep-base library is compiled for a kernel supporting the /proc filesystem, but it can't access it.\n");
|
||||
fprintf(stderr, "You should recompile or change your kernel.\n");
|
||||
#ifdef HAVE_PROGRAM_INVOCATION_NAME
|
||||
#ifdef HAVE_PROGRAM_INVOCATION_NAME
|
||||
fprintf(stderr, "We try to go on anyway; but the program will ignore any argument which were passed to it.\n");
|
||||
_gnu_noobjc_argc = 1;
|
||||
_gnu_noobjc_argv = malloc(sizeof(char *) * 2);
|
||||
|
@ -603,22 +603,22 @@ static char **_gnu_noobjc_env = NULL;
|
|||
/*
|
||||
* There is really little sense in going on here, because NSBundle
|
||||
* will anyway crash later if we just put something like "_Unknown_"
|
||||
* as the program name.
|
||||
* as the program name.
|
||||
*/
|
||||
abort();
|
||||
#endif /* HAVE_PROGRAM_INVOCATION_NAME */
|
||||
#endif /* !HAVE_KVM_ENV (e.g. HAVE_PROCFS) */
|
||||
malloc_error:
|
||||
malloc_error:
|
||||
fprintf(stderr, "malloc() error when starting gnustep-base.\n");
|
||||
fprintf(stderr, "Free some memory and then re-run the program.\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
_gnu_noobjc_free_vars(void)
|
||||
{
|
||||
char **p;
|
||||
|
||||
|
||||
p = _gnu_noobjc_argv;
|
||||
while (*p)
|
||||
{
|
||||
|
@ -704,7 +704,7 @@ int main(int argc, char *argv[], char *env[])
|
|||
#endif /* !GS_PASS_ARGUMENTS */
|
||||
#endif /* __MINGW__ */
|
||||
|
||||
#endif /* HAS_LOAD_METHOD && HAS_PROCFS */
|
||||
#endif /* HAS_LOAD_METHOD && HAS_PROCFS */
|
||||
|
||||
/**
|
||||
* Returns the shared NSProcessInfo object for the current process.
|
||||
|
@ -784,7 +784,7 @@ int main(int argc, char *argv[], char *env[])
|
|||
count = counter++;
|
||||
[gnustep_global_lock unlock];
|
||||
|
||||
// $$$ The format of the string is not specified by the OpenStep
|
||||
// $$$ The format of the string is not specified by the OpenStep
|
||||
// specification.
|
||||
return [NSString stringWithFormat: @"%@_%x_%lx_%lx",
|
||||
host, pid, start, count];
|
||||
|
@ -795,7 +795,7 @@ int main(int argc, char *argv[], char *env[])
|
|||
*/
|
||||
- (NSString *) hostName
|
||||
{
|
||||
if (!_gnu_hostName)
|
||||
if (!_gnu_hostName)
|
||||
{
|
||||
_gnu_hostName = [[[NSHost currentHost] name] copy];
|
||||
}
|
||||
|
@ -1089,7 +1089,7 @@ GSEnvironmentFlag(const char *name, BOOL def)
|
|||
/**
|
||||
* Used by NSException uncaught exception handler - must not call any
|
||||
* methods/functions which might cause a recursive exception.
|
||||
*/
|
||||
*/
|
||||
const char*
|
||||
GSArgZero(void)
|
||||
{
|
||||
|
|
|
@ -3,24 +3,24 @@
|
|||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <string.h>
|
||||
|
@ -977,7 +977,7 @@ nodeToObject(GSXMLNode* node, NSPropertyListMutabilityOptions o, NSString **e)
|
|||
}
|
||||
else if ([name isEqualToString: @"data"])
|
||||
{
|
||||
result = [GSMimeDocument decodeBase64:
|
||||
result = [GSMimeDocument decodeBase64:
|
||||
[content dataUsingEncoding: NSASCIIStringEncoding]];
|
||||
if (o == NSPropertyListMutableContainersAndLeaves)
|
||||
{
|
||||
|
@ -1300,7 +1300,7 @@ PString(NSString *obj, NSMutableData *output)
|
|||
{
|
||||
case '\t':
|
||||
case '\r':
|
||||
case '\n':
|
||||
case '\n':
|
||||
*ptr++ = *from;
|
||||
break;
|
||||
|
||||
|
@ -1396,19 +1396,19 @@ XString(NSString* obj, NSMutableData *output)
|
|||
c = base[rpos];
|
||||
switch (c)
|
||||
{
|
||||
case '&':
|
||||
case '&':
|
||||
len += 5;
|
||||
break;
|
||||
case '<':
|
||||
case '>':
|
||||
case '<':
|
||||
case '>':
|
||||
len += 4;
|
||||
break;
|
||||
case '\'':
|
||||
case '"':
|
||||
case '\'':
|
||||
case '"':
|
||||
len += 6;
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
if ((c < 0x20 && (c != 0x09 && c != 0x0A && c != 0x0D))
|
||||
|| (c > 0xD7FF && c < 0xE000) || c > 0xFFFD)
|
||||
{
|
||||
|
@ -1427,26 +1427,26 @@ XString(NSString* obj, NSMutableData *output)
|
|||
c = base[rpos];
|
||||
switch (c)
|
||||
{
|
||||
case '&':
|
||||
case '&':
|
||||
map[wpos++] = '&';
|
||||
map[wpos++] = 'a';
|
||||
map[wpos++] = 'm';
|
||||
map[wpos++] = 'p';
|
||||
map[wpos++] = ';';
|
||||
break;
|
||||
case '<':
|
||||
case '<':
|
||||
map[wpos++] = '&';
|
||||
map[wpos++] = 'l';
|
||||
map[wpos++] = 't';
|
||||
map[wpos++] = ';';
|
||||
break;
|
||||
case '>':
|
||||
case '>':
|
||||
map[wpos++] = '&';
|
||||
map[wpos++] = 'g';
|
||||
map[wpos++] = 't';
|
||||
map[wpos++] = ';';
|
||||
break;
|
||||
case '\'':
|
||||
case '\'':
|
||||
map[wpos++] = '&';
|
||||
map[wpos++] = 'a';
|
||||
map[wpos++] = 'p';
|
||||
|
@ -1454,7 +1454,7 @@ XString(NSString* obj, NSMutableData *output)
|
|||
map[wpos++] = 's';
|
||||
map[wpos++] = ';';
|
||||
break;
|
||||
case '"':
|
||||
case '"':
|
||||
map[wpos++] = '&';
|
||||
map[wpos++] = 'q';
|
||||
map[wpos++] = 'u';
|
||||
|
@ -1463,7 +1463,7 @@ XString(NSString* obj, NSMutableData *output)
|
|||
map[wpos++] = ';';
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
if ((c < 0x20 && (c != 0x09 && c != 0x0A && c != 0x0D))
|
||||
|| (c > 0xD7FF && c < 0xE000) || c > 0xFFFD)
|
||||
{
|
||||
|
@ -1645,7 +1645,7 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
|
|||
#define num2char(num) ((num) < 0xa ? ((num)+'0') : ((num)+0x57))
|
||||
|
||||
j = [dest length];
|
||||
[dest setLength: j + 2*length+(length > 4 ? (length-1)/4+2 : 2)];
|
||||
[dest setLength: j + 2*length+(length > 4 ? (length-1)/4+2 : 2)];
|
||||
dst = [dest mutableBytes];
|
||||
dst[j++] = '<';
|
||||
for (i = 0; i < length; i++, j++)
|
||||
|
@ -2060,7 +2060,7 @@ static BOOL classInitialized = NO;
|
|||
|
||||
loc = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||
dest = [NSMutableData dataWithCapacity: 1024];
|
||||
|
||||
|
||||
if (aFormat == NSPropertyListXMLFormat_v1_0)
|
||||
{
|
||||
const char *prefix =
|
||||
|
@ -2078,7 +2078,7 @@ static BOOL classInitialized = NO;
|
|||
[NSSerializer serializePropertyList: aPropertyList intoData: dest];
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
OAppend(aPropertyList, loc, 0, step > 3 ? 3 : step, aFormat, dest);
|
||||
}
|
||||
return dest;
|
||||
|
@ -2106,7 +2106,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Illegal object (%@) at argument 0", *str];
|
||||
}
|
||||
|
||||
|
||||
if (forDescription)
|
||||
{
|
||||
style = NSPropertyListOpenStepFormat;
|
||||
|
@ -2125,7 +2125,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
}
|
||||
|
||||
dest = [NSMutableData dataWithCapacity: 1024];
|
||||
|
||||
|
||||
if (style == NSPropertyListXMLFormat_v1_0)
|
||||
{
|
||||
const char *prefix =
|
||||
|
@ -2139,7 +2139,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
[dest appendBytes: "</plist>" length: 8];
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
OAppend(obj, loc, 0, step > 3 ? 3 : step, style, dest);
|
||||
}
|
||||
tmp = [[NSString alloc] initWithData: dest encoding: NSASCIIStringEncoding];
|
||||
|
@ -2212,7 +2212,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
else
|
||||
{
|
||||
unsigned int index = 0;
|
||||
|
||||
|
||||
// Skip any leading white space.
|
||||
while (index < length && GS_IS_WHITESPACE(bytes[index]) == YES)
|
||||
{
|
||||
|
@ -2515,7 +2515,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
unsigned char oid;
|
||||
|
||||
[data getBytes: &oid range: NSMakeRange(*counter,1)];
|
||||
*counter += 1;
|
||||
*counter += 1;
|
||||
return oid;
|
||||
}
|
||||
else if (index_size == 2)
|
||||
|
@ -2523,7 +2523,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
unsigned short oid;
|
||||
|
||||
[data getBytes: &oid range: NSMakeRange(*counter, 2)];
|
||||
*counter += 2;
|
||||
*counter += 2;
|
||||
|
||||
return NSSwapBigShortToHost(oid);
|
||||
}
|
||||
|
@ -2733,7 +2733,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
unsigned i;
|
||||
unichar buffer[len];
|
||||
|
||||
[data getBytes: buffer
|
||||
[data getBytes: buffer
|
||||
range: NSMakeRange(counter, sizeof(unichar)*len)];
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
|
@ -2781,8 +2781,8 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
unsigned char index;
|
||||
|
||||
[data getBytes: &index range: NSMakeRange(counter,1)];
|
||||
result = [NSDictionary dictionaryWithObject:
|
||||
[NSNumber numberWithInt: index]
|
||||
result = [NSDictionary dictionaryWithObject:
|
||||
[NSNumber numberWithInt: index]
|
||||
forKey: @"CF$UID"];
|
||||
}
|
||||
else if (next == 0x81)
|
||||
|
@ -2791,8 +2791,8 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
|
||||
[data getBytes: &index range: NSMakeRange(counter,2)];
|
||||
index = NSSwapBigShortToHost(index);
|
||||
result = [NSDictionary dictionaryWithObject:
|
||||
[NSNumber numberWithInt: index]
|
||||
result = [NSDictionary dictionaryWithObject:
|
||||
[NSNumber numberWithInt: index]
|
||||
forKey: @"CF$UID"];
|
||||
}
|
||||
else if ((next >= 0xA0) && (next < 0xAF))
|
||||
|
@ -2872,14 +2872,14 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
if (mutability == NSPropertyListMutableContainersAndLeaves
|
||||
|| mutability == NSPropertyListMutableContainers)
|
||||
{
|
||||
result = [NSMutableDictionary dictionaryWithObjects: values
|
||||
forKeys: keys
|
||||
result = [NSMutableDictionary dictionaryWithObjects: values
|
||||
forKeys: keys
|
||||
count: len];
|
||||
}
|
||||
else
|
||||
{
|
||||
result = [NSDictionary dictionaryWithObjects: values
|
||||
forKeys: keys
|
||||
result = [NSDictionary dictionaryWithObjects: values
|
||||
forKeys: keys
|
||||
count: len];
|
||||
}
|
||||
}
|
||||
|
@ -2911,14 +2911,14 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
if (mutability == NSPropertyListMutableContainersAndLeaves
|
||||
|| mutability == NSPropertyListMutableContainers)
|
||||
{
|
||||
result = [NSMutableDictionary dictionaryWithObjects: values
|
||||
forKeys: keys
|
||||
result = [NSMutableDictionary dictionaryWithObjects: values
|
||||
forKeys: keys
|
||||
count: len];
|
||||
}
|
||||
else
|
||||
{
|
||||
result = [NSDictionary dictionaryWithObjects: values
|
||||
forKeys: keys
|
||||
result = [NSDictionary dictionaryWithObjects: values
|
||||
forKeys: keys
|
||||
count: len];
|
||||
}
|
||||
NSZoneFree(NSDefaultMallocZone(), values);
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/** NSRange - range functions
|
||||
* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* Written by: Adam Fedor <fedor@boulder.colorado.edu>
|
||||
* Date: Mar 1995
|
||||
*
|
||||
*
|
||||
* This file is part of the GNUstep Base Library.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSRange class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -108,7 +108,7 @@ typedef struct {
|
|||
*
|
||||
* NB. This class is private to NSRunLoop and must not be subclassed.
|
||||
*/
|
||||
|
||||
|
||||
static SEL eventSel; /* Initialized in [NSRunLoop +initialize] */
|
||||
|
||||
@interface GSRunLoopWatcher: NSObject
|
||||
|
@ -147,12 +147,12 @@ static SEL eventSel; /* Initialized in [NSRunLoop +initialize] */
|
|||
case ET_RDESC: type = aType; break;
|
||||
case ET_WDESC: type = aType; break;
|
||||
case ET_RPORT: type = aType; break;
|
||||
default:
|
||||
default:
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"NSRunLoop - unknown event type"];
|
||||
}
|
||||
receiver = anObj;
|
||||
if ([receiver respondsToSelector: eventSel] == YES)
|
||||
if ([receiver respondsToSelector: eventSel] == YES)
|
||||
handleEvent = [receiver methodForSelector: eventSel];
|
||||
else
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
|
@ -337,7 +337,7 @@ static inline BOOL timerInvalidated(NSTimer* timer)
|
|||
|
||||
static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1)
|
||||
{
|
||||
return [((GSRunLoopWatcher *)(i0.obj))->_date
|
||||
return [((GSRunLoopWatcher *)(i0.obj))->_date
|
||||
compare: ((GSRunLoopWatcher *)(i1.obj))->_date];
|
||||
}
|
||||
|
||||
|
@ -359,14 +359,14 @@ wRetain(NSMapTable* t, const void* w)
|
|||
(*wRetImp)((id)w, wRetSel);
|
||||
}
|
||||
|
||||
static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
||||
static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
||||
{
|
||||
wRetain,
|
||||
wRelease,
|
||||
0
|
||||
};
|
||||
#else
|
||||
#define WatcherMapValueCallBacks NSOwnedPointerMapValueCallBacks
|
||||
#define WatcherMapValueCallBacks NSOwnedPointerMapValueCallBacks
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -451,13 +451,13 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
{
|
||||
switch (type)
|
||||
{
|
||||
case ET_RDESC:
|
||||
case ET_RDESC:
|
||||
NSMapRemove(_rfdMap, data);
|
||||
break;
|
||||
case ET_WDESC:
|
||||
case ET_WDESC:
|
||||
NSMapRemove(_wfdMap, data);
|
||||
break;
|
||||
case ET_EDESC:
|
||||
case ET_EDESC:
|
||||
NSMapRemove(_efdMap, data);
|
||||
break;
|
||||
default:
|
||||
|
@ -613,25 +613,25 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
|
||||
switch (info->type)
|
||||
{
|
||||
case ET_EDESC:
|
||||
case ET_EDESC:
|
||||
fd = (int)info->data;
|
||||
setPollfd(fd, POLLPRI, self);
|
||||
NSMapInsert(_efdMap, (void*)fd, info);
|
||||
break;
|
||||
|
||||
case ET_RDESC:
|
||||
case ET_RDESC:
|
||||
fd = (int)info->data;
|
||||
setPollfd(fd, POLLIN, self);
|
||||
NSMapInsert(_rfdMap, (void*)fd, info);
|
||||
break;
|
||||
|
||||
case ET_WDESC:
|
||||
case ET_WDESC:
|
||||
fd = (int)info->data;
|
||||
setPollfd(fd, POLLOUT, self);
|
||||
NSMapInsert(_wfdMap, (void*)fd, info);
|
||||
break;
|
||||
|
||||
case ET_RPORT:
|
||||
case ET_RPORT:
|
||||
if ([info->receiver isValid] == NO)
|
||||
{
|
||||
/*
|
||||
|
@ -643,7 +643,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
else
|
||||
{
|
||||
id port = info->receiver;
|
||||
int port_fd_count = 128; // FIXME
|
||||
int port_fd_count = 128; // FIXME
|
||||
int port_fd_array[port_fd_count];
|
||||
|
||||
if ([port respondsToSelector:
|
||||
|
@ -658,7 +658,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
{
|
||||
fd = port_fd_array[port_fd_count];
|
||||
setPollfd(fd, POLLIN, self);
|
||||
NSMapInsert(_rfdMap,
|
||||
NSMapInsert(_rfdMap,
|
||||
(void*)port_fd_array[port_fd_count], info);
|
||||
}
|
||||
}
|
||||
|
@ -759,7 +759,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
int fd = pollfds[fdIndex].fd;
|
||||
GSRunLoopWatcher *watcher;
|
||||
BOOL found = NO;
|
||||
|
||||
|
||||
/*
|
||||
* The poll() call supports various error conditions - all
|
||||
* errors should be handled by any available handler.
|
||||
|
@ -850,7 +850,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
if (found == YES && --poll_return == 0)
|
||||
{
|
||||
completed = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (++fdIndex >= fdEnd)
|
||||
{
|
||||
|
@ -904,7 +904,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
timeout.tv_usec = (milliseconds - 1000 * timeout.tv_sec) * 1000;
|
||||
select_timeout = &timeout;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
timeout.tv_sec = -1;
|
||||
timeout.tv_usec = -1;
|
||||
|
@ -939,7 +939,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
}
|
||||
switch (info->type)
|
||||
{
|
||||
case ET_EDESC:
|
||||
case ET_EDESC:
|
||||
fd = (int)info->data;
|
||||
if (fd > fdEnd)
|
||||
fdEnd = fd;
|
||||
|
@ -948,7 +948,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
num_inputs++;
|
||||
break;
|
||||
|
||||
case ET_RDESC:
|
||||
case ET_RDESC:
|
||||
fd = (int)info->data;
|
||||
if (fd > fdEnd)
|
||||
fdEnd = fd;
|
||||
|
@ -957,7 +957,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
num_inputs++;
|
||||
break;
|
||||
|
||||
case ET_WDESC:
|
||||
case ET_WDESC:
|
||||
fd = (int)info->data;
|
||||
if (fd > fdEnd)
|
||||
fdEnd = fd;
|
||||
|
@ -966,7 +966,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
num_inputs++;
|
||||
break;
|
||||
|
||||
case ET_RPORT:
|
||||
case ET_RPORT:
|
||||
if ([info->receiver isValid] == NO)
|
||||
{
|
||||
/*
|
||||
|
@ -995,7 +995,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
FD_SET (port_fd_array[port_fd_count], &read_fds);
|
||||
if (fd > fdEnd)
|
||||
fdEnd = fd;
|
||||
NSMapInsert(_rfdMap,
|
||||
NSMapInsert(_rfdMap,
|
||||
(void*)port_fd_array[port_fd_count], info);
|
||||
num_inputs++;
|
||||
}
|
||||
|
@ -1052,7 +1052,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
completed = YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Look at all the file descriptors select() says are ready for action;
|
||||
* notify the corresponding object for each of the ready fd's.
|
||||
|
@ -1577,7 +1577,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
GSRunLoopWatcher *info;
|
||||
|
||||
info = [self _getWatcher: data type: type forMode: mode];
|
||||
|
||||
|
||||
if (info)
|
||||
{
|
||||
if (info->count == 0)
|
||||
|
@ -1804,7 +1804,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
*/
|
||||
GSIArrayRemoveItemAtIndexNoRelease(watchers, 0);
|
||||
obj = min_watcher->receiver;
|
||||
if ([obj respondsToSelector:
|
||||
if ([obj respondsToSelector:
|
||||
@selector(timedOutEvent:type:forMode:)])
|
||||
{
|
||||
nxt = [obj timedOutEvent: min_watcher->data
|
||||
|
@ -1814,7 +1814,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
else if ([obj respondsToSelector: @selector(delegate)])
|
||||
{
|
||||
obj = [obj delegate];
|
||||
if (obj != nil && [obj respondsToSelector:
|
||||
if (obj != nil && [obj respondsToSelector:
|
||||
@selector(timedOutEvent:type:forMode:)])
|
||||
{
|
||||
nxt = [obj timedOutEvent: min_watcher->data
|
||||
|
@ -1924,7 +1924,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
* earliest limit date has passed (whichever comes first).<br />
|
||||
* If the supplied mode is nil, uses NSDefaultRunLoopMode.
|
||||
*/
|
||||
- (void) acceptInputForMode: (NSString*)mode
|
||||
- (void) acceptInputForMode: (NSString*)mode
|
||||
beforeDate: (NSDate*)limit_date
|
||||
{
|
||||
GSRunLoopCtxt *context;
|
||||
|
@ -1980,7 +1980,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
else
|
||||
{
|
||||
/* Wait until the LIMIT_DATE. */
|
||||
NSDebugMLLog(@"NSRunLoop", @"accept I/P before %f (sec from now %f)",
|
||||
NSDebugMLLog(@"NSRunLoop", @"accept I/P before %f (sec from now %f)",
|
||||
[limit_date timeIntervalSinceReferenceDate], ti);
|
||||
if (ti >= INT_MAX / 1000)
|
||||
{
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
Date: 1996
|
||||
Rewrite/optimisation by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: 1998
|
||||
|
||||
|
||||
This file is part of the GNUstep Objective-C Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
<title>NSScanner class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
/* We need to define _GNU_SOURCE on systems (SuSE) to get LONG_LONG_MAX. */
|
||||
#ifndef _GNU_SOURCE
|
||||
|
@ -276,10 +276,10 @@ typedef struct {
|
|||
{
|
||||
switch (myCharacter(_scanLocation))
|
||||
{
|
||||
case '+':
|
||||
case '+':
|
||||
_scanLocation++;
|
||||
break;
|
||||
case '-':
|
||||
case '-':
|
||||
negative = YES;
|
||||
_scanLocation++;
|
||||
break;
|
||||
|
@ -386,7 +386,7 @@ typedef struct {
|
|||
case 'D': digitValue = 0xD; break;
|
||||
case 'E': digitValue = 0xE; break;
|
||||
case 'F': digitValue = 0xF; break;
|
||||
default:
|
||||
default:
|
||||
digitValue = radix;
|
||||
break;
|
||||
}
|
||||
|
@ -457,8 +457,8 @@ typedef struct {
|
|||
{
|
||||
switch (myCharacter(_scanLocation))
|
||||
{
|
||||
case 'x':
|
||||
case 'X':
|
||||
case 'x':
|
||||
case 'X':
|
||||
_scanLocation++;
|
||||
radix = 16;
|
||||
gotDigits = NO;
|
||||
|
@ -466,7 +466,7 @@ typedef struct {
|
|||
}
|
||||
}
|
||||
}
|
||||
if ( [self scanUnsignedInt_: value radix: radix gotDigits: gotDigits])
|
||||
if ([self scanUnsignedInt_: value radix: radix gotDigits: gotDigits])
|
||||
return YES;
|
||||
_scanLocation = saveScanLocation;
|
||||
return NO;
|
||||
|
@ -501,8 +501,8 @@ typedef struct {
|
|||
{
|
||||
switch (myCharacter(_scanLocation))
|
||||
{
|
||||
case 'x':
|
||||
case 'X':
|
||||
case 'x':
|
||||
case 'X':
|
||||
_scanLocation++; // Scan beyond the 0x prefix
|
||||
break;
|
||||
default:
|
||||
|
@ -555,10 +555,10 @@ typedef struct {
|
|||
{
|
||||
switch (myCharacter(_scanLocation))
|
||||
{
|
||||
case '+':
|
||||
case '+':
|
||||
_scanLocation++;
|
||||
break;
|
||||
case '-':
|
||||
case '-':
|
||||
negative = YES;
|
||||
_scanLocation++;
|
||||
break;
|
||||
|
@ -659,10 +659,10 @@ typedef struct {
|
|||
{
|
||||
switch (myCharacter(_scanLocation))
|
||||
{
|
||||
case '+':
|
||||
case '+':
|
||||
_scanLocation++;
|
||||
break;
|
||||
case '-':
|
||||
case '-':
|
||||
negative = YES;
|
||||
_scanLocation++;
|
||||
break;
|
||||
|
@ -765,7 +765,7 @@ typedef struct {
|
|||
- (BOOL) scanFloat: (float*)value
|
||||
{
|
||||
double num;
|
||||
|
||||
|
||||
if (value == NULL)
|
||||
return [self scanDouble: NULL];
|
||||
if ([self scanDouble: &num])
|
||||
|
@ -775,7 +775,7 @@ typedef struct {
|
|||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* After initial skipping (if any), this method scans any characters
|
||||
* from aSet, terminating when a character not in the set
|
||||
|
@ -784,7 +784,7 @@ typedef struct {
|
|||
* If value is not null, any character scanned are
|
||||
* stored in a string returned in this location.
|
||||
*/
|
||||
- (BOOL) scanCharactersFromSet: (NSCharacterSet *)aSet
|
||||
- (BOOL) scanCharactersFromSet: (NSCharacterSet *)aSet
|
||||
intoString: (NSString **)value
|
||||
{
|
||||
unsigned int saveScanLocation = _scanLocation;
|
||||
|
@ -843,7 +843,7 @@ typedef struct {
|
|||
* <br/>
|
||||
* Returns YES if anything is scanned, NO otherwise.
|
||||
*/
|
||||
- (BOOL) scanUpToCharactersFromSet: (NSCharacterSet *)aSet
|
||||
- (BOOL) scanUpToCharactersFromSet: (NSCharacterSet *)aSet
|
||||
intoString: (NSString **)value
|
||||
{
|
||||
unsigned int saveScanLocation = _scanLocation;
|
||||
|
@ -904,7 +904,7 @@ typedef struct {
|
|||
{
|
||||
NSRange range;
|
||||
unsigned int saveScanLocation = _scanLocation;
|
||||
|
||||
|
||||
skipToNextField();
|
||||
range.location = _scanLocation;
|
||||
range.length = [string length];
|
||||
|
@ -940,25 +940,25 @@ typedef struct {
|
|||
* conjunction with the -scanString:intoString: method.
|
||||
* </p>
|
||||
* <example>
|
||||
* NSString *ch = @"[";
|
||||
* unsigned total = 0;
|
||||
* NSString *ch = @"[";
|
||||
* unsigned total = 0;
|
||||
*
|
||||
* [scanner scanUpToString: ch intoString: NULL];
|
||||
* [scanner scanUpToString: ch intoString: NULL];
|
||||
* while ([scanner scanString: ch intoString: NULL] == YES)
|
||||
* {
|
||||
* {
|
||||
* total++;
|
||||
* [scanner scanUpToString: ch intoString: NULL];
|
||||
* }
|
||||
* NSLog(@"total %d", total);
|
||||
* [scanner scanUpToString: ch intoString: NULL];
|
||||
* }
|
||||
* NSLog(@"total %d", total);
|
||||
* </example>
|
||||
*/
|
||||
- (BOOL) scanUpToString: (NSString *)string
|
||||
- (BOOL) scanUpToString: (NSString *)string
|
||||
intoString: (NSString **)value
|
||||
{
|
||||
NSRange range;
|
||||
NSRange found;
|
||||
unsigned int saveScanLocation = _scanLocation;
|
||||
|
||||
|
||||
skipToNextField();
|
||||
range.location = _scanLocation;
|
||||
range.length = myLength() - _scanLocation;
|
||||
|
@ -1138,10 +1138,10 @@ GSScanInt(unichar *buf, unsigned length, int *result)
|
|||
{
|
||||
switch (buf[pos])
|
||||
{
|
||||
case '+':
|
||||
case '+':
|
||||
pos++;
|
||||
break;
|
||||
case '-':
|
||||
case '-':
|
||||
negative = YES;
|
||||
pos++;
|
||||
break;
|
||||
|
@ -1212,10 +1212,10 @@ GSScanDouble(unichar *buf, unsigned length, double *result)
|
|||
{
|
||||
switch (buf[pos])
|
||||
{
|
||||
case '+':
|
||||
case '+':
|
||||
pos++;
|
||||
break;
|
||||
case '-':
|
||||
case '-':
|
||||
negative = YES;
|
||||
pos++;
|
||||
break;
|
||||
|
|
|
@ -148,7 +148,7 @@ initSerializerInfo(_NSSerializerInfo* info, NSMutableData *d, BOOL u)
|
|||
Class c;
|
||||
|
||||
c = GSObjCClass(d);
|
||||
info->data = d;
|
||||
info->data = d;
|
||||
info->appImp = (void (*)(NSData*,SEL,const void*,unsigned))get_imp(c, appSel);
|
||||
info->datImp = (void* (*)(NSMutableData*,SEL))get_imp(c, datSel);
|
||||
info->lenImp = (unsigned int (*)(NSData*,SEL))get_imp(c, lenSel);
|
||||
|
@ -247,7 +247,7 @@ serializeToInfo(id object, _NSSerializerInfo* info)
|
|||
{
|
||||
unichar buffer[slen];
|
||||
[object getCharacters: buffer];
|
||||
memcpy((*info->datImp)(info->data, datSel) + dlen, buffer,
|
||||
memcpy((*info->datImp)(info->data, datSel) + dlen, buffer,
|
||||
slen*sizeof(unichar));
|
||||
}
|
||||
else
|
||||
|
@ -494,7 +494,7 @@ initDeserializerInfo(_NSDeserializerInfo* info, NSData *d, unsigned *c, BOOL m)
|
|||
|
||||
if (*c + 11 < l && memcmp(&b[*c-1], "GNUstepSer", 10) == 0)
|
||||
{
|
||||
*c += 9;
|
||||
*c += 9;
|
||||
(*info->debImp)(d, debSel, &u, 1, c);
|
||||
NSLog(@"Serialised data version %d not supported ..."
|
||||
@" try another version of GNUstep");
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/** NSSet - Set object to store key/value pairs
|
||||
Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: Sep 1995
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -105,7 +105,7 @@ static Class NSMutableSet_concrete_class;
|
|||
/**
|
||||
* New set containing (unique elements of) objects.
|
||||
*/
|
||||
+ (id) setWithObjects: (id*)objects
|
||||
+ (id) setWithObjects: (id*)objects
|
||||
count: (unsigned)count
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
|
@ -118,7 +118,7 @@ static Class NSMutableSet_concrete_class;
|
|||
+ (id) setWithObjects: firstObject, ...
|
||||
{
|
||||
id set;
|
||||
|
||||
|
||||
GS_USEIDLIST(firstObject,
|
||||
set = [[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: __objects count: __count]);
|
||||
|
@ -224,7 +224,7 @@ static Class NSMutableSet_concrete_class;
|
|||
{
|
||||
id array;
|
||||
|
||||
array = [(NSKeyedUnarchiver*)aCoder _decodeArrayOfObjectsForKey:
|
||||
array = [(NSKeyedUnarchiver*)aCoder _decodeArrayOfObjectsForKey:
|
||||
@"NS.objects"];
|
||||
if (array == nil)
|
||||
{
|
||||
|
@ -255,7 +255,7 @@ static Class NSMutableSet_concrete_class;
|
|||
{
|
||||
unsigned i;
|
||||
GS_BEGINIDBUF(objs, count);
|
||||
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &objs[i]];
|
||||
|
@ -322,7 +322,7 @@ static Class NSMutableSet_concrete_class;
|
|||
- (id) member: (id)anObject
|
||||
{
|
||||
return [self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -412,7 +412,7 @@ static Class NSMutableSet_concrete_class;
|
|||
/**
|
||||
* Initialize with same items as other (items not copied).
|
||||
*/
|
||||
- (id) initWithSet: (NSSet*)other
|
||||
- (id) initWithSet: (NSSet*)other
|
||||
{
|
||||
return [self initWithSet: other copyItems: NO];
|
||||
}
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
/** Implementation of network port object based on TCP sockets
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Based on code by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -121,7 +121,7 @@ static gsu32 maxDataLength = 10 * 1024 * 1024;
|
|||
/*
|
||||
* Theory of operation
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
@ -240,7 +240,7 @@ decodePort(NSData *data, NSString *defaultAddress)
|
|||
gsu32 length;
|
||||
NSHost *host;
|
||||
unichar c;
|
||||
|
||||
|
||||
pih = (GSPortItemHeader*)[data bytes];
|
||||
NSCAssert(GSSwapBigI32ToHost(pih->type) == GSP_PORT,
|
||||
NSInternalInconsistencyException);
|
||||
|
@ -250,7 +250,7 @@ decodePort(NSData *data, NSString *defaultAddress)
|
|||
if (strncmp(pi->addr, "VER", 3) == 0)
|
||||
{
|
||||
NSLog(@"Remote version of GNUstep at %s:%d is more recent than this one",
|
||||
pi->addr, pnum);
|
||||
pi->addr, pnum);
|
||||
return nil;
|
||||
}
|
||||
addr = [NSString stringWithCString: pi->addr];
|
||||
|
@ -290,7 +290,7 @@ newDataWithEncodedPort(NSSocketPort *port)
|
|||
unsigned plen;
|
||||
NSString *addr;
|
||||
gsu16 pnum;
|
||||
|
||||
|
||||
pnum = [port portNumber];
|
||||
addr = [port address];
|
||||
if (addr == nil)
|
||||
|
@ -629,7 +629,7 @@ static Class runLoopClass;
|
|||
{
|
||||
M_LOCK(myLock);
|
||||
if (valid == YES)
|
||||
{
|
||||
{
|
||||
NSRunLoop *l;
|
||||
|
||||
valid = NO;
|
||||
|
@ -1460,7 +1460,7 @@ static unsigned wordAlign;
|
|||
* we did the 'bind' call.
|
||||
*/
|
||||
port->listener = desc;
|
||||
port->portNum = GSSwapBigI16ToHost(sockaddr.sin_port);
|
||||
port->portNum = GSSwapBigI16ToHost(sockaddr.sin_port);
|
||||
/*
|
||||
* Make sure we have the map table for this port.
|
||||
*/
|
||||
|
@ -1471,7 +1471,7 @@ static unsigned wordAlign;
|
|||
/*
|
||||
* No known ports with this port number -
|
||||
* create the map table to add the new port to.
|
||||
*/
|
||||
*/
|
||||
thePorts = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
NSMapInsert(tcpPortMap, (void*)(gsaddr)port->portNum,
|
||||
|
@ -1496,7 +1496,7 @@ static unsigned wordAlign;
|
|||
/*
|
||||
* No known ports within this port number -
|
||||
* create the map table to add the new port to.
|
||||
*/
|
||||
*/
|
||||
thePorts = NSCreateMapTable(NSIntMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
NSMapInsert(tcpPortMap, (void*)(gsaddr)number, (void*)thePorts);
|
||||
|
@ -1999,7 +1999,7 @@ static unsigned wordAlign;
|
|||
[header setLength: rl];
|
||||
[components insertObject: header atIndex: 0];
|
||||
RELEASE(header);
|
||||
}
|
||||
}
|
||||
|
||||
header = [components objectAtIndex: 0];
|
||||
/*
|
||||
|
|
|
@ -103,7 +103,7 @@ typedef enum {
|
|||
unsigned expecting;
|
||||
NSMutableData *data;
|
||||
NSFileHandle *handle;
|
||||
GSPortComState state;
|
||||
GSPortComState state;
|
||||
struct in_addr addr;
|
||||
}
|
||||
- (struct in_addr) addr;
|
||||
|
@ -172,7 +172,7 @@ typedef enum {
|
|||
{
|
||||
NSDebugMLLog(@"NSSocketPortNameServer",
|
||||
@"failed connect to gdomap on %@ - %@",
|
||||
[[notification object] socketAddress], e);
|
||||
[[notification object] socketAddress], e);
|
||||
/*
|
||||
* Remove our file handle, then either retry or fail.
|
||||
*/
|
||||
|
@ -193,7 +193,7 @@ typedef enum {
|
|||
@"Trying to launch gdomap from %@ or a machine/operating-system subdirectory.\n"
|
||||
@"It is recommended that you start up gdomap at login time or (better) when\n"
|
||||
@"your computer is started instead.",
|
||||
[launchCmd stringByDeletingLastPathComponent]);
|
||||
[launchCmd stringByDeletingLastPathComponent]);
|
||||
[NSTask launchedTaskWithLaunchPath: launchCmd arguments: nil];
|
||||
timer = [NSTimer timerWithTimeInterval: 5.0
|
||||
invocation: nil
|
||||
|
@ -201,7 +201,7 @@ typedef enum {
|
|||
[loop addTimer: timer forMode: [loop currentMode]];
|
||||
[loop runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 5.0]];
|
||||
NSDebugMLLog(@"NSSocketPortNameServer",
|
||||
@"retrying local connection to gdomap");
|
||||
@"retrying local connection to gdomap");
|
||||
state = GSPC_RETRY;
|
||||
[self open: nil];
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ typedef enum {
|
|||
{
|
||||
[self fail];
|
||||
NSLog(@"NSSocketPortNameServer lost connection to gdomap on %@",
|
||||
[[notification object] socketAddress]);
|
||||
[[notification object] socketAddress]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -308,7 +308,7 @@ typedef enum {
|
|||
{
|
||||
[self fail];
|
||||
NSLog(@"NSSocketPortNameServer failed write to gdomap on %@ - %@",
|
||||
[[notification object] socketAddress], e);
|
||||
[[notification object] socketAddress], e);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -538,7 +538,7 @@ typedef enum {
|
|||
+ (id) allocWithZone: (NSZone*)aZone
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"attempt to create extra port name server"];
|
||||
format: @"attempt to create extra port name server"];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -586,7 +586,7 @@ typedef enum {
|
|||
- (void) dealloc
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"attempt to deallocate default port name server"];
|
||||
format: @"attempt to deallocate default port name server"];
|
||||
}
|
||||
|
||||
- (BOOL) _lookupName: (NSString*)name onHost: (NSString*)host
|
||||
|
@ -606,20 +606,20 @@ typedef enum {
|
|||
if (name == nil)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to lookup port with nil name"];
|
||||
format: @"attempt to lookup port with nil name"];
|
||||
}
|
||||
|
||||
len = [name cStringLength];
|
||||
if (len == 0)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to lookup port with no name"];
|
||||
format: @"attempt to lookup port with no name"];
|
||||
}
|
||||
if (len > GDO_NAME_MAX_LEN)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"name of port is too long (max %d) bytes",
|
||||
GDO_NAME_MAX_LEN];
|
||||
GDO_NAME_MAX_LEN];
|
||||
}
|
||||
|
||||
limit = [NSDate dateWithTimeIntervalSinceNow: timeout];
|
||||
|
@ -658,7 +658,7 @@ typedef enum {
|
|||
if ([com state] != GSPC_DONE)
|
||||
{
|
||||
[NSException raise: NSPortTimeoutException
|
||||
format: @"timed out listing name servers"];
|
||||
format: @"timed out listing name servers"];
|
||||
}
|
||||
/*
|
||||
* Retain and autorelease the data item so the buffer won't disappear
|
||||
|
@ -865,30 +865,30 @@ typedef enum {
|
|||
if (name == nil)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to register port with nil name"];
|
||||
format: @"attempt to register port with nil name"];
|
||||
}
|
||||
if (port == nil)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to register nil port"];
|
||||
format: @"attempt to register nil port"];
|
||||
}
|
||||
if ([port isKindOfClass: portClass] == NO)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to register port of unexpected class (%@)",
|
||||
port];
|
||||
port];
|
||||
}
|
||||
len = [name cStringLength];
|
||||
if (len == 0)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to register port with no name"];
|
||||
format: @"attempt to register port with no name"];
|
||||
}
|
||||
if (len > GDO_NAME_MAX_LEN)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"name of port is too long (max %d) bytes",
|
||||
GDO_NAME_MAX_LEN];
|
||||
GDO_NAME_MAX_LEN];
|
||||
}
|
||||
|
||||
limit = [NSDate dateWithTimeIntervalSinceNow: timeout];
|
||||
|
@ -913,7 +913,7 @@ typedef enum {
|
|||
|
||||
/*
|
||||
* If this port has never been registered under any name, first
|
||||
* send an unregister message to gdomap to ensure that any old
|
||||
* send an unregister message to gdomap to ensure that any old
|
||||
* names for the port (perhaps from a server that crashed without
|
||||
* unregistering its ports) are no longer around.
|
||||
*/
|
||||
|
@ -931,7 +931,7 @@ typedef enum {
|
|||
if ([com state] != GSPC_DONE)
|
||||
{
|
||||
[NSException raise: NSPortTimeoutException
|
||||
format: @"timed out unregistering port"];
|
||||
format: @"timed out unregistering port"];
|
||||
}
|
||||
DESTROY(com);
|
||||
}
|
||||
|
@ -947,7 +947,7 @@ typedef enum {
|
|||
if ([com state] != GSPC_DONE)
|
||||
{
|
||||
[NSException raise: NSPortTimeoutException
|
||||
format: @"timed out registering port %@", name];
|
||||
format: @"timed out registering port %@", name];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1048,20 +1048,20 @@ typedef enum {
|
|||
if (name == nil)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to remove port with nil name"];
|
||||
format: @"attempt to remove port with nil name"];
|
||||
}
|
||||
|
||||
len = [name cStringLength];
|
||||
if (len == 0)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to remove port with no name"];
|
||||
format: @"attempt to remove port with no name"];
|
||||
}
|
||||
if (len > GDO_NAME_MAX_LEN)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"name of port is too long (max %d) bytes",
|
||||
GDO_NAME_MAX_LEN];
|
||||
GDO_NAME_MAX_LEN];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1084,7 +1084,7 @@ typedef enum {
|
|||
if ([com state] != GSPC_DONE)
|
||||
{
|
||||
[NSException raise: NSPortTimeoutException
|
||||
format: @"timed out unregistering port"];
|
||||
format: @"timed out unregistering port"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1162,7 +1162,7 @@ typedef enum {
|
|||
if (port == nil)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to get names for nil port"];
|
||||
format: @"attempt to get names for nil port"];
|
||||
}
|
||||
/*
|
||||
* Lock out other threads while grabbing port names.
|
||||
|
|
|
@ -1739,7 +1739,7 @@ handle_printf_atsign (FILE *stream,
|
|||
* be at index 0, 1, and 2).<br />
|
||||
* If the supplied index is greater than or equal to the length of the
|
||||
* receiver an exception is raised.
|
||||
*/
|
||||
*/
|
||||
- (NSString*) substringFromIndex: (unsigned int)index
|
||||
{
|
||||
return [self substringWithRange: ((NSRange){index, [self length]-index})];
|
||||
|
@ -1752,7 +1752,7 @@ handle_printf_atsign (FILE *stream,
|
|||
* the first three characters of the receiver.<br />
|
||||
* If the supplied index is greater than the length of the receiver
|
||||
* an exception is raised.
|
||||
*/
|
||||
*/
|
||||
- (NSString*) substringToIndex: (unsigned int)index
|
||||
{
|
||||
return [self substringWithRange: ((NSRange){0,index})];;
|
||||
|
@ -2411,7 +2411,7 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
BOOL found = NO;
|
||||
end = aRange.location;
|
||||
if(aRange.length)
|
||||
if (aRange.length)
|
||||
{
|
||||
end += (aRange.length - 1);
|
||||
}
|
||||
|
@ -3218,7 +3218,7 @@ static NSFileManager *fm = nil;
|
|||
/**
|
||||
* Converts this string, which is assumed to be a path in Unix notation ('/'
|
||||
* is file separator, '.' is extension separator) to a string path expressed
|
||||
* in the convention for the host operating system.
|
||||
* in the convention for the host operating system.
|
||||
*/
|
||||
- (NSString*) localFromOpenStepPath
|
||||
{
|
||||
|
@ -3231,9 +3231,9 @@ static NSFileManager *fm = nil;
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts this string, which is assumed to be a path in the convention
|
||||
* Converts this string, which is assumed to be a path in the convention
|
||||
* for the host operating system to a string path expressed
|
||||
* in Unix notation ('/' is file separator, '.' is extension separator).
|
||||
* in Unix notation ('/' is file separator, '.' is extension separator).
|
||||
*/
|
||||
- (NSString*) openStepPathFromLocal
|
||||
{
|
||||
|
@ -3735,7 +3735,7 @@ static NSFileManager *fm = nil;
|
|||
*/
|
||||
- (NSString*) stringByReplacingPercentEscapesUsingEncoding: (NSStringEncoding)e
|
||||
{
|
||||
NSMutableData *d;
|
||||
NSMutableData *d;
|
||||
NSString *s = nil;
|
||||
|
||||
d = [[self dataUsingEncoding: NSASCIIStringEncoding] mutableCopy];
|
||||
|
@ -4500,7 +4500,7 @@ static NSFileManager *fm = nil;
|
|||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
NSString *string = (NSString*)[(NSKeyedUnarchiver*)aCoder
|
||||
NSString *string = (NSString*)[(NSKeyedUnarchiver*)aCoder
|
||||
_decodePropertyListForKey: @"NS.string"];
|
||||
|
||||
self = [self initWithString: string];
|
||||
|
@ -4515,18 +4515,18 @@ static NSFileManager *fm = nil;
|
|||
{
|
||||
NSStringEncoding enc;
|
||||
NSZone *zone;
|
||||
|
||||
|
||||
[aCoder decodeValueOfObjCType: @encode(NSStringEncoding) at: &enc];
|
||||
#if GS_WITH_GC
|
||||
zone = GSAtomicMallocZone();
|
||||
#else
|
||||
zone = GSObjCZone(self);
|
||||
#endif
|
||||
|
||||
|
||||
if (enc == NSUnicodeStringEncoding)
|
||||
{
|
||||
unichar *chars;
|
||||
|
||||
|
||||
chars = NSZoneMalloc(zone, count*sizeof(unichar));
|
||||
[aCoder decodeArrayOfObjCType: @encode(unichar)
|
||||
count: count
|
||||
|
@ -4539,7 +4539,7 @@ static NSFileManager *fm = nil;
|
|||
|| enc == _DefaultStringEncoding)
|
||||
{
|
||||
unsigned char *chars;
|
||||
|
||||
|
||||
chars = NSZoneMalloc(zone, count+1);
|
||||
[aCoder decodeArrayOfObjCType: @encode(unsigned char)
|
||||
count: count
|
||||
|
@ -4564,7 +4564,7 @@ static NSFileManager *fm = nil;
|
|||
{
|
||||
unsigned char *chars;
|
||||
NSData *data;
|
||||
|
||||
|
||||
chars = NSZoneMalloc(zone, count);
|
||||
[aCoder decodeArrayOfObjCType: @encode(unsigned char)
|
||||
count: count
|
||||
|
@ -4679,12 +4679,12 @@ static NSFileManager *fm = nil;
|
|||
* followed by a semicolon. In this case, the value for that key is
|
||||
* assumed to be an empty string.
|
||||
* </p>
|
||||
* <example>
|
||||
* <example>
|
||||
* // Strings file entries follow -
|
||||
* key1 = " a string value";
|
||||
* key2; // This key has an empty string as a value.
|
||||
* "Another key" = "a longer string value for th third key";
|
||||
* </example>
|
||||
* </example>
|
||||
*/
|
||||
- (NSDictionary*) propertyListFromStringsFileFormat
|
||||
{
|
||||
|
|
|
@ -543,7 +543,7 @@ pty_slave(const char* name)
|
|||
* The default behavior is to inherit the parent processes
|
||||
* stdout stream.<br />
|
||||
* This method cannot be used after a task is launched ...
|
||||
* it raises an NSInvalidArgumentException.
|
||||
* it raises an NSInvalidArgumentException.
|
||||
*/
|
||||
- (void) setStandardOutput: (id)hdl
|
||||
{
|
||||
|
@ -982,7 +982,7 @@ GSCheckTasks()
|
|||
static DWORD WINAPI _threadFunction(LPVOID t)
|
||||
{
|
||||
DWORD milliseconds = 60000;
|
||||
int taskId = [(NSTask*)t processIdentifier];
|
||||
int taskId = [(NSTask*)t processIdentifier];
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -1016,7 +1016,7 @@ endSlashesDoubledFromString(NSString *aString)
|
|||
{
|
||||
int i = [aString length] - 2;
|
||||
NSMutableString *returnString;
|
||||
|
||||
|
||||
if (![aString hasSuffix:@"\\"])
|
||||
{
|
||||
return aString;
|
||||
|
@ -1037,7 +1037,7 @@ quotedFromString(NSString *aString)
|
|||
NSString *resultString;
|
||||
NSMutableArray *components;
|
||||
int i;
|
||||
|
||||
|
||||
/* First split on "'s */
|
||||
components = [NSMutableArray arrayWithArray:
|
||||
[aString componentsSeparatedByString: @"\""]];
|
||||
|
@ -1075,7 +1075,7 @@ quotedFromString(NSString *aString)
|
|||
const wchar_t *wexecutable;
|
||||
LPVOID envp = 0;
|
||||
NSDictionary *env;
|
||||
|
||||
|
||||
if (_hasLaunched)
|
||||
{
|
||||
return;
|
||||
|
@ -1093,7 +1093,7 @@ quotedFromString(NSString *aString)
|
|||
[args appendString: @" "];
|
||||
[args appendString: quotedFromString(arg)];
|
||||
}
|
||||
|
||||
|
||||
w_args = NSZoneMalloc(NSDefaultMallocZone(),
|
||||
sizeof(wchar_t) * ([args length] + 1));
|
||||
[args getCharacters: (unichar*)w_args];
|
||||
|
@ -1106,7 +1106,7 @@ quotedFromString(NSString *aString)
|
|||
NSString *key;
|
||||
unichar terminator = 0;
|
||||
CREATE_AUTORELEASE_POOL(pool);
|
||||
|
||||
|
||||
// Win32 environment variables must be sorted by name
|
||||
enumerator = [[[env allKeys]
|
||||
sortedArrayUsingSelector: @selector(compare:)] objectEnumerator];
|
||||
|
@ -1127,10 +1127,10 @@ quotedFromString(NSString *aString)
|
|||
{
|
||||
r.length = 1024;
|
||||
}
|
||||
|
||||
|
||||
[setting getCharacters: buffer range: r];
|
||||
[data appendBytes: buffer length: (r.length)*sizeof(unichar)];
|
||||
|
||||
|
||||
r.location += r.length;
|
||||
}
|
||||
[data appendBytes: &terminator length: 2]; // end of setting
|
||||
|
@ -1146,7 +1146,7 @@ quotedFromString(NSString *aString)
|
|||
start_info.hStdInput = [[self standardInput] nativeHandle];
|
||||
start_info.hStdOutput = [[self standardOutput] nativeHandle];
|
||||
start_info.hStdError = [[self standardError] nativeHandle];
|
||||
|
||||
|
||||
result = CreateProcessW(wexecutable,
|
||||
w_args,
|
||||
NULL, /* proc attrs */
|
||||
|
@ -1163,7 +1163,7 @@ quotedFromString(NSString *aString)
|
|||
NSLog(@"Error launching task: %@", lpath);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_taskId = procInfo.dwProcessId;
|
||||
_hasLaunched = YES;
|
||||
ASSIGN(_launchPath, lpath); // Actual path used.
|
||||
|
@ -1242,7 +1242,7 @@ GSCheckTasks()
|
|||
}
|
||||
}
|
||||
}
|
||||
while (result > 0);
|
||||
while (result > 0);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
Rewritten by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
to add optimisations features for faster thread access.
|
||||
Modified by: Nicola Pero <n.pero@mi.flashnet.it>
|
||||
to add GNUstep extensions allowing to interact with threads created
|
||||
to add GNUstep extensions allowing to interact with threads created
|
||||
by external libraries/code (eg, a Java Virtual Machine).
|
||||
|
||||
|
||||
This file is part of the GNUstep Objective-C Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
<title>NSThread class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
@ -187,14 +187,14 @@ inline static void objc_thread_add (void)
|
|||
objc_mutex_lock(__objc_runtime_mutex);
|
||||
__objc_is_multi_threaded = 1;
|
||||
__objc_runtime_threads_alive++;
|
||||
objc_mutex_unlock(__objc_runtime_mutex);
|
||||
objc_mutex_unlock(__objc_runtime_mutex);
|
||||
}
|
||||
|
||||
inline static void objc_thread_remove (void)
|
||||
{
|
||||
objc_mutex_lock(__objc_runtime_mutex);
|
||||
__objc_runtime_threads_alive--;
|
||||
objc_mutex_unlock(__objc_runtime_mutex);
|
||||
objc_mutex_unlock(__objc_runtime_mutex);
|
||||
}
|
||||
#endif /* not HAVE_OBJC_THREAD_ADD */
|
||||
|
||||
|
@ -277,7 +277,7 @@ GSDictionaryForThread(NSThread *t)
|
|||
{
|
||||
return nil;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
NSMutableDictionary *dict = t->_thread_dictionary;
|
||||
|
||||
|
@ -285,7 +285,7 @@ GSDictionaryForThread(NSThread *t)
|
|||
{
|
||||
dict = [t threadDictionary];
|
||||
}
|
||||
return dict;
|
||||
return dict;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,7 +453,7 @@ gnustep_base_thread_callback(void)
|
|||
+ (NSThread*) currentThread
|
||||
{
|
||||
NSThread *t = nil;
|
||||
|
||||
|
||||
if (entered_multi_threaded_state == NO)
|
||||
{
|
||||
/*
|
||||
|
@ -481,7 +481,7 @@ gnustep_base_thread_callback(void)
|
|||
* anArgument. This should have no return value, and must set up an
|
||||
* autorelease pool if retain/release memory management is used. It should
|
||||
* free this pool before it finishes execution.</p>
|
||||
*
|
||||
*
|
||||
* <p><strong>Note</strong>, unlike in Cocoa (and perhaps OpenStep), the
|
||||
* thread will <em>not</em> exit when the method finishes execution. You must
|
||||
* call [Thread +exit] yourself (from the thread) to terminate it.</p> */
|
||||
|
@ -846,16 +846,16 @@ static NSDate *theFuture;
|
|||
* treated as sockets so this will not WORK.
|
||||
* Consequence, performSelectorOnMainThread methods will not
|
||||
* work.
|
||||
*/
|
||||
*/
|
||||
#ifndef __MINGW__
|
||||
for (i = 0; i < count; i++ )
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
[loop addEvent: (void*)inputFd
|
||||
type: ET_RDESC
|
||||
watcher: (id<RunLoopEvents>)self
|
||||
forMode: [m objectAtIndex: i]];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (BOOL) isValid
|
||||
|
@ -912,7 +912,7 @@ static NSDate *theFuture;
|
|||
modes: h->modes];
|
||||
}
|
||||
[perfArray removeAllObjects];
|
||||
|
||||
|
||||
[subthreadsLock unlock];
|
||||
}
|
||||
|
||||
|
@ -1038,7 +1038,7 @@ static NSDate *theFuture;
|
|||
{
|
||||
l = [[NSConditionLock alloc] init];
|
||||
}
|
||||
|
||||
|
||||
h = [GSPerformHolder newForReceiver: self
|
||||
argument: anObject
|
||||
selector: aSelector
|
||||
|
@ -1122,7 +1122,7 @@ GSRegisterCurrentThread (void)
|
|||
/*
|
||||
* Create the new thread object.
|
||||
*/
|
||||
thread = (NSThread*)NSAllocateObject (threadClass, 0,
|
||||
thread = (NSThread*)NSAllocateObject (threadClass, 0,
|
||||
NSDefaultMallocZone ());
|
||||
thread = [thread _initWithSelector: NULL toTarget: nil withObject: nil];
|
||||
objc_thread_set_data (thread);
|
||||
|
@ -1130,7 +1130,7 @@ GSRegisterCurrentThread (void)
|
|||
}
|
||||
|
||||
/*
|
||||
* We post the notification after we register the thread.
|
||||
* We post the notification after we register the thread.
|
||||
* NB. Even if we are the default thread, we do this to register the app
|
||||
* as being multi-threaded - this is so that, if this thread is unregistered
|
||||
* later, it does not leave us with a bad default thread.
|
||||
|
@ -1144,7 +1144,7 @@ GSRegisterCurrentThread (void)
|
|||
* <p>
|
||||
* This function is provided to let threads started by some other
|
||||
* software library unregister themselves from the GNUstep threading
|
||||
* system.
|
||||
* system.
|
||||
* </p>
|
||||
* <p>
|
||||
* Calling this function causes a
|
||||
|
@ -1159,14 +1159,14 @@ GSUnregisterCurrentThread (void)
|
|||
NSThread *thread;
|
||||
|
||||
thread = GSCurrentThread();
|
||||
|
||||
|
||||
if (((NSThread_ivars *)thread)->_active == YES)
|
||||
{
|
||||
/*
|
||||
* Set the thread to be inactive to avoid any possibility of recursion.
|
||||
*/
|
||||
((NSThread_ivars *)thread)->_active = NO;
|
||||
|
||||
|
||||
/*
|
||||
* Let observers know this thread is exiting.
|
||||
*/
|
||||
|
@ -1176,7 +1176,7 @@ GSUnregisterCurrentThread (void)
|
|||
}
|
||||
[nc postNotificationName: NSThreadWillExitNotification
|
||||
object: thread
|
||||
userInfo: nil];
|
||||
userInfo: nil];
|
||||
|
||||
/*
|
||||
* destroy the thread object.
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
/** Time zone management. -*- Mode: ObjC -*-
|
||||
Copyright (C) 1997-2002 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Yoo C. Chung <wacko@laplace.snu.ac.kr>
|
||||
Date: June 1997
|
||||
|
||||
|
||||
Rewrite large chunks by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: September 2002
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License
|
||||
as published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -26,7 +26,7 @@
|
|||
<title>NSTimeZone class reference</title>
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
|
||||
|
||||
/* Use the system time zones if available. In other cases, use an
|
||||
implementation independent of the system, since POSIX functions for
|
||||
time zones are woefully inadequate for implementing NSTimeZone.
|
||||
|
@ -56,10 +56,10 @@
|
|||
|
||||
Files & File System Heirarchy info:
|
||||
===================================
|
||||
|
||||
|
||||
Default place for the NSTimeZone directory is _time_zone_path():
|
||||
{$(GNUSTEP_SYSTEM_ROOT)Libary/Libraries/Resources/TIME_ZONE_DIR}
|
||||
|
||||
|
||||
LOCAL_TIME_FILE is a text file with the name of the time zone file.
|
||||
|
||||
ZONES_DIR is a sub-directory under TIME_ZONE_DIR
|
||||
|
@ -72,7 +72,7 @@
|
|||
Note that full zone info is required, especially the various "GMT"
|
||||
files which are created especially for OPENSTEP compatibility.
|
||||
Zone info comes from the Olson time database.
|
||||
|
||||
|
||||
FIXME?: use leap seconds? */
|
||||
|
||||
#include "config.h"
|
||||
|
@ -264,14 +264,14 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
|
|||
if (type == nil)
|
||||
type = @"";
|
||||
gbundle = [NSBundle bundleForLibrary: @"gnustep-base"];
|
||||
return [gbundle pathForResource: subpath
|
||||
return [gbundle pathForResource: subpath
|
||||
ofType: type
|
||||
inDirectory: TIME_ZONE_DIR];
|
||||
}
|
||||
|
||||
@interface GSPlaceholderTimeZone : NSTimeZone
|
||||
@end
|
||||
|
||||
|
||||
@interface GSAbsTimeZone : NSTimeZone
|
||||
{
|
||||
@public
|
||||
|
@ -282,7 +282,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
|
|||
|
||||
- (id) initWithOffset: (int)anOffset;
|
||||
@end
|
||||
|
||||
|
||||
@interface NSLocalTimeZone : NSTimeZone
|
||||
@end
|
||||
|
||||
|
@ -299,7 +299,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
|
|||
withOffset: (int)anOffset
|
||||
withDST: (BOOL)isDST;
|
||||
@end
|
||||
|
||||
|
||||
@interface GSAbsTimeZoneDetail : NSTimeZoneDetail
|
||||
{
|
||||
GSAbsTimeZone *zone; // Time zone which created this object.
|
||||
|
@ -307,7 +307,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
|
|||
|
||||
- (id) initWithTimeZone: (GSAbsTimeZone*)aZone;
|
||||
@end
|
||||
|
||||
|
||||
/* Private methods for obtaining resource file names. */
|
||||
@interface NSTimeZone (Private)
|
||||
+ (NSString*) getTimeZoneFile: (NSString*)name;
|
||||
|
@ -459,7 +459,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
|
|||
|
||||
|
||||
@implementation NSLocalTimeZone
|
||||
|
||||
|
||||
- (NSString*) abbreviation
|
||||
{
|
||||
return [[NSTimeZoneClass defaultTimeZone] abbreviation];
|
||||
|
@ -528,7 +528,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
|
|||
{
|
||||
return [[NSTimeZoneClass defaultTimeZone] timeZoneDetailArray];
|
||||
}
|
||||
|
||||
|
||||
- (NSTimeZoneDetail*) timeZoneDetailForDate: (NSDate*)date
|
||||
{
|
||||
return [[NSTimeZoneClass defaultTimeZone] timeZoneDetailForDate: date];
|
||||
|
@ -678,21 +678,21 @@ static NSMapTable *absolutes = 0;
|
|||
{
|
||||
return [NSTimeZone arrayWithObject: detail];
|
||||
}
|
||||
|
||||
|
||||
- (NSTimeZoneDetail*) timeZoneDetailForDate: (NSDate*)date
|
||||
{
|
||||
return detail;
|
||||
}
|
||||
|
||||
|
||||
- (NSString*) timeZoneName
|
||||
{
|
||||
return name;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation GSTimeZoneDetail
|
||||
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(timeZone);
|
||||
|
@ -718,22 +718,22 @@ static NSMapTable *absolutes = 0;
|
|||
is_dst = isDST;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) isDaylightSavingTimeZone
|
||||
{
|
||||
return is_dst;
|
||||
}
|
||||
|
||||
|
||||
- (NSString*) name
|
||||
{
|
||||
return [timeZone name];
|
||||
}
|
||||
|
||||
|
||||
- (NSString*) timeZoneAbbreviation
|
||||
{
|
||||
return abbrev;
|
||||
}
|
||||
|
||||
|
||||
- (NSArray*) timeZoneDetailArray
|
||||
{
|
||||
return [timeZone timeZoneDetailArray];
|
||||
|
@ -753,12 +753,12 @@ static NSMapTable *absolutes = 0;
|
|||
{
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation GSAbsTimeZoneDetail
|
||||
|
||||
|
||||
- (NSString*) abbreviation
|
||||
{
|
||||
return zone->name;
|
||||
|
@ -780,27 +780,27 @@ static NSMapTable *absolutes = 0;
|
|||
zone = RETAIN(aZone);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) isDaylightSavingTimeZone
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) isDaylightSavingTimeZoneForDate: (NSDate*)aDate
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
- (NSString*) name
|
||||
{
|
||||
return zone->name;
|
||||
}
|
||||
|
||||
|
||||
- (NSString*) timeZoneAbbreviation
|
||||
{
|
||||
return zone->name;
|
||||
}
|
||||
|
||||
|
||||
- (NSArray*) timeZoneDetailArray
|
||||
{
|
||||
return [zone timeZoneDetailArray];
|
||||
|
@ -820,7 +820,7 @@ static NSMapTable *absolutes = 0;
|
|||
{
|
||||
return zone->offset;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -867,7 +867,7 @@ static NSMapTable *absolutes = 0;
|
|||
* Returns a dictionary containing time zone abbreviations and their
|
||||
* corresponding time zone names. More than one time zone may be associated
|
||||
* with a single abbreviation. In this case, the dictionary contains only
|
||||
* one (usually the most common) time zone name for the abbreviation.
|
||||
* one (usually the most common) time zone name for the abbreviation.
|
||||
*/
|
||||
+ (NSDictionary*) abbreviationDictionary
|
||||
{
|
||||
|
@ -882,9 +882,9 @@ static NSMapTable *absolutes = 0;
|
|||
raise: NSInternalInconsistencyException
|
||||
format: @"Failed to open time zone abbreviation dictionary."];
|
||||
}
|
||||
abbreviationDictionary =
|
||||
abbreviationDictionary =
|
||||
[[NSString stringWithContentsOfFile: path] propertyList];
|
||||
abbreviationDictionary =
|
||||
abbreviationDictionary =
|
||||
[abbreviationDictionary makeImmutableCopyOnFail: NO];
|
||||
return RETAIN(abbreviationDictionary);
|
||||
}
|
||||
|
@ -1163,10 +1163,10 @@ static NSMapTable *absolutes = 0;
|
|||
*/
|
||||
localZoneString = [[NSUserDefaults standardUserDefaults]
|
||||
stringForKey: LOCALDBKEY];
|
||||
|
||||
|
||||
/*
|
||||
* Try to get timezone from GNUSTEP_TZ environment variable.
|
||||
*/
|
||||
*/
|
||||
if (localZoneString == nil)
|
||||
{
|
||||
localZoneString = [[[NSProcessInfo processInfo]
|
||||
|
@ -1220,12 +1220,12 @@ static NSMapTable *absolutes = 0;
|
|||
}
|
||||
}
|
||||
#endif
|
||||
if ( localZoneString != nil && [localZoneString hasPrefix: tzdir] )
|
||||
if (localZoneString != nil && [localZoneString hasPrefix: tzdir])
|
||||
{
|
||||
/* This must be the time zone name */
|
||||
localZoneString = [[localZoneString mutableCopy] autorelease];
|
||||
[(NSMutableString *)localZoneString deletePrefix: tzdir];
|
||||
if ( [localZoneString hasPrefix: @"/"] )
|
||||
if ([localZoneString hasPrefix: @"/"])
|
||||
{
|
||||
[(NSMutableString *)localZoneString deletePrefix: @"/"];
|
||||
}
|
||||
|
@ -1251,7 +1251,7 @@ static NSMapTable *absolutes = 0;
|
|||
*/
|
||||
{
|
||||
HKEY regkey;
|
||||
|
||||
|
||||
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, \
|
||||
"SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation", 0, KEY_READ, ®key))
|
||||
{
|
||||
|
@ -1270,8 +1270,8 @@ static NSMapTable *absolutes = 0;
|
|||
RegCloseKey(regkey);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if (localZoneString != nil)
|
||||
{
|
||||
NSDebugLLog (@"NSTimeZone", @"Using zone %@", localZoneString);
|
||||
|
@ -1608,7 +1608,7 @@ static NSMapTable *absolutes = 0;
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
* This class serves no useful purpose in GNUstep, and is provided
|
||||
* solely for backward compatibility with the OpenStep spec. It is
|
||||
|
@ -1632,7 +1632,7 @@ static NSMapTable *absolutes = 0;
|
|||
[self subclassResponsibility: _cmd];
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DEPRECATED: Class is no longer used.
|
||||
*/
|
||||
|
@ -1640,7 +1640,7 @@ static NSMapTable *absolutes = 0;
|
|||
{
|
||||
return [self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DEPRECATED: Class is no longer used.
|
||||
*/
|
||||
|
@ -1662,7 +1662,7 @@ static NSMapTable *absolutes = 0;
|
|||
{
|
||||
NSString *dir = nil;
|
||||
|
||||
/* Use the system zone info if possible, otherwise, use our installed
|
||||
/* Use the system zone info if possible, otherwise, use our installed
|
||||
info. */
|
||||
if (tzdir && [[NSFileManager defaultManager] fileExistsAtPath:
|
||||
[tzdir stringByAppendingPathComponent: name]] == NO)
|
||||
|
@ -1758,55 +1758,55 @@ int dayOfCommonEra(NSTimeInterval when);
|
|||
Unfortunately name is a localized value. The keys in the registry are
|
||||
unlocalized names. */
|
||||
CHAR achKey[255]; // buffer for subkey name
|
||||
DWORD cbName; // size of name string
|
||||
CHAR achClass[MAX_PATH] = ""; // buffer for class name
|
||||
DWORD cchClassName = MAX_PATH; // size of class string
|
||||
DWORD cSubKeys=0; // number of subkeys
|
||||
DWORD cbMaxSubKey; // longest subkey size
|
||||
DWORD cchMaxClass; // longest class string
|
||||
DWORD cValues; // number of values for key
|
||||
DWORD cchMaxValue; // longest value name
|
||||
DWORD cbMaxValueData; // longest value data
|
||||
DWORD cbSecurityDescriptor; // size of security descriptor
|
||||
FILETIME ftLastWriteTime; // last write time
|
||||
DWORD cbName; // size of name string
|
||||
CHAR achClass[MAX_PATH] = ""; // buffer for class name
|
||||
DWORD cchClassName = MAX_PATH; // size of class string
|
||||
DWORD cSubKeys=0; // number of subkeys
|
||||
DWORD cbMaxSubKey; // longest subkey size
|
||||
DWORD cchMaxClass; // longest class string
|
||||
DWORD cValues; // number of values for key
|
||||
DWORD cchMaxValue; // longest value name
|
||||
DWORD cbMaxValueData; // longest value data
|
||||
DWORD cbSecurityDescriptor; // size of security descriptor
|
||||
FILETIME ftLastWriteTime; // last write time
|
||||
|
||||
DWORD i, retCode;
|
||||
BOOL tzFound = NO;
|
||||
|
||||
/* Get the class name and the value count. */
|
||||
retCode = RegQueryInfoKey(
|
||||
regDirKey, // key handle
|
||||
achClass, // buffer for class name
|
||||
&cchClassName, // size of class string
|
||||
NULL, // reserved
|
||||
&cSubKeys, // number of subkeys
|
||||
&cbMaxSubKey, // longest subkey size
|
||||
&cchMaxClass, // longest class string
|
||||
&cValues, // number of values for this key
|
||||
&cchMaxValue, // longest value name
|
||||
&cbMaxValueData, // longest value data
|
||||
&cbSecurityDescriptor, // security descriptor
|
||||
&ftLastWriteTime); // last write time
|
||||
regDirKey, // key handle
|
||||
achClass, // buffer for class name
|
||||
&cchClassName, // size of class string
|
||||
NULL, // reserved
|
||||
&cSubKeys, // number of subkeys
|
||||
&cbMaxSubKey, // longest subkey size
|
||||
&cchMaxClass, // longest class string
|
||||
&cValues, // number of values for this key
|
||||
&cchMaxValue, // longest value name
|
||||
&cbMaxValueData, // longest value data
|
||||
&cbSecurityDescriptor, // security descriptor
|
||||
&ftLastWriteTime); // last write time
|
||||
|
||||
if (cSubKeys && (retCode == ERROR_SUCCESS))
|
||||
{
|
||||
const char *cName = [name cString];
|
||||
|
||||
for (i=0; i<cSubKeys && !tzFound; i++)
|
||||
{
|
||||
for (i=0; i<cSubKeys && !tzFound; i++)
|
||||
{
|
||||
cbName = 255;
|
||||
|
||||
retCode = RegEnumKeyEx(regDirKey, i, achKey, &cbName, NULL, NULL, NULL, &ftLastWriteTime);
|
||||
if (retCode == ERROR_SUCCESS)
|
||||
|
||||
retCode = RegEnumKeyEx(regDirKey, i, achKey, &cbName, NULL, NULL, NULL, &ftLastWriteTime);
|
||||
if (retCode == ERROR_SUCCESS)
|
||||
{
|
||||
char keyBuffer[16384];
|
||||
HKEY regKey;
|
||||
|
||||
|
||||
if (isNT)
|
||||
sprintf(keyBuffer,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones\\%s",achKey);
|
||||
else
|
||||
sprintf(keyBuffer,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Time Zones\\%s",achKey);
|
||||
|
||||
|
||||
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyBuffer, 0, KEY_READ, ®Key))
|
||||
{
|
||||
char buf[256];
|
||||
|
@ -1848,7 +1848,7 @@ int dayOfCommonEra(NSTimeInterval when);
|
|||
StandardDate = tzi->StandardDate;
|
||||
DaylightDate = tzi->DaylightDate;
|
||||
}
|
||||
|
||||
|
||||
/* Set the standard name for the time zone. */
|
||||
if (strlen(standardName))
|
||||
{
|
||||
|
@ -1857,7 +1857,7 @@ int dayOfCommonEra(NSTimeInterval when);
|
|||
timeZoneName = [[NSString stringWithCString:standardName] retain];
|
||||
|
||||
/* Abbr generated here is IMHO a bit suspicous but I kept it */
|
||||
for(a=0,b=0;standardName[a];a++)
|
||||
for (a=0,b=0;standardName[a];a++)
|
||||
{
|
||||
if (isupper(standardName[a]))
|
||||
standardName[b++]=standardName[a];
|
||||
|
@ -1875,7 +1875,7 @@ int dayOfCommonEra(NSTimeInterval when);
|
|||
daylightZoneName = [[NSString stringWithCString:daylightName] retain];
|
||||
|
||||
/* Abbr generated here is IMHO a bit suspicous but I kept it */
|
||||
for(a=0,b=0;daylightName[a];a++)
|
||||
for (a=0,b=0;daylightName[a];a++)
|
||||
{
|
||||
if (isupper(daylightName[a]))
|
||||
daylightName[b++]=daylightName[a];
|
||||
|
@ -1886,13 +1886,13 @@ int dayOfCommonEra(NSTimeInterval when);
|
|||
}
|
||||
}
|
||||
RegCloseKey(regKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RegCloseKey(regDirKey);
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -1921,7 +1921,7 @@ int dayOfCommonEra(NSTimeInterval when);
|
|||
dow = dow % 7;
|
||||
if (dow < 0)
|
||||
dow += 7;
|
||||
|
||||
|
||||
if (month == DaylightDate.wMonth /* April */)
|
||||
{
|
||||
daylightdate = day - dow + DaylightDate.wDayOfWeek;
|
||||
|
@ -2008,13 +2008,13 @@ int dayOfCommonEra(NSTimeInterval when);
|
|||
- (NSArray*) timeZoneDetailArray
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
[[[GSTimeZoneDetail alloc] initWithTimeZone:self
|
||||
withAbbrev:timeZoneNameAbbr
|
||||
withOffset:-Bias*60 - StandardBias*60
|
||||
withDST:NO] autorelease],
|
||||
[[[GSTimeZoneDetail alloc] initWithTimeZone:self
|
||||
withAbbrev:daylightZoneNameAbbr
|
||||
withOffset:-Bias*60 - DaylightBias*60
|
||||
[[[GSTimeZoneDetail alloc] initWithTimeZone:self
|
||||
withAbbrev:timeZoneNameAbbr
|
||||
withOffset:-Bias*60 - StandardBias*60
|
||||
withDST:NO] autorelease],
|
||||
[[[GSTimeZoneDetail alloc] initWithTimeZone:self
|
||||
withAbbrev:daylightZoneNameAbbr
|
||||
withOffset:-Bias*60 - DaylightBias*60
|
||||
withDST:YES] autorelease], 0];
|
||||
}
|
||||
|
||||
|
@ -2029,7 +2029,7 @@ int dayOfCommonEra(NSTimeInterval when);
|
|||
{
|
||||
offset = -Bias*60 - DaylightBias*60;
|
||||
abbr = daylightZoneNameAbbr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = -Bias*60 - StandardBias*60;
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/** Implementation of NSTimer for GNUstep
|
||||
Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: March 1996
|
||||
|
||||
|
||||
Rewrite by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -216,7 +216,7 @@ static Class NSDate_class;
|
|||
[_target performSelector: _selector withObject: self];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
{
|
||||
NSLog(@"*** NSTimer ignoring exception '%@' (reason '%@') "
|
||||
@"raised during posting of timer with target %p and selector '%@'",
|
||||
[localException name], [localException reason], _target,
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
/** NSUrl.m - Class NSURL
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jan 1999
|
||||
|
||||
|
||||
Rewrite by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: Jun 2002
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -28,8 +28,8 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
Note from Manuel Guesdon:
|
||||
* I've made some test to compare apple NSURL results
|
||||
Note from Manuel Guesdon:
|
||||
* I've made some test to compare apple NSURL results
|
||||
and GNUstep NSURL results but as there this class is not very documented, some
|
||||
function may be incorrect
|
||||
* I've put 2 functions to make tests. You can add your own tests
|
||||
|
@ -267,7 +267,7 @@ static char *buildURL(parsedURL *base, parsedURL *rel, BOOL standardize)
|
|||
/*
|
||||
* Reduce any '/something/../' sequence to '/' and a trailing
|
||||
* "/something/.." to ""
|
||||
*/
|
||||
*/
|
||||
tmp = ptr;
|
||||
while ((tmp = findUp(tmp)) != 0)
|
||||
{
|
||||
|
@ -302,7 +302,7 @@ static char *buildURL(parsedURL *base, parsedURL *rel, BOOL standardize)
|
|||
}
|
||||
}
|
||||
ptr = &ptr[strlen(ptr)];
|
||||
|
||||
|
||||
if (rel->parameters != 0)
|
||||
{
|
||||
*ptr++ = ';';
|
||||
|
@ -339,7 +339,7 @@ static id clientForHandle(void *data, NSURLHandle *hdl)
|
|||
}
|
||||
|
||||
/**
|
||||
* Locate a '/../ or trailing '/..'
|
||||
* Locate a '/../ or trailing '/..'
|
||||
*/
|
||||
static char *findUp(char *str)
|
||||
{
|
||||
|
@ -1132,7 +1132,7 @@ static unsigned urlAlign;
|
|||
{
|
||||
NSURLHandle *handle = [self URLHandleUsingCache: YES];
|
||||
NSData *d;
|
||||
|
||||
|
||||
if (shouldUseCache == YES && (d = [handle availableResourceData]) != nil)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/** NSURLHandle.m - Class NSURLHandle
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jan 1999
|
||||
Rewrite by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: Sep 2000, June 2002
|
||||
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
@ -53,13 +53,13 @@ NSString * const NSHTTPPropertyStatusReasonKey
|
|||
|
||||
NSString * const NSHTTPPropertyServerHTTPVersionKey
|
||||
= @"NSHTTPPropertyServerHTTPVersionKey";
|
||||
|
||||
|
||||
NSString * const NSHTTPPropertyRedirectionHeadersKey
|
||||
= @"NSHTTPPropertyRedirectionHeadersKey";
|
||||
|
||||
NSString * const NSHTTPPropertyErrorPageDataKey
|
||||
= @"NSHTTPPropertyErrorPageDataKey";
|
||||
|
||||
|
||||
/* These are GNUstep extras */
|
||||
NSString * const GSHTTPPropertyMethodKey
|
||||
= @"GSHTTPPropertyMethodKey";
|
||||
|
@ -72,7 +72,7 @@ NSString * const GSHTTPPropertyProxyHostKey
|
|||
|
||||
NSString * const GSHTTPPropertyProxyPortKey
|
||||
= @"GSHTTPPropertyProxyPortKey";
|
||||
|
||||
|
||||
NSString * const GSHTTPPropertyCertificateFileKey
|
||||
= @"GSHTTPPropertyCertificateFileKey";
|
||||
|
||||
|
@ -276,7 +276,7 @@ static Class NSURLHandleClass = 0;
|
|||
_status = NSURLHandleLoadFailed;
|
||||
DESTROY(_data);
|
||||
ASSIGNCOPY(_failure, reason);
|
||||
|
||||
|
||||
while ((client = [enumerator nextObject]) != nil)
|
||||
{
|
||||
[client URLHandle: self resourceDidFailLoadingWithReason: _failure];
|
||||
|
@ -330,7 +330,7 @@ static Class NSURLHandleClass = 0;
|
|||
{
|
||||
NSEnumerator *enumerator;
|
||||
id <NSURLHandleClient> client;
|
||||
|
||||
|
||||
/*
|
||||
* Let clients know we are starting loading (unless this has already been
|
||||
* done).
|
||||
|
@ -445,7 +445,7 @@ static Class NSURLHandleClass = 0;
|
|||
NSData *d;
|
||||
|
||||
[self beginLoadInBackground];
|
||||
d = [self loadInForeground];
|
||||
d = [self loadInForeground];
|
||||
if (d == nil)
|
||||
{
|
||||
[self backgroundLoadDidFailWithReason: @"foreground load returned nil"];
|
||||
|
@ -474,7 +474,7 @@ static Class NSURLHandleClass = 0;
|
|||
limit = [[NSDate alloc] initWithTimeIntervalSinceNow: 1.0];
|
||||
[loop runUntilDate: limit];
|
||||
RELEASE(limit);
|
||||
}
|
||||
}
|
||||
return _data;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/** Implementation of NSUnarchiver for GNUstep
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Richard frith-Macdonald <richard@brainstorm.co.Ik>
|
||||
Created: October 1998
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue