ObjFW  Check-in [56393a3fbd]

Overview
Comment:OFBlock is now based on OFObject.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 56393a3fbdf0aa7a405e3342082096e7e7ef623d9a4543187f4df08d8da5c29a
User & Date: js on 2010-11-11 21:55:49
Other Links: manifest | tags
Context
2010-11-11
22:46
Fix a typo in configure.ac. check-in: f060cc04eb user: js tags: trunk
21:55
OFBlock is now based on OFObject. check-in: 56393a3fbd user: js tags: trunk
20:52
Ignore BOM at start of string. check-in: 1e7e237e6e user: js tags: trunk
Changes

Modified src/OFBlock.h from [78089d079f] to [5c02ac3636].

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
/*
 * Copyright (c) 2008 - 2010
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. 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 "objfw-defs.h"

#ifdef OF_OBJFW_RUNTIME
# import <objfw-rt.h>
#else
# import <objc/objc.h>
#endif

/// \cond internal
typedef struct __of_block_literal {
	Class isa;
	int flags;
	int reserved;
	void (*invoke)(void *, ...);











|
<
<
<
<
<
<







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






13
14
15
16
17
18
19
/*
 * Copyright (c) 2008 - 2010
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. 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"







/// \cond internal
typedef struct __of_block_literal {
	Class isa;
	int flags;
	int reserved;
	void (*invoke)(void *, ...);
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
# define Block_copy(x) ((__typeof__(x))_Block_copy((const void*)(x)))
#endif
#ifndef Block_release
# define Block_release(x) _Block_release((const void*)(x))
#endif

/// \cond internal
@interface OFBlock
{
	Class isa;
}

+ (Class)class;
- copy;
- (void)release;
@end

@interface OFStackBlock: OFBlock
@end

@interface OFGlobalBlock: OFBlock
@end

@interface OFMallocBlock: OFBlock
@end
/// \endcond







|
<
<
<
<
<
<
<











59
60
61
62
63
64
65
66







67
68
69
70
71
72
73
74
75
76
77
# define Block_copy(x) ((__typeof__(x))_Block_copy((const void*)(x)))
#endif
#ifndef Block_release
# define Block_release(x) _Block_release((const void*)(x))
#endif

/// \cond internal
@interface OFBlock: OFObject







@end

@interface OFStackBlock: OFBlock
@end

@interface OFGlobalBlock: OFBlock
@end

@interface OFMallocBlock: OFBlock
@end
/// \endcond

Modified src/OFBlock.m from [daa6113db1] to [e3fe4dcc30].

228
229
230
231
232
233
234





235

236


237
238





239

240





































241
242
243
244
245
246
247








248
249
250
251
252







253
254
255
256
257
258
259
260
261
262
263
264
265
		break;
	}
}
#endif

/// \cond internal
@implementation OFBlock





+ (void)initialize

{


}






+ (Class)class

{





































	return self;
}

- copy
{
	return Block_copy(self);
}









- (void)release
{
	Block_release(self);
}







@end

#if !defined(OF_GNU_RUNTIME) && !defined(OF_OBJFW_RUNTIME)
@implementation OFStackBlock
@end

@implementation OFGlobalBlock
@end

@implementation OFMallocBlock
@end
#endif
/// \endcond







>
>
>
>
>
|
>

>
>


>
>
>
>
>
|
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







>
>
>
>
>
>
>
>





>
>
>
>
>
>
>













228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
		break;
	}
}
#endif

/// \cond internal
@implementation OFBlock
+ alloc
{
	@throw [OFNotImplementedException newWithClass: self
					      selector: _cmd];
}

- init
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void)addMemoryToPool: (void*)ptr
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void*)allocMemoryWithSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void*)allocMemoryForNItems: (size_t)nitems
                     withSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void*)resizeMemory: (void*)ptr
               toSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void*)resizeMemory: (void*)ptr
	     toNItems: (size_t)nitems
	     withSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void)freeMemory: (void*)ptr
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- retain
{
	if (isa == (Class)&_NSConcreteMallocBlock)
		return Block_copy(self);

	return self;
}

- copy
{
	return Block_copy(self);
}

- (size_t)retainCount
{
	if (isa == (Class)&_NSConcreteMallocBlock)
		return ((of_block_literal_t*)self)->reserved;

	return SIZE_MAX;
}

- (void)release
{
	Block_release(self);
}

- (void)dealloc
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
	[super dealloc];	/* Get rid of a stupid warning */
}
@end

#if !defined(OF_GNU_RUNTIME) && !defined(OF_OBJFW_RUNTIME)
@implementation OFStackBlock
@end

@implementation OFGlobalBlock
@end

@implementation OFMallocBlock
@end
#endif
/// \endcond