* 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
* EOAccess/Makefile.preamble: added -Werror-implicit-function-declaration
* 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>

View file

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

View file

@ -119,10 +119,6 @@ RCS_ID("$Id$")
- (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)
{
@ -165,7 +161,7 @@ RCS_ID("$Id$")
[super release];
}
- (unsigned int) retainCount
- (NSUInteger) retainCount
{
#ifdef DEBUG
NSDebugFLog(@"retainCount EOCheapCopyArray %p. %@",

View file

@ -1,3 +1,4 @@
/**
EOClassDescription.m <title>EOClassDescription Class</title>
@ -57,7 +58,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h>
#include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif
#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>
#else
#include <Foundation/Foundation.h>
#include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif
#include "EOCustomObject.h"

View file

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

View file

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

View file

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

View file

@ -37,7 +37,7 @@ RCS_ID("$Id$")
//TODO EOMultiReaderLocks
#ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h>
#include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif
#include <Foundation/Foundation.h>
@ -172,7 +172,7 @@ static EOObjectStore *defaultParentStore = nil;
static NSTimeInterval defaultFetchLag = 3600.0;
//static NSHashTable *ecDeallocHT = 0;
//static NSHashTable *assocDeallocHT = 0;
static NSHashTable *assocDeallocHT = 0;
/* Notifications */
NSString *EOObjectsChangedInEditingContextNotification
@ -265,15 +265,21 @@ _mergeValueForKey(id obj, id value,
}
}
// rename to _objectWillDealloc: ? -- dw
+ (void)_objectDeallocated:(id)object
{
[[object editingContext] forgetObject: object];
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
@ -4020,3 +4026,24 @@ static BOOL usesContextRelativeEncoding = NO;
[self notImplemented: _cmd]; //TODO
}
@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
#include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/GSCategories.h>
#include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif
#include <objc/Protocol.h>
@ -78,22 +78,8 @@ static Class EOFaultClass = NULL;
+ (void)initialize
{
// Must be here as initialize is called for each root class
// without asking if it responds to it !
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];
}
}
@ -172,7 +158,7 @@ static Class EOFaultClass = NULL;
/*
* 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
@ -312,43 +298,12 @@ static Class EOFaultClass = NULL;
- (BOOL)conformsToProtocol: (Protocol *)protocol
{
int i;
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;
return class_conformsToProtocol([_handler targetClass], protocol);
}
- (BOOL)respondsToSelector: (SEL)selector
{
Class class;
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;
return class_respondsToSelector([_handler targetClass], selector);
}
- (NSMethodSignature *)methodSignatureForSelector: (SEL)selector
@ -489,20 +444,6 @@ static Class EOFaultClass = NULL;
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
{
NSDebugFLLog(@"gsdb",@"invocation selector=%@ target: %p",

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,3 +1,4 @@
/**
EOKeyValueCoding.m <title>EOKeyValueCoding</title>
@ -60,7 +61,8 @@ RCS_ID("$Id$")
#ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h>
#include <GNUstepBase/NSDebug+GNUstepBase.h>
#include <GNUstepBase/NSString+GNUstepBase.h>
#endif
#include <EOControl/EOKeyValueCoding.h>
@ -384,12 +386,14 @@ initialize(void)
INITIALIZE;
EOFLOGObjectFnStartCond(@"EOKVC");
mode = [[NSDecimalNumber defaultBehavior] roundingMode];
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)
{
unsigned int i=0;
@ -403,7 +407,7 @@ initialize(void)
};
ret = [NSDecimalNumber decimalNumberWithDecimal: result];
EOFLOGObjectFnStopCond(@"EOKVC");
return ret;
}
@ -425,7 +429,11 @@ initialize(void)
EOFLOGObjectFnStartCond(@"EOKVC");
mode = [[NSDecimalNumber defaultBehavior] roundingMode];
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)
{
@ -445,7 +453,10 @@ initialize(void)
}
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);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -39,7 +39,7 @@
@class EOMKKDInitializer;
@class EOGlobalID;
typedef unsigned int (*GDL2IMP_UINT)(id, SEL, ...);
typedef NSUInteger (*GDL2IMP_UINT)(id, SEL, ...);
typedef BOOL (*GDL2IMP_BOOL)(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 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 unsigned int EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDInitializer* mkkdInit,GDL2IMP_UINT* impPtr,NSString* key);
GDL2CONTROL_EXPORT NSUInteger EOMKKD_indexForKeyWithImpPtr(EOMutableKnownKeyDictionary* mkkd,GDL2IMP_UINT* impPtr,NSString* key);
GDL2CONTROL_EXPORT NSUInteger EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDInitializer* mkkdInit,GDL2IMP_UINT* impPtr,NSString* key);
// ==== EOEditingContext ====

View file

@ -329,7 +329,7 @@ EOMKKD_hasKeyWithImpPtr(NSDictionary* mkkd,
return NO;
};
unsigned int
NSUInteger
EOMKKD_indexForKeyWithImpPtr(EOMutableKnownKeyDictionary* mkkd,
GDL2IMP_UINT* impPtr,
NSString* key)
@ -355,8 +355,7 @@ EOMKKD_indexForKeyWithImpPtr(EOMutableKnownKeyDictionary* mkkd,
return 0;
};
unsigned int
EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDInitializer* mkkdInit,
NSUInteger EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDInitializer* mkkdInit,
GDL2IMP_UINT* impPtr,
NSString* key)
{
@ -478,7 +477,7 @@ void EOHashAddTable(NSHashTable *to, NSHashTable *from)
static SEL eqSel;
@interface GDL2NonRetainingMutableArray (PrivateExceptions)
- (void) _raiseRangeExceptionWithIndex:(unsigned) index from:(SEL)selector;
- (void) _raiseRangeExceptionWithIndex:(NSUInteger) index from:(SEL)selector;
@end
/**
@ -516,7 +515,7 @@ static SEL eqSel;
}
/* designated initializer */
- (id) initWithCapacity:(unsigned)capacity
- (id) initWithCapacity:(NSUInteger)capacity
{
self = [super init];
_contents = NSZoneMalloc([self zone], sizeof(GSIArray_t));
@ -524,7 +523,7 @@ static SEL eqSel;
return self;
}
- (id) initWithObjects:(id *)objects count:(unsigned)count
- (id) initWithObjects:(id *)objects count:(NSUInteger)count
{
int i;
self = [self initWithCapacity:count];
@ -534,12 +533,12 @@ static SEL eqSel;
}
/* These are *this* subclasses responsibility */
- (unsigned) count
- (NSUInteger) count
{
return GSIArrayCount(_contents);
}
- (id) objectAtIndex:(unsigned) index
- (id) objectAtIndex:(NSUInteger) index
{
if (index >= GSIArrayCount(_contents))
[self _raiseRangeExceptionWithIndex:index from:_cmd];
@ -559,7 +558,7 @@ static SEL eqSel;
GSIArrayAddItem(_contents, (GSIArrayItem)object);
}
- (void) replaceObjectAtIndex:(unsigned)index withObject:(id)object
- (void) replaceObjectAtIndex:(NSUInteger)index withObject:(id)object
{
if (object == nil)
{
@ -576,7 +575,7 @@ static SEL eqSel;
GSIArraySetItemAtIndex(_contents, (GSIArrayItem)object, index);
}
- (void) insertObject:(id)object atIndex:(unsigned)index
- (void) insertObject:(id)object atIndex:(NSUInteger)index
{
if (object == nil)
{
@ -592,7 +591,7 @@ static SEL eqSel;
GSIArrayInsertItem(_contents, (GSIArrayItem)object, index);
}
- (void) removeObjectAtIndex:(unsigned)index
- (void) removeObjectAtIndex:(NSUInteger)index
{
if (index >= GSIArrayCount(_contents))
{
@ -639,16 +638,16 @@ static SEL eqSel;
}
/* private methods. */
- (void) _raiseRangeExceptionWithIndex: (unsigned)index from: (SEL)sel
- (void) _raiseRangeExceptionWithIndex: (NSUInteger)index from: (SEL)sel
{
NSDictionary *info;
NSException *exception;
NSString *reason;
unsigned count = GSIArrayCount(_contents);
NSUInteger count = GSIArrayCount(_contents);
info = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithUnsignedInt: index], @"Index",
[NSNumber numberWithUnsignedInt: count], @"Count",
[NSNumber numberWithUnsignedInteger: index], @"Index",
[NSNumber numberWithUnsignedInteger: count], @"Count",
self, @"Array", nil, nil];
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
#include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSCategories.h>
#include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif
#include <GNUstepBase/GSObjCRuntime.h>
@ -939,23 +939,23 @@ _qualifierWithArgs(id self, SEL _cmd, NSString *format, NSArray *array, va_list
+ (NSString *)stringForOperatorSelector: (SEL)selector
{
if (sel_eq(selector, EOQualifierOperatorEqual))
if (sel_isEqual(selector, EOQualifierOperatorEqual))
return @"=";
else if (sel_eq(selector, EOQualifierOperatorNotEqual))
else if (sel_isEqual(selector, EOQualifierOperatorNotEqual))
return @"<>";
else if (sel_eq(selector, EOQualifierOperatorLessThan))
else if (sel_isEqual(selector, EOQualifierOperatorLessThan))
return @"<";
else if (sel_eq(selector, EOQualifierOperatorGreaterThan))
else if (sel_isEqual(selector, EOQualifierOperatorGreaterThan))
return @">";
else if (sel_eq(selector, EOQualifierOperatorLessThanOrEqualTo))
else if (sel_isEqual(selector, EOQualifierOperatorLessThanOrEqualTo))
return @"<=";
else if (sel_eq(selector, EOQualifierOperatorGreaterThanOrEqualTo))
else if (sel_isEqual(selector, EOQualifierOperatorGreaterThanOrEqualTo))
return @">=";
else if (sel_eq(selector, EOQualifierOperatorContains))
else if (sel_isEqual(selector, EOQualifierOperatorContains))
return @"doesContain";
else if (sel_eq(selector, EOQualifierOperatorLike))
else if (sel_isEqual(selector, EOQualifierOperatorLike))
return @"like";
else if (sel_eq(selector, EOQualifierOperatorCaseInsensitiveLike))
else if (sel_isEqual(selector, EOQualifierOperatorCaseInsensitiveLike))
return @"caseInsensitiveLike";
return NSStringFromSelector(selector);