ObjFW
src/OFBlock.h
00001 /*
00002  * Copyright (c) 2008, 2009, 2010, 2011, 2012
00003  *   Jonathan Schleifer <js@webkeks.org>
00004  *
00005  * All rights reserved.
00006  *
00007  * This file is part of ObjFW. It may be distributed under the terms of the
00008  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
00009  * the packaging of this file.
00010  *
00011  * Alternatively, it may be distributed under the terms of the GNU General
00012  * Public License, either version 2 or 3, which can be found in the file
00013  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
00014  * file.
00015  */
00016 
00017 #import "OFObject.h"
00018 
00019 typedef struct of_block_literal_t {
00020         Class isa;
00021         int flags;
00022         int reserved;
00023         void (*invoke)(void *, ...);
00024         struct of_block_descriptor_t {
00025                 unsigned long reserved;
00026                 unsigned long size;
00027                 void (*copy_helper)(void *dest, void *src);
00028                 void (*dispose_helper)(void *src);
00029                 const char *signature;
00030         } *descriptor;
00031 } of_block_literal_t;
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 extern void* _Block_copy(const void*);
00037 extern void _Block_release(const void*);
00038 #ifdef __cplusplus
00039 }
00040 #endif
00041 
00042 #ifndef Block_copy
00043 # define Block_copy(x) ((__typeof__(x))_Block_copy((const void*)(x)))
00044 #endif
00045 #ifndef Block_release
00046 # define Block_release(x) _Block_release((const void*)(x))
00047 #endif
00048 
00052 @interface OFBlock: OFObject
00053 @end
00054 
00055 @interface OFStackBlock: OFBlock
00056 @end
00057 
00058 @interface OFGlobalBlock: OFBlock
00059 @end
00060 
00061 @interface OFMallocBlock: OFBlock
00062 @end
 All Classes Functions Variables Properties