From 7cea2578637b823e93798e308ab0811c7fd7b7a4 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Mon, 28 Jan 2008 19:17:00 +0100 Subject: Directory layout: Put code imported from PyObjC into its own directory. darcs-hash:e3dd1138105e4eece0fbcbc13365eb3a25ffb808 --- Objective-C/objc-runtime-apple.h | 137 --------------------------------------- 1 file changed, 137 deletions(-) delete mode 100644 Objective-C/objc-runtime-apple.h (limited to 'Objective-C/objc-runtime-apple.h') diff --git a/Objective-C/objc-runtime-apple.h b/Objective-C/objc-runtime-apple.h deleted file mode 100644 index 8d050a1..0000000 --- a/Objective-C/objc-runtime-apple.h +++ /dev/null @@ -1,137 +0,0 @@ -/* Copyright (c) 1996,97,98 by Lele Gaifax. All Rights Reserved - * Copyright (c) 2003 Ronald Oussoren - * - * This software may be used and distributed freely for any purpose - * provided that this notice is included unchanged on any and all - * copies. The author does not warrant or guarantee this software in - * any way. - * - * This file is part of the PyObjC package. - * - * RCSfile: objc_support.h,v - * Revision: 1.16 - * Date: 1998/08/18 15:35:57 - * - * Created Tue Sep 10 14:11:38 1996. - */ - -#ifndef PyObjC_RUNTIME_APPLE_H -#define PyObjC_RUNTIME_APPLE_H - -#import -#import - -#include -#include - -#include -#include -#include -#include - -static inline int -PyObjCRT_SameSEL(SEL a, SEL b) -{ - return a == b; -} - -static inline const char* -PyObjCRT_SELName(SEL sel) -{ - return sel_getName(sel); -} - -static inline SEL -PyObjCRT_SELUID(const char* str) -{ - return sel_getUid(str); -} - -static inline Class -PyObjCRT_LookUpClass(const char* name) -{ - return objc_lookUpClass(name); -} - -static inline struct objc_method_list * -PyObjCRT_NextMethodList(Class c, void ** p) -{ - return class_nextMethodList(c, p); -} - -static inline void -PyObjCRT_InitMethod(Method m, SEL name, const char* types, IMP imp) -{ - memset(m, 0, sizeof(*m)); - m->method_name = name; - m->method_types = strdup((char*)types); - m->method_imp = imp; -} - -static inline void -PyObjCRT_ClassAddMethodList(Class cls, struct objc_method_list* lst) -{ - class_addMethods(cls, lst); -} - - -extern struct objc_method_list* PyObjCRT_AllocMethodList(ssize_t); -extern struct objc_protocol_list* PyObjCRT_AllocProtocolList(ssize_t); - -typedef Method PyObjCRT_Method_t; -typedef Ivar PyObjCRT_Ivar_t; - -#define GETISA(c) ((c)->isa) - -#define RECEIVER(c) ((c).receiver) - -#define _C_CONST 'r' -#define _C_IN 'n' -#define _C_INOUT 'N' -#define _C_OUT 'o' -#define _C_BYCOPY 'O' -#define _C_ONEWAY 'V' -#define _C_LNGLNG 'q' -#define _C_ULNGLNG 'Q' -#define _C_BOOL 'B' /* (Objective-)C++ 'bool' */ - - -/* Return a number that is likely to change when the method list changes, - * and is cheap to compute. - */ -static inline int -objc_methodlist_magic(Class cls) -{ - int res = 0; - int cnt = 0; - - /* This is the documented way of enumerating the method list. It - * is slower than the obvious way, but does not explode under - * esoteric situations. - */ - void *iterator = NULL; - struct objc_method_list *mlist; - - if (cls == NULL) return -1; - - while ( (mlist = class_nextMethodList( cls, &iterator )) != NULL ) { - res += mlist->method_count; - cnt++; - } - - return (cnt << 16) | (res & 0xFFFF); -} - -static inline const char * -get_selector_encoding (id self, SEL sel) -{ - struct objc_method* m = class_getInstanceMethod(self->isa, sel); - - if (!m) { - return NULL; - } else { - return m->method_types; - } -} - -#endif /* PyObjC_RUNTIME_APPLE_H */ -- cgit v1.2.3