@@ -99,12 +99,13 @@ #endif static void enumeration_mutation_handler(id object) { - @throw [OFEnumerationMutationException newWithClass: [object class] - object: object]; + @throw [OFEnumerationMutationException + exceptionWithClass: [object class] + object: object]; } #ifndef HAVE_OBJC_ENUMERATIONMUTATION void objc_enumerationMutation(id object) @@ -195,11 +196,12 @@ #if !defined(OF_ATOMIC_OPS) if (!of_spinlock_new( &((struct pre_ivar*)instance)->retainCountSpinlock)) { free(instance); - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } #endif instance = (OFObject*)((char*)instance + PRE_IVAR_ALIGN); memset(instance, 0, instanceSize); @@ -302,31 +304,31 @@ { #if defined(OF_OBJFW_RUNTIME) const char *ret; if ((ret = objc_get_type_encoding(self, selector)) == NULL) - @throw [OFNotImplementedException newWithClass: self - selector: selector]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: selector]; return ret; #elif defined(OF_OLD_GNU_RUNTIME) Method_t m; if ((m = class_get_instance_method(self, selector)) == NULL || m->method_types == NULL) - @throw [OFNotImplementedException newWithClass: self - selector: selector]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: selector]; return m->method_types; #else Method m; const char *ret; if ((m = class_getInstanceMethod(self, selector)) == NULL || (ret = method_getTypeEncoding(m)) == NULL) - @throw [OFNotImplementedException newWithClass: self - selector: selector]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: selector]; return ret; #endif } @@ -338,23 +340,23 @@ + (IMP)setImplementation: (IMP)newImp forClassMethod: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) if (newImp == (IMP)0 || !class_respondsToSelector(self->isa, selector)) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; return objc_replace_class_method(self, selector, newImp); #elif defined(OF_OLD_GNU_RUNTIME) Method_t method; MethodList_t iter; method = class_get_class_method(self->class_pointer, selector); if (newImp == (IMP)0 || method == METHOD_NULL) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; for (iter = ((Class)self->class_pointer)->methods; iter != NULL; iter = iter->method_next) { int i; @@ -381,12 +383,12 @@ #else Method method; if (newImp == (IMP)0 || (method = class_getClassMethod(self, selector)) == NULL) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; /* * Cast needed because it's isa in the Apple runtime, but class_pointer * in the GNU runtime. */ @@ -399,12 +401,12 @@ withMethodFromClass: (Class)class { IMP newImp; if (![class isSubclassOfClass: self]) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; newImp = [class methodForSelector: selector]; return [self setImplementation: newImp forClassMethod: selector]; @@ -413,23 +415,23 @@ + (IMP)setImplementation: (IMP)newImp forInstanceMethod: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) if (newImp == (IMP)0 || !class_respondsToSelector(self, selector)) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; return objc_replace_instance_method(self, selector, newImp); #elif defined(OF_OLD_GNU_RUNTIME) Method_t method; MethodList_t iter; method = class_get_instance_method(self, selector); if (newImp == (IMP)0 || method == METHOD_NULL) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; for (iter = ((Class)self)->methods; iter != NULL; iter = iter->method_next) { int i; @@ -455,12 +457,12 @@ #else Method method; if (newImp == (IMP)0 || (method = class_getInstanceMethod(self, selector)) == NULL) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; return class_replaceMethod(self, selector, newImp, method_getTypeEncoding(method)); #endif } @@ -469,12 +471,12 @@ withMethodFromClass: (Class)class { IMP newImp; if (![class isSubclassOfClass: self]) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; newImp = [class instanceMethodForSelector: selector]; return [self setImplementation: newImp forInstanceMethod: selector]; @@ -499,12 +501,12 @@ return NO; } if ((methodList = malloc(sizeof(*methodList))) == NULL) @throw [OFOutOfMemoryException - newWithClass: self - requestedSize: sizeof(*methodList)]; + exceptionWithClass: self + requestedSize: sizeof(*methodList)]; methodList->method_next = ((Class)self)->methods; methodList->method_count = 1; methodList->method_list[0].method_name = selector; @@ -515,12 +517,12 @@ __objc_update_dispatch_table_for_class(self); return YES; #else - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; #endif } + (BOOL)addClassMethod: (SEL)selector withTypeEncoding: (const char*)typeEncoding @@ -542,12 +544,12 @@ return NO; } if ((methodList = malloc(sizeof(*methodList))) == NULL) @throw [OFOutOfMemoryException - newWithClass: self - requestedSize: sizeof(*methodList)]; + exceptionWithClass: self + requestedSize: sizeof(*methodList)]; methodList->method_next = ((Class)self->class_pointer)->methods; methodList->method_count = 1; methodList->method_list[0].method_name = selector; @@ -558,12 +560,12 @@ __objc_update_dispatch_table_for_class((Class)self->class_pointer); return YES; #else - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; #endif } + (void)inheritMethodsFromClass: (Class)class { @@ -698,12 +700,12 @@ implementation: implementation]; } } } #else - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; #endif [self inheritMethodsFromClass: [class superclass]]; } @@ -790,31 +792,31 @@ { #if defined(OF_OBJFW_RUNTIME) const char *ret; if ((ret = objc_get_type_encoding(isa, selector)) == NULL) - @throw [OFNotImplementedException newWithClass: isa - selector: selector]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: selector]; return ret; #elif defined(OF_OLD_GNU_RUNTIME) Method_t m; if ((m = class_get_instance_method(isa, selector)) == NULL || m->method_types == NULL) - @throw [OFNotImplementedException newWithClass: isa - selector: selector]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: selector]; return m->method_types; #else Method m; const char *ret; if ((m = class_getInstanceMethod(isa, selector)) == NULL || (ret = method_getTypeEncoding(m)) == NULL) - @throw [OFNotImplementedException newWithClass: isa - selector: selector]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: selector]; return ret; #endif } @@ -843,16 +845,17 @@ memoryChunksSize = PRE_IVAR->memoryChunksSize + 1; if (UINT_MAX - PRE_IVAR->memoryChunksSize < 1 || memoryChunksSize > UINT_MAX / sizeof(void*)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if ((memoryChunks = realloc(PRE_IVAR->memoryChunks, memoryChunksSize * sizeof(void*))) == NULL) - @throw [OFOutOfMemoryException newWithClass: isa - requestedSize: memoryChunksSize]; + @throw [OFOutOfMemoryException + exceptionWithClass: isa + requestedSize: memoryChunksSize]; PRE_IVAR->memoryChunks = memoryChunks; PRE_IVAR->memoryChunks[PRE_IVAR->memoryChunksSize] = pointer; PRE_IVAR->memoryChunksSize = memoryChunksSize; } @@ -867,21 +870,22 @@ memoryChunksSize = PRE_IVAR->memoryChunksSize + 1; if (UINT_MAX - PRE_IVAR->memoryChunksSize == 0 || memoryChunksSize > UINT_MAX / sizeof(void*)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if ((pointer = malloc(size)) == NULL) - @throw [OFOutOfMemoryException newWithClass: isa - requestedSize: size]; + @throw [OFOutOfMemoryException exceptionWithClass: isa + requestedSize: size]; if ((memoryChunks = realloc(PRE_IVAR->memoryChunks, memoryChunksSize * sizeof(void*))) == NULL) { free(pointer); - @throw [OFOutOfMemoryException newWithClass: isa - requestedSize: memoryChunksSize]; + @throw [OFOutOfMemoryException + exceptionWithClass: isa + requestedSize: memoryChunksSize]; } PRE_IVAR->memoryChunks = memoryChunks; PRE_IVAR->memoryChunks[PRE_IVAR->memoryChunksSize] = pointer; PRE_IVAR->memoryChunksSize = memoryChunksSize; @@ -894,11 +898,11 @@ { if (nItems == 0 || size == 0) return NULL; if (nItems > SIZE_MAX / size) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return [self allocMemoryWithSize: nItems * size]; } - (void*)resizeMemory: (void*)pointer @@ -919,20 +923,20 @@ while (iter-- > PRE_IVAR->memoryChunks) { if (OF_UNLIKELY(*iter == pointer)) { if (OF_UNLIKELY((pointer = realloc(pointer, size)) == NULL)) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: size]; + exceptionWithClass: isa + requestedSize: size]; *iter = pointer; return pointer; } } - @throw [OFMemoryNotPartOfObjectException newWithClass: isa - pointer: pointer]; + @throw [OFMemoryNotPartOfObjectException exceptionWithClass: isa + pointer: pointer]; } - (void*)resizeMemory: (void*)pointer toNItems: (size_t)nItems ofSize: (size_t)size @@ -945,11 +949,11 @@ [self freeMemory: pointer]; return NULL; } if (nItems > SIZE_MAX / size) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return [self resizeMemory: pointer toSize: nItems * size]; } @@ -997,12 +1001,12 @@ return; } } - @throw [OFMemoryNotPartOfObjectException newWithClass: isa - pointer: pointer]; + @throw [OFMemoryNotPartOfObjectException exceptionWithClass: isa + pointer: pointer]; } - retain { #if defined(OF_ATOMIC_OPS) @@ -1089,21 +1093,21 @@ /* Required to use properties with the Apple runtime */ - copyWithZone: (void*)zone { if (zone != NULL) - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; return [(id)self copy]; } - mutableCopyWithZone: (void*)zone { if (zone != NULL) - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; return [(id)self mutableCopy]; } /* @@ -1110,46 +1114,46 @@ * Those are needed as the root class is the superclass of the root class's * metaclass and thus instance methods can be sent to class objects as well. */ + (void)addMemoryToPool: (void*)pointer { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + (void*)allocMemoryWithSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + (void*)allocMemoryForNItems: (size_t)nItems ofSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + (void*)resizeMemory: (void*)pointer toSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + (void*)resizeMemory: (void*)pointer toNItems: (size_t)nItems ofSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + (void)freeMemory: (void*)pointer { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + retain { return self; @@ -1169,21 +1173,21 @@ { } + (void)dealloc { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + copyWithZone: (void*)zone { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + mutableCopyWithZone: (void*)zone { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } @end