ObjFW  Check-in [a0a1f62df4]

Overview
Comment:Generate externs for the Amiga library glue
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a0a1f62df4dfe1d732c841154be5217e6f15988dc32f33caa6f4ef5888d09da5
User & Date: js on 2020-12-29 23:01:02
Other Links: manifest | tags
Context
2020-12-29
23:17
Generate the Amiga library function array check-in: 5b2b743aa1 user: js tags: trunk
23:01
Generate externs for the Amiga library glue check-in: a0a1f62df4 user: js tags: trunk
22:42
Update buildsys check-in: b8ff7d6e0e user: js tags: trunk
Changes

Modified generators/library/GlueGenerator.h from [c982e6064d] to [2457b5cd4c].

19
20
21
22
23
24
25
26
27
28
29
30

31
32

#import "OFStream.h"
#import "OFXMLElement.h"

@interface GlueGenerator: OFObject
{
	OFXMLElement *_library;
	OFStream *_outputStream;
}

- (instancetype)initWithLibrary: (OFXMLElement *)library
		   outputStream: (OFStream *)outputStream;

- (void)generate;
@end







|



|
>


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

#import "OFStream.h"
#import "OFXMLElement.h"

@interface GlueGenerator: OFObject
{
	OFXMLElement *_library;
	OFStream *_header, *_impl;
}

- (instancetype)initWithLibrary: (OFXMLElement *)library
			 header: (OFStream *)header
		 implementation: (OFStream *)implementation;
- (void)generate;
@end

Modified generators/library/GlueGenerator.m from [a45c4e65ce] to [be3132a03b].

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
#import "OFInvalidFormatException.h"
#import "OFUnsupportedVersionException.h"

#import "copyright.h"

@implementation GlueGenerator
- (instancetype)initWithLibrary: (OFXMLElement *)library
		   outputStream: (OFStream *)outputStream

{
	self = [super init];

	@try {
		OFXMLAttribute *version;

		if (![library.name isEqual: @"amiga-library"] ||
		    library.namespace != nil)
			@throw [OFInvalidFormatException exception];

		if ((version = [library attributeForName: @"version"]) == nil)
			@throw [OFInvalidFormatException exception];

		if (![version.stringValue isEqual: @"1.0"])
			@throw [OFUnsupportedVersionException
			    exceptionWithVersion: version.stringValue];

		_library = [library retain];

		_outputStream = [outputStream retain];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[_library release];

	[_outputStream release];

	[super dealloc];
}

- (void)generate
{

	[_outputStream writeString: COPYRIGHT];





	[_outputStream writeString:
	    @"/* This file is automatically generated from library.xml */\n"
	    @"\n"
	    @"#include \"config.h\"\n"


	    @"\n"];

	for (OFXMLElement *include in [_library elementsForName: @"include"])
		[_outputStream writeFormat: @"#import \"%@\"\n",
					    include.stringValue];

	[_outputStream writeString:
	    @"\n"
	    @"#ifdef OF_AMIGAOS_M68K\n"
	    @"# define PPC_PARAMS(...) (void)\n"
	    @"# define M68K_ARG(type, name, reg)\t\t\\\n"
	    @"\tregister type reg##name __asm__(#reg);\t\\\n"
	    @"\ttype name = reg##name;\n"
	    @"#else\n"
	    @"# define PPC_PARAMS(...) (__VA_ARGS__)\n"
	    @"# define M68K_ARG(...)\n"
	    @"#endif\n"
	    @"\n"

	    @"#ifdef OF_MORPHOS\n"
	    @"/* All __saveds functions in this file need to use the SysV "
	    @"ABI */\n"
	    @"__asm__ (\n"
	    @"    \".section .text\\n\"\n"
	    @"    \".align 2\\n\"\n"
	    @"    \"__restore_r13:\\n\"\n"







|
>


















>
|











>
|






>
|
>
>
>
>
>
|



>
>



|
<

|










|
>







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
#import "OFInvalidFormatException.h"
#import "OFUnsupportedVersionException.h"

#import "copyright.h"

@implementation GlueGenerator
- (instancetype)initWithLibrary: (OFXMLElement *)library
			 header: (OFStream *)header
		 implementation: (OFStream *)impl
{
	self = [super init];

	@try {
		OFXMLAttribute *version;

		if (![library.name isEqual: @"amiga-library"] ||
		    library.namespace != nil)
			@throw [OFInvalidFormatException exception];

		if ((version = [library attributeForName: @"version"]) == nil)
			@throw [OFInvalidFormatException exception];

		if (![version.stringValue isEqual: @"1.0"])
			@throw [OFUnsupportedVersionException
			    exceptionWithVersion: version.stringValue];

		_library = [library retain];
		_header = [header retain];
		_impl = [impl retain];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[_library release];
	[_header release];
	[_impl release];

	[super dealloc];
}

- (void)generate
{
	[_header writeString: COPYRIGHT];
	[_impl writeString: COPYRIGHT];

	[_header writeString:
	    @"/* This file is automatically generated from library.xml */\n"
	    @"\n"];

	[_impl writeString:
	    @"/* This file is automatically generated from library.xml */\n"
	    @"\n"
	    @"#include \"config.h\"\n"
	    @"\n"
	    @"#import \"amiga-glue.h\"\n"
	    @"\n"];

	for (OFXMLElement *include in [_library elementsForName: @"include"])
		[_header writeFormat: @"#import \"%@\"\n", include.stringValue];


	[_header writeString:
	    @"\n"
	    @"#ifdef OF_AMIGAOS_M68K\n"
	    @"# define PPC_PARAMS(...) (void)\n"
	    @"# define M68K_ARG(type, name, reg)\t\t\\\n"
	    @"\tregister type reg##name __asm__(#reg);\t\\\n"
	    @"\ttype name = reg##name;\n"
	    @"#else\n"
	    @"# define PPC_PARAMS(...) (__VA_ARGS__)\n"
	    @"# define M68K_ARG(...)\n"
	    @"#endif\n"
	    @"\n"];
	[_impl writeString:
	    @"#ifdef OF_MORPHOS\n"
	    @"/* All __saveds functions in this file need to use the SysV "
	    @"ABI */\n"
	    @"__asm__ (\n"
	    @"    \".section .text\\n\"\n"
	    @"    \".align 2\\n\"\n"
	    @"    \"__restore_r13:\\n\"\n"
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
		OFArray OF_GENERIC(OFXMLElement *) *arguments =
		    [function elementsForName: @"argument"];
		size_t argumentIndex;

		if (returnType == nil)
			returnType = @"void";







		[_outputStream writeFormat: @"\n"
					    @"%@ __saveds\n"
					    @"glue_%@",
					    returnType, name];

		if (arguments.count > 0)

			[_outputStream writeString: @" PPC_PARAMS("];
		else

			[_outputStream writeString: @"(void"];


		argumentIndex = 0;
		for (OFXMLElement *argument in arguments) {
			OFString *argName =
			    [argument attributeForName: @"name"].stringValue;
			OFString *argType =
			    [argument attributeForName: @"type"].stringValue;

			if (argumentIndex++ > 0)

				[_outputStream writeString: @", "];



			[_outputStream writeString: argType];
			if (![argType hasSuffix: @"*"])

				[_outputStream writeString: @" "];


			[_outputStream writeString: argName];
		}



		[_outputStream writeString: @")\n{\n"];
		for (OFXMLElement *argument in arguments) {
			OFString *argName =
			    [argument attributeForName: @"name"].stringValue;
			OFString *argType =
			    [argument attributeForName: @"type"].stringValue;
			OFString *m68kReg = [argument
			    attributeForName: @"m68k-reg"].stringValue;

			[_outputStream writeFormat: @"\tM68K_ARG(%@, %@, %@)\n",
						    argType, argName, m68kReg];
		}

		if (arguments.count > 0)
			[_outputStream writeString: @"\n"];

		if (![returnType isEqual: @"void"])
			[_outputStream writeString: @"\treturn "];
		else
			[_outputStream writeString: @"\t"];

		[_outputStream writeFormat: @"%@(", name];

		argumentIndex = 0;
		for (OFXMLElement *argument in arguments) {
			OFString *argName =
			    [argument attributeForName: @"name"].stringValue;

			if (argumentIndex++ > 0)
				[_outputStream writeString: @", "];

			[_outputStream writeString: argName];
		}

		[_outputStream writeString: @");\n}\n"];
	}
}
@end







>
>
>
>
>
>
|




|
>
|
|
>
|
>








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


>
>
|








|




|


|

|

|







|

|


|



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
		OFArray OF_GENERIC(OFXMLElement *) *arguments =
		    [function elementsForName: @"argument"];
		size_t argumentIndex;

		if (returnType == nil)
			returnType = @"void";

		[_header writeFormat:
		    @"extern %@%@glue_%@",
		    returnType,
		    (![returnType hasSuffix: @"*"] ? @" " : @""),
		    name];

		[_impl writeFormat: @"\n"
					    @"%@ __saveds\n"
					    @"glue_%@",
					    returnType, name];

		if (arguments.count > 0) {
			[_header writeString: @" PPC_PARAMS("];
			[_impl writeString: @" PPC_PARAMS("];
		} else {
			[_header writeString: @"(void"];
			[_impl writeString: @"(void"];
		}

		argumentIndex = 0;
		for (OFXMLElement *argument in arguments) {
			OFString *argName =
			    [argument attributeForName: @"name"].stringValue;
			OFString *argType =
			    [argument attributeForName: @"type"].stringValue;

			if (argumentIndex++ > 0) {
				[_header writeString: @", "];
				[_impl writeString: @", "];
			}

			[_header writeString: argType];
			[_impl writeString: argType];
			if (![argType hasSuffix: @"*"]) {
				[_header writeString: @" "];
				[_impl writeString: @" "];
			}
			[_header writeString: argName];
			[_impl writeString: argName];
		}

		[_header writeString: @");\n"];

		[_impl writeString: @")\n{\n"];
		for (OFXMLElement *argument in arguments) {
			OFString *argName =
			    [argument attributeForName: @"name"].stringValue;
			OFString *argType =
			    [argument attributeForName: @"type"].stringValue;
			OFString *m68kReg = [argument
			    attributeForName: @"m68k-reg"].stringValue;

			[_impl writeFormat: @"\tM68K_ARG(%@, %@, %@)\n",
						    argType, argName, m68kReg];
		}

		if (arguments.count > 0)
			[_impl writeString: @"\n"];

		if (![returnType isEqual: @"void"])
			[_impl writeString: @"\treturn "];
		else
			[_impl writeString: @"\t"];

		[_impl writeFormat: @"%@(", name];

		argumentIndex = 0;
		for (OFXMLElement *argument in arguments) {
			OFString *argName =
			    [argument attributeForName: @"name"].stringValue;

			if (argumentIndex++ > 0)
				[_impl writeString: @", "];

			[_impl writeString: argName];
		}

		[_impl writeString: @");\n}\n"];
	}
}
@end

Modified generators/library/LibraryGenerator.m from [891a3f630d] to [1d9456d07f].

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
{
	OFURL *sourcesURL = [[OFFileManager defaultManager].currentDirectoryURL
	    URLByAppendingPathComponent: @"../../src"];
	OFURL *runtimeLibraryURL = [sourcesURL
	    URLByAppendingPathComponent: @"runtime/library.xml"];
	OFURL *runtimeLinkLibURL = [sourcesURL
	    URLByAppendingPathComponent: @"runtime/linklib/linklib.m"];


	OFURL *runtimeGlueURL = [sourcesURL
	    URLByAppendingPathComponent: @"runtime/amiga-glue.m"];
	OFXMLElement *runtimeLibrary = [OFXMLElement elementWithStream:
	    [OFFile fileWithURL: runtimeLibraryURL
			   mode: @"r"]];
	OFFile *runtimeLinkLib = [OFFile fileWithURL: runtimeLinkLibURL
						mode: @"w"];


	OFFile *runtimeGlue = [OFFile fileWithURL: runtimeGlueURL
					     mode: @"w"];
	LinkLibGenerator *runtimeLinkLibGenerator = [[[LinkLibGenerator alloc]
	    initWithLibrary: runtimeLibrary
	       outputStream: runtimeLinkLib] autorelease];
	GlueGenerator *runtimeGlueGenerator = [[[GlueGenerator alloc]
	    initWithLibrary: runtimeLibrary

	       outputStream: runtimeGlue] autorelease];

	[runtimeLinkLibGenerator generate];
	[runtimeGlueGenerator generate];

	[OFApplication terminate];
}
@end







>
>







>
>




|


>
|







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
{
	OFURL *sourcesURL = [[OFFileManager defaultManager].currentDirectoryURL
	    URLByAppendingPathComponent: @"../../src"];
	OFURL *runtimeLibraryURL = [sourcesURL
	    URLByAppendingPathComponent: @"runtime/library.xml"];
	OFURL *runtimeLinkLibURL = [sourcesURL
	    URLByAppendingPathComponent: @"runtime/linklib/linklib.m"];
	OFURL *runtimeGlueHeaderURL = [sourcesURL
	    URLByAppendingPathComponent: @"runtime/amiga-glue.h"];
	OFURL *runtimeGlueURL = [sourcesURL
	    URLByAppendingPathComponent: @"runtime/amiga-glue.m"];
	OFXMLElement *runtimeLibrary = [OFXMLElement elementWithStream:
	    [OFFile fileWithURL: runtimeLibraryURL
			   mode: @"r"]];
	OFFile *runtimeLinkLib = [OFFile fileWithURL: runtimeLinkLibURL
						mode: @"w"];
	OFFile *runtimeGlueHeader = [OFFile fileWithURL: runtimeGlueHeaderURL
						   mode: @"w"];
	OFFile *runtimeGlue = [OFFile fileWithURL: runtimeGlueURL
					     mode: @"w"];
	LinkLibGenerator *runtimeLinkLibGenerator = [[[LinkLibGenerator alloc]
	    initWithLibrary: runtimeLibrary
	     implementation: runtimeLinkLib] autorelease];
	GlueGenerator *runtimeGlueGenerator = [[[GlueGenerator alloc]
	    initWithLibrary: runtimeLibrary
		     header: runtimeGlueHeader
	     implementation: runtimeGlue] autorelease];

	[runtimeLinkLibGenerator generate];
	[runtimeGlueGenerator generate];

	[OFApplication terminate];
}
@end

Modified generators/library/LinkLibGenerator.h from [1ad010b630] to [e8b227f852].

18
19
20
21
22
23
24
25
26
27
28
29
30
31
#import "OFObject.h"
#import "OFStream.h"
#import "OFXMLElement.h"

@interface LinkLibGenerator: OFObject
{
	OFXMLElement *_library;
	OFStream *_outputStream;
}

- (instancetype)initWithLibrary: (OFXMLElement *)library
		   outputStream: (OFStream *)outputStream;
- (void)generate;
@end







|



|


18
19
20
21
22
23
24
25
26
27
28
29
30
31
#import "OFObject.h"
#import "OFStream.h"
#import "OFXMLElement.h"

@interface LinkLibGenerator: OFObject
{
	OFXMLElement *_library;
	OFStream *_impl;
}

- (instancetype)initWithLibrary: (OFXMLElement *)library
		 implementation: (OFStream *)impl;
- (void)generate;
@end

Modified generators/library/LinkLibGenerator.m from [e43125cde8] to [8a29b3ee03].

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
#import "OFInvalidFormatException.h"
#import "OFUnsupportedVersionException.h"

#import "copyright.h"

@implementation LinkLibGenerator
- (instancetype)initWithLibrary: (OFXMLElement *)library
		   outputStream: (OFStream *)outputStream
{
	self = [super init];

	@try {
		OFXMLAttribute *version;

		if (![library.name isEqual: @"amiga-library"] ||
		    library.namespace != nil)
			@throw [OFInvalidFormatException exception];

		if ((version = [library attributeForName: @"version"]) == nil)
			@throw [OFInvalidFormatException exception];

		if (![version.stringValue isEqual: @"1.0"])
			@throw [OFUnsupportedVersionException
			    exceptionWithVersion: version.stringValue];

		_library = [library retain];
		_outputStream = [outputStream retain];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[_library release];
	[_outputStream release];

	[super dealloc];
}

- (void)generate
{
	OFString *libBase = [_library attributeForName: @"base"].stringValue;
	OFArray OF_GENERIC(OFXMLElement *) *functions;
	size_t funcIndex = 0;

	[_outputStream writeString: COPYRIGHT];
	[_outputStream writeString:
	    @"/* This file is automatically generated from library.xml */\n"
	    @"\n"
	    @"#include \"config.h\"\n"
	    @"\n"];

	for (OFXMLElement *include in [_library elementsForName: @"include"])
		[_outputStream writeFormat: @"#import \"%@\"\n",
					    include.stringValue];

	[_outputStream writeFormat: @"\n"
				    @"extern struct Library *%@;\n"
				    @"\n",
				    libBase];

	functions = [_library elementsForName: @"function"];
	for (OFXMLElement *function in functions) {
		OFString *name =
		    [function attributeForName: @"name"].stringValue;
		OFString *returnType =
		    [function attributeForName: @"return-type"].stringValue;
		OFArray OF_GENERIC(OFXMLElement *) *arguments =
		    [function elementsForName: @"argument"];
		size_t argumentIndex;

		if (returnType == nil)
			returnType = @"void";

		[_outputStream writeFormat: @"%@\n%@(", returnType, name];

		argumentIndex = 0;
		for (OFXMLElement *argument in
		    [function elementsForName: @"argument"]) {
			OFString *argName =
			    [argument attributeForName: @"name"].stringValue;
			OFString *argType =
			    [argument attributeForName: @"type"].stringValue;

			if (argumentIndex++ > 0)
				[_outputStream writeString: @", "];

			[_outputStream writeString: argType];
			if (![argType hasSuffix: @"*"])
				[_outputStream writeString: @" "];
			[_outputStream writeString: argName];
		}

		[_outputStream writeFormat:
		    @")\n"
		    @"{\n"
		    @"#if defined(OF_AMIGAOS_M68K)\n"
		    @"\tregister struct Library *a6 __asm__(\"a6\") = %@;\n"
		    @"\t(void)a6;\n"
		    @"\t", libBase];

		if (![returnType isEqual: @"void"])
			[_outputStream writeString: @"return "];

		[_outputStream writeString: @"(("];
		[_outputStream writeString: returnType];
		if (![returnType hasSuffix: @"*"])
			[_outputStream writeString: @" "];
		[_outputStream writeString: @"(*)("];

		argumentIndex = 0;
		for (OFXMLElement *argument in arguments) {
			OFString *argType =
			    [argument attributeForName: @"type"].stringValue;
			OFString *m68kReg = [argument
			    attributeForName: @"m68k-reg"].stringValue;

			if (argumentIndex++ > 0)
				[_outputStream writeString: @", "];

			[_outputStream writeString: argType];
			if (![argType hasSuffix: @"*"])
				[_outputStream writeString: @" "];
			[_outputStream writeFormat: @"__asm__(\"%@\")",
						    m68kReg];
		}

		[_outputStream writeFormat: @"))(((uintptr_t)%@) - %zu))(",
					    libBase, 30 + funcIndex * 6];

		argumentIndex = 0;
		for (OFXMLElement *argument in
		    [function elementsForName: @"argument"]) {
			OFString *argName =
			    [argument attributeForName: @"name"].stringValue;

			if (argumentIndex++ > 0)
				[_outputStream writeString: @", "];

			[_outputStream writeString: argName];
		}

		[_outputStream writeFormat:
		    @");\n"
		    @"#elif defined(OF_MORPHOS)\n"
		    @"\t__asm__ __volatile__ (\n"
		    @"\t    \"mr\t\t%%%%r12, %%0\"\n"
		    @"\t    :: \"r\"(%@) : \"r12\"\n"
		    @"\t);\n"
		    @"\n"
		    @"\t",
		    libBase, libBase];

		if (![returnType isEqual: @"void"])
			[_outputStream writeString: @"return "];

		[_outputStream writeString: @"__extension__ (("];
		[_outputStream writeString: returnType];
		if (![returnType hasSuffix: @"*"])
			[_outputStream writeString: @" "];
		[_outputStream writeString: @"(*)("];

		argumentIndex = 0;
		for (OFXMLElement *argument in arguments) {
			OFString *argType =
			    [argument attributeForName: @"type"].stringValue;

			if (argumentIndex++ > 0)
				[_outputStream writeString: @", "];

			[_outputStream writeString: argType];
		}

		[_outputStream writeFormat:
		    @"))*(void **)(((uintptr_t)%@) - %zu))(",
		    libBase, 28 + funcIndex * 6];

		argumentIndex = 0;
		for (OFXMLElement *argument in
		    [function elementsForName: @"argument"]) {
			OFString *argName =
			    [argument attributeForName: @"name"].stringValue;

			if (argumentIndex++ > 0)
				[_outputStream writeString: @", "];

			[_outputStream writeString: argName];
		}

		[_outputStream writeString: @");\n"
					    @"#endif\n"];

		if ([function attributeForName: @"noreturn"] != nil)
			[_outputStream writeString: @"\n\tOF_UNREACHABLE\n"];

		[_outputStream writeString: @"}\n"];

		if (++funcIndex < functions.count)
			[_outputStream writeString: @"\n"];
	}
}
@end







|


















|











|










|
|






|


|

















|










|

|

|
|


|








|

|
|

|
|









|

|

|
|



|









|

|


|
<










|

|
|

|
|







|

|


<
|









|

|


|



|

|


|



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
#import "OFInvalidFormatException.h"
#import "OFUnsupportedVersionException.h"

#import "copyright.h"

@implementation LinkLibGenerator
- (instancetype)initWithLibrary: (OFXMLElement *)library
		 implementation: (OFStream *)impl
{
	self = [super init];

	@try {
		OFXMLAttribute *version;

		if (![library.name isEqual: @"amiga-library"] ||
		    library.namespace != nil)
			@throw [OFInvalidFormatException exception];

		if ((version = [library attributeForName: @"version"]) == nil)
			@throw [OFInvalidFormatException exception];

		if (![version.stringValue isEqual: @"1.0"])
			@throw [OFUnsupportedVersionException
			    exceptionWithVersion: version.stringValue];

		_library = [library retain];
		_impl = [impl retain];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[_library release];
	[_impl release];

	[super dealloc];
}

- (void)generate
{
	OFString *libBase = [_library attributeForName: @"base"].stringValue;
	OFArray OF_GENERIC(OFXMLElement *) *functions;
	size_t funcIndex = 0;

	[_impl writeString: COPYRIGHT];
	[_impl writeString:
	    @"/* This file is automatically generated from library.xml */\n"
	    @"\n"
	    @"#include \"config.h\"\n"
	    @"\n"];

	for (OFXMLElement *include in [_library elementsForName: @"include"])
		[_impl writeFormat: @"#import \"%@\"\n",
					    include.stringValue];

	[_impl writeFormat: @"\n"
				    @"extern struct Library *%@;\n"
				    @"\n",
				    libBase];

	functions = [_library elementsForName: @"function"];
	for (OFXMLElement *function in functions) {
		OFString *name =
		    [function attributeForName: @"name"].stringValue;
		OFString *returnType =
		    [function attributeForName: @"return-type"].stringValue;
		OFArray OF_GENERIC(OFXMLElement *) *arguments =
		    [function elementsForName: @"argument"];
		size_t argumentIndex;

		if (returnType == nil)
			returnType = @"void";

		[_impl writeFormat: @"%@\n%@(", returnType, name];

		argumentIndex = 0;
		for (OFXMLElement *argument in
		    [function elementsForName: @"argument"]) {
			OFString *argName =
			    [argument attributeForName: @"name"].stringValue;
			OFString *argType =
			    [argument attributeForName: @"type"].stringValue;

			if (argumentIndex++ > 0)
				[_impl writeString: @", "];

			[_impl writeString: argType];
			if (![argType hasSuffix: @"*"])
				[_impl writeString: @" "];
			[_impl writeString: argName];
		}

		[_impl writeFormat:
		    @")\n"
		    @"{\n"
		    @"#if defined(OF_AMIGAOS_M68K)\n"
		    @"\tregister struct Library *a6 __asm__(\"a6\") = %@;\n"
		    @"\t(void)a6;\n"
		    @"\t", libBase];

		if (![returnType isEqual: @"void"])
			[_impl writeString: @"return "];

		[_impl writeString: @"(("];
		[_impl writeString: returnType];
		if (![returnType hasSuffix: @"*"])
			[_impl writeString: @" "];
		[_impl writeString: @"(*)("];

		argumentIndex = 0;
		for (OFXMLElement *argument in arguments) {
			OFString *argType =
			    [argument attributeForName: @"type"].stringValue;
			OFString *m68kReg = [argument
			    attributeForName: @"m68k-reg"].stringValue;

			if (argumentIndex++ > 0)
				[_impl writeString: @", "];

			[_impl writeString: argType];
			if (![argType hasSuffix: @"*"])
				[_impl writeString: @" "];
			[_impl writeFormat: @"__asm__(\"%@\")",
						    m68kReg];
		}

		[_impl writeFormat: @"))(((uintptr_t)%@) - %zu))(",
					    libBase, 30 + funcIndex * 6];

		argumentIndex = 0;
		for (OFXMLElement *argument in
		    [function elementsForName: @"argument"]) {
			OFString *argName =
			    [argument attributeForName: @"name"].stringValue;

			if (argumentIndex++ > 0)
				[_impl writeString: @", "];

			[_impl writeString: argName];
		}

		[_impl writeFormat: @");\n"

		    @"#elif defined(OF_MORPHOS)\n"
		    @"\t__asm__ __volatile__ (\n"
		    @"\t    \"mr\t\t%%%%r12, %%0\"\n"
		    @"\t    :: \"r\"(%@) : \"r12\"\n"
		    @"\t);\n"
		    @"\n"
		    @"\t",
		    libBase, libBase];

		if (![returnType isEqual: @"void"])
			[_impl writeString: @"return "];

		[_impl writeString: @"__extension__ (("];
		[_impl writeString: returnType];
		if (![returnType hasSuffix: @"*"])
			[_impl writeString: @" "];
		[_impl writeString: @"(*)("];

		argumentIndex = 0;
		for (OFXMLElement *argument in arguments) {
			OFString *argType =
			    [argument attributeForName: @"type"].stringValue;

			if (argumentIndex++ > 0)
				[_impl writeString: @", "];

			[_impl writeString: argType];
		}


		[_impl writeFormat: @"))*(void **)(((uintptr_t)%@) - %zu))(",
		    libBase, 28 + funcIndex * 6];

		argumentIndex = 0;
		for (OFXMLElement *argument in
		    [function elementsForName: @"argument"]) {
			OFString *argName =
			    [argument attributeForName: @"name"].stringValue;

			if (argumentIndex++ > 0)
				[_impl writeString: @", "];

			[_impl writeString: argName];
		}

		[_impl writeString: @");\n"
					    @"#endif\n"];

		if ([function attributeForName: @"noreturn"] != nil)
			[_impl writeString: @"\n\tOF_UNREACHABLE\n"];

		[_impl writeString: @"}\n"];

		if (++funcIndex < functions.count)
			[_impl writeString: @"\n"];
	}
}
@end

Added src/runtime/amiga-glue.h version [fa91e5dca5].



















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
 *               2018, 2019, 2020
 *   Jonathan Schleifer <js@nil.im>
 *
 * 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.
 */

/* This file is automatically generated from library.xml */

#import "ObjFWRT.h"
#import "private.h"

#ifdef OF_AMIGAOS_M68K
# define PPC_PARAMS(...) (void)
# define M68K_ARG(type, name, reg)		\
	register type reg##name __asm__(#reg);	\
	type name = reg##name;
#else
# define PPC_PARAMS(...) (__VA_ARGS__)
# define M68K_ARG(...)
#endif

extern bool glue_objc_init PPC_PARAMS(unsigned int version, struct objc_libc *libc);
extern void glue___objc_exec_class PPC_PARAMS(struct objc_module *_Nonnull module);
extern IMP _Nonnull glue_objc_msg_lookup PPC_PARAMS(id _Nullable object, SEL _Nonnull selector);
extern IMP _Nonnull glue_objc_msg_lookup_stret PPC_PARAMS(id _Nullable object, SEL _Nonnull selector);
extern IMP _Nonnull glue_objc_msg_lookup_super PPC_PARAMS(struct objc_super *_Nonnull super, SEL _Nonnull selector);
extern IMP _Nonnull glue_objc_msg_lookup_super_stret PPC_PARAMS(struct objc_super *_Nonnull super, SEL _Nonnull selector);
extern Class _Nullable glue_objc_lookUpClass PPC_PARAMS(const char *_Nonnull name);
extern Class _Nullable glue_objc_getClass PPC_PARAMS(const char *_Nonnull name);
extern Class _Nonnull glue_objc_getRequiredClass PPC_PARAMS(const char *_Nonnull name);
extern Class _Nullable glue_objc_lookup_class PPC_PARAMS(const char *_Nonnull name);
extern Class _Nonnull glue_objc_get_class PPC_PARAMS(const char *_Nonnull name);
extern void glue_objc_exception_throw PPC_PARAMS(id _Nonnull object);
extern int glue_objc_sync_enter PPC_PARAMS(id _Nullable object);
extern int glue_objc_sync_exit PPC_PARAMS(id _Nullable object);
extern id _Nullable glue_objc_getProperty PPC_PARAMS(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, bool atomic);
extern void glue_objc_setProperty PPC_PARAMS(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, id _Nullable value, bool atomic, signed char copy);
extern void glue_objc_getPropertyStruct PPC_PARAMS(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong);
extern void glue_objc_setPropertyStruct PPC_PARAMS(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong);
extern void glue_objc_enumerationMutation PPC_PARAMS(id _Nonnull object);
extern int glue___gnu_objc_personality PPC_PARAMS(int version, int actions, uint64_t *_Nonnull exClass, void *_Nonnull ex, void *_Nonnull ctx);
extern id _Nullable glue_objc_retain PPC_PARAMS(id _Nullable object);
extern id _Nullable glue_objc_retainBlock PPC_PARAMS(id _Nullable block);
extern id _Nullable glue_objc_retainAutorelease PPC_PARAMS(id _Nullable object);
extern void glue_objc_release PPC_PARAMS(id _Nullable object);
extern id _Nullable glue_objc_autorelease PPC_PARAMS(id _Nullable object);
extern id _Nullable glue_objc_autoreleaseReturnValue PPC_PARAMS(id _Nullable object);
extern id _Nullable glue_objc_retainAutoreleaseReturnValue PPC_PARAMS(id _Nullable object);
extern id _Nullable glue_objc_retainAutoreleasedReturnValue PPC_PARAMS(id _Nullable object);
extern id _Nullable glue_objc_storeStrong PPC_PARAMS(id _Nullable *_Nonnull object, id _Nullable value);
extern id _Nullable glue_objc_storeWeak PPC_PARAMS(id _Nullable *_Nonnull object, id _Nullable value);
extern id _Nullable glue_objc_loadWeakRetained PPC_PARAMS(id _Nullable *_Nonnull object);
extern id _Nullable glue_objc_initWeak PPC_PARAMS(id _Nullable *_Nonnull object, id _Nullable value);
extern void glue_objc_destroyWeak PPC_PARAMS(id _Nullable *_Nonnull object);
extern id _Nullable glue_objc_loadWeak PPC_PARAMS(id _Nullable *_Nonnull object);
extern void glue_objc_copyWeak PPC_PARAMS(id _Nullable *_Nonnull dest, id _Nullable *_Nonnull src);
extern void glue_objc_moveWeak PPC_PARAMS(id _Nullable *_Nonnull dest, id _Nullable *_Nonnull src);
extern SEL _Nonnull glue_sel_registerName PPC_PARAMS(const char *_Nonnull name);
extern const char *_Nonnull glue_sel_getName PPC_PARAMS(SEL _Nonnull selector);
extern bool glue_sel_isEqual PPC_PARAMS(SEL _Nonnull selector1, SEL _Nonnull selector2);
extern Class _Nonnull glue_objc_allocateClassPair PPC_PARAMS(Class _Nullable superclass, const char *_Nonnull name, size_t extraBytes);
extern void glue_objc_registerClassPair PPC_PARAMS(Class _Nonnull class);
extern unsigned int glue_objc_getClassList PPC_PARAMS(Class _Nonnull *_Nullable buffer, unsigned int count);
extern Class _Nonnull *_Nonnull glue_objc_copyClassList PPC_PARAMS(unsigned int *_Nullable length);
extern bool glue_class_isMetaClass PPC_PARAMS(Class _Nullable class);
extern const char *_Nullable glue_class_getName PPC_PARAMS(Class _Nullable class);
extern Class _Nullable glue_class_getSuperclass PPC_PARAMS(Class _Nullable class);
extern unsigned long glue_class_getInstanceSize PPC_PARAMS(Class _Nullable class);
extern bool glue_class_respondsToSelector PPC_PARAMS(Class _Nullable class, SEL _Nonnull selector);
extern bool glue_class_conformsToProtocol PPC_PARAMS(Class _Nullable class, Protocol *_Nonnull p);
extern IMP _Nullable glue_class_getMethodImplementation PPC_PARAMS(Class _Nullable class, SEL _Nonnull selector);
extern IMP _Nullable glue_class_getMethodImplementation_stret PPC_PARAMS(Class _Nullable class, SEL _Nonnull selector);
extern Method _Nullable glue_class_getInstanceMethod PPC_PARAMS(Class _Nullable class, SEL _Nonnull selector);
extern bool glue_class_addMethod PPC_PARAMS(Class _Nonnull class, SEL _Nonnull selector, IMP _Nonnull implementation, const char *_Nullable typeEncoding);
extern IMP _Nullable glue_class_replaceMethod PPC_PARAMS(Class _Nonnull class, SEL _Nonnull selector, IMP _Nonnull implementation, const char *_Nullable typeEncoding);
extern Class _Nullable glue_object_getClass PPC_PARAMS(id _Nullable object);
extern Class _Nullable glue_object_setClass PPC_PARAMS(id _Nullable object, Class _Nonnull class);
extern const char *_Nullable glue_object_getClassName PPC_PARAMS(id _Nullable object);
extern const char *_Nonnull glue_protocol_getName PPC_PARAMS(Protocol *_Nonnull protocol);
extern bool glue_protocol_isEqual PPC_PARAMS(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2);
extern bool glue_protocol_conformsToProtocol PPC_PARAMS(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2);
extern _Nullable objc_uncaught_exception_handler_t glue_objc_setUncaughtExceptionHandler PPC_PARAMS(objc_uncaught_exception_handler_t _Nullable handler);
extern void glue_objc_setForwardHandler PPC_PARAMS(IMP _Nullable forward, IMP _Nullable stretForward);
extern void glue_objc_setEnumerationMutationHandler PPC_PARAMS(objc_enumeration_mutation_handler_t _Nullable hadler);
extern id _Nullable glue_objc_constructInstance PPC_PARAMS(Class _Nullable class, void *_Nullable bytes);
extern void glue_objc_exit(void);
extern Ivar _Nullable *_Nullable glue_class_copyIvarList PPC_PARAMS(Class _Nullable class, unsigned int *_Nullable outCount);
extern const char *_Nonnull glue_ivar_getName PPC_PARAMS(Ivar _Nonnull ivar);
extern const char *_Nonnull glue_ivar_getTypeEncoding PPC_PARAMS(Ivar _Nonnull ivar);
extern ptrdiff_t glue_ivar_getOffset PPC_PARAMS(Ivar _Nonnull ivar);
extern Method _Nullable *_Nullable glue_class_copyMethodList PPC_PARAMS(Class _Nullable class, unsigned int *_Nullable outCount);
extern SEL _Nonnull glue_method_getName PPC_PARAMS(Method _Nonnull method);
extern const char *_Nullable glue_method_getTypeEncoding PPC_PARAMS(Method _Nonnull method);
extern objc_property_t _Nullable *_Nullable glue_class_copyPropertyList PPC_PARAMS(Class _Nullable class, unsigned int *_Nullable outCount);
extern const char *_Nonnull glue_property_getName PPC_PARAMS(objc_property_t _Nonnull property);
extern char *_Nullable glue_property_copyAttributeValue PPC_PARAMS(objc_property_t _Nonnull property, const char *_Nonnull name);
extern void *_Nullable glue_objc_destructInstance PPC_PARAMS(id _Nullable object);
extern void *_Null_unspecified glue_objc_autoreleasePoolPush(void);
extern void glue_objc_autoreleasePoolPop PPC_PARAMS(void *_Null_unspecified pool);
extern id _Nullable glue__objc_rootAutorelease PPC_PARAMS(id _Nullable object);
extern struct objc_hashtable *_Nonnull glue_objc_hashtable_new PPC_PARAMS(objc_hashtable_hash_func hash, objc_hashtable_equal_func equal, uint32_t size);
extern void glue_objc_hashtable_set PPC_PARAMS(struct objc_hashtable *_Nonnull table, const void *_Nonnull key, const void *_Nonnull object);
extern void *_Nullable glue_objc_hashtable_get PPC_PARAMS(struct objc_hashtable *_Nonnull table, const void *_Nonnull key);
extern void glue_objc_hashtable_delete PPC_PARAMS(struct objc_hashtable *_Nonnull table, const void *_Nonnull key);
extern void glue_objc_hashtable_free PPC_PARAMS(struct objc_hashtable *_Nonnull table);
extern void glue_objc_setTaggedPointerSecret PPC_PARAMS(uintptr_t secret);
extern int glue_objc_registerTaggedPointerClass PPC_PARAMS(Class _Nonnull class);
extern bool glue_object_isTaggedPointer PPC_PARAMS(id _Nullable object);
extern uintptr_t glue_object_getTaggedPointerValue PPC_PARAMS(id _Nonnull object);
extern id _Nullable glue_objc_createTaggedPointer PPC_PARAMS(int class, uintptr_t value);

Modified src/runtime/amiga-glue.m from [5e933555c5] to [46067aa42b].

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
 * file.
 */

/* This file is automatically generated from library.xml */

#include "config.h"

#import "ObjFWRT.h"
#import "private.h"

#ifdef OF_AMIGAOS_M68K
# define PPC_PARAMS(...) (void)
# define M68K_ARG(type, name, reg)		\
	register type reg##name __asm__(#reg);	\
	type name = reg##name;
#else
# define PPC_PARAMS(...) (__VA_ARGS__)
# define M68K_ARG(...)
#endif

#ifdef OF_MORPHOS
/* All __saveds functions in this file need to use the SysV ABI */
__asm__ (
    ".section .text\n"
    ".align 2\n"
    "__restore_r13:\n"







|
<
<
<
<
<
<
<
<
<
<
<







15
16
17
18
19
20
21
22











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

/* This file is automatically generated from library.xml */

#include "config.h"

#import "amiga-glue.h"












#ifdef OF_MORPHOS
/* All __saveds functions in this file need to use the SysV ABI */
__asm__ (
    ".section .text\n"
    ".align 2\n"
    "__restore_r13:\n"

Modified src/runtime/amiga-library.m from [359a58f2d8] to [564f1475a5].

15
16
17
18
19
20
21


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

#include "config.h"

#import "ObjFWRT.h"
#import "private.h"



#include <exec/libraries.h>
#include <exec/nodes.h>
#include <exec/resident.h>
#include <proto/exec.h>

#define CONCAT_VERSION2(major, minor) #major "." #minor







>
>







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

#include "config.h"

#import "ObjFWRT.h"
#import "private.h"

#import "amiga-glue.h"

#include <exec/libraries.h>
#include <exec/nodes.h>
#include <exec/resident.h>
#include <proto/exec.h>

#define CONCAT_VERSION2(major, minor) #major "." #minor
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

#ifdef OF_AMIGAOS_M68K
extern uintptr_t __CTOR_LIST__[];
extern const void *_EH_FRAME_BEGINS__;
extern void *_EH_FRAME_OBJECTS__;
#endif

extern bool glue_objc_init(void);
extern void glue___objc_exec_class(void);
extern IMP glue_objc_msg_lookup(void);
extern IMP glue_objc_msg_lookup_stret(void);
extern IMP glue_objc_msg_lookup_super(void);
extern IMP glue_objc_msg_lookup_super_stret(void);
extern Class glue_objc_lookUpClass(void);
extern Class glue_objc_getClass(void);
extern Class glue_objc_getRequiredClass(void);
extern Class glue_objc_lookup_class(void);
extern Class glue_objc_get_class(void);
extern void glue_objc_exception_throw(void);
extern int glue_objc_sync_enter(void);
extern int glue_objc_sync_exit(void);
extern id glue_objc_getProperty(void);
extern void glue_objc_setProperty(void);
extern void glue_objc_getPropertyStruct(void);
extern void glue_objc_setPropertyStruct(void);
extern void glue_objc_enumerationMutation(void);
extern int glue___gnu_objc_personality(void);
extern id glue_objc_retain(void);
extern id glue_objc_retainBlock(void);
extern id glue_objc_retainAutorelease(void);
extern void glue_objc_release(void);
extern id glue_objc_autorelease(void);
extern id glue_objc_autoreleaseReturnValue(void);
extern id glue_objc_retainAutoreleaseReturnValue(void);
extern id glue_objc_retainAutoreleasedReturnValue(void);
extern id glue_objc_storeStrong(void);
extern id glue_objc_storeWeak(void);
extern id glue_objc_loadWeakRetained(void);
extern id glue_objc_initWeak(void);
extern void glue_objc_destroyWeak(void);
extern id glue_objc_loadWeak(void);
extern void glue_objc_copyWeak(void);
extern void glue_objc_moveWeak(void);
extern SEL glue_sel_registerName(void);
extern const char *glue_sel_getName(void);
extern bool glue_sel_isEqual(void);
extern Class glue_objc_allocateClassPair(void);
extern void glue_objc_registerClassPair(void);
extern unsigned int glue_objc_getClassList(void);
extern Class *glue_objc_copyClassList(void);
extern bool glue_class_isMetaClass(void);
extern const char *glue_class_getName(void);
extern Class glue_class_getSuperclass(void);
extern unsigned long glue_class_getInstanceSize(void);
extern bool glue_class_respondsToSelector(void);
extern bool glue_class_conformsToProtocol(void);
extern IMP glue_class_getMethodImplementation(void);
extern IMP glue_class_getMethodImplementation_stret(void);
extern Method glue_class_getInstanceMethod(void);
extern bool glue_class_addMethod(void);
extern IMP glue_class_replaceMethod(void);
extern Class glue_object_getClass(void);
extern Class glue_object_setClass(void);
extern const char *glue_object_getClassName(void);
extern const char *glue_protocol_getName(void);
extern bool glue_protocol_isEqual(void);
extern bool glue_protocol_conformsToProtocol(void);
extern objc_uncaught_exception_handler_t
    glue_objc_setUncaughtExceptionHandler(void);
extern void glue_objc_setForwardHandler(void);
extern void glue_objc_setEnumerationMutationHandler(void);
extern id glue_objc_constructInstance(void);
extern void glue_objc_exit(void);
extern Ivar *glue_class_copyIvarList(void);
extern const char *glue_ivar_getName(void);
extern const char *glue_ivar_getTypeEncoding(void);
extern ptrdiff_t glue_ivar_getOffset(void);
extern Method *glue_class_copyMethodList(void);
extern SEL glue_method_getName(void);
extern const char *glue_method_getTypeEncoding(void);
extern objc_property_t *glue_class_copyPropertyList(void);
extern const char *glue_property_getName(void);
extern char *glue_property_copyAttributeValue(void);
extern void *glue_objc_destructInstance(void);
extern void *glue_objc_autoreleasePoolPush(void);
extern void glue_objc_autoreleasePoolPop(void);
extern id glue__objc_rootAutorelease(void);
extern struct objc_hashtable *glue_objc_hashtable_new(void);
extern void glue_objc_hashtable_set(void);
extern void *glue_objc_hashtable_get(void);
extern void glue_objc_hashtable_delete(void);
extern void glue_objc_hashtable_free(void);
extern void glue_objc_setTaggedPointerSecret(void);
extern int glue_objc_registerTaggedPointerClass(void);
extern bool glue_object_isTaggedPointer(void);
extern uintptr_t glue_object_getTaggedPointerValue(void);
extern id glue_objc_createTaggedPointer(void);

#ifdef OF_MORPHOS
const ULONG __abox__ = 1;
#endif
struct ExecBase *SysBase;
struct objc_libc libc;

#if defined(OF_AMIGAOS_M68K)







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







67
68
69
70
71
72
73



























































































74
75
76
77
78
79
80

#ifdef OF_AMIGAOS_M68K
extern uintptr_t __CTOR_LIST__[];
extern const void *_EH_FRAME_BEGINS__;
extern void *_EH_FRAME_OBJECTS__;
#endif




























































































#ifdef OF_MORPHOS
const ULONG __abox__ = 1;
#endif
struct ExecBase *SysBase;
struct objc_libc libc;

#if defined(OF_AMIGAOS_M68K)