Overview
Comment: | More compatibility with Apple's Blocks runtime. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
3e8d3a2668151bae1bcb79914cfc87ef |
User & Date: | js on 2010-09-07 09:45:00 |
Other Links: | manifest | tags |
Context
2010-09-08
| ||
09:58 | Add some #ifdefs to make OFBlocks.m compile with the Apple runtime. check-in: 0c55736c5d user: js tags: trunk | |
2010-09-07
| ||
09:45 | More compatibility with Apple's Blocks runtime. check-in: 3e8d3a2668 user: js tags: trunk | |
09:10 | Rename +[addObjectToTopmostPool:] to +[addObject:]. check-in: eafb8d18ed user: js tags: trunk | |
Changes
Modified src/Makefile from [35ed01a7f4] to [b2d5824793].
1 2 3 4 5 6 7 8 9 10 11 | include ../extra.mk LIB = ${OBJFW_SHARED_LIB} LIB_MAJOR = ${OBJFW_LIB_MAJOR} LIB_MINOR = ${OBJFW_LIB_MINOR} STATIC_LIB = ${OBJFW_STATIC_LIB} SRCS = OFApplication.m \ OFArray.m \ OFAutoreleasePool.m \ OFConstString.m \ | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | include ../extra.mk LIB = ${OBJFW_SHARED_LIB} LIB_MAJOR = ${OBJFW_LIB_MAJOR} LIB_MINOR = ${OBJFW_LIB_MINOR} STATIC_LIB = ${OBJFW_STATIC_LIB} SRCS = OFApplication.m \ OFArray.m \ OFAutoreleasePool.m \ OFConstString.m \ OFDataArray.m \ OFDictionary.m \ OFExceptions.m \ OFFile.m \ OFHash.m \ OFEnumerator.m \ OFList.m \ |
︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | OFXMLAttribute.m \ OFXMLElement.m \ OFXMLElementBuilder.m \ OFXMLParser.m \ unicode.m INCLUDES := ${SRCS:.m=.h} \ OFCollection.h \ ObjFW.h \ asprintf.h \ ${ATOMIC_H} \ macros.h \ objfw-defs.h \ ${THREADING_H} | > > | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | OFXMLAttribute.m \ OFXMLElement.m \ OFXMLElementBuilder.m \ OFXMLParser.m \ unicode.m INCLUDES := ${SRCS:.m=.h} \ OFBlock.h \ OFCollection.h \ ObjFW.h \ asprintf.h \ ${ATOMIC_H} \ macros.h \ objfw-defs.h \ ${THREADING_H} SRCS += ${OFBLOCK_M} \ ${ASPRINTF_M} \ iso_8859_15.m \ windows_1252.m \ ${OBJC_PROPERTIES_M} \ ${OBJC_SYNC_M} include ../buildsys.mk CPPFLAGS += -I.. LD = ${OBJC} LDFLAGS += ${REEXPORT_LIBOBJC} |
Modified src/OFBlock.h from [a646593991] to [383899c068].
︙ | ︙ | |||
62 63 64 65 66 67 68 | } - copy; - (void)release; - autorelease; @end | > > | > > > | > > | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | } - copy; - (void)release; - autorelease; @end extern void* _Block_copy(const void*); extern void _Block_release(const void*); #ifndef Block_copy # 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 |
Modified src/OFBlock.m from [0aebe6c0fb] to [0cb72d5e21].
︙ | ︙ | |||
86 87 88 89 90 91 92 | __objc_gnu_init() { __objc_exec_class(&module); } /* Emd of ObjC module */ of_block_literal_t* | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | __objc_gnu_init() { __objc_exec_class(&module); } /* Emd of ObjC module */ of_block_literal_t* _Block_copy(of_block_literal_t *block) { if (block->isa == (Class)&_NSConcreteStackBlock) { of_block_literal_t *copy; if ((copy = malloc(block->descriptor->size)) == NULL) { fputs("Not enough memory to copy block!\n", stderr); exit(1); |
︙ | ︙ | |||
113 114 115 116 117 118 119 | if (block->isa == (Class)&_NSConcreteMallocBlock) block->reserved++; return block; } void | | | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | if (block->isa == (Class)&_NSConcreteMallocBlock) block->reserved++; return block; } void _Block_release(of_block_literal_t *block) { if (block->isa != (Class)&_NSConcreteMallocBlock) return; if (--block->reserved == 0) { if (block->flags & OF_BLOCK_HAS_COPY_DISPOSE) block->descriptor->dispose_helper(block); free(block); } } void _Block_object_assign(void *dst, void *src, int flags) { flags &= OF_BLOCK_FIELD_IS_BLOCK | OF_BLOCK_FIELD_IS_OBJECT | OF_BLOCK_FIELD_IS_BYREF; switch (flags) { case OF_BLOCK_FIELD_IS_BLOCK: *(of_block_literal_t**)dst = _Block_copy(src); break; case OF_BLOCK_FIELD_IS_OBJECT: *(id*)dst = [(id)src retain]; break; case OF_BLOCK_FIELD_IS_BYREF:; of_block_byref_t *src_ = src; of_block_byref_t **dst_ = dst; |
︙ | ︙ | |||
173 174 175 176 177 178 179 | _Block_object_dispose(void *obj, int flags) { flags &= OF_BLOCK_FIELD_IS_BLOCK | OF_BLOCK_FIELD_IS_OBJECT | OF_BLOCK_FIELD_IS_BYREF; switch (flags) { case OF_BLOCK_FIELD_IS_BLOCK: | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | _Block_object_dispose(void *obj, int flags) { flags &= OF_BLOCK_FIELD_IS_BLOCK | OF_BLOCK_FIELD_IS_OBJECT | OF_BLOCK_FIELD_IS_BYREF; switch (flags) { case OF_BLOCK_FIELD_IS_BLOCK: _Block_release(obj); break; case OF_BLOCK_FIELD_IS_OBJECT: [(id)obj release]; break; case OF_BLOCK_FIELD_IS_BYREF:; of_block_byref_t *obj_ = obj; |
︙ | ︙ | |||
196 197 198 199 200 201 202 | } static Class autoreleasepool = Nil; @implementation OFBlock - copy { | | | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | } static Class autoreleasepool = Nil; @implementation OFBlock - copy { return Block_copy(self); } - (void)release { Block_release(self); } - autorelease { /* * Cache OFAutoreleasePool since class lookups are expensive with the * GNU runtime. |
︙ | ︙ |