* EOControl/EOEditingContext.m:

added @implementation EOCustomObject (AssociationsHack)
re-added registerAssociationForDeallocHack
* EOControl/*: ported to new runtime and OS X



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@30244 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2010-04-26 22:05:17 +00:00
parent 7e98e4bba8
commit fea268900f
28 changed files with 270 additions and 284 deletions

View file

@ -17,7 +17,11 @@
fixed leaks fixed leaks
* EOAccess/Makefile.preamble: added -Werror-implicit-function-declaration * EOAccess/Makefile.preamble: added -Werror-implicit-function-declaration
* EOAccess/*: ported to new runtime and OS X * EOAccess/*: ported to new runtime and OS X
* EOControl/EOMutableKnownKeyDictionary.*: ported, works for me, please double check
* EOControl/EOEditingContext.m:
added @implementation EOCustomObject (AssociationsHack)
re-added registerAssociationForDeallocHack
* EOControl/*: ported to new runtime and OS X
2010-04-21 Sergey Golovin <golovin.sv@gmail.com> 2010-04-21 Sergey Golovin <golovin.sv@gmail.com>

View file

@ -51,7 +51,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSObjCRuntime.h> #include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <EOControl/EOQualifier.h> #include <EOControl/EOQualifier.h>
@ -249,7 +249,7 @@ RCS_ID("$Id$")
NSString *dscr; NSString *dscr;
dscr = [NSString stringWithFormat: @"<%s %p - qualifiers: %@>", dscr = [NSString stringWithFormat: @"<%s %p - qualifiers: %@>",
object_get_class_name(self), object_getClassName(self),
(void*)self, (void*)self,
_qualifiers]; _qualifiers];

View file

@ -119,10 +119,6 @@ RCS_ID("$Id$")
- (void) dealloc - (void) dealloc
{ {
#ifdef DEBUG
NSDebugFLog(@"Deallocate EOCheapCopyArray %p zone=%p _contents_array=%p _count=%d _refcount=%d",
self, [self zone], _contents_array, _count, _refcount);
#endif
if (_contents_array) if (_contents_array)
{ {
@ -165,7 +161,7 @@ RCS_ID("$Id$")
[super release]; [super release];
} }
- (unsigned int) retainCount - (NSUInteger) retainCount
{ {
#ifdef DEBUG #ifdef DEBUG
NSDebugFLog(@"retainCount EOCheapCopyArray %p. %@", NSDebugFLog(@"retainCount EOCheapCopyArray %p. %@",

View file

@ -1,3 +1,4 @@
/** /**
EOClassDescription.m <title>EOClassDescription Class</title> EOClassDescription.m <title>EOClassDescription Class</title>
@ -57,7 +58,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <GNUstepBase/GSLock.h> #include <GNUstepBase/GSLock.h>

View file

@ -44,6 +44,9 @@ RCS_ID("$Id: EOGenericRecord.m 30111 2010-04-09 10:09:41Z ayers $")
#include <Foundation/FoundationErrors.h> #include <Foundation/FoundationErrors.h>
#else #else
#include <Foundation/Foundation.h> #include <Foundation/Foundation.h>
#include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include "EOCustomObject.h" #include "EOCustomObject.h"

View file

@ -40,7 +40,6 @@
#endif #endif
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GSCategories.h>
#endif #endif
#include <EOControl/EODefines.h> #include <EOControl/EODefines.h>

View file

@ -45,7 +45,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSObjCRuntime.h> #include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <unistd.h> #include <unistd.h>
@ -67,12 +67,12 @@ EOFLogC_(const char *file, int line, const char *string)
if ([NSThread isMultiThreaded]) if ([NSThread isMultiThreaded])
{ {
fprintf(stderr, "%s PID=(%d) ", fprintf(stderr, "%s PID=(%d) ",
[[GSCurrentThread() description] cString], [[[NSThread currentThread] description] cStringUsingEncoding:NSUTF8StringEncoding],
(int)getpid()); (int)getpid());
} }
fprintf(stderr, "File %s: %d. ", file, line); fprintf(stderr, "File %s: %d. ", file, line);
fprintf(stderr, string); fprintf(stderr, string, NULL); // the NULL makes the compiler happy -- dw
len = strlen(string); len = strlen(string);
@ -128,14 +128,14 @@ IVarInString(const char* _type, void* _value)
{ {
Class *pvalue = (Class*)_value; Class *pvalue = (Class*)_value;
return [NSString stringWithFormat: @"Class:%s", return [NSString stringWithFormat: @"Class:%s",
class_get_class_name(*pvalue)]; class_getName(*pvalue)];
} }
break; break;
case _C_SEL: case _C_SEL:
{ {
SEL *pvalue = (SEL*)_value; SEL *pvalue = (SEL*)_value;
return [NSString stringWithFormat: @"SEL:%s", return [NSString stringWithFormat: @"SEL:%s",
sel_get_name(*pvalue)]; sel_getName(*pvalue)];
} }
break; break;
case _C_CHR: case _C_CHR:
@ -321,69 +321,81 @@ TypeToNSString(const char* _type)
static void static void
DumpIVar(id object, GSIVar ivar, int deep) DumpIVar(id object, GSIVar ivar, int deep)
{ {
#ifndef GNUSTEP
#warning DumpIVar() is not ported to your platform
#else
if (ivar && object && deep >= 0) if (ivar && object && deep >= 0)
{
void *pValue = ((void*)object) + ivar->ivar_offset;
NSString *pType = TypeToNSString(ivar->ivar_type);
NSString *pIVar = IVarInString(ivar->ivar_type,pValue);
NSDebugFLog(@"IVar %s type:%@ value:%@\n",
ivar->ivar_name,
pType,
pIVar);
if (deep > 0 && ivar->ivar_type && *ivar->ivar_type == _C_ID && pValue)
{ {
void *pValue = ((void*)object) + ivar->ivar_offset; EOFLogDumpObject_(NULL, 0, *((id*)pValue), deep);
NSString *pType = TypeToNSString(ivar->ivar_type);
NSString *pIVar = IVarInString(ivar->ivar_type,pValue);
NSDebugFLog(@"IVar %s type:%@ value:%@\n",
ivar->ivar_name,
pType,
pIVar);
if (deep > 0 && ivar->ivar_type && *ivar->ivar_type == _C_ID && pValue)
{
EOFLogDumpObject_(NULL, 0, *((id*)pValue), deep);
}
} }
}
#endif
} }
//Dump object //Dump object
void void
EOFLogDumpObject_(const char *file, int line, id object, int deep) EOFLogDumpObject_(const char *file, int line, id object, int deep)
{ {
#ifndef GNUSTEP
#warning EOFLogDumpObject_() is not ported to your platform
#else
USTART USTART
if (object && deep > 0) if (object && deep > 0)
{
struct objc_ivar_list *ivars = NULL;
Class class = [object class];
if (class)
{ {
struct objc_ivar_list *ivars = NULL; NSDebugFLog(@"--%s %d [%d] Dumping object %p of Class %s Description:%@\n",
Class class = [object class]; (file && isalpha(*file) && line >= 0
&& line<=20000) ? file :"",
if (class) line,
{ deep,
NSDebugFLog(@"--%s %d [%d] Dumping object %p of Class %s Description:%@\n", (void*)object,
(file && isalpha(*file) && line >= 0 class_getName(class),
&& line<=20000) ? file :"", objectDescription(object));
line, while (class)
deep,
(void*)object,
class->name,
objectDescription(object));
while (class)
{ {
ivars = class->ivars; ivars = class->ivars;
class = class->super_class; class = class_getSuperclass(class);
if (ivars) if (ivars)
{ {
int i; int i;
for (i = 0; i < ivars->ivar_count; i++) for (i = 0; i < ivars->ivar_count; i++)
{ {
DumpIVar(object,&ivars->ivar_list[i],deep-1); DumpIVar(object,&ivars->ivar_list[i],deep-1);
} }
}
}
} }
}
} }
}
USTOP USTOP
#endif
} }
void void
EOFLogAssertGood_(const char *file, int line, id object) EOFLogAssertGood_(const char *file, int line, id object)
{ {
#ifndef GNUSTEP
#warning EOFLogDumpObject_() is not ported to your platform
#else
if (object) if (object)
{ {
if (object->class_pointer == ((Class)0xdeadface)) if (object->class_pointer == ((Class)0xdeadface))
@ -404,6 +416,8 @@ EOFLogAssertGood_(const char *file, int line, id object)
line); line);
NSCParameterAssert(object); NSCParameterAssert(object);
} }
#endif
} }
#endif #endif

View file

@ -302,7 +302,7 @@ RCS_ID("$Id$")
- (NSString*) description - (NSString*) description
{ {
return [NSString stringWithFormat: @"<%s %p : masterDataSource=%@ masterObject=%@ detailKey=%@ masterClassDescriptionName=%@>", return [NSString stringWithFormat: @"<%s %p : masterDataSource=%@ masterObject=%@ detailKey=%@ masterClassDescriptionName=%@>",
object_get_class_name(self), object_getClassName(self),
(void*)self, (void*)self,
_masterDataSource, _masterDataSource,
_masterObject, _masterObject,

View file

@ -37,7 +37,7 @@ RCS_ID("$Id$")
//TODO EOMultiReaderLocks //TODO EOMultiReaderLocks
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <Foundation/Foundation.h> #include <Foundation/Foundation.h>
@ -172,7 +172,7 @@ static EOObjectStore *defaultParentStore = nil;
static NSTimeInterval defaultFetchLag = 3600.0; static NSTimeInterval defaultFetchLag = 3600.0;
//static NSHashTable *ecDeallocHT = 0; //static NSHashTable *ecDeallocHT = 0;
//static NSHashTable *assocDeallocHT = 0; static NSHashTable *assocDeallocHT = 0;
/* Notifications */ /* Notifications */
NSString *EOObjectsChangedInEditingContextNotification NSString *EOObjectsChangedInEditingContextNotification
@ -265,15 +265,21 @@ _mergeValueForKey(id obj, id value,
} }
} }
// rename to _objectWillDealloc: ? -- dw
+ (void)_objectDeallocated:(id)object + (void)_objectDeallocated:(id)object
{ {
[[object editingContext] forgetObject: object];
if (EOAssociationClass != nil) if (EOAssociationClass != nil)
{ {
[EOAssociationClass objectDeallocated: object]; // rename to _objectDeallocated: ? -- dw if (assocDeallocHT && NSHashGet(assocDeallocHT, object))
{
// rename to _objectWillDealloc: ? -- dw
[EOAssociationClass objectDeallocated: object];
NSHashRemove(assocDeallocHT,object);
}
} }
[[object editingContext] forgetObject: object];
} }
+ (NSTimeInterval)defaultFetchTimestampLag + (NSTimeInterval)defaultFetchTimestampLag
@ -4020,3 +4026,24 @@ static BOOL usesContextRelativeEncoding = NO;
[self notImplemented: _cmd]; //TODO [self notImplemented: _cmd]; //TODO
} }
@end @end
@implementation EOCustomObject (AssociationsHack)
/*
this is used for EOAssociations
*/
- (void) registerAssociationForDeallocHack:(id)object
{
if (EOAssociationClass != nil)
{
if (!assocDeallocHT)
{
assocDeallocHT = NSCreateHashTable(NSNonOwnedPointerHashCallBacks, 64);
}
NSHashInsert(assocDeallocHT, object);
}
}
@end

View file

@ -56,7 +56,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSObjCRuntime.h> #include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <objc/Protocol.h> #include <objc/Protocol.h>
@ -78,22 +78,8 @@ static Class EOFaultClass = NULL;
+ (void)initialize + (void)initialize
{ {
// Must be here as initialize is called for each root class
// without asking if it responds to it !
if (EOFaultClass == NULL) if (EOFaultClass == NULL)
{ {
GSMethod nsfwd = GSGetMethod([NSObject class],
@selector(forward::),
YES,NO);
if (nsfwd != NULL)
{
GSMethod eofwd = GSGetMethod(self,
@selector(forward::),
YES,NO);
eofwd->method_imp = nsfwd->method_imp;
GSFlushMethodCacheForClass(self);
}
EOFaultClass = [EOFault class]; EOFaultClass = [EOFault class];
} }
} }
@ -172,7 +158,7 @@ static Class EOFaultClass = NULL;
/* /*
* Since 'self' is an class, get_imp() will get the instance method. * Since 'self' is an class, get_imp() will get the instance method.
*/ */
return get_imp((Class)self, selector); return class_getMethodImplementation((Class)self, selector);
} }
// Fault class methods // Fault class methods
@ -312,43 +298,12 @@ static Class EOFaultClass = NULL;
- (BOOL)conformsToProtocol: (Protocol *)protocol - (BOOL)conformsToProtocol: (Protocol *)protocol
{ {
int i; return class_conformsToProtocol([_handler targetClass], protocol);
struct objc_protocol_list* protos;
Class class, sClass;
class = [_handler targetClass];
for (protos = class->protocols; protos; protos = protos->next)
{
for (i = 0; i < protos->count; i++)
if ([protos->list[i] conformsTo: protocol])
return YES;
}
sClass = [class superclass];
if (sClass)
return [sClass conformsToProtocol: protocol];
else
return NO;
} }
- (BOOL)respondsToSelector: (SEL)selector - (BOOL)respondsToSelector: (SEL)selector
{ {
Class class; return class_respondsToSelector([_handler targetClass], selector);
BOOL respondsToSelector;
NSDebugFLLog(@"gsdb", @"START self=%p", self);
class = [_handler targetClass];
NSDebugFLLog(@"gsdb", @"class=%@ selector=%@", class,
NSStringFromSelector(selector));
respondsToSelector
= (GSGetMethod(class, selector, YES, YES) != (GSMethod)0);
NSDebugFLLog(@"gsdb", @"STOP self=%p", self);
return respondsToSelector;
} }
- (NSMethodSignature *)methodSignatureForSelector: (SEL)selector - (NSMethodSignature *)methodSignatureForSelector: (SEL)selector
@ -489,20 +444,6 @@ static Class EOFaultClass = NULL;
NSStringFromSelector(selector)]; NSStringFromSelector(selector)];
} }
/**
* This method is replaced by the current implementation of NSObject (if any).
*
* It is assumed that this method will not be called if NSObject does not
* implement it.
*/
- (retval_t)forward: (SEL)selector
: (arglist_t)args
{
retval_t ret = 0;
NSAssert(NO,@"This should never be called (see +initialize).");
return ret;
}
- (void)forwardInvocation: (NSInvocation *)invocation - (void)forwardInvocation: (NSInvocation *)invocation
{ {
NSDebugFLLog(@"gsdb",@"invocation selector=%@ target: %p", NSDebugFLLog(@"gsdb",@"invocation selector=%@ target: %p",

View file

@ -50,7 +50,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <EOControl/EOFault.h> #include <EOControl/EOFault.h>
@ -124,7 +124,7 @@ RCS_ID("$Id$")
{ {
Class class; Class class;
for (class = _targetClass; class != Nil; class = class_get_super_class(class)) for (class = _targetClass; class != Nil; class = class_getSuperclass(class))
{ {
if (class == aclass) if (class == aclass)
return YES; return YES;
@ -142,25 +142,31 @@ RCS_ID("$Id$")
- (BOOL)conformsToProtocol: (Protocol *)protocol - (BOOL)conformsToProtocol: (Protocol *)protocol
forFault: (id)fault forFault: (id)fault
{ {
int i;
struct objc_protocol_list *proto_list; // TODO: check on GNUstep if class_conformsToProtocol() works -- dw
Class class; //int i;
//struct objc_protocol_list *proto_list;
for(class = _targetClass; class != Nil; class = class_get_super_class(class)) //Class class;
return class_conformsToProtocol(_targetClass, protocol);
/*
for(class = _targetClass; class != Nil; class = class_getSuperclass(class))
{
for (proto_list =
((struct objc_class *)_targetClass)->class_pointer->protocols;
proto_list; proto_list = proto_list->next)
{ {
for (proto_list = for (i = 0; i < proto_list->count; i++)
((struct objc_class *)_targetClass)->class_pointer->protocols;
proto_list; proto_list = proto_list->next)
{
for (i = 0; i < proto_list->count; i++)
{ {
if ([proto_list->list[i] conformsTo: protocol]) if ([proto_list->list[i] conformsTo: protocol])
return YES; return YES;
} }
}
} }
}
return NO; return NO;
*/
} }
- (BOOL)respondsToSelector: (SEL)sel - (BOOL)respondsToSelector: (SEL)sel

View file

@ -46,7 +46,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h> #import <GNUstepBase/GSObjCRuntime.h>
#endif #endif
#include <EOControl/EOFetchSpecification.h> #include <EOControl/EOFetchSpecification.h>

View file

@ -53,7 +53,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSObjCRuntime.h> #include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <GNUstepBase/GSLock.h> #include <GNUstepBase/GSLock.h>
@ -1112,7 +1112,7 @@ infinite loop in description **/
} }
return [NSString stringWithFormat: @"<%s %p : classDescription=%@\nvalues=%@>", return [NSString stringWithFormat: @"<%s %p : classDescription=%@\nvalues=%@>",
object_get_class_name(self), object_getClassName(self),
(void*)self, (void*)self,
classDescription, classDescription,
dict]; dict];
@ -1202,7 +1202,7 @@ infinite loop in description **/
} }
return [NSString stringWithFormat: @"<%s %p : classDescription=%@\nvalues=%@>", return [NSString stringWithFormat: @"<%s %p : classDescription=%@\nvalues=%@>",
object_get_class_name(self), object_getClassName(self),
(void*)self, (void*)self,
classDescription, classDescription,
dict]; dict];
@ -1517,16 +1517,14 @@ You can override this to exclude properties manually handled by derived object *
- (unsigned int)eoGetSize - (unsigned int)eoGetSize
{ {
unsigned int size = 0; size_t size = 0;
Class selfClass = Nil; Class selfClass = Nil;
// EOFLOGObjectFnStartOrCond(@"EOGenericRecord");
selfClass = [self class]; selfClass = [self class];
size = selfClass->instance_size;
// EOFLOGObjectFnStopOrCond(@"EOGenericRecord");
// size = selfClass->instance_size;
size = class_getInstanceSize(selfClass);
return size; return size;
} }
@ -1539,12 +1537,8 @@ You can override this to exclude properties manually handled by derived object *
unsigned int size; unsigned int size;
//consider 2bytes string //consider 2bytes string
//EOFLOGObjectFnStartOrCond(@"EOGenericRecord");
size = [super eoGetSize] + [self length] * 2; size = [super eoGetSize] + [self length] * 2;
//EOFLOGObjectFnStopOrCond(@"EOGenericRecord");
return size; return size;
} }
@ -1619,7 +1613,7 @@ You can override this to exclude properties manually handled by derived object *
[processed setObject: [NSNumber numberWithUnsignedInt: 0] [processed setObject: [NSNumber numberWithUnsignedInt: 0]
forKey: objectP]; forKey: objectP];
size += objectClass->instance_size; size += class_getInstanceSize(objectClass);
if ([object isKindOfClass: [NSArray class]]) if ([object isKindOfClass: [NSArray class]])
baseSize += size; baseSize += size;

View file

@ -259,7 +259,7 @@ static unsigned short sequence = USHRT_MAX;
} }
dst[j] = 0; dst[j] = 0;
return [NSString stringWithFormat: @"<%s %s>", return [NSString stringWithFormat: @"<%s %s>",
GSClassNameFromObject(self), dst]; object_getClassName(self), dst];
} }
@end @end

View file

@ -188,41 +188,41 @@ RCS_ID("$Id$")
{ {
return (*imp) (leftVal, _selector, rightVal); return (*imp) (leftVal, _selector, rightVal);
} }
if (sel_eq(_selector, EOQualifierOperatorEqual) == YES) if (sel_isEqual(_selector, EOQualifierOperatorEqual) == YES)
{ {
return [leftVal isEqual: rightVal]; return [leftVal isEqual: rightVal];
} }
else if (sel_eq(_selector, EOQualifierOperatorNotEqual) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorNotEqual) == YES)
{ {
return ([leftVal isEqual: rightVal]?NO:YES); return ([leftVal isEqual: rightVal]?NO:YES);
} }
else if (sel_eq(_selector, EOQualifierOperatorLessThan) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorLessThan) == YES)
{ {
return [leftVal compare: rightVal] == NSOrderedAscending; return [leftVal compare: rightVal] == NSOrderedAscending;
} }
else if (sel_eq(_selector, EOQualifierOperatorGreaterThan) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorGreaterThan) == YES)
{ {
return [leftVal compare: rightVal] == NSOrderedDescending; return [leftVal compare: rightVal] == NSOrderedDescending;
} }
else if (sel_eq(_selector, EOQualifierOperatorLessThanOrEqualTo) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorLessThanOrEqualTo) == YES)
{ {
return [leftVal compare: rightVal] != NSOrderedDescending; return [leftVal compare: rightVal] != NSOrderedDescending;
} }
else if (sel_eq(_selector, EOQualifierOperatorGreaterThanOrEqualTo) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorGreaterThanOrEqualTo) == YES)
{ {
return [leftVal compare: rightVal] != NSOrderedAscending; return [leftVal compare: rightVal] != NSOrderedAscending;
} }
else if (sel_eq(_selector, EOQualifierOperatorContains) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorContains) == YES)
{ {
return [(id)leftVal rangeOfString: (id)rightVal].location != NSNotFound; return [(id)leftVal rangeOfString: (id)rightVal].location != NSNotFound;
} }
else if (sel_eq(_selector, EOQualifierOperatorLike) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorLike) == YES)
{ {
NSEmitTODO(); //TODO NSEmitTODO(); //TODO
return [leftVal isEqual: rightVal] return [leftVal isEqual: rightVal]
== NSOrderedSame; == NSOrderedSame;
} }
else if (sel_eq(_selector, EOQualifierOperatorCaseInsensitiveLike) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorCaseInsensitiveLike) == YES)
{ {
NSEmitTODO(); //TODO NSEmitTODO(); //TODO
return [[(id)leftVal uppercaseString] isEqual: [(id)rightVal uppercaseString]] return [[(id)leftVal uppercaseString] isEqual: [(id)rightVal uppercaseString]]
@ -260,7 +260,7 @@ RCS_ID("$Id$")
selectorString = NSStringFromSelector(_selector); selectorString = NSStringFromSelector(_selector);
} }
return [NSString stringWithFormat:@"<%s %p - %@ %@ %@>", return [NSString stringWithFormat:@"<%s %p - %@ %@ %@>",
object_get_class_name(self), object_getClassName(self),
(void*)self, (void*)self,
_leftKey, _leftKey,
selectorString, selectorString,

View file

@ -47,7 +47,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSObjCRuntime.h> #include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <EOControl/EOKeyGlobalID.h> #include <EOControl/EOKeyGlobalID.h>
@ -200,7 +200,7 @@ RCS_ID("$Id$")
int i; int i;
dscr = [NSString stringWithFormat: @"<%s %p - Entity %@ - keysValues:", dscr = [NSString stringWithFormat: @"<%s %p - Entity %@ - keysValues:",
object_get_class_name(self), object_getClassName(self),
(void*)self, (void*)self,
_entityName]; _entityName];

View file

@ -76,7 +76,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <EOControl/EOKeyValueArchiver.h> #include <EOControl/EOKeyValueArchiver.h>

View file

@ -1,3 +1,4 @@
/** /**
EOKeyValueCoding.m <title>EOKeyValueCoding</title> EOKeyValueCoding.m <title>EOKeyValueCoding</title>
@ -60,7 +61,8 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#include <GNUstepBase/NSString+GNUstepBase.h>
#endif #endif
#include <EOControl/EOKeyValueCoding.h> #include <EOControl/EOKeyValueCoding.h>
@ -384,12 +386,14 @@ initialize(void)
INITIALIZE; INITIALIZE;
EOFLOGObjectFnStartCond(@"EOKVC");
mode = [[NSDecimalNumber defaultBehavior] roundingMode]; mode = [[NSDecimalNumber defaultBehavior] roundingMode];
count = [self count]; count = [self count];
NSDecimalFromComponents(&result, 0, 0, NO);
// does not seem to exist on snow leopad -- dw
// NSDecimalFromComponents(&result, 0, 0, NO);
result = [[NSDecimalNumber zero] decimalValue];
if (count>0) if (count>0)
{ {
unsigned int i=0; unsigned int i=0;
@ -403,7 +407,7 @@ initialize(void)
}; };
ret = [NSDecimalNumber decimalNumberWithDecimal: result]; ret = [NSDecimalNumber decimalNumberWithDecimal: result];
EOFLOGObjectFnStopCond(@"EOKVC");
return ret; return ret;
} }
@ -425,7 +429,11 @@ initialize(void)
EOFLOGObjectFnStartCond(@"EOKVC"); EOFLOGObjectFnStartCond(@"EOKVC");
mode = [[NSDecimalNumber defaultBehavior] roundingMode]; mode = [[NSDecimalNumber defaultBehavior] roundingMode];
count = [self count]; count = [self count];
NSDecimalFromComponents(&result, 0, 0, NO);
result = [[NSDecimalNumber zero] decimalValue];
// not available on snow leo -- dw
// NSDecimalFromComponents(&result, 0, 0, NO);
if (count>0) if (count>0)
{ {
@ -445,7 +453,10 @@ initialize(void)
} }
left = result; left = result;
NSDecimalFromComponents(&right, (unsigned long long) count, 0, NO);
right = [[NSNumber numberWithUnsignedLongLong:count] decimalValue];
// NSDecimalFromComponents(&right, (unsigned long long) count, 0, NO);
NSDecimalDivide(&result, &left, &right, mode); NSDecimalDivide(&result, &left, &right, mode);

View file

@ -52,7 +52,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSObjCRuntime.h> #include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <EOControl/EOQualifier.h> #include <EOControl/EOQualifier.h>
@ -229,15 +229,15 @@ RCS_ID("$Id$")
{ {
return (*imp) (objectValue, _selector, selfValue); return (*imp) (objectValue, _selector, selfValue);
} }
if (sel_eq(_selector, EOQualifierOperatorEqual) == YES) if (sel_isEqual(_selector, EOQualifierOperatorEqual) == YES)
{ {
return [objectValue isEqual: selfValue]; return [objectValue isEqual: selfValue];
} }
else if (sel_eq(_selector, EOQualifierOperatorNotEqual) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorNotEqual) == YES)
{ {
return ([objectValue isEqual: selfValue]?NO:YES); return ([objectValue isEqual: selfValue]?NO:YES);
} }
else if (sel_eq(_selector, EOQualifierOperatorLessThan) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorLessThan) == YES)
{ {
if (objectValue==GDL2_EONull) if (objectValue==GDL2_EONull)
return ((selfValue==GDL2_EONull) ? NO : YES); return ((selfValue==GDL2_EONull) ? NO : YES);
@ -246,7 +246,7 @@ RCS_ID("$Id$")
else else
return [objectValue compare: selfValue] == NSOrderedAscending; return [objectValue compare: selfValue] == NSOrderedAscending;
} }
else if (sel_eq(_selector, EOQualifierOperatorGreaterThan) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorGreaterThan) == YES)
{ {
if (objectValue==GDL2_EONull) if (objectValue==GDL2_EONull)
return NO; return NO;
@ -255,7 +255,7 @@ RCS_ID("$Id$")
else else
return [objectValue compare: selfValue] == NSOrderedDescending; return [objectValue compare: selfValue] == NSOrderedDescending;
} }
else if (sel_eq(_selector, EOQualifierOperatorLessThanOrEqualTo) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorLessThanOrEqualTo) == YES)
{ {
if (objectValue==GDL2_EONull) if (objectValue==GDL2_EONull)
return YES; return YES;
@ -264,7 +264,7 @@ RCS_ID("$Id$")
else else
return [objectValue compare: selfValue] != NSOrderedDescending; return [objectValue compare: selfValue] != NSOrderedDescending;
} }
else if (sel_eq(_selector, EOQualifierOperatorGreaterThanOrEqualTo) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorGreaterThanOrEqualTo) == YES)
{ {
if (objectValue==GDL2_EONull) if (objectValue==GDL2_EONull)
return ((selfValue==GDL2_EONull) ? YES : NO); return ((selfValue==GDL2_EONull) ? YES : NO);
@ -273,7 +273,7 @@ RCS_ID("$Id$")
else else
return [objectValue compare: selfValue] != NSOrderedAscending; return [objectValue compare: selfValue] != NSOrderedAscending;
} }
else if (sel_eq(_selector, EOQualifierOperatorContains) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorContains) == YES)
{ {
//Philosophical question: does nil contains nil ?? //Philosophical question: does nil contains nil ??
@ -285,13 +285,13 @@ RCS_ID("$Id$")
return [(NSString*)objectValue rangeOfString: return [(NSString*)objectValue rangeOfString:
(NSString*)selfValue].location != NSNotFound; (NSString*)selfValue].location != NSNotFound;
} }
else if (sel_eq(_selector, EOQualifierOperatorLike) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorLike) == YES)
{ {
NSEmitTODO(); //TODO NSEmitTODO(); //TODO
//How to handle nil like ? //How to handle nil like ?
return [objectValue isEqual: selfValue]; return [objectValue isEqual: selfValue];
} }
else if (sel_eq(_selector, EOQualifierOperatorCaseInsensitiveLike) == YES) else if (sel_isEqual(_selector, EOQualifierOperatorCaseInsensitiveLike) == YES)
{ {
NSEmitTODO(); //TODO NSEmitTODO(); //TODO
//How to handle nil like ? //How to handle nil like ?
@ -335,7 +335,7 @@ RCS_ID("$Id$")
selectorString = NSStringFromSelector(_selector); selectorString = NSStringFromSelector(_selector);
} }
return [NSString stringWithFormat:@"<%s %p - %@ %@ (%@)'%@'>", return [NSString stringWithFormat:@"<%s %p - %@ %@ (%@)'%@'>",
object_get_class_name(self), object_getClassName(self),
(void*)self, (void*)self,
_key, _key,
selectorString, selectorString,

View file

@ -28,7 +28,6 @@
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h>
#include <Foundation/Foundation.h> #include <Foundation/Foundation.h>
#else #else
#include <Foundation/NSLock.h> #include <Foundation/NSLock.h>
@ -122,6 +121,8 @@
- (void)lockForReading - (void)lockForReading
{ {
NSThread *ct = [NSThread currentThread]; NSThread *ct = [NSThread currentThread];
#warning is int good here? I don't think so. -- dw
int cnt = (int)NSMapGet(_readerThreads,ct); int cnt = (int)NSMapGet(_readerThreads,ct);
if (ct == _writerLockThread) if (ct == _writerLockThread)

View file

@ -54,6 +54,7 @@ RCS_ID("$Id$")
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/GSCategories.h>
#include <GNUstepBase/GSObjCRuntime.h> #include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <GNUstepBase/Unicode.h> #include <GNUstepBase/Unicode.h>
#include <GNUstepBase/GSLock.h> #include <GNUstepBase/GSLock.h>
@ -177,7 +178,7 @@ GDL2_Activate(Class sup, Class cls)
@"%@: No result for object %@ resultOfPerformingSelector:\"%s\" withEachObjectInArray:", @"%@: No result for object %@ resultOfPerformingSelector:\"%s\" withEachObjectInArray:",
self, self,
object, object,
sel_get_name(sel)); sel_getName(sel));
[results addObject: result]; [results addObject: result];
} }
@ -573,10 +574,13 @@ GDL2_Activate(Class sup, Class cls)
unichar *chars; unichar *chars;
unsigned int length = [self length]; unsigned int length = [self length];
chars = objc_malloc(length * sizeof(unichar)); chars = NSZoneMalloc(NSDefaultMallocZone(),length * sizeof(unichar));
[self getCharacters: chars]; [self getCharacters: chars];
chars[0]=uni_toupper(chars[0]); chars[0]=uni_toupper(chars[0]);
// CHECKME: does this really free how we want it? -- dw
return AUTORELEASE([[NSString alloc] initWithCharactersNoCopy: chars return AUTORELEASE([[NSString alloc] initWithCharactersNoCopy: chars
length: length length: length
freeWhenDone: YES]); freeWhenDone: YES]);
@ -663,7 +667,7 @@ GDL2_Activate(Class sup, Class cls)
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"%@ null selector given", NSStringFromSelector(_cmd)]; format: @"%@ null selector given", NSStringFromSelector(_cmd)];
msg = get_imp(GSObjCClass(self), selector); msg = class_getMethodImplementation([self class], selector);
if (!msg) if (!msg)
{ {
[NSException raise: NSGenericException [NSException raise: NSGenericException

View file

@ -43,7 +43,6 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h>
#endif #endif
#include <EOControl/EOObjectStore.h> #include <EOControl/EOObjectStore.h>

View file

@ -48,7 +48,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <EOControl/EOObjectStoreCoordinator.h> #include <EOControl/EOObjectStoreCoordinator.h>

View file

@ -49,7 +49,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <EOControl/EOObserver.h> #include <EOControl/EOObserver.h>
@ -68,12 +68,7 @@ RCS_ID("$Id$")
*/ */
- (void)willChange - (void)willChange
{ {
EOFLOGObjectFnStart();
EOFLOGObjectLevelArgs(@"EOObserver", @"willChange self=%p", self);
[EOObserverCenter notifyObserversObjectWillChange: self]; [EOObserverCenter notifyObserversObjectWillChange: self];
EOFLOGObjectFnStop();
} }
@end @end
@ -200,61 +195,49 @@ static id lastObject;
*/ */
+ (void)notifyObserversObjectWillChange: (id)object + (void)notifyObserversObjectWillChange: (id)object
{ {
EOFLOGClassFnStart();
EOFLOGObjectLevelArgs(@"EOObserver", @"object=%p", object);
if (!notificationSuppressCount) if (!notificationSuppressCount)
{
SEL objectWillChangeSel = @selector(objectWillChange:);
if (object == nil)
{ {
SEL objectWillChangeSel = @selector(objectWillChange:); NSHashEnumerator omniscEnum = NSEnumerateHashTable(omniscientHash);
EOFLOGObjectLevelArgs(@"EOObserver", @"object=%p lastObject=%p", id obj;
object, lastObject);
lastObject = nil;
if (object == nil) while ((obj = (id)NSNextHashEnumeratorItem(&omniscEnum)))
{
NSHashEnumerator omniscEnum = NSEnumerateHashTable(omniscientHash);
id obj;
lastObject = nil;
while ((obj = (id)NSNextHashEnumeratorItem(&omniscEnum)))
{ {
[obj performSelector:objectWillChangeSel withObject:object]; [obj performSelector:objectWillChangeSel withObject:object];
} }
} }
else if (lastObject != object) else if (lastObject != object)
{ {
NSHashTable *observersHash; NSHashTable *observersHash;
NSHashEnumerator observersEnum; NSHashEnumerator observersEnum;
id obj; id obj;
lastObject = object; lastObject = object;
observersHash = NSMapGet(observersMap, object); observersHash = NSMapGet(observersMap, object);
if (observersHash) if (observersHash)
{ {
observersEnum = NSEnumerateHashTable(observersHash); observersEnum = NSEnumerateHashTable(observersHash);
EOFLOGObjectLevelArgs(@"EOObserver", @"observersArray count=%d",
NSCountHashTable(observersHash));
while ((obj = (id)NSNextHashEnumeratorItem(&observersEnum))) while ((obj = (id)NSNextHashEnumeratorItem(&observersEnum)))
{ {
[obj performSelector:objectWillChangeSel withObject:object]; [obj performSelector:objectWillChangeSel withObject:object];
} }
} }
EOFLOGObjectLevelArgs(@"EOObserver", @"omniscientObservers count=%d", observersEnum = NSEnumerateHashTable(omniscientHash);
NSCountHashTable(omniscientHash)); while ((obj = (id)NSNextHashEnumeratorItem(&observersEnum)))
observersEnum = NSEnumerateHashTable(omniscientHash);
while ((obj = (id)NSNextHashEnumeratorItem(&observersEnum)))
{ {
[obj performSelector:objectWillChangeSel withObject:object]; [obj performSelector:objectWillChangeSel withObject:object];
} }
}
} }
}
EOFLOGClassFnStop();
} }
/** /**
@ -288,25 +271,29 @@ static id lastObject;
+ (id)observerForObject: (id)object ofClass: (Class)targetClass + (id)observerForObject: (id)object ofClass: (Class)targetClass
{ {
NSHashTable *observersHash; NSHashTable *observersHash;
id observer = nil;
if (object == nil) if (object == nil)
return nil; return nil;
observersHash = NSMapGet(observersMap, object); observersHash = NSMapGet(observersMap, object);
if (observersHash) if (observersHash)
{
NSHashEnumerator observersEnum;
observersEnum = NSEnumerateHashTable(observersHash);
while ((observer = (id)NSNextHashEnumeratorItem(&observersEnum)))
{ {
NSHashEnumerator observersEnum; if ([observer isKindOfClass: targetClass])
observersEnum = NSEnumerateHashTable(observersHash); {
id observer; break;
}
while ((observer = (id)NSNextHashEnumeratorItem(&observersEnum)))
{
if ([observer isKindOfClass: targetClass])
return observer;
}
} }
// avoid memory leak! -- dw
return nil; NSEndHashTableEnumeration(&observersEnum);
}
return observer;
} }
/** /**

View file

@ -49,7 +49,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSObjCRuntime.h> #include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <EOControl/EOQualifier.h> #include <EOControl/EOQualifier.h>
@ -235,7 +235,7 @@ RCS_ID("$Id$")
NSString *dscr; NSString *dscr;
dscr = [NSString stringWithFormat: @"<%s %p - qualifiers: %@>", dscr = [NSString stringWithFormat: @"<%s %p - qualifiers: %@>",
object_get_class_name(self), object_getClassName(self),
(void*)self, (void*)self,
_qualifiers]; _qualifiers];
return dscr; return dscr;

View file

@ -39,7 +39,7 @@
@class EOMKKDInitializer; @class EOMKKDInitializer;
@class EOGlobalID; @class EOGlobalID;
typedef unsigned int (*GDL2IMP_UINT)(id, SEL, ...); typedef NSUInteger (*GDL2IMP_UINT)(id, SEL, ...);
typedef BOOL (*GDL2IMP_BOOL)(id, SEL, ...); typedef BOOL (*GDL2IMP_BOOL)(id, SEL, ...);
typedef NSStringEncoding (*GDL2IMP_NSStringEncoding)(id, SEL, ...); typedef NSStringEncoding (*GDL2IMP_NSStringEncoding)(id, SEL, ...);
@ -357,8 +357,8 @@ GDL2CONTROL_EXPORT void EOMKKD_setObjectForKeyWithImpPtr(NSDictionary* mkkd,IMP*
GDL2CONTROL_EXPORT void EOMKKD_removeObjectForKeyWithImpPtr(NSDictionary* mkkd,IMP* impPtr,NSString* key); GDL2CONTROL_EXPORT void EOMKKD_removeObjectForKeyWithImpPtr(NSDictionary* mkkd,IMP* impPtr,NSString* key);
GDL2CONTROL_EXPORT BOOL EOMKKD_hasKeyWithImpPtr(NSDictionary* mkkd,GDL2IMP_BOOL* impPtr,NSString* key); GDL2CONTROL_EXPORT BOOL EOMKKD_hasKeyWithImpPtr(NSDictionary* mkkd,GDL2IMP_BOOL* impPtr,NSString* key);
GDL2CONTROL_EXPORT unsigned int EOMKKD_indexForKeyWithImpPtr(EOMutableKnownKeyDictionary* mkkd,GDL2IMP_UINT* impPtr,NSString* key); GDL2CONTROL_EXPORT NSUInteger EOMKKD_indexForKeyWithImpPtr(EOMutableKnownKeyDictionary* mkkd,GDL2IMP_UINT* impPtr,NSString* key);
GDL2CONTROL_EXPORT unsigned int EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDInitializer* mkkdInit,GDL2IMP_UINT* impPtr,NSString* key); GDL2CONTROL_EXPORT NSUInteger EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDInitializer* mkkdInit,GDL2IMP_UINT* impPtr,NSString* key);
// ==== EOEditingContext ==== // ==== EOEditingContext ====

View file

@ -329,7 +329,7 @@ EOMKKD_hasKeyWithImpPtr(NSDictionary* mkkd,
return NO; return NO;
}; };
unsigned int NSUInteger
EOMKKD_indexForKeyWithImpPtr(EOMutableKnownKeyDictionary* mkkd, EOMKKD_indexForKeyWithImpPtr(EOMutableKnownKeyDictionary* mkkd,
GDL2IMP_UINT* impPtr, GDL2IMP_UINT* impPtr,
NSString* key) NSString* key)
@ -355,8 +355,7 @@ EOMKKD_indexForKeyWithImpPtr(EOMutableKnownKeyDictionary* mkkd,
return 0; return 0;
}; };
unsigned int NSUInteger EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDInitializer* mkkdInit,
EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDInitializer* mkkdInit,
GDL2IMP_UINT* impPtr, GDL2IMP_UINT* impPtr,
NSString* key) NSString* key)
{ {
@ -478,7 +477,7 @@ void EOHashAddTable(NSHashTable *to, NSHashTable *from)
static SEL eqSel; static SEL eqSel;
@interface GDL2NonRetainingMutableArray (PrivateExceptions) @interface GDL2NonRetainingMutableArray (PrivateExceptions)
- (void) _raiseRangeExceptionWithIndex:(unsigned) index from:(SEL)selector; - (void) _raiseRangeExceptionWithIndex:(NSUInteger) index from:(SEL)selector;
@end @end
/** /**
@ -516,7 +515,7 @@ static SEL eqSel;
} }
/* designated initializer */ /* designated initializer */
- (id) initWithCapacity:(unsigned)capacity - (id) initWithCapacity:(NSUInteger)capacity
{ {
self = [super init]; self = [super init];
_contents = NSZoneMalloc([self zone], sizeof(GSIArray_t)); _contents = NSZoneMalloc([self zone], sizeof(GSIArray_t));
@ -524,7 +523,7 @@ static SEL eqSel;
return self; return self;
} }
- (id) initWithObjects:(id *)objects count:(unsigned)count - (id) initWithObjects:(id *)objects count:(NSUInteger)count
{ {
int i; int i;
self = [self initWithCapacity:count]; self = [self initWithCapacity:count];
@ -534,12 +533,12 @@ static SEL eqSel;
} }
/* These are *this* subclasses responsibility */ /* These are *this* subclasses responsibility */
- (unsigned) count - (NSUInteger) count
{ {
return GSIArrayCount(_contents); return GSIArrayCount(_contents);
} }
- (id) objectAtIndex:(unsigned) index - (id) objectAtIndex:(NSUInteger) index
{ {
if (index >= GSIArrayCount(_contents)) if (index >= GSIArrayCount(_contents))
[self _raiseRangeExceptionWithIndex:index from:_cmd]; [self _raiseRangeExceptionWithIndex:index from:_cmd];
@ -559,7 +558,7 @@ static SEL eqSel;
GSIArrayAddItem(_contents, (GSIArrayItem)object); GSIArrayAddItem(_contents, (GSIArrayItem)object);
} }
- (void) replaceObjectAtIndex:(unsigned)index withObject:(id)object - (void) replaceObjectAtIndex:(NSUInteger)index withObject:(id)object
{ {
if (object == nil) if (object == nil)
{ {
@ -576,7 +575,7 @@ static SEL eqSel;
GSIArraySetItemAtIndex(_contents, (GSIArrayItem)object, index); GSIArraySetItemAtIndex(_contents, (GSIArrayItem)object, index);
} }
- (void) insertObject:(id)object atIndex:(unsigned)index - (void) insertObject:(id)object atIndex:(NSUInteger)index
{ {
if (object == nil) if (object == nil)
{ {
@ -592,7 +591,7 @@ static SEL eqSel;
GSIArrayInsertItem(_contents, (GSIArrayItem)object, index); GSIArrayInsertItem(_contents, (GSIArrayItem)object, index);
} }
- (void) removeObjectAtIndex:(unsigned)index - (void) removeObjectAtIndex:(NSUInteger)index
{ {
if (index >= GSIArrayCount(_contents)) if (index >= GSIArrayCount(_contents))
{ {
@ -639,16 +638,16 @@ static SEL eqSel;
} }
/* private methods. */ /* private methods. */
- (void) _raiseRangeExceptionWithIndex: (unsigned)index from: (SEL)sel - (void) _raiseRangeExceptionWithIndex: (NSUInteger)index from: (SEL)sel
{ {
NSDictionary *info; NSDictionary *info;
NSException *exception; NSException *exception;
NSString *reason; NSString *reason;
unsigned count = GSIArrayCount(_contents); NSUInteger count = GSIArrayCount(_contents);
info = [NSDictionary dictionaryWithObjectsAndKeys: info = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithUnsignedInt: index], @"Index", [NSNumber numberWithUnsignedInteger: index], @"Index",
[NSNumber numberWithUnsignedInt: count], @"Count", [NSNumber numberWithUnsignedInteger: count], @"Count",
self, @"Array", nil, nil]; self, @"Array", nil, nil];
reason = [NSString stringWithFormat: @"Index %d is out of range %d (in '%@')", index, count, NSStringFromSelector(sel)]; reason = [NSString stringWithFormat: @"Index %d is out of range %d (in '%@')", index, count, NSStringFromSelector(sel)];

View file

@ -55,7 +55,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif #endif
#include <GNUstepBase/GSObjCRuntime.h> #include <GNUstepBase/GSObjCRuntime.h>
@ -939,23 +939,23 @@ _qualifierWithArgs(id self, SEL _cmd, NSString *format, NSArray *array, va_list
+ (NSString *)stringForOperatorSelector: (SEL)selector + (NSString *)stringForOperatorSelector: (SEL)selector
{ {
if (sel_eq(selector, EOQualifierOperatorEqual)) if (sel_isEqual(selector, EOQualifierOperatorEqual))
return @"="; return @"=";
else if (sel_eq(selector, EOQualifierOperatorNotEqual)) else if (sel_isEqual(selector, EOQualifierOperatorNotEqual))
return @"<>"; return @"<>";
else if (sel_eq(selector, EOQualifierOperatorLessThan)) else if (sel_isEqual(selector, EOQualifierOperatorLessThan))
return @"<"; return @"<";
else if (sel_eq(selector, EOQualifierOperatorGreaterThan)) else if (sel_isEqual(selector, EOQualifierOperatorGreaterThan))
return @">"; return @">";
else if (sel_eq(selector, EOQualifierOperatorLessThanOrEqualTo)) else if (sel_isEqual(selector, EOQualifierOperatorLessThanOrEqualTo))
return @"<="; return @"<=";
else if (sel_eq(selector, EOQualifierOperatorGreaterThanOrEqualTo)) else if (sel_isEqual(selector, EOQualifierOperatorGreaterThanOrEqualTo))
return @">="; return @">=";
else if (sel_eq(selector, EOQualifierOperatorContains)) else if (sel_isEqual(selector, EOQualifierOperatorContains))
return @"doesContain"; return @"doesContain";
else if (sel_eq(selector, EOQualifierOperatorLike)) else if (sel_isEqual(selector, EOQualifierOperatorLike))
return @"like"; return @"like";
else if (sel_eq(selector, EOQualifierOperatorCaseInsensitiveLike)) else if (sel_isEqual(selector, EOQualifierOperatorCaseInsensitiveLike))
return @"caseInsensitiveLike"; return @"caseInsensitiveLike";
return NSStringFromSelector(selector); return NSStringFromSelector(selector);