diff -r 27ae40361ca5 Modules/_ctypes/libffi/ChangeLog.libffi --- a/Modules/_ctypes/libffi/ChangeLog.libffi Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/ChangeLog.libffi Sat Aug 04 21:43:50 2012 +0300 @@ -165,7 +165,7 @@ * src/sh64/ffi.c: Remove lint directives. Was missing from merge of Andreas Tobler's patch from 2006-04-22. - + 2009-06-04 Andrew Haley * src/sh/ffi.c: Apply missing hunk from Alexandre Oliva's patch of @@ -183,20 +183,20 @@ 2008-12-22 Timothy Wall * testsuite/libffi.call/closure_fn0.c, - testsuite/libffi.call/closure_fn1.c, - testsuite/libffi.call/closure_fn2.c, - testsuite/libffi.call/closure_fn3.c, - testsuite/libffi.call/closure_fn4.c, - testsuite/libffi.call/closure_fn5.c, - testsuite/libffi.call/closure_fn6.c, - testsuite/libffi.call/closure_loc_fn0.c, - testsuite/libffi.call/closure_stdcall.c, - testsuite/libffi.call/cls_align_pointer.c, - testsuite/libffi.call/cls_pointer.c, + testsuite/libffi.call/closure_fn1.c, + testsuite/libffi.call/closure_fn2.c, + testsuite/libffi.call/closure_fn3.c, + testsuite/libffi.call/closure_fn4.c, + testsuite/libffi.call/closure_fn5.c, + testsuite/libffi.call/closure_fn6.c, + testsuite/libffi.call/closure_loc_fn0.c, + testsuite/libffi.call/closure_stdcall.c, + testsuite/libffi.call/cls_align_pointer.c, + testsuite/libffi.call/cls_pointer.c, testsuite/libffi.call/cls_pointer_stack.c: use portable cast from pointer to integer (intptr_t). * testsuite/libffi.call/cls_longdouble.c: disable for win64. - + 2008-12-19 Anthony Green * configure.ac: Bump version to 3.0.8. @@ -574,8 +574,8 @@ * Makefile.am, include/Makefile.am: Move headers to libffi_la_SOURCES for new automake. * Makefile.in, include/Makefile.in: Rebuilt. - - * testsuite/lib/wrapper.exp: Copied from gcc tree to allow for + + * testsuite/lib/wrapper.exp: Copied from gcc tree to allow for execution outside of gcc tree. * testsuite/lib/target-libpath.exp: Ditto. diff -r 27ae40361ca5 Modules/_ctypes/libffi/ChangeLog.v1 --- a/Modules/_ctypes/libffi/ChangeLog.v1 Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/ChangeLog.v1 Sat Aug 04 21:43:50 2012 +0300 @@ -59,9 +59,9 @@ * configure.in: Removed AC_PROG_RANLIB. * Makefile.in, aclocal.m4, config.guess, config.sub, configure, - ltmain.sh, */Makefile.in: libtoolized again and rebuilt with + ltmain.sh, */Makefile.in: libtoolized again and rebuilt with automake and autoconf. - + Sat May 10 18:44:50 1997 Tom Tromey * configure, aclocal.m4: Rebuilt. @@ -77,9 +77,9 @@ * README: Boosted rev to 1.14. Added notes. * acconfig.h: Moved PACKAGE and VERSION for new automake. - + * configure.in: Changes for libtool. - + * Makefile.am (check): make test now make check. Uses libtool now. * Makefile.in, configure.in, aclocal.h, fficonfig.h.in: Rebuilt. @@ -136,7 +136,7 @@ * README: Added n32 bug fix notes. - * Makefile.am: Added "make lint" production. + * Makefile.am: Added "make lint" production. * Makefile.in: Rebuilt. Mon Oct 14 10:54:46 1996 Anthony Green @@ -160,7 +160,7 @@ * configure.in, README: Boosted rev to 1.03. * configure: Rebuilt. - * README: Added struct notes. + * README: Added struct notes. * Makefile.am (EXTRA_DIST): Added LICENSE to distribution. * Makefile.in: Rebuilt. @@ -189,7 +189,7 @@ * configure.in: Added nasty bit to support SGI tools. * configure: Rebuilt. - + * README: Added SGI notes. Added note about automake bug. Mon Oct 7 11:00:28 1996 Anthony Green @@ -212,12 +212,12 @@ Added EXTRADIST code for "make dist". * configure: Rebuilt. - * */Makefile.in: Rebuilt with patched automake. + * */Makefile.in: Rebuilt with patched automake. Tue Oct 1 17:12:25 1996 Anthony Green * Makefile.am, aclocal.m4, config.guess, config.sub, - configure.in, fficonfig.h.in, install-sh, mkinstalldirs, + configure.in, fficonfig.h.in, install-sh, mkinstalldirs, stamp-h.in: Created * Makefile.in, configure: Generated @@ -283,7 +283,7 @@ Thu Oct 10 14:53:37 1996 Anthony Green - * ffi_mips.h: Added FFI_TYPE_STRUCT_* definitions for + * ffi_mips.h: Added FFI_TYPE_STRUCT_* definitions for special structure return types. Wed Oct 9 13:55:57 1996 Anthony Green @@ -314,7 +314,7 @@ * ffi.h.in: Added FFI_ABI member to ffi_cif and changed function prototypes accordingly. - Added #define @TARGET@. Now programs including ffi.h don't + Added #define @TARGET@. Now programs including ffi.h don't have to specify this themselves. Thu Oct 3 15:36:44 1996 Anthony Green @@ -396,7 +396,7 @@ * mips/ffi.c: Fixed comment typo. - * x86/ffi.c (ffi_prep_cif_machdep), x86/sysv.S (retfloat): + * x86/ffi.c (ffi_prep_cif_machdep), x86/sysv.S (retfloat): Fixed x86 long double return handling. * types.c: Fixed x86 long double alignment info. @@ -466,14 +466,14 @@ (main): Emit warning for structure test 3 failure on Sun. * Makefile.am (VPATH): Fixed VPATH def'n so automake won't - strip it out. - Moved distdir hack from libffi to automake. + strip it out. + Moved distdir hack from libffi to automake. (ffitest): Added missing -c for $(COMPILE) (change in automake). * Makefile.in: Rebuilt. - + Tue Oct 15 13:08:20 1996 Anthony Green - * Makefile.am: Added "make lint" production. + * Makefile.am: Added "make lint" production. * Makefile.in: Rebuilt. * prep_cif.c (STACK_ARG_SIZE): Improved STACK_ARG_SIZE macro. @@ -522,7 +522,7 @@ * Makefile.am: Added test production. * Makefile: Rebuilt. - * ffitest.c (main): Created. + * ffitest.c (main): Created. * types.c: Created. Stripped common code out of */ffi.c. @@ -646,7 +646,7 @@ Tue Oct 15 13:17:25 1996 Anthony Green - * n32.S: Fixed bad stack munging. + * n32.S: Fixed bad stack munging. * ffi.c: Moved prototypes for ffi_call_?32() to here from ffi_mips.h because extended_cif is not defined in ffi_mips.h. @@ -657,7 +657,7 @@ Thu Oct 10 11:22:16 1996 Anthony Green - * n32.S, ffi.c: Lots of changes to support passing and + * n32.S, ffi.c: Lots of changes to support passing and returning structures with the n32 calling convention. * n32.S: Fixed fn pointer bug. @@ -712,7 +712,7 @@ Tue Oct 1 17:11:02 1996 Anthony Green * ffi.c, o32.S, object.mak: Created - + --- libffi/src/sparc ------------------------------------------------------ Tue Feb 24 16:33:18 1998 Anthony Green @@ -725,16 +725,16 @@ Thu May 1 16:07:56 1997 Anthony Green - * v8.S: Fixed minor portability problem reported by + * v8.S: Fixed minor portability problem reported by Russ McManus . Tue Nov 26 14:12:43 1996 Anthony Green - * v8.S: Used STACKFRAME define elsewhere. + * v8.S: Used STACKFRAME define elsewhere. * ffi.c (ffi_prep_args): Zero out space when USING_PURIFY is set. - (ffi_prep_cif_machdep): Allocate the correct stack frame + (ffi_prep_cif_machdep): Allocate the correct stack frame space for functions with < 6 args. Tue Oct 29 15:08:55 1996 Anthony Green @@ -750,7 +750,7 @@ is no longer valid after gordoni hacked v8.S. * v8.S (ffi_call_V8): Rewrote with gordoni. Much simpler. - + * v8.S, ffi.c: ffi_call() had changed to accept more than two args, so v8.S had to change (because it hijacks incoming arg registers). @@ -760,5 +760,5 @@ Thu Oct 10 17:48:16 1996 Anthony Green * ffi.c, v8.S, objects.mak: Created. - + diff -r 27ae40361ca5 Modules/_ctypes/libffi/Makefile.in --- a/Modules/_ctypes/libffi/Makefile.in Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/Makefile.in Sat Aug 04 21:43:50 2012 +0300 @@ -488,7 +488,7 @@ "RANLIB=$(RANLIB)" \ "DESTDIR=$(DESTDIR)" -MAKEOVERRIDES = +MAKEOVERRIDES = ACLOCAL_AMFLAGS = $(ACLOCAL_AMFLAGS) -I m4 lib_LTLIBRARIES = libffi.la noinst_LTLIBRARIES = libffi_convenience.la @@ -560,7 +560,7 @@ stamp-h1: $(srcdir)/fficonfig.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status fficonfig.h -$(srcdir)/fficonfig.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(srcdir)/fficonfig.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ @@ -829,9 +829,9 @@ src/pa/ffi.lo: src/pa/$(am__dirstamp) src/pa/$(DEPDIR)/$(am__dirstamp) src/pa/hpux32.lo: src/pa/$(am__dirstamp) \ src/pa/$(DEPDIR)/$(am__dirstamp) -libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES) $(EXTRA_libffi_la_DEPENDENCIES) +libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES) $(EXTRA_libffi_la_DEPENDENCIES) $(libffi_la_LINK) -rpath $(libdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS) -libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES) $(EXTRA_libffi_convenience_la_DEPENDENCIES) +libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES) $(EXTRA_libffi_convenience_la_DEPENDENCIES) $(LINK) $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_LIBADD) $(LIBS) mostlyclean-compile: diff -r 27ae40361ca5 Modules/_ctypes/libffi/README --- a/Modules/_ctypes/libffi/README Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/README Sat Aug 04 21:43:50 2012 +0300 @@ -25,7 +25,7 @@ The libffi library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run -time. +time. FFI stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code @@ -106,15 +106,15 @@ You may want to tell configure where to install the libffi library and header files. To do that, use the --prefix configure switch. Libffi -will install under /usr/local by default. +will install under /usr/local by default. If you want to enable extra run-time debugging checks use the the --enable-debug configure switch. This is useful when your program dies -mysteriously while using libffi. +mysteriously while using libffi. Another useful configure switch is --enable-purify-safety. Using this will add some extra code which will suppress certain warnings when you -are using Purify with libffi. Only use this switch when using +are using Purify with libffi. Only use this switch when using Purify, as it will slow down the library. It's also possible to build libffi on Windows platforms with @@ -252,9 +252,9 @@ Linux x86 a.out fix. 1.12 Nov-22-96 - Added missing ffi_type_void, needed for supporting void return - types. Fixed test case for non MIPS machines. Cygnus Support - is now Cygnus Solutions. + Added missing ffi_type_void, needed for supporting void return + types. Fixed test case for non MIPS machines. Cygnus Support + is now Cygnus Solutions. 1.11 Oct-30-96 Added notes about GNU make. @@ -263,8 +263,8 @@ Added configuration fix for non GNU compilers. 1.09 Oct-29-96 - Added --enable-debug configure switch. Clean-ups based on LCLint - feedback. ffi_mips.h is always installed. Many configuration + Added --enable-debug configure switch. Clean-ups based on LCLint + feedback. ffi_mips.h is always installed. Many configuration fixes. Fixed ffitest.c for sparc builds. 1.08 Oct-15-96 @@ -274,7 +274,7 @@ Gordon Irlam rewrites v8.S again. Bug fixes. 1.06 Oct-14-96 - Gordon Irlam improved the sparc port. + Gordon Irlam improved the sparc port. 1.05 Oct-14-96 Interface changes based on feedback. @@ -326,7 +326,7 @@ mips Anthony Green, Casey Marshall mips64 David Daney pa Randolph Chung, Dave Anglin, Andreas Tobler -powerpc Geoffrey Keating, Andreas Tobler, +powerpc Geoffrey Keating, Andreas Tobler, David Edelsohn, John Hornkvist powerpc64 Jakub Jelinek s390 Gerhard Tonn, Ulrich Weigand diff -r 27ae40361ca5 Modules/_ctypes/libffi/configure.ac --- a/Modules/_ctypes/libffi/configure.ac Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/configure.ac Sat Aug 04 21:43:50 2012 +0300 @@ -117,7 +117,7 @@ i?86-*-solaris2.1[[0-9]]*) TARGET=X86_64; TARGETDIR=x86 ;; - i*86-*-nto-qnx*) + i*86-*-nto-qnx*) TARGET=X86; TARGETDIR=x86 ;; i?86-*-*) diff -r 27ae40361ca5 Modules/_ctypes/libffi/configure.host --- a/Modules/_ctypes/libffi/configure.host Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/configure.host Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ # configure.host # # This shell script handles all host based configuration for libffi. -# +# # THIS TABLE IS SORTED. KEEP IT THAT WAY. case "${host}" in diff -r 27ae40361ca5 Modules/_ctypes/libffi/doc/libffi.texi --- a/Modules/_ctypes/libffi/doc/libffi.texi Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/doc/libffi.texi Sat Aug 04 21:43:50 2012 +0300 @@ -215,26 +215,26 @@ void *values[1]; char *s; int rc; - - /* Initialize the argument info vectors */ + + /* Initialize the argument info vectors */ args[0] = &ffi_type_pointer; values[0] = &s; - + /* Initialize the cif */ - if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, args) == FFI_OK) @{ s = "Hello World!"; ffi_call(&cif, puts, &rc, values); /* rc now holds the result of the call to puts */ - - /* values holds a pointer to the function's arg, so to - call puts() again all we need to do is change the + + /* values holds a pointer to the function's arg, so to + call puts() again all we need to do is change the value of s */ s = "This is cool!"; ffi_call(&cif, puts, &rc, values); @} - + return 0; @} @end example @@ -415,7 +415,7 @@ tm_type.size = tm_type.alignment = 0; tm_type.elements = &tm_type_elements; - + for (i = 0; i < 9; i++) tm_type_elements[i] = &ffi_type_sint; @@ -532,7 +532,7 @@ @node Closure Example @section Closure Example -A trivial example that creates a new @code{puts} by binding +A trivial example that creates a new @code{puts} by binding @code{fputs} with @code{stdin}. @example @@ -540,7 +540,7 @@ #include /* Acts like puts with the file given at time of enclosure. */ -void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[], +void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[], FILE *stream) @{ *ret = fputs(*(char **)args[0], stream); @@ -554,7 +554,7 @@ int (*bound_puts)(char *); int rc; - + /* Allocate closure and bound_puts */ closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts); @@ -568,7 +568,7 @@ &ffi_type_uint, args) == FFI_OK) @{ /* Initialize the closure, setting stream to stdout */ - if (ffi_prep_closure_loc(closure, &cif, puts_binding, + if (ffi_prep_closure_loc(closure, &cif, puts_binding, stdout, bound_puts) == FFI_OK) @{ rc = bound_puts("Hello World!"); diff -r 27ae40361ca5 Modules/_ctypes/libffi/include/ffi.h.in --- a/Modules/_ctypes/libffi/include/ffi.h.in Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/include/ffi.h.in Sat Aug 04 21:43:50 2012 +0300 @@ -345,8 +345,8 @@ #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 + /* 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*); @@ -371,8 +371,8 @@ #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 + /* 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*); @@ -441,18 +441,18 @@ #endif /* If these change, update src/mips/ffitarget.h. */ -#define FFI_TYPE_VOID 0 +#define FFI_TYPE_VOID 0 #define FFI_TYPE_INT 1 -#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_FLOAT 2 #define FFI_TYPE_DOUBLE 3 #if @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_UINT8 5 #define FFI_TYPE_SINT8 6 -#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_UINT16 7 #define FFI_TYPE_SINT16 8 #define FFI_TYPE_UINT32 9 #define FFI_TYPE_SINT32 10 diff -r 27ae40361ca5 Modules/_ctypes/libffi/include/ffi_common.h --- a/Modules/_ctypes/libffi/include/ffi_common.h Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/include/ffi_common.h Sat Aug 04 21:43:50 2012 +0300 @@ -2,7 +2,7 @@ ffi_common.h - Copyright (C) 2011, 2012 Anthony Green Copyright (C) 2007 Free Software Foundation, Inc Copyright (c) 1996 Red Hat, Inc. - + Common internal definitions and macros. Only necessary for building libffi. ----------------------------------------------------------------------- */ diff -r 27ae40361ca5 Modules/_ctypes/libffi/libtool-version --- a/Modules/_ctypes/libffi/libtool-version Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/libtool-version Sat Aug 04 21:43:50 2012 +0300 @@ -5,7 +5,7 @@ # # Here are a set of rules to help you update your library version # information: -# +# # 1. Start with version information of `0:0:0' for each libtool library. # # 2. Update the version information only immediately before a public diff -r 27ae40361ca5 Modules/_ctypes/libffi/m4/libtool.m4 --- a/Modules/_ctypes/libffi/m4/libtool.m4 Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/m4/libtool.m4 Sat Aug 04 21:43:50 2012 +0300 @@ -1196,7 +1196,7 @@ # Invoke $ECHO with all args, space-separated. func_echo_all () { - $ECHO "$*" + $ECHO "$*" } case "$ECHO" in diff -r 27ae40361ca5 Modules/_ctypes/libffi/m4/lt~obsolete.m4 --- a/Modules/_ctypes/libffi/m4/lt~obsolete.m4 Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/m4/lt~obsolete.m4 Sat Aug 04 21:43:50 2012 +0300 @@ -25,7 +25,7 @@ # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until diff -r 27ae40361ca5 Modules/_ctypes/libffi/man/ffi_prep_cif.3 --- a/Modules/_ctypes/libffi/man/ffi_prep_cif.3 Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/man/ffi_prep_cif.3 Sat Aug 04 21:43:50 2012 +0300 @@ -5,7 +5,7 @@ .Nd Prepare a .Nm ffi_cif structure for use with -.Nm ffi_call +.Nm ffi_call . .Sh SYNOPSIS .In ffi.h @@ -22,7 +22,7 @@ .Nm ffi_prep_cif function prepares a .Nm ffi_cif -structure for use with +structure for use with .Nm ffi_call . .Fa abi diff -r 27ae40361ca5 Modules/_ctypes/libffi/msvcc.sh --- a/Modules/_ctypes/libffi/msvcc.sh Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/msvcc.sh Sat Aug 04 21:43:50 2012 +0300 @@ -141,7 +141,7 @@ -o) outdir="$(dirname $2)" base="$(basename $2|sed 's/\.[^.]*//g')" - if [ -n "$single" ]; then + if [ -n "$single" ]; then output="-Fo$2" else output="-Fe$2" diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/alpha/ffi.c --- a/Modules/_ctypes/libffi/src/alpha/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/alpha/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -1,8 +1,8 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2012 Anthony Green Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc. - - Alpha Foreign Function Interface + + Alpha Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -71,7 +71,7 @@ cif->flags = FFI_TYPE_INT; break; } - + return FFI_OK; } @@ -82,7 +82,7 @@ unsigned long *stack, *argp; long i, avn; ffi_type **arg_types; - + /* If the return value is a struct and we don't have a return value address then we need to make one. */ if (rvalue == NULL && cif->flags == FFI_TYPE_STRUCT) @@ -108,25 +108,25 @@ case FFI_TYPE_SINT8: *(SINT64 *) argp = *(SINT8 *)(* avalue); break; - + case FFI_TYPE_UINT8: *(SINT64 *) argp = *(UINT8 *)(* avalue); break; - + case FFI_TYPE_SINT16: *(SINT64 *) argp = *(SINT16 *)(* avalue); break; - + case FFI_TYPE_UINT16: *(SINT64 *) argp = *(UINT16 *)(* avalue); break; - + case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: /* Note that unsigned 32-bit quantities are sign extended. */ *(SINT64 *) argp = *(SINT32 *)(* avalue); break; - + case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_POINTER: @@ -229,7 +229,7 @@ i = 0; avn = cif->nargs; arg_types = cif->arg_types; - + /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) { diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/alpha/osf.S --- a/Modules/_ctypes/libffi/src/alpha/osf.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/alpha/osf.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- osf.S - Copyright (c) 1998, 2001, 2007, 2008, 2011 Red Hat - - Alpha/OSF Foreign Function Interface + + Alpha/OSF Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/arm/ffi.c --- a/Modules/_ctypes/libffi/src/arm/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/arm/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -4,8 +4,8 @@ Copyright (c) 2011 Anthony Green Copyright (c) 2011 Free Software Foundation Copyright (c) 1998, 2008, 2011 Red Hat, Inc. - - ARM Foreign Function Interface + + ARM Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -39,7 +39,7 @@ /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments - + The vfp_space parameter is the load area for VFP regs, the return value is cif->vfp_used (word bitset of VFP regs used for passing arguments). These are only used for the VFP hard-float ABI. @@ -104,19 +104,19 @@ case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; - + case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; - + case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; - + case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; - + case FFI_TYPE_STRUCT: memcpy(argp, *p_argv, (*p_arg)->size); break; @@ -145,7 +145,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { int type_code; - /* Round the stack up to a multiple of 8 bytes. This isn't needed + /* Round the stack up to a multiple of 8 bytes. This isn't needed everywhere, but it is on some platforms, and it doesn't harm anything when it isn't needed. */ cif->bytes = (cif->bytes + 7) & ~7; @@ -216,7 +216,7 @@ { extended_cif ecif; - int small_struct = (cif->flags == FFI_TYPE_INT + int small_struct = (cif->flags == FFI_TYPE_INT && cif->rtype->type == FFI_TYPE_STRUCT); int vfp_struct = (cif->flags == FFI_TYPE_STRUCT_VFP_FLOAT || cif->flags == FFI_TYPE_STRUCT_VFP_DOUBLE); @@ -225,11 +225,11 @@ ecif.avalue = avalue; unsigned int temp; - + /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ - if ((rvalue == NULL) && + if ((rvalue == NULL) && (cif->flags == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); @@ -244,7 +244,7 @@ else ecif.rvalue = rvalue; - switch (cif->abi) + switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); @@ -289,10 +289,10 @@ void **arg_area; cif = closure->cif; - arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); /* this call will initialize ARG_AREA, such that each - * element in that array points to the corresponding + * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will re-set RESP to point to the * structure return address. */ @@ -305,7 +305,7 @@ } /*@-exportheader@*/ -static void +static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, ffi_cif *cif, /* Used only under VFP hard-float ABI. */ @@ -330,7 +330,7 @@ { size_t z; size_t alignment; - + if (cif->abi == FFI_VFP && vi < cif->vfp_nargs && vfp_type_p (*p_arg)) { @@ -360,7 +360,7 @@ p_argv++; argp += z; } - + return; } @@ -617,7 +617,7 @@ #endif else return FFI_BAD_ABI; - + #if FFI_EXEC_TRAMPOLINE_TABLE void **config = FFI_TRAMPOLINE_CODELOC_CONFIG(codeloc); config[0] = closure; diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/arm/gentramp.sh --- a/Modules/_ctypes/libffi/src/arm/gentramp.sh Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/arm/gentramp.sh Sat Aug 04 21:43:50 2012 +0300 @@ -2,7 +2,7 @@ # ----------------------------------------------------------------------- # gentramp.sh - Copyright (c) 2010, Plausible Labs Cooperative, Inc. -# +# # ARM Trampoline Page Generator # # Permission is hereby granted, free of charge, to any person obtaining @@ -41,7 +41,7 @@ # are unreachable due to our maximum pc-relative ldr offset. PAGE_AVAIL=`expr $PAGE_SIZE - 16` -# Compute the number of of available trampolines. +# Compute the number of of available trampolines. TRAMPOLINE_COUNT=`expr $PAGE_AVAIL / $TRAMPOLINE_SIZE` header () { @@ -52,7 +52,7 @@ # Write out the license header cat << EOF # Copyright (c) 2010, Plausible Labs Cooperative, 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 diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/arm/sysv.S --- a/Modules/_ctypes/libffi/src/arm/sysv.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/arm/sysv.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,8 +1,8 @@ /* ----------------------------------------------------------------------- sysv.S - Copyright (c) 1998, 2008, 2011 Red Hat, Inc. Copyright (c) 2011 Plausible Labs Cooperative, Inc. - - ARM Foreign Function Interface + + ARM Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include #ifdef HAVE_MACHINE_ASM_H @@ -59,7 +59,7 @@ #define __SOFTFP__ #endif -/* We need a better way of testing for this, but for now, this is all +/* We need a better way of testing for this, but for now, this is all we can do. */ @ This selects the minimum architecture level required. #define __ARM_ARCH__ 3 @@ -68,7 +68,7 @@ # undef __ARM_ARCH__ # define __ARM_ARCH__ 4 #endif - + #if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ || defined(__ARM_ARCH_5TEJ__) @@ -107,9 +107,9 @@ #define UNWIND #else #define UNWIND @ -#endif +#endif - + #if defined(__thumb__) && !defined(__THUMB_INTERWORK__) .macro ARM_FUNC_START name .text @@ -201,14 +201,14 @@ @ call (fn) (...) call_reg(ip) - + @ Remove the space we pushed for the args mov sp, fp @ Load r2 with the pointer to storage for the return value ldr r2, [sp, #24] - @ Load r3 with the return type code + @ Load r3 with the return type code ldr r3, [sp, #12] @ If the return value pointer is NULL, assume no return value. @@ -397,7 +397,7 @@ @ the return value ldr r2, [sp, #24] - @ Load r3 with the return type code + @ Load r3 with the return type code ldr r3, [sp, #12] @ If the return value pointer is NULL, @@ -416,7 +416,7 @@ cmp r3, #FFI_TYPE_FLOAT fstseq s0, [r2] beq LSYM(Lepilogue_vfp) - + cmp r3, #FFI_TYPE_DOUBLE fstdeq d0, [r2] beq LSYM(Lepilogue_vfp) @@ -466,7 +466,7 @@ cmp r0, #FFI_TYPE_STRUCT_VFP_DOUBLE beq .Lretdouble_struct_vfp - + .Lclosure_epilogue_vfp: add sp, sp, #72 ldmfd sp, {sp, pc} diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/arm/trampoline.S --- a/Modules/_ctypes/libffi/src/arm/trampoline.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/arm/trampoline.S Sat Aug 04 21:43:50 2012 +0300 @@ -2,7 +2,7 @@ # This file was generated by src/arm/gentramp.sh # Copyright (c) 2010, Plausible Labs Cooperative, 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 diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/closures.c --- a/Modules/_ctypes/libffi/src/closures.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/closures.c Sat Aug 04 21:43:50 2012 +0300 @@ -46,7 +46,7 @@ # define HAVE_MNTENT 1 # endif # if defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__) -/* Windows systems may have Data Execution Protection (DEP) enabled, +/* Windows systems may have Data Execution Protection (DEP) enabled, which requires the use of VirtualMalloc/VirtualFree to alloc/free executable memory. */ # define FFI_MMAP_EXEC_WRIT 1 diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/dlmalloc.c Sat Aug 04 21:43:50 2012 +0300 @@ -363,9 +363,9 @@ size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set REALLOC_ZERO_BYTES_FREES default: not defined - This should be set if a call to realloc with zero bytes should - be the same as a call to free. Some people think it should. Otherwise, - since this malloc returns a unique pointer for malloc(0), so does + This should be set if a call to realloc with zero bytes should + be the same as a call to free. Some people think it should. Otherwise, + since this malloc returns a unique pointer for malloc(0), so does realloc(p, 0). LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H @@ -3556,7 +3556,7 @@ set_segment_flags(&m->seg, mmap_flag); m->magic = mparams.magic; init_bins(m); - if (is_global(m)) + if (is_global(m)) init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); else { /* Offset top by embedded malloc_state */ @@ -3709,7 +3709,7 @@ } /* Unmap any unused mmapped segments */ - if (HAVE_MMAP) + if (HAVE_MMAP) released += release_unused_segments(m); /* On failure, disable autotrim to avoid repeated failed future calls */ @@ -3917,7 +3917,7 @@ while (a < alignment) a <<= 1; alignment = a; } - + if (bytes >= MAX_REQUEST - alignment) { if (m != 0) { /* Test isn't needed but avoids compiler warning */ MALLOC_FAILURE_ACTION; @@ -5162,5 +5162,5 @@ Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) * Based loosely on libg++-1.2X malloc. (It retains some of the overall structure of old version, but most details differ.) - + */ diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/frv/eabi.S --- a/Modules/_ctypes/libffi/src/frv/eabi.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/frv/eabi.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- eabi.S - Copyright (c) 2004 Anthony Green - + FR-V Assembly glue. Permission is hereby granted, free of charge, to any person obtaining @@ -23,7 +23,7 @@ OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include @@ -40,8 +40,8 @@ # gr11: fig->flags # gr12: ecif.rvalue # gr13: fn - -ffi_call_EABI: + +ffi_call_EABI: addi sp, #-80, sp sti fp, @(sp, #24) addi sp, #24, fp @@ -49,7 +49,7 @@ /* Make room for the new arguments. */ /* subi sp, fp, gr10 */ - + /* Store return address and incoming args on stack. */ sti gr5, @(fp, #8) sti gr8, @(fp, #-4) @@ -60,7 +60,7 @@ sti gr13, @(fp, #-24) sub sp, gr10, sp - + /* Call ffi_prep_args. */ ldi @(fp, #-4), gr4 addi sp, #0, gr8 @@ -70,11 +70,11 @@ calll @(gr14, gr0) #else calll @(gr4, gr0) -#endif +#endif /* ffi_prep_args returns the new stack pointer. */ mov gr8, gr4 - + ldi @(sp, #0), gr8 ldi @(sp, #4), gr9 ldi @(sp, #8), gr10 @@ -90,7 +90,7 @@ /* Use the ffi_prep_args return value for the new sp. */ mov gr4, sp - + /* Call the target function. */ ldi @(fp, -24), gr4 #ifdef __FRV_FDPIC__ @@ -98,7 +98,7 @@ calll @(gr14, gr0) #else calll @(gr4, gr0) -#endif +#endif /* Store the result. */ ldi @(fp, #-16), gr10 /* fig->flags */ @@ -117,7 +117,7 @@ beq icc0, 0, .L3 /* No, save a 4 byte return value. */ sti gr8, @(gr4, #0) -.L3: +.L3: /* Restore the stack, and return. */ ldi @(fp, 8), gr5 @@ -125,4 +125,4 @@ addi sp,#80,sp jmpl @(gr5,gr0) .size ffi_call_EABI, .-ffi_call_EABI - + diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/frv/ffi.c --- a/Modules/_ctypes/libffi/src/frv/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/frv/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -2,8 +2,8 @@ ffi.c - Copyright (C) 2004 Anthony Green Copyright (C) 2007 Free Software Foundation, Inc. Copyright (C) 2008 Red Hat, Inc. - - FR-V Foreign Function Interface + + FR-V Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -50,19 +50,19 @@ i--, p_arg++) { size_t z; - + z = (*p_arg)->size; if ((*p_arg)->type == FFI_TYPE_STRUCT) { z = sizeof(void*); *(void **) argp = *p_argv; - } + } /* if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (count > 24) { - // This is going on the stack. Turn it into a double. + // This is going on the stack. Turn it into a double. *(double *) argp = (double) *(float*)(* p_argv); z = sizeof(double); } @@ -77,19 +77,19 @@ case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; - + case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; - + case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; - + case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; - + default: FFI_ASSERT(0); } @@ -123,38 +123,38 @@ return FFI_OK; } -extern void ffi_call_EABI(void *(*)(char *, extended_cif *), - extended_cif *, - unsigned, unsigned, - unsigned *, +extern void ffi_call_EABI(void *(*)(char *, extended_cif *), + extended_cif *, + unsigned, unsigned, + unsigned *, void (*fn)(void)); -void ffi_call(ffi_cif *cif, - void (*fn)(void), - void *rvalue, +void ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; - + /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ - if ((rvalue == NULL) && + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; - - - switch (cif->abi) + + + switch (cif->abi) { case FFI_EABI: - ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, + ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: @@ -239,7 +239,7 @@ /* Functions return 4-byte or smaller results in gr8. 8-byte values also use gr9. We fill the both, even for small return - values, just to avoid a branch. */ + values, just to avoid a branch. */ asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/ia64/ffi.c --- a/Modules/_ctypes/libffi/src/ia64/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/ia64/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -2,8 +2,8 @@ ffi.c - Copyright (c) 1998, 2007, 2008, 2012 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company Copyright (c) 2011 Anthony Green - - IA64 Foreign Function Interface + + IA64 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -36,7 +36,7 @@ #include "ia64_flags.h" /* A 64-bit pointer value. In LP64 mode, this is effectively a plain - pointer. In ILP32 mode, it's a pointer that's been extended to + pointer. In ILP32 mode, it's a pointer that's been extended to 64 bits by "addp4". */ typedef void *PTR64 __attribute__((mode(DI))); @@ -285,7 +285,7 @@ /* If we have no spot for a return value, make one. */ if (rvalue == NULL && cif->rtype->type != FFI_TYPE_VOID) rvalue = alloca (cif->rtype->size); - + /* Allocate the stack frame. */ stack = alloca (cif->bytes); @@ -412,7 +412,7 @@ void *user_data, void *codeloc) { - /* The layout of a function descriptor. A C function pointer really + /* The layout of a function descriptor. A C function pointer really points to one of these. */ struct ia64_fd { diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/ia64/ia64_flags.h --- a/Modules/_ctypes/libffi/src/ia64/ia64_flags.h Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/ia64/ia64_flags.h Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- ia64_flags.h - Copyright (c) 2000 Hewlett Packard Company - - IA64/unix Foreign Function Interface + + IA64/unix Foreign Function Interface Original author: Hans Boehm, HP Labs diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/ia64/unix.S --- a/Modules/_ctypes/libffi/src/ia64/unix.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/ia64/unix.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,8 +1,8 @@ /* ----------------------------------------------------------------------- unix.S - Copyright (c) 1998, 2008 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company - - IA64/unix Foreign Function Interface + + IA64/unix Foreign Function Interface Primary author: Hans Boehm, HP Labs @@ -29,7 +29,7 @@ DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include #include "ia64_flags.h" diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/m32r/ffi.c --- a/Modules/_ctypes/libffi/src/m32r/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/m32r/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -1,8 +1,8 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2004 Renesas Technology Copyright (c) 2008 Red Hat, Inc. - - M32R Foreign Function Interface + + M32R Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -63,7 +63,7 @@ if (((*p_arg)->alignment - 1) & (unsigned) argp) argp = (char *) ALIGN (argp, (*p_arg)->alignment); - if (avn != 0) + if (avn != 0) { avn--; z = (*p_arg)->size; @@ -76,19 +76,19 @@ case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; - + case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; - + case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; - + case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; - + case FFI_TYPE_STRUCT: z = (*p_arg)->size; if ((*p_arg)->alignment != 1) @@ -131,7 +131,7 @@ argp += z; } } - + return; } @@ -181,21 +181,21 @@ ecif.cif = cif; ecif.avalue = avalue; - + /* If the return value is a struct and we don't have a return value address then we need to make one. */ - if ((rvalue == NULL) && + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca (cif->rtype->size); } else - ecif.rvalue = rvalue; - - switch (cif->abi) + ecif.rvalue = rvalue; + + switch (cif->abi) { case FFI_SYSV: - ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); if (cif->rtype->type == FFI_TYPE_STRUCT) { diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/m32r/sysv.S --- a/Modules/_ctypes/libffi/src/m32r/sysv.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/m32r/sysv.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2004 Renesas Technology - - M32R Foreign Function Interface + + M32R Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -58,7 +58,7 @@ sub sp, r2 /* Place all of the ffi_prep_args in position. */ - mv lr, r0 + mv lr, r0 mv r0, sp /* R1 already set. */ @@ -81,10 +81,10 @@ /* Call the function. */ ld lr, @(28,fp) - jl lr + jl lr /* Remove the space we pushed for the args. */ - mv sp, fp + mv sp, fp /* Load R2 with the pointer to storage for the return value. */ ld r2, @(24,sp) @@ -98,14 +98,14 @@ /* Return INT. */ ldi r4, #FFI_TYPE_INT bne r3, r4, return_double - st r0, @r2 + st r0, @r2 bra epilogue return_double: /* Return DOUBLE or LONGDOUBLE. */ ldi r4, #FFI_TYPE_DOUBLE bne r3, r4, epilogue - st r0, @r2 + st r0, @r2 st r1, @(4,r2) epilogue: diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/m68k/sysv.S --- a/Modules/_ctypes/libffi/src/m68k/sysv.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/m68k/sysv.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,10 +1,10 @@ /* ----------------------------------------------------------------------- - + sysv.S - Copyright (c) 2012 Alan Hourihane Copyright (c) 1998, 2012 Andreas Schwab - Copyright (c) 2008 Red Hat, Inc. - - m68k Foreign Function Interface + Copyright (c) 2008 Red Hat, Inc. + + m68k Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -27,7 +27,7 @@ DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include @@ -74,7 +74,7 @@ #else bsr.l CALLFUNC(ffi_prep_args@PLTPC) #endif - addq.l #8,%sp + addq.l #8,%sp | Pass pointer to struct value, if any #ifdef __MINT__ @@ -93,7 +93,7 @@ | Load the pointer to storage for the return value move.l 20(%fp),%a1 - | Load the return type code + | Load the return type code move.l 16(%fp),%d2 | If the return value pointer is NULL, assume no return value. diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/mips/ffi.c --- a/Modules/_ctypes/libffi/src/mips/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/mips/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -2,8 +2,8 @@ ffi.c - Copyright (c) 2011 Anthony Green Copyright (c) 2008 David Daney Copyright (c) 1996, 2007, 2008, 2011 Red Hat, Inc. - - MIPS Foreign Function Interface + + MIPS Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -60,14 +60,14 @@ FFI_MIPS_STOP_HERE(); \ } #else -#define FIX_ARGP +#define FIX_ARGP #endif /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ -static void ffi_prep_args(char *stack, +static void ffi_prep_args(char *stack, extended_cif *ecif, int bytes, int flags) @@ -79,7 +79,7 @@ #ifdef FFI_MIPS_N32 /* If more than 8 double words are used, the remainder go - on the stack. We reorder stuff on the stack here to + on the stack. We reorder stuff on the stack here to support this easily. */ if (bytes > 8 * sizeof(ffi_arg)) argp = &stack[bytes - (8 * sizeof(ffi_arg))]; @@ -95,7 +95,7 @@ if ( ecif->cif->rstruct_flag != 0 ) #else if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) -#endif +#endif { *(ffi_arg *) argp = (ffi_arg) ecif->rvalue; argp += sizeof(ffi_arg); @@ -113,7 +113,7 @@ a = (*p_arg)->alignment; if (a < sizeof(ffi_arg)) a = sizeof(ffi_arg); - + if ((a - 1) & (unsigned long) argp) { argp = (char *) ALIGN(argp, a); @@ -156,19 +156,19 @@ case FFI_TYPE_UINT8: *(ffi_arg *)argp = *(UINT8 *)(* p_argv); break; - + case FFI_TYPE_SINT16: *(ffi_arg *)argp = *(SINT16 *)(* p_argv); break; - + case FFI_TYPE_UINT16: *(ffi_arg *)argp = *(UINT16 *)(* p_argv); break; - + case FFI_TYPE_SINT32: *(ffi_arg *)argp = *(SINT32 *)(* p_argv); break; - + case FFI_TYPE_UINT32: *(ffi_arg *)argp = *(UINT32 *)(* p_argv); break; @@ -219,7 +219,7 @@ #ifdef FFI_MIPS_N32 -/* The n32 spec says that if "a chunk consists solely of a double +/* The n32 spec says that if "a chunk consists solely of a double float field (but not a double, which is part of a union), it is passed in a floating point register. Any other chunk is passed in an integer register". This code traverses structure @@ -268,12 +268,12 @@ ffi_type *e; /* Returning structures under n32 is a tricky thing. - A struct with only one or two floating point fields + A struct with only one or two floating point fields is returned in $f0 (and $f2 if necessary). Any other struct results at most 128 bits are returned in $2 (the first 64 bits) and $3 (remainder, if necessary). Larger structs are handled normally. */ - + if (arg->size > 16) return 0; @@ -293,12 +293,12 @@ flags += FFI_TYPE_DOUBLE << FFI_FLAG_BITS; else if (e->type == FFI_TYPE_FLOAT) flags += FFI_TYPE_FLOAT << FFI_FLAG_BITS; - else + else return small; if (flags && (arg->elements[2])) { - /* There are three arguments and the first two are + /* There are three arguments and the first two are floats! This must be passed the old way. */ return small; } @@ -334,7 +334,7 @@ case FFI_TYPE_DOUBLE: cif->flags += (cif->arg_types)[0]->type; break; - + default: break; } @@ -351,7 +351,7 @@ case FFI_TYPE_DOUBLE: cif->flags += (cif->arg_types)[1]->type << FFI_FLAG_BITS; break; - + default: break; } @@ -359,7 +359,7 @@ } } } - + /* Set the return type flag */ if (cif->abi == FFI_O32_SOFT_FLOAT) @@ -376,7 +376,7 @@ case FFI_TYPE_DOUBLE: cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2); break; - + case FFI_TYPE_FLOAT: default: cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); @@ -385,7 +385,7 @@ } else { - /* FFI_O32 */ + /* FFI_O32 */ switch (cif->rtype->type) { case FFI_TYPE_VOID: @@ -399,7 +399,7 @@ case FFI_TYPE_UINT64: cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2); break; - + default: cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); break; @@ -469,7 +469,7 @@ /* Align it. */ arg_reg = ALIGN(arg_reg, 2); /* Treat it as two adjacent doubles. */ - if (soft_float) + if (soft_float) { arg_reg += 2; } @@ -507,7 +507,7 @@ if (struct_flags == 0) { /* The structure is returned through a hidden - first argument. Do nothing, 'cause FFI_TYPE_VOID + first argument. Do nothing, 'cause FFI_TYPE_VOID is 0 */ } else @@ -519,7 +519,7 @@ } break; } - + case FFI_TYPE_VOID: /* Do nothing, 'cause FFI_TYPE_VOID is 0 */ break; @@ -567,18 +567,18 @@ } } #endif - + return FFI_OK; } /* Low level routine for calling O32 functions */ -extern int ffi_call_O32(void (*)(char *, extended_cif *, int, int), - extended_cif *, unsigned, +extern int ffi_call_O32(void (*)(char *, extended_cif *, int, int), + extended_cif *, unsigned, unsigned, unsigned *, void (*)(void)); /* Low level routine for calling N32 functions */ -extern int ffi_call_N32(void (*)(char *, extended_cif *, int, int), - extended_cif *, unsigned, +extern int ffi_call_N32(void (*)(char *, extended_cif *, int, int), + extended_cif *, unsigned, unsigned, void *, void (*)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) @@ -587,22 +587,22 @@ ecif.cif = cif; ecif.avalue = avalue; - + /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ - - if ((rvalue == NULL) && + + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) ecif.rvalue = alloca(cif->rtype->size); else ecif.rvalue = rvalue; - - switch (cif->abi) + + switch (cif->abi) { #ifdef FFI_MIPS_O32 case FFI_O32: case FFI_O32_SOFT_FLOAT: - ffi_call_O32(ffi_prep_args, &ecif, cif->bytes, + ffi_call_O32(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #endif @@ -804,12 +804,12 @@ avaluep[i] = &avalue[i]; *(UINT8 *) &avalue[i] = (UINT8) ar[argn]; break; - + case FFI_TYPE_SINT16: avaluep[i] = &avalue[i]; *(SINT16 *) &avalue[i] = (SINT16) ar[argn]; break; - + case FFI_TYPE_UINT16: avaluep[i] = &avalue[i]; *(UINT16 *) &avalue[i] = (UINT16) ar[argn]; diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/mips/ffitarget.h --- a/Modules/_ctypes/libffi/src/mips/ffitarget.h Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/mips/ffitarget.h Sat Aug 04 21:43:50 2012 +0300 @@ -82,7 +82,7 @@ #define FFI_FLAG_BITS 2 -/* SGI's strange assembler requires that we multiply by 4 rather +/* SGI's strange assembler requires that we multiply by 4 rather than shift left by FFI_FLAG_BITS */ #define FFI_ARGS_D FFI_TYPE_DOUBLE @@ -128,21 +128,21 @@ #define a1 $5 #define a2 $6 #define a3 $7 -#define a4 $8 -#define a5 $9 -#define a6 $10 -#define a7 $11 +#define a4 $8 +#define a5 $9 +#define a6 $10 +#define a7 $11 #define t0 $8 #define t1 $9 #define t2 $10 #define t3 $11 -#define t4 $12 +#define t4 $12 #define t5 $13 -#define t6 $14 +#define t6 $14 #define t7 $15 #define t8 $24 #define t9 $25 -#define ra $31 +#define ra $31 #ifdef FFI_MIPS_O32 # define REG_L lw diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/mips/n32.S --- a/Modules/_ctypes/libffi/src/mips/n32.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/mips/n32.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- n32.S - Copyright (c) 1996, 1998, 2005, 2007, 2009, 2010 Red Hat, Inc. - - MIPS Foreign Function Interface + + MIPS Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -24,11 +24,11 @@ DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include -/* Only build this code if we are compiling for n32 */ +/* Only build this code if we are compiling for n32 */ #if defined(FFI_MIPS_N32) @@ -48,7 +48,7 @@ .align 2 .globl ffi_call_N32 .ent ffi_call_N32 -ffi_call_N32: +ffi_call_N32: .LFB3: .frame $fp, SIZEOF_FRAME, ra .mask 0xc0000000,-FFI_SIZEOF_ARG @@ -70,12 +70,12 @@ # Allocate at least 4 words in the argstack move v0, bytes - bge bytes, 4 * FFI_SIZEOF_ARG, bigger + bge bytes, 4 * FFI_SIZEOF_ARG, bigger LI v0, 4 * FFI_SIZEOF_ARG b sixteen - bigger: - ADDU t4, v0, 2 * FFI_SIZEOF_ARG -1 # make sure it is aligned + bigger: + ADDU t4, v0, 2 * FFI_SIZEOF_ARG -1 # make sure it is aligned and v0, t4, -2 * FFI_SIZEOF_ARG # to a proper boundry. sixteen: @@ -87,10 +87,10 @@ # Call ffi_prep_args jal t9 - + # Copy the stack pointer to t9 move t9, $sp - + # Fix the stack if there are more than 8 64bit slots worth # of arguments. @@ -102,8 +102,8 @@ bltz t8, loadregs ADDU t9, t9, t8 - -loadregs: + +loadregs: REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6. @@ -111,14 +111,14 @@ bnez t4, arg1_floatp REG_L a0, 0*FFI_SIZEOF_ARG(t9) b arg1_next -arg1_floatp: +arg1_floatp: bne t4, FFI_TYPE_FLOAT, arg1_doublep l.s $f12, 0*FFI_SIZEOF_ARG(t9) b arg1_next -arg1_doublep: +arg1_doublep: l.d $f12, 0*FFI_SIZEOF_ARG(t9) -arg1_next: - +arg1_next: + SRL t4, t6, 1*FFI_FLAG_BITS and t4, ((1< #include -/* Only build this code if we are compiling for o32 */ +/* Only build this code if we are compiling for o32 */ #if defined(FFI_MIPS_O32) - + #define callback a0 #define bytes a2 #define flags a3 - + #define SIZEOF_FRAME (4 * FFI_SIZEOF_ARG + 2 * FFI_SIZEOF_ARG) #define A3_OFF (SIZEOF_FRAME + 3 * FFI_SIZEOF_ARG) #define FP_OFF (SIZEOF_FRAME - 2 * FFI_SIZEOF_ARG) @@ -46,7 +46,7 @@ .align 2 .globl ffi_call_O32 .ent ffi_call_O32 -ffi_call_O32: +ffi_call_O32: $LFB0: # Prologue SUBU $sp, SIZEOF_FRAME # Frame size @@ -65,7 +65,7 @@ LI v0, 4 * FFI_SIZEOF_ARG blt bytes, v0, sixteen - ADDU v0, bytes, 7 # make sure it is aligned + ADDU v0, bytes, 7 # make sure it is aligned and v0, -8 # to an 8 byte boundry sixteen: @@ -75,11 +75,11 @@ ADDU a0, $sp, 4 * FFI_SIZEOF_ARG jalr t9 - + REG_L t0, A3_OFF($fp) # load the flags word SRL t2, t0, 4 # shift our arg info and t0, ((1<<4)-1) # mask out the return type - + ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args bnez t0, pass_d # make it quick for int @@ -96,21 +96,21 @@ REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it -pass_f: +pass_f: bne t0, FFI_ARGS_F, pass_d_d l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args REG_L a1, 1*FFI_SIZEOF_ARG($sp) # passing a float REG_L a2, 2*FFI_SIZEOF_ARG($sp) REG_L a3, 3*FFI_SIZEOF_ARG($sp) - b call_it + b call_it -pass_d_d: +pass_d_d: bne t0, FFI_ARGS_DD, pass_f_f l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing two doubles b call_it -pass_f_f: +pass_f_f: bne t0, FFI_ARGS_FF, pass_d_f l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args l.s $f14, 1*FFI_SIZEOF_ARG($sp) # passing two floats @@ -118,20 +118,20 @@ REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it -pass_d_f: +pass_d_f: bne t0, FFI_ARGS_DF, pass_f_d l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args l.s $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it -pass_f_d: +pass_f_d: # assume that the only other combination must be float then double # bne t0, FFI_ARGS_F_D, call_it l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float -call_it: +call_it: # Load the function pointer REG_L t9, SIZEOF_FRAME + 5*FFI_SIZEOF_ARG($fp) @@ -161,19 +161,19 @@ s.s $f0, 0(t0) b epilogue -retdouble: +retdouble: bne t2, FFI_TYPE_DOUBLE, noretval jalr t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) s.d $f0, 0(t0) b epilogue - -noretval: + +noretval: jalr t9 - + # Epilogue -epilogue: - move $sp, $fp +epilogue: + move $sp, $fp REG_L $fp, FP_OFF($sp) # Restore frame pointer REG_L ra, RA_OFF($sp) # Restore return address ADDU $sp, SIZEOF_FRAME # Fix stack pointer @@ -187,7 +187,7 @@ in t4 ($12). Stores any arguments passed in registers onto the stack, then calls ffi_closure_mips_inner_O32, which then decodes them. - + Stack layout: 3 - a3 save @@ -209,7 +209,7 @@ -13 - Called function a1 save -14 - Called function a0 save, our sp and fp point here */ - + #define SIZEOF_FRAME2 (14 * FFI_SIZEOF_ARG) #define A3_OFF2 (SIZEOF_FRAME2 + 3 * FFI_SIZEOF_ARG) #define A2_OFF2 (SIZEOF_FRAME2 + 2 * FFI_SIZEOF_ARG) @@ -260,11 +260,11 @@ li $13, 1 # FFI_O32 bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT - + # Store all possible float/double registers. s.d $f12, FA_0_0_OFF2($fp) s.d $f14, FA_1_0_OFF2($fp) -1: +1: # Call ffi_closure_mips_inner_O32 to do the work. la t9, ffi_closure_mips_inner_O32 move a0, $12 # Pointer to the ffi_closure @@ -288,7 +288,7 @@ li $9, FFI_TYPE_DOUBLE l.d $f0, V0_OFF2($fp) beq $8, $9, closure_done -1: +1: REG_L $3, V1_OFF2($fp) REG_L $2, V0_OFF2($fp) diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/moxie/eabi.S --- a/Modules/_ctypes/libffi/src/moxie/eabi.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/moxie/eabi.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- eabi.S - Copyright (c) 2004 Anthony Green - + FR-V Assembly glue. Permission is hereby granted, free of charge, to any person obtaining @@ -23,7 +23,7 @@ OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include @@ -40,8 +40,8 @@ # gr11: fig->flags # gr12: ecif.rvalue # gr13: fn - -ffi_call_EABI: + +ffi_call_EABI: addi sp, #-80, sp sti fp, @(sp, #24) addi sp, #24, fp @@ -49,7 +49,7 @@ /* Make room for the new arguments. */ /* subi sp, fp, gr10 */ - + /* Store return address and incoming args on stack. */ sti gr5, @(fp, #8) sti gr8, @(fp, #-4) @@ -60,7 +60,7 @@ sti gr13, @(fp, #-24) sub sp, gr10, sp - + /* Call ffi_prep_args. */ ldi @(fp, #-4), gr4 addi sp, #0, gr8 @@ -70,11 +70,11 @@ calll @(gr14, gr0) #else calll @(gr4, gr0) -#endif +#endif /* ffi_prep_args returns the new stack pointer. */ mov gr8, gr4 - + ldi @(sp, #0), gr8 ldi @(sp, #4), gr9 ldi @(sp, #8), gr10 @@ -90,7 +90,7 @@ /* Use the ffi_prep_args return value for the new sp. */ mov gr4, sp - + /* Call the target function. */ ldi @(fp, -24), gr4 #ifdef __FRV_FDPIC__ @@ -98,7 +98,7 @@ calll @(gr14, gr0) #else calll @(gr4, gr0) -#endif +#endif /* Store the result. */ ldi @(fp, #-16), gr10 /* fig->flags */ @@ -117,7 +117,7 @@ beq icc0, 0, .L3 /* No, save a 4 byte return value. */ sti gr8, @(gr4, #0) -.L3: +.L3: /* Restore the stack, and return. */ ldi @(fp, 8), gr5 @@ -125,4 +125,4 @@ addi sp,#80,sp jmpl @(gr5,gr0) .size ffi_call_EABI, .-ffi_call_EABI - + diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/moxie/ffi.c --- a/Modules/_ctypes/libffi/src/moxie/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/moxie/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (C) 2009 Anthony Green - - Moxie Foreign Function Interface + + Moxie Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -48,19 +48,19 @@ i--, p_arg++) { size_t z; - + z = (*p_arg)->size; if ((*p_arg)->type == FFI_TYPE_STRUCT) { z = sizeof(void*); *(void **) argp = *p_argv; - } + } /* if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (count > 24) { - // This is going on the stack. Turn it into a double. + // This is going on the stack. Turn it into a double. *(double *) argp = (double) *(float*)(* p_argv); z = sizeof(double); } @@ -75,19 +75,19 @@ case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; - + case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; - + case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; - + case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; - + default: FFI_ASSERT(0); } @@ -121,38 +121,38 @@ return FFI_OK; } -extern void ffi_call_EABI(void *(*)(char *, extended_cif *), - extended_cif *, - unsigned, unsigned, - unsigned *, +extern void ffi_call_EABI(void *(*)(char *, extended_cif *), + extended_cif *, + unsigned, unsigned, + unsigned *, void (*fn)(void)); -void ffi_call(ffi_cif *cif, - void (*fn)(void), - void *rvalue, +void ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; - + /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ - if ((rvalue == NULL) && + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; - - - switch (cif->abi) + + + switch (cif->abi) { case FFI_EABI: - ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, + ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: @@ -237,7 +237,7 @@ /* Functions return 4-byte or smaller results in gr8. 8-byte values also use gr9. We fill the both, even for small return - values, just to avoid a branch. */ + values, just to avoid a branch. */ asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/pa/ffi.c --- a/Modules/_ctypes/libffi/src/pa/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/pa/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -3,9 +3,9 @@ (c) 2008 Red Hat, Inc. (c) 2006 Free Software Foundation, Inc. (c) 2003-2004 Randolph Chung - + HPPA Foreign Function Interface - HP-UX PA ABI support + HP-UX PA ABI support Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/powerpc/aix.S --- a/Modules/_ctypes/libffi/src/powerpc/aix.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/powerpc/aix.S Sat Aug 04 21:43:50 2012 +0300 @@ -204,7 +204,7 @@ b L(done_return_value) #else /* ! __64BIT__ */ - + .long .ffi_call_AIX, TOC[tc0], 0 .csect .text[PR] .ffi_call_AIX: diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/powerpc/aix_closure.S --- a/Modules/_ctypes/libffi/src/powerpc/aix_closure.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/powerpc/aix_closure.S Sat Aug 04 21:43:50 2012 +0300 @@ -272,7 +272,7 @@ blr #else /* ! __64BIT__ */ - + .long .ffi_closure_ASM, TOC[tc0], 0 .csect .text[PR] .ffi_closure_ASM: diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/powerpc/darwin.S --- a/Modules/_ctypes/libffi/src/powerpc/darwin.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/powerpc/darwin.S Sat Aug 04 21:43:50 2012 +0300 @@ -89,7 +89,7 @@ /* Save the old stack pointer as AP. */ mr r8,r1 LCFI0: - + /* Save the retval type in parents frame. */ sg r9,(LINKAGE_SIZE+6*GPR_BYTES)(r8) @@ -100,7 +100,7 @@ mflr r9 sg r9,SAVED_LR_OFFSET(r8) - sg r28,-(4 * GPR_BYTES)(r8) + sg r28,-(4 * GPR_BYTES)(r8) sg r29,-(3 * GPR_BYTES)(r8) sg r30,-(2 * GPR_BYTES)(r8) sg r31,-( GPR_BYTES)(r8) @@ -178,7 +178,7 @@ /* Now, deal with the return value. */ /* m64 structure returns can occupy the same set of registers as - would be used to pass such a structure as arg0 - so take care + would be used to pass such a structure as arg0 - so take care not to step on any possibly hot regs. */ /* Get the flags.. */ @@ -186,10 +186,10 @@ ; FLAG_RETURNS_NOTHING also covers struct ret-by-ref. bt 30,L(done_return_value) ; FLAG_RETURNS_NOTHING bf 27,L(scalar_return_value) ; not FLAG_RETURNS_STRUCT - + /* OK, so we have a struct. */ #if defined(__ppc64__) - bt 31,L(maybe_return_128) ; FLAG_RETURNS_128BITS, special case + bt 31,L(maybe_return_128) ; FLAG_RETURNS_128BITS, special case /* OK, we have to map the return back to a mem struct. We are about to trample the parents param area, so recover the @@ -220,7 +220,7 @@ subf r4,r5,r4 L3: bl _memcpy - + /* ... do we need the FP registers? - recover the flags.. */ mtcrf 0x03,r31 ; we need c6 & cr7 now. bf 29,L(done_return_value) /* No floats in the struct. */ @@ -275,14 +275,14 @@ L(scalar_return_value): bt 29,L(fp_return_value) ; FLAG_RETURNS_FP - ; ffi_arg is defined as unsigned long. + ; ffi_arg is defined as unsigned long. sg r3,0(r30) ; Save the reg. - bf 28,L(done_return_value) ; not FLAG_RETURNS_64BITS + bf 28,L(done_return_value) ; not FLAG_RETURNS_64BITS #if defined(__ppc64__) L(maybe_return_128): std r3,0(r30) - bf 31,L(done_return_value) ; not FLAG_RETURNS_128BITS + bf 31,L(done_return_value) ; not FLAG_RETURNS_128BITS std r4,8(r30) #else stw r4,4(r30) diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/powerpc/darwin_closure.S --- a/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- - darwin_closure.S - Copyright (c) 2002, 2003, 2004, 2010, - Free Software Foundation, Inc. + darwin_closure.S - Copyright (c) 2002, 2003, 2004, 2010, + Free Software Foundation, Inc. based on ppc_closure.S PowerPC Assembly glue. @@ -54,7 +54,7 @@ #define SAVED_CR_OFFSET MODE_CHOICE(4,8) /* save position for CR */ #define SAVED_LR_OFFSET MODE_CHOICE(8,16) /* save position for lr */ -/* WARNING: if ffi_type is changed... here be monsters. +/* WARNING: if ffi_type is changed... here be monsters. Offsets of items within the result type. */ #define FFI_TYPE_TYPE MODE_CHOICE(6,10) #define FFI_TYPE_ELEM MODE_CHOICE(8,16) @@ -404,9 +404,9 @@ /* OK, frustratingly, the process of saving the struct to mem might have messed with the FPRs, so we have to re-load them :(. - We`ll use our FPRs space again - calling: - void darwin64_pass_struct_floats (ffi_type *s, char *src, - unsigned *nfpr, double **fprs) + We`ll use our FPRs space again - calling: + void darwin64_pass_struct_floats (ffi_type *s, char *src, + unsigned *nfpr, double **fprs) We`ll temporarily pinch the first two slots of the param area for local vars used by the routine. */ xor r6,r6,r6 @@ -419,7 +419,7 @@ lg r3,LINKAGE_SIZE(r1) ; ffi_type * result_type. bl PASS_STR_FLOATS ; get struct floats into FPR save space. /* See if we used any floats */ - lwz r0,(SAVE_SIZE-RESULT_BYTES)(r1) + lwz r0,(SAVE_SIZE-RESULT_BYTES)(r1) cmpi 0,r0,0 beq Lstructints ; nope. /* OK load `em up... */ @@ -458,7 +458,7 @@ blr Lendcode: .align 1 - + /* END(ffi_closure_ASM) */ /* EH frame stuff. */ diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/powerpc/ffi.c --- a/Modules/_ctypes/libffi/src/powerpc/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/powerpc/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -1000,7 +1000,7 @@ #else unsigned int *tramp; - if (! (cif->abi == FFI_GCC_SYSV + if (! (cif->abi == FFI_GCC_SYSV || cif->abi == FFI_SYSV || cif->abi == FFI_LINUX || cif->abi == FFI_LINUX_SOFT_FLOAT)) diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c --- a/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c Sat Aug 04 21:43:50 2012 +0300 @@ -6,7 +6,7 @@ Copyright (C) 2002, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. FFI support for Darwin and AIX. - + 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 @@ -35,7 +35,7 @@ extern void ffi_closure_ASM (void); enum { - /* The assembly depends on these exact flags. + /* The assembly depends on these exact flags. For Darwin64 (when FLAG_RETURNS_STRUCT is set): FLAG_RETURNS_FP indicates that the structure embeds FP data. FLAG_RETURNS_128BITS signals a special struct size that is not @@ -64,7 +64,7 @@ /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments. - + m32/m64 The stack layout we want looks like this: @@ -96,7 +96,7 @@ #if defined(POWERPC_DARWIN64) static void -darwin64_pass_struct_by_value +darwin64_pass_struct_by_value (ffi_type *, char *, unsigned, unsigned *, double **, unsigned long **); #endif @@ -108,7 +108,7 @@ const unsigned bytes = ecif->cif->bytes; const unsigned flags = ecif->cif->flags; const unsigned nargs = ecif->cif->nargs; -#if !defined(POWERPC_DARWIN64) +#if !defined(POWERPC_DARWIN64) const ffi_abi abi = ecif->cif->abi; #endif @@ -128,7 +128,7 @@ void **p_argv = ecif->avalue; unsigned long gprvalue; ffi_type** ptr = ecif->cif->arg_types; -#if !defined(POWERPC_DARWIN64) +#if !defined(POWERPC_DARWIN64) char *dest_cpy; #endif unsigned size_al = 0; @@ -256,7 +256,7 @@ size_al = (*ptr)->size; #if defined(POWERPC_DARWIN64) next_arg = (unsigned long *)ALIGN((char *)next_arg, (*ptr)->alignment); - darwin64_pass_struct_by_value (*ptr, (char *) *p_argv, + darwin64_pass_struct_by_value (*ptr, (char *) *p_argv, (unsigned) size_al, (unsigned int *) &fparg_count, &fpr_base, &next_arg); @@ -268,7 +268,7 @@ if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN((*ptr)->size, 8); -# if defined(POWERPC64) +# if defined(POWERPC64) FFI_ASSERT (abi != FFI_DARWIN); memcpy ((char *) dest_cpy, (char *) *p_argv, size_al); next_arg += (size_al + 7) / 8; @@ -336,7 +336,7 @@ (*nfpr) += 1; break; default: - break; + break; } } } @@ -381,9 +381,9 @@ default: /* If we try and place any item, that is non-float, once we've exceeded the 8 GPR mark, then we can't fit the struct. */ - if ((unsigned long)item_base >= 8*8) + if ((unsigned long)item_base >= 8*8) return 1; - break; + break; } /* now count the size of what we just used. */ struct_offset += p->size; @@ -392,37 +392,37 @@ } /* Can this struct be returned by value? */ -int +int darwin64_struct_ret_by_value_p (ffi_type *s) { unsigned nfp = 0; FFI_ASSERT (s && s->type == FFI_TYPE_STRUCT); - + /* The largest structure we can return is 8long + 13 doubles. */ if (s->size > 168) return 0; - + /* We can't pass more than 13 floats. */ darwin64_scan_struct_for_floats (s, &nfp); if (nfp > 13) return 0; - + /* If there are not too many floats, and the struct is small enough to accommodate in the GPRs, then it must be OK. */ if (s->size <= 64) return 1; - + /* Well, we have to look harder. */ nfp = 0; if (darwin64_struct_size_exceeds_gprs_p (s, NULL, &nfp)) return 0; - + return 1; } void -darwin64_pass_struct_floats (ffi_type *s, char *src, +darwin64_pass_struct_floats (ffi_type *s, char *src, unsigned *nfpr, double **fprs) { int i; @@ -462,7 +462,7 @@ (*nfpr) += 1; break; default: - break; + break; } /* now count the size of what we just used. */ struct_offset += p->size; @@ -487,13 +487,13 @@ /* First... special cases. */ if (size < 3 - || (size == 4 - && s->elements[0] + || (size == 4 + && s->elements[0] && s->elements[0]->type != FFI_TYPE_FLOAT)) { - /* Must be at least one GPR, padding is unspecified in value, + /* Must be at least one GPR, padding is unspecified in value, let's make it zero. */ - *next_arg = 0UL; + *next_arg = 0UL; dest_cpy += 8 - size; memcpy ((char *) dest_cpy, src, size); next_arg++; @@ -510,7 +510,7 @@ darwin64_pass_struct_floats (s, src, nfpr, fprs); next_arg += (size+7)/8; } - + *arg = next_arg; } @@ -558,7 +558,7 @@ } break; default: - break; + break; } /* now count the size of what we just used. */ struct_offset += p->size; @@ -569,7 +569,7 @@ #endif /* Adjust the size of S to be correct for Darwin. - On Darwin m32, the first field of a structure has natural alignment. + On Darwin m32, the first field of a structure has natural alignment. On Darwin m64, all fields have natural alignment. */ static void @@ -585,7 +585,7 @@ { ffi_type *p; int align; - + p = s->elements[i]; if (p->type == FFI_TYPE_STRUCT) darwin_adjust_aggregate_sizes (p); @@ -606,9 +606,9 @@ /* Pad, if necessary, before adding the current item. */ s->size = ALIGN(s->size, align) + p->size; } - + s->size = ALIGN(s->size, s->alignment); - + /* This should not be necessary on m64, but harmless. */ if (s->elements[0]->type == FFI_TYPE_UINT64 || s->elements[0]->type == FFI_TYPE_SINT64 @@ -634,7 +634,7 @@ { ffi_type *p; int align; - + p = s->elements[i]; aix_adjust_aggregate_sizes (p); align = p->alignment; @@ -642,9 +642,9 @@ align = 4; s->size = ALIGN(s->size, align) + p->size; } - + s->size = ALIGN(s->size, s->alignment); - + if (s->elements[0]->type == FFI_TYPE_UINT64 || s->elements[0]->type == FFI_TYPE_SINT64 || s->elements[0]->type == FFI_TYPE_DOUBLE @@ -688,7 +688,7 @@ bytes = (LINKAGE_AREA_GPRS + ASM_NEEDS_REGISTERS) * sizeof(unsigned long); - /* Return value handling. + /* Return value handling. The rules m32 are as follows: - 32-bit (or less) integer values are returned in gpr3; - structures of size <= 4 bytes also returned in gpr3; @@ -781,9 +781,9 @@ /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest - goes on the stack. - ??? Structures are passed as a pointer to a copy of the structure. - Stuff on the stack needs to keep proper alignment. + goes on the stack. + ??? Structures are passed as a pointer to a copy of the structure. + Stuff on the stack needs to keep proper alignment. For m64 the count is effectively of half-GPRs. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { @@ -826,7 +826,7 @@ on the stack. If they go on the stack, they must be 8-byte-aligned. */ if (intarg_count == NUM_GPR_ARG_REGISTERS-1 - || (intarg_count >= NUM_GPR_ARG_REGISTERS + || (intarg_count >= NUM_GPR_ARG_REGISTERS && (intarg_count & 0x01) != 0)) intarg_count++; intarg_count += 2; @@ -850,7 +850,7 @@ if (align_words) intarg_count = ALIGN(intarg_count, align_words); /* If the first member of the struct is a double, then align - the struct to double-word. + the struct to double-word. if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN((*ptr)->size, 8); */ # ifdef POWERPC64 @@ -875,7 +875,7 @@ #if defined(POWERPC_DARWIN64) /* Space to image the FPR registers, if needed - which includes when they might be used in a struct return. */ - if (fparg_count != 0 + if (fparg_count != 0 || ((flags & FLAG_RETURNS_STRUCT) && (flags & FLAG_RETURNS_FP))) bytes += NUM_FPR_ARG_REGISTERS * sizeof(double); @@ -1220,10 +1220,10 @@ fpsused++; } } - else + else { if (size_al != 16) - pfr = (ffi_dblfl *) + pfr = (ffi_dblfl *) darwin64_struct_floats_to_mem (arg_types[i], (char *)pgr, (double *)pfr, &fpsused); avalue[i] = pgr; diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/raw_api.c --- a/Modules/_ctypes/libffi/src/raw_api.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/raw_api.c Sat Aug 04 21:43:50 2012 +0300 @@ -62,27 +62,27 @@ #if WORDS_BIGENDIAN for (i = 0; i < cif->nargs; i++, tp++, args++) - { + { switch ((*tp)->type) { case FFI_TYPE_UINT8: case FFI_TYPE_SINT8: *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 1); break; - + case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 2); break; -#if FFI_SIZEOF_ARG >= 4 +#if FFI_SIZEOF_ARG >= 4 case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 4); break; #endif - -#if !FFI_NO_STRUCTS + +#if !FFI_NO_STRUCTS case FFI_TYPE_STRUCT: *args = (raw++)->ptr; break; @@ -91,7 +91,7 @@ case FFI_TYPE_POINTER: *args = (void*) &(raw++)->ptr; break; - + default: *args = raw; raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; @@ -104,7 +104,7 @@ /* then assume little endian */ for (i = 0; i < cif->nargs; i++, tp++, args++) - { + { #if !FFI_NO_STRUCTS if ((*tp)->type == FFI_TYPE_STRUCT) { @@ -132,7 +132,7 @@ ffi_type **tp = cif->arg_types; for (i = 0; i < cif->nargs; i++, tp++, args++) - { + { switch ((*tp)->type) { case FFI_TYPE_UINT8: diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/s390/ffi.c --- a/Modules/_ctypes/libffi/src/s390/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/s390/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -1,9 +1,9 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2000, 2007 Software AG Copyright (c) 2008 Red Hat, Inc - + S390 Foreign Function Interface - + 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 @@ -11,10 +11,10 @@ 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. @@ -27,24 +27,24 @@ /* Includes */ /* -------- */ /*====================================================================*/ - + #include #include - + #include #include - + /*====================== End of Includes =============================*/ - + /*====================================================================*/ /* Defines */ /* ------- */ /*====================================================================*/ -/* Maximum number of GPRs available for argument passing. */ +/* Maximum number of GPRs available for argument passing. */ #define MAX_GPRARGS 5 -/* Maximum number of FPRs available for argument passing. */ +/* Maximum number of FPRs available for argument passing. */ #ifdef __s390x__ #define MAX_FPRARGS 4 #else @@ -63,27 +63,27 @@ #define FFI390_RET_INT64 5 /*===================== End of Defines ===============================*/ - + /*====================================================================*/ /* Prototypes */ /* ---------- */ /*====================================================================*/ - + static void ffi_prep_args (unsigned char *, extended_cif *); void #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) __attribute__ ((visibility ("hidden"))) #endif -ffi_closure_helper_SYSV (ffi_closure *, unsigned long *, +ffi_closure_helper_SYSV (ffi_closure *, unsigned long *, unsigned long long *, unsigned long *); /*====================== End of Prototypes ===========================*/ - + /*====================================================================*/ /* Externals */ /* --------- */ /*====================================================================*/ - + extern void ffi_call_SYSV(unsigned, extended_cif *, void (*)(unsigned char *, extended_cif *), @@ -92,9 +92,9 @@ void (*fn)(void)); extern void ffi_closure_SYSV(void); - + /*====================== End of Externals ============================*/ - + /*====================================================================*/ /* */ /* Name - ffi_check_struct_type. */ @@ -103,7 +103,7 @@ /* general purpose or floating point register. */ /* */ /*====================================================================*/ - + static int ffi_check_struct_type (ffi_type *arg) { @@ -111,7 +111,7 @@ /* If the struct has just one element, look at that element to find out whether to consider the struct as floating point. */ - while (arg->type == FFI_TYPE_STRUCT + while (arg->type == FFI_TYPE_STRUCT && arg->elements[0] && !arg->elements[1]) arg = arg->elements[0]; @@ -144,9 +144,9 @@ /* Other structs are passed via a pointer to the data. */ return FFI_TYPE_POINTER; } - + /*======================== End of Routine ============================*/ - + /*====================================================================*/ /* */ /* Name - ffi_prep_args. */ @@ -157,7 +157,7 @@ /* has been allocated for the function's arguments. */ /* */ /*====================================================================*/ - + static void ffi_prep_args (unsigned char *stack, extended_cif *ecif) { @@ -192,7 +192,7 @@ ffi_type **ptr; void **p_argv = ecif->avalue; int i; - + /* If we returning a structure then we set the first parameter register to the address of where we are returning this structure. */ @@ -200,7 +200,7 @@ p_gpr[n_gpr++] = (unsigned long) ecif->rvalue; /* Now for the arguments. */ - + for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv++) @@ -229,7 +229,7 @@ } /* Now handle all primitive int/pointer/float data types. */ - switch (type) + switch (type) { case FFI_TYPE_DOUBLE: if (n_fpr < MAX_FPRARGS) @@ -242,7 +242,7 @@ p_ov[n_ov++] = ((unsigned long *) arg)[1]; #endif break; - + case FFI_TYPE_FLOAT: if (n_fpr < MAX_FPRARGS) p_fpr[n_fpr++] = (long long) *(unsigned int *) arg << 32; @@ -256,7 +256,7 @@ else p_ov[n_ov++] = (unsigned long)*(unsigned char **) arg; break; - + case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: #ifdef __s390x__ @@ -275,14 +275,14 @@ p_ov[n_ov++] = ((unsigned long *) arg)[1]; #endif break; - + case FFI_TYPE_UINT32: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(unsigned int *) arg; else p_ov[n_ov++] = *(unsigned int *) arg; break; - + case FFI_TYPE_INT: case FFI_TYPE_SINT32: if (n_gpr < MAX_GPRARGS) @@ -290,14 +290,14 @@ else p_ov[n_ov++] = *(signed int *) arg; break; - + case FFI_TYPE_UINT16: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(unsigned short *) arg; else p_ov[n_ov++] = *(unsigned short *) arg; break; - + case FFI_TYPE_SINT16: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(signed short *) arg; @@ -311,14 +311,14 @@ else p_ov[n_ov++] = *(unsigned char *) arg; break; - + case FFI_TYPE_SINT8: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(signed char *) arg; else p_ov[n_ov++] = *(signed char *) arg; break; - + default: FFI_ASSERT (0); break; @@ -327,7 +327,7 @@ } /*======================== End of Routine ============================*/ - + /*====================================================================*/ /* */ /* Name - ffi_prep_cif_machdep. */ @@ -335,7 +335,7 @@ /* Function - Perform machine dependent CIF processing. */ /* */ /*====================================================================*/ - + ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { @@ -347,7 +347,7 @@ ffi_type **ptr; int i; - /* Determine return value handling. */ + /* Determine return value handling. */ switch (cif->rtype->type) { @@ -360,7 +360,7 @@ case FFI_TYPE_STRUCT: cif->flags = FFI390_RET_STRUCT; n_gpr++; /* We need one GPR to pass the pointer. */ - break; + break; /* Floating point values are returned in fpr 0. */ case FFI_TYPE_FLOAT: @@ -399,14 +399,14 @@ cif->flags = FFI390_RET_INT32; #endif break; - + default: FFI_ASSERT (0); break; } /* Now for the arguments. */ - + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) @@ -431,7 +431,7 @@ } /* Now handle all primitive int/float data types. */ - switch (type) + switch (type) { /* The first MAX_FPRARGS floating point arguments go in FPRs, the rest overflow to the stack. */ @@ -442,7 +442,7 @@ else n_ov += sizeof (double) / sizeof (long); break; - + case FFI_TYPE_FLOAT: if (n_fpr < MAX_FPRARGS) n_fpr++; @@ -452,9 +452,9 @@ /* On 31-bit machines, 64-bit integers are passed in GPR pairs, if one is still available, or else on the stack. If only one - register is free, skip the register (it won't be used for any + register is free, skip the register (it won't be used for any subsequent argument either). */ - + #ifndef __s390x__ case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: @@ -470,7 +470,7 @@ /* Everything else is passed in GPRs (until MAX_GPRARGS have been used) or overflows to the stack. */ - default: + default: if (n_gpr < MAX_GPRARGS) n_gpr++; else @@ -483,12 +483,12 @@ and temporary structure copies. */ cif->bytes = ROUND_SIZE (n_ov * sizeof (long)) + struct_size; - + return FFI_OK; } - + /*======================== End of Routine ============================*/ - + /*====================================================================*/ /* */ /* Name - ffi_call. */ @@ -496,7 +496,7 @@ /* Function - Call the FFI routine. */ /* */ /*====================================================================*/ - + void ffi_call(ffi_cif *cif, void (*fn)(void), @@ -505,7 +505,7 @@ { int ret_type = cif->flags; extended_cif ecif; - + ecif.cif = cif; ecif.avalue = avalue; ecif.rvalue = rvalue; @@ -517,7 +517,7 @@ ecif.rvalue = alloca (cif->rtype->size); else ret_type = FFI390_RET_VOID; - } + } switch (cif->abi) { @@ -525,13 +525,13 @@ ffi_call_SYSV (cif->bytes, &ecif, ffi_prep_args, ret_type, ecif.rvalue, fn); break; - + default: FFI_ASSERT (0); break; } } - + /*======================== End of Routine ============================*/ /*====================================================================*/ @@ -541,7 +541,7 @@ /* Function - Call a FFI closure target function. */ /* */ /*====================================================================*/ - + void ffi_closure_helper_SYSV (ffi_closure *closure, unsigned long *p_gpr, @@ -565,8 +565,8 @@ p_arg = avalue = alloca (closure->cif->nargs * sizeof (void *)); - /* If we returning a structure, pass the structure address - directly to the target function. Otherwise, have the target + /* If we returning a structure, pass the structure address + directly to the target function. Otherwise, have the target function store the return value to the GPR save area. */ if (closure->cif->flags == FFI390_RET_STRUCT) @@ -592,7 +592,7 @@ { type = ffi_check_struct_type (*ptr); - /* If we pass the struct via pointer, remember to + /* If we pass the struct via pointer, remember to retrieve the pointer later. */ if (type == FFI_TYPE_POINTER) deref_struct_pointer = 1; @@ -607,23 +607,23 @@ #endif /* Now handle all primitive int/float data types. */ - switch (type) + switch (type) { case FFI_TYPE_DOUBLE: if (n_fpr < MAX_FPRARGS) *p_arg = &p_fpr[n_fpr++]; else - *p_arg = &p_ov[n_ov], + *p_arg = &p_ov[n_ov], n_ov += sizeof (double) / sizeof (long); break; - + case FFI_TYPE_FLOAT: if (n_fpr < MAX_FPRARGS) *p_arg = &p_fpr[n_fpr++]; else *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4; break; - + case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: #ifdef __s390x__ @@ -640,7 +640,7 @@ *p_arg = &p_ov[n_ov], n_ov += 2; #endif break; - + case FFI_TYPE_INT: case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: @@ -649,7 +649,7 @@ else *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4; break; - + case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: if (n_gpr < MAX_GPRARGS) @@ -665,7 +665,7 @@ else *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 1; break; - + default: FFI_ASSERT (0); break; @@ -732,7 +732,7 @@ break; } } - + /*======================== End of Routine ============================*/ /*====================================================================*/ @@ -742,7 +742,7 @@ /* Function - Prepare a FFI closure. */ /* */ /*====================================================================*/ - + ffi_status ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif, @@ -767,14 +767,14 @@ *(short *)&closure->tramp [8] = 0x07f1; /* br %r1 */ *(long *)&closure->tramp[16] = (long)codeloc; *(long *)&closure->tramp[24] = (long)&ffi_closure_SYSV; -#endif - +#endif + closure->cif = cif; closure->user_data = user_data; closure->fun = fun; - + return FFI_OK; } /*======================== End of Routine ============================*/ - + diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/s390/sysv.S --- a/Modules/_ctypes/libffi/src/s390/sysv.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/s390/sysv.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,9 +1,9 @@ /* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2000 Software AG Copyright (c) 2008 Red Hat, Inc. - + S390 Foreign Function Interface - + 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 @@ -11,10 +11,10 @@ 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 @@ -30,7 +30,7 @@ #include #ifndef __s390x__ - + .text # r2: cif->bytes @@ -38,8 +38,8 @@ # r4: ffi_prep_args # r5: ret_type # r6: ecif.rvalue - # ov: fn - + # ov: fn + # This assumes we are using gas. .globl ffi_call_SYSV .type ffi_call_SYSV,%function @@ -81,7 +81,7 @@ ste %f0,0(%r8) # Return float lm %r6,%r15,48+24(%r11) br %r4 - + .LretDouble: l %r4,48+56(%r11) std %f0,0(%r8) # Return double @@ -93,13 +93,13 @@ st %r2,0(%r8) # Return int lm %r6,%r15,48+24(%r11) br %r4 - + .LretInt64: l %r4,48+56(%r11) stm %r2,%r3,0(%r8) # Return long long lm %r6,%r15,48+24(%r11) br %r4 - + .Ltable: .byte .LretNone-.Lbase # FFI390_RET_VOID .byte .LretNone-.Lbase # FFI390_RET_STRUCT @@ -108,7 +108,7 @@ .byte .LretInt32-.Lbase # FFI390_RET_INT32 .byte .LretInt64-.Lbase # FFI390_RET_INT64 -.LFE1: +.LFE1: .ffi_call_SYSV_end: .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV @@ -146,7 +146,7 @@ .Lchelper: .long ffi_closure_helper_SYSV-.Lcbase -.LFE2: +.LFE2: .ffi_closure_SYSV_end: .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV @@ -233,16 +233,16 @@ .LEFDE2: #else - + .text - + # r2: cif->bytes # r3: &ecif # r4: ffi_prep_args # r5: ret_type # r6: ecif.rvalue - # ov: fn - + # ov: fn + # This assumes we are using gas. .globl ffi_call_SYSV .type ffi_call_SYSV,%function @@ -285,7 +285,7 @@ ste %f0,0(%r8) # Return float lmg %r6,%r15,80+48(%r11) br %r4 - + .LretDouble: lg %r4,80+112(%r11) std %f0,0(%r8) # Return double @@ -297,13 +297,13 @@ st %r2,0(%r8) # Return int lmg %r6,%r15,80+48(%r11) br %r4 - + .LretInt64: lg %r4,80+112(%r11) stg %r2,0(%r8) # Return long lmg %r6,%r15,80+48(%r11) br %r4 - + .Ltable: .byte .LretNone-.Lbase # FFI390_RET_VOID .byte .LretNone-.Lbase # FFI390_RET_STRUCT @@ -312,7 +312,7 @@ .byte .LretInt32-.Lbase # FFI390_RET_INT32 .byte .LretInt64-.Lbase # FFI390_RET_INT64 -.LFE1: +.LFE1: .ffi_call_SYSV_end: .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV @@ -344,7 +344,7 @@ lg %r2,160+16(%r15) la %r15,160(%r15) br %r14 -.LFE2: +.LFE2: .ffi_closure_SYSV_end: .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/sh/ffi.c --- a/Modules/_ctypes/libffi/src/sh/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/sh/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -1,8 +1,8 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2002-2008, 2012 Kaz Kojima Copyright (c) 2008 Red Hat, Inc. - - SuperH Foreign Function Interface + + SuperH Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -154,19 +154,19 @@ case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; - + case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; - + case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; - + case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; - + case FFI_TYPE_STRUCT: *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); break; @@ -243,19 +243,19 @@ case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; - + case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; - + case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; - + case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; - + case FFI_TYPE_STRUCT: *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); break; @@ -356,7 +356,7 @@ cif->flags += ((cif->arg_types)[i]->type) << (2 * j); j++; break; - + default: size = (cif->arg_types)[i]->size; n = (size + sizeof (int) - 1) / sizeof (int); @@ -416,14 +416,14 @@ ecif.cif = cif; ecif.avalue = avalue; - + /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if (cif->rtype->type == FFI_TYPE_STRUCT && return_type (cif->rtype) != FFI_TYPE_STRUCT) ecif.rvalue = &trvalue; - else if ((rvalue == NULL) && + else if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); @@ -431,7 +431,7 @@ else ecif.rvalue = rvalue; - switch (cif->abi) + switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, @@ -494,11 +494,11 @@ return FFI_OK; } -/* Basically the trampoline invokes ffi_closure_SYSV, and on +/* Basically the trampoline invokes ffi_closure_SYSV, and on * entry, r3 holds the address of the closure. * After storing the registers that could possibly contain * parameters to be passed into the stack frame and setting - * up space for a return value, ffi_closure_SYSV invokes the + * up space for a return value, ffi_closure_SYSV invokes the * following helper function to do most of the work. */ @@ -511,8 +511,8 @@ #endif int -ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue, - unsigned long *pgr, unsigned long *pfr, +ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue, + unsigned long *pgr, unsigned long *pfr, unsigned long *pst) { void **avalue; @@ -522,7 +522,7 @@ #if defined(__SH4__) int freg = 0; #endif - ffi_cif *cif; + ffi_cif *cif; cif = closure->cif; avalue = alloca(cif->nargs * sizeof(void *)); @@ -559,12 +559,12 @@ case FFI_TYPE_UINT8: avalue[i] = (((char *)pgr) + OFS_INT8); break; - + case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = (((char *)pgr) + OFS_INT16); break; - + case FFI_TYPE_STRUCT: avalue[i] = pgr; break; @@ -644,12 +644,12 @@ case FFI_TYPE_UINT8: avalue[i] = (((char *)pst) + OFS_INT8); break; - + case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = (((char *)pst) + OFS_INT16); break; - + case FFI_TYPE_STRUCT: avalue[i] = pst; break; diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/sh/sysv.S --- a/Modules/_ctypes/libffi/src/sh/sysv.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/sh/sysv.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2002, 2003, 2004, 2006, 2008 Kaz Kojima - - SuperH Foreign Function Interface + + SuperH Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include #ifdef HAVE_MACHINE_ASM_H @@ -508,7 +508,7 @@ .LCFIB: sts.l pr,@-r15 - /* Stack layout: + /* Stack layout: xx bytes (on stack parameters) 16 bytes (register parameters) 4 bytes (saved frame pointer) @@ -644,16 +644,16 @@ bra L_case_v fmov.s @r2,fr0 #endif - + L_case_ll: mov.l @r2+,r0 bra L_case_v mov.l @r2,r1 - + L_case_i: bra L_case_v mov.l @r2,r0 - + L_case_q: #ifdef __LITTLE_ENDIAN__ #else diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/sh64/ffi.c --- a/Modules/_ctypes/libffi/src/sh64/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/sh64/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -1,8 +1,8 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2003, 2004, 2006, 2007, 2012 Kaz Kojima Copyright (c) 2008 Anthony Green - - SuperH SHmedia Foreign Function Interface + + SuperH SHmedia Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -89,19 +89,19 @@ case FFI_TYPE_SINT8: *(SINT64 *) argp = (SINT64) *(SINT8 *)(*p_argv); break; - + case FFI_TYPE_UINT8: *(UINT64 *) argp = (UINT64) *(UINT8 *)(*p_argv); break; - + case FFI_TYPE_SINT16: *(SINT64 *) argp = (SINT64) *(SINT16 *)(*p_argv); break; - + case FFI_TYPE_UINT16: *(UINT64 *) argp = (UINT64) *(UINT16 *)(*p_argv); break; - + case FFI_TYPE_STRUCT: memcpy (argp, *p_argv, z); break; @@ -197,7 +197,7 @@ else cif->flags2 += FFI_TYPE_INT << (2 * j++); break; - + default: size = (cif->arg_types)[i]->size; if (size < sizeof (UINT64)) @@ -240,17 +240,17 @@ /*@-declundef@*/ /*@-exportheader@*/ -extern void ffi_call_SYSV(void (*)(char *, extended_cif *), - /*@out@*/ extended_cif *, +extern void ffi_call_SYSV(void (*)(char *, extended_cif *), + /*@out@*/ extended_cif *, unsigned, unsigned, long long, - /*@out@*/ unsigned *, + /*@out@*/ unsigned *, void (*fn)(void)); /*@=declundef@*/ /*@=exportheader@*/ -void ffi_call(/*@dependent@*/ ffi_cif *cif, - void (*fn)(void), - /*@out@*/ void *rvalue, +void ffi_call(/*@dependent@*/ ffi_cif *cif, + void (*fn)(void), + /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue) { extended_cif ecif; @@ -258,14 +258,14 @@ ecif.cif = cif; ecif.avalue = avalue; - + /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if (cif->rtype->type == FFI_TYPE_STRUCT && return_type (cif->rtype) != FFI_TYPE_STRUCT) ecif.rvalue = &trvalue; - else if ((rvalue == NULL) && + else if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); @@ -273,7 +273,7 @@ else ecif.rvalue = rvalue; - switch (cif->abi) + switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, cif->flags2, @@ -338,16 +338,16 @@ return FFI_OK; } -/* Basically the trampoline invokes ffi_closure_SYSV, and on +/* Basically the trampoline invokes ffi_closure_SYSV, and on * entry, r3 holds the address of the closure. * After storing the registers that could possibly contain * parameters to be passed into the stack frame and setting - * up space for a return value, ffi_closure_SYSV invokes the + * up space for a return value, ffi_closure_SYSV invokes the * following helper function to do most of the work. */ int -ffi_closure_helper_SYSV (ffi_closure *closure, UINT64 *rvalue, +ffi_closure_helper_SYSV (ffi_closure *closure, UINT64 *rvalue, UINT64 *pgr, UINT64 *pfr, UINT64 *pst) { void **avalue; diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/sh64/sysv.S --- a/Modules/_ctypes/libffi/src/sh64/sysv.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/sh64/sysv.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2003, 2004, 2006, 2008 Kaz Kojima - - SuperH SHmedia Foreign Function Interface + + SuperH SHmedia Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -14,7 +14,7 @@ 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 @@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include #ifdef HAVE_MACHINE_ASM_H @@ -165,7 +165,7 @@ pt/l 5f, tr2 gettr tr1, r20 bge/l r23, r63, tr2 - add r1, r63, r23 + add r1, r63, r23 shlli r1, 3, r21 addi r1, 2, r1 add r20, r21, r20 @@ -330,7 +330,7 @@ .LCFI4: add r15, r63, r14 .LCFI5: - /* Stack layout: + /* Stack layout: ... 64 bytes (register parameters) 48 bytes (floating register parameters) diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/sparc/ffi.c --- a/Modules/_ctypes/libffi/src/sparc/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/sparc/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -1,8 +1,8 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2011 Anthony Green Copyright (c) 1996, 2003-2004, 2007-2008 Red Hat, Inc. - - SPARC Foreign Function Interface + + SPARC Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -91,15 +91,15 @@ case FFI_TYPE_SINT8: *(signed int *) argp = *(SINT8 *)(* p_argv); break; - + case FFI_TYPE_UINT8: *(unsigned int *) argp = *(UINT8 *)(* p_argv); break; - + case FFI_TYPE_SINT16: *(signed int *) argp = *(SINT16 *)(* p_argv); break; - + case FFI_TYPE_UINT16: *(unsigned int *) argp = *(UINT16 *)(* p_argv); break; @@ -116,7 +116,7 @@ p_argv++; argp += z; } - + return; } @@ -265,7 +265,7 @@ /* sparc call frames require that space is allocated for 6 args, even if they aren't used. Make that space if necessary. */ - + if (cif->bytes < 4*6+4) cif->bytes = 4*6+4; } @@ -275,7 +275,7 @@ /* sparc call frames require that space is allocated for 6 args, even if they aren't used. Make that space if necessary. */ - + if (cif->bytes < 8*6) cif->bytes = 8*6; } @@ -369,10 +369,10 @@ #ifdef SPARC64 -extern int ffi_call_v9(void *, extended_cif *, unsigned, +extern int ffi_call_v9(void *, extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); #else -extern int ffi_call_v8(void *, extended_cif *, unsigned, +extern int ffi_call_v8(void *, extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); #endif @@ -400,7 +400,7 @@ } } - switch (cif->abi) + switch (cif->abi) { case FFI_V8: #ifdef SPARC64 @@ -540,7 +540,7 @@ /* Copy the caller's structure return address so that the closure returns the data directly to the caller. */ if (cif->flags == FFI_TYPE_STRUCT -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE || cif->flags == FFI_TYPE_LONGDOUBLE #endif ) diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/sparc/v8.S --- a/Modules/_ctypes/libffi/src/sparc/v8.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/sparc/v8.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- v8.S - Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. - - SPARC Foreign Function Interface + + SPARC Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include @@ -41,9 +41,9 @@ .LLFB1: save %sp, -STACKFRAME, %sp .LLCFI0: - + sub %sp, %i2, %sp ! alloca() space in stack for frame to set up - add %sp, STACKFRAME, %l0 ! %l0 has start of + add %sp, STACKFRAME, %l0 ! %l0 has start of ! frame to set up mov %l0, %o0 ! call routine to set up frame @@ -141,7 +141,7 @@ #undef STACKFRAME #define STACKFRAME 104 /* 16*4 register window + - 1*4 struct return + + 1*4 struct return + 6*4 args backing store + 3*4 locals */ diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/sparc/v9.S --- a/Modules/_ctypes/libffi/src/sparc/v9.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/sparc/v9.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- v9.S - Copyright (c) 2000, 2003, 2004, 2008 Red Hat, Inc. - - SPARC 64-bit Foreign Function Interface + + SPARC 64-bit Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include @@ -46,9 +46,9 @@ .LLFB1: save %sp, -STACKFRAME, %sp .LLCFI0: - + sub %sp, %i2, %sp ! alloca() space in stack for frame to set up - add %sp, STACKFRAME+STACK_BIAS, %l0 ! %l0 has start of + add %sp, STACKFRAME+STACK_BIAS, %l0 ! %l0 has start of ! frame to set up mov %l0, %o0 ! call routine to set up frame diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/types.c --- a/Modules/_ctypes/libffi/src/types.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/types.c Sat Aug 04 21:43:50 2012 +0300 @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- types.c - Copyright (c) 1996, 1998 Red Hat, Inc. - + Predefined ffi_types needed by libffi. Permission is hereby granted, free of charge, to any person obtaining @@ -64,7 +64,7 @@ FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE); #ifdef __alpha__ -/* Even if we're not configured to default to 128-bit long double, +/* Even if we're not configured to default to 128-bit long double, maintain binary compatibility, as -mlong-double-128 can be used at any time. */ /* Validate the hard-coded number below. */ diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/x86/darwin.S --- a/Modules/_ctypes/libffi/src/x86/darwin.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/x86/darwin.S Sat Aug 04 21:43:50 2012 +0300 @@ -28,7 +28,7 @@ #ifndef __x86_64__ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include @@ -59,12 +59,12 @@ call *8(%ebp) /* Return stack to previous state and call the function */ - addl $16,%esp + addl $16,%esp call *28(%ebp) /* Load %ecx with the return type code */ - movl 20(%ebp),%ecx + movl 20(%ebp),%ecx /* Protect %esi. We're going to pop it in the epilogue. */ pushl %esi @@ -73,7 +73,7 @@ cmpl $0,24(%ebp) jne 0f - /* Even if there is no space for the return value, we are + /* Even if there is no space for the return value, we are obliged to handle floating-point values. */ cmpl $FFI_TYPE_FLOAT,%ecx jne noretval diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/x86/ffi.c --- a/Modules/_ctypes/libffi/src/x86/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/x86/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -341,7 +341,7 @@ ecif.cif = cif; ecif.avalue = avalue; - + /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ @@ -363,9 +363,9 @@ #endif else ecif.rvalue = rvalue; - - - switch (cif->abi) + + + switch (cif->abi) { #ifdef X86_WIN64 case FFI_WIN64: @@ -456,16 +456,16 @@ void *resp = &result; cif = closure->cif; - arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); /* this call will initialize ARG_AREA, such that each - * element in that array points to the corresponding + * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will change RESP to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(args, &resp, arg_area, cif); - + (closure->fun) (cif, resp, arg_area, closure->user_data); /* The result is returned in rax. This does the right thing for @@ -485,10 +485,10 @@ void **arg_area; cif = closure->cif; - arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); /* this call will initialize ARG_AREA, such that each - * element in that array points to the corresponding + * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will change RESP to point to the * structure return address. */ @@ -552,12 +552,12 @@ #endif { z = (*p_arg)->size; - + /* because we're little endian, this is what it turns into. */ - + *p_argv = (void*) argp; } - + p_argv++; #ifdef X86_WIN64 argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); @@ -565,7 +565,7 @@ argp += z; #endif } - + return; } @@ -653,7 +653,7 @@ #ifdef X86_WIN64 #define ISFLOAT(IDX) (cif->arg_types[IDX]->type == FFI_TYPE_FLOAT || cif->arg_types[IDX]->type == FFI_TYPE_DOUBLE) #define FLAG(IDX) (cif->nargs>(IDX)&&ISFLOAT(IDX)?(1<<(IDX)):0) - if (cif->abi == FFI_WIN64) + if (cif->abi == FFI_WIN64) { int mask = FLAG(0)|FLAG(1)|FLAG(2)|FLAG(3); FFI_INIT_TRAMPOLINE_WIN64 (&closure->tramp[0], @@ -694,7 +694,7 @@ { return FFI_BAD_ABI; } - + closure->cif = cif; closure->user_data = user_data; closure->fun = fun; @@ -732,7 +732,7 @@ FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT); FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); } - + #ifdef X86_WIN32 if (cif->abi == FFI_SYSV) { @@ -754,7 +754,7 @@ return FFI_OK; } -static void +static void ffi_prep_args_raw(char *stack, extended_cif *ecif) { memcpy (stack, ecif->avalue, ecif->cif->bytes); @@ -773,7 +773,7 @@ ecif.cif = cif; ecif.avalue = avalue; - + /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ @@ -785,9 +785,9 @@ } else ecif.rvalue = rvalue; - - - switch (cif->abi) + + + switch (cif->abi) { #ifdef X86_WIN32 case FFI_SYSV: diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/x86/ffi64.c --- a/Modules/_ctypes/libffi/src/x86/ffi64.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/x86/ffi64.c Sat Aug 04 21:43:50 2012 +0300 @@ -2,8 +2,8 @@ ffi64.c - Copyright (c) 20011 Anthony Green Copyright (c) 2008, 2010 Red Hat, Inc. Copyright (c) 2002, 2007 Bo Thorsen - - x86-64 Foreign Function Interface + + x86-64 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -197,7 +197,7 @@ { const int UNITS_PER_WORD = 8; int words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; - ffi_type **ptr; + ffi_type **ptr; int i; enum x86_64_reg_class subclasses[MAX_CLASSES]; @@ -576,7 +576,7 @@ avn = cif->nargs; arg_types = cif->arg_types; - + for (i = 0; i < avn; ++i) { enum x86_64_reg_class classes[MAX_CLASSES]; diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/x86/freebsd.S --- a/Modules/_ctypes/libffi/src/x86/freebsd.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/x86/freebsd.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- freebsd.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc. Copyright (c) 2008 Björn König - + X86 Foreign Function Interface for FreeBSD Permission is hereby granted, free of charge, to any person obtaining @@ -27,7 +27,7 @@ #ifndef __x86_64__ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include @@ -57,12 +57,12 @@ call *8(%ebp) /* Return stack to previous state and call the function */ - addl $8,%esp + addl $8,%esp call *28(%ebp) /* Load %ecx with the return type code */ - movl 20(%ebp),%ecx + movl 20(%ebp),%ecx /* Protect %esi. We're going to pop it in the epilogue. */ pushl %esi @@ -71,7 +71,7 @@ cmpl $0,24(%ebp) jne 0f - /* Even if there is no space for the return value, we are + /* Even if there is no space for the return value, we are obliged to handle floating-point values. */ cmpl $FFI_TYPE_FLOAT,%ecx jne noretval @@ -125,29 +125,29 @@ retfloat: /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx fstps (%ecx) jmp epilogue retdouble: /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx fstpl (%ecx) jmp epilogue retlongdouble: /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx fstpt (%ecx) jmp epilogue - -retint64: + +retint64: /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp epilogue - + retstruct1b: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx @@ -162,7 +162,7 @@ retint: /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx movl %eax,0(%ecx) retstruct: @@ -217,7 +217,7 @@ jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lcls_retint - + 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/x86/sysv.S --- a/Modules/_ctypes/libffi/src/x86/sysv.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/x86/sysv.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008, 2010 Red Hat, Inc. - - X86 Foreign Function Interface + + X86 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -26,7 +26,7 @@ #ifndef __x86_64__ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include @@ -59,12 +59,12 @@ call *8(%ebp) /* Return stack to previous state and call the function */ - addl $8,%esp + addl $8,%esp call *28(%ebp) /* Load %ecx with the return type code */ - movl 20(%ebp),%ecx + movl 20(%ebp),%ecx /* Protect %esi. We're going to pop it in the epilogue. */ pushl %esi @@ -73,7 +73,7 @@ cmpl $0,24(%ebp) jne 0f - /* Even if there is no space for the return value, we are + /* Even if there is no space for the return value, we are obliged to handle floating-point values. */ cmpl $FFI_TYPE_FLOAT,%ecx jne noretval @@ -125,32 +125,32 @@ retfloat: /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx fstps (%ecx) jmp epilogue retdouble: /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx fstpl (%ecx) jmp epilogue retlongdouble: /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx fstpt (%ecx) jmp epilogue - -retint64: + +retint64: /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp epilogue - + retint: /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx movl %eax,0(%ecx) retstruct: @@ -205,7 +205,7 @@ jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lcls_retint - + 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/x86/unix64.S --- a/Modules/_ctypes/libffi/src/x86/unix64.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/x86/unix64.S Sat Aug 04 21:43:50 2012 +0300 @@ -2,7 +2,7 @@ unix64.S - Copyright (c) 2002 Bo Thorsen Copyright (c) 2008 Red Hat, Inc - x86-64 Foreign Function Interface + x86-64 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -26,7 +26,7 @@ ----------------------------------------------------------------------- */ #ifdef __x86_64__ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/x86/win32.S --- a/Modules/_ctypes/libffi/src/x86/win32.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/x86/win32.S Sat Aug 04 21:43:50 2012 +0300 @@ -3,10 +3,10 @@ Copyright (c) 2001 John Beniton Copyright (c) 2002 Ranjit Mathew Copyright (c) 2009 Daniel Witte - - + + X86 Foreign Function Interface - + 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 @@ -14,10 +14,10 @@ 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 @@ -28,7 +28,7 @@ DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ - + #define LIBFFI_ASM #include #include @@ -474,7 +474,7 @@ #else .text - + # This assumes we are using gas. .balign 16 .globl _ffi_call_win32 @@ -488,16 +488,16 @@ movl %esp,%ebp .LCFI1: # Make room for all of the new args. - movl 20(%ebp),%ecx + movl 20(%ebp),%ecx subl %ecx,%esp - + movl %esp,%eax - + # Place all of the ffi_prep_args in position pushl 12(%ebp) pushl %eax call *8(%ebp) - + # Return stack to previous state and call the function addl $8,%esp @@ -515,27 +515,27 @@ addl $4, %esp .do_fncall: - + # FIXME: Align the stack to a 128-bit boundary to avoid # potential performance hits. call *32(%ebp) - + # stdcall functions pop arguments off the stack themselves # Load %ecx with the return type code movl 24(%ebp),%ecx - + # If the return value pointer is NULL, assume no return value. cmpl $0,28(%ebp) jne 0f - + # Even if there is no space for the return value, we are # obliged to handle floating-point values. cmpl $FFI_TYPE_FLOAT,%ecx jne .Lnoretval fstp %st(0) - + jmp .Lepilogue 0: @@ -590,25 +590,25 @@ movl 28(%ebp),%ecx movl %eax,0(%ecx) jmp .Lepilogue - + .Lretfloat: # Load %ecx with the pointer to storage for the return value movl 28(%ebp),%ecx fstps (%ecx) jmp .Lepilogue - + .Lretdouble: # Load %ecx with the pointer to storage for the return value movl 28(%ebp),%ecx fstpl (%ecx) jmp .Lepilogue - + .Lretlongdouble: # Load %ecx with the pointer to storage for the return value movl 28(%ebp),%ecx fstpt (%ecx) jmp .Lepilogue - + .Lretint64: # Load %ecx with the pointer to storage for the return value movl 28(%ebp),%ecx @@ -621,7 +621,7 @@ movl 28(%ebp),%ecx movb %al,0(%ecx) jmp .Lepilogue - + .Lretstruct2b: # Load %ecx with the pointer to storage for the return value movl 28(%ebp),%ecx @@ -636,7 +636,7 @@ .Lretstruct: # Nothing to do! - + .Lnoretval: .Lepilogue: movl %ebp,%esp diff -r 27ae40361ca5 Modules/_ctypes/libffi/src/x86/win64.S --- a/Modules/_ctypes/libffi/src/x86/win64.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/src/x86/win64.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,8 +1,8 @@ #define LIBFFI_ASM #include #include - -/* Constants for ffi_call_win64 */ + +/* Constants for ffi_call_win64 */ #define STACK 0 #define PREP_ARGS_FN 32 #define ECIF 40 @@ -31,11 +31,11 @@ ;;; ;;; It must move the parameters passed in registers to their stack location, ;;; call ffi_closure_win64_inner for the actual work, then return the result. -;;; +;;; ffi_closure_win64 PROC FRAME ;; copy register arguments onto stack test r11, 1 - jne first_is_float + jne first_is_float mov QWORD PTR [rsp+8], rcx jmp second first_is_float: @@ -43,7 +43,7 @@ second: test r11, 2 - jne second_is_float + jne second_is_float mov QWORD PTR [rsp+16], rdx jmp third second_is_float: @@ -51,7 +51,7 @@ third: test r11, 4 - jne third_is_float + jne third_is_float mov QWORD PTR [rsp+24], r8 jmp fourth third_is_float: @@ -59,7 +59,7 @@ fourth: test r11, 8 - jne fourth_is_float + jne fourth_is_float mov QWORD PTR [rsp+32], r9 jmp done fourth_is_float: @@ -222,7 +222,7 @@ mov rcx, QWORD PTR RVALUE[rbp] mov QWORD PTR [rcx], rax jmp SHORT ret_void$ - + ret_void$: xor rax, rax @@ -252,13 +252,13 @@ # # It must move the parameters passed in registers to their stack location, # call ffi_closure_win64_inner for the actual work, then return the result. -# +# .balign 16 .globl SYMBOL_NAME(ffi_closure_win64) SYMBOL_NAME(ffi_closure_win64): # copy register arguments onto stack test $1,%r11 - jne .Lfirst_is_float + jne .Lfirst_is_float mov %rcx, 8(%rsp) jmp .Lsecond .Lfirst_is_float: @@ -266,7 +266,7 @@ .Lsecond: test $2, %r11 - jne .Lsecond_is_float + jne .Lsecond_is_float mov %rdx, 16(%rsp) jmp .Lthird .Lsecond_is_float: @@ -274,7 +274,7 @@ .Lthird: test $4, %r11 - jne .Lthird_is_float + jne .Lthird_is_float mov %r8,24(%rsp) jmp .Lfourth .Lthird_is_float: @@ -282,7 +282,7 @@ .Lfourth: test $8, %r11 - jne .Lfourth_is_float + jne .Lfourth_is_float mov %r9, 32(%rsp) jmp .Ldone .Lfourth_is_float: @@ -366,15 +366,15 @@ .Lret_struct2b: cmpl $FFI_TYPE_SMALL_STRUCT_2B, CIF_FLAGS(%rbp) jne .Lret_struct1b - + mov RVALUE(%rbp), %rcx mov %ax, (%rcx) jmp .Lret_void - + .Lret_struct1b: cmpl $FFI_TYPE_SMALL_STRUCT_1B, CIF_FLAGS(%rbp) jne .Lret_uint8 - + mov RVALUE(%rbp), %rcx mov %al, (%rcx) jmp .Lret_void @@ -382,7 +382,7 @@ .Lret_uint8: cmpl $FFI_TYPE_UINT8, CIF_FLAGS(%rbp) jne .Lret_sint8 - + mov RVALUE(%rbp), %rcx movzbq %al, %rax movq %rax, (%rcx) @@ -391,7 +391,7 @@ .Lret_sint8: cmpl $FFI_TYPE_SINT8, CIF_FLAGS(%rbp) jne .Lret_uint16 - + mov RVALUE(%rbp), %rcx movsbq %al, %rax movq %rax, (%rcx) @@ -400,7 +400,7 @@ .Lret_uint16: cmpl $FFI_TYPE_UINT16, CIF_FLAGS(%rbp) jne .Lret_sint16 - + mov RVALUE(%rbp), %rcx movzwq %ax, %rax movq %rax, (%rcx) @@ -409,7 +409,7 @@ .Lret_sint16: cmpl $FFI_TYPE_SINT16, CIF_FLAGS(%rbp) jne .Lret_uint32 - + mov RVALUE(%rbp), %rcx movswq %ax, %rax movq %rax, (%rcx) @@ -418,7 +418,7 @@ .Lret_uint32: cmpl $FFI_TYPE_UINT32, CIF_FLAGS(%rbp) jne .Lret_sint32 - + mov RVALUE(%rbp), %rcx movl %eax, %eax movq %rax, (%rcx) @@ -456,7 +456,7 @@ mov RVALUE(%rbp), %rcx mov %rax, (%rcx) jmp .Lret_void - + .Lret_void: xor %rax, %rax diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/Makefile.in --- a/Modules/_ctypes/libffi/testsuite/Makefile.in Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/Makefile.in Sat Aug 04 21:43:50 2012 +0300 @@ -54,7 +54,7 @@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ -AM_RUNTESTFLAGS = +AM_RUNTESTFLAGS = AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/lib/libffi.exp --- a/Modules/_ctypes/libffi/testsuite/lib/libffi.exp Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/lib/libffi.exp Sat Aug 04 21:43:50 2012 +0300 @@ -101,7 +101,7 @@ global tool_root_dir global ld_library_path - set blddirffi [pwd]/.. + set blddirffi [pwd]/.. verbose "libffi $blddirffi" set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] @@ -285,7 +285,7 @@ # compare them to the actual options. if { [string compare [lindex $args 2] "*"] == 0 && [string compare [lindex $args 3] "" ] == 0 } { - set result 1 + set result 1 } else { # The target list might be an effective-target keyword, so replace # the original list with "*-*-*", since we already know it matches. diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/lib/wrapper.exp --- a/Modules/_ctypes/libffi/testsuite/lib/wrapper.exp Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/lib/wrapper.exp Sat Aug 04 21:43:50 2012 +0300 @@ -4,12 +4,12 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GCC; see the file COPYING3. If not see # . diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/closure_loc_fn0.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/closure_loc_fn0.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/closure_loc_fn0.c Sat Aug 04 21:43:50 2012 +0300 @@ -82,7 +82,7 @@ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_loc_test_fn0, (void *) 3 /* userdata */, codeloc) == FFI_OK); - + CHECK(memcmp(pcl, codeloc, sizeof(*pcl)) == 0); res = (*((closure_loc_test_type0)codeloc)) diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c Sat Aug 04 21:43:50 2012 +0300 @@ -66,7 +66,7 @@ } static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c Sat Aug 04 21:43:50 2012 +0300 @@ -46,7 +46,7 @@ } static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c Sat Aug 04 21:43:50 2012 +0300 @@ -22,7 +22,7 @@ result.b = (void *)((uintptr_t)a1.b + (uintptr_t)a2.b); result.c = a1.c + a2.c; - printf("%d %" PRIuPTR " %d %d %" PRIuPTR " %d: %d %" PRIuPTR " %d\n", + printf("%d %" PRIuPTR " %d %d %" PRIuPTR " %d: %d %" PRIuPTR " %d\n", a1.a, (uintptr_t)a1.b, a1.c, a2.a, (uintptr_t)a2.b, a2.c, result.a, (uintptr_t)result.b, diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c Sat Aug 04 21:43:50 2012 +0300 @@ -11,7 +11,7 @@ #include "ffitest.h" static void -cls_double_va_fn(ffi_cif* cif __UNUSED__, void* resp, +cls_double_va_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { char* format = *(char**)args[0]; diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c Sat Aug 04 21:43:50 2012 +0300 @@ -30,7 +30,7 @@ } static void -cls_ldouble_gn(ffi_cif* cif __UNUSED__, void* resp, +cls_ldouble_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { long double a1 = *(long double*)args[0]; diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c Sat Aug 04 21:43:50 2012 +0300 @@ -11,7 +11,7 @@ #include "ffitest.h" static void -cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp, +cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { char* format = *(char**)args[0]; diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c Sat Aug 04 21:43:50 2012 +0300 @@ -11,7 +11,7 @@ { void* result = (void*)((intptr_t)a1 + (intptr_t)a2); - printf("0x%08x 0x%08x: 0x%08x\n", + printf("0x%08x 0x%08x: 0x%08x\n", (unsigned int)(uintptr_t) a1, (unsigned int)(uintptr_t) a2, (unsigned int)(uintptr_t) result); @@ -20,7 +20,7 @@ } static void -cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, +cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { void* a1 = *(void**)(args[0]); diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c Sat Aug 04 21:43:50 2012 +0300 @@ -35,7 +35,7 @@ result = (void*)((intptr_t)a1 + (intptr_t)a2); - printf("0x%08x 0x%08x: 0x%08x\n", + printf("0x%08x 0x%08x: 0x%08x\n", (unsigned int)(uintptr_t) a1, (unsigned int)(uintptr_t) a2, (unsigned int)(uintptr_t) result); @@ -71,7 +71,7 @@ } static void -cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, +cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { void* a1 = *(void**)(args[0]); diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c Sat Aug 04 21:43:50 2012 +0300 @@ -9,7 +9,7 @@ #include "ffitest.h" static void -dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, +dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, void** args __UNUSED__, void* userdata __UNUSED__) {} diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/fastthis1_win32.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis1_win32.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis1_win32.c Sat Aug 04 21:43:50 2012 +0300 @@ -25,26 +25,26 @@ args[1] = &ffi_type_float; values[0] = (void*) &s; values[1] = (void*) &v2; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 2, &ffi_type_sint, args) == FFI_OK); - + s = "a"; v2 = 0.0; ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); CHECK(rint == 1); - + s = "1234567"; v2 = -1.0; ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); CHECK(rint == 6); - + s = "1234567890123456789012345"; v2 = 1.0; ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); CHECK(rint == 26); - + printf("fastcall fct1 tests passed\n"); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/fastthis2_win32.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis2_win32.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis2_win32.c Sat Aug 04 21:43:50 2012 +0300 @@ -25,26 +25,26 @@ args[0] = &ffi_type_float; values[1] = (void*) &s; values[0] = (void*) &v2; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 2, &ffi_type_sint, args) == FFI_OK); - + s = "a"; v2 = 0.0; ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); CHECK(rint == 1); - + s = "1234567"; v2 = -1.0; ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); CHECK(rint == 6); - + s = "1234567890123456789012345"; v2 = 1.0; ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); CHECK(rint == 26); - + printf("fastcall fct2 tests passed\n"); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/fastthis3_win32.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis3_win32.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis3_win32.c Sat Aug 04 21:43:50 2012 +0300 @@ -28,29 +28,29 @@ values[2] = (void*) &v1; values[1] = (void*) &s; values[0] = (void*) &v2; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 3, &ffi_type_sint, args) == FFI_OK); - + s = "a"; v1 = 1; v2 = 0.0; ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); CHECK(rint == 2); - + s = "1234567"; v2 = -1.0; v1 = -2; ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); CHECK(rint == 4); - + s = "1234567890123456789012345"; v2 = 1.0; v1 = 2; ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); CHECK(rint == 28); - + printf("fastcall fct3 tests passed\n"); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/float4.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/float4.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/float4.c Sat Aug 04 21:43:50 2012 +0300 @@ -34,23 +34,23 @@ args[0] = &ffi_type_double; values[0] = &d; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_double, args) == FFI_OK); - + d = DBL_MIN / 2; - + /* Put a canary in the return array. This is a regression test for a buffer overrun. */ memset(result[1].c, CANARY, sizeof (double)); ffi_call(&cif, FFI_FN(dblit), &result[0].d, values); - + /* The standard delta check doesn't work for denorms. Since we didn't do any arithmetic, we should get the original result back, and hence an exact check should be OK here. */ - + CHECK(result[0].d == dblit(d)); /* Check the canary. */ diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c Sat Aug 04 21:43:50 2012 +0300 @@ -120,13 +120,13 @@ { BigStruct retVal = { ui8_1 + 1, si8_1 + 1, ui16_1 + 1, si16_1 + 1, ui32_1 + 1, si32_1 + 1, - ui64_1 + 1, si64_1 + 1, f_1 + 1, d_1 + 1, ld_1 + 1, (char*)((intptr_t)p_1 + 1), + ui64_1 + 1, si64_1 + 1, f_1 + 1, d_1 + 1, ld_1 + 1, (char*)((intptr_t)p_1 + 1), ui8_2 + 2, si8_2 + 2, ui16_2 + 2, si16_2 + 2, ui32_2 + 2, si32_2 + 2, - ui64_2 + 2, si64_2 + 2, f_2 + 2, d_2 + 2, ld_2 + 2, (char*)((intptr_t)p_2 + 2), + ui64_2 + 2, si64_2 + 2, f_2 + 2, d_2 + 2, ld_2 + 2, (char*)((intptr_t)p_2 + 2), ui8_3 + 3, si8_3 + 3, ui16_3 + 3, si16_3 + 3, ui32_3 + 3, si32_3 + 3, - ui64_3 + 3, si64_3 + 3, f_3 + 3, d_3 + 3, ld_3 + 3, (char*)((intptr_t)p_3 + 3), + ui64_3 + 3, si64_3 + 3, f_3 + 3, d_3 + 3, ld_3 + 3, (char*)((intptr_t)p_3 + 3), ui8_4 + 4, si8_4 + 4, ui16_4 + 4, si16_4 + 4, ui32_4 + 4, si32_4 + 4, - ui64_4 + 4, si64_4 + 4, f_4 + 4, d_4 + 4, ld_4 + 4, (char*)((intptr_t)p_4 + 4), + ui64_4 + 4, si64_4 + 4, f_4 + 4, d_4 + 4, ld_4 + 4, (char*)((intptr_t)p_4 + 4), ui8_5 + 5, si8_5 + 5}; printf("%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/many.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/many.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/many.c Sat Aug 04 21:43:50 2012 +0300 @@ -25,7 +25,7 @@ { #if 0 printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n", - (double) f1, (double) f2, (double) f3, (double) f4, (double) f5, + (double) f1, (double) f2, (double) f3, (double) f4, (double) f5, (double) f6, (double) f7, (double) f8, (double) f9, (double) f10, (double) f11, (double) f12, (double) f13); #endif @@ -50,7 +50,7 @@ } /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13, + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13, &ffi_type_float, args) == FFI_OK); ffi_call(&cif, FFI_FN(many), &f, values); diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/strlen.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/strlen.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/strlen.c Sat Aug 04 21:43:50 2012 +0300 @@ -22,23 +22,23 @@ args[0] = &ffi_type_pointer; values[0] = (void*) &s; - + /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sint, args) == FFI_OK); - + s = "a"; ffi_call(&cif, FFI_FN(my_strlen), &rint, values); CHECK(rint == 1); - + s = "1234567"; ffi_call(&cif, FFI_FN(my_strlen), &rint, values); CHECK(rint == 7); - + s = "1234567890123456789012345"; ffi_call(&cif, FFI_FN(my_strlen), &rint, values); CHECK(rint == 25); - + exit (0); } - + diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/strlen2_win32.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/strlen2_win32.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/strlen2_win32.c Sat Aug 04 21:43:50 2012 +0300 @@ -22,23 +22,23 @@ char *s; args[0] = &ffi_type_pointer; values[0] = (void*) &s; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, &ffi_type_sint, args) == FFI_OK); - + s = "a"; ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); CHECK(rint == 1); - + s = "1234567"; ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); CHECK(rint == 7); - + s = "1234567890123456789012345"; ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); CHECK(rint == 25); - + printf("fastcall strlen tests passed\n"); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/strlen_win32.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/strlen_win32.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/strlen_win32.c Sat Aug 04 21:43:50 2012 +0300 @@ -22,23 +22,23 @@ char *s; args[0] = &ffi_type_pointer; values[0] = (void*) &s; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 1, &ffi_type_sint, args) == FFI_OK); - + s = "a"; ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); CHECK(rint == 1); - + s = "1234567"; ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); CHECK(rint == 7); - + s = "1234567890123456789012345"; ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); CHECK(rint == 25); - + printf("stdcall strlen tests passed\n"); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c Sat Aug 04 21:43:50 2012 +0300 @@ -45,23 +45,23 @@ ts1_type_elements[1] = &ffi_type_double; ts1_type_elements[2] = &ffi_type_uint; ts1_type_elements[3] = NULL; - + args[0] = &ts1_type; values[0] = &ts1_arg; - + /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts1_type, args) == FFI_OK); - + ts1_arg.uc = '\x01'; ts1_arg.d = 3.14159; ts1_arg.ui = 555; ffi_call(&cif, FFI_FN(struct1), ts1_result, values); - + CHECK(ts1_result->ui == 556); CHECK(ts1_result->d == 3.14159 - 1); - + free (ts1_result); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/struct1_win32.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct1_win32.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct1_win32.c Sat Aug 04 21:43:50 2012 +0300 @@ -45,23 +45,23 @@ ts1_type_elements[1] = &ffi_type_double; ts1_type_elements[2] = &ffi_type_uint; ts1_type_elements[3] = NULL; - + args[0] = &ts1_type; values[0] = &ts1_arg; - + /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, &ts1_type, args) == FFI_OK); - + ts1_arg.uc = '\x01'; ts1_arg.d = 3.14159; ts1_arg.ui = 555; ffi_call(&cif, FFI_FN(struct1), ts1_result, values); - + CHECK(ts1_result->ui == 556); CHECK(ts1_result->d == 3.14159 - 1); - + free (ts1_result); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c Sat Aug 04 21:43:50 2012 +0300 @@ -44,24 +44,24 @@ args[0] = &ts2_type; values[0] = &ts2_arg; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts2_type, args) == FFI_OK); - + ts2_arg.d1 = 5.55; ts2_arg.d2 = 6.66; - + printf ("%g\n", ts2_arg.d1); printf ("%g\n", ts2_arg.d2); - + ffi_call(&cif, FFI_FN(struct2), ts2_result, values); - + printf ("%g\n", ts2_result->d1); printf ("%g\n", ts2_result->d2); - + CHECK(ts2_result->d1 == 5.55 - 1); CHECK(ts2_result->d2 == 6.66 - 1); - + free (ts2_result); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/struct2_win32.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct2_win32.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct2_win32.c Sat Aug 04 21:43:50 2012 +0300 @@ -44,24 +44,24 @@ args[0] = &ts2_type; values[0] = &ts2_arg; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, &ts2_type, args) == FFI_OK); - + ts2_arg.d1 = 5.55; ts2_arg.d2 = 6.66; - + printf ("%g\n", ts2_arg.d1); printf ("%g\n", ts2_arg.d2); - + ffi_call(&cif, FFI_FN(struct2), ts2_result, values); - + printf ("%g\n", ts2_result->d1); printf ("%g\n", ts2_result->d2); - + CHECK(ts2_result->d1 == 5.55 - 1); CHECK(ts2_result->d2 == 6.66 - 1); - + free (ts2_result); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c Sat Aug 04 21:43:50 2012 +0300 @@ -41,20 +41,20 @@ args[0] = &ts3_type; values[0] = &ts3_arg; - + /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts3_type, args) == FFI_OK); - + ts3_arg.si = -123; compare_value = ts3_arg.si; - + ffi_call(&cif, FFI_FN(struct3), ts3_result, values); - + printf ("%d %d\n", ts3_result->si, -(compare_value*2)); - + CHECK(ts3_result->si == -(compare_value*2)); - + free (ts3_result); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c Sat Aug 04 21:43:50 2012 +0300 @@ -27,7 +27,7 @@ ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts4_type; - ffi_type *ts4_type_elements[4]; + ffi_type *ts4_type_elements[4]; test_structure_4 ts4_arg; @@ -46,19 +46,19 @@ args[0] = &ts4_type; values[0] = &ts4_arg; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts4_type, args) == FFI_OK); - + ts4_arg.ui1 = 2; ts4_arg.ui2 = 3; ts4_arg.ui3 = 4; - + ffi_call (&cif, FFI_FN(struct4), ts4_result, values); - + CHECK(ts4_result->ui3 == 2U * 3U * 4U); - - + + free (ts4_result); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c Sat Aug 04 21:43:50 2012 +0300 @@ -16,7 +16,7 @@ { ts1.c1 += ts2.c1; ts1.c2 -= ts2.c2; - + return ts1; } @@ -46,21 +46,21 @@ args[1] = &ts5_type; values[0] = &ts5_arg1; values[1] = &ts5_arg2; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ts5_type, args) == FFI_OK); - + ts5_arg1.c1 = 2; ts5_arg1.c2 = 6; ts5_arg2.c1 = 5; ts5_arg2.c2 = 3; - + ffi_call (&cif, FFI_FN(struct5), ts5_result, values); - - CHECK(ts5_result->c1 == 7); + + CHECK(ts5_result->c1 == 7); CHECK(ts5_result->c2 == 3); - - + + free (ts5_result); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c Sat Aug 04 21:43:50 2012 +0300 @@ -16,7 +16,7 @@ { ts.f += 1; ts.d += 1; - + return ts; } @@ -47,18 +47,18 @@ /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts6_type, args) == FFI_OK); - + ts6_arg.f = 5.55f; ts6_arg.d = 6.66; - + printf ("%g\n", ts6_arg.f); printf ("%g\n", ts6_arg.d); ffi_call(&cif, FFI_FN(struct6), ts6_result, values); - + CHECK(ts6_result->f == 5.55f + 1); CHECK(ts6_result->d == 6.66 + 1); - + free (ts6_result); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c Sat Aug 04 21:43:50 2012 +0300 @@ -47,10 +47,10 @@ args[0] = &ts7_type; values[0] = &ts7_arg; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts7_type, args) == FFI_OK); - + ts7_arg.f1 = 5.55f; ts7_arg.f2 = 55.5f; ts7_arg.d = 6.66; @@ -58,17 +58,17 @@ printf ("%g\n", ts7_arg.f1); printf ("%g\n", ts7_arg.f2); printf ("%g\n", ts7_arg.d); - + ffi_call(&cif, FFI_FN(struct7), ts7_result, values); printf ("%g\n", ts7_result->f1); printf ("%g\n", ts7_result->f2); printf ("%g\n", ts7_result->d); - + CHECK(ts7_result->f1 == 5.55f + 1); CHECK(ts7_result->f2 == 55.5f + 1); CHECK(ts7_result->d == 6.66 + 1); - + free (ts7_result); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c Sat Aug 04 21:43:50 2012 +0300 @@ -50,10 +50,10 @@ args[0] = &ts8_type; values[0] = &ts8_arg; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts8_type, args) == FFI_OK); - + ts8_arg.f1 = 5.55f; ts8_arg.f2 = 55.5f; ts8_arg.f3 = -5.55f; @@ -63,19 +63,19 @@ printf ("%g\n", ts8_arg.f2); printf ("%g\n", ts8_arg.f3); printf ("%g\n", ts8_arg.f4); - + ffi_call(&cif, FFI_FN(struct8), ts8_result, values); printf ("%g\n", ts8_result->f1); printf ("%g\n", ts8_result->f2); printf ("%g\n", ts8_result->f3); printf ("%g\n", ts8_result->f4); - + CHECK(ts8_result->f1 == 5.55f + 1); CHECK(ts8_result->f2 == 55.5f + 1); CHECK(ts8_result->f3 == -5.55f + 1); CHECK(ts8_result->f4 == -55.5f + 1); - + free (ts8_result); exit(0); } diff -r 27ae40361ca5 Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c Sat Aug 04 21:43:50 2012 +0300 @@ -45,21 +45,21 @@ args[0] = &ts9_type; values[0] = &ts9_arg; - + /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts9_type, args) == FFI_OK); - + ts9_arg.f = 5.55f; ts9_arg.i = 5; - + printf ("%g\n", ts9_arg.f); printf ("%d\n", ts9_arg.i); - + ffi_call(&cif, FFI_FN(struct9), ts9_result, values); printf ("%g\n", ts9_result->f); printf ("%d\n", ts9_result->i); - + CHECK(ts9_result->f == 5.55f + 1); CHECK(ts9_result->i == 5 + 1); diff -r 27ae40361ca5 Modules/_ctypes/libffi/texinfo.tex --- a/Modules/_ctypes/libffi/texinfo.tex Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi/texinfo.tex Sat Aug 04 21:43:50 2012 +0300 @@ -661,7 +661,7 @@ \def\?{?\spacefactor=\endofsentencespacefactor\space} % @frenchspacing on|off says whether to put extra space after punctuation. -% +% \def\onword{on} \def\offword{off} % @@ -1207,7 +1207,7 @@ % that's we do). % double active backslashes. -% +% {\catcode`\@=0 \catcode`\\=\active @gdef@activebackslash{@catcode`@\=@active @otherbackslash} @gdef@activebackslashdouble{% @@ -1219,11 +1219,11 @@ % not active characters. hyperref.dtx (which has the same problem as % us) handles it with this amazing macro to replace tokens. I've % tinkered with it a little for texinfo, but it's definitely from there. -% +% % #1 is the tokens to replace. % #2 is the replacement. % #3 is the control sequence with the string. -% +% \def\HyPsdSubst#1#2#3{% \def\HyPsdReplace##1#1##2\END{% ##1% @@ -1913,7 +1913,7 @@ % each of the four underscores in __typeof__. This is undesirable in % some manuals, especially if they don't have long identifiers in % general. @allowcodebreaks provides a way to control this. -% +% \newif\ifallowcodebreaks \allowcodebreakstrue \def\keywordtrue{true} @@ -2044,7 +2044,7 @@ % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. -% +% \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% {\selectfonts\lsize #1}% @@ -2056,7 +2056,7 @@ % @abbr for "Comput. J." and the like. % No font change, but don't do end-of-sentence spacing. -% +% \def\abbr#1{\doabbr #1,,\finish} \def\doabbr#1,#2,#3\finish{% {\plainfrenchspacing #1}% @@ -2075,43 +2075,43 @@ % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. -% +% % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular % font height. -% +% % feymr - regular % feymo - slanted % feybr - bold % feybo - bold slanted -% +% % There is no good (free) typewriter version, to my knowledge. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. % Hmm. -% +% % Also doesn't work in math. Do we need to do math with euro symbols? % Hope not. -% -% +% +% \def\euro{{\eurofont e}} \def\eurofont{% % We set the font at each command, rather than predefining it in % \textfonts and the other font-switching commands, so that % installations which never need the symbol don't have to have the % font installed. - % + % % There is only one designed size (nominal 10pt), so we always scale % that to the current nominal size. - % + % % By the way, simply using "at 1em" works for cmr10 and the like, but % does not work for cmbx10 and other extended/shrunken fonts. - % + % \def\eurosize{\csname\curfontsize nominalsize\endcsname}% % - \ifx\curfontstyle\bfstylename + \ifx\curfontstyle\bfstylename % bold: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize - \else + \else % regular: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize \fi @@ -2131,7 +2131,7 @@ % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. -% +% \ifx\Orb\undefined \def\Orb{\mathhexbox20D} \fi @@ -2447,7 +2447,7 @@ % cause the example and the item to crash together. So we use this % bizarre value of 10001 as a signal to \aboveenvbreak to insert % \parskip glue after all. Section titles are handled this way also. - % + % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse @@ -3457,11 +3457,11 @@ % makeinfo does not expand macros in the argument to @deffn, which ends up % writing an index entry, and texindex isn't prepared for an index sort entry % that starts with \. - % + % % Since macro invocations are followed by braces, we can just redefine them % to take a single TeX argument. The case of a macro invocation that % goes to end-of-line is not handled. - % + % \macrolist } @@ -3587,7 +3587,7 @@ % to re-insert the same penalty (values >10000 are used for various % signals); since we just inserted a non-discardable item, any % following glue (such as a \parskip) would be a breakpoint. For example: - % + % % @deffn deffn-whatever % @vindex index-whatever % Description. @@ -4527,11 +4527,11 @@ % glue accumulate. (Not a breakpoint because it's preceded by a % discardable item.) \vskip-\parskip - % + % % This is purely so the last item on the list is a known \penalty > % 10000. This is so \startdefun can avoid allowing breakpoints after % section headings. Otherwise, it would insert a valid breakpoint between: - % + % % @section sec-whatever % @deffn def-whatever \penalty 10001 @@ -4589,7 +4589,7 @@ % These characters do not print properly in the Computer Modern roman % fonts, so we must take special care. This is more or less redundant % with the Texinfo input format setup at the end of this file. -% +% \def\activecatcodes{% \catcode`\"=\active \catcode`\$=\active @@ -5303,7 +5303,7 @@ % by \defargscommonending, instead of 10000, since the sectioning % commands also insert a nobreak penalty, and we don't want to allow % a break between a section heading and a defun. - % + % \ifnum\lastpenalty=10002 \penalty2000 \fi % % Similarly, after a section heading, do not allow a break. @@ -5682,7 +5682,7 @@ % This does \let #1 = #2, with \csnames; that is, % \let \csname#1\endcsname = \csname#2\endcsname % (except of course we have to play expansion games). -% +% \def\cslet#1#2{% \expandafter\let \csname#1\expandafter\endcsname diff -r 27ae40361ca5 Modules/_ctypes/libffi_arm_wince/debug.c --- a/Modules/_ctypes/libffi_arm_wince/debug.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_arm_wince/debug.c Sat Aug 04 21:43:50 2012 +0300 @@ -31,7 +31,7 @@ void ffi_stop_here(void) { /* This function is only useful for debugging purposes. - Place a breakpoint on ffi_stop_here to be notified of + Place a breakpoint on ffi_stop_here to be notified of significant events. */ } diff -r 27ae40361ca5 Modules/_ctypes/libffi_arm_wince/ffi.c --- a/Modules/_ctypes/libffi_arm_wince/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_arm_wince/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998 Red Hat, Inc. - - ARM Foreign Function Interface + + ARM Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -79,19 +79,19 @@ case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; - + case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; - + case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; - + case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; - + case FFI_TYPE_STRUCT: /* *p_argv may not be aligned for a UINT32 */ memcpy(argp, *p_argv, z); @@ -112,7 +112,7 @@ p_argv++; argp += z; } - + return; } @@ -144,29 +144,29 @@ /*@-declundef@*/ /*@-exportheader@*/ -extern void ffi_call_SYSV(void (*)(char *, extended_cif *), - /*@out@*/ extended_cif *, - unsigned, unsigned, - /*@out@*/ unsigned *, +extern void ffi_call_SYSV(void (*)(char *, extended_cif *), + /*@out@*/ extended_cif *, + unsigned, unsigned, + /*@out@*/ unsigned *, void (*fn)()); /*@=declundef@*/ /*@=exportheader@*/ /* Return type changed from void for ctypes */ -int ffi_call(/*@dependent@*/ ffi_cif *cif, - void (*fn)(), - /*@out@*/ void *rvalue, +int ffi_call(/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; - + /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ - if ((rvalue == NULL) && + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { /*@-sysunrecog@*/ @@ -175,13 +175,13 @@ } else ecif.rvalue = rvalue; - - - switch (cif->abi) + + + switch (cif->abi) { case FFI_SYSV: /*@-usedef@*/ - ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); /*@=usedef@*/ break; @@ -207,16 +207,16 @@ ffi_cif *cif = closure->cif; void **out_args; - out_args = (void **) alloca(cif->nargs * sizeof (void *)); + out_args = (void **) alloca(cif->nargs * sizeof (void *)); /* this call will initialize out_args, such that each - * element in that array points to the corresponding + * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will re-set rvalue to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(in_args, &rvalue, out_args, cif); - + (closure->fun)(cif, rvalue, out_args, closure->user_data); /* Tell ffi_closure_SYSV what the returntype is */ @@ -224,7 +224,7 @@ } /*@-exportheader@*/ -static void +static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, ffi_cif *cif) /*@=exportheader@*/ @@ -293,7 +293,7 @@ void *user_data) { FFI_ASSERT (cif->abi == FFI_SYSV); - + FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_SYSV); closure->cif = cif; diff -r 27ae40361ca5 Modules/_ctypes/libffi_arm_wince/ffi.h --- a/Modules/_ctypes/libffi_arm_wince/ffi.h Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_arm_wince/ffi.h Sat Aug 04 21:43:50 2012 +0300 @@ -155,7 +155,7 @@ typedef enum { FFI_OK = 0, FFI_BAD_TYPEDEF, - FFI_BAD_ABI + FFI_BAD_ABI } ffi_status; typedef unsigned FFI_TYPE; @@ -190,9 +190,9 @@ void* ptr; } ffi_raw; -void ffi_raw_call (/*@dependent@*/ ffi_cif *cif, - void (*fn)(), - /*@out@*/ void *rvalue, +void ffi_raw_call (/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, /*@dependent@*/ ffi_raw *avalue); void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); @@ -203,9 +203,9 @@ /* 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)(), - /*@out@*/ void *rvalue, +void ffi_java_raw_call (/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, /*@dependent@*/ ffi_raw *avalue); void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); @@ -236,8 +236,8 @@ #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 + /* 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*); @@ -266,16 +266,16 @@ /* ---- Public interface definition -------------------------------------- */ -ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, +ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, ffi_abi abi, - unsigned int nargs, - /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type *rtype, + unsigned int nargs, + /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type *rtype, /*@dependent@*/ ffi_type **atypes); /* Return type changed from void for ctypes */ -int ffi_call(/*@dependent@*/ ffi_cif *cif, - void (*fn)(), - /*@out@*/ void *rvalue, +int ffi_call(/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue); /* Useful for eliminating compiler warnings */ @@ -286,18 +286,18 @@ #endif /* If these change, update src/mips/ffitarget.h. */ -#define FFI_TYPE_VOID 0 +#define FFI_TYPE_VOID 0 #define FFI_TYPE_INT 1 -#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_FLOAT 2 #define FFI_TYPE_DOUBLE 3 #if 0 /*@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_UINT8 5 #define FFI_TYPE_SINT8 6 -#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_UINT16 7 #define FFI_TYPE_SINT16 8 #define FFI_TYPE_UINT32 9 #define FFI_TYPE_SINT32 10 diff -r 27ae40361ca5 Modules/_ctypes/libffi_arm_wince/ffi_common.h --- a/Modules/_ctypes/libffi_arm_wince/ffi_common.h Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_arm_wince/ffi_common.h Sat Aug 04 21:43:50 2012 +0300 @@ -41,7 +41,7 @@ # endif #endif -#if defined(FFI_DEBUG) +#if defined(FFI_DEBUG) #include #endif @@ -54,7 +54,7 @@ #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(x) #define FFI_ASSERT_AT(x, f, l) #define FFI_ASSERT_VALID_TYPE(x) #endif diff -r 27ae40361ca5 Modules/_ctypes/libffi_arm_wince/prep_cif.c --- a/Modules/_ctypes/libffi_arm_wince/prep_cif.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_arm_wince/prep_cif.c Sat Aug 04 21:43:50 2012 +0300 @@ -35,7 +35,7 @@ static ffi_status initialize_aggregate(/*@out@*/ ffi_type *arg) { - ffi_type **ptr; + ffi_type **ptr; FFI_ASSERT(arg != NULL); @@ -51,14 +51,14 @@ { if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; - + /* Perform a sanity check on the argument type */ FFI_ASSERT_VALID_TYPE(*ptr); arg->size = ALIGN(arg->size, (*ptr)->alignment); arg->size += (*ptr)->size; - arg->alignment = (arg->alignment > (*ptr)->alignment) ? + arg->alignment = (arg->alignment > (*ptr)->alignment) ? arg->alignment : (*ptr)->alignment; ptr++; @@ -84,9 +84,9 @@ /* Perform machine independent ffi_cif preparation, then call machine dependent routine. */ -ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, - ffi_abi abi, unsigned int nargs, - /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type *rtype, +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) { unsigned bytes = 0; @@ -133,7 +133,7 @@ if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; - /* Perform a sanity check on the argument type, do this + /* Perform a sanity check on the argument type, do this check after the initialization. */ FFI_ASSERT_VALID_TYPE(*ptr); @@ -161,7 +161,7 @@ /* Add any padding if necessary */ if (((*ptr)->alignment - 1) & bytes) bytes = ALIGN(bytes, (*ptr)->alignment); - + #endif bytes += STACK_ARG_SIZE((*ptr)->size); } diff -r 27ae40361ca5 Modules/_ctypes/libffi_arm_wince/sysv.asm --- a/Modules/_ctypes/libffi_arm_wince/sysv.asm Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_arm_wince/sysv.asm Sat Aug 04 21:43:50 2012 +0300 @@ -1,7 +1,7 @@ ; ----------------------------------------------------------------------- ; sysv.S - Copyright (c) 1998 Red Hat, Inc. -; -; ARM Foreign Function Interface +; +; ARM Foreign Function Interface ; ; Permission is hereby granted, free of charge, to any person obtaining ; a copy of this software and associated documentation files (the @@ -23,7 +23,7 @@ ; OTHER DEALINGS IN THE SOFTWARE. ; ----------------------------------------------------------------------- */ -;#define LIBFFI_ASM +;#define LIBFFI_ASM ;#include ;#include ;#ifdef HAVE_MACHINE_ASM_H @@ -117,7 +117,7 @@ ; Load a3 with the pointer to storage for the return value ldr a3, [sp, #24] - ; Load a4 with the return type code + ; Load a4 with the return type code ldr a4, [sp, #12] ; If the return value pointer is NULL, assume no return value. @@ -185,7 +185,7 @@ ; static unsigned int ; ffi_closure_SYSV_inner (ffi_closure *closure, char *in_args, void *rvalue) bl ffi_closure_SYSV_inner - ; a1 now contains the return type code + ; a1 now contains the return type code ; At this point the return value is on the stack ; Transfer it to the correct registers if necessary diff -r 27ae40361ca5 Modules/_ctypes/libffi_msvc/README --- a/Modules/_ctypes/libffi_msvc/README Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_msvc/README Sat Aug 04 21:43:50 2012 +0300 @@ -30,7 +30,7 @@ The libffi library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run -time. +time. Ffi stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code @@ -68,7 +68,7 @@ You must use GNU make to build libffi. SGI's make will not work. Sun's probably won't either. - + If you port libffi to another platform, please let me know! I assume that some will be easy (x86 NetBSD), and others will be more difficult (HP). @@ -87,15 +87,15 @@ You may want to tell configure where to install the libffi library and header files. To do that, use the --prefix configure switch. Libffi -will install under /usr/local by default. +will install under /usr/local by default. If you want to enable extra run-time debugging checks use the the --enable-debug configure switch. This is useful when your program dies -mysteriously while using libffi. +mysteriously while using libffi. Another useful configure switch is --enable-purify-safety. Using this will add some extra code which will suppress certain warnings when you -are using Purify with libffi. Only use this switch when using +are using Purify with libffi. Only use this switch when using Purify, as it will slow down the library. Configure has many other options. Use "configure --help" to see them all. @@ -125,19 +125,19 @@ following function: ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, - unsigned int nargs, + unsigned int nargs, ffi_type *rtype, ffi_type **atypes); CIF is a pointer to the call interface object you wish to initialize. - ABI is an enum that specifies the calling convention + ABI is an enum that specifies the calling convention to use for the call. FFI_DEFAULT_ABI defaults to the system's native calling convention. Other ABI's may be used with care. They are system specific. - NARGS is the number of arguments this function accepts. + NARGS is the number of arguments this function accepts. libffi does not yet support vararg functions. RTYPE is a pointer to an ffi_type structure that represents @@ -146,14 +146,14 @@ ffi_type objects for many of the native C types: signed int, unsigned int, signed char, unsigned char, etc. There is also a pointer ffi_type object and - a void ffi_type. Use &ffi_type_void for functions that + a void ffi_type. Use &ffi_type_void for functions that don't return values. ATYPES is a vector of ffi_type pointers. ARGS must be NARGS long. If NARGS is 0, this is ignored. -ffi_prep_cif will return a status code that you are responsible +ffi_prep_cif will return a status code that you are responsible for checking. It will be one of the following: FFI_OK - All is good. @@ -162,7 +162,7 @@ came across is bad. -Before making the call, the VALUES vector should be initialized +Before making the call, the VALUES vector should be initialized with pointers to the appropriate argument values. To call the the function using the initialized ffi_cif, use the @@ -178,11 +178,11 @@ RVALUE is a pointer to a chunk of memory that is to hold the result of the function call. Currently, it must be at least one word in size (except for the n32 version - under Irix 6.x, which must be a pointer to an 8 byte - aligned value (a long long). It must also be at least + under Irix 6.x, which must be a pointer to an 8 byte + aligned value (a long long). It must also be at least word aligned (depending on the return type, and the - system's alignment requirements). If RTYPE is - &ffi_type_void, this is ignored. If RVALUE is NULL, + system's alignment requirements). If RTYPE is + &ffi_type_void, this is ignored. If RVALUE is NULL, the return value is discarded. AVALUES is a vector of void* that point to the memory locations @@ -202,7 +202,7 @@ #include #include - + int main() { ffi_cif cif; @@ -210,26 +210,26 @@ void *values[1]; char *s; int rc; - - /* Initialize the argument info vectors */ + + /* Initialize the argument info vectors */ args[0] = &ffi_type_uint; values[0] = &s; - + /* Initialize the cif */ - if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, args) == FFI_OK) { s = "Hello World!"; ffi_call(&cif, puts, &rc, values); /* rc now holds the result of the call to puts */ - - /* values holds a pointer to the function's arg, so to - call puts() again all we need to do is change the + + /* values holds a pointer to the function's arg, so to + call puts() again all we need to do is change the value of s */ s = "This is cool!"; ffi_call(&cif, puts, &rc, values); } - + return 0; } @@ -250,7 +250,7 @@ short type; struct _ffi_type **elements; } ffi_type; - + All structures must have type set to FFI_TYPE_STRUCT. You may set size and alignment to 0. These will be calculated and reset to the appropriate values by ffi_prep_cif(). @@ -284,7 +284,7 @@ tm_type.size = tm_type.alignment = 0; tm_type.elements = &tm_type_elements; - + for (i = 0; i < 9; i++) tm_type_elements[i] = &ffi_type_sint; @@ -330,10 +330,10 @@ Here's one way of forcing this: double struct_storage[2]; - my_small_struct *s = (my_small_struct *) struct_storage; + my_small_struct *s = (my_small_struct *) struct_storage; /* Use s for RVALUE */ -If you don't do this you are liable to get spurious bus errors. +If you don't do this you are liable to get spurious bus errors. "long long" values are not supported yet. @@ -418,9 +418,9 @@ Linux x86 a.out fix. 1.12 Nov-22-96 - Added missing ffi_type_void, needed for supporting void return - types. Fixed test case for non MIPS machines. Cygnus Support - is now Cygnus Solutions. + Added missing ffi_type_void, needed for supporting void return + types. Fixed test case for non MIPS machines. Cygnus Support + is now Cygnus Solutions. 1.11 Oct-30-96 Added notes about GNU make. @@ -429,8 +429,8 @@ Added configuration fix for non GNU compilers. 1.09 Oct-29-96 - Added --enable-debug configure switch. Clean-ups based on LCLint - feedback. ffi_mips.h is always installed. Many configuration + Added --enable-debug configure switch. Clean-ups based on LCLint + feedback. ffi_mips.h is always installed. Many configuration fixes. Fixed ffitest.c for sparc builds. 1.08 Oct-15-96 @@ -440,7 +440,7 @@ Gordon Irlam rewrites v8.S again. Bug fixes. 1.06 Oct-14-96 - Gordon Irlam improved the sparc port. + Gordon Irlam improved the sparc port. 1.05 Oct-14-96 Interface changes based on feedback. diff -r 27ae40361ca5 Modules/_ctypes/libffi_msvc/ffi.c --- a/Modules/_ctypes/libffi_msvc/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_msvc/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -3,8 +3,8 @@ Copyright (c) 2002 Ranjit Mathew Copyright (c) 2002 Bo Thorsen Copyright (c) 2002 Roger Sayle - - x86 Foreign Function Interface + + x86 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -110,7 +110,7 @@ argp += z; } - if (argp >= stack && (unsigned)(argp - stack) > ecif->cif->bytes) + if (argp >= stack && (unsigned)(argp - stack) > ecif->cif->bytes) { Py_FatalError("FFI BUG: not enough stack space for arguments"); } @@ -149,10 +149,10 @@ #ifdef _WIN32 extern int -ffi_call_x86(void (*)(char *, extended_cif *), - /*@out@*/ extended_cif *, - unsigned, unsigned, - /*@out@*/ unsigned *, +ffi_call_x86(void (*)(char *, extended_cif *), + /*@out@*/ extended_cif *, + unsigned, unsigned, + /*@out@*/ unsigned *, void (*fn)()); #endif @@ -166,20 +166,20 @@ #endif int -ffi_call(/*@dependent@*/ ffi_cif *cif, - void (*fn)(), - /*@out@*/ void *rvalue, +ffi_call(/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; - + /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ - if ((rvalue == NULL) && + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { /*@-sysunrecog@*/ @@ -188,14 +188,14 @@ } else ecif.rvalue = rvalue; - - - switch (cif->abi) + + + switch (cif->abi) { #if !defined(_WIN64) case FFI_SYSV: case FFI_STDCALL: - return ffi_call_x86(ffi_prep_args, &ecif, cif->bytes, + return ffi_call_x86(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #else @@ -240,16 +240,16 @@ void *args = &argp[1]; cif = closure->cif; - arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); /* this call will initialize ARG_AREA, such that each - * element in that array points to the corresponding + * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will re-set RESP to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(args, (void**)&resp, arg_area, cif); - + (closure->fun) (cif, resp, arg_area, closure->user_data); rtype = cif->flags; @@ -284,7 +284,7 @@ _asm mov eax, [edx] ; _asm mov edx, [edx + 4] ; // asm ("movl 0(%0),%%eax;" -// "movl 4(%0),%%edx" +// "movl 4(%0),%%edx" // : : "r"(resp) // : "eax", "edx"); } @@ -309,7 +309,7 @@ else if (rtype == FFI_TYPE_SINT64) { asm ("movl 0(%0),%%eax;" - "movl 4(%0),%%edx" + "movl 4(%0),%%edx" : : "r"(resp) : "eax", "edx"); } @@ -326,7 +326,7 @@ } /*@-exportheader@*/ -static void +static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, ffi_cif *cif) /*@=exportheader@*/ @@ -363,7 +363,7 @@ p_argv++; argp += z; } - + return; } @@ -383,7 +383,7 @@ int mask = 0; #endif FFI_ASSERT (cif->abi == FFI_SYSV); - + if (cif->abi == FFI_SYSV) bytes = 0; #if !defined(_WIN64) @@ -444,7 +444,7 @@ /* ret bytes */ BYTES("\xc2"); SHORT(bytes); - + #endif if (tramp - &closure->tramp[0] > FFI_TRAMPOLINE_SIZE) diff -r 27ae40361ca5 Modules/_ctypes/libffi_msvc/ffi.h --- a/Modules/_ctypes/libffi_msvc/ffi.h Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_msvc/ffi.h Sat Aug 04 21:43:50 2012 +0300 @@ -155,7 +155,7 @@ typedef enum { FFI_OK = 0, FFI_BAD_TYPEDEF, - FFI_BAD_ABI + FFI_BAD_ABI } ffi_status; typedef unsigned FFI_TYPE; @@ -188,9 +188,9 @@ void* ptr; } ffi_raw; -void ffi_raw_call (/*@dependent@*/ ffi_cif *cif, - void (*fn)(), - /*@out@*/ void *rvalue, +void ffi_raw_call (/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, /*@dependent@*/ ffi_raw *avalue); void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); @@ -201,9 +201,9 @@ /* 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)(), - /*@out@*/ void *rvalue, +void ffi_java_raw_call (/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, /*@dependent@*/ ffi_raw *avalue); void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); @@ -238,8 +238,8 @@ #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 + /* 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*); @@ -268,16 +268,16 @@ /* ---- Public interface definition -------------------------------------- */ -ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, +ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, ffi_abi abi, - unsigned int nargs, - /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type *rtype, + unsigned int nargs, + /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type *rtype, /*@dependent@*/ ffi_type **atypes); int -ffi_call(/*@dependent@*/ ffi_cif *cif, - void (*fn)(), - /*@out@*/ void *rvalue, +ffi_call(/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue); /* Useful for eliminating compiler warnings */ @@ -288,18 +288,18 @@ #endif /* If these change, update src/mips/ffitarget.h. */ -#define FFI_TYPE_VOID 0 +#define FFI_TYPE_VOID 0 #define FFI_TYPE_INT 1 -#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_FLOAT 2 #define FFI_TYPE_DOUBLE 3 #if 1 #define FFI_TYPE_LONGDOUBLE 4 #else #define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE #endif -#define FFI_TYPE_UINT8 5 +#define FFI_TYPE_UINT8 5 #define FFI_TYPE_SINT8 6 -#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_UINT16 7 #define FFI_TYPE_SINT16 8 #define FFI_TYPE_UINT32 9 #define FFI_TYPE_SINT32 10 diff -r 27ae40361ca5 Modules/_ctypes/libffi_msvc/ffi_common.h --- a/Modules/_ctypes/libffi_msvc/ffi_common.h Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_msvc/ffi_common.h Sat Aug 04 21:43:50 2012 +0300 @@ -24,7 +24,7 @@ # endif #endif -#if defined(FFI_DEBUG) +#if defined(FFI_DEBUG) #include #endif @@ -37,7 +37,7 @@ #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(x) #define FFI_ASSERT_AT(x, f, l) #define FFI_ASSERT_VALID_TYPE(x) #endif diff -r 27ae40361ca5 Modules/_ctypes/libffi_msvc/prep_cif.c --- a/Modules/_ctypes/libffi_msvc/prep_cif.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_msvc/prep_cif.c Sat Aug 04 21:43:50 2012 +0300 @@ -35,7 +35,7 @@ static ffi_status initialize_aggregate(/*@out@*/ ffi_type *arg) { - ffi_type **ptr; + ffi_type **ptr; FFI_ASSERT(arg != NULL); @@ -51,14 +51,14 @@ { if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; - + /* Perform a sanity check on the argument type */ FFI_ASSERT_VALID_TYPE(*ptr); arg->size = ALIGN(arg->size, (*ptr)->alignment); arg->size += (*ptr)->size; - arg->alignment = (arg->alignment > (*ptr)->alignment) ? + arg->alignment = (arg->alignment > (*ptr)->alignment) ? arg->alignment : (*ptr)->alignment; ptr++; @@ -84,9 +84,9 @@ /* Perform machine independent ffi_cif preparation, then call machine dependent routine. */ -ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, - ffi_abi abi, unsigned int nargs, - /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type *rtype, +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) { unsigned bytes = 0; @@ -133,7 +133,7 @@ if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; - /* Perform a sanity check on the argument type, do this + /* Perform a sanity check on the argument type, do this check after the initialization. */ FFI_ASSERT_VALID_TYPE(*ptr); @@ -161,7 +161,7 @@ /* Add any padding if necessary */ if (((*ptr)->alignment - 1) & bytes) bytes = ALIGN(bytes, (*ptr)->alignment); - + #endif bytes += STACK_ARG_SIZE((*ptr)->size); } diff -r 27ae40361ca5 Modules/_ctypes/libffi_msvc/types.c --- a/Modules/_ctypes/libffi_msvc/types.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_msvc/types.c Sat Aug 04 21:43:50 2012 +0300 @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- types.c - Copyright (c) 1996, 1998 Red Hat, Inc. - + Predefined ffi_types needed by libffi. Permission is hereby granted, free of charge, to any person obtaining diff -r 27ae40361ca5 Modules/_ctypes/libffi_msvc/win32.c --- a/Modules/_ctypes/libffi_msvc/win32.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_msvc/win32.c Sat Aug 04 21:43:50 2012 +0300 @@ -2,10 +2,10 @@ win32.S - Copyright (c) 1996, 1998, 2001, 2002 Red Hat, Inc. Copyright (c) 2001 John Beniton Copyright (c) 2002 Ranjit Mathew - - + + X86 Foreign Function Interface - + 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 @@ -13,10 +13,10 @@ 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. @@ -56,7 +56,7 @@ // Make room for all of the new args. mov ecx, [ebp+16] sub esp, ecx // sub esp, bytes - + mov eax, esp // Place all of the ffi_prep_args in position @@ -74,7 +74,7 @@ mov ecx, [ebp + 12] mov ecx, [ecx]ecif.cif mov ecx, [ecx]ecif.cif.abi - + cmp ecx, FFI_STDCALL je noclean // STDCALL: Remove the space we pushed for the args diff -r 27ae40361ca5 Modules/_ctypes/libffi_msvc/win64.asm --- a/Modules/_ctypes/libffi_msvc/win64.asm Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_msvc/win64.asm Sat Aug 04 21:43:50 2012 +0300 @@ -12,11 +12,11 @@ ;;; ;;; It must move the parameters passed in registers to their stack location, ;;; call ffi_closure_SYSV for the actual work, then return the result. -;;; +;;; ffi_closure_OUTER PROC FRAME ;; save actual arguments to their stack space. test r11, 1 - jne first_is_float + jne first_is_float mov QWORD PTR [rsp+8], rcx jmp second first_is_float: @@ -24,7 +24,7 @@ second: test r11, 2 - jne second_is_float + jne second_is_float mov QWORD PTR [rsp+16], rdx jmp third second_is_float: @@ -32,7 +32,7 @@ third: test r11, 4 - jne third_is_float + jne third_is_float mov QWORD PTR [rsp+24], r8 jmp forth third_is_float: @@ -40,7 +40,7 @@ forth: test r11, 8 - jne forth_is_float + jne forth_is_float mov QWORD PTR [rsp+32], r9 jmp done forth_is_float: @@ -144,7 +144,7 @@ mov rcx, QWORD PTR rvalue$[rbp] mov QWORD PTR [rcx], rax jmp SHORT ret_nothing$ - + ret_nothing$: xor eax, eax diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/README --- a/Modules/_ctypes/libffi_osx/README Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/README Sat Aug 04 21:43:50 2012 +0300 @@ -30,7 +30,7 @@ The libffi library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run -time. +time. Ffi stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code @@ -68,7 +68,7 @@ You must use GNU make to build libffi. SGI's make will not work. Sun's probably won't either. - + If you port libffi to another platform, please let me know! I assume that some will be easy (x86 NetBSD), and others will be more difficult (HP). @@ -87,15 +87,15 @@ You may want to tell configure where to install the libffi library and header files. To do that, use the --prefix configure switch. Libffi -will install under /usr/local by default. +will install under /usr/local by default. If you want to enable extra run-time debugging checks use the the --enable-debug configure switch. This is useful when your program dies -mysteriously while using libffi. +mysteriously while using libffi. Another useful configure switch is --enable-purify-safety. Using this will add some extra code which will suppress certain warnings when you -are using Purify with libffi. Only use this switch when using +are using Purify with libffi. Only use this switch when using Purify, as it will slow down the library. Configure has many other options. Use "configure --help" to see them all. @@ -125,19 +125,19 @@ following function: ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, - unsigned int nargs, + unsigned int nargs, ffi_type *rtype, ffi_type **atypes); CIF is a pointer to the call interface object you wish to initialize. - ABI is an enum that specifies the calling convention + ABI is an enum that specifies the calling convention to use for the call. FFI_DEFAULT_ABI defaults to the system's native calling convention. Other ABI's may be used with care. They are system specific. - NARGS is the number of arguments this function accepts. + NARGS is the number of arguments this function accepts. libffi does not yet support vararg functions. RTYPE is a pointer to an ffi_type structure that represents @@ -146,14 +146,14 @@ ffi_type objects for many of the native C types: signed int, unsigned int, signed char, unsigned char, etc. There is also a pointer ffi_type object and - a void ffi_type. Use &ffi_type_void for functions that + a void ffi_type. Use &ffi_type_void for functions that don't return values. ATYPES is a vector of ffi_type pointers. ARGS must be NARGS long. If NARGS is 0, this is ignored. -ffi_prep_cif will return a status code that you are responsible +ffi_prep_cif will return a status code that you are responsible for checking. It will be one of the following: FFI_OK - All is good. @@ -162,7 +162,7 @@ came across is bad. -Before making the call, the VALUES vector should be initialized +Before making the call, the VALUES vector should be initialized with pointers to the appropriate argument values. To call the the function using the initialized ffi_cif, use the @@ -178,11 +178,11 @@ RVALUE is a pointer to a chunk of memory that is to hold the result of the function call. Currently, it must be at least one word in size (except for the n32 version - under Irix 6.x, which must be a pointer to an 8 byte - aligned value (a long long). It must also be at least + under Irix 6.x, which must be a pointer to an 8 byte + aligned value (a long long). It must also be at least word aligned (depending on the return type, and the - system's alignment requirements). If RTYPE is - &ffi_type_void, this is ignored. If RVALUE is NULL, + system's alignment requirements). If RTYPE is + &ffi_type_void, this is ignored. If RVALUE is NULL, the return value is discarded. AVALUES is a vector of void* that point to the memory locations @@ -202,7 +202,7 @@ #include #include - + int main() { ffi_cif cif; @@ -210,26 +210,26 @@ void *values[1]; char *s; int rc; - - /* Initialize the argument info vectors */ + + /* Initialize the argument info vectors */ args[0] = &ffi_type_uint; values[0] = &s; - + /* Initialize the cif */ - if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, args) == FFI_OK) { s = "Hello World!"; ffi_call(&cif, puts, &rc, values); /* rc now holds the result of the call to puts */ - - /* values holds a pointer to the function's arg, so to - call puts() again all we need to do is change the + + /* values holds a pointer to the function's arg, so to + call puts() again all we need to do is change the value of s */ s = "This is cool!"; ffi_call(&cif, puts, &rc, values); } - + return 0; } @@ -250,7 +250,7 @@ short type; struct _ffi_type **elements; } ffi_type; - + All structures must have type set to FFI_TYPE_STRUCT. You may set size and alignment to 0. These will be calculated and reset to the appropriate values by ffi_prep_cif(). @@ -284,7 +284,7 @@ tm_type.size = tm_type.alignment = 0; tm_type.elements = &tm_type_elements; - + for (i = 0; i < 9; i++) tm_type_elements[i] = &ffi_type_sint; @@ -330,10 +330,10 @@ Here's one way of forcing this: double struct_storage[2]; - my_small_struct *s = (my_small_struct *) struct_storage; + my_small_struct *s = (my_small_struct *) struct_storage; /* Use s for RVALUE */ -If you don't do this you are liable to get spurious bus errors. +If you don't do this you are liable to get spurious bus errors. "long long" values are not supported yet. @@ -418,9 +418,9 @@ Linux x86 a.out fix. 1.12 Nov-22-96 - Added missing ffi_type_void, needed for supporting void return - types. Fixed test case for non MIPS machines. Cygnus Support - is now Cygnus Solutions. + Added missing ffi_type_void, needed for supporting void return + types. Fixed test case for non MIPS machines. Cygnus Support + is now Cygnus Solutions. 1.11 Oct-30-96 Added notes about GNU make. @@ -429,8 +429,8 @@ Added configuration fix for non GNU compilers. 1.09 Oct-29-96 - Added --enable-debug configure switch. Clean-ups based on LCLint - feedback. ffi_mips.h is always installed. Many configuration + Added --enable-debug configure switch. Clean-ups based on LCLint + feedback. ffi_mips.h is always installed. Many configuration fixes. Fixed ffitest.c for sparc builds. 1.08 Oct-15-96 @@ -440,7 +440,7 @@ Gordon Irlam rewrites v8.S again. Bug fixes. 1.06 Oct-14-96 - Gordon Irlam improved the sparc port. + Gordon Irlam improved the sparc port. 1.05 Oct-14-96 Interface changes based on feedback. diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/README.pyobjc --- a/Modules/_ctypes/libffi_osx/README.pyobjc Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/README.pyobjc Sat Aug 04 21:43:50 2012 +0300 @@ -1,5 +1,5 @@ This directory contains a slightly modified version of libffi, extracted from the GCC source-tree. -The only modifications are those that are necessary to compile libffi using +The only modifications are those that are necessary to compile libffi using the Apple provided compiler and outside of the GCC source tree. diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/ffi.c --- a/Modules/_ctypes/libffi_osx/ffi.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/ffi.c Sat Aug 04 21:43:50 2012 +0300 @@ -64,12 +64,12 @@ arg->size = ALIGN(arg->size, curalign); arg->size += (*ptr)->size; - arg->alignment = (arg->alignment > curalign) ? + arg->alignment = (arg->alignment > curalign) ? arg->alignment : curalign; #else arg->size = ALIGN(arg->size, (*ptr)->alignment); arg->size += (*ptr)->size; - arg->alignment = (arg->alignment > (*ptr)->alignment) ? + arg->alignment = (arg->alignment > (*ptr)->alignment) ? arg->alignment : (*ptr)->alignment; #endif @@ -129,10 +129,10 @@ // Arguments' ffi_type->alignment must be nonzero. ffi_status ffi_prep_cif( -/*@out@*/ /*@partial@*/ ffi_cif* cif, +/*@out@*/ /*@partial@*/ ffi_cif* cif, ffi_abi abi, - unsigned int nargs, -/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype, + unsigned int nargs, +/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype, /*@dependent@*/ ffi_type** atypes) { if (cif == NULL) @@ -183,7 +183,7 @@ if ((*ptr)->alignment == 0) return FFI_BAD_TYPEDEF; - /* Perform a sanity check on the argument type, do this + /* Perform a sanity check on the argument type, do this check after the initialization. */ FFI_ASSERT_VALID_TYPE(*ptr); diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/include/ffi.h --- a/Modules/_ctypes/libffi_osx/include/ffi.h Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/include/ffi.h Sat Aug 04 21:43:50 2012 +0300 @@ -199,9 +199,9 @@ void ffi_raw_call( -/*@dependent@*/ ffi_cif* cif, - void (*fn)(void), -/*@out@*/ void* rvalue, +/*@dependent@*/ ffi_cif* cif, + void (*fn)(void), +/*@out@*/ void* rvalue, /*@dependent@*/ ffi_raw* avalue); void @@ -225,9 +225,9 @@ 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_cif* cif, + void (*fn)(void), +/*@out@*/ void* rvalue, /*@dependent@*/ ffi_raw* avalue); void @@ -272,8 +272,8 @@ 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 + /* 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; @@ -303,17 +303,17 @@ ffi_status ffi_prep_cif( -/*@out@*/ /*@partial@*/ ffi_cif* cif, +/*@out@*/ /*@partial@*/ ffi_cif* cif, ffi_abi abi, - unsigned int nargs, -/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype, + 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@*/ ffi_cif* cif, + void (*fn)(void), +/*@out@*/ void* rvalue, /*@dependent@*/ void** avalue); /* Useful for eliminating compiler warnings */ diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/include/ffi_common.h --- a/Modules/_ctypes/libffi_osx/include/ffi_common.h Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/include/ffi_common.h Sat Aug 04 21:43:50 2012 +0300 @@ -41,7 +41,7 @@ # endif #endif -/*#if defined(FFI_DEBUG) +/*#if defined(FFI_DEBUG) #include #endif*/ @@ -65,7 +65,7 @@ # 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(x) # define FFI_ASSERT_AT(x, f, l) # define FFI_ASSERT_VALID_TYPE(x) #endif // #ifdef FFI_DEBUG diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/include/fficonfig.h --- a/Modules/_ctypes/libffi_osx/include/fficonfig.h Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/include/fficonfig.h Sat Aug 04 21:43:50 2012 +0300 @@ -1,4 +1,4 @@ -/* Manually created fficonfig.h for Darwin on PowerPC or Intel +/* 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. @@ -33,10 +33,10 @@ # define SIZEOF_DOUBLE 8 # if __GNUC__ >= 4 # define HAVE_LONG_DOUBLE 1 -# define SIZEOF_LONG_DOUBLE 16 +# define SIZEOF_LONG_DOUBLE 16 # else # undef HAVE_LONG_DOUBLE -# define SIZEOF_LONG_DOUBLE 8 +# define SIZEOF_LONG_DOUBLE 8 # endif #elif defined(__ppc64__) diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/include/x86-ffitarget.h --- a/Modules/_ctypes/libffi_osx/include/x86-ffitarget.h Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/include/x86-ffitarget.h Sat Aug 04 21:43:50 2012 +0300 @@ -33,7 +33,7 @@ # define X86 #endif -#if defined(__x86_64__) +#if defined(__x86_64__) # ifndef X86_64 # define X86_64 # endif diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.S --- a/Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,4 +1,4 @@ -#if defined(__ppc__) || defined(__ppc64__) +#if defined(__ppc__) || defined(__ppc64__) /* ----------------------------------------------------------------------- ppc-darwin.S - Copyright (c) 2000 John Hornkvist @@ -197,7 +197,7 @@ #if defined(__ppc64__) ld r27,-40(r1) #endif - blr + blr #if defined(__ppc64__) L(st_return_value): diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c --- a/Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c Sat Aug 04 21:43:50 2012 +0300 @@ -891,7 +891,7 @@ avalue[i] = alloca(arg_types[i]->size); ffi64_struct_to_ram_form(arg_types[i], (const char*)pgr, &gprSize, (const char*)pfr, &fprSize, &nf, avalue[i], NULL); - + ng += gprSize / sizeof(long); pgr += gprSize / sizeof(long); pfr += (fprSize - savedFPRSize) / sizeof(double); @@ -1479,7 +1479,7 @@ memcpy(&outGPRs[destGMarker], &inStruct[srcMarker], inType->size); } - + srcMarker += inType->size; destGMarker += inType->size; i += inType->size - 1; @@ -1561,7 +1561,7 @@ case FFI_TYPE_STRUCT: recurseCount++; ffi64_struct_to_reg_form(inType->elements[i], - inStruct, &srcMarker, &fprsUsed, outGPRs, + inStruct, &srcMarker, &fprsUsed, outGPRs, &destGMarker, outFPRs, &destFMarker); recurseCount--; break; diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/types.c --- a/Modules/_ctypes/libffi_osx/types.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/types.c Sat Aug 04 21:43:50 2012 +0300 @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- types.c - Copyright (c) 1996, 1998 Red Hat, Inc. - + Predefined ffi_types needed by libffi. Permission is hereby granted, free of charge, to any person obtaining @@ -85,7 +85,7 @@ FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE); # endif -#elif defined ARM || defined SH || defined POWERPC_AIX +#elif defined ARM || defined SH || defined POWERPC_AIX FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE); FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE); #elif defined POWERPC_DARWIN diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/x86/x86-darwin.S --- a/Modules/_ctypes/libffi_osx/x86/x86-darwin.S Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/x86/x86-darwin.S Sat Aug 04 21:43:50 2012 +0300 @@ -1,8 +1,8 @@ #ifdef __i386__ /* ----------------------------------------------------------------------- darwin.S - Copyright (c) 1996, 1998, 2001, 2002, 2003 Red Hat, Inc. - - X86 Foreign Function Interface + + X86 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -23,7 +23,7 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ - + /* * This file is based on sysv.S and then hacked up by Ronald who hasn't done * assembly programming in 8 years. @@ -31,7 +31,7 @@ #ifndef __x86_64__ -#define LIBFFI_ASM +#define LIBFFI_ASM #include #include @@ -39,7 +39,7 @@ /* XXX: Debugging of stack alignment, to be removed */ #define ASSERT_STACK_ALIGNED movdqa -16(%esp), %xmm0 #else -#define ASSERT_STACK_ALIGNED +#define ASSERT_STACK_ALIGNED #endif .text @@ -69,7 +69,7 @@ call *8(%ebp) /* Return stack to previous state and call the function */ - addl $16,%esp + addl $16,%esp call *28(%ebp) @@ -78,13 +78,13 @@ addl %ecx,%esp /* Load %ecx with the return type code */ - movl 20(%ebp),%ecx + movl 20(%ebp),%ecx /* If the return value pointer is NULL, assume no return value. */ cmpl $0,24(%ebp) jne Lretint - /* Even if there is no space for the return value, we are + /* Even if there is no space for the return value, we are obliged to handle floating-point values. */ cmpl $FFI_TYPE_FLOAT,%ecx jne Lnoretval @@ -96,7 +96,7 @@ cmpl $FFI_TYPE_INT,%ecx jne Lretfloat /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx movl %eax,0(%ecx) jmp Lepilogue @@ -104,7 +104,7 @@ cmpl $FFI_TYPE_FLOAT,%ecx jne Lretdouble /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx fstps (%ecx) jmp Lepilogue @@ -112,7 +112,7 @@ cmpl $FFI_TYPE_DOUBLE,%ecx jne Lretlongdouble /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx fstpl (%ecx) jmp Lepilogue @@ -120,32 +120,32 @@ cmpl $FFI_TYPE_LONGDOUBLE,%ecx jne Lretint64 /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx fstpt (%ecx) jmp Lepilogue - -Lretint64: + +Lretint64: cmpl $FFI_TYPE_SINT64,%ecx jne Lretstruct1b /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp Lepilogue - -Lretstruct1b: + +Lretstruct1b: cmpl $FFI_TYPE_SINT8,%ecx jne Lretstruct2b /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx movb %al,0(%ecx) jmp Lepilogue -Lretstruct2b: +Lretstruct2b: cmpl $FFI_TYPE_SINT16,%ecx jne Lretstruct /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx + movl 24(%ebp),%ecx movw %ax,0(%ecx) jmp Lepilogue diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/x86/x86-ffi64.c --- a/Modules/_ctypes/libffi_osx/x86/x86-ffi64.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/x86/x86-ffi64.c Sat Aug 04 21:43:50 2012 +0300 @@ -2,8 +2,8 @@ /* ----------------------------------------------------------------------- x86-ffi64.c - Copyright (c) 2002 Bo Thorsen - - x86-64 Foreign Function Interface + + x86-64 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -178,7 +178,7 @@ case FFI_TYPE_STRUCT: { - ffi_type** ptr; + ffi_type** ptr; int i; enum x86_64_reg_class subclasses[MAX_CLASSES]; const int UNITS_PER_WORD = 8; diff -r 27ae40361ca5 Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c --- a/Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c Sat Aug 04 16:17:10 2012 +0200 +++ b/Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c Sat Aug 04 21:43:50 2012 +0300 @@ -4,8 +4,8 @@ Copyright (c) 2002 Ranjit Mathew Copyright (c) 2002 Bo Thorsen Copyright (c) 2002 Roger Sayle - - x86 Foreign Function Interface + + x86 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -41,27 +41,27 @@ register void **p_argv; register char *argp; register ffi_type **p_arg; - + argp = stack; - + if (ecif->cif->flags == FFI_TYPE_STRUCT) { *(void **) argp = ecif->rvalue; argp += 4; } - + p_argv = ecif->avalue; - + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i != 0; i--, p_arg++) { size_t z; - + /* Align if necessary */ if ((sizeof(int) - 1) & (unsigned) argp) argp = (char *) ALIGN(argp, sizeof(int)); - + z = (*p_arg)->size; if (z < sizeof(int)) { @@ -71,31 +71,31 @@ case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; - + case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; - + case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; - + case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; - + case FFI_TYPE_SINT32: *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv); break; - + case FFI_TYPE_UINT32: *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); break; - + case FFI_TYPE_STRUCT: *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); break; - + default: FFI_ASSERT(0); } @@ -107,7 +107,7 @@ p_argv++; argp += z; } - + return; } @@ -125,18 +125,18 @@ case FFI_TYPE_SINT8: case FFI_TYPE_SINT16: #endif - + case FFI_TYPE_SINT64: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: case FFI_TYPE_LONGDOUBLE: cif->flags = (unsigned) cif->rtype->type; break; - + case FFI_TYPE_UINT64: cif->flags = FFI_TYPE_SINT64; break; - + #ifndef X86 case FFI_TYPE_STRUCT: if (cif->rtype->size == 1) @@ -161,16 +161,16 @@ } break; #endif - + default: cif->flags = FFI_TYPE_INT; break; } - + #ifdef X86_DARWIN cif->bytes = (cif->bytes + 15) & ~0xF; #endif - + return FFI_OK; } @@ -186,23 +186,23 @@ void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) { extended_cif ecif; - + ecif.cif = cif; ecif.avalue = avalue; - + /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ - - if ((rvalue == NULL) && + + if ((rvalue == NULL) && (cif->flags == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; - - - switch (cif->abi) + + + switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, @@ -243,20 +243,20 @@ // our various things... ffi_cif *cif; void **arg_area; - + cif = closure->cif; - arg_area = (void**) alloca (cif->nargs * sizeof (void*)); - + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + /* this call will initialize ARG_AREA, such that each - * element in that array points to the corresponding + * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will re-set RESP to point to the * structure return address. */ - + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); - + (closure->fun) (cif, *respp, arg_area, closure->user_data); - + return cif->flags; } @@ -268,35 +268,35 @@ register void **p_argv; register char *argp; register ffi_type **p_arg; - + argp = stack; - + if ( cif->flags == FFI_TYPE_STRUCT ) { *rvalue = *(void **) argp; argp += 4; } - + p_argv = avalue; - + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { size_t z; - + /* Align if necessary */ if ((sizeof(int) - 1) & (unsigned) argp) { argp = (char *) ALIGN(argp, sizeof(int)); } - + z = (*p_arg)->size; - + /* because we're little endian, this is what it turns into. */ - + *p_argv = (void*) argp; - + p_argv++; argp += z; } - + return; } @@ -323,15 +323,15 @@ { if (cif->abi != FFI_SYSV) return FFI_BAD_ABI; - + FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ &ffi_closure_SYSV, \ (void*)closure); - + closure->cif = cif; closure->user_data = user_data; closure->fun = fun; - + return FFI_OK; } @@ -347,32 +347,32 @@ void *codeloc) { int i; - + FFI_ASSERT (cif->abi == FFI_SYSV); - + // we currently don't support certain kinds of arguments for raw // closures. This should be implemented by a separate assembly language // routine, since it would require argument processing, something we // don't do now for performance. - + for (i = cif->nargs-1; i >= 0; i--) { FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT); FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); } - - + + FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV, codeloc); - + closure->cif = cif; closure->user_data = user_data; closure->fun = fun; - + return FFI_OK; } -static void +static void ffi_prep_args_raw(char *stack, extended_cif *ecif) { memcpy (stack, ecif->avalue, ecif->cif->bytes); @@ -384,7 +384,7 @@ */ extern void -ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, +ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)()); #ifdef X86_WIN32 @@ -398,23 +398,23 @@ { extended_cif ecif; void **avalue = (void **)fake_avalue; - + ecif.cif = cif; ecif.avalue = avalue; - + /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ - - if ((rvalue == NULL) && + + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; - - - switch (cif->abi) + + + switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags,