ObjFW  Changes On Branch c8a5922af2c10bf2

Changes In Branch 0.6 Through [c8a5922af2] Excluding Merge-Ins

This is equivalent to a diff from 83ad0894c0 to c8a5922af2

2012-02-25
11:24
Always define __STDC_{CONSTANT,LIMIT}_MACROS before libc includes.
This is necessary for ObjC++.
check-in: 99ed50a5e4 user: js tags: 0.6
2012-02-24
20:38
Don't use OF_INLINE where the function contains a @try block.
Doing so does not work if exceptions are SJLJ.
check-in: c8a5922af2 user: js tags: 0.6
2012-02-21
19:59
Don't try to use SIG{HUP,USR1,USR2} on Windows. check-in: cf4be9e865 user: js tags: 0.6
2012-02-20
22:40
Set version to 0.7-dev in default branch. check-in: 584a8dccec user: js tags: trunk
22:38
Create branch for 0.6. check-in: 01ca5677b9 user: js tags: 0.6
2012-02-17
21:15
Create a branch for a bridge to Foundation, integrated into ObjFW. check-in: 7746f5f864 user: js tags: bridge
17:13
Make it possible to handle common signals in OFApplicationDelegate. check-in: 83ad0894c0 user: js tags: trunk
16:25
Fix a very bad typo in OFStreamObserver_poll. check-in: e9b0575094 user: js tags: trunk

Modified Info.plist from [3303e89e51] to [03babfdb24].

13
14
15
16
17
18
19
20
21
22
23
24
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundlePackageType</key>
	<string>FMWK</string>
	<key>CFBundleSignature</key>
	<string>OBJFW</string>
	<key>CFBundleVersion</key>
	<string>0.6-dev</string>
	<key>CFBundleShortVersionString</key>
	<string>0.6-dev</string>
</dict>
</plist>







|

|


13
14
15
16
17
18
19
20
21
22
23
24
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundlePackageType</key>
	<string>FMWK</string>
	<key>CFBundleSignature</key>
	<string>OBJFW</string>
	<key>CFBundleVersion</key>
	<string>0.6</string>
	<key>CFBundleShortVersionString</key>
	<string>0.6</string>
</dict>
</plist>

Modified configure.ac from [8cb5bd7e2a] to [9c0fb75b7f].

1
2
3
4
5
6
7
8
AC_INIT(ObjFW, 0.6-dev, js@webkeks.org)
AC_CONFIG_SRCDIR(src)

AS_IF([test x"$host" = x"psp"], [
	OBJCFLAGS="-G0 $OBJCFLAGS"
	LIBS="$LIBS -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc"
	LIBS="$LIBS -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver"
	LIBS="$LIBS -lpsputility -lpspuser -lpspkernel"
|







1
2
3
4
5
6
7
8
AC_INIT(ObjFW, 0.6, js@webkeks.org)
AC_CONFIG_SRCDIR(src)

AS_IF([test x"$host" = x"psp"], [
	OBJCFLAGS="-G0 $OBJCFLAGS"
	LIBS="$LIBS -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc"
	LIBS="$LIBS -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver"
	LIBS="$LIBS -lpsputility -lpspuser -lpspkernel"

Modified src/OFApplication.h from [1bcf3be869] to [1aa58a5990].

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
 * \warning You are not allowed to send any messages inside this method, as
 *	    message dispatching is not signal-safe! You are only allowed to do
 *	    signal-safe operations like setting a variable or calling a
 *	    signal-safe function!
 */
- (void)applicationDidReceiveSIGINT;


/**
 * \brief A method which is called when the application received a SIGHUP.


 *
 * \warning You are not allowed to send any messages inside this method, as
 *	    message dispatching is not signal-safe! You are only allowed to do
 *	    signal-safe operations like setting a variable or calling a
 *	    signal-safe function!
 */
- (void)applicationDidReceiveSIGHUP;

/**
 * \brief A method which is called when the application received a SIGUSR1.


 *
 * \warning You are not allowed to send any messages inside this method, as
 *	    message dispatching is not signal-safe! You are only allowed to do
 *	    signal-safe operations like setting a variable or calling a
 *	    signal-safe function!
 */
- (void)applicationDidReceiveSIGUSR1;

/**
 * \brief A method which is called when the application received a SIGUSR2.


 *
 * \warning You are not allowed to send any messages inside this method, as
 *	    message dispatching is not signal-safe! You are only allowed to do
 *	    signal-safe operations like setting a variable or calling a
 *	    signal-safe function!
 */
- (void)applicationDidReceiveSIGUSR2;

@end

/**
 * \brief Represents the application as an object.
 */
@interface OFApplication: OFObject
{
	OFString *programName;
	OFMutableArray *arguments;
	OFMutableDictionary *environment;
	int *argc;
	char ***argv;
@public
	id <OFApplicationDelegate> delegate;
	void (*SIGINTHandler)(id, SEL);

	void (*SIGHUPHandler)(id, SEL);
	void (*SIGUSR1Handler)(id, SEL);
	void (*SIGUSR2Handler)(id, SEL);

}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, assign) OFString *programName;
@property (readonly, assign) OFArray *arguments;
@property (readonly, assign) OFDictionary *environment;
@property (assign) id <OFApplicationDelegate> delegate;







>


>
>










>
>










>
>







>















>



>







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
 * \warning You are not allowed to send any messages inside this method, as
 *	    message dispatching is not signal-safe! You are only allowed to do
 *	    signal-safe operations like setting a variable or calling a
 *	    signal-safe function!
 */
- (void)applicationDidReceiveSIGINT;

#ifndef _WIN32
/**
 * \brief A method which is called when the application received a SIGHUP.
 *
 * This signal is not available on Windows.
 *
 * \warning You are not allowed to send any messages inside this method, as
 *	    message dispatching is not signal-safe! You are only allowed to do
 *	    signal-safe operations like setting a variable or calling a
 *	    signal-safe function!
 */
- (void)applicationDidReceiveSIGHUP;

/**
 * \brief A method which is called when the application received a SIGUSR1.
 *
 * This signal is not available on Windows.
 *
 * \warning You are not allowed to send any messages inside this method, as
 *	    message dispatching is not signal-safe! You are only allowed to do
 *	    signal-safe operations like setting a variable or calling a
 *	    signal-safe function!
 */
- (void)applicationDidReceiveSIGUSR1;

/**
 * \brief A method which is called when the application received a SIGUSR2.
 *
 * This signal is not available on Windows.
 *
 * \warning You are not allowed to send any messages inside this method, as
 *	    message dispatching is not signal-safe! You are only allowed to do
 *	    signal-safe operations like setting a variable or calling a
 *	    signal-safe function!
 */
- (void)applicationDidReceiveSIGUSR2;
#endif
@end

/**
 * \brief Represents the application as an object.
 */
@interface OFApplication: OFObject
{
	OFString *programName;
	OFMutableArray *arguments;
	OFMutableDictionary *environment;
	int *argc;
	char ***argv;
@public
	id <OFApplicationDelegate> delegate;
	void (*SIGINTHandler)(id, SEL);
#ifndef _WIN32
	void (*SIGHUPHandler)(id, SEL);
	void (*SIGUSR1Handler)(id, SEL);
	void (*SIGUSR2Handler)(id, SEL);
#endif
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, assign) OFString *programName;
@property (readonly, assign) OFArray *arguments;
@property (readonly, assign) OFDictionary *environment;
@property (assign) id <OFApplicationDelegate> delegate;

Modified src/OFApplication.m from [14e0a7d129] to [4213526325].

16
17
18
19
20
21
22


23
24
25
26
27
28
29

#include "config.h"

#define OF_APPLICATION_M

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



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








>
>







16
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>

#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
	static void						\
	handle##sig(int signal)					\
	{							\
		app->sig##Handler(app->delegate,		\
		    @selector(applicationDidReceive##sig));	\
	}
SIGNAL_HANDLER(SIGINT)

SIGNAL_HANDLER(SIGHUP)
SIGNAL_HANDLER(SIGUSR1)
SIGNAL_HANDLER(SIGUSR2)

#undef SIGNAL_HANDLER

int
of_application_main(int *argc, char **argv[], Class cls)
{
	OFApplication *app = [OFApplication sharedApplication];
	id <OFApplicationDelegate> delegate = [[cls alloc] init];







>



>







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];
256
257
258
259
260
261
262

263
264
265

266
267
268
269
270
271
272
	if (sig##Handler != (void(*)(id, SEL))[OFObject			  \
	    instanceMethodForSelector:					  \
	    @selector(applicationDidReceive##sig)])			  \
		signal(sig, handle##sig);				  \
	else								  \
		signal(sig, SIG_DFL);
	REGISTER_SIGNAL(SIGINT)

	REGISTER_SIGNAL(SIGHUP)
	REGISTER_SIGNAL(SIGUSR1)
	REGISTER_SIGNAL(SIGUSR2)

#undef REGISTER_SIGNAL
}

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







>



>







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

Modified src/OFString+JSONValue.m from [887f63d0ca] to [9190d7a166].

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
		old = *pointer;

		skipWhitespaces(pointer, stop);
		skipComment(pointer, stop);
	}
}

static OF_INLINE uint16_t
parseUnicodeEscape(const char *pointer, const char *stop)
{
	uint16_t ret = 0;
	char i;

	if (pointer + 5 >= stop)
		return 0xFFFF;







|







92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
		old = *pointer;

		skipWhitespaces(pointer, stop);
		skipComment(pointer, stop);
	}
}

static inline uint16_t
parseUnicodeEscape(const char *pointer, const char *stop)
{
	uint16_t ret = 0;
	char i;

	if (pointer + 5 >= stop)
		return 0xFFFF;
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
		else
			return 0xFFFF;
	}

	return ret;
}

static OF_INLINE OFString*
parseString(const char *restrict *pointer, const char *stop)
{
	char *buffer;
	size_t i = 0;

	if (++(*pointer) + 1 >= stop)
		return nil;







|







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
		else
			return 0xFFFF;
	}

	return ret;
}

static inline OFString*
parseString(const char *restrict *pointer, const char *stop)
{
	char *buffer;
	size_t i = 0;

	if (++(*pointer) + 1 >= stop)
		return nil;
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
		}
	}

	free(buffer);
	return nil;
}

static OF_INLINE OFMutableArray*
parseArray(const char *restrict *pointer, const char *stop)
{
	OFMutableArray *array = [OFMutableArray array];

	if (++(*pointer) >= stop)
		return nil;








|







255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
		}
	}

	free(buffer);
	return nil;
}

static inline OFMutableArray*
parseArray(const char *restrict *pointer, const char *stop)
{
	OFMutableArray *array = [OFMutableArray array];

	if (++(*pointer) >= stop)
		return nil;

297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
	}

	(*pointer)++;

	return array;
}

static OF_INLINE OFMutableDictionary*
parseDictionary(const char *restrict *pointer, const char *stop)
{
	OFMutableDictionary *dictionary = [OFMutableDictionary dictionary];

	if (++(*pointer) >= stop)
		return nil;








|







297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
	}

	(*pointer)++;

	return array;
}

static inline OFMutableDictionary*
parseDictionary(const char *restrict *pointer, const char *stop)
{
	OFMutableDictionary *dictionary = [OFMutableDictionary dictionary];

	if (++(*pointer) >= stop)
		return nil;

349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
	}

	(*pointer)++;

	return dictionary;
}

static OF_INLINE OFNumber*
parseNumber(const char *restrict *pointer, const char *stop)
{
	BOOL hasDecimal = NO;
	size_t i;
	OFString *string;
	OFNumber *number;








|







349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
	}

	(*pointer)++;

	return dictionary;
}

static inline OFNumber*
parseNumber(const char *restrict *pointer, const char *stop)
{
	BOOL hasDecimal = NO;
	size_t i;
	OFString *string;
	OFNumber *number;

Modified utils/objfw-config.in from [d7871a7cf4] to [a869d05900].

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
LDFLAGS_REEXPORT="@LDFLAGS_REEXPORT@"
LDFLAGS_RPATH="@LDFLAGS_RPATH@"
LIBS="-L${libdir} -lobjfw @LIBS@"
PLUGIN_CFLAGS="@PLUGIN_CFLAGS@"
PLUGIN_LDFLAGS="@PLUGIN_LDFLAGS@"
PLUGIN_SUFFIX="@PLUGIN_SUFFIX@"
PROG_SUFFIX="@EXEEXT@"
VERSION="0.6-dev"

show_help() {
	cat <<__EOF__
objfw-config: Available arguments are:

	--all		Outputs all flags + libs
	--cflags	Outputs the required CFLAGS







|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
LDFLAGS_REEXPORT="@LDFLAGS_REEXPORT@"
LDFLAGS_RPATH="@LDFLAGS_RPATH@"
LIBS="-L${libdir} -lobjfw @LIBS@"
PLUGIN_CFLAGS="@PLUGIN_CFLAGS@"
PLUGIN_LDFLAGS="@PLUGIN_LDFLAGS@"
PLUGIN_SUFFIX="@PLUGIN_SUFFIX@"
PROG_SUFFIX="@EXEEXT@"
VERSION="0.6"

show_help() {
	cat <<__EOF__
objfw-config: Available arguments are:

	--all		Outputs all flags + libs
	--cflags	Outputs the required CFLAGS