Rename PUBLIC to OBJC_PUBLIC to avoid some namespace pollution.

main
David Chisnall 7 years ago
parent 70a12d3612
commit d015f0160c

@ -6,9 +6,9 @@
#include "dtable.h" #include "dtable.h"
#include <assert.h> #include <assert.h>
PUBLIC struct objc_class _NSConcreteGlobalBlock; OBJC_PUBLIC struct objc_class _NSConcreteGlobalBlock;
PUBLIC struct objc_class _NSConcreteStackBlock; OBJC_PUBLIC struct objc_class _NSConcreteStackBlock;
PUBLIC struct objc_class _NSConcreteMallocBlock; OBJC_PUBLIC struct objc_class _NSConcreteMallocBlock;
static struct objc_class _NSConcreteGlobalBlockMeta; static struct objc_class _NSConcreteGlobalBlockMeta;
static struct objc_class _NSConcreteStackBlockMeta; static struct objc_class _NSConcreteStackBlockMeta;
@ -40,7 +40,7 @@ static void createNSBlockSubclass(Class superclass, Class newClass,
#define NEW_CLASS(super, sub) \ #define NEW_CLASS(super, sub) \
createNSBlockSubclass(super, &sub, &sub ## Meta, #sub) createNSBlockSubclass(super, &sub, &sub ## Meta, #sub)
PUBLIC OBJC_PUBLIC
BOOL objc_create_block_classes_as_subclasses_of(Class super) BOOL objc_create_block_classes_as_subclasses_of(Class super)
{ {
if (_NSBlock.super_class != NULL) { return NO; } if (_NSBlock.super_class != NULL) { return NO; }

@ -24,4 +24,4 @@
*/ */
#include "objc/runtime.h" #include "objc/runtime.h"
PUBLIC Class alias_getClass(const char *alias_name); OBJC_PUBLIC Class alias_getClass(const char *alias_name);

@ -77,7 +77,7 @@ static Alias alias_table_get_safe(const char *alias_name)
} }
PUBLIC Class alias_getClass(const char *alias_name) OBJC_PUBLIC Class alias_getClass(const char *alias_name)
{ {
if (NULL == alias_name) if (NULL == alias_name)
{ {
@ -99,7 +99,7 @@ PRIVATE void alias_table_insert(Alias alias)
alias_table_internal_insert(alias_table, alias); alias_table_internal_insert(alias_table, alias);
} }
PUBLIC BOOL class_registerAlias_np(Class class, const char *alias) OBJC_PUBLIC BOOL class_registerAlias_np(Class class, const char *alias)
{ {
if ((NULL == alias) || (NULL == class)) if ((NULL == alias) || (NULL == class))
{ {

48
arc.m

@ -213,14 +213,14 @@ static const long weak_mask = ((size_t)1)<<((sizeof(size_t)*8)-refcount_shift);
*/ */
static const long refcount_mask = ~weak_mask; static const long refcount_mask = ~weak_mask;
PUBLIC size_t object_getRetainCount_np(id obj) OBJC_PUBLIC size_t object_getRetainCount_np(id obj)
{ {
uintptr_t *refCount = ((uintptr_t*)obj) - 1; uintptr_t *refCount = ((uintptr_t*)obj) - 1;
uintptr_t refCountVal = __sync_fetch_and_add(refCount, 0); uintptr_t refCountVal = __sync_fetch_and_add(refCount, 0);
return (((size_t)refCountVal) & refcount_mask) + 1; return (((size_t)refCountVal) & refcount_mask) + 1;
} }
PUBLIC id objc_retain_fast_np(id obj) OBJC_PUBLIC id objc_retain_fast_np(id obj)
{ {
uintptr_t *refCount = ((uintptr_t*)obj) - 1; uintptr_t *refCount = ((uintptr_t*)obj) - 1;
uintptr_t refCountVal = __sync_fetch_and_add(refCount, 0); uintptr_t refCountVal = __sync_fetch_and_add(refCount, 0);
@ -293,7 +293,7 @@ static inline id retain(id obj)
return [obj retain]; return [obj retain];
} }
PUBLIC BOOL objc_release_fast_no_destroy_np(id obj) OBJC_PUBLIC BOOL objc_release_fast_no_destroy_np(id obj)
{ {
uintptr_t *refCount = ((uintptr_t*)obj) - 1; uintptr_t *refCount = ((uintptr_t*)obj) - 1;
uintptr_t refCountVal = __sync_fetch_and_add(refCount, 0); uintptr_t refCountVal = __sync_fetch_and_add(refCount, 0);
@ -331,7 +331,7 @@ PUBLIC BOOL objc_release_fast_no_destroy_np(id obj)
return NO; return NO;
} }
PUBLIC void objc_release_fast_np(id obj) OBJC_PUBLIC void objc_release_fast_np(id obj)
{ {
if (objc_release_fast_no_destroy_np(obj)) if (objc_release_fast_no_destroy_np(obj))
{ {
@ -421,7 +421,7 @@ static inline id autorelease(id obj)
return [obj autorelease]; return [obj autorelease];
} }
PUBLIC unsigned long objc_arc_autorelease_count_np(void) OBJC_PUBLIC unsigned long objc_arc_autorelease_count_np(void)
{ {
struct arc_tls* tls = getARCThreadData(); struct arc_tls* tls = getARCThreadData();
unsigned long count = 0; unsigned long count = 0;
@ -435,7 +435,7 @@ PUBLIC unsigned long objc_arc_autorelease_count_np(void)
} }
return count; return count;
} }
PUBLIC unsigned long objc_arc_autorelease_count_for_object_np(id obj) OBJC_PUBLIC unsigned long objc_arc_autorelease_count_for_object_np(id obj)
{ {
struct arc_tls* tls = getARCThreadData(); struct arc_tls* tls = getARCThreadData();
unsigned long count = 0; unsigned long count = 0;
@ -489,7 +489,7 @@ void *objc_autoreleasePoolPush(void)
if (0 == NewAutoreleasePool) { return NULL; } if (0 == NewAutoreleasePool) { return NULL; }
return NewAutoreleasePool(AutoreleasePool, SELECTOR(new)); return NewAutoreleasePool(AutoreleasePool, SELECTOR(new));
} }
PUBLIC void objc_autoreleasePoolPop(void *pool) OBJC_PUBLIC void objc_autoreleasePoolPop(void *pool)
{ {
if (useARCAutoreleasePool) if (useARCAutoreleasePool)
{ {
@ -512,7 +512,7 @@ PUBLIC void objc_autoreleasePoolPop(void *pool)
} }
} }
PUBLIC id objc_autorelease(id obj) OBJC_PUBLIC id objc_autorelease(id obj)
{ {
if (nil != obj) if (nil != obj)
{ {
@ -521,7 +521,7 @@ PUBLIC id objc_autorelease(id obj)
return obj; return obj;
} }
PUBLIC id objc_autoreleaseReturnValue(id obj) OBJC_PUBLIC id objc_autoreleaseReturnValue(id obj)
{ {
if (!useARCAutoreleasePool) if (!useARCAutoreleasePool)
{ {
@ -536,7 +536,7 @@ PUBLIC id objc_autoreleaseReturnValue(id obj)
return objc_autorelease(obj); return objc_autorelease(obj);
} }
PUBLIC id objc_retainAutoreleasedReturnValue(id obj) OBJC_PUBLIC id objc_retainAutoreleasedReturnValue(id obj)
{ {
// If the previous object was released with objc_autoreleaseReturnValue() // If the previous object was released with objc_autoreleaseReturnValue()
// just before return, then it will not have actually been autoreleased. // just before return, then it will not have actually been autoreleased.
@ -568,36 +568,36 @@ PUBLIC id objc_retainAutoreleasedReturnValue(id obj)
return objc_retain(obj); return objc_retain(obj);
} }
PUBLIC id objc_retain(id obj) OBJC_PUBLIC id objc_retain(id obj)
{ {
if (nil == obj) { return nil; } if (nil == obj) { return nil; }
return retain(obj); return retain(obj);
} }
PUBLIC id objc_retainAutorelease(id obj) OBJC_PUBLIC id objc_retainAutorelease(id obj)
{ {
return objc_autorelease(objc_retain(obj)); return objc_autorelease(objc_retain(obj));
} }
PUBLIC id objc_retainAutoreleaseReturnValue(id obj) OBJC_PUBLIC id objc_retainAutoreleaseReturnValue(id obj)
{ {
if (nil == obj) { return obj; } if (nil == obj) { return obj; }
return objc_autoreleaseReturnValue(retain(obj)); return objc_autoreleaseReturnValue(retain(obj));
} }
PUBLIC id objc_retainBlock(id b) OBJC_PUBLIC id objc_retainBlock(id b)
{ {
return _Block_copy(b); return _Block_copy(b);
} }
PUBLIC void objc_release(id obj) OBJC_PUBLIC void objc_release(id obj)
{ {
if (nil == obj) { return; } if (nil == obj) { return; }
release(obj); release(obj);
} }
PUBLIC id objc_storeStrong(id *addr, id value) OBJC_PUBLIC id objc_storeStrong(id *addr, id value)
{ {
value = objc_retain(value); value = objc_retain(value);
id oldValue = *addr; id oldValue = *addr;
@ -698,7 +698,7 @@ static inline BOOL weakRefRelease(WeakRef *ref)
void* block_load_weak(void *block); void* block_load_weak(void *block);
PUBLIC id objc_storeWeak(id *addr, id obj) OBJC_PUBLIC id objc_storeWeak(id *addr, id obj)
{ {
LOCK_FOR_SCOPE(&weakRefLock); LOCK_FOR_SCOPE(&weakRefLock);
WeakRef *oldRef; WeakRef *oldRef;
@ -789,7 +789,7 @@ PUBLIC id objc_storeWeak(id *addr, id obj)
return obj; return obj;
} }
PUBLIC BOOL objc_delete_weak_refs(id obj) OBJC_PUBLIC BOOL objc_delete_weak_refs(id obj)
{ {
LOCK_FOR_SCOPE(&weakRefLock); LOCK_FOR_SCOPE(&weakRefLock);
if (objc_test_class_flag(classForObject(obj), objc_class_flag_fast_arc)) if (objc_test_class_flag(classForObject(obj), objc_class_flag_fast_arc))
@ -827,7 +827,7 @@ PUBLIC BOOL objc_delete_weak_refs(id obj)
return YES; return YES;
} }
PUBLIC id objc_loadWeakRetained(id* addr) OBJC_PUBLIC id objc_loadWeakRetained(id* addr)
{ {
LOCK_FOR_SCOPE(&weakRefLock); LOCK_FOR_SCOPE(&weakRefLock);
id obj; id obj;
@ -865,12 +865,12 @@ PUBLIC id objc_loadWeakRetained(id* addr)
return objc_retain(obj); return objc_retain(obj);
} }
PUBLIC id objc_loadWeak(id* object) OBJC_PUBLIC id objc_loadWeak(id* object)
{ {
return objc_autorelease(objc_loadWeakRetained(object)); return objc_autorelease(objc_loadWeakRetained(object));
} }
PUBLIC void objc_copyWeak(id *dest, id *src) OBJC_PUBLIC void objc_copyWeak(id *dest, id *src)
{ {
// Don't retain or release. While the weak ref lock is held, we know that // Don't retain or release. While the weak ref lock is held, we know that
// the object can't be deallocated, so we just move the value and update // the object can't be deallocated, so we just move the value and update
@ -892,7 +892,7 @@ PUBLIC void objc_copyWeak(id *dest, id *src)
} }
} }
PUBLIC void objc_moveWeak(id *dest, id *src) OBJC_PUBLIC void objc_moveWeak(id *dest, id *src)
{ {
// Don't retain or release. While the weak ref lock is held, we know that // Don't retain or release. While the weak ref lock is held, we know that
// the object can't be deallocated, so we just move the value and update // the object can't be deallocated, so we just move the value and update
@ -910,12 +910,12 @@ PUBLIC void objc_moveWeak(id *dest, id *src)
} }
} }
PUBLIC void objc_destroyWeak(id* obj) OBJC_PUBLIC void objc_destroyWeak(id* obj)
{ {
objc_storeWeak(obj, nil); objc_storeWeak(obj, nil);
} }
PUBLIC id objc_initWeak(id *object, id value) OBJC_PUBLIC id objc_initWeak(id *object, id value)
{ {
*object = nil; *object = nil;
return objc_storeWeak(object, value); return objc_storeWeak(object, value);

@ -388,7 +388,7 @@ PRIVATE void gc_setTypeForClass(Class cls, void *type)
list->gc_type = type; list->gc_type = type;
} }
PUBLIC OBJC_PUBLIC
int objc_sync_enter(id object) int objc_sync_enter(id object)
{ {
if ((object == 0) || isSmallObject(object)) { return 0; } if ((object == 0) || isSmallObject(object)) { return 0; }
@ -397,7 +397,7 @@ int objc_sync_enter(id object)
return 0; return 0;
} }
PUBLIC OBJC_PUBLIC
int objc_sync_exit(id object) int objc_sync_exit(id object)
{ {
if ((object == 0) || isSmallObject(object)) { return 0; } if ((object == 0) || isSmallObject(object)) { return 0; }

@ -39,7 +39,7 @@
static void *_HeapBlockByRef = (void*)1; static void *_HeapBlockByRef = (void*)1;
PUBLIC _Bool _Block_has_signature(id b) OBJC_PUBLIC _Bool _Block_has_signature(id b)
{ {
const struct Block_layout *block = (struct Block_layout*)b; const struct Block_layout *block = (struct Block_layout*)b;
return ((NULL != block) && (block->flags & BLOCK_HAS_SIGNATURE)); return ((NULL != block) && (block->flags & BLOCK_HAS_SIGNATURE));
@ -47,7 +47,7 @@ PUBLIC _Bool _Block_has_signature(id b)
/** /**
* Returns the Objective-C type encoding for the block. * Returns the Objective-C type encoding for the block.
*/ */
PUBLIC const char * _Block_signature(id b) OBJC_PUBLIC const char * _Block_signature(id b)
{ {
const struct Block_layout *block = (struct Block_layout*)b; const struct Block_layout *block = (struct Block_layout*)b;
if ((NULL == block) || !(block->flags & BLOCK_HAS_SIGNATURE)) if ((NULL == block) || !(block->flags & BLOCK_HAS_SIGNATURE))
@ -60,7 +60,7 @@ PUBLIC const char * _Block_signature(id b)
} }
return block->descriptor->encoding; return block->descriptor->encoding;
} }
PUBLIC const char *block_getType_np(const void *b) OBJC_PUBLIC const char *block_getType_np(const void *b)
{ {
return _Block_signature(b); return _Block_signature(b);
} }
@ -120,7 +120,7 @@ static int cas(void *ptr, void *old, void *new)
* the other choices which are mutually exclusive. Only in a Block copy helper * the other choices which are mutually exclusive. Only in a Block copy helper
* will one see BLOCK_FIELD_IS_BYREF. * will one see BLOCK_FIELD_IS_BYREF.
*/ */
PUBLIC void _Block_object_assign(void *destAddr, const void *object, const int flags) OBJC_PUBLIC void _Block_object_assign(void *destAddr, const void *object, const int flags)
{ {
//printf("Copying %x to %x with flags %x\n", object, destAddr, flags); //printf("Copying %x to %x with flags %x\n", object, destAddr, flags);
// FIXME: Needs to be implemented // FIXME: Needs to be implemented
@ -199,7 +199,7 @@ PUBLIC void _Block_object_assign(void *destAddr, const void *object, const int f
* The same flags used in the copy helper should be used for each call * The same flags used in the copy helper should be used for each call
* generated to this function: * generated to this function:
*/ */
PUBLIC void _Block_object_dispose(const void *object, const int flags) OBJC_PUBLIC void _Block_object_dispose(const void *object, const int flags)
{ {
// FIXME: Needs to be implemented // FIXME: Needs to be implemented
//if(flags & BLOCK_FIELD_IS_WEAK) //if(flags & BLOCK_FIELD_IS_WEAK)
@ -244,7 +244,7 @@ PUBLIC void _Block_object_dispose(const void *object, const int flags)
// Copy a block to the heap if it's still on the stack or increments its retain count. // Copy a block to the heap if it's still on the stack or increments its retain count.
PUBLIC void *_Block_copy(const void *src) OBJC_PUBLIC void *_Block_copy(const void *src)
{ {
if (NULL == src) { return NULL; } if (NULL == src) { return NULL; }
struct Block_layout *self = (struct Block_layout*)src; struct Block_layout *self = (struct Block_layout*)src;
@ -278,7 +278,7 @@ PUBLIC void *_Block_copy(const void *src)
} }
// Release a block and frees the memory when the retain count hits zero. // Release a block and frees the memory when the retain count hits zero.
PUBLIC void _Block_release(const void *src) OBJC_PUBLIC void _Block_release(const void *src)
{ {
if (NULL == src) { return; } if (NULL == src) { return; }
struct Block_layout *self = (struct Block_layout*)src; struct Block_layout *self = (struct Block_layout*)src;

@ -34,7 +34,7 @@ static const int32_t caps =
#endif #endif
0; 0;
PUBLIC int objc_test_capability(int x) OBJC_PUBLIC int objc_test_capability(int x)
{ {
if (x >= 32) { return 0; } if (x >= 32) { return 0; }
if (caps & (1<<x)) { return 1; } if (caps & (1<<x)) { return 1; }

@ -46,9 +46,9 @@ static inline int classHasInstalledDtable(struct objc_class *cls)
return (cls->dtable != uninstalled_dtable); return (cls->dtable != uninstalled_dtable);
} }
PUBLIC OBJC_PUBLIC
int objc_sync_enter(id object); int objc_sync_enter(id object);
PUBLIC OBJC_PUBLIC
int objc_sync_exit(id object); int objc_sync_exit(id object);
/** /**
* Returns the dtable for a given class. If we are currently in an +initialize * Returns the dtable for a given class. If we are currently in an +initialize

@ -178,7 +178,7 @@ static enum {
void registerProtocol(Protocol *proto); void registerProtocol(Protocol *proto);
PUBLIC void __objc_load(struct objc_init *init) OBJC_PUBLIC void __objc_load(struct objc_init *init)
{ {
init_runtime(); init_runtime();
#ifdef DEBUG_LOADING #ifdef DEBUG_LOADING
@ -313,7 +313,7 @@ PUBLIC void __objc_load(struct objc_init *init)
} }
#ifdef OLDABI_COMPAT #ifdef OLDABI_COMPAT
PUBLIC void __objc_exec_class(struct objc_module_abi_8 *module) OBJC_PUBLIC void __objc_exec_class(struct objc_module_abi_8 *module)
{ {
init_runtime(); init_runtime();

@ -13,15 +13,15 @@
#define BLOCKS_EXPORT extern #define BLOCKS_EXPORT extern
#endif #endif
PUBLIC BLOCKS_EXPORT void *_Block_copy(const void *); OBJC_PUBLIC BLOCKS_EXPORT void *_Block_copy(const void *);
PUBLIC BLOCKS_EXPORT void _Block_release(const void *); OBJC_PUBLIC BLOCKS_EXPORT void _Block_release(const void *);
PUBLIC BLOCKS_EXPORT const char *block_getType_np(const void *b) OBJC_NONPORTABLE; OBJC_PUBLIC BLOCKS_EXPORT const char *block_getType_np(const void *b) OBJC_NONPORTABLE;
#ifdef __OBJC__ #ifdef __OBJC__
PUBLIC BLOCKS_EXPORT _Bool _Block_has_signature(id); OBJC_PUBLIC BLOCKS_EXPORT _Bool _Block_has_signature(id);
PUBLIC BLOCKS_EXPORT const char * _Block_signature(id); OBJC_PUBLIC BLOCKS_EXPORT const char * _Block_signature(id);
#else #else
PUBLIC BLOCKS_EXPORT _Bool _Block_has_signature(void *); OBJC_PUBLIC BLOCKS_EXPORT _Bool _Block_has_signature(void *);
PUBLIC BLOCKS_EXPORT const char * _Block_signature(void *); OBJC_PUBLIC BLOCKS_EXPORT const char * _Block_signature(void *);
#endif #endif
#define Block_copy(x) ((__typeof(x))_Block_copy((const void *)(x))) #define Block_copy(x) ((__typeof(x))_Block_copy((const void *)(x)))

@ -136,7 +136,7 @@ extern "C" {
* Run time feature test. This function returns 1 if the runtime supports the * Run time feature test. This function returns 1 if the runtime supports the
* specified feature or 0 if it does not. * specified feature or 0 if it does not.
*/ */
PUBLIC OBJC_PUBLIC
int objc_test_capability(int x) OBJC_NONPORTABLE; int objc_test_capability(int x) OBJC_NONPORTABLE;
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -14,7 +14,7 @@ extern "C" {
#ifndef OBJC_HOOK #ifndef OBJC_HOOK
#define OBJC_HOOK PUBLIC extern #define OBJC_HOOK OBJC_PUBLIC extern
#endif #endif
struct objc_category; struct objc_category;
/** /**
@ -109,7 +109,7 @@ typedef IMP (*objc_tracing_hook)(id, SEL, IMP, int, void*);
/** /**
* Registers a tracing hook for a specified selector. * Registers a tracing hook for a specified selector.
*/ */
PUBLIC int objc_registerTracingHook(SEL, objc_tracing_hook); OBJC_PUBLIC int objc_registerTracingHook(SEL, objc_tracing_hook);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -23,7 +23,7 @@
* systems even within the same architecture, so take great care if using this * systems even within the same architecture, so take great care if using this
* function for small (two integer) structures. * function for small (two integer) structures.
*/ */
PUBLIC OBJC_PUBLIC
id objc_msgSend(id self, SEL _cmd, ...); id objc_msgSend(id self, SEL _cmd, ...);
/** /**
* Standard message sending function. This function must be cast to the * Standard message sending function. This function must be cast to the
@ -40,7 +40,7 @@ id objc_msgSend(id self, SEL _cmd, ...);
* architecture, so take great care if using this function for small (two * architecture, so take great care if using this function for small (two
* integer) structures. * integer) structures.
*/ */
PUBLIC OBJC_PUBLIC
#ifdef __cplusplus #ifdef __cplusplus
id objc_msgSend_stret(id self, SEL _cmd, ...); id objc_msgSend_stret(id self, SEL _cmd, ...);
#else #else
@ -58,7 +58,7 @@ void objc_msgSend_stret(id self, SEL _cmd, ...);
* This version of the function is used for all messages that return floating * This version of the function is used for all messages that return floating
* point values. * point values.
*/ */
PUBLIC OBJC_PUBLIC
long double objc_msgSend_fpret(id self, SEL _cmd, ...); long double objc_msgSend_fpret(id self, SEL _cmd, ...);
#endif #endif

@ -13,90 +13,90 @@ extern "C" {
/** /**
* Autoreleases the argument. Equivalent to [obj autorelease]. * Autoreleases the argument. Equivalent to [obj autorelease].
*/ */
PUBLIC id objc_autorelease(id obj); OBJC_PUBLIC id objc_autorelease(id obj);
/** /**
* Autoreleases a return value. This is equivalent to [obj autorelease], but * Autoreleases a return value. This is equivalent to [obj autorelease], but
* may also store the object somewhere where it can be quickly removed without * may also store the object somewhere where it can be quickly removed without
* the need for any message sending. * the need for any message sending.
*/ */
PUBLIC id objc_autoreleaseReturnValue(id obj); OBJC_PUBLIC id objc_autoreleaseReturnValue(id obj);
/** /**
* Initializes object as a weak pointer and stores value in it, or nil if value * Initializes object as a weak pointer and stores value in it, or nil if value
* has already begun deallocation. * has already begun deallocation.
*/ */
PUBLIC id objc_initWeak(id *object, id value); OBJC_PUBLIC id objc_initWeak(id *object, id value);
/** /**
* Loads the object. Returns nil if the object stored at this address has * Loads the object. Returns nil if the object stored at this address has
* already begun deallocation. * already begun deallocation.
*/ */
PUBLIC id objc_loadWeak(id* object); OBJC_PUBLIC id objc_loadWeak(id* object);
/** /**
* Loads a weak value and retains it. * Loads a weak value and retains it.
*/ */
PUBLIC id objc_loadWeakRetained(id* obj); OBJC_PUBLIC id objc_loadWeakRetained(id* obj);
/** /**
* Retains the argument. Equivalent to [obj retain]. * Retains the argument. Equivalent to [obj retain].
*/ */
PUBLIC id objc_retain(id obj); OBJC_PUBLIC id objc_retain(id obj);
/** /**
* Retains the argument, assuming that the argument is a normal object and has * Retains the argument, assuming that the argument is a normal object and has
* its reference count managed by the runtime. * its reference count managed by the runtime.
* This is intended to implement `-retain` in ARC-compatible root classes. * This is intended to implement `-retain` in ARC-compatible root classes.
*/ */
PUBLIC id objc_retain_fast_np(id obj) OBJC_NONPORTABLE; OBJC_PUBLIC id objc_retain_fast_np(id obj) OBJC_NONPORTABLE;
/** /**
* Retains and autoreleases an object. Equivalent to [[obj retain] autorelease]. * Retains and autoreleases an object. Equivalent to [[obj retain] autorelease].
*/ */
PUBLIC id objc_retainAutorelease(id obj); OBJC_PUBLIC id objc_retainAutorelease(id obj);
/** /**
* Retains and releases a return value. Equivalent to * Retains and releases a return value. Equivalent to
* objc_retain(objc_autoreleaseReturnValue(obj)). * objc_retain(objc_autoreleaseReturnValue(obj)).
*/ */
PUBLIC id objc_retainAutoreleaseReturnValue(id obj); OBJC_PUBLIC id objc_retainAutoreleaseReturnValue(id obj);
/** /**
* Retains a return value that has previously been autoreleased and returned. * Retains a return value that has previously been autoreleased and returned.
* This is equivalent to objc_retainAutoreleaseReturnValue(), but may support a * This is equivalent to objc_retainAutoreleaseReturnValue(), but may support a
* fast path, skipping the autorelease pool entirely. * fast path, skipping the autorelease pool entirely.
*/ */
PUBLIC id objc_retainAutoreleasedReturnValue(id obj); OBJC_PUBLIC id objc_retainAutoreleasedReturnValue(id obj);
/** /**
* Retains a block. * Retains a block.
*/ */
PUBLIC id objc_retainBlock(id b); OBJC_PUBLIC id objc_retainBlock(id b);
/** /**
* Stores value in addr. This first retains value, then releases the old value * Stores value in addr. This first retains value, then releases the old value
* at addr, and stores the retained value in the address. * at addr, and stores the retained value in the address.
*/ */
PUBLIC id objc_storeStrong(id *addr, id value); OBJC_PUBLIC id objc_storeStrong(id *addr, id value);
/** /**
* Stores obj in zeroing weak pointer addr. If obj has begun deallocation, * Stores obj in zeroing weak pointer addr. If obj has begun deallocation,
* then this stores nil. * then this stores nil.
*/ */
PUBLIC id objc_storeWeak(id *addr, id obj); OBJC_PUBLIC id objc_storeWeak(id *addr, id obj);
/** /**
* Allocates an autorelease pool and pushes it onto the top of the autorelease * Allocates an autorelease pool and pushes it onto the top of the autorelease
* pool stack. Note that the returned autorelease pool is not required to be * pool stack. Note that the returned autorelease pool is not required to be
* an object. * an object.
*/ */
PUBLIC void *objc_autoreleasePoolPush(void); OBJC_PUBLIC void *objc_autoreleasePoolPush(void);
/** /**
* Pops the specified autorelease pool from the stack, sending release messages * Pops the specified autorelease pool from the stack, sending release messages
* to every object that has been autreleased since the pool was created. * to every object that has been autreleased since the pool was created.
*/ */
PUBLIC void objc_autoreleasePoolPop(void *pool); OBJC_PUBLIC void objc_autoreleasePoolPop(void *pool);
/** /**
* Initializes dest as a weak pointer and stores the value stored in src into * Initializes dest as a weak pointer and stores the value stored in src into
* it. * it.
*/ */
PUBLIC void objc_copyWeak(id *dest, id *src); OBJC_PUBLIC void objc_copyWeak(id *dest, id *src);
/** /**
* Destroys addr as a weak pointer. * Destroys addr as a weak pointer.
*/ */
PUBLIC void objc_destroyWeak(id* addr); OBJC_PUBLIC void objc_destroyWeak(id* addr);
/** /**
* Equivalent to objc_copyWeak(), but may also set src to nil. * Equivalent to objc_copyWeak(), but may also set src to nil.
*/ */
PUBLIC void objc_moveWeak(id *dest, id *src); OBJC_PUBLIC void objc_moveWeak(id *dest, id *src);
/** /**
* Releases the argument, assuming that the argument is a normal object and has * Releases the argument, assuming that the argument is a normal object and has
* its reference count managed by the runtime. If the retain count reaches * its reference count managed by the runtime. If the retain count reaches
@ -106,7 +106,7 @@ PUBLIC void objc_moveWeak(id *dest, id *src);
* This is intended to implement `-release` in ARC-compatible root * This is intended to implement `-release` in ARC-compatible root
* classes. * classes.
*/ */
PUBLIC void objc_release_fast_np(id obj) OBJC_NONPORTABLE; OBJC_PUBLIC void objc_release_fast_np(id obj) OBJC_NONPORTABLE;
/** /**
* Releases the argument, assuming that the argument is a normal object and has * Releases the argument, assuming that the argument is a normal object and has
* its reference count managed by the runtime. If the retain count reaches * its reference count managed by the runtime. If the retain count reaches
@ -116,15 +116,15 @@ PUBLIC void objc_release_fast_np(id obj) OBJC_NONPORTABLE;
* This is intended to implement `NSDecrementExtraRefCountWasZero` for use with * This is intended to implement `NSDecrementExtraRefCountWasZero` for use with
* ARC-compatible classes. * ARC-compatible classes.
*/ */
PUBLIC BOOL objc_release_fast_no_destroy_np(id obj) OBJC_NONPORTABLE; OBJC_PUBLIC BOOL objc_release_fast_no_destroy_np(id obj) OBJC_NONPORTABLE;
/** /**
* Returns the retain count of an object. * Returns the retain count of an object.
*/ */
PUBLIC size_t object_getRetainCount_np(id obj) OBJC_NONPORTABLE; OBJC_PUBLIC size_t object_getRetainCount_np(id obj) OBJC_NONPORTABLE;
/** /**
* Releases an object. Equivalent to [obj release]. * Releases an object. Equivalent to [obj release].
*/ */
PUBLIC void objc_release(id obj); OBJC_PUBLIC void objc_release(id obj);
/** /**
* Mark the object as about to begin deallocation. All subsequent reads of * Mark the object as about to begin deallocation. All subsequent reads of
* weak pointers will return 0. This function should be called in -release, * weak pointers will return 0. This function should be called in -release,
@ -134,16 +134,16 @@ PUBLIC void objc_release(id obj);
* *
* Nonstandard extension. * Nonstandard extension.
*/ */
PUBLIC BOOL objc_delete_weak_refs(id obj); OBJC_PUBLIC BOOL objc_delete_weak_refs(id obj);
/** /**
* Returns the total number of objects in the ARC-managed autorelease pool. * Returns the total number of objects in the ARC-managed autorelease pool.
*/ */
PUBLIC unsigned long objc_arc_autorelease_count_np(void); OBJC_PUBLIC unsigned long objc_arc_autorelease_count_np(void);
/** /**
* Returns the total number of times that an object has been autoreleased in * Returns the total number of times that an object has been autoreleased in
* this thread. * this thread.
*/ */
PUBLIC unsigned long objc_arc_autorelease_count_for_object_np(id); OBJC_PUBLIC unsigned long objc_arc_autorelease_count_for_object_np(id);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -1,9 +1,9 @@
#if defined _WIN32 || defined __CYGWIN__ #if defined _WIN32 || defined __CYGWIN__
# ifdef __OBJC_RUNTIME_INTERNAL__ # ifdef __OBJC_RUNTIME_INTERNAL__
# define PUBLIC __attribute__((dllexport)) # define OBJC_PUBLIC __attribute__((dllexport))
# else # else
# define PUBLIC __attribute__((dllimport)) # define OBJC_PUBLIC __attribute__((dllimport))
# endif # endif
#else #else
# define PUBLIC # define OBJC_PUBLIC
#endif #endif

@ -225,7 +225,7 @@ typedef struct
* registered by the runtime. The alignment must be the base-2 logarithm of * registered by the runtime. The alignment must be the base-2 logarithm of
* the alignment requirement and the types should be an Objective-C type encoding. * the alignment requirement and the types should be an Objective-C type encoding.
*/ */
PUBLIC OBJC_PUBLIC
BOOL class_addIvar(Class cls, BOOL class_addIvar(Class cls,
const char *name, const char *name,
size_t size, size_t size,
@ -235,13 +235,13 @@ BOOL class_addIvar(Class cls,
/** /**
* Adds a method to the class. * Adds a method to the class.
*/ */
PUBLIC OBJC_PUBLIC
BOOL class_addMethod(Class cls, SEL name, IMP imp, const char *types); BOOL class_addMethod(Class cls, SEL name, IMP imp, const char *types);
/** /**
* Adds a protocol to the class. * Adds a protocol to the class.
*/ */
PUBLIC OBJC_PUBLIC
BOOL class_addProtocol(Class cls, Protocol *protocol); BOOL class_addProtocol(Class cls, Protocol *protocol);
/** /**
@ -249,7 +249,7 @@ BOOL class_addProtocol(Class cls, Protocol *protocol);
* name are regarded as equivalent, even if they have different methods. This * name are regarded as equivalent, even if they have different methods. This
* behaviour will change in a future version. * behaviour will change in a future version.
*/ */
PUBLIC OBJC_PUBLIC
BOOL class_conformsToProtocol(Class cls, Protocol *protocol); BOOL class_conformsToProtocol(Class cls, Protocol *protocol);
/** /**
@ -257,7 +257,7 @@ BOOL class_conformsToProtocol(Class cls, Protocol *protocol);
* the outCount argument is set to the number of instance variables returned. * the outCount argument is set to the number of instance variables returned.
* The caller is responsible for freeing the returned buffer. * The caller is responsible for freeing the returned buffer.
*/ */
PUBLIC OBJC_PUBLIC
Ivar* class_copyIvarList(Class cls, unsigned int *outCount); Ivar* class_copyIvarList(Class cls, unsigned int *outCount);
/** /**
@ -265,7 +265,7 @@ Ivar* class_copyIvarList(Class cls, unsigned int *outCount);
* outCount argument is set to the number of methods returned. The caller is * outCount argument is set to the number of methods returned. The caller is
* responsible for freeing the returned buffer. * responsible for freeing the returned buffer.
*/ */
PUBLIC OBJC_PUBLIC
Method * class_copyMethodList(Class cls, unsigned int *outCount); Method * class_copyMethodList(Class cls, unsigned int *outCount);
/** /**
@ -273,7 +273,7 @@ Method * class_copyMethodList(Class cls, unsigned int *outCount);
* the outCount argument is set to the number of declared properties returned. * the outCount argument is set to the number of declared properties returned.
* The caller is responsible for freeing the returned buffer. * The caller is responsible for freeing the returned buffer.
*/ */
PUBLIC OBJC_PUBLIC
objc_property_t* class_copyPropertyList(Class cls, unsigned int *outCount); objc_property_t* class_copyPropertyList(Class cls, unsigned int *outCount);
/** /**
@ -281,13 +281,13 @@ objc_property_t* class_copyPropertyList(Class cls, unsigned int *outCount);
* outCount argument is set to the number of protocols returned. The caller is * outCount argument is set to the number of protocols returned. The caller is
* responsible for freeing the returned buffer. * responsible for freeing the returned buffer.
*/ */
PUBLIC OBJC_PUBLIC
Protocol *__unsafe_unretained* class_copyProtocolList(Class cls, unsigned int *outCount); Protocol *__unsafe_unretained* class_copyProtocolList(Class cls, unsigned int *outCount);
/** /**
* Creates an instance of this class, allocating memory using malloc. * Creates an instance of this class, allocating memory using malloc.
*/ */
PUBLIC OBJC_PUBLIC
id class_createInstance(Class cls, size_t extraBytes); id class_createInstance(Class cls, size_t extraBytes);
/** /**
@ -295,7 +295,7 @@ id class_createInstance(Class cls, size_t extraBytes);
* class. This is an opaque data type and must be accessed with the method_*() * class. This is an opaque data type and must be accessed with the method_*()
* family of functions. * family of functions.
*/ */
PUBLIC OBJC_PUBLIC
Method class_getClassMethod(Class aClass, SEL aSelector); Method class_getClassMethod(Class aClass, SEL aSelector);
/** /**
@ -303,7 +303,7 @@ Method class_getClassMethod(Class aClass, SEL aSelector);
* this class. This is an opaque data type and must be accessed with the * this class. This is an opaque data type and must be accessed with the
* ivar_*() family of functions. * ivar_*() family of functions.
*/ */
PUBLIC OBJC_PUBLIC
Ivar class_getClassVariable(Class cls, const char* name); Ivar class_getClassVariable(Class cls, const char* name);
/** /**
@ -311,7 +311,7 @@ Ivar class_getClassVariable(Class cls, const char* name);
* in this class. This is an opaque data type and must be accessed with the * in this class. This is an opaque data type and must be accessed with the
* method_*() family of functions. * method_*() family of functions.
*/ */
PUBLIC OBJC_PUBLIC
Method class_getInstanceMethod(Class aClass, SEL aSelector); Method class_getInstanceMethod(Class aClass, SEL aSelector);
/** /**
@ -319,7 +319,7 @@ Method class_getInstanceMethod(Class aClass, SEL aSelector);
* class's superclasses must be loaded before this call, or the result is * class's superclasses must be loaded before this call, or the result is
* undefined with the non-fragile ABI. * undefined with the non-fragile ABI.
*/ */
PUBLIC OBJC_PUBLIC
size_t class_getInstanceSize(Class cls); size_t class_getInstanceSize(Class cls);
/** /**
@ -327,26 +327,26 @@ size_t class_getInstanceSize(Class cls);
* returning a pointer to the instance variable definition or a null * returning a pointer to the instance variable definition or a null
* pointer if no instance variable of that name was found. * pointer if no instance variable of that name was found.
*/ */
PUBLIC OBJC_PUBLIC
Ivar class_getInstanceVariable(Class cls, const char* name); Ivar class_getInstanceVariable(Class cls, const char* name);
/** /**
* Sets the object value of a specified instance variable. * Sets the object value of a specified instance variable.
*/ */
PUBLIC OBJC_PUBLIC
void object_setIvar(id object, Ivar ivar, id value); void object_setIvar(id object, Ivar ivar, id value);
/** /**
* Sets a named instance variable to the value specified by *value. Note that * Sets a named instance variable to the value specified by *value. Note that
* the instance variable must be a pointer-sized quantity. * the instance variable must be a pointer-sized quantity.
*/ */
PUBLIC OBJC_PUBLIC
Ivar object_setInstanceVariable(id obj, const char *name, void *value); Ivar object_setInstanceVariable(id obj, const char *name, void *value);
/** /**
* Returns the value of the named instance variable. This should not be used * Returns the value of the named instance variable. This should not be used
* with instance variables that are not pointers. * with instance variables that are not pointers.
*/ */
PUBLIC OBJC_PUBLIC
id object_getIvar(id object, Ivar ivar); id object_getIvar(id object, Ivar ivar);
/** /**
@ -355,7 +355,7 @@ id object_getIvar(id object, Ivar ivar);
* *
* Note that the instance variable must be a pointer-sized quantity. * Note that the instance variable must be a pointer-sized quantity.
*/ */
PUBLIC OBJC_PUBLIC
Ivar object_getInstanceVariable(id obj, const char *name, void **outValue); Ivar object_getInstanceVariable(id obj, const char *name, void **outValue);
/** /**
@ -363,62 +363,62 @@ Ivar object_getInstanceVariable(id obj, const char *name, void **outValue);
* the receiver does not have a method corresponding to this message then this * the receiver does not have a method corresponding to this message then this
* function may return a runtime function that performs forwarding. * function may return a runtime function that performs forwarding.
*/ */
PUBLIC OBJC_PUBLIC
IMP class_getMethodImplementation(Class cls, SEL name); IMP class_getMethodImplementation(Class cls, SEL name);
/** /**
* Identical to class_getMethodImplementation(). * Identical to class_getMethodImplementation().
*/ */
PUBLIC OBJC_PUBLIC
IMP class_getMethodImplementation_stret(Class cls, SEL name); IMP class_getMethodImplementation_stret(Class cls, SEL name);
/** /**
* Returns the name of the class. This string is owned by the runtime and is * Returns the name of the class. This string is owned by the runtime and is
* valid for (at least) as long as the class remains loaded. * valid for (at least) as long as the class remains loaded.
*/ */
PUBLIC OBJC_PUBLIC
const char * class_getName(Class cls); const char * class_getName(Class cls);
/** /**
* Retrieves metadata about the property with the specified name. * Retrieves metadata about the property with the specified name.
*/ */
PUBLIC OBJC_PUBLIC
objc_property_t class_getProperty(Class cls, const char *name); objc_property_t class_getProperty(Class cls, const char *name);
/** /**
* Returns the superclass of the specified class. * Returns the superclass of the specified class.
*/ */
PUBLIC OBJC_PUBLIC
Class class_getSuperclass(Class cls); Class class_getSuperclass(Class cls);
/** /**
* Returns the version of the class. Currently, the class version is not used * Returns the version of the class. Currently, the class version is not used
* inside the runtime at all, however it may be used for the developer-mode ABI. * inside the runtime at all, however it may be used for the developer-mode ABI.
*/ */
PUBLIC OBJC_PUBLIC
int class_getVersion(Class theClass); int class_getVersion(Class theClass);
/** /**
* Sets the version for this class. * Sets the version for this class.
*/ */
PUBLIC OBJC_PUBLIC
void class_setVersion(Class theClass, int version); void class_setVersion(Class theClass, int version);
PUBLIC OBJC_GNUSTEP_RUNTIME_UNSUPPORTED("Weak instance variables") OBJC_PUBLIC OBJC_GNUSTEP_RUNTIME_UNSUPPORTED("Weak instance variables")
const char *class_getWeakIvarLayout(Class cls); const char *class_getWeakIvarLayout(Class cls);
/** /**
* Returns whether the class is a metaclass. This can be used in conjunction * Returns whether the class is a metaclass. This can be used in conjunction
* with object_getClass() for differentiating between objects and classes. * with object_getClass() for differentiating between objects and classes.
*/ */
PUBLIC OBJC_PUBLIC
BOOL class_isMetaClass(Class cls); BOOL class_isMetaClass(Class cls);
/** /**
* Registers an alias for the class. Returns YES if the alias could be * Registers an alias for the class. Returns YES if the alias could be
* registered successfully. * registered successfully.
*/ */
PUBLIC OBJC_NONPORTABLE OBJC_PUBLIC OBJC_NONPORTABLE
BOOL class_registerAlias_np(Class cls, const char *alias); BOOL class_registerAlias_np(Class cls, const char *alias);
/** /**
@ -426,7 +426,7 @@ BOOL class_registerAlias_np(Class cls, const char *alias);
* Objective-C runtime uses typed selectors, however the types of the selector * Objective-C runtime uses typed selectors, however the types of the selector
* will be ignored and a new selector registered with the specified types. * will be ignored and a new selector registered with the specified types.
*/ */
PUBLIC OBJC_PUBLIC
IMP class_replaceMethod(Class cls, SEL name, IMP imp, const char *types); IMP class_replaceMethod(Class cls, SEL name, IMP imp, const char *types);
/** /**
@ -435,20 +435,20 @@ IMP class_replaceMethod(Class cls, SEL name, IMP imp, const char *types);
* or more of the various forwarding mechanisms, then this will still return * or more of the various forwarding mechanisms, then this will still return
* NO. * NO.
*/ */
PUBLIC OBJC_PUBLIC
BOOL class_respondsToSelector(Class cls, SEL sel); BOOL class_respondsToSelector(Class cls, SEL sel);
/** /**
* Returns the instance variable layout of this class as an opaque list that * Returns the instance variable layout of this class as an opaque list that
* can be applied to other classes. * can be applied to other classes.
*/ */
PUBLIC OBJC_PUBLIC
const char *class_getIvarLayout(Class cls); const char *class_getIvarLayout(Class cls);
/** /**
* Sets the class's instance variable layout. The layout argument must be a * Sets the class's instance variable layout. The layout argument must be a
* value returned by class_getIvarLayout(). * value returned by class_getIvarLayout().
*/ */
PUBLIC OBJC_PUBLIC
void class_setIvarLayout(Class cls, const char *layout); void class_setIvarLayout(Class cls, const char *layout);
/** /**
@ -456,29 +456,29 @@ void class_setIvarLayout(Class cls, const char *layout);
* because modifying the superclass of a class at run time is a very complex * because modifying the superclass of a class at run time is a very complex
* operation and this function is almost always used incorrectly. * operation and this function is almost always used incorrectly.
*/ */
PUBLIC __attribute__((deprecated)) OBJC_PUBLIC __attribute__((deprecated))
Class class_setSuperclass(Class cls, Class newSuper); Class class_setSuperclass(Class cls, Class newSuper);
PUBLIC OBJC_GNUSTEP_RUNTIME_UNSUPPORTED("Weak instance variables") OBJC_PUBLIC OBJC_GNUSTEP_RUNTIME_UNSUPPORTED("Weak instance variables")
void class_setWeakIvarLayout(Class cls, const char *layout); void class_setWeakIvarLayout(Class cls, const char *layout);
/** /**
* Returns the name of an instance variable. * Returns the name of an instance variable.
*/ */
PUBLIC OBJC_PUBLIC
const char* ivar_getName(Ivar ivar); const char* ivar_getName(Ivar ivar);
/** /**
* Returns the offset of an instance variable. This value can be added to the * Returns the offset of an instance variable. This value can be added to the
* object pointer to get the address of the instance variable. * object pointer to get the address of the instance variable.
*/ */
PUBLIC OBJC_PUBLIC
ptrdiff_t ivar_getOffset(Ivar ivar); ptrdiff_t ivar_getOffset(Ivar ivar);
/** /**
* Returns the Objective-C type encoding of the instance variable. * Returns the Objective-C type encoding of the instance variable.
*/ */
PUBLIC OBJC_PUBLIC
const char* ivar_getTypeEncoding(Ivar ivar); const char* ivar_getTypeEncoding(Ivar ivar);
/** /**
@ -487,14 +487,14 @@ const char* ivar_getTypeEncoding(Ivar ivar);
* Objective-C method will be the self and _cmd parameters, so the returned * Objective-C method will be the self and _cmd parameters, so the returned
* value will be "@" and ":" respectively. * value will be "@" and ":" respectively.
*/ */
PUBLIC OBJC_PUBLIC
char* method_copyArgumentType(Method method, unsigned int index); char* method_copyArgumentType(Method method, unsigned int index);
/** /**
* Copies the type encoding of an argument of this method. The caller is * Copies the type encoding of an argument of this method. The caller is
* responsible for freeing the returned C string. * responsible for freeing the returned C string.
*/ */
PUBLIC OBJC_PUBLIC
char* method_copyReturnType(Method method); char* method_copyReturnType(Method method);
/** /**
@ -502,7 +502,7 @@ char* method_copyReturnType(Method method);
* expensive on the GNUstep runtime and its use is discouraged. It is * expensive on the GNUstep runtime and its use is discouraged. It is
* recommended that users call class_replaceMethod() instead. * recommended that users call class_replaceMethod() instead.
*/ */
PUBLIC OBJC_PUBLIC
void method_exchangeImplementations(Method m1, Method m2); void method_exchangeImplementations(Method m1, Method m2);
/** /**
@ -512,13 +512,13 @@ void method_exchangeImplementations(Method m1, Method m2);
* output string if there is enough space for the argument type and the NULL * output string if there is enough space for the argument type and the NULL
* terminator. Its use is therefore discouraged. * terminator. Its use is therefore discouraged.
*/ */
PUBLIC OBJC_PUBLIC
void method_getArgumentType(Method method, unsigned int index, char *dst, size_t dst_len); void method_getArgumentType(Method method, unsigned int index, char *dst, size_t dst_len);
/** /**
* Returns a pointer to the function used to implement this method. * Returns a pointer to the function used to implement this method.
*/ */
PUBLIC OBJC_PUBLIC
IMP method_getImplementation(Method method); IMP method_getImplementation(Method method);
/** /**
@ -528,14 +528,14 @@ IMP method_getImplementation(Method method);
* although calling method_getTypeEncoding() is faster if you just require the * although calling method_getTypeEncoding() is faster if you just require the
* types. * types.
*/ */
PUBLIC OBJC_PUBLIC
SEL method_getName(Method method); SEL method_getName(Method method);
/** /**
* Returns the number of arguments (including self and _cmd) that this method * Returns the number of arguments (including self and _cmd) that this method
* expects. * expects.
*/ */
PUBLIC OBJC_PUBLIC
unsigned method_getNumberOfArguments(Method method); unsigned method_getNumberOfArguments(Method method);
/** /**
@ -545,7 +545,7 @@ unsigned method_getNumberOfArguments(Method method);
* output string if there is enough space for the argument type and the NULL * output string if there is enough space for the argument type and the NULL
* terminator. Its use is therefore discouraged. * terminator. Its use is therefore discouraged.
*/ */
PUBLIC OBJC_PUBLIC
void method_getReturnType(Method method, char *dst, size_t dst_len); void method_getReturnType(Method method, char *dst, size_t dst_len);
/** /**
@ -553,7 +553,7 @@ void method_getReturnType(Method method, char *dst, size_t dst_len);
* runtime and will persist for (at least) as long as the class owning the * runtime and will persist for (at least) as long as the class owning the
* method is loaded. * method is loaded.
*/ */
PUBLIC OBJC_PUBLIC
const char * method_getTypeEncoding(Method method); const char * method_getTypeEncoding(Method method);
/** /**
@ -561,7 +561,7 @@ const char * method_getTypeEncoding(Method method);
* expensive with the GNUstep runtime and its use is discouraged. It is * expensive with the GNUstep runtime and its use is discouraged. It is
* recommended that you call class_replaceMethod() instead. * recommended that you call class_replaceMethod() instead.
*/ */
PUBLIC OBJC_PUBLIC
IMP method_setImplementation(Method method, IMP imp); IMP method_setImplementation(Method method, IMP imp);
/** /**
@ -570,7 +570,7 @@ IMP method_setImplementation(Method method, IMP imp);
* used for class variables by adding instance variables to the returned * used for class variables by adding instance variables to the returned
* metaclass. * metaclass.
*/ */
PUBLIC OBJC_PUBLIC
Class objc_allocateClassPair(Class superclass, const char *name, size_t extraBytes); Class objc_allocateClassPair(Class superclass, const char *name, size_t extraBytes);
/** /**
@ -578,7 +578,7 @@ Class objc_allocateClassPair(Class superclass, const char *name, size_t extraByt
* attempts to send messages to instances of this class or its subclasses * attempts to send messages to instances of this class or its subclasses
* result in undefined behaviour. * result in undefined behaviour.
*/ */
PUBLIC OBJC_PUBLIC
void objc_disposeClassPair(Class cls); void objc_disposeClassPair(Class cls);
/** /**
@ -587,7 +587,7 @@ void objc_disposeClassPair(Class cls);
* loaded, it calls the _objc_lookup_class() callback to allow an external * loaded, it calls the _objc_lookup_class() callback to allow an external
* library to load the module providing this class. * library to load the module providing this class.
*/ */
PUBLIC OBJC_PUBLIC
id objc_getClass(const char *name); id objc_getClass(const char *name);
/** /**
@ -596,21 +596,21 @@ id objc_getClass(const char *name);
* is 0, it returns the total number of classes registered with the runtime. * is 0, it returns the total number of classes registered with the runtime.
* Otherwise, it copies classes and returns the number copied. * Otherwise, it copies classes and returns the number copied.
*/ */
PUBLIC OBJC_PUBLIC
int objc_getClassList(Class *buffer, int bufferLen); int objc_getClassList(Class *buffer, int bufferLen);
/** /**
* Returns a copy of the list of all classes in the system. The caller is * Returns a copy of the list of all classes in the system. The caller is
* responsible for freeing this list. The number of classes is returned in the * responsible for freeing this list. The number of classes is returned in the
* parameter. * parameter.
*/ */
PUBLIC OBJC_PUBLIC
Class *objc_copyClassList(unsigned int *outCount); Class *objc_copyClassList(unsigned int *outCount);
/** /**
* Returns the metaclass with the specified name. This is equivalent to * Returns the metaclass with the specified name. This is equivalent to
* calling object_getClass() on the result of objc_getClass(). * calling object_getClass() on the result of objc_getClass().
*/ */
PUBLIC OBJC_PUBLIC
id objc_getMetaClass(const char *name); id objc_getMetaClass(const char *name);
/** /**
@ -618,20 +618,20 @@ id objc_getMetaClass(const char *name);
* function should generally only be called early on in a program, to ensure * function should generally only be called early on in a program, to ensure
* that all required libraries are loaded. * that all required libraries are loaded.
*/ */
PUBLIC OBJC_PUBLIC
id objc_getRequiredClass(const char *name); id objc_getRequiredClass(const char *name);
/** /**
* Looks up the class with the specified name, but does not invoke any * Looks up the class with the specified name, but does not invoke any
* external lazy loading mechanisms. * external lazy loading mechanisms.
*/ */
PUBLIC OBJC_PUBLIC
id objc_lookUpClass(const char *name); id objc_lookUpClass(const char *name);
/** /**
* Returns the protocol with the specified name. * Returns the protocol with the specified name.
*/ */
PUBLIC OBJC_PUBLIC
Protocol *objc_getProtocol(const char *name); Protocol *objc_getProtocol(const char *name);
/** /**
* Allocates a new protocol. This returns NULL if a protocol with the same * Allocates a new protocol. This returns NULL if a protocol with the same
@ -640,18 +640,18 @@ Protocol *objc_getProtocol(const char *name);
* Protocols are immutable after they have been registered, so may only be * Protocols are immutable after they have been registered, so may only be
* modified between calling this function and calling objc_registerProtocol(). * modified between calling this function and calling objc_registerProtocol().
*/ */
PUBLIC OBJC_PUBLIC
Protocol *objc_allocateProtocol(const char *name); Protocol *objc_allocateProtocol(const char *name);
/** /**
* Registers a protocol with the runtime. After this point, the protocol may * Registers a protocol with the runtime. After this point, the protocol may
* not be modified. * not be modified.
*/ */
PUBLIC OBJC_PUBLIC
void objc_registerProtocol(Protocol *proto); void objc_registerProtocol(Protocol *proto);
/** /**
* Adds a method to the protocol. * Adds a method to the protocol.
*/ */
PUBLIC OBJC_PUBLIC
void protocol_addMethodDescription(Protocol *aProtocol, void protocol_addMethodDescription(Protocol *aProtocol,
SEL name, SEL name,
const char *types, const char *types,
@ -660,12 +660,12 @@ void protocol_addMethodDescription(Protocol *aProtocol,
/** /**
* Adds a protocol to the protocol. * Adds a protocol to the protocol.
*/ */
PUBLIC OBJC_PUBLIC
void protocol_addProtocol(Protocol *aProtocol, Protocol *addition); void protocol_addProtocol(Protocol *aProtocol, Protocol *addition);
/** /**
* Adds a property to the protocol. * Adds a property to the protocol.
*/ */
PUBLIC OBJC_PUBLIC
void protocol_addProperty(Protocol *aProtocol, void protocol_addProperty(Protocol *aProtocol,
const char *name, const char *name,
const objc_property_attribute_t *attributes, const objc_property_attribute_t *attributes,
@ -680,7 +680,7 @@ void protocol_addProperty(Protocol *aProtocol,
* adding instance variables and methods to it. A class can not have instance * adding instance variables and methods to it. A class can not have instance
* variables added to it after objc_registerClassPair() has been called. * variables added to it after objc_registerClassPair() has been called.
*/ */
PUBLIC OBJC_PUBLIC
void objc_registerClassPair(Class cls); void objc_registerClassPair(Class cls);
/** /**
@ -688,7 +688,7 @@ void objc_registerClassPair(Class cls);
* object. This is a pointer to the storage specified with the extraBytes * object. This is a pointer to the storage specified with the extraBytes
* parameter given when allocating an object. * parameter given when allocating an object.
*/ */
PUBLIC OBJC_PUBLIC
void *object_getIndexedIvars(id obj); void *object_getIndexedIvars(id obj);
// FIXME: The GNU runtime has a version of this which omits the size parameter // FIXME: The GNU runtime has a version of this which omits the size parameter
@ -697,35 +697,35 @@ void *object_getIndexedIvars(id obj);
/** /**
* Free an object created with class_createInstance(). * Free an object created with class_createInstance().
*/ */
PUBLIC OBJC_PUBLIC
id object_dispose(id obj); id object_dispose(id obj);
/** /**
* Returns the class of the object. Note: the isa pointer should not be * Returns the class of the object. Note: the isa pointer should not be
* accessed directly with the GNUstep runtime. * accessed directly with the GNUstep runtime.
*/ */
PUBLIC OBJC_PUBLIC
Class object_getClass(id obj); Class object_getClass(id obj);
/** /**
* Sets the class of the object. Note: the isa pointer should not be * Sets the class of the object. Note: the isa pointer should not be
* accessed directly with the GNUstep runtime. * accessed directly with the GNUstep runtime.
*/ */
PUBLIC OBJC_PUBLIC
Class object_setClass(id obj, Class cls); Class object_setClass(id obj, Class cls);
/** /**
* Returns the name of the class of the object. This is equivalent to calling * Returns the name of the class of the object. This is equivalent to calling
* class_getName() on the result of object_getClass(). * class_getName() on the result of object_getClass().
*/ */
PUBLIC OBJC_PUBLIC
const char *object_getClassName(id obj); const char *object_getClassName(id obj);
/** /**
* Returns the name of a specified property. * Returns the name of a specified property.
*/ */
PUBLIC OBJC_PUBLIC
const char *property_getName(objc_property_t property); const char *property_getName(objc_property_t property);
/** /**
@ -734,13 +734,13 @@ const char *property_getName(objc_property_t property);
* description of the format for this string may be found in Apple's * description of the format for this string may be found in Apple's
* Objective-C Runtime Programming Guide. * Objective-C Runtime Programming Guide.
*/ */
PUBLIC OBJC_PUBLIC
const char *property_getAttributes(objc_property_t property); const char *property_getAttributes(objc_property_t property);
/** /**
* Returns an array of attributes for this property. * Returns an array of attributes for this property.
*/ */
PUBLIC OBJC_PUBLIC
objc_property_attribute_t *property_copyAttributeList(objc_property_t property, objc_property_attribute_t *property_copyAttributeList(objc_property_t property,
unsigned int *outCount); unsigned int *outCount);
/** /**
@ -748,7 +748,7 @@ objc_property_attribute_t *property_copyAttributeList(objc_property_t property,
* that this only sets the property metadata. The property accessor methods * that this only sets the property metadata. The property accessor methods
* must already be created. * must already be created.
*/ */
PUBLIC OBJC_PUBLIC
BOOL class_addProperty(Class cls, BOOL class_addProperty(Class cls,
const char *name, const char *name,
const objc_property_attribute_t *attributes, const objc_property_attribute_t *attributes,
@ -758,7 +758,7 @@ BOOL class_addProperty(Class cls,
* Replaces property metadata. If the property does not exist, then this is * Replaces property metadata. If the property does not exist, then this is
* equivalent to calling class_addProperty(). * equivalent to calling class_addProperty().
*/ */
PUBLIC OBJC_PUBLIC
void class_replaceProperty(Class cls, void class_replaceProperty(Class cls,
const char *name, const char *name,
const objc_property_attribute_t *attributes, const objc_property_attribute_t *attributes,
@ -767,14 +767,14 @@ void class_replaceProperty(Class cls,
/** /**
* Returns a copy of a single attribute. * Returns a copy of a single attribute.
*/ */
PUBLIC OBJC_PUBLIC
char *property_copyAttributeValue(objc_property_t property, char *property_copyAttributeValue(objc_property_t property,
const char *attributeName); const char *attributeName);
/** /**
* Testswhether a protocol conforms to another protocol. * Testswhether a protocol conforms to another protocol.
*/ */
PUBLIC OBJC_PUBLIC
BOOL protocol_conformsToProtocol(Protocol *p, Protocol *other); BOOL protocol_conformsToProtocol(Protocol *p, Protocol *other);
/** /**
@ -782,7 +782,7 @@ BOOL protocol_conformsToProtocol(Protocol *p, Protocol *other);
* the array in the variable pointed to by the last parameter. The caller is * the array in the variable pointed to by the last parameter. The caller is
* responsible for freeing this array. * responsible for freeing this array.
*/ */
PUBLIC OBJC_PUBLIC
struct objc_method_description *protocol_copyMethodDescriptionList(Protocol *p, struct objc_method_description *protocol_copyMethodDescriptionList(Protocol *p,
BOOL isRequiredMethod, BOOL isInstanceMethod, unsigned int *count); BOOL isRequiredMethod, BOOL isInstanceMethod, unsigned int *count);
@ -791,7 +791,7 @@ struct objc_method_description *protocol_copyMethodDescriptionList(Protocol *p,
* stored in the variable pointed to by the last argument. The caller is * stored in the variable pointed to by the last argument. The caller is
* responsible for freeing the returned array. * responsible for freeing the returned array.
*/ */
PUBLIC OBJC_PUBLIC
objc_property_t *protocol_copyPropertyList(Protocol *p, unsigned int *count); objc_property_t *protocol_copyPropertyList(Protocol *p, unsigned int *count);
/** /**
@ -799,7 +799,7 @@ objc_property_t *protocol_copyPropertyList(Protocol *p, unsigned int *count);
* being stored in the variable pointed to by the last argument. The caller is * being stored in the variable pointed to by the last argument. The caller is
* responsible for freeing the returned array. * responsible for freeing the returned array.
*/ */
PUBLIC OBJC_PUBLIC
objc_property_t *protocol_copyPropertyList2(Protocol *p, unsigned int *count, objc_property_t *protocol_copyPropertyList2(Protocol *p, unsigned int *count,
BOOL isRequiredProperty, BOOL isInstanceProperty); BOOL isRequiredProperty, BOOL isInstanceProperty);
@ -808,7 +808,7 @@ objc_property_t *protocol_copyPropertyList2(Protocol *p, unsigned int *count,
* number of protocols in the array being returned via the last argument. The * number of protocols in the array being returned via the last argument. The
* caller is responsible for freeing this array. * caller is responsible for freeing this array.
*/ */
PUBLIC OBJC_PUBLIC
Protocol *__unsafe_unretained*protocol_copyProtocolList(Protocol *p, unsigned int *count); Protocol *__unsafe_unretained*protocol_copyProtocolList(Protocol *p, unsigned int *count);
/** /**
@ -819,13 +819,13 @@ Protocol *__unsafe_unretained*protocol_copyProtocolList(Protocol *p, unsigned in
* *
* The caller is responsible for freeing the returned array. * The caller is responsible for freeing the returned array.
*/ */
PUBLIC OBJC_PUBLIC
Protocol *__unsafe_unretained*objc_copyProtocolList(unsigned int *outCount); Protocol *__unsafe_unretained*objc_copyProtocolList(unsigned int *outCount);
/** /**
* Returns the method description for the specified method within a given * Returns the method description for the specified method within a given
* protocol. * protocol.
*/ */
PUBLIC OBJC_PUBLIC
struct objc_method_description protocol_getMethodDescription(Protocol *p, struct objc_method_description protocol_getMethodDescription(Protocol *p,
SEL aSel, BOOL isRequiredMethod, BOOL isInstanceMethod); SEL aSel, BOOL isRequiredMethod, BOOL isInstanceMethod);
@ -836,20 +836,20 @@ struct objc_method_description protocol_getMethodDescription(Protocol *p,
* implementation and so its semantics may change in the future and this * implementation and so its semantics may change in the future and this
* runtime may diverge from Apple's. * runtime may diverge from Apple's.
*/ */
PUBLIC OBJC_PUBLIC
const char *_protocol_getMethodTypeEncoding(Protocol *p, SEL aSel, const char *_protocol_getMethodTypeEncoding(Protocol *p, SEL aSel,
BOOL isRequiredMethod, BOOL isInstanceMethod); BOOL isRequiredMethod, BOOL isInstanceMethod);
/** /**
* Returns the name of the specified protocol. * Returns the name of the specified protocol.
*/ */
PUBLIC OBJC_PUBLIC
const char* protocol_getName(Protocol *p); const char* protocol_getName(Protocol *p);
/** /**
* Returns the property metadata for the property with the specified name. * Returns the property metadata for the property with the specified name.
*/ */
PUBLIC OBJC_PUBLIC
objc_property_t protocol_getProperty(Protocol *p, const char *name, objc_property_t protocol_getProperty(Protocol *p, const char *name,
BOOL isRequiredProperty, BOOL isInstanceProperty); BOOL isRequiredProperty, BOOL isInstanceProperty);
@ -859,7 +859,7 @@ objc_property_t protocol_getProperty(Protocol *p, const char *name,
* which made not attempt to unique protocols (or even register them with the * which made not attempt to unique protocols (or even register them with the
* runtime). * runtime).
*/ */
PUBLIC OBJC_PUBLIC
BOOL protocol_isEqual(Protocol *p, Protocol *other); BOOL protocol_isEqual(Protocol *p, Protocol *other);
/** /**
@ -867,25 +867,25 @@ BOOL protocol_isEqual(Protocol *p, Protocol *other);
* the function (either a method or a forwarding hook) that should be called in * the function (either a method or a forwarding hook) that should be called in
* response to a given message. * response to a given message.
*/ */
PUBLIC OBJC_PUBLIC
IMP objc_msg_lookup(id, SEL) OBJC_NONPORTABLE; IMP objc_msg_lookup(id, SEL) OBJC_NONPORTABLE;
/** /**
* The message lookup function used for messages sent to super in the GCC ABI. * The message lookup function used for messages sent to super in the GCC ABI.
* This specifies both the class and the * This specifies both the class and the
*/ */
PUBLIC OBJC_PUBLIC
IMP objc_msg_lookup_super(struct objc_super*, SEL) OBJC_NONPORTABLE; IMP objc_msg_lookup_super(struct objc_super*, SEL) OBJC_NONPORTABLE;
/** /**
* Returns the name of the specified selector. * Returns the name of the specified selector.
*/ */
PUBLIC OBJC_PUBLIC
const char *sel_getName(SEL sel); const char *sel_getName(SEL sel);
/** /**
* Registers a selector with the runtime. This is equivalent to sel_registerName(). * Registers a selector with the runtime. This is equivalent to sel_registerName().
*/ */
PUBLIC OBJC_PUBLIC
SEL sel_getUid(const char *selName); SEL sel_getUid(const char *selName);
/** /**
@ -898,26 +898,26 @@ SEL sel_getUid(const char *selName);
* both b and c are typed selectors with different types, then then the first * both b and c are typed selectors with different types, then then the first
* two will return YES, but the third case will return NO. * two will return YES, but the third case will return NO.
*/ */
PUBLIC OBJC_PUBLIC
BOOL sel_isEqual(SEL sel1, SEL sel2); BOOL sel_isEqual(SEL sel1, SEL sel2);
/** /**
* Registers an untyped selector with the runtime. * Registers an untyped selector with the runtime.
*/ */
PUBLIC OBJC_PUBLIC
SEL sel_registerName(const char *selName); SEL sel_registerName(const char *selName);
/** /**
* Register a typed selector. * Register a typed selector.
*/ */
PUBLIC OBJC_PUBLIC
SEL sel_registerTypedName_np(const char *selName, const char *types) OBJC_NONPORTABLE; SEL sel_registerTypedName_np(const char *selName, const char *types) OBJC_NONPORTABLE;
/** /**
* Returns the type encoding associated with a selector, or the empty string is * Returns the type encoding associated with a selector, or the empty string is
* there is no such type. * there is no such type.
*/ */
PUBLIC OBJC_PUBLIC
const char *sel_getType_np(SEL aSel) OBJC_NONPORTABLE; const char *sel_getType_np(SEL aSel) OBJC_NONPORTABLE;
/** /**
@ -928,7 +928,7 @@ const char *sel_getType_np(SEL aSel) OBJC_NONPORTABLE;
* once with a relatively small on-stack buffer and then only call it again * once with a relatively small on-stack buffer and then only call it again
* with a heap-allocated buffer if there is not enough space. * with a heap-allocated buffer if there is not enough space.
*/ */
PUBLIC OBJC_PUBLIC
unsigned sel_copyTypes_np(const char *selName, const char **types, unsigned count) OBJC_NONPORTABLE; unsigned sel_copyTypes_np(const char *selName, const char **types, unsigned count) OBJC_NONPORTABLE;
/** /**
@ -939,14 +939,14 @@ unsigned sel_copyTypes_np(const char *selName, const char **types, unsigned coun
* once with a relatively small on-stack buffer and then only call it again * once with a relatively small on-stack buffer and then only call it again
* with a heap-allocated buffer if there is not enough space. * with a heap-allocated buffer if there is not enough space.
*/ */
PUBLIC OBJC_PUBLIC
unsigned sel_copyTypedSelectors_np(const char *selName, SEL *const sels, unsigned count) OBJC_NONPORTABLE; unsigned sel_copyTypedSelectors_np(const char *selName, SEL *const sels, unsigned count) OBJC_NONPORTABLE;
/** /**
* New ABI lookup function. Receiver may be modified during lookup or proxy * New ABI lookup function. Receiver may be modified during lookup or proxy
* forwarding and the sender may affect how lookup occurs. * forwarding and the sender may affect how lookup occurs.
*/ */
PUBLIC OBJC_PUBLIC
extern struct objc_slot *objc_msg_lookup_sender(id *receiver, SEL selector, id sender) extern struct objc_slot *objc_msg_lookup_sender(id *receiver, SEL selector, id sender)
OBJC_NONPORTABLE OBJC_DEPRECATED; OBJC_NONPORTABLE OBJC_DEPRECATED;
@ -954,7 +954,7 @@ extern struct objc_slot *objc_msg_lookup_sender(id *receiver, SEL selector, id s
* Deprecated function for accessing a slot without going via any forwarding * Deprecated function for accessing a slot without going via any forwarding
* mechanisms. * mechanisms.
*/ */
PUBLIC OBJC_PUBLIC
extern struct objc_slot *objc_get_slot(Class, SEL) extern struct objc_slot *objc_get_slot(Class, SEL)
OBJC_NONPORTABLE OBJC_DEPRECATED; OBJC_NONPORTABLE OBJC_DEPRECATED;
@ -964,7 +964,7 @@ extern struct objc_slot *objc_get_slot(Class, SEL)
* counter. If this value is equal to `objc_method_cache_version` then the * counter. If this value is equal to `objc_method_cache_version` then the
* slot is safe to reuse without performing another lookup. * slot is safe to reuse without performing another lookup.
*/ */
PUBLIC OBJC_PUBLIC
extern struct objc_slot2 *objc_get_slot2(Class, SEL, uint64_t*) extern struct objc_slot2 *objc_get_slot2(Class, SEL, uint64_t*)
OBJC_NONPORTABLE; OBJC_NONPORTABLE;
@ -974,14 +974,14 @@ extern struct objc_slot2 *objc_get_slot2(Class, SEL, uint64_t*)
* counter. If this value is equal to `objc_method_cache_version` then the * counter. If this value is equal to `objc_method_cache_version` then the
* slot is safe to reuse without performing another lookup. * slot is safe to reuse without performing another lookup.
*/ */
PUBLIC OBJC_PUBLIC
extern struct objc_slot2 *objc_slot_lookup_version(id *receiver, SEL selector, uint64_t*) extern struct objc_slot2 *objc_slot_lookup_version(id *receiver, SEL selector, uint64_t*)
OBJC_NONPORTABLE; OBJC_NONPORTABLE;
/** /**
* Look up a slot, invoking any required forwarding mechanisms. * Look up a slot, invoking any required forwarding mechanisms.
*/ */
PUBLIC OBJC_PUBLIC
extern IMP objc_msg_lookup2(id *receiver, SEL selector) OBJC_NONPORTABLE; extern IMP objc_msg_lookup2(id *receiver, SEL selector) OBJC_NONPORTABLE;
/** /**
@ -989,7 +989,7 @@ extern IMP objc_msg_lookup2(id *receiver, SEL selector) OBJC_NONPORTABLE;
* pointer. If the class can be registered, then this returns YES. The second * pointer. If the class can be registered, then this returns YES. The second
* argument specifies the bit pattern to use to identify the small object. * argument specifies the bit pattern to use to identify the small object.
*/ */
PUBLIC OBJC_PUBLIC
BOOL objc_registerSmallObjectClass_np(Class cls, uintptr_t classId); BOOL objc_registerSmallObjectClass_np(Class cls, uintptr_t classId);
/** /**
@ -1053,7 +1053,7 @@ typedef uintptr_t objc_AssociationPolicy;
* Returns an object previously stored by calling objc_setAssociatedObject() * Returns an object previously stored by calling objc_setAssociatedObject()
* with the same arguments, or nil if none exists. * with the same arguments, or nil if none exists.
*/ */
PUBLIC OBJC_PUBLIC
id objc_getAssociatedObject(id object, void *key); id objc_getAssociatedObject(id object, void *key);
/** /**
* Associates an object with another. This provides a mechanism for storing * Associates an object with another. This provides a mechanism for storing
@ -1063,12 +1063,12 @@ id objc_getAssociatedObject(id object, void *key);
* value may be any object, but must respond to -copy or -retain, and -release, * value may be any object, but must respond to -copy or -retain, and -release,
* if an association policy of copy or retain is passed as the final argument. * if an association policy of copy or retain is passed as the final argument.
*/ */
PUBLIC OBJC_PUBLIC
void objc_setAssociatedObject(id object, void *key, id value, objc_AssociationPolicy policy); void objc_setAssociatedObject(id object, void *key, id value, objc_AssociationPolicy policy);
/** /**
* Removes all associations from an object. * Removes all associations from an object.
*/ */
PUBLIC OBJC_PUBLIC
void objc_removeAssociatedObjects(id object); void objc_removeAssociatedObjects(id object);
/** /**
@ -1076,7 +1076,7 @@ void objc_removeAssociatedObjects(id object);
* take an object pointer (self) as its first argument, and then the same * take an object pointer (self) as its first argument, and then the same
* arguments as the method. * arguments as the method.
*/ */
PUBLIC OBJC_PUBLIC
IMP imp_implementationWithBlock(void *block); IMP imp_implementationWithBlock(void *block);
/** /**
* Returns the type encoding of an IMP that would be returned by passing the * Returns the type encoding of an IMP that would be returned by passing the
@ -1084,49 +1084,49 @@ IMP imp_implementationWithBlock(void *block);
* block encoding for transforming to an IMP (it must take id as its first * block encoding for transforming to an IMP (it must take id as its first
* argument). The caller is responsible for freeing the returned value. * argument). The caller is responsible for freeing the returned value.
*/ */
PUBLIC OBJC_PUBLIC
char *block_copyIMPTypeEncoding_np(void*block); char *block_copyIMPTypeEncoding_np(void*block);
/** /**
* Returns the block that was used in an IMP created by * Returns the block that was used in an IMP created by
* imp_implementationWithBlock(). The result of calling this function with any * imp_implementationWithBlock(). The result of calling this function with any
* other IMP is undefined. * other IMP is undefined.
*/ */
PUBLIC OBJC_PUBLIC
void *imp_getBlock(IMP anImp); void *imp_getBlock(IMP anImp);
/** /**
* Removes a block that was converted to an IMP with * Removes a block that was converted to an IMP with
* imp_implementationWithBlock(). The result of calling this function with any * imp_implementationWithBlock(). The result of calling this function with any
* other IMP is undefined. Returns YES on success, NO on failure. * other IMP is undefined. Returns YES on success, NO on failure.
*/ */
PUBLIC OBJC_PUBLIC
BOOL imp_removeBlock(IMP anImp); BOOL imp_removeBlock(IMP anImp);
/** /**
* Adds a method to a specific object, This method will not be added to any * Adds a method to a specific object, This method will not be added to any
* other instances of the same class. * other instances of the same class.
*/ */
PUBLIC OBJC_PUBLIC
BOOL object_addMethod_np(id object, SEL name, IMP imp, const char *types); BOOL object_addMethod_np(id object, SEL name, IMP imp, const char *types);
/** /**
* Replaces a method on a specific object, This method will not be added to * Replaces a method on a specific object, This method will not be added to
* any other instances of the same class. * any other instances of the same class.
*/ */
PUBLIC OBJC_PUBLIC
IMP object_replaceMethod_np(id object, SEL name, IMP imp, const char *types); IMP object_replaceMethod_np(id object, SEL name, IMP imp, const char *types);
/** /**
* Creates a clone, in the JavaScript sense - an object which inherits both * Creates a clone, in the JavaScript sense - an object which inherits both
* associated references and methods from the original object. * associated references and methods from the original object.
*/ */
PUBLIC OBJC_PUBLIC
id object_clone_np(id object); id object_clone_np(id object);
/** /**
* Returns the prototype of the object if it was created with * Returns the prototype of the object if it was created with
* object_clone_np(), or nil otherwise. * object_clone_np(), or nil otherwise.
*/ */
PUBLIC OBJC_PUBLIC
id object_getPrototype_np(id object); id object_getPrototype_np(id object);
/** /**
@ -1147,7 +1147,7 @@ id object_getPrototype_np(id object);
* This currently sets a global value. In the future, it may be configurable * This currently sets a global value. In the future, it may be configurable
* on a per-thread basis. * on a per-thread basis.
*/ */
PUBLIC OBJC_PUBLIC
int objc_set_apple_compatible_objcxx_exceptions(int newValue) OBJC_NONPORTABLE; int objc_set_apple_compatible_objcxx_exceptions(int newValue) OBJC_NONPORTABLE;

@ -23,7 +23,7 @@ struct objc_slot2
* invalid, for example if a subclass loads a category containing methods that * invalid, for example if a subclass loads a category containing methods that
* were inherited from the superclass. * were inherited from the superclass.
*/ */
PUBLIC extern _Atomic(uint64_t) objc_method_cache_version; OBJC_PUBLIC extern _Atomic(uint64_t) objc_method_cache_version;
/** /**
* Legacy cache structure. This is no longer maintained in the runtime and is * Legacy cache structure. This is no longer maintained in the runtime and is

@ -18,7 +18,7 @@ PRIVATE int spinlocks[spinlock_count];
/** /**
* Public function for getting a property. * Public function for getting a property.
*/ */
PUBLIC OBJC_PUBLIC
id objc_getProperty(id obj, SEL _cmd, ptrdiff_t offset, BOOL isAtomic) id objc_getProperty(id obj, SEL _cmd, ptrdiff_t offset, BOOL isAtomic)
{ {
if (nil == obj) { return nil; } if (nil == obj) { return nil; }
@ -46,7 +46,7 @@ id objc_getProperty(id obj, SEL _cmd, ptrdiff_t offset, BOOL isAtomic)
return ret; return ret;
} }
PUBLIC OBJC_PUBLIC
void objc_setProperty(id obj, SEL _cmd, ptrdiff_t offset, id arg, BOOL isAtomic, BOOL isCopy) void objc_setProperty(id obj, SEL _cmd, ptrdiff_t offset, id arg, BOOL isAtomic, BOOL isCopy)
{ {
if (nil == obj) { return; } if (nil == obj) { return; }
@ -87,7 +87,7 @@ void objc_setProperty(id obj, SEL _cmd, ptrdiff_t offset, id arg, BOOL isAtomic,
objc_release(old); objc_release(old);
} }
PUBLIC OBJC_PUBLIC
void objc_setProperty_atomic(id obj, SEL _cmd, id arg, ptrdiff_t offset) void objc_setProperty_atomic(id obj, SEL _cmd, id arg, ptrdiff_t offset)
{ {
char *addr = (char*)obj; char *addr = (char*)obj;
@ -101,7 +101,7 @@ void objc_setProperty_atomic(id obj, SEL _cmd, id arg, ptrdiff_t offset)
objc_release(old); objc_release(old);
} }
PUBLIC OBJC_PUBLIC
void objc_setProperty_atomic_copy(id obj, SEL _cmd, id arg, ptrdiff_t offset) void objc_setProperty_atomic_copy(id obj, SEL _cmd, id arg, ptrdiff_t offset)
{ {
char *addr = (char*)obj; char *addr = (char*)obj;
@ -116,7 +116,7 @@ void objc_setProperty_atomic_copy(id obj, SEL _cmd, id arg, ptrdiff_t offset)
objc_release(old); objc_release(old);
} }
PUBLIC OBJC_PUBLIC
void objc_setProperty_nonatomic(id obj, SEL _cmd, id arg, ptrdiff_t offset) void objc_setProperty_nonatomic(id obj, SEL _cmd, id arg, ptrdiff_t offset)
{ {
char *addr = (char*)obj; char *addr = (char*)obj;
@ -127,7 +127,7 @@ void objc_setProperty_nonatomic(id obj, SEL _cmd, id arg, ptrdiff_t offset)
objc_release(old); objc_release(old);
} }
PUBLIC OBJC_PUBLIC
void objc_setProperty_nonatomic_copy(id obj, SEL _cmd, id arg, ptrdiff_t offset) void objc_setProperty_nonatomic_copy(id obj, SEL _cmd, id arg, ptrdiff_t offset)
{ {
char *addr = (char*)obj; char *addr = (char*)obj;
@ -137,7 +137,7 @@ void objc_setProperty_nonatomic_copy(id obj, SEL _cmd, id arg, ptrdiff_t offset)
objc_release(old); objc_release(old);
} }
PUBLIC OBJC_PUBLIC
void objc_copyCppObjectAtomic(void *dest, const void *src, void objc_copyCppObjectAtomic(void *dest, const void *src,
void (*copyHelper) (void *dest, const void *source)) void (*copyHelper) (void *dest, const void *source))
{ {
@ -150,7 +150,7 @@ void objc_copyCppObjectAtomic(void *dest, const void *src,
unlock_spinlock(lock2); unlock_spinlock(lock2);
} }
PUBLIC OBJC_PUBLIC
void objc_getCppObjectAtomic(void *dest, const void *src, void objc_getCppObjectAtomic(void *dest, const void *src,
void (*copyHelper) (void *dest, const void *source)) void (*copyHelper) (void *dest, const void *source))
{ {
@ -160,7 +160,7 @@ void objc_getCppObjectAtomic(void *dest, const void *src,
unlock_spinlock(lock); unlock_spinlock(lock);
} }
PUBLIC OBJC_PUBLIC
void objc_setCppObjectAtomic(void *dest, const void *src, void objc_setCppObjectAtomic(void *dest, const void *src,
void (*copyHelper) (void *dest, const void *source)) void (*copyHelper) (void *dest, const void *source))
{ {
@ -177,7 +177,7 @@ void objc_setCppObjectAtomic(void *dest, const void *src,
* pointers corresponds to the object, which causes some excessive locking to * pointers corresponds to the object, which causes some excessive locking to
* be needed. * be needed.
*/ */
PUBLIC OBJC_PUBLIC
void objc_copyPropertyStruct(void *dest, void objc_copyPropertyStruct(void *dest,
void *src, void *src,
ptrdiff_t size, ptrdiff_t size,
@ -204,7 +204,7 @@ void objc_copyPropertyStruct(void *dest,
* Get property structure function. Copies a structure from an ivar to another * Get property structure function. Copies a structure from an ivar to another
* variable. Locks on the address of src. * variable. Locks on the address of src.
*/ */
PUBLIC OBJC_PUBLIC
void objc_getPropertyStruct(void *dest, void objc_getPropertyStruct(void *dest,
void *src, void *src,
ptrdiff_t size, ptrdiff_t size,
@ -228,7 +228,7 @@ void objc_getPropertyStruct(void *dest,
* Set property structure function. Copes a structure to an ivar. Locks on * Set property structure function. Copes a structure to an ivar. Locks on
* dest. * dest.
*/ */
PUBLIC OBJC_PUBLIC
void objc_setPropertyStruct(void *dest, void objc_setPropertyStruct(void *dest,
void *src, void *src,
ptrdiff_t size, ptrdiff_t size,
@ -249,7 +249,7 @@ void objc_setPropertyStruct(void *dest,
} }
PUBLIC OBJC_PUBLIC
objc_property_t class_getProperty(Class cls, const char *name) objc_property_t class_getProperty(Class cls, const char *name)
{ {
if (Nil == cls) if (Nil == cls)
@ -272,7 +272,7 @@ objc_property_t class_getProperty(Class cls, const char *name)
return NULL; return NULL;
} }
PUBLIC OBJC_PUBLIC
objc_property_t* class_copyPropertyList(Class cls, unsigned int *outCount) objc_property_t* class_copyPropertyList(Class cls, unsigned int *outCount)
{ {
if (Nil == cls) if (Nil == cls)
@ -327,7 +327,7 @@ static const char* property_getIVar(objc_property_t property)
return 0; return 0;
} }
PUBLIC OBJC_PUBLIC
const char *property_getName(objc_property_t property) const char *property_getName(objc_property_t property)
{ {
if (NULL == property) { return NULL; } if (NULL == property) { return NULL; }
@ -352,7 +352,7 @@ static const char *property_getTypeEncoding(objc_property_t property)
return property->type; return property->type;
} }
PUBLIC OBJC_PUBLIC
const char *property_getAttributes(objc_property_t property) const char *property_getAttributes(objc_property_t property)
{ {
if (NULL == property) { return NULL; } if (NULL == property) { return NULL; }
@ -360,7 +360,7 @@ const char *property_getAttributes(objc_property_t property)
} }
PUBLIC OBJC_PUBLIC
objc_property_attribute_t *property_copyAttributeList(objc_property_t property, objc_property_attribute_t *property_copyAttributeList(objc_property_t property,
unsigned int *outCount) unsigned int *outCount)
{ {
@ -551,7 +551,7 @@ PRIVATE struct objc_property propertyFromAttrs(const objc_property_attribute_t *
} }
PUBLIC OBJC_PUBLIC
BOOL class_addProperty(Class cls, BOOL class_addProperty(Class cls,
const char *name, const char *name,
const objc_property_attribute_t *attributes, const objc_property_attribute_t *attributes,
@ -572,7 +572,7 @@ BOOL class_addProperty(Class cls,
return YES; return YES;
} }
PUBLIC OBJC_PUBLIC
void class_replaceProperty(Class cls, void class_replaceProperty(Class cls,
const char *name, const char *name,
const objc_property_attribute_t *attributes, const objc_property_attribute_t *attributes,
@ -589,7 +589,7 @@ void class_replaceProperty(Class cls,
LOCK_RUNTIME_FOR_SCOPE(); LOCK_RUNTIME_FOR_SCOPE();
memcpy(old, &p, sizeof(struct objc_property)); memcpy(old, &p, sizeof(struct objc_property));
} }
PUBLIC OBJC_PUBLIC
char *property_copyAttributeValue(objc_property_t property, char *property_copyAttributeValue(objc_property_t property,
const char *attributeName) const char *attributeName)
{ {

@ -8,7 +8,7 @@
#ifdef NO_LEGACY #ifdef NO_LEGACY
# define LEGACY PRIVATE # define LEGACY PRIVATE
#else #else
# define LEGACY PUBLIC # define LEGACY OBJC_PUBLIC
#endif #endif
#if defined(DEBUG) || (!defined(__clang__)) #if defined(DEBUG) || (!defined(__clang__))

Loading…
Cancel
Save