2011-08-17 Federico Gimenez Nieto * Modified function calls for Modern GNU Objective-C runtime API following changes of source at http://svn.gna.org/viewcvs/gnustep/libs/gdl2/trunk/ Index: gnustep-dl2-0.12.0/EOControl/EOFaultHandler.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOControl/EOFaultHandler.m 2011-08-22 11:51:35.000000000 +0200 +++ gnustep-dl2-0.12.0/EOControl/EOFaultHandler.m 2011-08-22 12:52:50.000000000 +0200 @@ -123,7 +123,7 @@ { 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; @@ -141,11 +141,15 @@ - (BOOL)conformsToProtocol: (Protocol *)protocol forFault: (id)fault { + + return class_conformsToProtocol(_targetClass, protocol); + + /* int i; struct objc_protocol_list *proto_list; Class class; - for(class = _targetClass; class != Nil; class = class_get_super_class(class)) + for(class = _targetClass; class != Nil; class = class_getSuperclass(class)) { for (proto_list = ((struct objc_class *)_targetClass)->class_pointer->protocols; @@ -160,6 +164,7 @@ } return NO; + */ } - (BOOL)respondsToSelector: (SEL)sel Index: gnustep-dl2-0.12.0/EOControl/EOFault.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOControl/EOFault.m 2011-08-22 12:59:10.000000000 +0200 +++ gnustep-dl2-0.12.0/EOControl/EOFault.m 2011-08-23 08:27:31.000000000 +0200 @@ -77,22 +77,8 @@ + (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]; } } @@ -171,7 +157,7 @@ /* * 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 @@ -311,43 +297,12 @@ - (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 Index: gnustep-dl2-0.12.0/EOControl/EODebug.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOControl/EODebug.m 2011-08-23 08:36:52.000000000 +0200 +++ gnustep-dl2-0.12.0/EOControl/EODebug.m 2011-08-23 10:58:09.000000000 +0200 @@ -127,14 +127,14 @@ { 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: @@ -322,19 +322,20 @@ { 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); - + void *pValue = ((void*)object) + ivar_getOffset(ivar); + char *type = ivar_getTypeEncoding(ivar); + NSString *pType = TypeToNSString(type); + NSString *pIVar = IVarInString(type, pValue); + NSDebugFLog(@"IVar %s type:%@ value:address@hidden", - ivar->ivar_name, - pType, - pIVar); - - if (deep > 0 && ivar->ivar_type && *ivar->ivar_type == _C_ID && pValue) - { - EOFLogDumpObject_(NULL, 0, *((id*)pValue), deep); - } + ivar_getName(ivar), + pType, + pIVar); + + if (deep > 0 && type && *type == _C_ID && pValue) + { + EOFLogDumpObject_(NULL, 0, *((id*)pValue), deep); + } } } @@ -346,7 +347,6 @@ if (object && deep > 0) { - struct objc_ivar_list *ivars = NULL; Class class = [object class]; if (class) @@ -357,22 +357,25 @@ line, deep, (void*)object, - class->name, + class_getName(class), objectDescription(object)); while (class) { - ivars = class->ivars; - class = class->super_class; + unsigned int ivarCount; + Ivar *ivars = class_copyIvarList(class, &ivarCount); + + class = class_getSuperclass(class); if (ivars) { int i; - for (i = 0; i < ivars->ivar_count; i++) + for (i = 0; i < ivarCount; i++) { - DumpIVar(object,&ivars->ivar_list[i],deep-1); + DumpIVar(object, ivars[i], deep-1); } } + free(ivars); } } } Index: gnustep-dl2-0.12.0/EOControl/EOGenericRecord.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOControl/EOGenericRecord.m 2011-08-23 10:58:50.000000000 +0200 +++ gnustep-dl2-0.12.0/EOControl/EOGenericRecord.m 2011-08-23 12:19:24.000000000 +0200 @@ -1111,7 +1111,7 @@ } return [NSString stringWithFormat: @"<%s %p : address@hidden@>", - object_get_class_name(self), + object_getClassName(self), (void*)self, classDescription, dict]; @@ -1201,7 +1201,7 @@ } return [NSString stringWithFormat: @"<%s %p : address@hidden@>", - object_get_class_name(self), + object_getClassName(self), (void*)self, classDescription, dict]; Index: gnustep-dl2-0.12.0/EOControl/EOAndQualifier.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOControl/EOAndQualifier.m 2011-08-23 11:51:21.000000000 +0200 +++ gnustep-dl2-0.12.0/EOControl/EOAndQualifier.m 2011-08-23 11:52:10.000000000 +0200 @@ -247,7 +247,7 @@ NSString *dscr; dscr = [NSString stringWithFormat: @"<%s %p - qualifiers: %@>", - object_get_class_name(self), + object_getClassName(self), (void*)self, _qualifiers]; Index: gnustep-dl2-0.12.0/EOControl/EODetailDataSource.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOControl/EODetailDataSource.m 2011-08-23 11:54:10.000000000 +0200 +++ gnustep-dl2-0.12.0/EOControl/EODetailDataSource.m 2011-08-23 11:55:25.000000000 +0200 @@ -302,7 +302,7 @@ - (NSString*) description { return [NSString stringWithFormat: @"<%s %p : masterDataSource=%@ masterObject=%@ detailKey=%@ masterClassDescriptionName=%@>", - object_get_class_name(self), + object_getClassName(self), (void*)self, _masterDataSource, _masterObject, Index: gnustep-dl2-0.12.0/EOControl/EOKeyComparisonQualifier.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOControl/EOKeyComparisonQualifier.m 2011-08-23 11:37:23.000000000 +0200 +++ gnustep-dl2-0.12.0/EOControl/EOKeyComparisonQualifier.m 2011-08-23 11:37:48.000000000 +0200 @@ -259,7 +259,7 @@ selectorString = NSStringFromSelector(_selector); } return [NSString stringWithFormat:@"<%s %p - %@ %@ %@>", - object_get_class_name(self), + object_getClassName(self), (void*)self, _leftKey, selectorString, Index: gnustep-dl2-0.12.0/EOControl/EOKeyGlobalID.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOControl/EOKeyGlobalID.m 2011-08-23 11:53:28.000000000 +0200 +++ gnustep-dl2-0.12.0/EOControl/EOKeyGlobalID.m 2011-08-23 11:53:44.000000000 +0200 @@ -199,7 +199,7 @@ int i; dscr = [NSString stringWithFormat: @"<%s %p - Entity %@ - keysValues:", - object_get_class_name(self), + object_getClassName(self), (void*)self, _entityName]; Index: gnustep-dl2-0.12.0/EOControl/EOKeyValueQualifier.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOControl/EOKeyValueQualifier.m 2011-08-23 11:36:25.000000000 +0200 +++ gnustep-dl2-0.12.0/EOControl/EOKeyValueQualifier.m 2011-08-23 11:37:02.000000000 +0200 @@ -333,7 +333,7 @@ selectorString = NSStringFromSelector(_selector); } return [NSString stringWithFormat:@"<%s %p - %@ %@ (%@)'%@'>", - object_get_class_name(self), + object_getClassName(self), (void*)self, _key, selectorString, Index: gnustep-dl2-0.12.0/EOControl/EOMutableKnownKeyDictionary.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOControl/EOMutableKnownKeyDictionary.m 2011-08-23 11:57:40.000000000 +0200 +++ gnustep-dl2-0.12.0/EOControl/EOMutableKnownKeyDictionary.m 2011-08-23 12:30:48.000000000 +0200 @@ -177,7 +177,7 @@ int i; dscr = [NSString stringWithFormat: @"<%s %p - keys=", - object_get_class_name(self), + object_getClassName(self), (void*)self]; for (i = 0; i < _count; i++) @@ -421,7 +421,7 @@ NSString *dscr; dscr = [NSString stringWithFormat: @"<%s %p - target=%p>", - object_get_class_name(self), + object_getClassName(self), (void*)self, _target]; return dscr; @@ -489,7 +489,7 @@ int count = [_destinationDescription count]; dscr = [NSString stringWithFormat: @"<%s %p - ", - object_get_class_name(self), + object_getClassName(self), (void*)self]; dscr = [dscr stringByAppendingFormat: @"\nsourceDescription=%@", [_sourceDescription description]]; @@ -540,7 +540,7 @@ NSString *dscr; dscr = [NSString stringWithFormat: @"<%s %p >", - object_get_class_name(self), + object_getClassName(self), (void*)self]; return dscr; } @@ -964,7 +964,7 @@ id *keys; dscr = [NSString stringWithFormat: @"<%s %p - KV=", - object_get_class_name(self), + object_getClassName(self), (void*)self]; count = [_MKKDInitializer count]; Index: gnustep-dl2-0.12.0/EOControl/EOOrQualifier.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOControl/EOOrQualifier.m 2011-08-23 11:52:41.000000000 +0200 +++ gnustep-dl2-0.12.0/EOControl/EOOrQualifier.m 2011-08-23 11:53:03.000000000 +0200 @@ -233,7 +233,7 @@ NSString *dscr; dscr = [NSString stringWithFormat: @"<%s %p - qualifiers: %@>", - object_get_class_name(self), + object_getClassName(self), (void*)self, _qualifiers]; return dscr; Index: gnustep-dl2-0.12.0/EOControl/EONSAddOns.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOControl/EONSAddOns.m 2011-08-23 12:15:49.000000000 +0200 +++ gnustep-dl2-0.12.0/EOControl/EONSAddOns.m 2011-08-23 12:18:12.000000000 +0200 @@ -186,7 +186,7 @@ @"%@: No result for object %@ resultOfPerformingSelector:\"%s\" withEachObjectInArray:", self, object, - sel_get_name(sel)); + sel_getName(sel)); [results addObject: result]; } @@ -249,7 +249,7 @@ @"%@: No result for object %@ resultOfPerformingSelector:\"%s\"", self, object, - sel_get_name(sel)); + sel_getName(sel)); [results addObject: result]; //TODO What to do if nil ?? } @@ -307,7 +307,7 @@ @"%@: No result for object %@ resultOfPerformingSelector:\"%s\"", self, object, - sel_get_name(sel)); + sel_getName(sel)); [results addObject: result]; //TODO What to do if nil ?? } @@ -366,7 +366,7 @@ @"%@: No result for object %@ resultOfPerformingSelector:\"%s\"", self, object, - sel_get_name(sel)); + sel_getName(sel)); [results addObject: result]; //TODO What to do if nil ?? } @@ -672,11 +672,11 @@ [NSException raise: NSInvalidArgumentException format: @"%@ null selector given", NSStringFromSelector(_cmd)]; - msg = get_imp(GSObjCClass(self), selector); + msg = class_getMethodImplementation(GSObjCClass(self), selector); if (!msg) { [NSException raise: NSGenericException - format: @"invalid selector passed to %s", sel_get_name(_cmd)]; + format: @"invalid selector passed to %s", sel_getName(_cmd)]; return nil; } Index: gnustep-dl2-0.12.0/EOAccess/EOAdaptorOperation.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOAccess/EOAdaptorOperation.m 2011-08-25 09:53:34.000000000 +0200 +++ gnustep-dl2-0.12.0/EOAccess/EOAdaptorOperation.m 2011-08-25 09:53:50.000000000 +0200 @@ -207,7 +207,7 @@ } desc = [NSString stringWithFormat: @"<%s %p : operator: %@ entity: %@ qualifier:address@hidden: address@hidden:address@hidden: address@hidden: %@>", - object_get_class_name(self), + object_getClassName(self), (void*)self, operatorString, [_entity name], Index: gnustep-dl2-0.12.0/EOAccess/EOAttribute.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOAccess/EOAttribute.m 2011-08-25 09:52:03.000000000 +0200 +++ gnustep-dl2-0.12.0/EOAccess/EOAttribute.m 2011-08-25 09:52:20.000000000 +0200 @@ -383,7 +383,7 @@ - (NSString *)description { NSString *dscr = [NSString stringWithFormat: @"<%s %p - name=%@ entity=%@ columnName=%@ definition=%@ ", - object_get_class_name(self), + object_getClassName(self), (void*)self, [self name], [[self entity] name], Index: gnustep-dl2-0.12.0/EOAccess/EODatabaseDataSource.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOAccess/EODatabaseDataSource.m 2011-08-25 09:54:26.000000000 +0200 +++ gnustep-dl2-0.12.0/EOAccess/EODatabaseDataSource.m 2011-08-25 09:54:41.000000000 +0200 @@ -181,7 +181,7 @@ { return [NSString stringWithFormat: @"<%s %p : entity name=%@ editingContext=%p fetchSpecification=%@>", - object_get_class_name(self), + object_getClassName(self), (void *)self, [[self entity]name], _editingContext, Index: gnustep-dl2-0.12.0/EOAccess/EODatabaseOperation.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOAccess/EODatabaseOperation.m 2011-08-25 09:54:01.000000000 +0200 +++ gnustep-dl2-0.12.0/EOAccess/EODatabaseOperation.m 2011-08-25 09:54:18.000000000 +0200 @@ -349,7 +349,7 @@ } desc = [NSString stringWithFormat: @"<%s %p : operator: %@ entity: %@ globalID:address@hidden %p: address@hidden %p: address@hidden %p: %@>", - object_get_class_name(self), + object_getClassName(self), (void*)self, operatorString, [_entity name], Index: gnustep-dl2-0.12.0/EOAccess/EOEntity.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOAccess/EOEntity.m 2011-08-25 09:51:17.000000000 +0200 +++ gnustep-dl2-0.12.0/EOAccess/EOEntity.m 2011-08-25 09:51:47.000000000 +0200 @@ -624,7 +624,7 @@ NSString *dscr = nil; dscr = [NSString stringWithFormat: @"<%s %p - name=%@ className=%@ externalName=%@ externalQuery=%@", - object_get_class_name(self), + object_getClassName(self), (void*)self, _name, _className, @@ -3980,7 +3980,7 @@ - (NSString *) description { return [NSString stringWithFormat: @"<%s %p - Entity: %@>", - object_get_class_name(self), + object_getClassName(self), self, [self entityName]]; } Index: gnustep-dl2-0.12.0/EOAccess/EOJoin.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOAccess/EOJoin.m 2011-08-25 09:53:03.000000000 +0200 +++ gnustep-dl2-0.12.0/EOAccess/EOJoin.m 2011-08-25 09:53:18.000000000 +0200 @@ -136,7 +136,7 @@ */ dscr = [NSString stringWithFormat: @"<%s %p -", - object_get_class_name(self), + object_getClassName(self), (void*)self]; dscr = [dscr stringByAppendingFormat: @" sourceAttribute=%@", [_sourceAttribute name]]; Index: gnustep-dl2-0.12.0/EOAccess/EORelationship.m =================================================================== --- gnustep-dl2-0.12.0.orig/EOAccess/EORelationship.m 2011-08-25 09:52:28.000000000 +0200 +++ gnustep-dl2-0.12.0/EOAccess/EORelationship.m 2011-08-25 09:52:46.000000000 +0200 @@ -489,7 +489,7 @@ NS_DURING //Just for debugging { dscr = [NSString stringWithFormat: @"<%s %p - name=%@ entity=%@ destinationEntity=%@ definition=%@", - object_get_class_name(self), + object_getClassName(self), (void*)self, [self name], [[self entity]name],