ObjFW  Check-in [fe2cbe0021]

Overview
Comment:runtime: Define BOOL to be the same as bool

As we define the ABI, we can just replace BOOL with bool everywhere,
including in ObjFW itself. For the Apple platforms where BOOL and bool
are different, this is not a problem as BOOL and bool are passed and
returned the same way in the ABI.

This still defines BOOL to bool for compatibility, except on AmigaOS and
Wii, which both have its own BOOL type.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fe2cbe0021d3ead13b86293e21ff1a1371de0ae850025b73c2f7895570444720
User & Date: js on 2018-04-22 16:13:04
Other Links: manifest | tags
Context
2018-04-22
17:48
Make ObjFW compile for AmigaOS 3 check-in: 0b07c8fcfa user: js tags: trunk
16:13
runtime: Define BOOL to be the same as bool check-in: fe2cbe0021 user: js tags: trunk
2018-04-15
19:15
ObjFW.h: Fix conditional for OFHTTPClient import check-in: 4bc1aa6831 user: js tags: trunk
Changes

Modified src/OFApplication.m from [240e542914] to [8777ac3750].

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# include <crt_externs.h>
#elif defined(OF_WINDOWS)
# include <windows.h>

extern int _CRT_glob;
extern void __wgetmainargs(int *, wchar_t ***, wchar_t ***, int, int *);
#elif defined(OF_MORPHOS)
# define BOOL EXEC_BOOL
# include <proto/exec.h>
# include <proto/dos.h>
# undef BOOL
#elif !defined(OF_IOS)
extern char **environ;
#endif

#ifdef OF_PSP
# include <pspkerneltypes.h>
# include <psploadexec.h>







<


<







49
50
51
52
53
54
55

56
57

58
59
60
61
62
63
64
# include <crt_externs.h>
#elif defined(OF_WINDOWS)
# include <windows.h>

extern int _CRT_glob;
extern void __wgetmainargs(int *, wchar_t ***, wchar_t ***, int, int *);
#elif defined(OF_MORPHOS)

# include <proto/exec.h>
# include <proto/dos.h>

#elif !defined(OF_IOS)
extern char **environ;
#endif

#ifdef OF_PSP
# include <pspkerneltypes.h>
# include <psploadexec.h>

Modified src/OFFile.h from [ee74f7774a] to [1301722443].

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#import "OFKernelEventObserver.h"

#ifndef OF_MORPHOS
# define OF_FILE_HANDLE_IS_FD
# define OF_INVALID_FILE_HANDLE (-1)
typedef int of_file_handle_t;
#else
# define BOOL EXEC_BOOL
# include <proto/dos.h>
# undef BOOL
# define OF_INVALID_FILE_HANDLE NULL
typedef struct of_file_handle *of_file_handle_t;
#endif

OF_ASSUME_NONNULL_BEGIN

@class OFURL;







<

<







19
20
21
22
23
24
25

26

27
28
29
30
31
32
33
#import "OFKernelEventObserver.h"

#ifndef OF_MORPHOS
# define OF_FILE_HANDLE_IS_FD
# define OF_INVALID_FILE_HANDLE (-1)
typedef int of_file_handle_t;
#else

# include <proto/dos.h>

# define OF_INVALID_FILE_HANDLE NULL
typedef struct of_file_handle *of_file_handle_t;
#endif

OF_ASSUME_NONNULL_BEGIN

@class OFURL;

Modified src/OFFile.m from [1cab20f522] to [77e3c3a21e].

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#import "OFWriteFailedException.h"

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

#ifdef OF_WII
# define BOOL OGC_BOOL
# include <fat.h>
# undef BOOL
#endif

#ifdef OF_NINTENDO_DS
# include <stdbool.h>
# include <filesystem.h>
#endif








<

<







45
46
47
48
49
50
51

52

53
54
55
56
57
58
59
#import "OFWriteFailedException.h"

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

#ifdef OF_WII

# include <fat.h>

#endif

#ifdef OF_NINTENDO_DS
# include <stdbool.h>
# include <filesystem.h>
#endif

Modified src/OFFileManager.m from [74a0735e38] to [96795739ab].

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifdef OF_WINDOWS
# include <windows.h>
# include <direct.h>
# include <ntdef.h>
#endif

#ifdef OF_MORPHOS
# define BOOL EXEC_BOOL
# include <proto/dos.h>
# include <proto/locale.h>
# undef BOOL
#endif

@interface OFFileManager_default: OFFileManager
@end

static OFFileManager *defaultManager;








<


<







53
54
55
56
57
58
59

60
61

62
63
64
65
66
67
68
#ifdef OF_WINDOWS
# include <windows.h>
# include <direct.h>
# include <ntdef.h>
#endif

#ifdef OF_MORPHOS

# include <proto/dos.h>
# include <proto/locale.h>

#endif

@interface OFFileManager_default: OFFileManager
@end

static OFFileManager *defaultManager;

Modified src/OFLocalization.m from [8b387494ee] to [ae5afaaea8].

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

#ifdef OF_AMIGAOS
# ifdef OF_AMIGAOS4
#  define __NOLIBBASE__
#  define __NOGLOBALIFACE__
#  define __USE_INLINE__
# endif
# define BOOL EXEC_BOOL
# include <proto/dos.h>
# include <proto/exec.h>
# include <proto/locale.h>
# undef BOOL
#endif

static OFLocalization *sharedLocalization = nil;

#ifdef OF_AMIGAOS4
extern struct ExecIFace *IExec;
static struct Library *DOSBase = NULL;







<



<







31
32
33
34
35
36
37

38
39
40

41
42
43
44
45
46
47

#ifdef OF_AMIGAOS
# ifdef OF_AMIGAOS4
#  define __NOLIBBASE__
#  define __NOGLOBALIFACE__
#  define __USE_INLINE__
# endif

# include <proto/dos.h>
# include <proto/exec.h>
# include <proto/locale.h>

#endif

static OFLocalization *sharedLocalization = nil;

#ifdef OF_AMIGAOS4
extern struct ExecIFace *IExec;
static struct Library *DOSBase = NULL;

Modified src/OFObject.h from [f9418de3f6] to [a6c803a105].

696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
 * @brief Try to resolve the specified class method.
 *
 * This method is called if a class method was not found, so that an
 * implementation can be provided at runtime.
 *
 * @return Whether the method has been added to the class
 */
+ (BOOL)resolveClassMethod: (SEL)selector;

/*!
 * @brief Try to resolve the specified instance method.
 *
 * This method is called if an instance method was not found, so that an
 * implementation can be provided at runtime.
 *
 * @return Whether the method has been added to the class
 */
+ (BOOL)resolveInstanceMethod: (SEL)selector;

/*!
 * @brief Returns the class.
 *
 * This method exists so that classes can be used in collections requiring
 * conformance to the OFCopying protocol.
 *







|









|







696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
 * @brief Try to resolve the specified class method.
 *
 * This method is called if a class method was not found, so that an
 * implementation can be provided at runtime.
 *
 * @return Whether the method has been added to the class
 */
+ (bool)resolveClassMethod: (SEL)selector;

/*!
 * @brief Try to resolve the specified instance method.
 *
 * This method is called if an instance method was not found, so that an
 * implementation can be provided at runtime.
 *
 * @return Whether the method has been added to the class
 */
+ (bool)resolveInstanceMethod: (SEL)selector;

/*!
 * @brief Returns the class.
 *
 * This method exists so that classes can be used in collections requiring
 * conformance to the OFCopying protocol.
 *

Modified src/OFObject.m from [4583da4a4e] to [678b6e28e1].

464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
		free(methodList);
	}
#endif

	[self inheritMethodsFromClass: superclass];
}

+ (BOOL)resolveClassMethod: (SEL)selector
{
	return NO;
}

+ (BOOL)resolveInstanceMethod: (SEL)selector
{
	return NO;
}

- (instancetype)init
{
	return self;







|




|







464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
		free(methodList);
	}
#endif

	[self inheritMethodsFromClass: superclass];
}

+ (bool)resolveClassMethod: (SEL)selector
{
	return NO;
}

+ (bool)resolveInstanceMethod: (SEL)selector
{
	return NO;
}

- (instancetype)init
{
	return self;

Modified src/OFStdIOStream.h from [acf0fa9e57] to [230fa44006].

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 * file.
 */

#import "OFStream.h"
#import "OFKernelEventObserver.h"

#ifdef OF_MORPHOS
# define BOOL EXEC_BOOL
# include <proto/dos.h>
# undef BOOL
#endif

OF_ASSUME_NONNULL_BEGIN

/*!
 * @class OFStdIOStream OFStdIOStream.h ObjFW/OFStdIOStream.h
 *







<

<







15
16
17
18
19
20
21

22

23
24
25
26
27
28
29
 * file.
 */

#import "OFStream.h"
#import "OFKernelEventObserver.h"

#ifdef OF_MORPHOS

# include <proto/dos.h>

#endif

OF_ASSUME_NONNULL_BEGIN

/*!
 * @class OFStdIOStream OFStdIOStream.h ObjFW/OFStdIOStream.h
 *

Modified src/OFStdIOStream.m from [66757147ba] to [7f1468fef3].

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"

#ifdef OF_MORPHOS
# define BOOL EXEC_BOOL
# include <proto/exec.h>
# undef BOOL
#endif

/* References for static linking */
#ifdef OF_WINDOWS
void
_reference_to_OFStdIOStream_Win32Console(void)
{







<

<







38
39
40
41
42
43
44

45

46
47
48
49
50
51
52

#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"

#ifdef OF_MORPHOS

# include <proto/exec.h>

#endif

/* References for static linking */
#ifdef OF_WINDOWS
void
_reference_to_OFStdIOStream_Win32Console(void)
{

Modified src/OFSystemInfo.m from [cdbf79507f] to [d70c261d5b].

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# include <sys/utsname.h>
#endif
#ifdef OF_MACOS
# include <sys/sysctl.h>
#endif

#ifdef OF_MORPHOS
# define BOOL EXEC_BOOL
# include <exec/system.h>
# include <proto/exec.h>
# undef BOOL
#endif

#import "OFSystemInfo.h"
#import "OFApplication.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFLocalization.h"







<


<







29
30
31
32
33
34
35

36
37

38
39
40
41
42
43
44
# include <sys/utsname.h>
#endif
#ifdef OF_MACOS
# include <sys/sysctl.h>
#endif

#ifdef OF_MORPHOS

# include <exec/system.h>
# include <proto/exec.h>

#endif

#import "OFSystemInfo.h"
#import "OFApplication.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFLocalization.h"

Modified src/OFThread.m from [760eefafe7] to [87b40649c1].

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 <sched.h>
#endif
#include "unistd_wrapper.h"

#include "platform.h"

#ifdef OF_MORPHOS
# define BOOL EXEC_BOOL
# include <proto/dos.h>
# undef BOOL
#endif

#ifdef OF_WII
# define BOOL OGC_BOOL
# define nanosleep ogc_nanosleep
# include <ogcsys.h>
# undef BOOL
# undef nanosleep
#endif

#ifdef OF_NINTENDO_3DS
# include <3ds/svc.h>
#endif








<

<



<


<







29
30
31
32
33
34
35

36

37
38
39

40
41

42
43
44
45
46
47
48
# include <sched.h>
#endif
#include "unistd_wrapper.h"

#include "platform.h"

#ifdef OF_MORPHOS

# include <proto/dos.h>

#endif

#ifdef OF_WII

# define nanosleep ogc_nanosleep
# include <ogcsys.h>

# undef nanosleep
#endif

#ifdef OF_NINTENDO_3DS
# include <3ds/svc.h>
#endif

Modified src/OFURLHandler_file.m from [1ed7407f01] to [398809665b].

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifdef OF_WINDOWS
# include <windows.h>
# include <direct.h>
# include <ntdef.h>
#endif

#ifdef OF_MORPHOS
# define BOOL EXEC_BOOL
# include <proto/dos.h>
# include <proto/locale.h>
# undef BOOL
#endif

#if defined(OF_WINDOWS)
typedef struct __stat64 of_stat_t;
#elif defined(OF_MORPHOS)
typedef struct {
	of_offset_t st_size;







<


<







63
64
65
66
67
68
69

70
71

72
73
74
75
76
77
78
#ifdef OF_WINDOWS
# include <windows.h>
# include <direct.h>
# include <ntdef.h>
#endif

#ifdef OF_MORPHOS

# include <proto/dos.h>
# include <proto/locale.h>

#endif

#if defined(OF_WINDOWS)
typedef struct __stat64 of_stat_t;
#elif defined(OF_MORPHOS)
typedef struct {
	of_offset_t st_size;

Modified src/runtime/ObjFW_RT.h from [d5822f4845] to [75ca2f1db8].

51
52
53
54
55
56
57
58
59
60
61
62
63

64

65
66
67
68
69
70
71

#if !__has_feature(objc_arc) && !defined(__unsafe_unretained)
# define __unsafe_unretained
#endif

#define Nil (Class _Null_unspecified)0
#define nil (id _Null_unspecified)0
#define YES (BOOL)1
#define NO  (BOOL)0

typedef struct objc_class *Class;
typedef struct objc_object *id;
typedef const struct objc_selector *SEL;

typedef signed char BOOL;

typedef id _Nullable (*IMP)(id _Nonnull, SEL _Nonnull, ...);
typedef void (*objc_uncaught_exception_handler)(id _Nullable);
typedef void (*objc_enumeration_mutation_handler)(id _Nonnull);

struct objc_class {
	Class _Nonnull isa;
	Class _Nullable superclass;







|
|




>
|
>







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

#if !__has_feature(objc_arc) && !defined(__unsafe_unretained)
# define __unsafe_unretained
#endif

#define Nil (Class _Null_unspecified)0
#define nil (id _Null_unspecified)0
#define YES true
#define NO  false

typedef struct objc_class *Class;
typedef struct objc_object *id;
typedef const struct objc_selector *SEL;
#if !defined(OF_WII) && !defined(OF_AMIGAOS)
typedef bool BOOL;
#endif
typedef id _Nullable (*IMP)(id _Nonnull, SEL _Nonnull, ...);
typedef void (*objc_uncaught_exception_handler)(id _Nullable);
typedef void (*objc_enumeration_mutation_handler)(id _Nonnull);

struct objc_class {
	Class _Nonnull isa;
	Class _Nullable superclass;
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
extern void objc_setEnumerationMutationHandler(
    objc_enumeration_mutation_handler _Nullable);
extern void objc_zero_weak_references(id _Nonnull);
# ifdef __cplusplus
}
# endif
#else
# define BOOL EXEC_BOOL
# include <ppcinline/macros.h>
# undef BOOL
# ifdef __cplusplus
extern "C" {
# endif
extern struct Library *ObjFWRTBase;
# ifdef __cplusplus
}
# endif







<

<







247
248
249
250
251
252
253

254

255
256
257
258
259
260
261
extern void objc_setEnumerationMutationHandler(
    objc_enumeration_mutation_handler _Nullable);
extern void objc_zero_weak_references(id _Nonnull);
# ifdef __cplusplus
}
# endif
#else

# include <ppcinline/macros.h>

# ifdef __cplusplus
extern "C" {
# endif
extern struct Library *ObjFWRTBase;
# ifdef __cplusplus
}
# endif
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
extern id _Nullable objc_lookUpClass(const char *_Nonnull);
extern id _Nullable objc_getClass(const char *_Nonnull);
extern id _Nonnull objc_getRequiredClass(const char *_Nonnull);
extern void objc_exception_throw(id _Nullable);
extern int objc_sync_enter(id _Nullable);
extern int objc_sync_exit(id _Nullable);
extern id _Nullable objc_getProperty(id _Nonnull, SEL _Nonnull, ptrdiff_t,
    BOOL);
extern void objc_setProperty(id _Nonnull, SEL _Nonnull, ptrdiff_t, id _Nullable,
    BOOL, signed char);
extern void objc_getPropertyStruct(void *_Nonnull, const void *_Nonnull,
    ptrdiff_t, BOOL, BOOL);
extern void objc_setPropertyStruct(void *_Nonnull, const void *_Nonnull,
    ptrdiff_t, BOOL, BOOL);
extern void objc_enumerationMutation(id _Nonnull);
#ifdef __cplusplus
}
#endif

#endif







|

|

|

|






284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
extern id _Nullable objc_lookUpClass(const char *_Nonnull);
extern id _Nullable objc_getClass(const char *_Nonnull);
extern id _Nonnull objc_getRequiredClass(const char *_Nonnull);
extern void objc_exception_throw(id _Nullable);
extern int objc_sync_enter(id _Nullable);
extern int objc_sync_exit(id _Nullable);
extern id _Nullable objc_getProperty(id _Nonnull, SEL _Nonnull, ptrdiff_t,
    bool);
extern void objc_setProperty(id _Nonnull, SEL _Nonnull, ptrdiff_t, id _Nullable,
    bool, signed char);
extern void objc_getPropertyStruct(void *_Nonnull, const void *_Nonnull,
    ptrdiff_t, bool, bool);
extern void objc_setPropertyStruct(void *_Nonnull, const void *_Nonnull,
    ptrdiff_t, bool, bool);
extern void objc_enumerationMutation(id _Nonnull);
#ifdef __cplusplus
}
#endif

#endif

Modified src/runtime/class.m from [16946c32d6] to [8659e5eda9].

50
51
52
53
54
55
56
57

58
59
60
61
62
63
64
	cls->dtable = empty_dtable;
	cls->metaclass->dtable = empty_dtable;

	if (strcmp(cls->name, "Protocol") != 0)
		classes_cnt++;
}

BOOL

class_registerAlias_np(Class cls, const char *name)
{
	if (classes == NULL)
		return NO;

	objc_hashtable_set(classes, name, (Class)((uintptr_t)cls | 1));








<
>







50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
	cls->dtable = empty_dtable;
	cls->metaclass->dtable = empty_dtable;

	if (strcmp(cls->name, "Protocol") != 0)
		classes_cnt++;
}


bool
class_registerAlias_np(Class cls, const char *name)
{
	if (classes == NULL)
		return NO;

	objc_hashtable_set(classes, name, (Class)((uintptr_t)cls | 1));

Modified src/runtime/lookup.m from [d66050c602] to [107b957fe8].

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#import "macros.h"

@interface DummyObject
{
	Class isa;
}

+ (BOOL)resolveClassMethod: (SEL)selector;
+ (BOOL)resolveInstanceMethod: (SEL)selector;
@end

static IMP forward_handler = (IMP)0;
static IMP forward_handler_stret = (IMP)0;

static IMP
common_method_not_found(id obj, SEL sel, IMP (*lookup)(id, SEL), IMP forward)







|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#import "macros.h"

@interface DummyObject
{
	Class isa;
}

+ (bool)resolveClassMethod: (SEL)selector;
+ (bool)resolveInstanceMethod: (SEL)selector;
@end

static IMP forward_handler = (IMP)0;
static IMP forward_handler_stret = (IMP)0;

static IMP
common_method_not_found(id obj, SEL sel, IMP (*lookup)(id, SEL), IMP forward)

Modified src/runtime/morphos-library.m from [1e4a1b451d] to [6a9a522909].

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 */

#include "config.h"

#import "ObjFW_RT.h"
#import "macros.h"

#define BOOL EXEC_BOOL
#include <dos/dos.h>
#include <emul/emulregs.h>
#include <exec/execbase.h>
#include <exec/nodes.h>
#include <exec/resident.h>
#include <exec/types.h>
#include <proto/exec.h>
#undef BOOL

struct ObjFWRTBase {
	struct Library library;
	BPTR seg_list;
};

/* Forward declarations for all functions in the func_table */







<







<







16
17
18
19
20
21
22

23
24
25
26
27
28
29

30
31
32
33
34
35
36
 */

#include "config.h"

#import "ObjFW_RT.h"
#import "macros.h"


#include <dos/dos.h>
#include <emul/emulregs.h>
#include <exec/execbase.h>
#include <exec/nodes.h>
#include <exec/resident.h>
#include <exec/types.h>
#include <proto/exec.h>


struct ObjFWRTBase {
	struct Library library;
	BPTR seg_list;
};

/* Forward declarations for all functions in the func_table */

Modified src/runtime/property.m from [ad22d9f929] to [e9bfb6f639].

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	for (size_t i = 0; i < NUM_SPINLOCKS; i++)
		if (!of_spinlock_new(&spinlocks[i]))
			OBJC_ERROR("Failed to initialize spinlocks!")
}
#endif

id
objc_getProperty(id self, SEL _cmd, ptrdiff_t offset, BOOL atomic)
{
	if (atomic) {
		id *ptr = (id *)(void *)((char *)self + offset);
#ifdef OF_HAVE_THREADS
		unsigned hash = SPINLOCK_HASH(ptr);

		OF_ENSURE(of_spinlock_lock(&spinlocks[hash]));







|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	for (size_t i = 0; i < NUM_SPINLOCKS; i++)
		if (!of_spinlock_new(&spinlocks[i]))
			OBJC_ERROR("Failed to initialize spinlocks!")
}
#endif

id
objc_getProperty(id self, SEL _cmd, ptrdiff_t offset, bool atomic)
{
	if (atomic) {
		id *ptr = (id *)(void *)((char *)self + offset);
#ifdef OF_HAVE_THREADS
		unsigned hash = SPINLOCK_HASH(ptr);

		OF_ENSURE(of_spinlock_lock(&spinlocks[hash]));
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#endif
	}

	return *(id *)(void *)((char *)self + offset);
}

void
objc_setProperty(id self, SEL _cmd, ptrdiff_t offset, id value, BOOL atomic,
    signed char copy)
{
	if (atomic) {
		id *ptr = (id *)(void *)((char *)self + offset);
#ifdef OF_HAVE_THREADS
		unsigned hash = SPINLOCK_HASH(ptr);








|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#endif
	}

	return *(id *)(void *)((char *)self + offset);
}

void
objc_setProperty(id self, SEL _cmd, ptrdiff_t offset, id value, bool atomic,
    signed char copy)
{
	if (atomic) {
		id *ptr = (id *)(void *)((char *)self + offset);
#ifdef OF_HAVE_THREADS
		unsigned hash = SPINLOCK_HASH(ptr);

112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
	}

	[old release];
}

/* The following methods are only required for GCC >= 4.6 */
void
objc_getPropertyStruct(void *dest, const void *src, ptrdiff_t size, BOOL atomic,
    BOOL strong)
{
	if (atomic) {
#ifdef OF_HAVE_THREADS
		unsigned hash = SPINLOCK_HASH(src);

		OF_ENSURE(of_spinlock_lock(&spinlocks[hash]));
#endif
		memcpy(dest, src, size);
#ifdef OF_HAVE_THREADS
		OF_ENSURE(of_spinlock_unlock(&spinlocks[hash]));
#endif

		return;
	}

	memcpy(dest, src, size);
}

void
objc_setPropertyStruct(void *dest, const void *src, ptrdiff_t size, BOOL atomic,
    BOOL strong)
{
	if (atomic) {
#ifdef OF_HAVE_THREADS
		unsigned hash = SPINLOCK_HASH(src);

		OF_ENSURE(of_spinlock_lock(&spinlocks[hash]));
#endif







|
|



















|
|







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
	}

	[old release];
}

/* The following methods are only required for GCC >= 4.6 */
void
objc_getPropertyStruct(void *dest, const void *src, ptrdiff_t size, bool atomic,
    bool strong)
{
	if (atomic) {
#ifdef OF_HAVE_THREADS
		unsigned hash = SPINLOCK_HASH(src);

		OF_ENSURE(of_spinlock_lock(&spinlocks[hash]));
#endif
		memcpy(dest, src, size);
#ifdef OF_HAVE_THREADS
		OF_ENSURE(of_spinlock_unlock(&spinlocks[hash]));
#endif

		return;
	}

	memcpy(dest, src, size);
}

void
objc_setPropertyStruct(void *dest, const void *src, ptrdiff_t size, bool atomic,
    bool strong)
{
	if (atomic) {
#ifdef OF_HAVE_THREADS
		unsigned hash = SPINLOCK_HASH(src);

		OF_ENSURE(of_spinlock_lock(&spinlocks[hash]));
#endif

Modified src/runtime/protos.h from [aa2f35848c] to [e94f626094].

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
IMP objc_msg_lookup_super_stret_inline(struct objc_super *, SEL);
id objc_lookUpClass_inline(const char *);
id objc_getClass_inline(const char *);
id objc_getRequiredClass_inline(const char *);
void objc_exception_throw_inline(id);
int objc_sync_enter_inline(id);
int objc_sync_exit_inline(id);
id objc_getProperty_inline(id, SEL, ptrdiff_t, BOOL);
void objc_setProperty_inline(id, SEL, ptrdiff_t, id, BOOL, signed char);
void objc_getPropertyStruct_inline(void *, const void *, ptrdiff_t, BOOL, BOOL);
void objc_setPropertyStruct_inline(void *, const void *, ptrdiff_t, BOOL, BOOL);
void objc_enumerationMutation_inline(id);

SEL sel_registerName(const char *);
const char *sel_getName(SEL);
bool sel_isEqual(SEL, SEL);
Class objc_allocateClassPair(Class, const char *, size_t);
void objc_registerClassPair(Class);







|
|
|
|







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
IMP objc_msg_lookup_super_stret_inline(struct objc_super *, SEL);
id objc_lookUpClass_inline(const char *);
id objc_getClass_inline(const char *);
id objc_getRequiredClass_inline(const char *);
void objc_exception_throw_inline(id);
int objc_sync_enter_inline(id);
int objc_sync_exit_inline(id);
id objc_getProperty_inline(id, SEL, ptrdiff_t, bool);
void objc_setProperty_inline(id, SEL, ptrdiff_t, id, bool, signed char);
void objc_getPropertyStruct_inline(void *, const void *, ptrdiff_t, bool, bool);
void objc_setPropertyStruct_inline(void *, const void *, ptrdiff_t, bool, bool);
void objc_enumerationMutation_inline(id);

SEL sel_registerName(const char *);
const char *sel_getName(SEL);
bool sel_isEqual(SEL, SEL);
Class objc_allocateClassPair(Class, const char *, size_t);
void objc_registerClassPair(Class);

Modified src/socket.h from [e4ca2499ce] to [31842887c2].

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#endif

#include <stdbool.h>

#import "platform.h"

#ifdef OF_HAVE_SYS_SOCKET_H
# ifdef OF_MORPHOS
#  define BOOL EXEC_BOOL
# endif
# include <sys/socket.h>
# ifdef OF_MORPHOS
#  undef BOOL
# endif
#endif
#ifdef OF_HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef OF_HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif







<
<
<

<
<
<







22
23
24
25
26
27
28



29



30
31
32
33
34
35
36
#endif

#include <stdbool.h>

#import "platform.h"

#ifdef OF_HAVE_SYS_SOCKET_H



# include <sys/socket.h>



#endif
#ifdef OF_HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef OF_HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	uint8_t ss_len;
	uint8_t ss_family;
	char ss_data[2 + sizeof(struct in_addr) + 8];
};
#endif

#ifdef OF_WII
# define BOOL OGC_BOOL
# include <network.h>
# undef BOOL

struct sockaddr_storage {
	u8 ss_len;
	u8 ss_family;
	u8 ss_data[14];
};
#endif







<

<







67
68
69
70
71
72
73

74

75
76
77
78
79
80
81
	uint8_t ss_len;
	uint8_t ss_family;
	char ss_data[2 + sizeof(struct in_addr) + 8];
};
#endif

#ifdef OF_WII

# include <network.h>


struct sockaddr_storage {
	u8 ss_len;
	u8 ss_family;
	u8 ss_data[14];
};
#endif

Modified src/unistd_wrapper.h from [05d340e343] to [9807fe4f29].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * file.
 */

#include "config.h"

#include <stdlib.h>	/* Make sure we have any libc include */

#import "platform.h"

#ifdef OF_MORPHOS
# define BOOL EXEC_BOOL
# include <exec/types.h>
# undef BOOL
#endif

#if defined(HAVE_UNISTD_H)
# ifdef __GLIBC__
#  undef __USE_XOPEN	/* Needed to avoid old glibc using __block */
# endif
# include <unistd.h>
# ifdef __GLIBC__
#  define __USE_XOPEN 1
# endif
#endif







<
<
<
<
<
<
<
<









14
15
16
17
18
19
20








21
22
23
24
25
26
27
28
29
 * file.
 */

#include "config.h"

#include <stdlib.h>	/* Make sure we have any libc include */









#if defined(HAVE_UNISTD_H)
# ifdef __GLIBC__
#  undef __USE_XOPEN	/* Needed to avoid old glibc using __block */
# endif
# include <unistd.h>
# ifdef __GLIBC__
#  define __USE_XOPEN 1
# endif
#endif

Modified tests/ForwardingTests.m from [97260d7f73] to [b356b79162].

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
static void
test(id self, SEL _cmd)
{
	success = true;
}

@implementation ForwardingTest
+ (BOOL)resolveClassMethod: (SEL)selector
{
	forwardings++;

	if (sel_isEqual(selector, @selector(test))) {
		class_replaceMethod(object_getClass(self), @selector(test),
		    (IMP)test, "v#:");
		return YES;
	}

	return NO;
}

+ (BOOL)resolveInstanceMethod: (SEL)selector
{
	forwardings++;

	if (sel_isEqual(selector, @selector(test))) {
		class_replaceMethod(self, @selector(test), (IMP)test, "v@:");
		return YES;
	}







|












|







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
static void
test(id self, SEL _cmd)
{
	success = true;
}

@implementation ForwardingTest
+ (bool)resolveClassMethod: (SEL)selector
{
	forwardings++;

	if (sel_isEqual(selector, @selector(test))) {
		class_replaceMethod(object_getClass(self), @selector(test),
		    (IMP)test, "v#:");
		return YES;
	}

	return NO;
}

+ (bool)resolveInstanceMethod: (SEL)selector
{
	forwardings++;

	if (sel_isEqual(selector, @selector(test))) {
		class_replaceMethod(self, @selector(test), (IMP)test, "v@:");
		return YES;
	}

Modified tests/TestsAppDelegate.m from [251eb0b81a] to [4afc655dec].

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# include <pspkernel.h>
# include <pspdebug.h>
# include <pspctrl.h>
PSP_MODULE_INFO("ObjFW Tests", 0, 0, 0);
#endif

#ifdef OF_WII
# define BOOL OGC_BOOL
# define asm __asm__
# include <gccore.h>
# include <wiiuse/wpad.h>
# undef BOOL
# undef asm
#endif

#ifdef OF_NINTENDO_DS
# define asm __asm__
# include <nds.h>
# undef asm







<



<







38
39
40
41
42
43
44

45
46
47

48
49
50
51
52
53
54
# include <pspkernel.h>
# include <pspdebug.h>
# include <pspctrl.h>
PSP_MODULE_INFO("ObjFW Tests", 0, 0, 0);
#endif

#ifdef OF_WII

# define asm __asm__
# include <gccore.h>
# include <wiiuse/wpad.h>

# undef asm
#endif

#ifdef OF_NINTENDO_DS
# define asm __asm__
# include <nds.h>
# undef asm