Index: README ================================================================== --- README +++ README @@ -32,12 +32,12 @@ USING THE MAC OS X FRAMWORK IN XCODE To use the Mac OS X framework in Xcode, you need to add the .framework to your project and add the following flags to "Other C Flags": - -fconstant-string-class=OFConstString -fno-constant-cfstrings + -fconstant-string-class=OFConstantString -fno-constant-cfstrings BUGS AND FEATURE REQUESTS If you find any bugs or have feature requests, feel free to send a mail to js-spam@webkeks.org (remove -spam from the address!). Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -11,11 +11,11 @@ AC_PROG_EGREP CPP="$OBJCPP" CPPFLAGS="$CPPFLAGS $OBJCPPFLAGS" OBJCFLAGS="$OBJCFLAGS -Wall -fexceptions -fobjc-exceptions" -OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstString" +OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstantString" AX_CHECK_COMPILER_FLAGS(-pipe, [OBJCFLAGS="$OBJCFLAGS -pipe"]) AX_CHECK_COMPILER_FLAGS(-fno-common, [OBJCFLAGS="$OBJCFLAGS -fno-common"]) AX_CHECK_COMPILER_FLAGS(-fno-constant-cfstrings, [ NO_CONST_CFSTRINGS="-fno-constant-cfstrings" @@ -373,21 +373,21 @@ AC_MSG_CHECKING(whether gcc has bug objc/27438) AC_TRY_COMPILE([ #import - @interface OFConstString + @interface OFConstantString { Class isa; const char *string; unsigned long size; } @end - void *_OFConstStringClassReference; + void *_OFConstantStringClassReference; ], [ - OFConstString *test = @""; + OFConstantString *test = @""; test++; /* Get rid of unused variable warning */ ], [AC_MSG_RESULT(no)], [ AC_MSG_RESULT([yes, adding -Wno-unused-variable]) OBJCFLAGS="$OBJCFLAGS -Wno-unused-variable" AC_SUBST(NO_WARN_UNUSED, "-Wno-unused-variable")]) Index: src/Makefile ================================================================== --- src/Makefile +++ src/Makefile @@ -6,11 +6,11 @@ STATIC_LIB = ${OBJFW_STATIC_LIB} SRCS = OFApplication.m \ OFArray.m \ OFAutoreleasePool.m \ - OFConstString.m \ + OFConstantString.m \ OFDataArray.m \ OFDictionary.m \ OFExceptions.m \ OFFile.m \ OFHash.m \ DELETED src/OFConstString.h Index: src/OFConstString.h ================================================================== --- src/OFConstString.h +++ src/OFConstString.h @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2008 - 2010 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE included in - * the packaging of this file. - */ - -#import "OFString.h" - -#ifdef OF_APPLE_RUNTIME -extern void *_OFConstStringClassReference; -#endif - -/** - * \brief A class for storing constant strings using the \@"" literal. - */ -@interface OFConstString: OFString {} -@end DELETED src/OFConstString.m Index: src/OFConstString.m ================================================================== --- src/OFConstString.m +++ src/OFConstString.m @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2008 - 2010 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE included in - * the packaging of this file. - */ - -#include "config.h" - -#import "OFConstString.h" -#import "OFExceptions.h" - -#ifdef OF_APPLE_RUNTIME -# import - -void *_OFConstStringClassReference; -#endif - -@implementation OFConstString -#ifdef OF_APPLE_RUNTIME -+ (void)load -{ - objc_setFutureClass((Class)&_OFConstStringClassReference, - "OFConstString"); -} -#endif - -+ alloc -{ - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; -} - -- init -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- initWithCString: (const char*)str -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- initWithCString: (const char*)str - encoding: (enum of_string_encoding)encoding; -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- initWithCString: (const char*)str - encoding: (enum of_string_encoding)encoding - length: (size_t)len -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- initWithCString: (const char*)str - length: (size_t)len -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- initWithFormat: (OFString*)fmt, ... -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- initWithFormat: (OFString*)fmt - arguments: (va_list)args -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- initWithString: (OFString*)str -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- (void)addMemoryToPool: (void*)ptr -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- (void*)allocMemoryWithSize: (size_t)size -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- (void*)allocMemoryForNItems: (size_t)nitems - withSize: (size_t)size -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- (void*)resizeMemory: (void*)ptr - toSize: (size_t)size -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- (void*)resizeMemory: (void*)ptr - toNItems: (size_t)nitems - withSize: (size_t)size -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- (void)freeMemory: (void*)ptr -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} - -- retain -{ - return self; -} - -- autorelease -{ - return self; -} - -- (size_t)retainCount -{ - return SIZE_MAX; -} - -- (void)release -{ -} - -- (void)dealloc -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; - [super dealloc]; /* Get rid of a stupid warning */ -} -@end ADDED src/OFConstantString.h Index: src/OFConstantString.h ================================================================== --- src/OFConstantString.h +++ src/OFConstantString.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2008 - 2010 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE included in + * the packaging of this file. + */ + +#import "OFString.h" + +#ifdef OF_APPLE_RUNTIME +extern void *_OFConstantStringClassReference; +#endif + +/** + * \brief A class for storing constant strings using the \@"" literal. + */ +@interface OFConstantString: OFString {} +@end ADDED src/OFConstantString.m Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2008 - 2010 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE included in + * the packaging of this file. + */ + +#include "config.h" + +#import "OFConstantString.h" +#import "OFExceptions.h" + +#ifdef OF_APPLE_RUNTIME +# import + +void *_OFConstantStringClassReference; +#endif + +@implementation OFConstantString +#ifdef OF_APPLE_RUNTIME ++ (void)load +{ + objc_setFutureClass((Class)&_OFConstantStringClassReference, + "OFConstantString"); +} +#endif + ++ alloc +{ + @throw [OFNotImplementedException newWithClass: self + selector: _cmd]; +} + +- init +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- initWithCString: (const char*)str +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- initWithCString: (const char*)str + encoding: (enum of_string_encoding)encoding; +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- initWithCString: (const char*)str + encoding: (enum of_string_encoding)encoding + length: (size_t)len +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- initWithCString: (const char*)str + length: (size_t)len +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- initWithFormat: (OFString*)fmt, ... +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- initWithFormat: (OFString*)fmt + arguments: (va_list)args +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- initWithString: (OFString*)str +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- (void)addMemoryToPool: (void*)ptr +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- (void*)allocMemoryWithSize: (size_t)size +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- (void*)allocMemoryForNItems: (size_t)nitems + withSize: (size_t)size +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- (void*)resizeMemory: (void*)ptr + toSize: (size_t)size +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- (void*)resizeMemory: (void*)ptr + toNItems: (size_t)nitems + withSize: (size_t)size +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- (void)freeMemory: (void*)ptr +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; +} + +- retain +{ + return self; +} + +- autorelease +{ + return self; +} + +- (size_t)retainCount +{ + return SIZE_MAX; +} + +- (void)release +{ +} + +- (void)dealloc +{ + @throw [OFNotImplementedException newWithClass: isa + selector: _cmd]; + [super dealloc]; /* Get rid of a stupid warning */ +} +@end Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -373,11 +373,11 @@ * \param path The path of the file to write to */ - (void)writeToFile: (OFString*)path; @end -#import "OFConstString.h" +#import "OFConstantString.h" #import "OFMutableString.h" #import "OFString+Hashing.h" #import "OFString+URLEncoding.h" #import "OFString+XMLEscaping.h" #import "OFString+XMLUnescaping.h" Index: utils/objfw-config.in ================================================================== --- utils/objfw-config.in +++ utils/objfw-config.in @@ -5,11 +5,11 @@ CFLAGS="" CPPFLAGS="-I@includedir@" CXXFLAGS="" OBJC="@OBJC@" OBJCFLAGS="@GNU_RUNTIME@ -fexceptions -fobjc-exceptions" -OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstString" +OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstantString" OBJCFLAGS="$OBJCFLAGS @NO_CONST_CFSTRINGS@ @BLOCKS_FLAGS@ @NO_WARN_UNUSED@" LDFLAGS="" LDFLAGS_REEXPORT="@LDFLAGS_REEXPORT@" LDFLAGS_RPATH="@LDFLAGS_RPATH@" LIBS="-L${libdir} -lobjfw @LIBS@"