Index: PLATFORMS.md ================================================================== --- PLATFORMS.md +++ PLATFORMS.md @@ -12,10 +12,20 @@ * Architectures: ARMv6, ARMv7 * Compilers: Clang 3.3 * Runtimes: ObjFW * Limitations: Does not work as a shared library + +DOS +--- + + * OS versions: Windows XP DOS Emulation, DOSBox + * Architectures: x86 + * Compilers: DJGPP GCC 4.7.3 (djdev204) + * Runtimes: ObjFW + * Limitations: No threads, no sockets + DragonFlyBSD ------------ * OS versions: 3.0, 3.3-DEVELOPMENT Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1975,19 +1975,19 @@ pool = objc_autoreleasePoolPush(); characters = [self characters]; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (characters[length - 1] == OF_PATH_DELIMITER) #else if (characters[length - 1] == '/' || characters[length - 1] == '\\') #endif length--; for (i = 0; i < length; i++) { -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (characters[i] == OF_PATH_DELIMITER) { #else if (characters[i] == '/' || characters[i] == '\\') { #endif [ret addObject: [self substringWithRange: @@ -2018,19 +2018,19 @@ pool = objc_autoreleasePoolPush(); characters = [self characters]; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (characters[length - 1] == OF_PATH_DELIMITER) #else if (characters[length - 1] == '/' || characters[length - 1] == '\\') #endif length--; for (i = length - 1; i >= 0; i--) { -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (characters[i] == OF_PATH_DELIMITER) { #else if (characters[i] == '/' || characters[i] == '\\') { #endif i++; @@ -2081,11 +2081,11 @@ pool = objc_autoreleasePoolPush(); characters = [self characters]; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (characters[length - 1] == OF_PATH_DELIMITER) #else if (characters[length - 1] == '/' || characters[length - 1] == '\\') #endif length--; @@ -2094,21 +2094,21 @@ objc_autoreleasePoolPop(pool); return [self substringWithRange: of_range(0, 1)]; } for (i = length - 1; i >= 1; i--) { -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (characters[i] == OF_PATH_DELIMITER) { #else if (characters[i] == '/' || characters[i] == '\\') { #endif objc_autoreleasePoolPop(pool); return [self substringWithRange: of_range(0, i)]; } } -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (characters[0] == OF_PATH_DELIMITER) { #else if (characters[0] == '/' || characters[0] == '\\') { #endif objc_autoreleasePoolPop(pool); Index: src/OFString_UTF8.m ================================================================== --- src/OFString_UTF8.m +++ src/OFString_UTF8.m @@ -1094,20 +1094,20 @@ if (pathCStringLength == 0) return ret; pool = objc_autoreleasePoolPush(); -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (_s->cString[pathCStringLength - 1] == OF_PATH_DELIMITER) #else if (_s->cString[pathCStringLength - 1] == '/' || _s->cString[pathCStringLength - 1] == '\\') #endif pathCStringLength--; for (i = 0; i < pathCStringLength; i++) { -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (_s->cString[i] == OF_PATH_DELIMITER) { #else if (_s->cString[i] == '/' || _s->cString[i] == '\\') { #endif [ret addObject: @@ -1133,20 +1133,20 @@ ssize_t i; if (pathCStringLength == 0) return @""; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (_s->cString[pathCStringLength - 1] == OF_PATH_DELIMITER) #else if (_s->cString[pathCStringLength - 1] == '/' || _s->cString[pathCStringLength - 1] == '\\') #endif pathCStringLength--; for (i = pathCStringLength - 1; i >= 0; i--) { -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (_s->cString[i] == OF_PATH_DELIMITER) { #else if (_s->cString[i] == '/' || _s->cString[i] == '\\') { #endif i++; @@ -1170,11 +1170,11 @@ size_t i, pathCStringLength = _s->cStringLength; if (pathCStringLength == 0) return @""; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (_s->cString[pathCStringLength - 1] == OF_PATH_DELIMITER) #else if (_s->cString[pathCStringLength - 1] == '/' || _s->cString[pathCStringLength - 1] == '\\') #endif @@ -1183,19 +1183,19 @@ if (pathCStringLength == 0) return [OFString stringWithUTF8String: _s->cString length: 1]; for (i = pathCStringLength - 1; i >= 1; i--) -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (_s->cString[i] == OF_PATH_DELIMITER) #else if (_s->cString[i] == '/' || _s->cString[i] == '\\') #endif return [OFString stringWithUTF8String: _s->cString length: i]; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) if (_s->cString[0] == OF_PATH_DELIMITER) #else if (_s->cString[0] == '/' || _s->cString[0] == '\\') #endif return [OFString stringWithUTF8String: _s->cString Index: src/OFThread+Private.h ================================================================== --- src/OFThread+Private.h +++ src/OFThread+Private.h @@ -16,8 +16,10 @@ #import "OFThread.h" #import "macros.h" +#ifdef OF_HAVE_THREADS @interface OFThread (OF_PRIVATE_CATEGORY) + (void)OF_createMainThread; @end +#endif Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -63,10 +63,15 @@ #ifdef OF_HAVE_ATOMIC_OPS # import "atomic.h" #endif #import "autorelease.h" #import "macros.h" + +#ifdef __DJGPP__ +# define lrint(x) rint(x) +# define useconds_t unsigned int +#endif #ifdef OF_HAVE_THREADS # import "threading.h" static of_tlskey_t threadSelfKey; Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -111,11 +111,11 @@ fprintf(stderr, "Failed to ensure condition in " \ __FILE__ ":%d:\n" #cond "\n", __LINE__); \ abort(); \ } -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) # define OF_PATH_DELIMITER '/' # define OF_PATH_DELIMITER_STRING @"/" #else # define OF_PATH_DELIMITER '\\' # define OF_PATH_DELIMITER_STRING @"\\" Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -283,11 +283,11 @@ [[a objectAtIndex: i++] isEqual: @"baz"]) TEST(@"+[pathWithComponents:]", (is = [OFString pathWithComponents: [OFArray arrayWithObjects: @"foo", @"bar", @"baz", nil]]) && -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) [is isEqual: @"foo/bar/baz"] && #else [is isEqual: @"foo\\bar\\baz"] && #endif (is = [OFString pathWithComponents: @@ -347,11 +347,11 @@ TEST(@"-[stringByDeletingPathExtension]", [[@"foo.bar" stringByDeletingPathExtension] isEqual: @"foo"] && [[@"foo..bar" stringByDeletingPathExtension] isEqual: @"foo."] && [[@"/foo./bar" stringByDeletingPathExtension] isEqual: @"/foo./bar"] && -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__DJGPP__) [[@"/foo./bar.baz" stringByDeletingPathExtension] isEqual: @"/foo./bar"] && #else [[@"/foo./bar.baz" stringByDeletingPathExtension] isEqual: @"\\foo.\\bar"] && @@ -382,15 +382,15 @@ [@"\t-0.25 " floatValue] == -0.25 && [@"\r-INFINITY\n" floatValue] == -INFINITY && isnan([@" NAN\t\t" floatValue])) TEST(@"-[doubleValue]", -#ifndef __ANDROID__ +#if !defined(__ANDROID__) && !defined(__DJGPP__) [@"\t-0x1.FFFFFFFFFFFFFP-1020 " doubleValue] == -0x1.FFFFFFFFFFFFFP-1020 && #else - /* strtod() does not accept 0x on Android */ + /* Android and DJGPPP do not accept 0x for strtod() */ [@"\t-0.123456789 " doubleValue] == -0.123456789 && #endif [@"\r-INFINITY\n" doubleValue] == -INFINITY && isnan([@" NAN\t\t" doubleValue])) Index: tests/TestsAppDelegate.m ================================================================== --- tests/TestsAppDelegate.m +++ tests/TestsAppDelegate.m @@ -26,11 +26,11 @@ #import "OFException.h" #import "TestsAppDelegate.h" -#if defined(_WIN32) && defined(STDOUT) +#if defined(STDOUT) && (defined(_WIN32) || defined(__DJGPP__)) # undef STDOUT # define STDOUT_SIMPLE #endif #ifdef _PSP