ObjFW  Check-in [6a65366467]

Overview
Comment:Documentation improvements.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6a6536646794d7d498e4e37a497886d3f5aae26f7d54e6b7242010998ce49f81
User & Date: js on 2010-02-10 20:30:52
Other Links: manifest | tags
Context
2010-02-11
14:05
Add of_range_t and add methods taking an of_range_t. check-in: a7bed8325c user: js tags: trunk
2010-02-10
20:30
Documentation improvements. check-in: 6a65366467 user: js tags: trunk
2010-02-07
14:15
Reduce #ifdefs in OFObject.m. check-in: 623c89300a user: js tags: trunk
Changes

Modified src/OFDictionary.h from [bbde3d4fc4] to [a062c3e4f0].

12
13
14
15
16
17
18

19
20
21
22
23
24

25
26
27
28
29
30
31
#include <stdarg.h>

#import "OFObject.h"
#import "OFEnumerator.h"

@class OFArray;


struct of_dictionary_bucket
{
	OFObject <OFCopying> *key;
	OFObject	     *object;
	uint32_t	     hash;
};


/**
 * The OFDictionary class is a class for using hash tables.
 */
@interface OFDictionary: OFObject <OFCopying, OFMutableCopying,
    OFFastEnumeration>
{







>






>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <stdarg.h>

#import "OFObject.h"
#import "OFEnumerator.h"

@class OFArray;

/// \cond internal
struct of_dictionary_bucket
{
	OFObject <OFCopying> *key;
	OFObject	     *object;
	uint32_t	     hash;
};
/// \endcond

/**
 * The OFDictionary class is a class for using hash tables.
 */
@interface OFDictionary: OFObject <OFCopying, OFMutableCopying,
    OFFastEnumeration>
{

Modified src/OFEnumerator.h from [95bf700ece] to [6eea1f0fa8].

32
33
34
35
36
37
38

39

40

41

42
43
44
45
46
47
48
49
50
51
52
53
54
 *
 * We need this bad check to see if we already imported Cocoa, which defines
 * this as well.
 */
#define of_fast_enumeration_state_t NSFastEnumerationState
#ifndef NSINTEGER_DEFINED
typedef struct __of_fast_enumeration_state {

	unsigned long state;

	id *itemsPtr;

	unsigned long *mutationsPtr;

	unsigned long extra[5];
} of_fast_enumeration_state_t;
#endif

/**
 * The OFFastEnumeration protocol needs to be implemented by all classes
 * supporting fast enumeration.
 */
@protocol OFFastEnumeration
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
			   objects: (id*)objects
			     count: (int)count;
@end







>

>

>

>













32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 *
 * We need this bad check to see if we already imported Cocoa, which defines
 * this as well.
 */
#define of_fast_enumeration_state_t NSFastEnumerationState
#ifndef NSINTEGER_DEFINED
typedef struct __of_fast_enumeration_state {
	/// Arbitrary state information for the enumeration
	unsigned long state;
	/// Pointer to a C array of objects to return
	id *itemsPtr;
	/// Arbitrary state information to detect mutations
	unsigned long *mutationsPtr;
	/// Additional arbitrary state information
	unsigned long extra[5];
} of_fast_enumeration_state_t;
#endif

/**
 * The OFFastEnumeration protocol needs to be implemented by all classes
 * supporting fast enumeration.
 */
@protocol OFFastEnumeration
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
			   objects: (id*)objects
			     count: (int)count;
@end

Modified src/OFHashes.m from [ec07de4144] to [0f7eaa2074].

277
278
279
280
281
282
283

284
285
286
287

288
289
290
291
292
293
294
#define R3(v, w, x, y, z, i)						     \
	z += (((w | x) & y) | (w & x)) + blk(i) + 0x8F1BBCDC + OF_ROL(v, 5); \
	w = OF_ROL(w, 30);
#define R4(v, w, x, y, z, i)						\
	z += (w ^ x ^ y) + blk(i) + 0xCA62C1D6 + OF_ROL(v, 5);		\
	w = OF_ROL(w, 30);


typedef union {
	char	 c[64];
	uint32_t l[16];
} sha1_c64l16_t;


static inline void
sha1_transform(uint32_t state[5], const char buffer[64])
{
	uint32_t      a, b, c, d, e;
	char	      workspace[64];
	sha1_c64l16_t *block;







>




>







277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
#define R3(v, w, x, y, z, i)						     \
	z += (((w | x) & y) | (w & x)) + blk(i) + 0x8F1BBCDC + OF_ROL(v, 5); \
	w = OF_ROL(w, 30);
#define R4(v, w, x, y, z, i)						\
	z += (w ^ x ^ y) + blk(i) + 0xCA62C1D6 + OF_ROL(v, 5);		\
	w = OF_ROL(w, 30);

/// \cond internal
typedef union {
	char	 c[64];
	uint32_t l[16];
} sha1_c64l16_t;
/// \endcond

static inline void
sha1_transform(uint32_t state[5], const char buffer[64])
{
	uint32_t      a, b, c, d, e;
	char	      workspace[64];
	sha1_c64l16_t *block;

Modified src/OFList.h from [d1b99d4de4] to [dd11b8683b].

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

#import "OFObject.h"

/**
 * A struct that contains a pointer to the next list object, the previous list
 * object and the object.
 */
typedef struct __of_list_object
{
	/// A pointer to the next list object in the list
	struct __of_list_object *next;
	/// A pointer to the previous list object in the list
	struct __of_list_object *prev;
	/// The object for the list object
	id			object;
} of_list_object_t;







|
<







11
12
13
14
15
16
17
18

19
20
21
22
23
24
25

#import "OFObject.h"

/**
 * A struct that contains a pointer to the next list object, the previous list
 * object and the object.
 */
typedef struct __of_list_object {

	/// A pointer to the next list object in the list
	struct __of_list_object *next;
	/// A pointer to the previous list object in the list
	struct __of_list_object *prev;
	/// The object for the list object
	id			object;
} of_list_object_t;

Modified src/OFObject.m from [4674410a8d] to [66bcfdea6b].

39
40
41
42
43
44
45

46
47
48
49
50
51
52
53

54
55
56
57
58
59
60
/* A few macros to reduce #ifdefs */
#ifndef OF_APPLE_RUNTIME
# define class_getInstanceSize class_get_instance_size
# define class_getName class_get_name
# define class_getSuperclass class_get_super_class
#endif


struct pre_ivar {
	void	      **memchunks;
	size_t	      memchunks_size;
	int32_t	      retain_count; /* int32_t because atomic ops use int32_t */
#ifndef OF_ATOMIC_OPS
	of_spinlock_t retain_spinlock;
#endif
};


/* Hopefully no arch needs more than 16 bytes padding */
#define PRE_IVAR_ALIGN ((sizeof(struct pre_ivar) + 15) & ~15)
#define PRE_IVAR ((struct pre_ivar*)((char*)self - PRE_IVAR_ALIGN))

static struct {
	Class isa;







>








>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* A few macros to reduce #ifdefs */
#ifndef OF_APPLE_RUNTIME
# define class_getInstanceSize class_get_instance_size
# define class_getName class_get_name
# define class_getSuperclass class_get_super_class
#endif

/// \cond internal
struct pre_ivar {
	void	      **memchunks;
	size_t	      memchunks_size;
	int32_t	      retain_count; /* int32_t because atomic ops use int32_t */
#ifndef OF_ATOMIC_OPS
	of_spinlock_t retain_spinlock;
#endif
};
/// \endcond

/* Hopefully no arch needs more than 16 bytes padding */
#define PRE_IVAR_ALIGN ((sizeof(struct pre_ivar) + 15) & ~15)
#define PRE_IVAR ((struct pre_ivar*)((char*)self - PRE_IVAR_ALIGN))

static struct {
	Class isa;

Modified src/objc_sync.m from [f34c1be170] to [e58da8f002].

15
16
17
18
19
20
21

22
23
24
25
26
27
28

29
30
31
32
33
34
35
#include <stdlib.h>
#include <assert.h>

#import <objc/objc.h>

#import "threading.h"


struct locks_s {
	id		 obj;
	size_t		 count;
	size_t		 recursion;
	of_thread_t	 thread;
	of_mutex_t	 mutex;
};


static of_mutex_t mutex;
static struct locks_s *locks = NULL;
static size_t num_locks = 0;

#define SYNC_ERR(f)							\
	{								\







>







>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdlib.h>
#include <assert.h>

#import <objc/objc.h>

#import "threading.h"

/// \cond internal
struct locks_s {
	id		 obj;
	size_t		 count;
	size_t		 recursion;
	of_thread_t	 thread;
	of_mutex_t	 mutex;
};
/// \endcond

static of_mutex_t mutex;
static struct locks_s *locks = NULL;
static size_t num_locks = 0;

#define SYNC_ERR(f)							\
	{								\