Commits

Ronald Oussoren committed 58125da

* Change code to avoid compiler warnings on ppc32
* Add ffi testcases that show a bad interaction
between libffi and exceptions on PPC64.

  • Participants
  • Parent commits dce6d1c
  • Branches pyobjc-ancient

Comments (0)

Files changed (20)

File pyobjc-core/Modules/objc/libffi_support.h

 #ifndef PyObjC_FFI_SUPPORT_H
 #define PyObjC_FFI_SUPPORT_H
 
-#ifdef WITH_SYSTEM_FFI
-#include <ffi/ffi.h>
-#else
-#include "ffi.h"
-#endif
+#include "ffi/ffi.h"
 
 #ifndef FFI_CLOSURES
 #    error "Need FFI_CLOSURES!"

File pyobjc-core/Modules/objc/objc_super.m

 	PyType_GenericAlloc,			/* tp_alloc */
 	PyType_GenericNew,			/* tp_new */
 	PyObject_GC_Del,        		/* tp_free */
-	1,					/* tp_is_gc */
 };

File pyobjc-core/libffi-src/include/ffi.h

-/* -----------------------------------------------------------------*-C-*-
-   libffi PyOBJC - Copyright (c) 1996-2003  Red Hat, Inc.
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   ``Software''), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be included
-   in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
-
-   ----------------------------------------------------------------------- */
-
-/* -------------------------------------------------------------------
-   The basic API is described in the README file.
-
-   The raw API is designed to bypass some of the argument packing
-   and unpacking on architectures for which it can be avoided.
-
-   The closure API allows interpreted functions to be packaged up
-   inside a C function pointer, so that they can be called as C functions,
-   with no understanding on the client side that they are interpreted.
-   It can also be used in other cases in which it is necessary to package
-   up a user specified parameter and a function pointer as a single
-   function pointer.
-
-   The closure API must be implemented in order to get its functionality,
-   e.g. for use by gij.  Routines are provided to emulate the raw API
-   if the underlying platform doesn't allow faster implementation.
-
-   More details on the raw and closure API can be found in:
-
-   http://gcc.gnu.org/ml/java/1999-q3/msg00138.html
-
-   and
-
-   http://gcc.gnu.org/ml/java/1999-q3/msg00174.html
-   -------------------------------------------------------------------- */
-
-#ifndef LIBFFI_H
-#define LIBFFI_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*	Specify which architecture libffi is configured for. */
-#ifdef MACOSX
-#	if defined(__i386__) || defined(__x86_64__)
-#		define X86_DARWIN
-#	elif defined(__ppc__) || defined(__ppc64__)
-#		define POWERPC_DARWIN
-#	else
-#	error "Unsupported MacOS X CPU type"
-#	endif
-#else
-#error "Unsupported OS type"
-#endif
-
-/* ---- System configuration information --------------------------------- */
-
-#include "ffitarget.h"
-#include "fficonfig.h"
-
-#ifndef LIBFFI_ASM
-
-#include <stddef.h>
-#include <limits.h>
-
-/*	LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
-	But we can find it either under the correct ANSI name, or under GNU
-	C's internal name.  */
-#ifdef LONG_LONG_MAX
-#	define FFI_LONG_LONG_MAX LONG_LONG_MAX
-#else
-#	ifdef LLONG_MAX
-#		define FFI_LONG_LONG_MAX LLONG_MAX
-#	else
-#		ifdef __GNUC__
-#			define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
-#		endif
-#	endif
-#endif
-
-#if SCHAR_MAX == 127
-#	define ffi_type_uchar	ffi_type_uint8
-#	define ffi_type_schar	ffi_type_sint8
-#else
-#error "char size not supported"
-#endif
-
-#if SHRT_MAX == 32767
-#	define ffi_type_ushort	ffi_type_uint16
-#	define ffi_type_sshort	ffi_type_sint16
-#elif SHRT_MAX == 2147483647
-#	define ffi_type_ushort	ffi_type_uint32
-#	define ffi_type_sshort	ffi_type_sint32
-#else
-#error "short size not supported"
-#endif
-
-#if INT_MAX == 32767
-#	define ffi_type_uint	ffi_type_uint16
-#	define ffi_type_sint	ffi_type_sint16
-#elif INT_MAX == 2147483647
-#	define ffi_type_uint	ffi_type_uint32
-#	define ffi_type_sint	ffi_type_sint32
-#elif INT_MAX == 9223372036854775807
-#	define ffi_type_uint	ffi_type_uint64
-#	define ffi_type_sint	ffi_type_sint64
-#else
-#error "int size not supported"
-#endif
-
-#define ffi_type_ulong	ffi_type_uint64
-#define ffi_type_slong	ffi_type_sint64
-
-#if LONG_MAX == 2147483647
-#	if FFI_LONG_LONG_MAX != 9223372036854775807
-#		error "no 64-bit data type supported"
-#	endif
-#elif LONG_MAX != 9223372036854775807
-#error "long size not supported"
-#endif
-
-/*	The closure code assumes that this works on pointers, i.e. a size_t
-	can hold a pointer.	*/
-
-typedef struct _ffi_type {
-			size_t				size;
-			unsigned short		alignment;
-			unsigned short		type;
-/*@null@*/	struct _ffi_type**	elements;
-} ffi_type;
-
-/*	These are defined in types.c */
-extern ffi_type	ffi_type_void;
-extern ffi_type	ffi_type_uint8;
-extern ffi_type	ffi_type_sint8;
-extern ffi_type	ffi_type_uint16;
-extern ffi_type	ffi_type_sint16;
-extern ffi_type	ffi_type_uint32;
-extern ffi_type	ffi_type_sint32;
-extern ffi_type	ffi_type_uint64;
-extern ffi_type	ffi_type_sint64;
-extern ffi_type	ffi_type_float;
-extern ffi_type	ffi_type_double;
-extern ffi_type	ffi_type_longdouble;
-extern ffi_type	ffi_type_pointer;
-
-typedef enum ffi_status {
-	FFI_OK = 0,
-	FFI_BAD_TYPEDEF,
-	FFI_BAD_ABI
-} ffi_status;
-
-typedef unsigned	FFI_TYPE;
-
-typedef struct	ffi_cif {
-				ffi_abi		abi;
-				unsigned	nargs;
-/*@dependent@*/	ffi_type**	arg_types;
-/*@dependent@*/	ffi_type*	rtype;
-				unsigned	bytes;
-				unsigned	flags;
-#ifdef FFI_EXTRA_CIF_FIELDS
-				FFI_EXTRA_CIF_FIELDS;
-#endif
-} ffi_cif;
-
-/* ---- Definitions for the raw API -------------------------------------- */
-
-#ifndef FFI_SIZEOF_ARG
-#	if LONG_MAX == 2147483647
-#		define FFI_SIZEOF_ARG	4
-#	elif LONG_MAX == 9223372036854775807
-#		define FFI_SIZEOF_ARG	8
-#	endif
-#endif
-
-typedef union {
-	ffi_sarg	sint;
-	ffi_arg		uint;
-	float		flt;
-	char		data[FFI_SIZEOF_ARG];
-	void*		ptr;
-} ffi_raw;
-
-void
-ffi_raw_call(
-/*@dependent@*/	ffi_cif*	cif, 
-				void		(*fn)(void), 
-/*@out@*/		void*		rvalue, 
-/*@dependent@*/	ffi_raw*	avalue);
-
-void
-ffi_ptrarray_to_raw(
-	ffi_cif*	cif,
-	void**		args,
-	ffi_raw*	raw);
-
-void
-ffi_raw_to_ptrarray(
-	ffi_cif*	cif,
-	ffi_raw*	raw,
-	void**		args);
-
-size_t
-ffi_raw_size(
-	ffi_cif*	cif);
-
-/*	This is analogous to the raw API, except it uses Java parameter
-	packing, even on 64-bit machines.  I.e. on 64-bit machines
-	longs and doubles are followed by an empty 64-bit word.	*/
-void
-ffi_java_raw_call(
-/*@dependent@*/	ffi_cif*	cif, 
-				void		(*fn)(void), 
-/*@out@*/		void*		rvalue, 
-/*@dependent@*/	ffi_raw*	avalue);
-
-void
-ffi_java_ptrarray_to_raw(
-	ffi_cif*	cif,
-	void**		args,
-	ffi_raw*	raw);
-
-void
-ffi_java_raw_to_ptrarray(
-	ffi_cif*	cif,
-	ffi_raw*	raw,
-	void**		args);
-
-size_t
-ffi_java_raw_size(
-	ffi_cif*	cif);
-
-/* ---- Definitions for closures ----------------------------------------- */
-
-#if FFI_CLOSURES
-
-typedef struct ffi_closure {
-	char		tramp[FFI_TRAMPOLINE_SIZE];
-	ffi_cif*	cif;
-	void		(*fun)(ffi_cif*,void*,void**,void*);
-	void*		user_data;
-} ffi_closure;
-
-ffi_status
-ffi_prep_closure(
-	ffi_closure*	closure,
-	ffi_cif*		cif,
-	void			(*fun)(ffi_cif*,void*,void**,void*),
-	void*			user_data);
-
-typedef struct ffi_raw_closure {
-	char		tramp[FFI_TRAMPOLINE_SIZE];
-	ffi_cif*	cif;
-
-#if !FFI_NATIVE_RAW_API
-	/*	if this is enabled, then a raw closure has the same layout 
-		as a regular closure.  We use this to install an intermediate 
-		handler to do the transaltion, void** -> ffi_raw*. */
-	void	(*translate_args)(ffi_cif*,void*,void**,void*);
-	void*	this_closure;
-#endif
-
-	void	(*fun)(ffi_cif*,void*,ffi_raw*,void*);
-	void*	user_data;
-} ffi_raw_closure;
-
-ffi_status
-ffi_prep_raw_closure(
-	ffi_raw_closure*	closure,
-	ffi_cif*			cif,
-	void				(*fun)(ffi_cif*,void*,ffi_raw*,void*),
-	void*				user_data);
-
-ffi_status
-ffi_prep_java_raw_closure(
-	ffi_raw_closure*	closure,
-	ffi_cif*			cif,
-	void				(*fun)(ffi_cif*,void*,ffi_raw*,void*),
-	void*				user_data);
-
-#endif	// FFI_CLOSURES
-
-/* ---- Public interface definition -------------------------------------- */
-
-ffi_status
-ffi_prep_cif(
-/*@out@*/ /*@partial@*/					ffi_cif*		cif, 
-										ffi_abi			abi,
-										unsigned int	nargs, 
-/*@dependent@*/ /*@out@*/ /*@partial@*/	ffi_type*		rtype, 
-/*@dependent@*/							ffi_type**		atypes);
-
-void
-ffi_call(
-/*@dependent@*/	ffi_cif*	cif, 
-				void		(*fn)(void), 
-/*@out@*/		void*		rvalue, 
-/*@dependent@*/	void**		avalue);
-
-/* Useful for eliminating compiler warnings */
-#define FFI_FN(f) ((void (*)(void))f)
-
-#endif	// #ifndef LIBFFI_ASM
-/* ---- Definitions shared with assembly code ---------------------------- */
-
-/*	If these change, update src/mips/ffitarget.h. */
-#define FFI_TYPE_VOID       0
-#define FFI_TYPE_INT        1
-#define FFI_TYPE_FLOAT      2
-#define FFI_TYPE_DOUBLE     3
-
-#ifdef HAVE_LONG_DOUBLE
-#	define FFI_TYPE_LONGDOUBLE 4
-#else
-#	define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
-#endif
-
-#define FFI_TYPE_UINT8      5
-#define FFI_TYPE_SINT8      6
-#define FFI_TYPE_UINT16     7
-#define FFI_TYPE_SINT16     8
-#define FFI_TYPE_UINT32     9
-#define FFI_TYPE_SINT32     10
-#define FFI_TYPE_UINT64     11
-#define FFI_TYPE_SINT64     12
-#define FFI_TYPE_STRUCT     13
-#define FFI_TYPE_POINTER    14
-
-/*	This should always refer to the last type code (for sanity checks) */
-#define FFI_TYPE_LAST       FFI_TYPE_POINTER
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif	// #ifndef LIBFFI_H

File pyobjc-core/libffi-src/include/ffi/ffi.h

+/* -----------------------------------------------------------------*-C-*-
+   libffi PyOBJC - Copyright (c) 1996-2003  Red Hat, Inc.
+
+   Permission is hereby granted, free of charge, to any person obtaining
+   a copy of this software and associated documentation files (the
+   ``Software''), to deal in the Software without restriction, including
+   without limitation the rights to use, copy, modify, merge, publish,
+   distribute, sublicense, and/or sell copies of the Software, and to
+   permit persons to whom the Software is furnished to do so, subject to
+   the following conditions:
+
+   The above copyright notice and this permission notice shall be included
+   in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+   OTHER DEALINGS IN THE SOFTWARE.
+
+   ----------------------------------------------------------------------- */
+
+/* -------------------------------------------------------------------
+   The basic API is described in the README file.
+
+   The raw API is designed to bypass some of the argument packing
+   and unpacking on architectures for which it can be avoided.
+
+   The closure API allows interpreted functions to be packaged up
+   inside a C function pointer, so that they can be called as C functions,
+   with no understanding on the client side that they are interpreted.
+   It can also be used in other cases in which it is necessary to package
+   up a user specified parameter and a function pointer as a single
+   function pointer.
+
+   The closure API must be implemented in order to get its functionality,
+   e.g. for use by gij.  Routines are provided to emulate the raw API
+   if the underlying platform doesn't allow faster implementation.
+
+   More details on the raw and closure API can be found in:
+
+   http://gcc.gnu.org/ml/java/1999-q3/msg00138.html
+
+   and
+
+   http://gcc.gnu.org/ml/java/1999-q3/msg00174.html
+   -------------------------------------------------------------------- */
+
+#ifndef LIBFFI_H
+#define LIBFFI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*	Specify which architecture libffi is configured for. */
+#ifdef MACOSX
+#	if defined(__i386__) || defined(__x86_64__)
+#		define X86_DARWIN
+#	elif defined(__ppc__) || defined(__ppc64__)
+#		define POWERPC_DARWIN
+#	else
+#	error "Unsupported MacOS X CPU type"
+#	endif
+#else
+#error "Unsupported OS type"
+#endif
+
+/* ---- System configuration information --------------------------------- */
+
+#include "ffitarget.h"
+#include "fficonfig.h"
+
+#ifndef LIBFFI_ASM
+
+#include <stddef.h>
+#include <limits.h>
+
+/*	LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
+	But we can find it either under the correct ANSI name, or under GNU
+	C's internal name.  */
+#ifdef LONG_LONG_MAX
+#	define FFI_LONG_LONG_MAX LONG_LONG_MAX
+#else
+#	ifdef LLONG_MAX
+#		define FFI_LONG_LONG_MAX LLONG_MAX
+#	else
+#		ifdef __GNUC__
+#			define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
+#		endif
+#	endif
+#endif
+
+#if SCHAR_MAX == 127
+#	define ffi_type_uchar	ffi_type_uint8
+#	define ffi_type_schar	ffi_type_sint8
+#else
+#error "char size not supported"
+#endif
+
+#if SHRT_MAX == 32767
+#	define ffi_type_ushort	ffi_type_uint16
+#	define ffi_type_sshort	ffi_type_sint16
+#elif SHRT_MAX == 2147483647
+#	define ffi_type_ushort	ffi_type_uint32
+#	define ffi_type_sshort	ffi_type_sint32
+#else
+#error "short size not supported"
+#endif
+
+#if INT_MAX == 32767
+#	define ffi_type_uint	ffi_type_uint16
+#	define ffi_type_sint	ffi_type_sint16
+#elif INT_MAX == 2147483647
+#	define ffi_type_uint	ffi_type_uint32
+#	define ffi_type_sint	ffi_type_sint32
+#elif INT_MAX == 9223372036854775807
+#	define ffi_type_uint	ffi_type_uint64
+#	define ffi_type_sint	ffi_type_sint64
+#else
+#error "int size not supported"
+#endif
+
+#define ffi_type_ulong	ffi_type_uint64
+#define ffi_type_slong	ffi_type_sint64
+
+#if LONG_MAX == 2147483647
+#	if FFI_LONG_LONG_MAX != 9223372036854775807
+#		error "no 64-bit data type supported"
+#	endif
+#elif LONG_MAX != 9223372036854775807
+#error "long size not supported"
+#endif
+
+/*	The closure code assumes that this works on pointers, i.e. a size_t
+	can hold a pointer.	*/
+
+typedef struct _ffi_type {
+			size_t				size;
+			unsigned short		alignment;
+			unsigned short		type;
+/*@null@*/	struct _ffi_type**	elements;
+} ffi_type;
+
+/*	These are defined in types.c */
+extern ffi_type	ffi_type_void;
+extern ffi_type	ffi_type_uint8;
+extern ffi_type	ffi_type_sint8;
+extern ffi_type	ffi_type_uint16;
+extern ffi_type	ffi_type_sint16;
+extern ffi_type	ffi_type_uint32;
+extern ffi_type	ffi_type_sint32;
+extern ffi_type	ffi_type_uint64;
+extern ffi_type	ffi_type_sint64;
+extern ffi_type	ffi_type_float;
+extern ffi_type	ffi_type_double;
+extern ffi_type	ffi_type_longdouble;
+extern ffi_type	ffi_type_pointer;
+
+typedef enum ffi_status {
+	FFI_OK = 0,
+	FFI_BAD_TYPEDEF,
+	FFI_BAD_ABI
+} ffi_status;
+
+typedef unsigned	FFI_TYPE;
+
+typedef struct	ffi_cif {
+				ffi_abi		abi;
+				unsigned	nargs;
+/*@dependent@*/	ffi_type**	arg_types;
+/*@dependent@*/	ffi_type*	rtype;
+				unsigned	bytes;
+				unsigned	flags;
+#ifdef FFI_EXTRA_CIF_FIELDS
+				FFI_EXTRA_CIF_FIELDS;
+#endif
+} ffi_cif;
+
+/* ---- Definitions for the raw API -------------------------------------- */
+
+#ifndef FFI_SIZEOF_ARG
+#	if LONG_MAX == 2147483647
+#		define FFI_SIZEOF_ARG	4
+#	elif LONG_MAX == 9223372036854775807
+#		define FFI_SIZEOF_ARG	8
+#	endif
+#endif
+
+typedef union {
+	ffi_sarg	sint;
+	ffi_arg		uint;
+	float		flt;
+	char		data[FFI_SIZEOF_ARG];
+	void*		ptr;
+} ffi_raw;
+
+void
+ffi_raw_call(
+/*@dependent@*/	ffi_cif*	cif, 
+				void		(*fn)(void), 
+/*@out@*/		void*		rvalue, 
+/*@dependent@*/	ffi_raw*	avalue);
+
+void
+ffi_ptrarray_to_raw(
+	ffi_cif*	cif,
+	void**		args,
+	ffi_raw*	raw);
+
+void
+ffi_raw_to_ptrarray(
+	ffi_cif*	cif,
+	ffi_raw*	raw,
+	void**		args);
+
+size_t
+ffi_raw_size(
+	ffi_cif*	cif);
+
+/*	This is analogous to the raw API, except it uses Java parameter
+	packing, even on 64-bit machines.  I.e. on 64-bit machines
+	longs and doubles are followed by an empty 64-bit word.	*/
+void
+ffi_java_raw_call(
+/*@dependent@*/	ffi_cif*	cif, 
+				void		(*fn)(void), 
+/*@out@*/		void*		rvalue, 
+/*@dependent@*/	ffi_raw*	avalue);
+
+void
+ffi_java_ptrarray_to_raw(
+	ffi_cif*	cif,
+	void**		args,
+	ffi_raw*	raw);
+
+void
+ffi_java_raw_to_ptrarray(
+	ffi_cif*	cif,
+	ffi_raw*	raw,
+	void**		args);
+
+size_t
+ffi_java_raw_size(
+	ffi_cif*	cif);
+
+/* ---- Definitions for closures ----------------------------------------- */
+
+#if FFI_CLOSURES
+
+typedef struct ffi_closure {
+	char		tramp[FFI_TRAMPOLINE_SIZE];
+	ffi_cif*	cif;
+	void		(*fun)(ffi_cif*,void*,void**,void*);
+	void*		user_data;
+} ffi_closure;
+
+ffi_status
+ffi_prep_closure(
+	ffi_closure*	closure,
+	ffi_cif*		cif,
+	void			(*fun)(ffi_cif*,void*,void**,void*),
+	void*			user_data);
+
+typedef struct ffi_raw_closure {
+	char		tramp[FFI_TRAMPOLINE_SIZE];
+	ffi_cif*	cif;
+
+#if !FFI_NATIVE_RAW_API
+	/*	if this is enabled, then a raw closure has the same layout 
+		as a regular closure.  We use this to install an intermediate 
+		handler to do the transaltion, void** -> ffi_raw*. */
+	void	(*translate_args)(ffi_cif*,void*,void**,void*);
+	void*	this_closure;
+#endif
+
+	void	(*fun)(ffi_cif*,void*,ffi_raw*,void*);
+	void*	user_data;
+} ffi_raw_closure;
+
+ffi_status
+ffi_prep_raw_closure(
+	ffi_raw_closure*	closure,
+	ffi_cif*			cif,
+	void				(*fun)(ffi_cif*,void*,ffi_raw*,void*),
+	void*				user_data);
+
+ffi_status
+ffi_prep_java_raw_closure(
+	ffi_raw_closure*	closure,
+	ffi_cif*			cif,
+	void				(*fun)(ffi_cif*,void*,ffi_raw*,void*),
+	void*				user_data);
+
+#endif	// FFI_CLOSURES
+
+/* ---- Public interface definition -------------------------------------- */
+
+ffi_status
+ffi_prep_cif(
+/*@out@*/ /*@partial@*/					ffi_cif*		cif, 
+										ffi_abi			abi,
+										unsigned int	nargs, 
+/*@dependent@*/ /*@out@*/ /*@partial@*/	ffi_type*		rtype, 
+/*@dependent@*/							ffi_type**		atypes);
+
+void
+ffi_call(
+/*@dependent@*/	ffi_cif*	cif, 
+				void		(*fn)(void), 
+/*@out@*/		void*		rvalue, 
+/*@dependent@*/	void**		avalue);
+
+/* Useful for eliminating compiler warnings */
+#define FFI_FN(f) ((void (*)(void))f)
+
+#endif	// #ifndef LIBFFI_ASM
+/* ---- Definitions shared with assembly code ---------------------------- */
+
+/*	If these change, update src/mips/ffitarget.h. */
+#define FFI_TYPE_VOID       0
+#define FFI_TYPE_INT        1
+#define FFI_TYPE_FLOAT      2
+#define FFI_TYPE_DOUBLE     3
+
+#ifdef HAVE_LONG_DOUBLE
+#	define FFI_TYPE_LONGDOUBLE 4
+#else
+#	define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
+#endif
+
+#define FFI_TYPE_UINT8      5
+#define FFI_TYPE_SINT8      6
+#define FFI_TYPE_UINT16     7
+#define FFI_TYPE_SINT16     8
+#define FFI_TYPE_UINT32     9
+#define FFI_TYPE_SINT32     10
+#define FFI_TYPE_UINT64     11
+#define FFI_TYPE_SINT64     12
+#define FFI_TYPE_STRUCT     13
+#define FFI_TYPE_POINTER    14
+
+/*	This should always refer to the last type code (for sanity checks) */
+#define FFI_TYPE_LAST       FFI_TYPE_POINTER
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	// #ifndef LIBFFI_H

File pyobjc-core/libffi-src/include/ffi/ffi_common.h

+/* -----------------------------------------------------------------------
+   ffi_common.h - Copyright (c) 1996  Red Hat, Inc.
+
+   Common internal definitions and macros. Only necessary for building
+   libffi.
+   ----------------------------------------------------------------------- */
+
+#ifndef FFI_COMMON_H
+#define FFI_COMMON_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "fficonfig.h"
+
+/*	Do not move this. Some versions of AIX are very picky about where
+	this is positioned. */
+#ifdef __GNUC__
+#	define alloca __builtin_alloca
+#else
+#	if HAVE_ALLOCA_H
+#		include <alloca.h>
+#	else
+#		ifdef _AIX
+#			pragma alloca
+#		else
+#			ifndef alloca	/* predefined by HP cc +Olibcalls */
+char* alloca();
+#			endif
+#		endif
+#	endif
+#endif
+
+/*	Check for the existence of memcpy. */
+#if STDC_HEADERS
+#	include <string.h>
+#else
+#	ifndef HAVE_MEMCPY
+#		define memcpy(d, s, n) bcopy((s), (d), (n))
+#	endif
+#endif
+
+/*#if defined(FFI_DEBUG) 
+#include <stdio.h>
+#endif*/
+
+#ifdef FFI_DEBUG
+#include <stdio.h>
+
+/*@exits@*/ void
+ffi_assert(
+/*@temp@*/	char*	expr,
+/*@temp@*/	char*	file,
+			int		line);
+void
+ffi_stop_here(void);
+void
+ffi_type_test(
+/*@temp@*/ /*@out@*/	ffi_type*	a,
+/*@temp@*/				char*	file,
+						int		line);
+
+#	define FFI_ASSERT(x)			((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
+#	define FFI_ASSERT_AT(x, f, l)	((x) ? 0 : ffi_assert(#x, (f), (l)))
+#	define FFI_ASSERT_VALID_TYPE(x)	ffi_type_test(x, __FILE__, __LINE__)
+#else
+#	define FFI_ASSERT(x) 
+#	define FFI_ASSERT_AT(x, f, l)
+#	define FFI_ASSERT_VALID_TYPE(x)
+#endif	// #ifdef FFI_DEBUG
+
+#define ALIGN(v, a)	(((size_t)(v) + (a) - 1) & ~((a) - 1))
+
+/*	Perform machine dependent cif processing */
+ffi_status
+ffi_prep_cif_machdep(
+	ffi_cif*	cif);
+
+/*	Extended cif, used in callback from assembly routine */
+typedef struct	extended_cif {
+/*@dependent@*/	ffi_cif*	cif;
+/*@dependent@*/	void*		rvalue;
+/*@dependent@*/	void**		avalue;
+} extended_cif;
+
+/*	Terse sized type definitions.  */
+typedef unsigned int	UINT8	__attribute__((__mode__(__QI__)));
+typedef signed int		SINT8	__attribute__((__mode__(__QI__)));
+typedef unsigned int	UINT16	__attribute__((__mode__(__HI__)));
+typedef signed int		SINT16	__attribute__((__mode__(__HI__)));
+typedef unsigned int	UINT32	__attribute__((__mode__(__SI__)));
+typedef signed int		SINT32	__attribute__((__mode__(__SI__)));
+typedef unsigned int	UINT64	__attribute__((__mode__(__DI__)));
+typedef signed int		SINT64	__attribute__((__mode__(__DI__)));
+typedef float			FLOAT32;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	// #ifndef FFI_COMMON_H

File pyobjc-core/libffi-src/include/ffi/fficonfig.h

+/*	Manually created fficonfig.h for Darwin on PowerPC or Intel 
+
+	This file is manually generated to do away with the need for autoconf and
+	therefore make it easier to cross-compile and build fat binaries.
+
+	NOTE: This file was added by PyObjC.
+*/
+
+#ifndef MACOSX
+#error "This file is only supported on Mac OS X"
+#endif
+
+#if defined(__i386__)
+#	define	BYTEORDER 1234
+#	undef	HOST_WORDS_BIG_ENDIAN
+#	undef	WORDS_BIGENDIAN
+#	define	SIZEOF_DOUBLE 8
+#	define	HAVE_LONG_DOUBLE 1
+#	define	SIZEOF_LONG_DOUBLE 16
+
+#elif defined(__x86_64__)
+#	define	BYTEORDER 1234
+#	undef	HOST_WORDS_BIG_ENDIAN
+#	undef	WORDS_BIGENDIAN
+#	define	SIZEOF_DOUBLE 8
+#	define	HAVE_LONG_DOUBLE 1
+#	define	SIZEOF_LONG_DOUBLE 16
+
+#elif defined(__ppc__)
+#	define	BYTEORDER 4321
+#	define	HOST_WORDS_BIG_ENDIAN 1
+#	define	WORDS_BIGENDIAN 1
+#	define	SIZEOF_DOUBLE 8
+#	if __GNUC__ >= 4
+#		define	HAVE_LONG_DOUBLE 1
+#		define	SIZEOF_LONG_DOUBLE 16 
+#	else
+#		undef	HAVE_LONG_DOUBLE
+#		define	SIZEOF_LONG_DOUBLE 8 
+#	endif
+
+#elif defined(__ppc64__)
+#	define	BYTEORDER 4321
+#	define	HOST_WORDS_BIG_ENDIAN 1
+#	define	WORDS_BIGENDIAN 1
+#	define	SIZEOF_DOUBLE 8
+#	define	HAVE_LONG_DOUBLE 1
+#	define	SIZEOF_LONG_DOUBLE 16
+
+#else
+#error "Unknown CPU type"
+#endif
+
+/*	Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+	systems. This function is required for `alloca.c' support on those systems.	*/
+#undef CRAY_STACKSEG_END
+
+/*	Define to 1 if using `alloca.c'. */
+/*	#undef C_ALLOCA */
+
+/*	Define to the flags needed for the .section .eh_frame directive. */
+#define EH_FRAME_FLAGS "aw"
+
+/*	Define this if you want extra debugging. */
+/*	#undef FFI_DEBUG */
+
+/*	Define this is you do not want support for the raw API. */
+#define FFI_NO_RAW_API 1
+
+/*	Define this if you do not want support for aggregate types. */
+/*	#undef FFI_NO_STRUCTS */
+
+/*	Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/*	Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).	*/
+#define HAVE_ALLOCA_H 1
+
+/*	Define if your assembler supports .register. */
+/*	#undef HAVE_AS_REGISTER_PSEUDO_OP */
+
+/*	Define if your assembler and linker support unaligned PC relative relocs.	*/
+/*	#undef HAVE_AS_SPARC_UA_PCREL */
+
+/*	Define to 1 if you have the `memcpy' function. */
+#define HAVE_MEMCPY 1
+
+/*	Define if mmap with MAP_ANON(YMOUS) works. */
+#define HAVE_MMAP_ANON 1
+
+/*	Define if mmap of /dev/zero works. */
+/*	#undef HAVE_MMAP_DEV_ZERO */
+
+/*	Define if read-only mmap of a plain file works. */
+#define HAVE_MMAP_FILE 1
+
+/*	Define if .eh_frame sections should be read-only. */
+/*	#undef HAVE_RO_EH_FRAME */
+
+/*	Define to 1 if your C compiler doesn't accept -c and -o together. */
+/*	#undef NO_MINUS_C_MINUS_O */
+
+/*	Name of package */
+#define PACKAGE "libffi"
+
+/*	Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "http://gcc.gnu.org/bugs.html"
+
+/*	Define to the full name of this package. */
+#define PACKAGE_NAME "libffi"
+
+/*	Define to the full name and version of this package. */
+#define PACKAGE_STRING "libffi 2.1"
+
+/*	Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libffi"
+
+/*	Define to the version of this package. */
+#define PACKAGE_VERSION "2.1"
+
+/*	If using the C implementation of alloca, define if you know the
+	direction of stack growth for your system; otherwise it will be
+	automatically deduced at run-time.
+	STACK_DIRECTION > 0 => grows toward higher addresses
+	STACK_DIRECTION < 0 => grows toward lower addresses
+	STACK_DIRECTION = 0 => direction of growth unknown	*/
+/*	#undef STACK_DIRECTION */
+
+/*	Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/*	Define this if you are using Purify and want to suppress spurious messages.	*/
+/*	#undef USING_PURIFY	*/
+
+/*	Version number of package */
+#define VERSION "2.1-pyobjc"
+
+#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
+#	ifdef LIBFFI_ASM
+#		define FFI_HIDDEN(name) .hidden name
+#	else
+#		define FFI_HIDDEN __attribute__((visibility ("hidden")))
+#	endif
+#else
+#	ifdef LIBFFI_ASM
+#		define FFI_HIDDEN(name)
+#	else
+#		define FFI_HIDDEN
+#	endif
+#endif

File pyobjc-core/libffi-src/include/ffi/ffitarget.h

+/*	Dispatch to the right ffitarget file. This file is PyObjC specific; in a
+	normal build, the build environment copies the file to the right location or
+	sets up the right include flags. We want to do neither because that would
+	make building fat binaries harder.
+*/
+
+#if defined(__i386__) || defined(__x86_64__)
+#include "x86-ffitarget.h"
+#elif defined(__ppc__) || defined(__ppc64__)
+#include "ppc-ffitarget.h"
+#else
+#error "Unsupported CPU type"
+#endif

File pyobjc-core/libffi-src/include/ffi/ppc-ffitarget.h

+/* -----------------------------------------------------------------*-C-*-
+   ppc-ffitarget.h - Copyright (c) 1996-2003  Red Hat, Inc.
+   Target configuration macros for PowerPC.
+
+   Permission is hereby granted, free of charge, to any person obtaining
+   a copy of this software and associated documentation files (the
+   ``Software''), to deal in the Software without restriction, including
+   without limitation the rights to use, copy, modify, merge, publish,
+   distribute, sublicense, and/or sell copies of the Software, and to
+   permit persons to whom the Software is furnished to do so, subject to
+   the following conditions:
+
+   The above copyright notice and this permission notice shall be included
+   in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+   OTHER DEALINGS IN THE SOFTWARE.
+   ----------------------------------------------------------------------- */
+
+#ifndef LIBFFI_TARGET_H
+#define LIBFFI_TARGET_H
+
+/* ---- System specific configurations ----------------------------------- */
+
+#if (defined(POWERPC) && defined(__powerpc64__)) ||		\
+	(defined(POWERPC_DARWIN) && defined(__ppc64__))
+#define POWERPC64
+#endif
+
+#ifndef LIBFFI_ASM
+
+typedef unsigned long	ffi_arg;
+typedef signed long		ffi_sarg;
+
+typedef enum ffi_abi {
+	FFI_FIRST_ABI = 0,
+
+#ifdef POWERPC
+	FFI_SYSV,
+	FFI_GCC_SYSV,
+	FFI_LINUX64,
+#	ifdef POWERPC64
+	FFI_DEFAULT_ABI = FFI_LINUX64,
+#	else
+	FFI_DEFAULT_ABI = FFI_GCC_SYSV,
+#	endif
+#endif
+
+#ifdef POWERPC_AIX
+	FFI_AIX,
+	FFI_DARWIN,
+	FFI_DEFAULT_ABI = FFI_AIX,
+#endif
+
+#ifdef POWERPC_DARWIN
+	FFI_AIX,
+	FFI_DARWIN,
+	FFI_DEFAULT_ABI = FFI_DARWIN,
+#endif
+
+#ifdef POWERPC_FREEBSD
+	FFI_SYSV,
+	FFI_GCC_SYSV,
+	FFI_LINUX64,
+	FFI_DEFAULT_ABI = FFI_SYSV,
+#endif
+
+	FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
+} ffi_abi;
+
+#endif	// #ifndef LIBFFI_ASM
+
+/* ---- Definitions for closures ----------------------------------------- */
+
+#define FFI_CLOSURES 1
+#define FFI_NATIVE_RAW_API 0
+
+/* Needed for FFI_SYSV small structure returns.  */
+#define FFI_SYSV_TYPE_SMALL_STRUCT  (FFI_TYPE_LAST)
+
+#if defined(POWERPC64) /*|| defined(POWERPC_AIX)*/
+#	define FFI_TRAMPOLINE_SIZE 48
+#elif defined(POWERPC_AIX)
+#	define FFI_TRAMPOLINE_SIZE 24
+#else
+#	define FFI_TRAMPOLINE_SIZE 40
+#endif
+
+#ifndef LIBFFI_ASM
+#	if defined(POWERPC_DARWIN) || defined(POWERPC_AIX)
+typedef struct ffi_aix_trampoline_struct {
+	void*	code_pointer;	/* Pointer to ffi_closure_ASM */
+	void*	toc;			/* TOC */
+	void*	static_chain;	/* Pointer to closure */
+} ffi_aix_trampoline_struct;
+#	endif
+#endif	// #ifndef LIBFFI_ASM
+
+#endif	// #ifndef LIBFFI_TARGET_H

File pyobjc-core/libffi-src/include/ffi/x86-ffitarget.h

+/* -----------------------------------------------------------------*-C-*-
+   x86-ffitarget.h - Copyright (c) 1996-2003  Red Hat, Inc.
+   Target configuration macros for x86 and x86-64.
+
+   Permission is hereby granted, free of charge, to any person obtaining
+   a copy of this software and associated documentation files (the
+   ``Software''), to deal in the Software without restriction, including
+   without limitation the rights to use, copy, modify, merge, publish,
+   distribute, sublicense, and/or sell copies of the Software, and to
+   permit persons to whom the Software is furnished to do so, subject to
+   the following conditions:
+
+   The above copyright notice and this permission notice shall be included
+   in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+   OTHER DEALINGS IN THE SOFTWARE.
+
+   ----------------------------------------------------------------------- */
+
+#ifndef LIBFFI_TARGET_H
+#define LIBFFI_TARGET_H
+
+/* ---- System specific configurations ----------------------------------- */
+
+#if defined(X86_64) && defined(__i386__)
+#	undef X86_64
+#	define X86
+#endif
+
+#if defined(__x86_64__) 
+#	ifndef X86_64
+#		define X86_64
+#	endif
+#endif
+
+/* ---- Generic type definitions ----------------------------------------- */
+
+#ifndef LIBFFI_ASM
+
+typedef unsigned long	ffi_arg;
+typedef signed long		ffi_sarg;
+
+typedef enum ffi_abi {
+	FFI_FIRST_ABI = 0,
+
+	/* ---- Intel x86 Win32 ---------- */
+#ifdef X86_WIN32
+	FFI_SYSV,
+	FFI_STDCALL,
+	/* TODO: Add fastcall support for the sake of completeness */
+	FFI_DEFAULT_ABI = FFI_SYSV,
+#endif
+
+	/* ---- Intel x86 and AMD x86-64 - */
+#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__))
+	FFI_SYSV,
+	FFI_UNIX64,   /* Unix variants all use the same ABI for x86-64  */
+#	ifdef __i386__
+	FFI_DEFAULT_ABI = FFI_SYSV,
+#	else
+	FFI_DEFAULT_ABI = FFI_UNIX64,
+#	endif
+#endif
+
+	FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
+} ffi_abi;
+
+#endif	// #ifndef LIBFFI_ASM
+
+/* ---- Definitions for closures ----------------------------------------- */
+
+#define FFI_CLOSURES 1
+
+#if defined(X86_64) || (defined(__x86_64__) && defined(X86_DARWIN))
+#	define FFI_TRAMPOLINE_SIZE 24
+#	define FFI_NATIVE_RAW_API 0
+#else
+#	define FFI_TRAMPOLINE_SIZE 10
+#	define FFI_NATIVE_RAW_API 1	/* x86 has native raw api support */
+#endif
+
+#endif	// #ifndef LIBFFI_TARGET_H

File pyobjc-core/libffi-src/include/ffi_common.h

-/* -----------------------------------------------------------------------
-   ffi_common.h - Copyright (c) 1996  Red Hat, Inc.
-
-   Common internal definitions and macros. Only necessary for building
-   libffi.
-   ----------------------------------------------------------------------- */
-
-#ifndef FFI_COMMON_H
-#define FFI_COMMON_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "fficonfig.h"
-
-/*	Do not move this. Some versions of AIX are very picky about where
-	this is positioned. */
-#ifdef __GNUC__
-#	define alloca __builtin_alloca
-#else
-#	if HAVE_ALLOCA_H
-#		include <alloca.h>
-#	else
-#		ifdef _AIX
-#			pragma alloca
-#		else
-#			ifndef alloca	/* predefined by HP cc +Olibcalls */
-char* alloca();
-#			endif
-#		endif
-#	endif
-#endif
-
-/*	Check for the existence of memcpy. */
-#if STDC_HEADERS
-#	include <string.h>
-#else
-#	ifndef HAVE_MEMCPY
-#		define memcpy(d, s, n) bcopy((s), (d), (n))
-#	endif
-#endif
-
-/*#if defined(FFI_DEBUG) 
-#include <stdio.h>
-#endif*/
-
-#ifdef FFI_DEBUG
-#include <stdio.h>
-
-/*@exits@*/ void
-ffi_assert(
-/*@temp@*/	char*	expr,
-/*@temp@*/	char*	file,
-			int		line);
-void
-ffi_stop_here(void);
-void
-ffi_type_test(
-/*@temp@*/ /*@out@*/	ffi_type*	a,
-/*@temp@*/				char*	file,
-						int		line);
-
-#	define FFI_ASSERT(x)			((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
-#	define FFI_ASSERT_AT(x, f, l)	((x) ? 0 : ffi_assert(#x, (f), (l)))
-#	define FFI_ASSERT_VALID_TYPE(x)	ffi_type_test(x, __FILE__, __LINE__)
-#else
-#	define FFI_ASSERT(x) 
-#	define FFI_ASSERT_AT(x, f, l)
-#	define FFI_ASSERT_VALID_TYPE(x)
-#endif	// #ifdef FFI_DEBUG
-
-#define ALIGN(v, a)	(((size_t)(v) + (a) - 1) & ~((a) - 1))
-
-/*	Perform machine dependent cif processing */
-ffi_status
-ffi_prep_cif_machdep(
-	ffi_cif*	cif);
-
-/*	Extended cif, used in callback from assembly routine */
-typedef struct	extended_cif {
-/*@dependent@*/	ffi_cif*	cif;
-/*@dependent@*/	void*		rvalue;
-/*@dependent@*/	void**		avalue;
-} extended_cif;
-
-/*	Terse sized type definitions.  */
-typedef unsigned int	UINT8	__attribute__((__mode__(__QI__)));
-typedef signed int		SINT8	__attribute__((__mode__(__QI__)));
-typedef unsigned int	UINT16	__attribute__((__mode__(__HI__)));
-typedef signed int		SINT16	__attribute__((__mode__(__HI__)));
-typedef unsigned int	UINT32	__attribute__((__mode__(__SI__)));
-typedef signed int		SINT32	__attribute__((__mode__(__SI__)));
-typedef unsigned int	UINT64	__attribute__((__mode__(__DI__)));
-typedef signed int		SINT64	__attribute__((__mode__(__DI__)));
-typedef float			FLOAT32;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif	// #ifndef FFI_COMMON_H

File pyobjc-core/libffi-src/include/fficonfig.h

-/*	Manually created fficonfig.h for Darwin on PowerPC or Intel 
-
-	This file is manually generated to do away with the need for autoconf and
-	therefore make it easier to cross-compile and build fat binaries.
-
-	NOTE: This file was added by PyObjC.
-*/
-
-#ifndef MACOSX
-#error "This file is only supported on Mac OS X"
-#endif
-
-#if defined(__i386__)
-#	define	BYTEORDER 1234
-#	undef	HOST_WORDS_BIG_ENDIAN
-#	undef	WORDS_BIGENDIAN
-#	define	SIZEOF_DOUBLE 8
-#	define	HAVE_LONG_DOUBLE 1
-#	define	SIZEOF_LONG_DOUBLE 16
-
-#elif defined(__x86_64__)
-#	define	BYTEORDER 1234
-#	undef	HOST_WORDS_BIG_ENDIAN
-#	undef	WORDS_BIGENDIAN
-#	define	SIZEOF_DOUBLE 8
-#	define	HAVE_LONG_DOUBLE 1
-#	define	SIZEOF_LONG_DOUBLE 16
-
-#elif defined(__ppc__)
-#	define	BYTEORDER 4321
-#	define	HOST_WORDS_BIG_ENDIAN 1
-#	define	WORDS_BIGENDIAN 1
-#	define	SIZEOF_DOUBLE 8
-#	if __GNUC__ >= 4
-#		define	HAVE_LONG_DOUBLE 1
-#		define	SIZEOF_LONG_DOUBLE 16 
-#	else
-#		undef	HAVE_LONG_DOUBLE
-#		define	SIZEOF_LONG_DOUBLE 8 
-#	endif
-
-#elif defined(__ppc64__)
-#	define	BYTEORDER 4321
-#	define	HOST_WORDS_BIG_ENDIAN 1
-#	define	WORDS_BIGENDIAN 1
-#	define	SIZEOF_DOUBLE 8
-#	define	HAVE_LONG_DOUBLE 1
-#	define	SIZEOF_LONG_DOUBLE 16
-
-#else
-#error "Unknown CPU type"
-#endif
-
-/*	Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
-	systems. This function is required for `alloca.c' support on those systems.	*/
-#undef CRAY_STACKSEG_END
-
-/*	Define to 1 if using `alloca.c'. */
-/*	#undef C_ALLOCA */
-
-/*	Define to the flags needed for the .section .eh_frame directive. */
-#define EH_FRAME_FLAGS "aw"
-
-/*	Define this if you want extra debugging. */
-/*	#undef FFI_DEBUG */
-
-/*	Define this is you do not want support for the raw API. */
-#define FFI_NO_RAW_API 1
-
-/*	Define this if you do not want support for aggregate types. */
-/*	#undef FFI_NO_STRUCTS */
-
-/*	Define to 1 if you have `alloca', as a function or macro. */
-#define HAVE_ALLOCA 1
-
-/*	Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).	*/
-#define HAVE_ALLOCA_H 1
-
-/*	Define if your assembler supports .register. */
-/*	#undef HAVE_AS_REGISTER_PSEUDO_OP */
-
-/*	Define if your assembler and linker support unaligned PC relative relocs.	*/
-/*	#undef HAVE_AS_SPARC_UA_PCREL */
-
-/*	Define to 1 if you have the `memcpy' function. */
-#define HAVE_MEMCPY 1
-
-/*	Define if mmap with MAP_ANON(YMOUS) works. */
-#define HAVE_MMAP_ANON 1
-
-/*	Define if mmap of /dev/zero works. */
-/*	#undef HAVE_MMAP_DEV_ZERO */
-
-/*	Define if read-only mmap of a plain file works. */
-#define HAVE_MMAP_FILE 1
-
-/*	Define if .eh_frame sections should be read-only. */
-/*	#undef HAVE_RO_EH_FRAME */
-
-/*	Define to 1 if your C compiler doesn't accept -c and -o together. */
-/*	#undef NO_MINUS_C_MINUS_O */
-
-/*	Name of package */
-#define PACKAGE "libffi"
-
-/*	Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "http://gcc.gnu.org/bugs.html"
-
-/*	Define to the full name of this package. */
-#define PACKAGE_NAME "libffi"
-
-/*	Define to the full name and version of this package. */
-#define PACKAGE_STRING "libffi 2.1"
-
-/*	Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "libffi"
-
-/*	Define to the version of this package. */
-#define PACKAGE_VERSION "2.1"
-
-/*	If using the C implementation of alloca, define if you know the
-	direction of stack growth for your system; otherwise it will be
-	automatically deduced at run-time.
-	STACK_DIRECTION > 0 => grows toward higher addresses
-	STACK_DIRECTION < 0 => grows toward lower addresses
-	STACK_DIRECTION = 0 => direction of growth unknown	*/
-/*	#undef STACK_DIRECTION */
-
-/*	Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/*	Define this if you are using Purify and want to suppress spurious messages.	*/
-/*	#undef USING_PURIFY	*/
-
-/*	Version number of package */
-#define VERSION "2.1-pyobjc"
-
-#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
-#	ifdef LIBFFI_ASM
-#		define FFI_HIDDEN(name) .hidden name
-#	else
-#		define FFI_HIDDEN __attribute__((visibility ("hidden")))
-#	endif
-#else
-#	ifdef LIBFFI_ASM
-#		define FFI_HIDDEN(name)
-#	else
-#		define FFI_HIDDEN
-#	endif
-#endif

File pyobjc-core/libffi-src/include/ffitarget.h

-/*	Dispatch to the right ffitarget file. This file is PyObjC specific; in a
-	normal build, the build environment copies the file to the right location or
-	sets up the right include flags. We want to do neither because that would
-	make building fat binaries harder.
-*/
-
-#if defined(__i386__) || defined(__x86_64__)
-#include "x86-ffitarget.h"
-#elif defined(__ppc__) || defined(__ppc64__)
-#include "ppc-ffitarget.h"
-#else
-#error "Unsupported CPU type"
-#endif

File pyobjc-core/libffi-src/include/ppc-ffitarget.h

-/* -----------------------------------------------------------------*-C-*-
-   ppc-ffitarget.h - Copyright (c) 1996-2003  Red Hat, Inc.
-   Target configuration macros for PowerPC.
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   ``Software''), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be included
-   in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
-   ----------------------------------------------------------------------- */
-
-#ifndef LIBFFI_TARGET_H
-#define LIBFFI_TARGET_H
-
-/* ---- System specific configurations ----------------------------------- */
-
-#if (defined(POWERPC) && defined(__powerpc64__)) ||		\
-	(defined(POWERPC_DARWIN) && defined(__ppc64__))
-#define POWERPC64
-#endif
-
-#ifndef LIBFFI_ASM
-
-typedef unsigned long	ffi_arg;
-typedef signed long		ffi_sarg;
-
-typedef enum ffi_abi {
-	FFI_FIRST_ABI = 0,
-
-#ifdef POWERPC
-	FFI_SYSV,
-	FFI_GCC_SYSV,
-	FFI_LINUX64,
-#	ifdef POWERPC64
-	FFI_DEFAULT_ABI = FFI_LINUX64,
-#	else
-	FFI_DEFAULT_ABI = FFI_GCC_SYSV,
-#	endif
-#endif
-
-#ifdef POWERPC_AIX
-	FFI_AIX,
-	FFI_DARWIN,
-	FFI_DEFAULT_ABI = FFI_AIX,
-#endif
-
-#ifdef POWERPC_DARWIN
-	FFI_AIX,
-	FFI_DARWIN,
-	FFI_DEFAULT_ABI = FFI_DARWIN,
-#endif
-
-#ifdef POWERPC_FREEBSD
-	FFI_SYSV,
-	FFI_GCC_SYSV,
-	FFI_LINUX64,
-	FFI_DEFAULT_ABI = FFI_SYSV,
-#endif
-
-	FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
-} ffi_abi;
-
-#endif	// #ifndef LIBFFI_ASM
-
-/* ---- Definitions for closures ----------------------------------------- */
-
-#define FFI_CLOSURES 1
-#define FFI_NATIVE_RAW_API 0
-
-/* Needed for FFI_SYSV small structure returns.  */
-#define FFI_SYSV_TYPE_SMALL_STRUCT  (FFI_TYPE_LAST)
-
-#if defined(POWERPC64) /*|| defined(POWERPC_AIX)*/
-#	define FFI_TRAMPOLINE_SIZE 48
-#elif defined(POWERPC_AIX)
-#	define FFI_TRAMPOLINE_SIZE 24
-#else
-#	define FFI_TRAMPOLINE_SIZE 40
-#endif
-
-#ifndef LIBFFI_ASM
-#	if defined(POWERPC_DARWIN) || defined(POWERPC_AIX)
-typedef struct ffi_aix_trampoline_struct {
-	void*	code_pointer;	/* Pointer to ffi_closure_ASM */
-	void*	toc;			/* TOC */
-	void*	static_chain;	/* Pointer to closure */
-} ffi_aix_trampoline_struct;
-#	endif
-#endif	// #ifndef LIBFFI_ASM
-
-#endif	// #ifndef LIBFFI_TARGET_H

File pyobjc-core/libffi-src/include/x86-ffitarget.h

-/* -----------------------------------------------------------------*-C-*-
-   x86-ffitarget.h - Copyright (c) 1996-2003  Red Hat, Inc.
-   Target configuration macros for x86 and x86-64.
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   ``Software''), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be included
-   in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
-
-   ----------------------------------------------------------------------- */
-
-#ifndef LIBFFI_TARGET_H
-#define LIBFFI_TARGET_H
-
-/* ---- System specific configurations ----------------------------------- */
-
-#if defined(X86_64) && defined(__i386__)
-#	undef X86_64
-#	define X86
-#endif
-
-#if defined(__x86_64__) 
-#	ifndef X86_64
-#		define X86_64
-#	endif
-#endif
-
-/* ---- Generic type definitions ----------------------------------------- */
-
-#ifndef LIBFFI_ASM
-
-typedef unsigned long	ffi_arg;
-typedef signed long		ffi_sarg;
-
-typedef enum ffi_abi {
-	FFI_FIRST_ABI = 0,
-
-	/* ---- Intel x86 Win32 ---------- */
-#ifdef X86_WIN32
-	FFI_SYSV,
-	FFI_STDCALL,
-	/* TODO: Add fastcall support for the sake of completeness */
-	FFI_DEFAULT_ABI = FFI_SYSV,
-#endif
-
-	/* ---- Intel x86 and AMD x86-64 - */
-#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__))
-	FFI_SYSV,
-	FFI_UNIX64,   /* Unix variants all use the same ABI for x86-64  */
-#	ifdef __i386__
-	FFI_DEFAULT_ABI = FFI_SYSV,
-#	else
-	FFI_DEFAULT_ABI = FFI_UNIX64,
-#	endif
-#endif
-
-	FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
-} ffi_abi;
-
-#endif	// #ifndef LIBFFI_ASM
-
-/* ---- Definitions for closures ----------------------------------------- */
-
-#define FFI_CLOSURES 1
-
-#if defined(X86_64) || (defined(__x86_64__) && defined(X86_DARWIN))
-#	define FFI_TRAMPOLINE_SIZE 24
-#	define FFI_NATIVE_RAW_API 0
-#else
-#	define FFI_TRAMPOLINE_SIZE 10
-#	define FFI_NATIVE_RAW_API 1	/* x86 has native raw api support */
-#endif
-
-#endif	// #ifndef LIBFFI_TARGET_H

File pyobjc-core/libffi-src/powerpc/ppc-darwin.h

    OTHER DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
+
 #define L(x) x
 
 #define SF_ARG9		MODE_CHOICE(56,112)
 	((x) == FFI_TYPE_UINT32 || (x) == FFI_TYPE_SINT32 ||\
 	(x) == FFI_TYPE_INT || (x) == FFI_TYPE_FLOAT)
 
+
 #if !defined(LIBFFI_ASM)
 
 enum {
 	FLAG_RETVAL_REFERENCE	= 1 << (31 - 4)
 };
 
+
 void ffi_prep_args(extended_cif*   inEcif, unsigned *const stack);
 
 typedef union
         ffi_dblfl*              pfr);
 
 
-
 #if defined(__ppc64__)
 void ffi64_struct_to_ram_form(const ffi_type*, const char*, unsigned int*,
 	const char*, unsigned int*, unsigned int*, char*, unsigned int*);

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

    OTHER DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
-#include <ffi.h>
-#include <ffi_common.h>
+#include "ffi.h"
+#include "ffi_common.h"
 
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <ppc-darwin.h>
+#include "ppc-darwin.h"
 #include <architecture/ppc/mode_independent_asm.h>
 
 #if defined(POWERPC_DARWIN)
 	unsigned int		nf = 0;	/* number of FPRs already used.  */
 	unsigned int		ng = 0;	/* number of GPRs already used.  */
 	ffi_cif*			cif = closure->cif;
-	long				avn = cif->nargs;
+	unsigned int				avn = cif->nargs;
 	void**				avalue = alloca(cif->nargs * sizeof(void*));
 	ffi_type**			arg_types = cif->arg_types;
 
 						size_al = ALIGN(arg_types[i]->size, 8);
 
 					if (size_al < 3)
-						avalue[i] = (void*)pgr + MODE_CHOICE(4,8) - size_al;
+						avalue[i] = (char*)pgr + MODE_CHOICE(4,8) - size_al;
 					else
-						avalue[i] = (void*)pgr;
+						avalue[i] = (char*)pgr;
 
 					ng	+= (size_al + 3) / sizeof(long);
 					pgr += (size_al + 3) / sizeof(long);

File pyobjc-core/libffi-src/tests/testsuite/libffi.call/exception1.m

+/* Area:	ffi_call
+   Purpose:	Check raising/catching exceptions
+   Limitations:	none.
+   PR:		none.
+   Originator:	Ronald Oussoren */
+
+/* { dg-do run } */
+#include "ffitest.h"
+#import <Foundation/Foundation.h>
+
+static void raiseit(void)
+{
+  [NSException raise:NSInvalidArgumentException format:@"Dummy exception"];
+}
+
+int main (void)
+{
+  ffi_cif cif;
+  ffi_type *args[MAX_ARGS];
+  void *values[MAX_ARGS];
+  int ok;
+
+  NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+
+
+  /* Initialize the cif */
+  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, 
+		     &ffi_type_void, args) == FFI_OK);
+  
+  ok = 0;
+  NS_DURING
+	ffi_call(&cif, FFI_FN(raiseit), NULL, values);
+  NS_HANDLER
+ 	ok = 1;
+
+  NS_ENDHANDLER
+  
+  CHECK(ok);
+
+  [pool release];
+  exit(0);
+
+}

File pyobjc-core/libffi-src/tests/testsuite/libffi.call/exception2.m

+/* Area:	ffi_call
+   Purpose:	Check raising/catching exceptions
+   Limitations:	none.
+   PR:		none.
+   Originator:	Ronald Oussoren */
+
+/* { dg-do run } */
+#include "ffitest.h"
+#import <Foundation/Foundation.h>
+
+static void
+closure_raise(ffi_cif* cif,void* resp,void** args, void* userdata)
+{
+  [NSException raise:NSInvalidArgumentException format:@"Dummy exception"];
+}
+
+
+typedef void (*testfunc)(void);
+
+int main (void)
+{
+  ffi_cif cif;
+  ffi_type *args[MAX_ARGS];
+  void *values[MAX_ARGS];
+  int ok;
+
+#ifndef USING_MMAP
+  static ffi_closure cl;
+#endif
+  ffi_closure *pcl;
+
+#ifdef USING_MMAP
+  pcl = allocate_mmap (sizeof(ffi_closure));
+#else
+  pcl = &cl;
+#endif
+
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+
+
+
+
+
+  /* Initialize the cif */
+  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, 
+		     &ffi_type_void, args) == FFI_OK);
+  
+  CHECK(ffi_prep_closure(pcl, &cif, closure_raise,
+                         (void *) 3 /* userdata */) == FFI_OK);
+  ok = 0;
+  NS_DURING
+	((testfunc)pcl)();
+  NS_HANDLER
+ 	ok = 1;
+
+  NS_ENDHANDLER
+  
+  CHECK(ok);
+
+  [pool release];
+  exit(0);
+}

File pyobjc-core/setup-lib/dejagnu.py

         libdir = os.path.join('build', 'temp.%s-%d.%d'%(get_platform(), sys.version_info[0], sys.version_info[1]), 'libffi-src')
         libffiobjects = self.object_files(libdir)
 
-        commandline='MACOSX_DEPLPOYMENT_TARGET=%s cc %s -g -DMACOSX -Ilibffi-src/include -Ilibffi-src/powerpc -o /tmp/test.bin %s %s 2>&1'%(
+        if self.filename.endswith('.m'):
+            extra_link = '-framework Foundation'
+        else:
+            extra_link = ''
+
+        commandline='MACOSX_DEPLPOYMENT_TARGET=%s cc %s -g -DMACOSX -Ilibffi-src/include -Ilibffi-src/powerpc -o /tmp/test.bin %s %s %s 2>&1'%(
                 get_config_var('MACOSX_DEPLOYMENT_TARGET'),
-                get_config_var('CFLAGS'), self.filename, ' '.join(libffiobjects))
+                get_config_var('CFLAGS'), self.filename, ' '.join(libffiobjects),
+		extra_link)
 
         fp = os.popen(commandline)
         data = fp.read()
 def testSuiteForDirectory(dirname):
     tests = []
     for fn in os.listdir(dirname):
-        if not fn.endswith('.c'): continue
+        if not fn.endswith('.c') and not fn.endswith('.m'): continue
         tst = DgTestCase(os.path.join(dirname, fn))
         if alltests and tst.shortDescription() not in alltests:
             continue

File pyobjc-core/setup.py

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