Commits

Ronald Oussoren committed ff29c08

pyobjc-core now compiles on Tiger, and for the most part passes
unittests.

There are some issues, but most are a known issue (BOOL vs. bool on PPC),
one needs further research and one seems to be a buggy testcase.

Comments (0)

Files changed (7)

pyobjc-core/Modules/objc/libffi_support.h

 #ifndef PyObjC_FFI_SUPPORT_H
 #define PyObjC_FFI_SUPPORT_H
 
-#include "ffi/ffi.h"
+#include "ffi.h"
 
 #ifndef FFI_CLOSURES
 #    error "Need FFI_CLOSURES!"

pyobjc-core/Modules/objc/libffi_support.m

 	volatile int      useStret;
 	volatile int      flags;
 	SEL		  theSel;
-	int		  isUninitialized;
+	volatile int		  isUninitialized;
 	BOOL		  variadicAllArgs = NO;
 
 	/* True iff output arguments are also in the argument list */

pyobjc-core/Modules/objc/objc-runtime-compat.h

 extern Ivar* (*PyObjC_class_copyIvarList)(Class, unsigned int*);
 extern Protocol** (*PyObjC_class_copyProtocolList)(Class, unsigned int*);
 
+extern BOOL (*PyObjC_class_isMetaClass)(Class);
+
 extern SEL (*PyObjC_method_getName)(Method m);
 extern const char *(*PyObjC_method_getTypeEncoding)(Method m);
 extern IMP (*PyObjC_method_getImplementation)(Method m);
 #define class_copyIvarList		PyObjC_class_copyIvarList
 #define class_copyProtocolList		PyObjC_class_copyProtocolList
 #define class_conformsToProtocol	PyObjC_class_conformsToProtocol
+#define class_isMetaClass		PyObjC_class_isMetaClass
 
 #define method_getName 			PyObjC_method_getName
 #define method_getTypeEncoding   	PyObjC_method_getTypeEncoding

pyobjc-core/Modules/objc/objc-runtime-compat.m

 }
 #endif
 
+static BOOL
+compat_class_isMetaClass(Class cls)
+{
+	return CLS_GETINFO(cls, CLS_META) == CLS_META;
+}
+
 static BOOL 
 compat_class_addMethodList(Class cls,
 		struct PyObjC_method* list, unsigned int count)
 		struct PyObjC_method*, unsigned int) = NULL;
 Ivar* (*PyObjC_class_copyIvarList)(Class, unsigned int*) = NULL;
 Protocol** (*PyObjC_class_copyProtocolList)(Class, unsigned int*) = NULL;
+BOOL (*PyObjC_class_isMetaClass)(Class) = NULL;
 
 SEL (*PyObjC_method_getName)(Method m) = NULL;
 IMP (*PyObjC_method_getImplementation)(Method m) = NULL;
 	SETUP(class_copyProtocolList);
 	SETUP(class_copyMethodList);
 	SETUP(class_getName);
+	SETUP(class_isMetaClass);
 
 	SETUP(method_getName);
 	SETUP(method_getTypeEncoding);

pyobjc-core/Modules/objc/pyobjc-api.h

 #endif
 #endif
 
+#ifndef NSUInteger
+# define NSUInteger unsigned int
+#endif
+#ifndef NSInteger
+# define NSInteger int
+#endif
+
 
 #import <Foundation/NSException.h>
 
 
 
 /* threading support */
-#if 0
+#ifdef NO_OBJC2_RUNTIME
 #define PyObjC_DURING \
 		Py_BEGIN_ALLOW_THREADS \
 		NS_DURING

pyobjc-core/libffi-src/powerpc/ppc-ffi_darwin.c

 #include "ppc-darwin.h"
 #include <architecture/ppc/mode_independent_asm.h>
 
+#if 0
 #if defined(POWERPC_DARWIN)
 #include <libkern/OSCacheControl.h>	// for sys_icache_invalidate()
 #endif
 
+#else 
+
+/* Explicit prototype instead of including a header to allow compilation
+ * on Tiger systems.
+ */
+
+#pragma weak sys_icache_invalidate
+extern void sys_icache_invalidate(void *start, size_t len);
+
+#endif
+
 extern void ffi_closure_ASM(void);
 
 // The layout of a function descriptor.  A C function pointer really
 
 			// Flush the icache. Only necessary on Darwin.
 #if defined(POWERPC_DARWIN)
-			sys_icache_invalidate(closure->tramp, FFI_TRAMPOLINE_SIZE);
+			if (sys_icache_invalidate) {
+				sys_icache_invalidate(closure->tramp, FFI_TRAMPOLINE_SIZE);
+			}
 #else
 			flush_range(closure->tramp, FFI_TRAMPOLINE_SIZE);
 #endif

pyobjc-core/setup.py

 
 EXTRA_SOURCE = FFI_SOURCE
 EXTRA_CFLAGS = FFI_CFLAGS
-#EXTRA_SOURCE = []
-#EXTRA_CFLAGS = []
 
 CorePackages = [ 'objc' ]
 objcExtension = Extension("objc._objc",