Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -221,13 +221,23 @@ ]) AC_DEFINE_UNQUOTED(SIZE_MAX, $size_max, [Maximum value for size_t]) ]) AC_CHECK_FUNC(asprintf, [ - have_asprintf="yes" - AC_DEFINE(OF_HAVE_ASPRINTF, 1, [Whether we have asprintf]) - AC_SUBST(ASPRINTF_DEF, "-DOF_HAVE_ASPRINTF") + case "$host" in + *-psp-*) + dnl asprintf is broken on the PSP, but snprintf works. + have_asprintf="no" + AC_SUBST(ASPRINTF_M, "asprintf.m") + ac_cv_snprintf_useful_ret="yes" + ;; + *) + AC_DEFINE(OF_HAVE_ASPRINTF, 1, + [Whether we have asprintf]) + AC_SUBST(ASPRINTF_DEF, "-DOF_HAVE_ASPRINTF") + ;; + esac ], [ have_asprintf="no" AC_SUBST(ASPRINTF_M, "asprintf.m") AC_MSG_CHECKING(whether snprintf returns something useful) Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -123,11 +123,11 @@ #if defined(_WIN32) SYSTEM_INFO si; GetSystemInfo(&si); of_pagesize = si.dwPageSize; #elif defined(_PSP) - of_pagesize = 512; + of_pagesize = 4096; #else if ((of_pagesize = sysconf(_SC_PAGESIZE)) < 1) of_pagesize = 4096; #endif } Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -14,14 +14,11 @@ * file. */ #include #include - -#ifdef HAVE_INTTYPES_H -# include -#endif +#include #import "OFObject.h" typedef uint32_t of_unichar_t; Index: tests/TestsAppDelegate.m ================================================================== --- tests/TestsAppDelegate.m +++ tests/TestsAppDelegate.m @@ -22,20 +22,44 @@ #import "TestsAppDelegate.h" #ifdef _PSP # include +# include +# include PSP_MODULE_INFO("ObjFW Tests", 0, 0, 0); #endif OF_APPLICATION_DELEGATE(TestsAppDelegate) @implementation TestsAppDelegate - (void)outputString: (OFString*)str withColor: (int)color { -#ifdef STDOUT +#if defined(_PSP) + char i, space = ' '; + int y = pspDebugScreenGetY(); + + pspDebugScreenSetXY(0, y); + for (i = 0; i < 68; i++) + pspDebugScreenPrintData(&space, 1); + + switch (color) { + case 0: + pspDebugScreenSetTextColor(0x00FFFF); + break; + case 1: + pspDebugScreenSetTextColor(0x00FF00); + break; + case 2: + pspDebugScreenSetTextColor(0x0000FF); + break; + } + + pspDebugScreenSetXY(0, y); + pspDebugScreenPrintData([str cString], [str cStringLength]); +#elif defined(STDOUT) switch (color) { case 0: [of_stdout writeString: @"\r\033[K\033[1;33m"]; break; case 1: @@ -86,10 +110,14 @@ [pool release]; } - (void)applicationDidFinishLaunching { +#ifdef _PSP + pspDebugScreenInit(); +#endif + [self objectTests]; #ifdef OF_HAVE_BLOCKS [self blockTests]; #endif [self stringTests];