123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370 |
- #ifndef _OBJC_MESSAGE_H
- #define _OBJC_MESSAGE_H
- #include <objc/objc.h>
- #include <objc/runtime.h>
- #ifndef OBJC_SUPER
- #define OBJC_SUPER
- struct objc_super {
-
- __unsafe_unretained _Nonnull id receiver;
-
- #if !defined(__cplusplus) && !__OBJC2__
-
- __unsafe_unretained _Nonnull Class class;
- #else
- __unsafe_unretained _Nonnull Class super_class;
- #endif
-
- };
- #endif
- #if !OBJC_OLD_DISPATCH_PROTOTYPES
- OBJC_EXPORT void
- objc_msgSend(void )
- OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
- OBJC_EXPORT void
- objc_msgSendSuper(void )
- OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
- #else
- OBJC_EXPORT id _Nullable
- objc_msgSend(id _Nullable self, SEL _Nonnull op, ...)
- OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
- OBJC_EXPORT id _Nullable
- objc_msgSendSuper(struct objc_super * _Nonnull super, SEL _Nonnull op, ...)
- OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
- #endif
- #if !OBJC_OLD_DISPATCH_PROTOTYPES
- OBJC_EXPORT void
- objc_msgSend_stret(void )
- OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
- OBJC_ARM64_UNAVAILABLE;
- OBJC_EXPORT void
- objc_msgSendSuper_stret(void )
- OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
- OBJC_ARM64_UNAVAILABLE;
- #else
- OBJC_EXPORT void
- objc_msgSend_stret(id _Nullable self, SEL _Nonnull op, ...)
- OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
- OBJC_ARM64_UNAVAILABLE;
- OBJC_EXPORT void
- objc_msgSendSuper_stret(struct objc_super * _Nonnull super,
- SEL _Nonnull op, ...)
- OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
- OBJC_ARM64_UNAVAILABLE;
- #endif
- #if !OBJC_OLD_DISPATCH_PROTOTYPES
- # if defined(__i386__)
- OBJC_EXPORT void
- objc_msgSend_fpret(void )
- OBJC_AVAILABLE(10.4, 2.0, 9.0, 1.0, 2.0);
- # elif defined(__x86_64__)
- OBJC_EXPORT void
- objc_msgSend_fpret(void )
- OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
- OBJC_EXPORT void
- objc_msgSend_fp2ret(void )
- OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
- # endif
- #else
- # if defined(__i386__)
- OBJC_EXPORT double
- objc_msgSend_fpret(id _Nullable self, SEL _Nonnull op, ...)
- OBJC_AVAILABLE(10.4, 2.0, 9.0, 1.0, 2.0);
- # elif defined(__x86_64__)
- OBJC_EXPORT long double
- objc_msgSend_fpret(id _Nullable self, SEL _Nonnull op, ...)
- OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
- # if __STDC_VERSION__ >= 199901L
- OBJC_EXPORT _Complex long double
- objc_msgSend_fp2ret(id _Nullable self, SEL _Nonnull op, ...)
- OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
- # else
- OBJC_EXPORT void objc_msgSend_fp2ret(id _Nullable self, SEL _Nonnull op, ...)
- OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
- # endif
- # endif
- #endif
- #if !OBJC_OLD_DISPATCH_PROTOTYPES
- OBJC_EXPORT void
- method_invoke(void )
- OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
- OBJC_EXPORT void
- method_invoke_stret(void )
- OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0)
- OBJC_ARM64_UNAVAILABLE;
- #else
- OBJC_EXPORT id _Nullable
- method_invoke(id _Nullable receiver, Method _Nonnull m, ...)
- OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
- OBJC_EXPORT void
- method_invoke_stret(id _Nullable receiver, Method _Nonnull m, ...)
- OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0)
- OBJC_ARM64_UNAVAILABLE;
- #endif
- #if !OBJC_OLD_DISPATCH_PROTOTYPES
- OBJC_EXPORT void
- _objc_msgForward(void )
- OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
- OBJC_EXPORT void
- _objc_msgForward_stret(void )
- OBJC_AVAILABLE(10.6, 3.0, 9.0, 1.0, 2.0)
- OBJC_ARM64_UNAVAILABLE;
- #else
- OBJC_EXPORT id _Nullable
- _objc_msgForward(id _Nonnull receiver, SEL _Nonnull sel, ...)
- OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
- OBJC_EXPORT void
- _objc_msgForward_stret(id _Nonnull receiver, SEL _Nonnull sel, ...)
- OBJC_AVAILABLE(10.6, 3.0, 9.0, 1.0, 2.0)
- OBJC_ARM64_UNAVAILABLE;
- #endif
- typedef void* marg_list;
- OBJC_EXPORT id _Nullable
- objc_msgSendv(id _Nullable self, SEL _Nonnull op, size_t arg_size,
- marg_list _Nonnull arg_frame)
- OBJC2_UNAVAILABLE;
- OBJC_EXPORT void
- objc_msgSendv_stret(void * _Nonnull stretAddr, id _Nullable self,
- SEL _Nonnull op, size_t arg_size,
- marg_list _Nullable arg_frame)
- OBJC2_UNAVAILABLE;
- #if defined(__i386__)
- OBJC_EXPORT double
- objc_msgSendv_fpret(id _Nullable self, SEL _Nonnull op,
- unsigned arg_size, marg_list _Nullable arg_frame)
- OBJC2_UNAVAILABLE;
- #endif
- #if !__OBJC2__
- #define marg_prearg_size 0
- #define marg_malloc(margs, method) \
- do { \
- margs = (marg_list *)malloc (marg_prearg_size + ((7 + method_getSizeOfArguments(method)) & ~7)); \
- } while (0)
- #define marg_free(margs) \
- do { \
- free(margs); \
- } while (0)
-
- #define marg_adjustedOffset(method, offset) \
- (marg_prearg_size + offset)
- #define marg_getRef(margs, offset, type) \
- ( (type *)((char *)margs + marg_adjustedOffset(method,offset) ) )
- #define marg_getValue(margs, offset, type) \
- ( *marg_getRef(margs, offset, type) )
- #define marg_setValue(margs, offset, type, value) \
- ( marg_getValue(margs, offset, type) = (value) )
- #endif
- #endif
|