ObjFW  Check-in [8df894fc8a]

Overview
Comment:Add support for ObjC 2 properties.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8df894fc8ada42697b4a127fc7af4946490f59e077d28b70aa1ce100be9985ac
User & Date: js on 2010-01-05 23:24:24
Other Links: manifest | tags
Context
2010-01-07
11:54
Change URL in framwork plist. check-in: 259737827b user: js tags: trunk
2010-01-05
23:24
Add support for ObjC 2 properties. check-in: 8df894fc8a user: js tags: trunk
2010-01-04
15:00
Add ChangeLog to default branch as well. check-in: c3cb23d274 user: js tags: trunk
Changes

Modified configure.ac from [23d53411b3] to [117a51637e].

48
49
50
51
52
53
54



55
56
57
58
59
60
61
	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_enumerationMutation, [
	AC_DEFINE(HAVE_OBJC_ENUMERATIONMUTATION, 1,
		[Whether we have objc_enumerationMutation])])

BUILDSYS_LIB
AC_DEFINE_UNQUOTED(PLUGIN_SUFFIX, "$PLUGIN_SUFFIX", [Suffix for plugins])
if test x"$PLUGIN_SUFFIX" != "x"; then







>
>
>







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
	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_SUBST(OBJC_PROPERTIES_M, "objc_properties.m")])

AC_CHECK_FUNC(objc_enumerationMutation, [
	AC_DEFINE(HAVE_OBJC_ENUMERATIONMUTATION, 1,
		[Whether we have objc_enumerationMutation])])

BUILDSYS_LIB
AC_DEFINE_UNQUOTED(PLUGIN_SUFFIX, "$PLUGIN_SUFFIX", [Suffix for plugins])
if test x"$PLUGIN_SUFFIX" != "x"; then

Modified extra.mk.in from [d89a7b2c42] to [5cf2a3c0d7].

1

2
3
4
5
6
7
8
ASPRINTF_M = @ASPRINTF_M@

OBJC_SYNC_M = @OBJC_SYNC_M@
OFPLUGIN_M = @OFPLUGIN_M@
OFTHREAD_M = @OFTHREAD_M@
TESTPLUGIN = @TESTPLUGIN@
TESTS = @TESTS@
TEST_LAUNCHER = @TEST_LAUNCHER@
THREADING_H = @THREADING_H@

>







1
2
3
4
5
6
7
8
9
ASPRINTF_M = @ASPRINTF_M@
OBJC_PROPERTIES_M = @OBJC_PROPERTIES_M@
OBJC_SYNC_M = @OBJC_SYNC_M@
OFPLUGIN_M = @OFPLUGIN_M@
OFTHREAD_M = @OFTHREAD_M@
TESTPLUGIN = @TESTPLUGIN@
TESTS = @TESTS@
TEST_LAUNCHER = @TEST_LAUNCHER@
THREADING_H = @THREADING_H@

Modified src/Makefile from [56eedcf2bc] to [52223a5ca8].

34
35
36
37
38
39
40
41
42
43
44


45
46
47
48
49
50
	    OFFastEnumeration.h	\
	    OFMacros.h		\
	    ObjFW.h		\
	    asprintf.h		\
	    objfw-defs.h	\
	    ${THREADING_H}

SRCS += ${OBJC_SYNC_M}	\
	${ASPRINTF_M}	\
	iso_8859_15.m	\
	windows_1252.m



include ../buildsys.mk

CPPFLAGS += -I..
OBJCFLAGS += ${LIB_CFLAGS}
LD = ${OBJC}







<
|
|
|
>
>






34
35
36
37
38
39
40

41
42
43
44
45
46
47
48
49
50
51
	    OFFastEnumeration.h	\
	    OFMacros.h		\
	    ObjFW.h		\
	    asprintf.h		\
	    objfw-defs.h	\
	    ${THREADING_H}


SRCS += ${AS_PRINTF_M} 		\
	iso_8859_15.m		\
	windows_1252.m		\
	${OBJC_PROPERTIES_M}	\
	${OBJC_SYNC_M}

include ../buildsys.mk

CPPFLAGS += -I..
OBJCFLAGS += ${LIB_CFLAGS}
LD = ${OBJC}

Added src/objc_properties.m version [2f04d69904].





































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
/*
 * Copyright (c) 2008 - 2009
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#include "config.h"

#import <objc/objc.h>

#import "OFExceptions.h"

id
objc_getProperty(id self, SEL _cmd, ptrdiff_t offset, BOOL atomic)
{
	if (atomic) {
		@synchronized (self) {
			id ptr = *(id*)((char*)self + offset);
			return [[ptr retain] autorelease];
		}
	}

	return [[*(id*)((char*)self + offset) retain] autorelease];
}

void
objc_setProperty(id self, SEL _cmd, ptrdiff_t offset, id value, BOOL atomic,
    BOOL copy)
{
	if (atomic) {
		@synchronized ((atomic ? self : nil)) {
			id *ptr = (id*)((char*)self + offset);
			id old = *ptr;

			*ptr = (copy ? [value copy] : [value retain]);
			[old release];
		}
	}

	id *ptr = (id*)((char*)self + offset);
	id old = *ptr;

	*ptr = (copy ? [value copy] : [value retain]);
	[old release];
}