ObjFW  Diff

Differences From Artifact [14e0a7d129]:

To Artifact [68b2ca804c]:


14
15
16
17
18
19
20

21
22


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







+


+
+







 * file.
 */

#include "config.h"

#define OF_APPLICATION_M

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

#include <signal.h>

#import "OFApplication.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFAutoreleasePool.h"

51
52
53
54
55
56
57

58
59
60

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







+



+







	static void						\
	handle##sig(int signal)					\
	{							\
		app->sig##Handler(app->delegate,		\
		    @selector(applicationDidReceive##sig));	\
	}
SIGNAL_HANDLER(SIGINT)
#ifndef _WIN32
SIGNAL_HANDLER(SIGHUP)
SIGNAL_HANDLER(SIGUSR1)
SIGNAL_HANDLER(SIGUSR2)
#endif
#undef SIGNAL_HANDLER

int
of_application_main(int *argc, char **argv[], Class cls)
{
	OFApplication *app = [OFApplication sharedApplication];
	id <OFApplicationDelegate> delegate = [[cls alloc] init];
256
257
258
259
260
261
262

263
264
265

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







+



+







	if (sig##Handler != (void(*)(id, SEL))[OFObject			  \
	    instanceMethodForSelector:					  \
	    @selector(applicationDidReceive##sig)])			  \
		signal(sig, handle##sig);				  \
	else								  \
		signal(sig, SIG_DFL);
	REGISTER_SIGNAL(SIGINT)
#ifndef _WIN32
	REGISTER_SIGNAL(SIGHUP)
	REGISTER_SIGNAL(SIGUSR1)
	REGISTER_SIGNAL(SIGUSR2)
#endif
#undef REGISTER_SIGNAL
}

- (void)run
{
	[delegate applicationDidFinishLaunching];
}