ObjFW  Diff

Differences From Artifact [771a8d1673]:

To Artifact [4213526325]:


17
18
19
20
21
22
23
24
25

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


24

25
26
27
28
29
30
31







-
-
+
-







#include "config.h"

#define OF_APPLICATION_M

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

#ifndef _WIN32
# include <signal.h>
#include <signal.h>
#endif

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

55
56
57
58
59
60
61

62
63
64

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







+



+







	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];
260
261
262
263
264
265
266

267
268
269

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







+



+







	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];
}