ObjFW  Check-in [8c2755723a]

Overview
Comment:Add support for ObjFW-RT, the ObjFW Objective C runtime.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8c2755723a927b63e404051778bac0c0cae3a7913d7d81288f362b0d346f71cd
User & Date: js on 2010-04-01 23:51:01
Other Links: manifest | tags
Context
2010-04-02
14:18
Close socket before throwing an exception when bind fails. check-in: ebf57f4891 user: js tags: trunk
2010-04-01
23:51
Add support for ObjFW-RT, the ObjFW Objective C runtime. check-in: 8c2755723a user: js tags: trunk
22:18
Merge to fix wrong parent. check-in: ab2f572dd8 user: js tags: trunk
Changes

Modified configure.ac from [94497d816e] to [fea6d80c3f].

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
AC_PROG_INSTALL
AC_PROG_EGREP

CPP="$OBJCPP"
CPPFLAGS="$CPPFLAGS $OBJCPPFLAGS"
OBJCFLAGS="$OBJCFLAGS -Wall -fexceptions -fobjc-exceptions"
OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstString"
LIBS="$LIBS -lobjc"

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"
	OBJCFLAGS="$OBJCFLAGS -fno-constant-cfstrings"])
AC_SUBST(NO_CONST_CFSTRINGS)







<







10
11
12
13
14
15
16

17
18
19
20
21
22
23
AC_PROG_INSTALL
AC_PROG_EGREP

CPP="$OBJCPP"
CPPFLAGS="$CPPFLAGS $OBJCPPFLAGS"
OBJCFLAGS="$OBJCFLAGS -Wall -fexceptions -fobjc-exceptions"
OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstString"


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"
	OBJCFLAGS="$OBJCFLAGS -fno-constant-cfstrings"])
AC_SUBST(NO_CONST_CFSTRINGS)
53
54
55
56
57
58
59
60

61



62
63
64
65
66
67
68

69

70

71

72






73




74

75






76
77
78
79
80
81
82
	[foo bar];
	], [
	AC_DEFINE(OF_HAVE_PROPERTIES, 1, [Compiler support for properties])
	AC_SUBST(PROPERTIES_M, "properties.m")
	AC_MSG_RESULT(yes)
	], [
	AC_MSG_RESULT(no)])


AC_MSG_CHECKING(which Objective C runtime we use)



dnl TODO: This is ugly. Let's think of a better check.
AC_EGREP_CPP(gnu, [
	#import <objc/objc.h>
	#ifdef __objc_INCLUDE_GNU
	gnu
	#endif
	], [

	AC_DEFINE(OF_GNU_RUNTIME, 1, [Whether we use the GNU ObjC runtime])

	AC_SUBST(RUNTIME_DEF, "-DOF_GNU_RUNTIME")

	objc_runtime="GNU"

	], [






	AC_DEFINE(OF_APPLE_RUNTIME, 1, [Whether we use the Apple ObjC runtime])




	AC_SUBST(RUNTIME_DEF, "-DOF_APPLE_RUNTIME")

	objc_runtime="Apple"])






AC_MSG_RESULT($objc_runtime)

AC_CHECK_FUNC(objc_getProperty,, [
	AC_DEFINE(NEED_OBJC_PROPERTIES_INIT, 1,
		[Whether objc_properties_init needs to be called])
	AC_SUBST(OBJC_PROPERTIES_M, "objc_properties.m")])









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







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
	[foo bar];
	], [
	AC_DEFINE(OF_HAVE_PROPERTIES, 1, [Compiler support for properties])
	AC_SUBST(PROPERTIES_M, "properties.m")
	AC_MSG_RESULT(yes)
	], [
	AC_MSG_RESULT(no)])

AC_CHECK_HEADERS([objfw-rt.h objc/objc.h])

test x"$ac_cv_header_objfw_rt_h" = x"yes" && objc_runtime="ObjFW-RT"

if test x"$ac_cv_header_objc_objc_h" = x"yes"; then
	dnl TODO: This is ugly. Let's think of a better check.
	AC_EGREP_CPP(gnu, [
		#import <objc/objc.h>
		#ifdef __objc_INCLUDE_GNU
		gnu
		#endif
		],
		[test x"$objc_runtime" = "x" && objc_runtime="GNU"],
		[objc_runtime="Apple"])
fi

AC_MSG_CHECKING(which Objective C runtime we use)
case $objc_runtime in
	ObjFW-RT)
		AC_DEFINE(OF_OBJFW_RUNTIME, 1,
			[Whether we use the ObjFW runtime])
		AC_SUBST(GNU_RUNTIME, "-fgnu-runtime")
		OBJCFLAGS="$OBJCFLAGS -fgnu-runtime"
		LIBS="$LIBS -lobjfw-rt"
		;;
	Apple)
		AC_DEFINE(OF_APPLE_RUNTIME, 1,
			[Whether we use the Apple ObjC runtime])
		LIBS="$LIBS -lobjc"
		;;
	GNU)
		AC_DEFINE(OF_GNU_RUNTIME, 1,
			[Whether we use the GNU ObjC runtime])
		LIBS="$LIBS -lobjc"
		;;
	*)
		AC_MSG_RESULT(none)
		AC_MSG_ERROR(No ObjC runtime found! Please install ObjFW-RT!)
		;;
esac
AC_MSG_RESULT($objc_runtime)

AC_CHECK_FUNC(objc_getProperty,, [
	AC_DEFINE(NEED_OBJC_PROPERTIES_INIT, 1,
		[Whether objc_properties_init needs to be called])
	AC_SUBST(OBJC_PROPERTIES_M, "objc_properties.m")])

372
373
374
375
376
377
378







AC_SUBST(CPP)
AC_SUBST(CPPFLAGS)

AC_SUBST(PACKAGE, ObjFW)
AC_CONFIG_FILES([buildsys.mk extra.mk objfw-config])
AC_CONFIG_HEADERS([config.h src/objfw-defs.h])
AC_OUTPUT














>
>
>
>
>
>
>
396
397
398
399
400
401
402
403
404
405
406
407
408
409
AC_SUBST(CPP)
AC_SUBST(CPPFLAGS)

AC_SUBST(PACKAGE, ObjFW)
AC_CONFIG_FILES([buildsys.mk extra.mk objfw-config])
AC_CONFIG_HEADERS([config.h src/objfw-defs.h])
AC_OUTPUT

if test x"$objc_runtime" = x"GNU"; then
	echo
	echo "Warning: You are using GNU libobjc! Support for GNU libobjc will "
	echo "be dropped in the next version! You should upgrade to ObjFW-RT"
	echo "(the ObjFW runtime) instead!"
fi

Modified objfw-config.in from [6e584c777b] to [6c5e0d875b].

1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
#!/bin/sh
prefix="@prefix@"
exec_prefix="@exec_prefix@"
libdir="@libdir@"
CFLAGS=""
CPPFLAGS="-I@includedir@"
CXXFLAGS=""

OBJCFLAGS="-fexceptions -fobjc-exceptions -fconstant-string-class=OFConstString"
OBJCFLAGS="$OBJCFLAGS @NO_CONST_CFSTRINGS@ @NO_WARN_UNUSED@ @ATOMIC_OBJCFLAGS@"
LDFLAGS=""
LDFLAGS_RPATH="@LDFLAGS_RPATH@"
LIBS="-L${libdir} -lobjfw @LIBS@"
VERSION="0.3-dev"

show_help() {







>
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
prefix="@prefix@"
exec_prefix="@exec_prefix@"
libdir="@libdir@"
CFLAGS=""
CPPFLAGS="-I@includedir@"
CXXFLAGS=""
OBJCFLAGS="@GNU_RUNTIME@ -fexceptions -fobjc-exceptions"
OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstString"
OBJCFLAGS="$OBJCFLAGS @NO_CONST_CFSTRINGS@ @NO_WARN_UNUSED@ @ATOMIC_OBJCFLAGS@"
LDFLAGS=""
LDFLAGS_RPATH="@LDFLAGS_RPATH@"
LIBS="-L${libdir} -lobjfw @LIBS@"
VERSION="0.3-dev"

show_help() {

Modified src/OFExceptions.m from [10534da3ea] to [fc53fd3cfe].

12
13
14
15
16
17
18
19
20
21
22

23



24
25
26
27
28
29
30
31
#include "config.h"

#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#import <objc/objc-api.h>
#ifdef OF_APPLE_RUNTIME
# import <objc/runtime.h>
# define SEL_NAME(x) sel_getName(x)

#else



# define SEL_NAME(x) sel_get_name(x)
#endif

#import "OFExceptions.h"
#import "OFString.h"
#import "OFTCPSocket.h"

#ifndef _WIN32







<


<
>
|
>
>
>
|







12
13
14
15
16
17
18

19
20

21
22
23
24
25
26
27
28
29
30
31
32
33
#include "config.h"

#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


#ifdef OF_APPLE_RUNTIME
# import <objc/runtime.h>

# import <objc/objc-api.h>
#endif

#ifdef OF_GNU_RUNTIME
# import <objc/objc-api.h>
# define sel_getName(x) sel_get_name(x)
#endif

#import "OFExceptions.h"
#import "OFString.h"
#import "OFTCPSocket.h"

#ifndef _WIN32
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The method %s of class %s is not or not fully implemented!",
	    SEL_NAME(selector), [class_ className]];

	return string;
}
@end

@implementation OFOutOfRangeException
- (OFString*)string







|







242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The method %s of class %s is not or not fully implemented!",
	    sel_getName(selector), [class_ className]];

	return string;
}
@end

@implementation OFOutOfRangeException
- (OFString*)string
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The argument for method %s of class %s is invalid!",
	    SEL_NAME(selector), [class_ className]];

	return string;
}
@end

@implementation OFInvalidEncodingException
- (OFString*)string







|







292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The argument for method %s of class %s is invalid!",
	    sel_getName(selector), [class_ className]];

	return string;
}
@end

@implementation OFInvalidEncodingException
- (OFString*)string

Modified src/OFObject.h from [d59ecc6081] to [2662d5b8c3].

10
11
12
13
14
15
16



17

18
19
20
21
22
23
24
 */

#import "objfw-defs.h"

#include <stddef.h>
#include <stdint.h>




#import <objc/objc.h>


/**
 * \brief A result of a comparison.
 */
typedef enum __of_comparison_result {
	/// The left object is smaller than the right
	OF_ORDERED_ASCENDING = -1,







>
>
>
|
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 */

#import "objfw-defs.h"

#include <stddef.h>
#include <stdint.h>

#ifdef OF_OBJFW_RUNTIME
# import <objfw-rt.h>
#else
# import <objc/objc.h>
#endif

/**
 * \brief A result of a comparison.
 */
typedef enum __of_comparison_result {
	/// The left object is smaller than the right
	OF_ORDERED_ASCENDING = -1,

Modified src/OFObject.m from [95a9dc34dd] to [6d2f924ac1].

19
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
#include <assert.h>

#import "OFObject.h"
#import "OFAutoreleasePool.h"
#import "OFExceptions.h"
#import "macros.h"


#import <objc/objc-api.h>
#ifdef OF_APPLE_RUNTIME

# import <objc/runtime.h>
#endif
#ifdef OF_GNU_RUNTIME

# import <objc/sarray.h>
#endif

#ifdef _WIN32
# include <windows.h>
#endif

#ifdef OF_ATOMIC_OPS
# import "atomic.h"
#else
# import "threading.h"
#endif

/* A few macros to reduce #ifdefs */
#ifndef OF_APPLE_RUNTIME
# define class_getInstanceSize class_get_instance_size
# define class_getName class_get_class_name
# define class_getSuperclass class_get_super_class
#endif

/// \cond internal
struct pre_ivar {







>
|
|
>

<
|
>














|







19
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
#include <assert.h>

#import "OFObject.h"
#import "OFAutoreleasePool.h"
#import "OFExceptions.h"
#import "macros.h"

#if defined(OF_OBJFW_RUNTIME)
# import <objfw-rt.h>
#elif defined(OF_APPLE_RUNTIME)
# import <objc/objc-api.h>
# import <objc/runtime.h>

#elif defined(OF_GNU_RUNTIME)
# import <objc/objc-api.h>
# import <objc/sarray.h>
#endif

#ifdef _WIN32
# include <windows.h>
#endif

#ifdef OF_ATOMIC_OPS
# import "atomic.h"
#else
# import "threading.h"
#endif

/* A few macros to reduce #ifdefs */
#ifdef OF_GNU_RUNTIME
# define class_getInstanceSize class_get_instance_size
# define class_getName class_get_class_name
# define class_getSuperclass class_get_super_class
#endif

/// \cond internal
struct pre_ivar {
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
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
+ (Class)superclass
{
	return class_getSuperclass(self);
}

+ (BOOL)instancesRespondToSelector: (SEL)selector
{
#ifdef OF_APPLE_RUNTIME
	return class_respondsToSelector(self, selector);
#else
	return class_get_instance_method(self, selector) != METHOD_NULL;
#endif
}

+ (BOOL)conformsToProtocol: (Protocol*)protocol
{
#ifdef OF_APPLE_RUNTIME
	Class c;

	for (c = self; c != Nil; c = class_getSuperclass(c))
		if (class_conformsToProtocol(c, protocol))
			return YES;

	return NO;
#else
	Class c;
	struct objc_protocol_list *pl;
	size_t i;

	for (c = self; c != Nil; c = class_get_super_class(c))
		for (pl = c->protocols; pl != NULL; pl = pl->next)
			for (i = 0; i < pl->count; i++)
				if ([pl->list[i] conformsToProtocol: protocol])
					return YES;









	return NO;
#endif
}

+ (IMP)instanceMethodForSelector: (SEL)selector
{


#ifdef OF_APPLE_RUNTIME
	return class_getMethodImplementation(self, selector);
#else
	return method_get_imp(class_get_instance_method(self, selector));
#endif
}

+ (IMP)setImplementation: (IMP)newimp
	  forClassMethod: (SEL)selector
{


#ifdef OF_APPLE_RUNTIME
	return class_replaceMethod(self->isa, selector, newimp,
	    method_getTypeEncoding(class_getClassMethod(self, selector)));
#else
	Method_t method;
	IMP oldimp;

	/* The class method is the instance method of the meta class */







|
|

|





|
<
<
<
<
<
<
<
<










>
>
>
>
>
>
>
>






>
>
|









>
>
|







181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197








198
199
200
201
202
203
204
205
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
+ (Class)superclass
{
	return class_getSuperclass(self);
}

+ (BOOL)instancesRespondToSelector: (SEL)selector
{
#ifdef OF_GNU_RUNTIME
	return class_get_instance_method(self, selector) != METHOD_NULL;
#else
	return class_respondsToSelector(self, selector);
#endif
}

+ (BOOL)conformsToProtocol: (Protocol*)protocol
{
#ifdef OF_GNU_RUNTIME








	Class c;
	struct objc_protocol_list *pl;
	size_t i;

	for (c = self; c != Nil; c = class_get_super_class(c))
		for (pl = c->protocols; pl != NULL; pl = pl->next)
			for (i = 0; i < pl->count; i++)
				if ([pl->list[i] conformsToProtocol: protocol])
					return YES;

	return NO;
#else
	Class c;

	for (c = self; c != Nil; c = class_getSuperclass(c))
		if (class_conformsToProtocol(c, protocol))
			return YES;

	return NO;
#endif
}

+ (IMP)instanceMethodForSelector: (SEL)selector
{
#if defined(OF_OBJFW_RUNTIME)
	return objc_get_instance_method(self, selector);
#elif defined(OF_APPLE_RUNTIME)
	return class_getMethodImplementation(self, selector);
#else
	return method_get_imp(class_get_instance_method(self, selector));
#endif
}

+ (IMP)setImplementation: (IMP)newimp
	  forClassMethod: (SEL)selector
{
#if defined(OF_OBJFW_RUNTIME)
	return objc_replace_class_method(self, selector, newimp);
#elif defined(OF_APPLE_RUNTIME)
	return class_replaceMethod(self->isa, selector, newimp,
	    method_getTypeEncoding(class_getClassMethod(self, selector)));
#else
	Method_t method;
	IMP oldimp;

	/* The class method is the instance method of the meta class */
257
258
259
260
261
262
263


264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279


280
281
282
283
284
285
286
287
}

+  (IMP)replaceClassMethod: (SEL)selector
  withClassMethodFromClass: (Class)class;
{
	IMP newimp;



#ifdef OF_APPLE_RUNTIME
	newimp = method_getImplementation(class_getClassMethod(class,
	    selector));
#else
	/* The class method is the instance method of the meta class */
	newimp = method_get_imp(class_get_instance_method(class->class_pointer,
	    selector));
#endif

	return [self setImplementation: newimp
			forClassMethod: selector];
}

+ (IMP)setImplementation: (IMP)newimp
       forInstanceMethod: (SEL)selector
{


#ifdef OF_APPLE_RUNTIME
	return class_replaceMethod(self, selector, newimp,
	    method_getTypeEncoding(class_getInstanceMethod(self, selector)));
#else
	Method_t method = class_get_instance_method(self, selector);
	IMP oldimp;

	if (method == NULL)







>
>
|















>
>
|







263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
}

+  (IMP)replaceClassMethod: (SEL)selector
  withClassMethodFromClass: (Class)class;
{
	IMP newimp;

#if defined(OF_OBJFW_RUNTIME)
	newimp = objc_get_class_method(class, selector);
#elif defined(OF_APPLE_RUNTIME)
	newimp = method_getImplementation(class_getClassMethod(class,
	    selector));
#else
	/* The class method is the instance method of the meta class */
	newimp = method_get_imp(class_get_instance_method(class->class_pointer,
	    selector));
#endif

	return [self setImplementation: newimp
			forClassMethod: selector];
}

+ (IMP)setImplementation: (IMP)newimp
       forInstanceMethod: (SEL)selector
{
#if defined(OF_OBJFW_RUNTIME)
	return objc_replace_instance_method(self, selector, newimp);
#elif defined(OF_APPLE_RUNTIME)
	return class_replaceMethod(self, selector, newimp,
	    method_getTypeEncoding(class_getInstanceMethod(self, selector)));
#else
	Method_t method = class_get_instance_method(self, selector);
	IMP oldimp;

	if (method == NULL)
305
306
307
308
309
310
311


312
313
314
315
316
317
318
319
}

+  (IMP)replaceInstanceMethod: (SEL)selector
  withInstanceMethodFromClass: (Class)class;
{
	IMP newimp;



#ifdef OF_APPLE_RUNTIME
	newimp = class_getMethodImplementation(class, selector);
#else
	newimp = method_get_imp(class_get_instance_method(class, selector));
#endif

	return [self setImplementation: newimp
		     forInstanceMethod: selector];







>
>
|







315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
}

+  (IMP)replaceInstanceMethod: (SEL)selector
  withInstanceMethodFromClass: (Class)class;
{
	IMP newimp;

#if defined(OF_OBJFW_RUNTIME)
	newimp = objc_get_instance_method(class, selector);
#elif defined(OF_APPLE_RUNTIME)
	newimp = class_getMethodImplementation(class, selector);
#else
	newimp = method_get_imp(class_get_instance_method(class, selector));
#endif

	return [self setImplementation: newimp
		     forInstanceMethod: selector];
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360


361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
- (Class)class
{
	return isa;
}

- (const char*)className
{
#ifdef OF_APPLE_RUNTIME
	return class_getName(isa);
#else
	return object_get_class_name(self);
#endif
}

- (BOOL)isKindOfClass: (Class)class
{
	Class iter;

	for (iter = isa; iter != Nil; iter = class_getSuperclass(iter))
		if (iter == class)
			return YES;

	return NO;
}

- (BOOL)respondsToSelector: (SEL)selector
{
#ifdef OF_APPLE_RUNTIME
	return class_respondsToSelector(isa, selector);
#else
	if (object_is_instance(self))
		return class_get_instance_method(isa, selector) != METHOD_NULL;
	else
		return class_get_class_method(isa, selector) != METHOD_NULL;


#endif
}

- (BOOL)conformsToProtocol: (Protocol*)protocol
{
	return [isa conformsToProtocol: protocol];
}

- (IMP)methodForSelector: (SEL)selector
{
#ifdef OF_APPLE_RUNTIME
	return class_getMethodImplementation(isa, selector);
#else
	if (object_is_instance(self))
		return method_get_imp(class_get_instance_method(isa, selector));
	else
		return method_get_imp(class_get_class_method(isa, selector));
#endif
}

- (BOOL)isEqual: (OFObject*)obj
{
	/* Classes containing data should reimplement this! */
	return (self == obj ? YES : NO);







|
|

|
















|
<
<




>
>













<
|
<
<







339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366


367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385

386


387
388
389
390
391
392
393
- (Class)class
{
	return isa;
}

- (const char*)className
{
#ifdef OF_GNU_RUNTIME
	return object_get_class_name(self);
#else
	return class_getName(isa);
#endif
}

- (BOOL)isKindOfClass: (Class)class
{
	Class iter;

	for (iter = isa; iter != Nil; iter = class_getSuperclass(iter))
		if (iter == class)
			return YES;

	return NO;
}

- (BOOL)respondsToSelector: (SEL)selector
{
#ifdef OF_GNU_RUNTIME


	if (object_is_instance(self))
		return class_get_instance_method(isa, selector) != METHOD_NULL;
	else
		return class_get_class_method(isa, selector) != METHOD_NULL;
#else
	return class_respondsToSelector(isa, selector);
#endif
}

- (BOOL)conformsToProtocol: (Protocol*)protocol
{
	return [isa conformsToProtocol: protocol];
}

- (IMP)methodForSelector: (SEL)selector
{
#ifdef OF_APPLE_RUNTIME
	return class_getMethodImplementation(isa, selector);
#else

	return objc_msg_lookup(self, selector);


#endif
}

- (BOOL)isEqual: (OFObject*)obj
{
	/* Classes containing data should reimplement this! */
	return (self == obj ? YES : NO);

Modified src/objc_sync.m from [557c8959b1] to [a4f4af841a].

11
12
13
14
15
16
17



18

19
20
21
22
23
24
25

#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>




#import <objc/objc.h>


#import "threading.h"

/// \cond internal
struct locks_s {
	id		 obj;
	size_t		 count;







>
>
>
|
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

#ifdef OF_OBJFW_RUNTIME
# import <objfw-rt.h>
#else
# import <objc/objc.h>
#endif

#import "threading.h"

/// \cond internal
struct locks_s {
	id		 obj;
	size_t		 count;

Modified src/objfw-defs.h.in from [e92fcadc33] to [216453ffb3].

1
2
3
4
5
6
7
8
9
10

11
12
13
#undef OF_APPLE_RUNTIME
#undef OF_ATOMIC_OPS
#undef OF_BIG_ENDIAN
#undef OF_GNU_RUNTIME
#undef OF_HAVE_ASPRINTF
#undef OF_HAVE_GCC_ATOMIC_OPS
#undef OF_HAVE_LIBKERN_OSATOMIC_H
#undef OF_HAVE_PTHREADS
#undef OF_HAVE_PTHREAD_SPINLOCKS
#undef OF_HAVE_SCHED_YIELD

#undef OF_PLUGINS
#undef OF_THREADS
#undef SIZE_MAX










>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
#undef OF_APPLE_RUNTIME
#undef OF_ATOMIC_OPS
#undef OF_BIG_ENDIAN
#undef OF_GNU_RUNTIME
#undef OF_HAVE_ASPRINTF
#undef OF_HAVE_GCC_ATOMIC_OPS
#undef OF_HAVE_LIBKERN_OSATOMIC_H
#undef OF_HAVE_PTHREADS
#undef OF_HAVE_PTHREAD_SPINLOCKS
#undef OF_HAVE_SCHED_YIELD
#undef OF_OBJFW_RUNTIME
#undef OF_PLUGINS
#undef OF_THREADS
#undef SIZE_MAX