ObjFW  Check-in [f8b652cc27]

Overview
Comment:Add objfw.h which includes everything.
Only importing what you really need is preferred, though.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f8b652cc278b9fec478b3f0708fe9978c6f064ac701951008d2d8dbc18ba8828
User & Date: js on 2009-06-01 20:36:25
Other Links: manifest | tags
Context
2009-06-02
17:21
Take care of the root metaclass's super being the root class. check-in: 4c343b7841 user: js tags: trunk
2009-06-01
20:36
Add objfw.h which includes everything.
Only importing what you really need is preferred, though.
check-in: f8b652cc27 user: js tags: trunk
12:20
Add +[conformsTo:] and -[conformsTo:]. check-in: 5008910e85 user: js tags: trunk
Changes

Modified configure.ac from [b75ed815e1] to [8f985e5de6].

15
16
17
18
19
20
21

22
23

24




25
26
27
28
29
30
31
AC_DEFINE(OF_CONFIG_H, 1, [Define so that we know we got our config.h])

BUILDSYS_LIB
AC_DEFINE_UNQUOTED(PLUGIN_SUFFIX, "$PLUGIN_SUFFIX", [Suffix for plugins])
if test x"$PLUGIN_SUFFIX" != "x"; then
	AC_SUBST(OFPLUGIN_M, "OFPlugin.m")
	AC_SUBST(OFPLUGIN, "OFPlugin")

fi


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





AC_MSG_CHECKING(for SIZE_MAX)
AC_EGREP_CPP(yes, [
	#include <stdint.h>
	#include <limits.h>

	#ifdef SIZE_MAX







>


>
|
>
>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
AC_DEFINE(OF_CONFIG_H, 1, [Define so that we know we got our config.h])

BUILDSYS_LIB
AC_DEFINE_UNQUOTED(PLUGIN_SUFFIX, "$PLUGIN_SUFFIX", [Suffix for plugins])
if test x"$PLUGIN_SUFFIX" != "x"; then
	AC_SUBST(OFPLUGIN_M, "OFPlugin.m")
	AC_SUBST(OFPLUGIN, "OFPlugin")
	AC_SUBST(OFPLUGIN_DEF, "-DOF_PLUGINS")
fi

AC_C_BIGENDIAN([
	AC_DEFINE(OF_BIG_ENDIAN, 1, [Whether we are big endian])
	AC_SUBST(ENDIANESS_DEF, "-DOF_BIG_ENDIAN")
	], [
	AC_DEFINE(OF_LITTLE_ENDIAN, 1, [Whether we are little endian])
	AC_SUBST(ENDIANESS_DEF, "-DOF_LITTLE_ENDIAN")])

AC_MSG_CHECKING(for SIZE_MAX)
AC_EGREP_CPP(yes, [
	#include <stdint.h>
	#include <limits.h>

	#ifdef SIZE_MAX
46
47
48
49
50
51
52
53


54
55
56
57
58
59
60
		size_max="((size_t)-1)"])
	AC_DEFINE_UNQUOTED(SIZE_MAX, $size_max, [Maximum value for size_t])])

AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl")

AC_CHECK_FUNC(asprintf, [
	have_asprintf="yes"
	AC_DEFINE(HAVE_ASPRINTF, 1, [Whether we have asprintf])], [


	have_asprintf="no"
	AC_SUBST(ASPRINTF_C, "asprintf.c")])

AC_MSG_CHECKING(whether snprintf returns something useful)
AC_CACHE_VAL(ac_cv_snprintf_useful_ret, [
	AC_TRY_RUN([
		#include <stdio.h>







|
>
>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
		size_max="((size_t)-1)"])
	AC_DEFINE_UNQUOTED(SIZE_MAX, $size_max, [Maximum value for size_t])])

AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl")

AC_CHECK_FUNC(asprintf, [
	have_asprintf="yes"
	AC_DEFINE(OF_HAVE_ASPRINTF, 1, [Whether we have asprintf])
	AC_SUBST(ASPRINTF_DEF, "-DOF_HAVE_ASPRINTF")
	], [
	have_asprintf="no"
	AC_SUBST(ASPRINTF_C, "asprintf.c")])

AC_MSG_CHECKING(whether snprintf returns something useful)
AC_CACHE_VAL(ac_cv_snprintf_useful_ret, [
	AC_TRY_RUN([
		#include <stdio.h>

Modified objfw-config.in from [00d761a00d] to [41e333e8ef].

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
prefix="@prefix@"
exec_prefix="@exec_prefix@"
CFLAGS=""
CPPFLAGS="-I@includedir@/objfw"
CXXFLAGS=""
OBJCFLAGS="-fobjc-exceptions -fconstant-string-class=OFConstString"
OBJCFLAGS="$OBJCFLAGS @NO_CONST_CFSTRINGS@"
LIBS="-L@libdir@ -lobjfw @LIBS@"
VERSION="0.1"

show_help() {




|







1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
prefix="@prefix@"
exec_prefix="@exec_prefix@"
CFLAGS=""
CPPFLAGS="-I@includedir@/objfw @ENDIANESS_DEF@ @ASPRINTF_DEF@ @OFPLUGIN_DEF@"
CXXFLAGS=""
OBJCFLAGS="-fobjc-exceptions -fconstant-string-class=OFConstString"
OBJCFLAGS="$OBJCFLAGS @NO_CONST_CFSTRINGS@"
LIBS="-L@libdir@ -lobjfw @LIBS@"
VERSION="0.1"

show_help() {

Modified src/Makefile from [27fadc8012] to [23931478df].

23
24
25
26
27
28
29
30
31
32
33
34


35
36

37
38
39
40
41
42
43
44
       OFSocket.m		\
       OFStream.m		\
       OFString.m		\
       OFTCPSocket.m		\
       OFThread.m		\
       OFURLEncoding.m		\
       OFXMLFactory.m		\
       ${ASPRINTF_C}

INCLUDESTMP := ${SRCS:.c=.h}
INCLUDES := ${INCLUDESTMP:.m=.h}	\
	   OFMacros.h



SRCS += ${OBJC_SYNC_M}


include ../buildsys.mk

CPPFLAGS += -I..
CFLAGS += ${LIB_CFLAGS}
OBJCFLAGS += ${LIB_CFLAGS}
LD = ${OBJC}
LDFLAGS += ${LIB_LDFLAGS}







<



|
>
>

|
>








23
24
25
26
27
28
29

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
       OFSocket.m		\
       OFStream.m		\
       OFString.m		\
       OFTCPSocket.m		\
       OFThread.m		\
       OFURLEncoding.m		\
       OFXMLFactory.m		\


INCLUDESTMP := ${SRCS:.c=.h}
INCLUDES := ${INCLUDESTMP:.m=.h}	\
	    OFMacros.h			\
	    asprintf.h			\
	    objfw.h

SRCS += ${OBJC_SYNC_M}	\
	${ASPRINTF_C}

include ../buildsys.mk

CPPFLAGS += -I..
CFLAGS += ${LIB_CFLAGS}
OBJCFLAGS += ${LIB_CFLAGS}
LD = ${OBJC}
LDFLAGS += ${LIB_LDFLAGS}

Modified src/OFMacros.h from [ec8a81722f] to [6d59233a09].

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
/*
 * Copyright (c) 2008 - 2009
 *   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.
 */

#ifndef OF_CONFIG_H
#error "You need to have the objfw defines in your config.h and include it!"
#endif

#ifdef __GNUC__
#define OF_INLINE inline __attribute__((always_inline))
#define OF_LIKELY(cond) __builtin_expect(!!(cond), 1)
#define OF_UNLIKELY(cond) __builtin_expect(!!(cond), 0)
#else
#define OF_INLINE inline
#define OF_LIKELY(cond) cond
#define OF_UNLIKELY(cond) cond
#endif

#ifdef OF_BIG_ENDIAN
static OF_INLINE void
OF_BSWAP_V(uint8_t *buf, size_t len)
{
	uint32_t t;

	while (len--) {
		t = (uint32_t)((uint32_t)buf[3] << 8 | buf[2]) << 16 |
		    ((uint32_t)buf[1] << 8 | buf[0]);
		*(uint32_t*)buf = t;
		buf += sizeof(t);
	}
}
#else
#define OF_BSWAP_V(buf, len)


#endif

#define OF_ROL(val, bits) \
	(((val) << (bits)) | ((val) >> (32 - (bits))))

#define OF_HASH_INIT(hash) hash = 0
#define OF_HASH_ADD(hash, byte)		\











<
<
<
<










|












|

>
>







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
/*
 * Copyright (c) 2008 - 2009
 *   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.
 */





#ifdef __GNUC__
#define OF_INLINE inline __attribute__((always_inline))
#define OF_LIKELY(cond) __builtin_expect(!!(cond), 1)
#define OF_UNLIKELY(cond) __builtin_expect(!!(cond), 0)
#else
#define OF_INLINE inline
#define OF_LIKELY(cond) cond
#define OF_UNLIKELY(cond) cond
#endif

#if defined(OF_BIG_ENDIAN)
static OF_INLINE void
OF_BSWAP_V(uint8_t *buf, size_t len)
{
	uint32_t t;

	while (len--) {
		t = (uint32_t)((uint32_t)buf[3] << 8 | buf[2]) << 16 |
		    ((uint32_t)buf[1] << 8 | buf[0]);
		*(uint32_t*)buf = t;
		buf += sizeof(t);
	}
}
#elif defined(OF_LITTLE_ENDIAN)
#define OF_BSWAP_V(buf, len)
#else
#error Please define either OF_BIG_ENDIAN or OF_LITTLE_ENDIAN!
#endif

#define OF_ROL(val, bits) \
	(((val) << (bits)) | ((val) >> (32 - (bits))))

#define OF_HASH_INIT(hash) hash = 0
#define OF_HASH_ADD(hash, byte)		\

Modified src/OFMutableString.m from [fb06bc791e] to [6f55d4cb4b].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#define madvise(addr, len, advise)
#endif

#import "OFMutableString.h"
#import "OFExceptions.h"
#import "OFMacros.h"

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

@implementation OFMutableString
- (id)copy
{
	return [[OFString alloc] initWithString: self];
}








<

<







24
25
26
27
28
29
30

31

32
33
34
35
36
37
38
#define madvise(addr, len, advise)
#endif

#import "OFMutableString.h"
#import "OFExceptions.h"
#import "OFMacros.h"


#import "asprintf.h"


@implementation OFMutableString
- (id)copy
{
	return [[OFString alloc] initWithString: self];
}

Modified src/OFString.m from [aeeb03c826] to [346940a245].

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

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

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

/* Reference for static linking */
void _reference_to_OFURLEncoding_in_OFString()
{
	_OFURLEncoding_reference = 1;
};








<

<







24
25
26
27
28
29
30

31

32
33
34
35
36
37
38

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


#import "asprintf.h"


/* Reference for static linking */
void _reference_to_OFURLEncoding_in_OFString()
{
	_OFURLEncoding_reference = 1;
};

Modified src/asprintf.h from [e7761a686f] to [b13fc53a42].

1
2
3
4
5
6
7
8
9
10



11
12
13

/*
 * Copyright (c) 2008 - 2009
 *   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.
 */




extern int asprintf(char**, const char*, ...);
extern int vasprintf(char**, const char*, va_list);











>
>
>



>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
 * Copyright (c) 2008 - 2009
 *   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.
 */

#ifndef OF_HAVE_ASPRINTF
#include <stdarg.h>

extern int asprintf(char**, const char*, ...);
extern int vasprintf(char**, const char*, va_list);
#endif

Added src/objfw.h version [e03bc7167f].

























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/*
 * Copyright (c) 2008 - 2009
 *   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 <OFObject.h>
#import <OFExceptions.h>

#import <OFAutoreleasePool.h>
#import <OFString.h>

#import <OFDataArray.h>
#import <OFArray.h>

#import <OFList.h>

#import <OFDictionary.h>
#import <OFIterator.h>

#import <OFNumber.h>

#import <OFStream.h>

#import <OFFile.h>

#import <OFSocket.h>
#import <OFTCPSocket.h>

#import <OFHashes.h>
#import <OFThread.h>
#import <OFXMLFactory.h>

#ifdef OF_PLUGINS
#import <OFPlugin.h>
#endif

#import <OFMacros.h>
#import <asprintf.h>