ObjFW  Check-in [ba01b9c18a]

Overview
Comment:Some import fixes, some static lib and win32 enhancements.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ba01b9c18a7961b2f7eaf6c1fed7b50097a97c56d743e1e738456cbd1949d322
User & Date: js on 2009-01-02 17:20:18
Other Links: manifest | tags
Context
2009-01-03
22:57
If we use -pthread(s) in CPPFLAGS, we need it in LIBS as well. check-in: 3d5b91a8c1 user: js tags: trunk
2009-01-02
17:20
Some import fixes, some static lib and win32 enhancements. check-in: ba01b9c18a user: js tags: trunk
2008-12-30
14:42
Add OFNumber. check-in: 555f28985f user: js tags: trunk
Changes

Modified TODO from [db83e9cc17] to [45e4e88464].

1
2
3



4
5
6
7
8
9
10



1
2
3
4
5
6
7
8
9
10
-
-
-
+
+
+







OFInteger

Tests for OFFile.
Serialization
Tests for OFFile.
Tests for OFNumber.

OFBase64

OFDirectory
OFDictionary
OFSortedArray
OFThread

Modified configure.ac from [9ecb996b22] to [1b0298c4c8].

8
9
10
11
12
13
14

15
16
17
18
19
20
21
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22







+







AC_PROG_OBJC
AC_PROG_CPP
AC_PROG_LN_S
AC_PROG_EGREP

CFLAGS="$CFLAGS -Wall"
OBJCFLAGS="$OBJCFLAGS -Wall -fobjc-exceptions"
LIBS="$LIBS -lobjc"

AC_DEFINE(OF_CONFIG_H, 1, [Define so that we know we got our config.h])

BUILDSYS_LIB
AC_C_BIGENDIAN([AC_DEFINE(OF_BIG_ENDIAN, 1, [Whether we are big endian])])

AC_MSG_CHECKING(for SIZE_MAX)
63
64
65
66
67
68
69
70

71
72
73
74
75
76
77
78
79
64
65
66
67
68
69
70

71


72
73
74
75
76
77
78







-
+
-
-







AC_MSG_RESULT($ac_cv_snprintf_useful_ret)

test x"$have_asprintf" != x"yes" -a x"$ac_cv_snprintf_useful_ret" != x"yes" && \
	AC_MSG_ERROR(No asprintf and no snprintf returning required space!)

ACX_PTHREAD

AC_CHECK_LIB(ws2_32, main,
AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32")
	AC_SUBST(WS2_LIBS, "-lws2_32"),
	AC_SUBST(WS2_LIBS, ""))

AC_MSG_CHECKING(whether we have IPv6 support)
AC_CACHE_VAL(ac_cv_have_ipv6, [
	AC_TRY_RUN([
		#include <stdlib.h>
		#include <string.h>

Modified src/Makefile from [17df7c65b5] to [93c6a4bf93].

25
26
27
28
29
30
31
32
25
26
27
28
29
30
31








-
include ../buildsys.mk

CPPFLAGS += -I.. ${PTHREAD_CFLAGS}
CFLAGS += ${LIB_CFLAGS}
OBJCFLAGS += ${LIB_CFLAGS}
LD = ${OBJC}
LDFLAGS += ${LIB_LDFLAGS} ${PTHREAD_LIBS}
LIBS += -lobjc ${WS2_LIBS}

Modified src/OFNumber.h from [2b396a780c] to [204398f67a].

1
2
3
4
5
6
7
8
9
10


11
12
13
14
15
16
17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19










+
+







/*
 * Copyright (c) 2008
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of libobjfw. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import <unistd.h>

#import "OFObject.h"

enum of_number_type {
	OF_NUMBER_CHAR,
	OF_NUMBER_SHORT,
	OF_NUMBER_INT,

Modified src/OFString.h from [23e156a28f] to [b76c2c6c58].

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20












+







/*
 * Copyright (c) 2008
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of libobjfw. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import <stdarg.h>
#import <stdio.h>

#import "OFObject.h"

/**
 * A class for storing and modifying strings.
 */
@interface OFString: OFObject

Modified src/OFString.m from [8055b56c32] to [781415eae9].

23
24
25
26
27
28
29




30
31
32
33
34
35
36
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40







+
+
+
+







#else
#define madvise(addr, len, advise)
#endif

#import "OFString.h"
#import "OFExceptions.h"
#import "OFMacros.h"

#ifndef HAVE_ASPRINTF
#import "asprintf.h"
#endif

static OF_INLINE int
check_utf8(const char *str, size_t len)
{
	size_t i;
	BOOL utf8;

Modified src/OFTCPSocket.h from [4f744ac404] to [e56061d926].

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
44
45
46
47
48
49
50





51
52
53
54
55
56
57







-
-
-
-
-







#else
	SOCKET	  sock;
#endif
	struct	  sockaddr *saddr;
	socklen_t saddr_len;
}

/**
 * This needs to be called before any socket can be used.
 */
+ (void)startup;

/**
 * Initializes an already allocated OFTCPSocket.
 *
 * \return An initialized OFTCPSocket
 */
- init;

Modified src/OFTCPSocket.m from [546d4d81ab] to [180713756a].

21
22
23
24
25
26
27

28

29
30
31
32
33
34
35
36

37
38
39
40
41
42
43
21
22
23
24
25
26
27
28

29
30

31
32
33
34

35
36
37
38
39
40
41
42
43







+
-
+

-




-

+







#import "OFExceptions.h"

#ifndef INVALID_SOCKET
#define INVALID_SOCKET -1
#endif

@implementation OFTCPSocket
#ifdef _WIN32
+ (void)startup
+ (void)initialize
{
#ifdef _WIN32
	WSADATA wsa;

	if (WSAStartup(MAKEWORD(2, 0), &wsa))
		@throw [OFInitializationFailedException newWithClass: self];
#endif
}
#endif

- init
{
	if ((self = [super init])) {
		sock = INVALID_SOCKET;
		saddr = NULL;
		saddr_len = 0;

Modified tests/OFArray/Makefile from [9d0d3e29e5] to [8179431a8e].

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15







-
+







PROG_NOINST = ofarray${PROG_SUFFIX}
SRCS = OFArray.m

include ../../buildsys.mk
include ../../extra.mk

CPPFLAGS += -I../../src -I../..
LIBS += -L../../src -lobjfw -lobjc
LIBS := -L../../src -lobjfw ${LIBS}

.PHONY: run

all: run
run: ${PROG_NOINST}
	rm -f libobjfw.so.1 libobjfw.so.1.0 libobjfw.dylib
	ln -s ../../src/libobjfw.so libobjfw.so.1

Modified tests/OFHashes/Makefile from [9220a25abe] to [60ece43bc8].

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15







-
+







PROG_NOINST = ofhashes${PROG_SUFFIX}
SRCS = OFHashes.m

include ../../buildsys.mk
include ../../extra.mk

CPPFLAGS += -I../../src -I../..
LIBS += -L../../src -lobjfw -lobjc
LIBS := -L../../src -lobjfw ${LIBS}

.PHONY: run

all: run
run: ${PROG_NOINST}
	rm -f libobjfw.so.1 libobjfw.so.1.0 libobjfw.dylib
	ln -s ../../src/libobjfw.so libobjfw.so.1

Modified tests/OFList/Makefile from [699fd931fb] to [e24afc3ccb].

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15







-
+







PROG_NOINST = oflist${PROG_SUFFIX}
SRCS = OFList.m

include ../../buildsys.mk
include ../../extra.mk

CPPFLAGS += -I../../src -I../..
LIBS += -L../../src -lobjfw -lobjc
LIBS := -L../../src -lobjfw ${LIBS}

.PHONY: run

all: run
run: ${PROG_NOINST}
	rm -f libobjfw.so.1 libobjfw.so.1.0 libobjfw.dylib
	ln -s ../../src/libobjfw.so libobjfw.so.1

Modified tests/OFList/OFList.m from [c9c2390a0d] to [5e467fc100].

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













-




+
+







/*
 * Copyright (c) 2008
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of libobjfw. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import "config.h"

#import <stdio.h>
#import <string.h>

#import "OFString.h"
#import "OFList.h"

#import <stdio.h>

#ifndef _WIN32
#define ZD "%zd"
#else
#define ZD "%u"
#endif

Modified tests/OFObject/Makefile from [c00fe56bc9] to [6338061b26].

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15







-
+







PROG_NOINST = ofobject${PROG_SUFFIX}
SRCS = OFObject.m

include ../../buildsys.mk
include ../../extra.mk

CPPFLAGS += -I../../src -I../..
LIBS += -L../../src -lobjfw -lobjc
LIBS := -L../../src -lobjfw ${LIBS}

.PHONY: run

all: run
run: ${PROG_NOINST}
	rm -f libobjfw.so.1 libobjfw.so.1.0 libobjfw.dylib
	ln -s ../../src/libobjfw.so libobjfw.so.1

Modified tests/OFString/Makefile from [d0e6d2aca0] to [115a002220].

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15







-
+







PROG_NOINST = ofstring${PROG_SUFFIX}
SRCS = OFString.m

include ../../buildsys.mk
include ../../extra.mk

CPPFLAGS += -I../../src -I../..
LIBS += -L../../src -lobjfw -lobjc
LIBS := -L../../src -lobjfw ${LIBS}

.PHONY: run

all: run
run: ${PROG_NOINST}
	rm -f libobjfw.so.1 libobjfw.so.1.0 libobjfw.dylib
	ln -s ../../src/libobjfw.so libobjfw.so.1

Modified tests/OFString/OFString.m from [22509a4b2b] to [d3cc87a9de].

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













-




+
+







/*
 * Copyright (c) 2008
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of libobjfw. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import "config.h"

#import <stdio.h>
#import <string.h>

#import "OFString.h"
#import "OFExceptions.h"

#import <stdio.h>

#ifndef _WIN32
#define ZD "%zd"
#else
#define ZD "%u"
#endif

Modified tests/OFTCPSocket/Makefile from [85095214db] to [c7c55f66ff].

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15







-
+







PROG_NOINST = oftcpsocket${PROG_SUFFIX}
SRCS = OFTCPSocket.m

include ../../buildsys.mk
include ../../extra.mk

CPPFLAGS += -I../../src -I../..
LIBS += -L../../src -lobjfw -lobjc ${WS2_LIBS}
LIBS := -L../../src -lobjfw ${LIBS}

.PHONY: run

all: run
run: ${PROG_NOINST}
	rm -f libobjfw.so.1 libobjfw.so.1.0 libobjfw.dylib
	ln -s ../../src/libobjfw.so libobjfw.so.1

Modified tests/OFTCPSocket/OFTCPSocket.m from [896d312291] to [9a6a7a9089].

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
34
35
36
37
38
39
40


41
42
43
44
45
46
47







-
-







main()
{
	uint16_t port;

	srand(time(NULL));

	@try {
		[OFTCPSocket startup];

		OFTCPSocket *server = [OFTCPSocket new];
		OFTCPSocket *client = [OFTCPSocket new];
		OFTCPSocket *accepted;
		char buf[7];

		puts("== IPv4 ==");
		port = get_port();

Modified tests/OFXMLFactory/Makefile from [1e404a9a41] to [0eb2293fb3].

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15







-
+







PROG_NOINST = ofxmlfactory${PROG_SUFFIX}
SRCS = OFXMLFactory.m

include ../../buildsys.mk
include ../../extra.mk

CPPFLAGS += -I../../src -I../..
LIBS += -L../../src -lobjfw -lobjc
LIBS := -L../../src -lobjfw ${LIBS}

.PHONY: run

all: run
run: ${PROG_NOINST}
	rm -f libobjfw.so.1 libobjfw.so.1.0 libobjfw.dylib
	ln -s ../../src/libobjfw.so libobjfw.so.1