ObjFW  Check-in [73ae6fa60f]

Overview
Comment:Add a few more instancetypes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 73ae6fa60fd69b40bf4c735b8748488d5dbef0648311b7f8a929cd9f4d81add6
User & Date: js on 2013-08-13 10:39:57
Other Links: manifest | tags
Context
2013-08-14
13:18
OFZIPArchive: Make meta data of files available. check-in: 2168071f36 user: js tags: trunk
2013-08-13
10:39
Add a few more instancetypes. check-in: 73ae6fa60f user: js tags: trunk
2013-08-12
21:59
OFZIPArchive: Initial implementation. check-in: 1c78b3a4db user: js tags: trunk
Changes

Modified src/OFIntrospection.m from [f870fce7d2] to [1405af45f9].

28
29
30
31
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
59
#import "OFArray.h"

#import "autorelease.h"
#import "macros.h"

@implementation OFMethod
#if defined(OF_OBJFW_RUNTIME)
- OF_initWithMethod: (struct objc_method*)method
{
	self = [super init];

	@try {
		_selector = (SEL)&method->sel;
		_name = [[OFString alloc]
		    initWithUTF8String: sel_getName(_selector)];
		_typeEncoding = method->sel.types;
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
#elif defined(OF_APPLE_RUNTIME)
- OF_initWithMethod: (Method)method
{
	self = [super init];

	@try {
		_selector = method_getName(method);
		_name = [[OFString alloc]
		    initWithUTF8String: sel_getName(_selector)];







|
















|







28
29
30
31
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
59
#import "OFArray.h"

#import "autorelease.h"
#import "macros.h"

@implementation OFMethod
#if defined(OF_OBJFW_RUNTIME)
- (instancetype)OF_initWithMethod: (struct objc_method*)method
{
	self = [super init];

	@try {
		_selector = (SEL)&method->sel;
		_name = [[OFString alloc]
		    initWithUTF8String: sel_getName(_selector)];
		_typeEncoding = method->sel.types;
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
#elif defined(OF_APPLE_RUNTIME)
- (instancetype)OF_initWithMethod: (Method)method
{
	self = [super init];

	@try {
		_selector = method_getName(method);
		_name = [[OFString alloc]
		    initWithUTF8String: sel_getName(_selector)];
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171

	return hash;
}
@end

@implementation OFInstanceVariable
#if defined(OF_OBJFW_RUNTIME)
- OF_initWithIvar: (struct objc_ivar*)ivar
{
	self = [super init];

	@try {
		_name = [[OFString alloc] initWithUTF8String: ivar->name];
		_typeEncoding = ivar->type;
		_offset = ivar->offset;
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
#elif defined(OF_APPLE_RUNTIME)
- OF_initWithIvar: (Ivar)ivar
{
	self = [super init];

	@try {
		_name = [[OFString alloc]
		    initWithUTF8String: ivar_getName(ivar)];
		_typeEncoding = ivar_getTypeEncoding(ivar);







|















|







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171

	return hash;
}
@end

@implementation OFInstanceVariable
#if defined(OF_OBJFW_RUNTIME)
- (instancetype)OF_initWithIvar: (struct objc_ivar*)ivar
{
	self = [super init];

	@try {
		_name = [[OFString alloc] initWithUTF8String: ivar->name];
		_typeEncoding = ivar->type;
		_offset = ivar->offset;
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
#elif defined(OF_APPLE_RUNTIME)
- (instancetype)OF_initWithIvar: (Ivar)ivar
{
	self = [super init];

	@try {
		_name = [[OFString alloc]
		    initWithUTF8String: ivar_getName(ivar)];
		_typeEncoding = ivar_getTypeEncoding(ivar);

Modified src/OFMapTable.m from [360a62d844] to [162f4f232a].

672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
		[self release];
		@throw e;
	}

	abort();
}

- OF_initWithMapTable: (OFMapTable*)mapTable
	      buckets: (struct of_map_table_bucket**)buckets
	     capacity: (uint32_t)capacity
     mutationsPointer: (unsigned long*)mutationsPtr
{
	self = [super init];

	_mapTable = [mapTable retain];
	_buckets = buckets;
	_capacity = capacity;
	_mutations = *mutationsPtr;







|
|
|
|







672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
		[self release];
		@throw e;
	}

	abort();
}

- (instancetype)OF_initWithMapTable: (OFMapTable*)mapTable
			    buckets: (struct of_map_table_bucket**)buckets
			   capacity: (uint32_t)capacity
		   mutationsPointer: (unsigned long*)mutationsPtr
{
	self = [super init];

	_mapTable = [mapTable retain];
	_buckets = buckets;
	_capacity = capacity;
	_mutations = *mutationsPtr;

Modified src/OFStdIOStream.h from [cff734a988] to [b9d05c835c].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 */
@interface OFStdIOStream: OFStream
{
	int  _fd;
	bool _atEndOfStream;
}

- OF_initWithFileDescriptor: (int)fd;
@end

#ifdef __cplusplus
extern "C" {
#endif
/*! @file */








|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 */
@interface OFStdIOStream: OFStream
{
	int  _fd;
	bool _atEndOfStream;
}

- (instancetype)OF_initWithFileDescriptor: (int)fd;
@end

#ifdef __cplusplus
extern "C" {
#endif
/*! @file */

Modified src/OFStdIOStream.m from [0fb850ba21] to [7fe2743d3d].

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
		[self release];
		@throw e;
	}

	abort();
}

- OF_initWithFileDescriptor: (int)fd
{
	self = [super init];

	_fd = fd;

	return self;
}







|







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
		[self release];
		@throw e;
	}

	abort();
}

- (instancetype)OF_initWithFileDescriptor: (int)fd
{
	self = [super init];

	_fd = fd;

	return self;
}

Modified src/OFString_UTF8.h from [9a39a2d989] to [d53866cce9].

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
		bool	 hashed;
		uint32_t hash;
		char	 *freeWhenDone;
	} *restrict _s;
	struct of_string_utf8_ivars _storage;
}

- OF_initWithUTF8String: (const char*)UTF8String
		 length: (size_t)UTF8StringLength
		storage: (char*)storage;
@end

#ifdef __cplusplus
extern "C" {
#endif
extern int of_string_utf8_check(const char*, size_t, size_t*);
extern size_t of_string_utf8_get_index(const char*, size_t);
extern size_t of_string_utf8_get_position(const char*, size_t, size_t);
#ifdef __cplusplus
}
#endif







|
|
|











34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
		bool	 hashed;
		uint32_t hash;
		char	 *freeWhenDone;
	} *restrict _s;
	struct of_string_utf8_ivars _storage;
}

- (instancetype)OF_initWithUTF8String: (const char*)UTF8String
			       length: (size_t)UTF8StringLength
			      storage: (char*)storage;
@end

#ifdef __cplusplus
extern "C" {
#endif
extern int of_string_utf8_check(const char*, size_t, size_t*);
extern size_t of_string_utf8_get_index(const char*, size_t);
extern size_t of_string_utf8_get_position(const char*, size_t, size_t);
#ifdef __cplusplus
}
#endif

Modified src/OFString_UTF8.m from [48ca6830d9] to [9860c5f0d1].

164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
		[self release];
		@throw e;
	}

	return self;
}

- OF_initWithUTF8String: (const char*)UTF8String
		 length: (size_t)UTF8StringLength
		storage: (char*)storage
{
	self = [super init];

	@try {
		if (UTF8StringLength >= 3 &&
		    !memcmp(UTF8String, "\xEF\xBB\xBF", 3)) {
			UTF8String += 3;







|
|
|







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
		[self release];
		@throw e;
	}

	return self;
}

- (instancetype)OF_initWithUTF8String: (const char*)UTF8String
			       length: (size_t)UTF8StringLength
			      storage: (char*)storage
{
	self = [super init];

	@try {
		if (UTF8StringLength >= 3 &&
		    !memcmp(UTF8String, "\xEF\xBB\xBF", 3)) {
			UTF8String += 3;

Modified src/OFTimer.m from [2cd75597b2] to [39f8a0b5fa].

213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
		[self release];
		@throw e;
	}

	abort();
}

- OF_initWithFireDate: (OFDate*)fireDate
	     interval: (double)interval
	       target: (id)target
	     selector: (SEL)selector
	       object: (id)object1
	       object: (id)object2
	    arguments: (uint8_t)arguments
	      repeats: (bool)repeats
{
	self = [super init];

	@try {
		_fireDate = [fireDate retain];
		_interval = interval;
		_target = [target retain];







|
|
|
|
|
|
|
|







213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
		[self release];
		@throw e;
	}

	abort();
}

- (instancetype)OF_initWithFireDate: (OFDate*)fireDate
			   interval: (double)interval
			     target: (id)target
			   selector: (SEL)selector
			     object: (id)object1
			     object: (id)object2
			  arguments: (uint8_t)arguments
			    repeats: (bool)repeats
{
	self = [super init];

	@try {
		_fireDate = [fireDate retain];
		_interval = interval;
		_target = [target retain];