ObjFW  Check-in [3273f141b3]

Overview
Comment:More work on the PSP port.
Outputting text now works - with colours!
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3273f141b3c5e56e0dd29e6f504efdb3632381f93841327b3e1ef9054571d9b6
User & Date: js on 2011-02-10 20:41:51
Other Links: manifest | tags
Context
2011-02-10
22:07
Fix a typo in tests. check-in: 7d4f42ca34 user: js tags: trunk
20:41
More work on the PSP port.
Outputting text now works - with colours!
check-in: 3273f141b3 user: js tags: trunk
18:40
Fix two unimportant typos. check-in: 5a0049ac30 user: js tags: trunk
Changes

Modified configure.ac from [cc714d0a26] to [6e5af35735].

219
220
221
222
223
224
225



226
227
228










229
230
231
232
233
234
235
219
220
221
222
223
224
225
226
227
228



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245







+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+







		AC_MSG_RESULT(no)
		size_max="(~(size_t)0)"
	])
	AC_DEFINE_UNQUOTED(SIZE_MAX, $size_max, [Maximum value for size_t])
])

AC_CHECK_FUNC(asprintf, [
	case "$host" in
		*-psp-*)
			dnl asprintf is broken on the PSP, but snprintf works.
	have_asprintf="yes"
	AC_DEFINE(OF_HAVE_ASPRINTF, 1, [Whether we have asprintf])
	AC_SUBST(ASPRINTF_DEF, "-DOF_HAVE_ASPRINTF")
			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)
	AC_CACHE_VAL(ac_cv_snprintf_useful_ret, [
		AC_TRY_RUN([

Modified src/OFObject.m from [0e939837b3] to [ffdb3bc597].

121
122
123
124
125
126
127
128

129
130
131
132
133
134
135
121
122
123
124
125
126
127

128
129
130
131
132
133
134
135







-
+







#endif

#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
}

+ (void)initialize

Modified src/OFString.h from [aedcb6f5f6] to [a14b03c49f].

12
13
14
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29
12
13
14
15
16
17
18



19

20
21
22
23
24
25
26







-
-
-
+
-







 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include <stdio.h>
#include <stdarg.h>

#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#include <inttypes.h>
#endif

#import "OFObject.h"

typedef uint32_t of_unichar_t;

/**
 * \brief The encoding of a string.

Modified tests/TestsAppDelegate.m from [bc63f49aac] to [a3fd31c5d3].

20
21
22
23
24
25
26


27
28
29
30
31
32
33
34
35






















36

37
38
39
40
41
42
43
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

60
61
62
63
64
65
66
67







+
+









+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+







#import "OFFile.h"
#import "OFAutoreleasePool.h"

#import "TestsAppDelegate.h"

#ifdef _PSP
# include <pspmoduleinfo.h>
# include <pspkernel.h>
# include <pspdebug.h>
PSP_MODULE_INFO("ObjFW Tests", 0, 0, 0);
#endif

OF_APPLICATION_DELEGATE(TestsAppDelegate)

@implementation TestsAppDelegate
- (void)outputString: (OFString*)str
	   withColor: (int)color
{
#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]);
#ifdef STDOUT
#elif defined(STDOUT)
	switch (color) {
	case 0:
		[of_stdout writeString: @"\r\033[K\033[1;33m"];
		break;
	case 1:
		[of_stdout writeString: @"\r\033[K\033[1;32m"];
		break;
84
85
86
87
88
89
90




91
92
93
94
95
96
97
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125







+
+
+
+







							[test cString]]
		 withColor: 2];
	[pool release];
}

- (void)applicationDidFinishLaunching
{
#ifdef _PSP
	pspDebugScreenInit();
#endif

	[self objectTests];
#ifdef OF_HAVE_BLOCKS
	[self blockTests];
#endif
	[self stringTests];
	[self fileTests];
	[self MD5HashTests];