ObjFW  Check-in [5bb771755d]

Overview
Comment:runtime: Rename include to ObjFW-RT.h
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5bb771755de0c5201735e8894259264944bbbe838d9ab625a526f4ff5ae97bbc
User & Date: js on 2017-07-09 15:29:03
Other Links: manifest | tags
Context
2017-07-16
11:07
TableGenerator: Apply decomposition recursively check-in: 474694d5bb user: js tags: trunk
2017-07-09
15:29
runtime: Rename include to ObjFW-RT.h check-in: 5bb771755d user: js tags: trunk
14:14
runtime/morphos-library.m: Add all functions check-in: b930fcc11f user: js tags: trunk
Changes

Modified configure.ac from [67067285a0] to [12f3d4bae6].

129
130
131
132
133
134
135
136
137
138
139
140
141
142
143

	AC_DEFINE(OF_NINTENDO_3DS, 1,
		[Whether we are compiling for the Nintendo 3DS])
	AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
])

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

case "$OBJC" in
	*clang*)
		case "$host" in
			dnl Clang generates MIPS assembly not accepted by GNU







|







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143

	AC_DEFINE(OF_NINTENDO_3DS, 1,
		[Whether we are compiling for the Nintendo 3DS])
	AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
])

CPP="$OBJCPP"
CPPFLAGS="$CPPFLAGS $OBJCPPFLAGS -DOF_COMPILING_OBJFW"
OBJCFLAGS="$OBJCFLAGS -Wall -fexceptions -fobjc-exceptions -funwind-tables"
OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstantString"

case "$OBJC" in
	*clang*)
		case "$host" in
			dnl Clang generates MIPS assembly not accepted by GNU

Modified src/Makefile from [456208f686] to [8cf2a2c1f8].

172
173
174
175
176
177
178
179
180
181
182
LIB_OBJS_EXTRA = ${RUNTIME_RUNTIME_LIB_A}	\
		 ${EXCEPTIONS_EXCEPTIONS_LIB_A}	\
		 ${ENCODINGS_ENCODINGS_LIB_A}	\
		 ${FORWARDING_FORWARDING_LIB_A}

include ../buildsys.mk

CPPFLAGS += -I. -I.. -Iexceptions -Iruntime -DOF_COMPILING_OBJFW
LD = ${OBJC}
LDFLAGS += ${REEXPORT_RUNTIME}
LIBS += -Lruntime ${RUNTIME_LIBS}







|



172
173
174
175
176
177
178
179
180
181
182
LIB_OBJS_EXTRA = ${RUNTIME_RUNTIME_LIB_A}	\
		 ${EXCEPTIONS_EXCEPTIONS_LIB_A}	\
		 ${ENCODINGS_ENCODINGS_LIB_A}	\
		 ${FORWARDING_FORWARDING_LIB_A}

include ../buildsys.mk

CPPFLAGS += -I. -I.. -Iexceptions -Iruntime
LD = ${OBJC}
LDFLAGS += ${REEXPORT_RUNTIME}
LIBS += -Lruntime ${RUNTIME_LIBS}

Modified src/OFBlock.m from [d386c614c9] to [bc6ad5b4e9].

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

#import "OFBlock.h"

#import "OFAllocFailedException.h"
#import "OFInitializationFailedException.h"

#if defined(OF_OBJFW_RUNTIME)
# import "runtime-private.h"
#endif

#ifdef OF_HAVE_ATOMIC_OPS
# import "atomic.h"
#endif
#ifdef OF_HAVE_THREADS
# import "threading.h"







|







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

#import "OFBlock.h"

#import "OFAllocFailedException.h"
#import "OFInitializationFailedException.h"

#if defined(OF_OBJFW_RUNTIME)
# import "runtime/private.h"
#endif

#ifdef OF_HAVE_ATOMIC_OPS
# import "atomic.h"
#endif
#ifdef OF_HAVE_THREADS
# import "threading.h"

Modified src/OFObject.m from [a3ec40e380] to [c072b00a16].

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#import "OFNotImplementedException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"

#if defined(OF_APPLE_RUNTIME) && __OBJC2__
# import <objc/objc-exception.h>
#elif defined(OF_OBJFW_RUNTIME)
# import "runtime.h"
#endif

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

#import "OFString.h"







|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#import "OFNotImplementedException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"

#if defined(OF_APPLE_RUNTIME) && __OBJC2__
# import <objc/objc-exception.h>
#elif defined(OF_OBJFW_RUNTIME)
# import "ObjFW-RT.h"
#endif

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

#import "OFString.h"

Modified src/encodings/Makefile from [3f9e4a7eba] to [7b7ddcc159].

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

STATIC_PIC_LIB_NOINST = ${ENCODINGS_LIB_A}
STATIC_LIB_NOINST = ${ENCODINGS_A}

SRCS = ${ENCODINGS_SRCS}

include ../../buildsys.mk

CPPFLAGS += -I. -I.. -I../.. -I../runtime -I../exceptions -DOF_COMPILING_OBJFW









|
1
2
3
4
5
6
7
8
9
10
include ../../extra.mk

STATIC_PIC_LIB_NOINST = ${ENCODINGS_LIB_A}
STATIC_LIB_NOINST = ${ENCODINGS_A}

SRCS = ${ENCODINGS_SRCS}

include ../../buildsys.mk

CPPFLAGS += -I. -I.. -I../.. -I../runtime -I../exceptions

Modified src/exceptions/Makefile from [106f86395a] to [4234a1c5c7].

66
67
68
69
70
71
72
73
	       OFThreadStartFailedException.m		\
	       OFThreadStillRunningException.m

INCLUDES = ${SRCS:.m=.h}

include ../../buildsys.mk

CPPFLAGS += -I. -I.. -I../.. -I../runtime -DOF_COMPILING_OBJFW







|
66
67
68
69
70
71
72
73
	       OFThreadStartFailedException.m		\
	       OFThreadStillRunningException.m

INCLUDES = ${SRCS:.m=.h}

include ../../buildsys.mk

CPPFLAGS += -I. -I.. -I../.. -I../runtime

Modified src/macros.h from [4e6153e065] to [8a33280748].

29
30
31
32
33
34
35

36



37
38
39
40
41
42
43
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "platform.h"

#ifdef OF_OBJFW_RUNTIME

# import "runtime.h"



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








>
|
>
>
>







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "platform.h"

#ifdef OF_OBJFW_RUNTIME
# ifdef OF_COMPILING_OBJFW
#  import "ObjFW-RT.h"
# else
#  import <ObjFW-RT/ObjFW-RT.h>
# endif
#endif
#ifdef OF_APPLE_RUNTIME
# import <objc/objc.h>
# import <objc/runtime.h>
# import <objc/message.h>
#endif

Modified src/runtime/Makefile from [5637a69868] to [271fe24054].

22
23
24
25
26
27
28
29

30
31
32
33
34
35
36
       selector.m		\
       sparsearray.m		\
       static-instances.m	\
       synchronized.m		\
       ${USE_SRCS_THREADS}
SRCS_THREADS = threading.m	\
	       ../threading.m
INCLUDES = runtime.h


OBJS_EXTRA = ${LOOKUP_ASM_LOOKUP_ASM_A}
LIB_OBJS_EXTRA = ${LOOKUP_ASM_LOOKUP_ASM_LIB_A}
MORPHOS_LIB_OBJS_EXTRA = morphos-library.o ${LOOKUP_ASM_LOOKUP_ASM_A}

include ../../buildsys.mk








|
>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
       selector.m		\
       sparsearray.m		\
       static-instances.m	\
       synchronized.m		\
       ${USE_SRCS_THREADS}
SRCS_THREADS = threading.m	\
	       ../threading.m
INCLUDES = ObjFW-RT.h
includesubdir = ObjFW-RT

OBJS_EXTRA = ${LOOKUP_ASM_LOOKUP_ASM_A}
LIB_OBJS_EXTRA = ${LOOKUP_ASM_LOOKUP_ASM_LIB_A}
MORPHOS_LIB_OBJS_EXTRA = morphos-library.o ${LOOKUP_ASM_LOOKUP_ASM_A}

include ../../buildsys.mk

Added src/runtime/ObjFW-RT.h version [134f947253].











































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
51
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
107
108
109
110
111
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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
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
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
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
 *   Jonathan Schleifer <js@heap.zone>
 *
 * 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.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * 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.
 */

#ifndef __OBJFW_RUNTIME_H__
#define __OBJFW_RUNTIME_H__

#ifndef __STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS
#endif
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
#endif

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

#ifndef __has_feature
# define __has_feature(x) 0
#endif

#ifndef __has_attribute
# define __has_attribute(x) 0
#endif

#if __has_feature(objc_arc)
# define OBJC_UNSAFE_UNRETAINED __unsafe_unretained
#else
# define OBJC_UNSAFE_UNRETAINED
#endif

#if __has_feature(nullability)
# define OBJC_NONNULL _Nonnull
# define OBJC_NULLABLE _Nullable
#else
# define OBJC_NONNULL
# define OBJC_NULLABLE
#endif

#if __has_attribute(__objc_root_class__)
# define OBJC_ROOT_CLASS __attribute__((__objc_root_class__))
#else
# define OBJC_ROOT_CLASS
#endif

#define Nil (Class)0
#define nil (id)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 OBJC_NULLABLE (*IMP)(id OBJC_NONNULL, SEL OBJC_NONNULL, ...);
typedef void (*objc_uncaught_exception_handler)(id OBJC_NULLABLE);
typedef void (*objc_enumeration_mutation_handler)(id OBJC_NONNULL);

struct objc_class {
	Class OBJC_NONNULL isa;
	Class OBJC_NULLABLE superclass;
	const char *OBJC_NONNULL name;
	unsigned long version;
	unsigned long info;
	long instance_size;
	struct objc_ivar_list *OBJC_NULLABLE ivars;
	struct objc_method_list *OBJC_NULLABLE methodlist;
	struct objc_dtable *OBJC_NULLABLE dtable;
	Class OBJC_NONNULL *OBJC_NULLABLE subclass_list;
	void *OBJC_NULLABLE sibling_class;
	struct objc_protocol_list *OBJC_NULLABLE protocols;
	void *OBJC_NULLABLE gc_object_type;
	unsigned long abi_version;
	int32_t *OBJC_NONNULL *OBJC_NULLABLE ivar_offsets;
	struct objc_property_list *OBJC_NULLABLE properties;
};

enum objc_class_info {
	OBJC_CLASS_INFO_CLASS	    = 0x001,
	OBJC_CLASS_INFO_METACLASS   = 0x002,
	OBJC_CLASS_INFO_NEW_ABI	    = 0x010,
	OBJC_CLASS_INFO_SETUP	    = 0x100,
	OBJC_CLASS_INFO_LOADED	    = 0x200,
	OBJC_CLASS_INFO_DTABLE	    = 0x400,
	OBJC_CLASS_INFO_INITIALIZED = 0x800
};

struct objc_object {
	Class OBJC_NONNULL isa;
};

struct objc_selector {
	uintptr_t uid;
	const char *OBJC_NULLABLE types;
};

struct objc_super {
	id OBJC_UNSAFE_UNRETAINED OBJC_NULLABLE self;
	Class OBJC_NONNULL cls;
};

struct objc_method {
	struct objc_selector sel;
	IMP OBJC_NONNULL imp;
};

struct objc_method_list {
	struct objc_method_list *OBJC_NULLABLE next;
	unsigned int count;
	struct objc_method methods[1];
};

struct objc_category {
	const char *OBJC_NONNULL category_name;
	const char *OBJC_NONNULL class_name;
	struct objc_method_list *OBJC_NULLABLE instance_methods;
	struct objc_method_list *OBJC_NULLABLE class_methods;
	struct objc_protocol_list *OBJC_NULLABLE protocols;
};

struct objc_ivar {
	const char *OBJC_NONNULL name;
	const char *OBJC_NONNULL type;
	unsigned int offset;
};

struct objc_ivar_list {
	unsigned int count;
	struct objc_ivar ivars[1];
};

enum objc_property_attributes {
	OBJC_PROPERTY_READONLY	= 0x01,
	OBJC_PROPERTY_GETTER	= 0x02,
	OBJC_PROPERTY_ASSIGN	= 0x04,
	OBJC_PROPERTY_READWRITE	= 0x08,
	OBJC_PROPERTY_RETAIN	= 0x10,
	OBJC_PROPERTY_COPY	= 0x20,
	OBJC_PROPERTY_NONATOMIC	= 0x40,
	OBJC_PROPERTY_SETTER	= 0x80
};

enum objc_property_extended_attributes {
	OBJC_PROPERTY_SYNTHESIZE	=  0x1,
	OBJC_PROPERTY_DYNAMIC		=  0x2,
	OBJC_PROPERTY_PROTOCOL		=  0x3,
	OBJC_PROPERTY_ATOMIC		=  0x4,
	OBJC_PROPERTY_WEAK		=  0x8,
	OBJC_PROPERTY_STRONG		= 0x10,
	OBJC_PROPERTY_UNSAFE_UNRETAINED = 0x20
};

struct objc_property {
	const char *OBJC_NONNULL name;
	unsigned char attributes, extended_attributes;
	struct {
		const char *OBJC_NULLABLE name;
		const char *OBJC_NULLABLE type;
	} getter, setter;
};

struct objc_property_list {
	unsigned int count;
	struct objc_property_list *OBJC_NULLABLE next;
	struct objc_property properties[1];
};

#ifdef __OBJC__
OBJC_ROOT_CLASS
@interface Protocol
{
@public
#else
typedef struct {
#endif
	Class OBJC_NONNULL isa;
	const char *OBJC_NONNULL name;
	struct objc_protocol_list *OBJC_NULLABLE protocol_list;
	struct objc_abi_method_description_list *OBJC_NULLABLE instance_methods;
	struct objc_abi_method_description_list *OBJC_NULLABLE class_methods;
#ifdef __OBJC__
}
@end
#else
} Protocol;
#endif

struct objc_protocol_list {
	struct objc_protocol_list *OBJC_NULLABLE next;
	long count;
	Protocol *OBJC_UNSAFE_UNRETAINED OBJC_NONNULL list[1];
};

#ifdef __cplusplus
extern "C" {
#endif
extern SEL OBJC_NONNULL sel_registerName(const char *OBJC_NONNULL);
extern const char *OBJC_NONNULL sel_getName(SEL OBJC_NONNULL);
extern bool sel_isEqual(SEL OBJC_NONNULL, SEL OBJC_NONNULL);
extern Class OBJC_NONNULL objc_allocateClassPair(Class OBJC_NULLABLE,
    const char *OBJC_NONNULL, size_t);
extern void objc_registerClassPair(Class OBJC_NONNULL);
extern id OBJC_NULLABLE objc_lookUpClass(const char *OBJC_NONNULL);
extern id OBJC_NULLABLE objc_getClass(const char *OBJC_NONNULL);
extern id OBJC_NONNULL objc_getRequiredClass(const char *OBJC_NONNULL);
extern unsigned int objc_getClassList(Class OBJC_NONNULL *OBJC_NULLABLE,
    unsigned int);
extern Class OBJC_NONNULL *OBJC_NONNULL objc_copyClassList(
    unsigned int *OBJC_NULLABLE);
extern bool class_isMetaClass(Class OBJC_NULLABLE);
extern const char *OBJC_NONNULL class_getName(Class OBJC_NULLABLE);
extern Class OBJC_NULLABLE class_getSuperclass(Class OBJC_NULLABLE);
extern unsigned long class_getInstanceSize(Class OBJC_NULLABLE);
extern bool class_respondsToSelector(Class OBJC_NULLABLE, SEL OBJC_NONNULL);
extern bool class_conformsToProtocol(Class OBJC_NULLABLE,
    Protocol *OBJC_NONNULL);
extern IMP OBJC_NULLABLE class_getMethodImplementation(Class OBJC_NULLABLE,
    SEL OBJC_NONNULL);
extern IMP OBJC_NULLABLE class_getMethodImplementation_stret(
    Class OBJC_NULLABLE, SEL OBJC_NONNULL);
extern const char *OBJC_NULLABLE class_getMethodTypeEncoding(
    Class OBJC_NULLABLE, SEL OBJC_NONNULL);
extern bool class_addMethod(Class OBJC_NONNULL, SEL OBJC_NONNULL,
    IMP OBJC_NONNULL, const char *OBJC_NULLABLE);
extern IMP OBJC_NULLABLE class_replaceMethod(Class OBJC_NONNULL,
    SEL OBJC_NONNULL, IMP OBJC_NONNULL, const char *OBJC_NULLABLE);
extern Class OBJC_NULLABLE object_getClass(id OBJC_NULLABLE);
extern Class OBJC_NULLABLE object_setClass(id OBJC_NULLABLE,
    Class OBJC_NONNULL);
extern const char *OBJC_NONNULL object_getClassName(id OBJC_NULLABLE);
extern const char *OBJC_NONNULL protocol_getName(Protocol *OBJC_NONNULL);
extern bool protocol_isEqual(Protocol *OBJC_NONNULL, Protocol *OBJC_NONNULL);
extern bool protocol_conformsToProtocol(Protocol *OBJC_NONNULL,
    Protocol *OBJC_NONNULL);
extern void objc_exit(void);
extern OBJC_NULLABLE objc_uncaught_exception_handler
    objc_setUncaughtExceptionHandler(
    objc_uncaught_exception_handler OBJC_NULLABLE);
extern void objc_setForwardHandler(IMP OBJC_NULLABLE, IMP OBJC_NULLABLE);
extern void objc_zero_weak_references(id OBJC_NONNULL);

/*
 * Used by the compiler, but can also be called manually.
 *
 * These declarations are also required to prevent Clang's implicit
 * declarations which include __declspec(dllimport) on Windows.
 */
struct objc_abi_module;
extern void __objc_exec_class(void *OBJC_NONNULL);
extern IMP OBJC_NONNULL objc_msg_lookup(id OBJC_NULLABLE, SEL OBJC_NONNULL);
extern IMP OBJC_NONNULL objc_msg_lookup_stret(id OBJC_NULLABLE,
    SEL OBJC_NONNULL);
extern IMP OBJC_NONNULL objc_msg_lookup_super(struct objc_super *OBJC_NONNULL,
    SEL OBJC_NONNULL);
extern IMP OBJC_NONNULL objc_msg_lookup_super_stret(
    struct objc_super *OBJC_NONNULL, SEL OBJC_NONNULL);
extern void objc_exception_throw(id OBJC_NULLABLE);
extern int objc_sync_enter(id OBJC_NULLABLE);
extern int objc_sync_exit(id OBJC_NULLABLE);
extern id OBJC_NULLABLE objc_getProperty(id OBJC_NONNULL, SEL OBJC_NONNULL,
    ptrdiff_t, BOOL);
extern void objc_setProperty(id OBJC_NONNULL, SEL OBJC_NONNULL, ptrdiff_t,
    id OBJC_NULLABLE, BOOL, signed char);
extern void objc_getPropertyStruct(void *OBJC_NONNULL, const void *OBJC_NONNULL,
    ptrdiff_t, BOOL, BOOL);
extern void objc_setPropertyStruct(void *OBJC_NONNULL, const void *OBJC_NONNULL,
    ptrdiff_t, BOOL, BOOL);
extern void objc_enumerationMutation(id OBJC_NONNULL);
extern void objc_setEnumerationMutationHandler(
    objc_enumeration_mutation_handler OBJC_NULLABLE);
#ifdef __cplusplus
}
#endif

#undef OBJC_NONNULL
#undef OBJC_NULLABLE
#undef OBJC_UNSAFE_UNRETAINED
#undef OBJC_ROOT_CLASS

#endif

Modified src/runtime/arc.m from [04f2c4d0f6] to [e75942a762].

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * 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 "config.h"

#import "runtime.h"
#import "runtime-private.h"

#ifdef OF_HAVE_THREADS
# import "threading.h"
#endif

#import "OFObject.h"
#import "OFBlock.h"







|
|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * 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 "config.h"

#import "ObjFW-RT.h"
#import "private.h"

#ifdef OF_HAVE_THREADS
# import "threading.h"
#endif

#import "OFObject.h"
#import "OFBlock.h"

Modified src/runtime/category.m from [768ffeb962] to [f4a91ebbc5].

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#include "config.h"

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

#import "runtime.h"
#import "runtime-private.h"

static struct objc_hashtable *categories = NULL;

static void
register_selectors(struct objc_abi_category *cat)
{
	for (struct objc_abi_method_list *ml = cat->instance_methods;







|
|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#include "config.h"

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

#import "ObjFW-RT.h"
#import "private.h"

static struct objc_hashtable *categories = NULL;

static void
register_selectors(struct objc_abi_category *cat)
{
	for (struct objc_abi_method_list *ml = cat->instance_methods;

Modified src/runtime/class.m from [aedf6b0f5f] to [d9200138d3].

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

#include <assert.h>

#import "runtime.h"
#import "runtime-private.h"

static struct objc_hashtable *classes = NULL;
static unsigned classes_cnt = 0;
static Class *load_queue = NULL;
static size_t load_queue_cnt = 0;
static struct objc_dtable *empty_dtable = NULL;
static unsigned lookups_till_fast_path = 128;







|
|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

#include <assert.h>

#import "ObjFW-RT.h"
#import "private.h"

static struct objc_hashtable *classes = NULL;
static unsigned classes_cnt = 0;
static Class *load_queue = NULL;
static size_t load_queue_cnt = 0;
static struct objc_dtable *empty_dtable = NULL;
static unsigned lookups_till_fast_path = 128;

Modified src/runtime/dtable.m from [6f5c36ea25] to [2fb63ca21b].

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

#include "config.h"

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

#import "runtime.h"
#import "runtime-private.h"

static struct objc_dtable_level2 *empty_level2 = NULL;
#ifdef OF_SELUID24
static struct objc_dtable_level3 *empty_level3 = NULL;
#endif

static void







|
|







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

#include "config.h"

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

#import "ObjFW-RT.h"
#import "private.h"

static struct objc_dtable_level2 *empty_level2 = NULL;
#ifdef OF_SELUID24
static struct objc_dtable_level3 *empty_level3 = NULL;
#endif

static void

Modified src/runtime/exception.m from [9516bed461] to [11649a75a7].

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#include "config.h"

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

#import "runtime.h"
#import "runtime-private.h"

#import "macros.h"
#ifdef OF_HAVE_THREADS
# include "threading.h"
#endif

#ifdef HAVE_SEH_EXCEPTIONS







|
|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#include "config.h"

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

#import "ObjFW-RT.h"
#import "private.h"

#import "macros.h"
#ifdef OF_HAVE_THREADS
# include "threading.h"
#endif

#ifdef HAVE_SEH_EXCEPTIONS

Modified src/runtime/hashtable.m from [8166d9c683] to [69b267cc69].

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#import "runtime.h"
#import "runtime-private.h"

struct objc_hashtable_bucket objc_deleted_bucket;

uint32_t
objc_hash_string(const void *str_)
{
	const char *str = str_;







|
|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#import "ObjFW-RT.h"
#import "private.h"

struct objc_hashtable_bucket objc_deleted_bucket;

uint32_t
objc_hash_string(const void *str_)
{
	const char *str = str_;

Modified src/runtime/init.m from [56c8216488] to [fe37d21ecb].

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * 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 "config.h"

#import "runtime.h"
#import "runtime-private.h"

void
__objc_exec_class(void *module_)
{
	struct objc_abi_module *module = module_;

	objc_global_mutex_lock();







|
|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * 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 "config.h"

#import "ObjFW-RT.h"
#import "private.h"

void
__objc_exec_class(void *module_)
{
	struct objc_abi_module *module = module_;

	objc_global_mutex_lock();

Modified src/runtime/lookup.m from [b142ca0e6c] to [70c618650d].

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

#include "config.h"

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

#import "runtime.h"
#import "runtime-private.h"
#import "macros.h"

@interface DummyObject
{
	Class isa;
}








|
|







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

#include "config.h"

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

#import "ObjFW-RT.h"
#import "private.h"
#import "macros.h"

@interface DummyObject
{
	Class isa;
}

Modified src/runtime/misc.m from [8f9e858d65] to [8528ad8ba5].

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

#include "config.h"

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

#include "runtime.h"
#include "runtime-private.h"

static objc_enumeration_mutation_handler enumeration_mutation_handler = NULL;

void
objc_enumerationMutation(id obj)
{
	if (enumeration_mutation_handler != NULL)







|
|







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

#include "config.h"

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

#include "ObjFW-RT.h"
#include "private.h"

static objc_enumeration_mutation_handler enumeration_mutation_handler = NULL;

void
objc_enumerationMutation(id obj)
{
	if (enumeration_mutation_handler != NULL)

Modified src/runtime/morphos-library.m from [71fd96ba85] to [9724385102].

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 "config.h"

#import "runtime.h"
#import "macros.h"

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







|







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 "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>
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	(ULONG)objc_sync_enter,
	(ULONG)objc_sync_exit,
	(ULONG)objc_getProperty,
	(ULONG)objc_setProperty,
	(ULONG)objc_getPropertyStruct,
	(ULONG)objc_setPropertyStruct,
	(ULONG)objc_enumerationMutation,
	/* Functions declared in runtime.h */
	(ULONG)sel_registerName,
	(ULONG)sel_getName,
	(ULONG)sel_isEqual,
	(ULONG)objc_allocateClassPair,
	(ULONG)objc_registerClassPair,
	(ULONG)objc_getClassList,
	(ULONG)objc_copyClassList,







|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	(ULONG)objc_sync_enter,
	(ULONG)objc_sync_exit,
	(ULONG)objc_getProperty,
	(ULONG)objc_setProperty,
	(ULONG)objc_getPropertyStruct,
	(ULONG)objc_setPropertyStruct,
	(ULONG)objc_enumerationMutation,
	/* Functions declared in ObjFW-RT.h */
	(ULONG)sel_registerName,
	(ULONG)sel_getName,
	(ULONG)sel_isEqual,
	(ULONG)objc_allocateClassPair,
	(ULONG)objc_registerClassPair,
	(ULONG)objc_getClassList,
	(ULONG)objc_copyClassList,

Added src/runtime/private.h version [69fcb5506f].















































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
51
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
107
108
109
110
111
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
 *   Jonathan Schleifer <js@heap.zone>
 *
 * 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.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * 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 "config.h"

#include "platform.h"

#if defined(__has_feature) && __has_feature(nullability)
# define OBJC_NONNULL _Nonnull
# define OBJC_NULLABLE _Nullable
#else
# define OBJC_NONNULL
# define OBJC_NULLABLE
#endif

struct objc_abi_class {
	struct objc_abi_class *OBJC_NONNULL metaclass;
	const char *OBJC_NULLABLE superclass;
	const char *OBJC_NONNULL name;
	unsigned long version;
	unsigned long info;
	long instance_size;
	void *OBJC_NULLABLE ivars;
	struct objc_abi_method_list *OBJC_NULLABLE methodlist;
	void *OBJC_NULLABLE dtable;
	void *OBJC_NULLABLE subclass_list;
	void *OBJC_NULLABLE sibling_class;
	void *OBJC_NULLABLE protocols;
	void *OBJC_NULLABLE gc_object_type;
	long abi_version;
	int32_t *OBJC_NONNULL *OBJC_NULLABLE ivar_offsets;
	void *OBJC_NULLABLE properties;
};

struct objc_abi_selector {
	const char *OBJC_NONNULL name;
	const char *OBJC_NULLABLE types;
};

struct objc_abi_method {
	struct objc_abi_selector sel;
	IMP OBJC_NONNULL imp;
};

struct objc_abi_method_list {
	struct objc_abi_method_list *OBJC_NULLABLE next;
	unsigned int count;
	struct objc_abi_method methods[1];
};

struct objc_abi_category {
	const char *OBJC_NONNULL category_name;
	const char *OBJC_NONNULL class_name;
	struct objc_abi_method_list *OBJC_NULLABLE instance_methods;
	struct objc_abi_method_list *OBJC_NULLABLE class_methods;
	struct objc_protocol_list *OBJC_NULLABLE protocols;
};

struct objc_abi_method_description {
	const char *OBJC_NONNULL name;
	const char *OBJC_NONNULL types;
};

struct objc_abi_method_description_list {
	int count;
	struct objc_abi_method_description list[1];
};

struct objc_abi_static_instances {
	const char *OBJC_NONNULL class_name;
	id OBJC_NULLABLE instances[1];
};

struct objc_abi_symtab {
	unsigned long unknown;
	struct objc_abi_selector *OBJC_NULLABLE sel_refs;
	uint16_t cls_def_cnt;
	uint16_t cat_def_cnt;
	void *OBJC_NONNULL defs[1];
};

struct objc_abi_module {
	unsigned long version;	/* 9 = non-fragile */
	unsigned long size;
	const char *OBJC_NULLABLE name;
	struct objc_abi_symtab *OBJC_NONNULL symtab;
};

struct objc_hashtable_bucket {
	const void *OBJC_NONNULL key, *OBJC_NONNULL obj;
	uint32_t hash;
};

struct objc_hashtable {
	uint32_t (*OBJC_NONNULL hash)(const void *OBJC_NONNULL key);
	bool (*OBJC_NONNULL equal)(const void *OBJC_NONNULL key1,
	    const void *OBJC_NONNULL key2);
	uint32_t count, size;
	struct objc_hashtable_bucket *OBJC_NONNULL *OBJC_NULLABLE data;
};

struct objc_sparsearray {
	struct objc_sparsearray_data {
		void *OBJC_NULLABLE next[256];
	} *OBJC_NONNULL data;
	uint8_t index_size;
};

struct objc_dtable {
	struct objc_dtable_level2 {
#ifdef OF_SELUID24
		struct objc_dtable_level3 {
			IMP OBJC_NULLABLE buckets[256];
		} *OBJC_NONNULL buckets[256];
#else
		IMP OBJC_NULLABLE buckets[256];
#endif
	} *OBJC_NONNULL buckets[256];
};

extern void objc_register_all_categories(struct objc_abi_symtab *OBJC_NONNULL);
extern struct objc_category *OBJC_NULLABLE *OBJC_NULLABLE
    objc_categories_for_class(Class OBJC_NONNULL);
extern void objc_unregister_all_categories(void);
extern void objc_initialize_class(Class OBJC_NONNULL);
extern void objc_update_dtable(Class OBJC_NONNULL);
extern void objc_register_all_classes(struct objc_abi_symtab *OBJC_NONNULL);
extern Class OBJC_NULLABLE objc_classname_to_class(const char *OBJC_NONNULL,
    bool);
extern void objc_unregister_class(Class OBJC_NONNULL);
extern void objc_unregister_all_classes(void);
extern uint32_t objc_hash_string(const void *OBJC_NONNULL);
extern bool objc_equal_string(const void *OBJC_NONNULL,
    const void *OBJC_NONNULL);
extern struct objc_hashtable *OBJC_NONNULL objc_hashtable_new(
    uint32_t (*OBJC_NONNULL)(const void *OBJC_NONNULL),
    bool (*OBJC_NONNULL)(const void *OBJC_NONNULL, const void *OBJC_NONNULL),
    uint32_t);
extern struct objc_hashtable_bucket objc_deleted_bucket;
extern void objc_hashtable_set(struct objc_hashtable *OBJC_NONNULL,
    const void *OBJC_NONNULL, const void *OBJC_NONNULL);
extern void *OBJC_NULLABLE objc_hashtable_get(
    struct objc_hashtable *OBJC_NONNULL, const void *OBJC_NONNULL);
extern void objc_hashtable_delete(struct objc_hashtable *OBJC_NONNULL,
    const void *OBJC_NONNULL);
extern void objc_hashtable_free(struct objc_hashtable *OBJC_NONNULL);
extern void objc_register_selector(struct objc_abi_selector *OBJC_NONNULL);
extern void objc_register_all_selectors(struct objc_abi_symtab *OBJC_NONNULL);
extern void objc_unregister_all_selectors(void);
extern struct objc_sparsearray *OBJC_NONNULL objc_sparsearray_new(uint8_t);
extern void *OBJC_NULLABLE objc_sparsearray_get(
    struct objc_sparsearray *OBJC_NONNULL, uintptr_t);
extern void objc_sparsearray_set(struct objc_sparsearray *OBJC_NONNULL,
    uintptr_t, void *OBJC_NULLABLE);
extern void objc_sparsearray_free(struct objc_sparsearray *OBJC_NONNULL);
extern struct objc_dtable *OBJC_NONNULL objc_dtable_new(void);
extern void objc_dtable_copy(struct objc_dtable *OBJC_NONNULL,
    struct objc_dtable *OBJC_NONNULL);
extern void objc_dtable_set(struct objc_dtable *OBJC_NONNULL, uint32_t,
    IMP OBJC_NULLABLE);
extern void objc_dtable_free(struct objc_dtable *OBJC_NONNULL);
extern void objc_dtable_cleanup(void);
extern void objc_init_static_instances(struct objc_abi_symtab *OBJC_NONNULL);
extern void objc_forget_pending_static_instances(void);
#ifdef OF_HAVE_THREADS
extern void objc_global_mutex_lock(void);
extern void objc_global_mutex_unlock(void);
extern void objc_global_mutex_free(void);
#else
# define objc_global_mutex_lock()
# define objc_global_mutex_unlock()
# define objc_global_mutex_free()
#endif

static inline IMP OBJC_NULLABLE
objc_dtable_get(const struct objc_dtable *OBJC_NONNULL dtable, uint32_t idx)
{
#ifdef OF_SELUID24
	uint8_t i = idx >> 16;
	uint8_t j = idx >>  8;
	uint8_t k = idx;

	return dtable->buckets[i]->buckets[j]->buckets[k];
#else
	uint8_t i = idx >> 8;
	uint8_t j = idx;

	return dtable->buckets[i]->buckets[j];
#endif
}

#if defined(OF_ELF)
# if defined(OF_X86_64) || defined(OF_X86) || defined(OF_POWERPC) || \
    defined(OF_ARM64) || defined(OF_ARM) || \
    defined(OF_MIPS64_N64) || defined(OF_MIPS) || \
    defined(OF_SPARC64) || defined(OF_SPARC)
#  define OF_ASM_LOOKUP
# endif
#elif defined(OF_MACH_O)
# if defined(OF_X86_64) || defined(OF_POWERPC)
#  define OF_ASM_LOOKUP
# endif
#elif defined(OF_WINDOWS)
# if defined(OF_X86_64) || defined(OF_X86)
#  define OF_ASM_LOOKUP
# endif
#endif

#define OBJC_ERROR(...)							\
	{								\
		fprintf(stderr, "[objc @ " __FILE__ ":%d] ", __LINE__);	\
		fprintf(stderr, __VA_ARGS__);				\
		fputs("\n", stderr);					\
		abort();						\
	}

#undef OBJC_NONNULL
#undef OBJC_NULLABLE

Modified src/runtime/property.m from [f610db3f7e] to [6c7c7fc677].

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

#include "config.h"

#include <string.h>

#import "runtime.h"
#import "runtime-private.h"

#import "OFObject.h"

#ifdef OF_HAVE_THREADS
# import "threading.h"
# define NUM_SPINLOCKS 8	/* needs to be a power of 2 */
# define SPINLOCK_HASH(p) ((unsigned)((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1))







|
|







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

#include "config.h"

#include <string.h>

#import "ObjFW-RT.h"
#import "private.h"

#import "OFObject.h"

#ifdef OF_HAVE_THREADS
# import "threading.h"
# define NUM_SPINLOCKS 8	/* needs to be a power of 2 */
# define SPINLOCK_HASH(p) ((unsigned)((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1))

Modified src/runtime/protocol.m from [b64c537258] to [74d4f4e6fc].

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

#include "config.h"

#include <string.h>

#import "runtime.h"
#import "runtime-private.h"

@implementation Protocol
@end

const char *
protocol_getName(Protocol *p)
{







|
|







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

#include "config.h"

#include <string.h>

#import "ObjFW-RT.h"
#import "private.h"

@implementation Protocol
@end

const char *
protocol_getName(Protocol *p)
{

Deleted src/runtime/runtime-private.h version [69fcb5506f].

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
51
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
107
108
109
110
111
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
 *   Jonathan Schleifer <js@heap.zone>
 *
 * 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.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * 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 "config.h"

#include "platform.h"

#if defined(__has_feature) && __has_feature(nullability)
# define OBJC_NONNULL _Nonnull
# define OBJC_NULLABLE _Nullable
#else
# define OBJC_NONNULL
# define OBJC_NULLABLE
#endif

struct objc_abi_class {
	struct objc_abi_class *OBJC_NONNULL metaclass;
	const char *OBJC_NULLABLE superclass;
	const char *OBJC_NONNULL name;
	unsigned long version;
	unsigned long info;
	long instance_size;
	void *OBJC_NULLABLE ivars;
	struct objc_abi_method_list *OBJC_NULLABLE methodlist;
	void *OBJC_NULLABLE dtable;
	void *OBJC_NULLABLE subclass_list;
	void *OBJC_NULLABLE sibling_class;
	void *OBJC_NULLABLE protocols;
	void *OBJC_NULLABLE gc_object_type;
	long abi_version;
	int32_t *OBJC_NONNULL *OBJC_NULLABLE ivar_offsets;
	void *OBJC_NULLABLE properties;
};

struct objc_abi_selector {
	const char *OBJC_NONNULL name;
	const char *OBJC_NULLABLE types;
};

struct objc_abi_method {
	struct objc_abi_selector sel;
	IMP OBJC_NONNULL imp;
};

struct objc_abi_method_list {
	struct objc_abi_method_list *OBJC_NULLABLE next;
	unsigned int count;
	struct objc_abi_method methods[1];
};

struct objc_abi_category {
	const char *OBJC_NONNULL category_name;
	const char *OBJC_NONNULL class_name;
	struct objc_abi_method_list *OBJC_NULLABLE instance_methods;
	struct objc_abi_method_list *OBJC_NULLABLE class_methods;
	struct objc_protocol_list *OBJC_NULLABLE protocols;
};

struct objc_abi_method_description {
	const char *OBJC_NONNULL name;
	const char *OBJC_NONNULL types;
};

struct objc_abi_method_description_list {
	int count;
	struct objc_abi_method_description list[1];
};

struct objc_abi_static_instances {
	const char *OBJC_NONNULL class_name;
	id OBJC_NULLABLE instances[1];
};

struct objc_abi_symtab {
	unsigned long unknown;
	struct objc_abi_selector *OBJC_NULLABLE sel_refs;
	uint16_t cls_def_cnt;
	uint16_t cat_def_cnt;
	void *OBJC_NONNULL defs[1];
};

struct objc_abi_module {
	unsigned long version;	/* 9 = non-fragile */
	unsigned long size;
	const char *OBJC_NULLABLE name;
	struct objc_abi_symtab *OBJC_NONNULL symtab;
};

struct objc_hashtable_bucket {
	const void *OBJC_NONNULL key, *OBJC_NONNULL obj;
	uint32_t hash;
};

struct objc_hashtable {
	uint32_t (*OBJC_NONNULL hash)(const void *OBJC_NONNULL key);
	bool (*OBJC_NONNULL equal)(const void *OBJC_NONNULL key1,
	    const void *OBJC_NONNULL key2);
	uint32_t count, size;
	struct objc_hashtable_bucket *OBJC_NONNULL *OBJC_NULLABLE data;
};

struct objc_sparsearray {
	struct objc_sparsearray_data {
		void *OBJC_NULLABLE next[256];
	} *OBJC_NONNULL data;
	uint8_t index_size;
};

struct objc_dtable {
	struct objc_dtable_level2 {
#ifdef OF_SELUID24
		struct objc_dtable_level3 {
			IMP OBJC_NULLABLE buckets[256];
		} *OBJC_NONNULL buckets[256];
#else
		IMP OBJC_NULLABLE buckets[256];
#endif
	} *OBJC_NONNULL buckets[256];
};

extern void objc_register_all_categories(struct objc_abi_symtab *OBJC_NONNULL);
extern struct objc_category *OBJC_NULLABLE *OBJC_NULLABLE
    objc_categories_for_class(Class OBJC_NONNULL);
extern void objc_unregister_all_categories(void);
extern void objc_initialize_class(Class OBJC_NONNULL);
extern void objc_update_dtable(Class OBJC_NONNULL);
extern void objc_register_all_classes(struct objc_abi_symtab *OBJC_NONNULL);
extern Class OBJC_NULLABLE objc_classname_to_class(const char *OBJC_NONNULL,
    bool);
extern void objc_unregister_class(Class OBJC_NONNULL);
extern void objc_unregister_all_classes(void);
extern uint32_t objc_hash_string(const void *OBJC_NONNULL);
extern bool objc_equal_string(const void *OBJC_NONNULL,
    const void *OBJC_NONNULL);
extern struct objc_hashtable *OBJC_NONNULL objc_hashtable_new(
    uint32_t (*OBJC_NONNULL)(const void *OBJC_NONNULL),
    bool (*OBJC_NONNULL)(const void *OBJC_NONNULL, const void *OBJC_NONNULL),
    uint32_t);
extern struct objc_hashtable_bucket objc_deleted_bucket;
extern void objc_hashtable_set(struct objc_hashtable *OBJC_NONNULL,
    const void *OBJC_NONNULL, const void *OBJC_NONNULL);
extern void *OBJC_NULLABLE objc_hashtable_get(
    struct objc_hashtable *OBJC_NONNULL, const void *OBJC_NONNULL);
extern void objc_hashtable_delete(struct objc_hashtable *OBJC_NONNULL,
    const void *OBJC_NONNULL);
extern void objc_hashtable_free(struct objc_hashtable *OBJC_NONNULL);
extern void objc_register_selector(struct objc_abi_selector *OBJC_NONNULL);
extern void objc_register_all_selectors(struct objc_abi_symtab *OBJC_NONNULL);
extern void objc_unregister_all_selectors(void);
extern struct objc_sparsearray *OBJC_NONNULL objc_sparsearray_new(uint8_t);
extern void *OBJC_NULLABLE objc_sparsearray_get(
    struct objc_sparsearray *OBJC_NONNULL, uintptr_t);
extern void objc_sparsearray_set(struct objc_sparsearray *OBJC_NONNULL,
    uintptr_t, void *OBJC_NULLABLE);
extern void objc_sparsearray_free(struct objc_sparsearray *OBJC_NONNULL);
extern struct objc_dtable *OBJC_NONNULL objc_dtable_new(void);
extern void objc_dtable_copy(struct objc_dtable *OBJC_NONNULL,
    struct objc_dtable *OBJC_NONNULL);
extern void objc_dtable_set(struct objc_dtable *OBJC_NONNULL, uint32_t,
    IMP OBJC_NULLABLE);
extern void objc_dtable_free(struct objc_dtable *OBJC_NONNULL);
extern void objc_dtable_cleanup(void);
extern void objc_init_static_instances(struct objc_abi_symtab *OBJC_NONNULL);
extern void objc_forget_pending_static_instances(void);
#ifdef OF_HAVE_THREADS
extern void objc_global_mutex_lock(void);
extern void objc_global_mutex_unlock(void);
extern void objc_global_mutex_free(void);
#else
# define objc_global_mutex_lock()
# define objc_global_mutex_unlock()
# define objc_global_mutex_free()
#endif

static inline IMP OBJC_NULLABLE
objc_dtable_get(const struct objc_dtable *OBJC_NONNULL dtable, uint32_t idx)
{
#ifdef OF_SELUID24
	uint8_t i = idx >> 16;
	uint8_t j = idx >>  8;
	uint8_t k = idx;

	return dtable->buckets[i]->buckets[j]->buckets[k];
#else
	uint8_t i = idx >> 8;
	uint8_t j = idx;

	return dtable->buckets[i]->buckets[j];
#endif
}

#if defined(OF_ELF)
# if defined(OF_X86_64) || defined(OF_X86) || defined(OF_POWERPC) || \
    defined(OF_ARM64) || defined(OF_ARM) || \
    defined(OF_MIPS64_N64) || defined(OF_MIPS) || \
    defined(OF_SPARC64) || defined(OF_SPARC)
#  define OF_ASM_LOOKUP
# endif
#elif defined(OF_MACH_O)
# if defined(OF_X86_64) || defined(OF_POWERPC)
#  define OF_ASM_LOOKUP
# endif
#elif defined(OF_WINDOWS)
# if defined(OF_X86_64) || defined(OF_X86)
#  define OF_ASM_LOOKUP
# endif
#endif

#define OBJC_ERROR(...)							\
	{								\
		fprintf(stderr, "[objc @ " __FILE__ ":%d] ", __LINE__);	\
		fprintf(stderr, __VA_ARGS__);				\
		fputs("\n", stderr);					\
		abort();						\
	}

#undef OBJC_NONNULL
#undef OBJC_NULLABLE
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































Deleted src/runtime/runtime.h version [134f947253].

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
51
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
107
108
109
110
111
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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
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
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
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
 *   Jonathan Schleifer <js@heap.zone>
 *
 * 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.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * 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.
 */

#ifndef __OBJFW_RUNTIME_H__
#define __OBJFW_RUNTIME_H__

#ifndef __STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS
#endif
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
#endif

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

#ifndef __has_feature
# define __has_feature(x) 0
#endif

#ifndef __has_attribute
# define __has_attribute(x) 0
#endif

#if __has_feature(objc_arc)
# define OBJC_UNSAFE_UNRETAINED __unsafe_unretained
#else
# define OBJC_UNSAFE_UNRETAINED
#endif

#if __has_feature(nullability)
# define OBJC_NONNULL _Nonnull
# define OBJC_NULLABLE _Nullable
#else
# define OBJC_NONNULL
# define OBJC_NULLABLE
#endif

#if __has_attribute(__objc_root_class__)
# define OBJC_ROOT_CLASS __attribute__((__objc_root_class__))
#else
# define OBJC_ROOT_CLASS
#endif

#define Nil (Class)0
#define nil (id)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 OBJC_NULLABLE (*IMP)(id OBJC_NONNULL, SEL OBJC_NONNULL, ...);
typedef void (*objc_uncaught_exception_handler)(id OBJC_NULLABLE);
typedef void (*objc_enumeration_mutation_handler)(id OBJC_NONNULL);

struct objc_class {
	Class OBJC_NONNULL isa;
	Class OBJC_NULLABLE superclass;
	const char *OBJC_NONNULL name;
	unsigned long version;
	unsigned long info;
	long instance_size;
	struct objc_ivar_list *OBJC_NULLABLE ivars;
	struct objc_method_list *OBJC_NULLABLE methodlist;
	struct objc_dtable *OBJC_NULLABLE dtable;
	Class OBJC_NONNULL *OBJC_NULLABLE subclass_list;
	void *OBJC_NULLABLE sibling_class;
	struct objc_protocol_list *OBJC_NULLABLE protocols;
	void *OBJC_NULLABLE gc_object_type;
	unsigned long abi_version;
	int32_t *OBJC_NONNULL *OBJC_NULLABLE ivar_offsets;
	struct objc_property_list *OBJC_NULLABLE properties;
};

enum objc_class_info {
	OBJC_CLASS_INFO_CLASS	    = 0x001,
	OBJC_CLASS_INFO_METACLASS   = 0x002,
	OBJC_CLASS_INFO_NEW_ABI	    = 0x010,
	OBJC_CLASS_INFO_SETUP	    = 0x100,
	OBJC_CLASS_INFO_LOADED	    = 0x200,
	OBJC_CLASS_INFO_DTABLE	    = 0x400,
	OBJC_CLASS_INFO_INITIALIZED = 0x800
};

struct objc_object {
	Class OBJC_NONNULL isa;
};

struct objc_selector {
	uintptr_t uid;
	const char *OBJC_NULLABLE types;
};

struct objc_super {
	id OBJC_UNSAFE_UNRETAINED OBJC_NULLABLE self;
	Class OBJC_NONNULL cls;
};

struct objc_method {
	struct objc_selector sel;
	IMP OBJC_NONNULL imp;
};

struct objc_method_list {
	struct objc_method_list *OBJC_NULLABLE next;
	unsigned int count;
	struct objc_method methods[1];
};

struct objc_category {
	const char *OBJC_NONNULL category_name;
	const char *OBJC_NONNULL class_name;
	struct objc_method_list *OBJC_NULLABLE instance_methods;
	struct objc_method_list *OBJC_NULLABLE class_methods;
	struct objc_protocol_list *OBJC_NULLABLE protocols;
};

struct objc_ivar {
	const char *OBJC_NONNULL name;
	const char *OBJC_NONNULL type;
	unsigned int offset;
};

struct objc_ivar_list {
	unsigned int count;
	struct objc_ivar ivars[1];
};

enum objc_property_attributes {
	OBJC_PROPERTY_READONLY	= 0x01,
	OBJC_PROPERTY_GETTER	= 0x02,
	OBJC_PROPERTY_ASSIGN	= 0x04,
	OBJC_PROPERTY_READWRITE	= 0x08,
	OBJC_PROPERTY_RETAIN	= 0x10,
	OBJC_PROPERTY_COPY	= 0x20,
	OBJC_PROPERTY_NONATOMIC	= 0x40,
	OBJC_PROPERTY_SETTER	= 0x80
};

enum objc_property_extended_attributes {
	OBJC_PROPERTY_SYNTHESIZE	=  0x1,
	OBJC_PROPERTY_DYNAMIC		=  0x2,
	OBJC_PROPERTY_PROTOCOL		=  0x3,
	OBJC_PROPERTY_ATOMIC		=  0x4,
	OBJC_PROPERTY_WEAK		=  0x8,
	OBJC_PROPERTY_STRONG		= 0x10,
	OBJC_PROPERTY_UNSAFE_UNRETAINED = 0x20
};

struct objc_property {
	const char *OBJC_NONNULL name;
	unsigned char attributes, extended_attributes;
	struct {
		const char *OBJC_NULLABLE name;
		const char *OBJC_NULLABLE type;
	} getter, setter;
};

struct objc_property_list {
	unsigned int count;
	struct objc_property_list *OBJC_NULLABLE next;
	struct objc_property properties[1];
};

#ifdef __OBJC__
OBJC_ROOT_CLASS
@interface Protocol
{
@public
#else
typedef struct {
#endif
	Class OBJC_NONNULL isa;
	const char *OBJC_NONNULL name;
	struct objc_protocol_list *OBJC_NULLABLE protocol_list;
	struct objc_abi_method_description_list *OBJC_NULLABLE instance_methods;
	struct objc_abi_method_description_list *OBJC_NULLABLE class_methods;
#ifdef __OBJC__
}
@end
#else
} Protocol;
#endif

struct objc_protocol_list {
	struct objc_protocol_list *OBJC_NULLABLE next;
	long count;
	Protocol *OBJC_UNSAFE_UNRETAINED OBJC_NONNULL list[1];
};

#ifdef __cplusplus
extern "C" {
#endif
extern SEL OBJC_NONNULL sel_registerName(const char *OBJC_NONNULL);
extern const char *OBJC_NONNULL sel_getName(SEL OBJC_NONNULL);
extern bool sel_isEqual(SEL OBJC_NONNULL, SEL OBJC_NONNULL);
extern Class OBJC_NONNULL objc_allocateClassPair(Class OBJC_NULLABLE,
    const char *OBJC_NONNULL, size_t);
extern void objc_registerClassPair(Class OBJC_NONNULL);
extern id OBJC_NULLABLE objc_lookUpClass(const char *OBJC_NONNULL);
extern id OBJC_NULLABLE objc_getClass(const char *OBJC_NONNULL);
extern id OBJC_NONNULL objc_getRequiredClass(const char *OBJC_NONNULL);
extern unsigned int objc_getClassList(Class OBJC_NONNULL *OBJC_NULLABLE,
    unsigned int);
extern Class OBJC_NONNULL *OBJC_NONNULL objc_copyClassList(
    unsigned int *OBJC_NULLABLE);
extern bool class_isMetaClass(Class OBJC_NULLABLE);
extern const char *OBJC_NONNULL class_getName(Class OBJC_NULLABLE);
extern Class OBJC_NULLABLE class_getSuperclass(Class OBJC_NULLABLE);
extern unsigned long class_getInstanceSize(Class OBJC_NULLABLE);
extern bool class_respondsToSelector(Class OBJC_NULLABLE, SEL OBJC_NONNULL);
extern bool class_conformsToProtocol(Class OBJC_NULLABLE,
    Protocol *OBJC_NONNULL);
extern IMP OBJC_NULLABLE class_getMethodImplementation(Class OBJC_NULLABLE,
    SEL OBJC_NONNULL);
extern IMP OBJC_NULLABLE class_getMethodImplementation_stret(
    Class OBJC_NULLABLE, SEL OBJC_NONNULL);
extern const char *OBJC_NULLABLE class_getMethodTypeEncoding(
    Class OBJC_NULLABLE, SEL OBJC_NONNULL);
extern bool class_addMethod(Class OBJC_NONNULL, SEL OBJC_NONNULL,
    IMP OBJC_NONNULL, const char *OBJC_NULLABLE);
extern IMP OBJC_NULLABLE class_replaceMethod(Class OBJC_NONNULL,
    SEL OBJC_NONNULL, IMP OBJC_NONNULL, const char *OBJC_NULLABLE);
extern Class OBJC_NULLABLE object_getClass(id OBJC_NULLABLE);
extern Class OBJC_NULLABLE object_setClass(id OBJC_NULLABLE,
    Class OBJC_NONNULL);
extern const char *OBJC_NONNULL object_getClassName(id OBJC_NULLABLE);
extern const char *OBJC_NONNULL protocol_getName(Protocol *OBJC_NONNULL);
extern bool protocol_isEqual(Protocol *OBJC_NONNULL, Protocol *OBJC_NONNULL);
extern bool protocol_conformsToProtocol(Protocol *OBJC_NONNULL,
    Protocol *OBJC_NONNULL);
extern void objc_exit(void);
extern OBJC_NULLABLE objc_uncaught_exception_handler
    objc_setUncaughtExceptionHandler(
    objc_uncaught_exception_handler OBJC_NULLABLE);
extern void objc_setForwardHandler(IMP OBJC_NULLABLE, IMP OBJC_NULLABLE);
extern void objc_zero_weak_references(id OBJC_NONNULL);

/*
 * Used by the compiler, but can also be called manually.
 *
 * These declarations are also required to prevent Clang's implicit
 * declarations which include __declspec(dllimport) on Windows.
 */
struct objc_abi_module;
extern void __objc_exec_class(void *OBJC_NONNULL);
extern IMP OBJC_NONNULL objc_msg_lookup(id OBJC_NULLABLE, SEL OBJC_NONNULL);
extern IMP OBJC_NONNULL objc_msg_lookup_stret(id OBJC_NULLABLE,
    SEL OBJC_NONNULL);
extern IMP OBJC_NONNULL objc_msg_lookup_super(struct objc_super *OBJC_NONNULL,
    SEL OBJC_NONNULL);
extern IMP OBJC_NONNULL objc_msg_lookup_super_stret(
    struct objc_super *OBJC_NONNULL, SEL OBJC_NONNULL);
extern void objc_exception_throw(id OBJC_NULLABLE);
extern int objc_sync_enter(id OBJC_NULLABLE);
extern int objc_sync_exit(id OBJC_NULLABLE);
extern id OBJC_NULLABLE objc_getProperty(id OBJC_NONNULL, SEL OBJC_NONNULL,
    ptrdiff_t, BOOL);
extern void objc_setProperty(id OBJC_NONNULL, SEL OBJC_NONNULL, ptrdiff_t,
    id OBJC_NULLABLE, BOOL, signed char);
extern void objc_getPropertyStruct(void *OBJC_NONNULL, const void *OBJC_NONNULL,
    ptrdiff_t, BOOL, BOOL);
extern void objc_setPropertyStruct(void *OBJC_NONNULL, const void *OBJC_NONNULL,
    ptrdiff_t, BOOL, BOOL);
extern void objc_enumerationMutation(id OBJC_NONNULL);
extern void objc_setEnumerationMutationHandler(
    objc_enumeration_mutation_handler OBJC_NULLABLE);
#ifdef __cplusplus
}
#endif

#undef OBJC_NONNULL
#undef OBJC_NULLABLE
#undef OBJC_UNSAFE_UNRETAINED
#undef OBJC_ROOT_CLASS

#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































Modified src/runtime/selector.m from [57debffc40] to [1deeb73a3c].

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#include "config.h"

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

#import "runtime.h"
#import "runtime-private.h"

#import "macros.h"

#ifdef OF_SELUID24
# define SEL_MAX 0xFFFFFF
# define SEL_SIZE 3
#else







|
|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#include "config.h"

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

#import "ObjFW-RT.h"
#import "private.h"

#import "macros.h"

#ifdef OF_SELUID24
# define SEL_MAX 0xFFFFFF
# define SEL_SIZE 3
#else

Modified src/runtime/sparsearray.m from [5adec15068] to [888b04f387].

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

#include "config.h"

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

#import "runtime.h"
#import "runtime-private.h"

struct objc_sparsearray *
objc_sparsearray_new(uint8_t index_size)
{
	struct objc_sparsearray *sparsearray;

	if ((sparsearray = calloc(1, sizeof(*sparsearray))) == NULL)







|
|







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

#include "config.h"

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

#import "ObjFW-RT.h"
#import "private.h"

struct objc_sparsearray *
objc_sparsearray_new(uint8_t index_size)
{
	struct objc_sparsearray *sparsearray;

	if ((sparsearray = calloc(1, sizeof(*sparsearray))) == NULL)

Modified src/runtime/static-instances.m from [7559b44b68] to [77813d591b].

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

#include "config.h"

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

#import "runtime.h"
#import "runtime-private.h"

static struct objc_abi_static_instances **static_instances = NULL;
static size_t static_instances_cnt = 0;

void
objc_init_static_instances(struct objc_abi_symtab *symtab)
{







|
|







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

#include "config.h"

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

#import "ObjFW-RT.h"
#import "private.h"

static struct objc_abi_static_instances **static_instances = NULL;
static size_t static_instances_cnt = 0;

void
objc_init_static_instances(struct objc_abi_symtab *symtab)
{

Modified src/runtime/synchronized.m from [5afa8ac0c0] to [c805c34225].

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

#include "config.h"

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

#import "runtime.h"
#import "runtime-private.h"

#ifdef OF_HAVE_THREADS
# import "threading.h"

static struct lock_s {
	id	      object;
	int	      count;







|
|







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

#include "config.h"

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

#import "ObjFW-RT.h"
#import "private.h"

#ifdef OF_HAVE_THREADS
# import "threading.h"

static struct lock_s {
	id	      object;
	int	      count;

Modified src/runtime/threading.m from [1fbcc9555d] to [13701244e7].

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

#include "config.h"

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

#import "runtime.h"
#import "runtime-private.h"
#import "threading.h"

static of_rmutex_t global_mutex;
static of_once_t once_control = OF_ONCE_INIT;

static void
init(void)







|
|







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

#include "config.h"

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

#import "ObjFW-RT.h"
#import "private.h"
#import "threading.h"

static of_rmutex_t global_mutex;
static of_once_t once_control = OF_ONCE_INIT;

static void
init(void)

Modified tests/OFBlockTests.m from [3e483694ef] to [b51076c2c2].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "config.h"

#import "OFBlock.h"
#import "OFString.h"
#import "OFAutoreleasePool.h"

#if defined(OF_OBJFW_RUNTIME)
# include "runtime.h"
#elif defined(OF_APPLE_RUNTIME)
# include <objc/runtime.h>
#endif

#import "TestsAppDelegate.h"

static OFString *module = @"OFBlock";







|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "config.h"

#import "OFBlock.h"
#import "OFString.h"
#import "OFAutoreleasePool.h"

#if defined(OF_OBJFW_RUNTIME)
# include "ObjFW-RT.h"
#elif defined(OF_APPLE_RUNTIME)
# include <objc/runtime.h>
#endif

#import "TestsAppDelegate.h"

static OFString *module = @"OFBlock";

Modified tests/plugin/TestPlugin.m from [591fb14b83] to [e89cd87e53].

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

#include "config.h"

#import "TestPlugin.h"

#ifdef OF_OBJFW_RUNTIME
# import "runtime-private.h"

OF_DESTRUCTOR()
{
	objc_unregister_class(objc_getClass("TestPlugin"));
}
#endif








|







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

#include "config.h"

#import "TestPlugin.h"

#ifdef OF_OBJFW_RUNTIME
# import "runtime/private.h"

OF_DESTRUCTOR()
{
	objc_unregister_class(objc_getClass("TestPlugin"));
}
#endif