ObjFW  Check-in [345716d824]

Overview
Comment:Get rid of dependency on method_getSizeOfArguments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 345716d824b1cc2b153a2af35059f6e4896891929e20b3de19a0aaeb5d4c0ecc
User & Date: js on 2009-04-16 17:18:41
Other Links: manifest | tags
Context
2009-04-17
16:45
Add - hash for OFNumber. check-in: cd9bd80792 user: js tags: trunk
2009-04-16
17:18
Get rid of dependency on method_getSizeOfArguments. check-in: 345716d824 user: js tags: trunk
2009-04-15
20:31
Workaround for wrong length of OFConstStrings on PPC64 OS X.
Apple does a strange thing there: The length is only 32 bit, followed
by another 32 bit which seem to be garbage.
check-in: 9b3e9e6895 user: js tags: trunk
Changes

Modified Makefile from [c7605d134b] to [427824f052].

1
2
3
4
5
6

7
8
9
10
11
include extra.mk

SUBDIRS = src ${TESTS}
DISTCLEAN = aclocal.m4		\
	    autom4te.cache	\
	    buildsys.mk		\

	    config.log		\
	    config.status	\
	    extra.mk

include buildsys.mk






>





1
2
3
4
5
6
7
8
9
10
11
12
include extra.mk

SUBDIRS = src ${TESTS}
DISTCLEAN = aclocal.m4		\
	    autom4te.cache	\
	    buildsys.mk		\
	    config.h		\
	    config.log		\
	    config.status	\
	    extra.mk

include buildsys.mk

Modified src/OFObject.m from [4cc42158d1] to [7381da9158].

206
207
208
209
210
211
212
213
214

215
216
217



218

219


220






221



222








223


224




225



226
227
228
229
230
231
232
233
234
235
236
237
{
	return objc_msg_sendv(self, selector, args);
}
#else
- performv: (SEL)selector
	  : (marg_list)args
{
#if !__OBJC2__
	Method method;

	unsigned size;

	if ((method = class_getInstanceMethod(isa, selector)) != NULL)



		size = method_getSizeOfArguments(method);

	else


		size = 0;










	if (!size)








		return [self forward: selector


				    : args];








	return objc_msgSendv(self, selector, size, args);
#else
#warning ObjC2 removed objc_msgSendv and there is
#warning no own implementation for it yet!
	return nil;
#endif
}
#endif

- (BOOL)isEqual: (id)obj
{
	/* Classes containing data should reimplement this! */







<
|
>
|

|
>
>
>
|
>
|
>
>
|
>
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>
>
>
>
|
>
>
|
>
>
>
>

>
>
>
|

<
<
|







206
207
208
209
210
211
212

213
214
215
216
217
218
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259


260
261
262
263
264
265
266
267
{
	return objc_msg_sendv(self, selector, args);
}
#else
- performv: (SEL)selector
	  : (marg_list)args
{

	Method m;
	char *encoding, rettype;
	size_t depth, argsize;

	if ((m = class_getInstanceMethod(isa, selector)) == NULL ||
	    (encoding = (char*)method_getTypeEncoding(m)) == NULL)
		@throw [OFInvalidArgumentException newWithClass: [self class]
						    andSelector: _cmd];

	rettype = *encoding;

	/* Skip the return type */
	switch (*encoding) {
	case '{':
		for (depth = 0; *encoding; encoding++) {
			if (OF_UNLIKELY(*encoding == '{'))
				depth++;
			else if (OF_UNLIKELY(*encoding == '}') &&
			    OF_LIKELY(!--depth))
				break;
		}
		break;
	case '(':
		for (depth = 0; *encoding; encoding++) {
			if (OF_UNLIKELY(*encoding == '('))
				depth++;
			else if (OF_UNLIKELY(*encoding == ')') &&
			    OF_LIKELY(!--depth))
				break;
		}
		break;
	}
	encoding++;

	for (argsize = 0; *encoding >= '0' && *encoding <= '9'; encoding++)
		argsize = argsize * 10 + (*encoding - '0');

	/* We don't support returning structs or unions yet */
	if (rettype == '{' || rettype == '(')
		@throw [OFNotImplementedException newWithClass: [self class]
						   andSelector: _cmd];

#if __OBJC2__
	@throw [OFNotImplementedException newWithClass: [self class]
					   andSelector: _cmd];
	return self;
#else


	return objc_msgSendv(self, selector, argsize, args);
#endif
}
#endif

- (BOOL)isEqual: (id)obj
{
	/* Classes containing data should reimplement this! */