ffi 1.9.3-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ffi might be problematic. Click here for more details.
- data/COPYING +49 -0
- data/LICENSE +24 -0
- data/README.md +109 -0
- data/Rakefile +220 -0
- data/ext/ffi_c/AbstractMemory.c +1032 -0
- data/ext/ffi_c/AbstractMemory.h +175 -0
- data/ext/ffi_c/ArrayType.c +162 -0
- data/ext/ffi_c/ArrayType.h +59 -0
- data/ext/ffi_c/Buffer.c +365 -0
- data/ext/ffi_c/Call.c +465 -0
- data/ext/ffi_c/Call.h +93 -0
- data/ext/ffi_c/ClosurePool.c +283 -0
- data/ext/ffi_c/ClosurePool.h +57 -0
- data/ext/ffi_c/DataConverter.c +91 -0
- data/ext/ffi_c/DynamicLibrary.c +333 -0
- data/ext/ffi_c/DynamicLibrary.h +49 -0
- data/ext/ffi_c/Function.c +999 -0
- data/ext/ffi_c/Function.h +87 -0
- data/ext/ffi_c/FunctionInfo.c +271 -0
- data/ext/ffi_c/LastError.c +184 -0
- data/ext/ffi_c/LastError.h +47 -0
- data/ext/ffi_c/LongDouble.c +63 -0
- data/ext/ffi_c/LongDouble.h +51 -0
- data/ext/ffi_c/MappedType.c +168 -0
- data/ext/ffi_c/MappedType.h +59 -0
- data/ext/ffi_c/MemoryPointer.c +197 -0
- data/ext/ffi_c/MemoryPointer.h +53 -0
- data/ext/ffi_c/MethodHandle.c +360 -0
- data/ext/ffi_c/MethodHandle.h +55 -0
- data/ext/ffi_c/Platform.c +121 -0
- data/ext/ffi_c/Platform.h +45 -0
- data/ext/ffi_c/Pointer.c +508 -0
- data/ext/ffi_c/Pointer.h +63 -0
- data/ext/ffi_c/Struct.c +828 -0
- data/ext/ffi_c/Struct.h +106 -0
- data/ext/ffi_c/StructByReference.c +190 -0
- data/ext/ffi_c/StructByReference.h +50 -0
- data/ext/ffi_c/StructByValue.c +150 -0
- data/ext/ffi_c/StructByValue.h +55 -0
- data/ext/ffi_c/StructLayout.c +698 -0
- data/ext/ffi_c/Thread.c +352 -0
- data/ext/ffi_c/Thread.h +95 -0
- data/ext/ffi_c/Type.c +397 -0
- data/ext/ffi_c/Type.h +62 -0
- data/ext/ffi_c/Types.c +139 -0
- data/ext/ffi_c/Types.h +89 -0
- data/ext/ffi_c/Variadic.c +276 -0
- data/ext/ffi_c/compat.h +83 -0
- data/ext/ffi_c/extconf.rb +64 -0
- data/ext/ffi_c/ffi.c +98 -0
- data/ext/ffi_c/libffi.bsd.mk +34 -0
- data/ext/ffi_c/libffi.darwin.mk +95 -0
- data/ext/ffi_c/libffi.gnu.mk +31 -0
- data/ext/ffi_c/libffi.mk +13 -0
- data/ext/ffi_c/libffi.vc.mk +26 -0
- data/ext/ffi_c/libffi.vc64.mk +26 -0
- data/ext/ffi_c/libffi/ChangeLog +4600 -0
- data/ext/ffi_c/libffi/ChangeLog.libffi +584 -0
- data/ext/ffi_c/libffi/ChangeLog.libgcj +40 -0
- data/ext/ffi_c/libffi/ChangeLog.v1 +764 -0
- data/ext/ffi_c/libffi/LICENSE +21 -0
- data/ext/ffi_c/libffi/Makefile.am +196 -0
- data/ext/ffi_c/libffi/Makefile.in +1820 -0
- data/ext/ffi_c/libffi/Makefile.vc +141 -0
- data/ext/ffi_c/libffi/Makefile.vc64 +141 -0
- data/ext/ffi_c/libffi/README +342 -0
- data/ext/ffi_c/libffi/acinclude.m4 +92 -0
- data/ext/ffi_c/libffi/aclocal.m4 +1873 -0
- data/ext/ffi_c/libffi/build-ios.sh +67 -0
- data/ext/ffi_c/libffi/compile +143 -0
- data/ext/ffi_c/libffi/config.guess +1501 -0
- data/ext/ffi_c/libffi/config.sub +1705 -0
- data/ext/ffi_c/libffi/configure +17191 -0
- data/ext/ffi_c/libffi/configure.ac +496 -0
- data/ext/ffi_c/libffi/configure.host +11 -0
- data/ext/ffi_c/libffi/depcomp +630 -0
- data/ext/ffi_c/libffi/doc/libffi.info +593 -0
- data/ext/ffi_c/libffi/doc/libffi.texi +600 -0
- data/ext/ffi_c/libffi/doc/stamp-vti +4 -0
- data/ext/ffi_c/libffi/doc/version.texi +4 -0
- data/ext/ffi_c/libffi/fficonfig.h.in +199 -0
- data/ext/ffi_c/libffi/fficonfig.hw +57 -0
- data/ext/ffi_c/libffi/include/Makefile.am +9 -0
- data/ext/ffi_c/libffi/include/Makefile.in +487 -0
- data/ext/ffi_c/libffi/include/ffi.h.in +427 -0
- data/ext/ffi_c/libffi/include/ffi.h.vc +427 -0
- data/ext/ffi_c/libffi/include/ffi.h.vc64 +427 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +126 -0
- data/ext/ffi_c/libffi/install-sh +520 -0
- data/ext/ffi_c/libffi/libffi.pc.in +10 -0
- data/ext/ffi_c/libffi/libtool-version +29 -0
- data/ext/ffi_c/libffi/ltmain.sh +9636 -0
- data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +176 -0
- data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +195 -0
- data/ext/ffi_c/libffi/m4/ax_check_compiler_flags.m4 +76 -0
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +63 -0
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +70 -0
- data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +300 -0
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +215 -0
- data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +79 -0
- data/ext/ffi_c/libffi/m4/libtool.m4 +7831 -0
- data/ext/ffi_c/libffi/m4/ltoptions.m4 +369 -0
- data/ext/ffi_c/libffi/m4/ltsugar.m4 +123 -0
- data/ext/ffi_c/libffi/m4/ltversion.m4 +23 -0
- data/ext/ffi_c/libffi/m4/lt~obsolete.m4 +98 -0
- data/ext/ffi_c/libffi/man/Makefile.am +8 -0
- data/ext/ffi_c/libffi/man/Makefile.in +466 -0
- data/ext/ffi_c/libffi/man/ffi.3 +31 -0
- data/ext/ffi_c/libffi/man/ffi_call.3 +103 -0
- data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +66 -0
- data/ext/ffi_c/libffi/mdate-sh +201 -0
- data/ext/ffi_c/libffi/missing +376 -0
- data/ext/ffi_c/libffi/msvcc.sh +197 -0
- data/ext/ffi_c/libffi/src/alpha/ffi.c +284 -0
- data/ext/ffi_c/libffi/src/alpha/ffitarget.h +48 -0
- data/ext/ffi_c/libffi/src/alpha/osf.S +387 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +728 -0
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +65 -0
- data/ext/ffi_c/libffi/src/arm/gentramp.sh +118 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +497 -0
- data/ext/ffi_c/libffi/src/arm/trampoline.S +4450 -0
- data/ext/ffi_c/libffi/src/avr32/ffi.c +423 -0
- data/ext/ffi_c/libffi/src/avr32/ffitarget.h +50 -0
- data/ext/ffi_c/libffi/src/avr32/sysv.S +208 -0
- data/ext/ffi_c/libffi/src/closures.c +615 -0
- data/ext/ffi_c/libffi/src/cris/ffi.c +383 -0
- data/ext/ffi_c/libffi/src/cris/ffitarget.h +51 -0
- data/ext/ffi_c/libffi/src/cris/sysv.S +215 -0
- data/ext/ffi_c/libffi/src/debug.c +59 -0
- data/ext/ffi_c/libffi/src/dlmalloc.c +5161 -0
- data/ext/ffi_c/libffi/src/frv/eabi.S +128 -0
- data/ext/ffi_c/libffi/src/frv/ffi.c +292 -0
- data/ext/ffi_c/libffi/src/frv/ffitarget.h +57 -0
- data/ext/ffi_c/libffi/src/ia64/ffi.c +582 -0
- data/ext/ffi_c/libffi/src/ia64/ffitarget.h +50 -0
- data/ext/ffi_c/libffi/src/ia64/ia64_flags.h +40 -0
- data/ext/ffi_c/libffi/src/ia64/unix.S +560 -0
- data/ext/ffi_c/libffi/src/java_raw_api.c +356 -0
- data/ext/ffi_c/libffi/src/m32r/ffi.c +232 -0
- data/ext/ffi_c/libffi/src/m32r/ffitarget.h +48 -0
- data/ext/ffi_c/libffi/src/m32r/sysv.S +121 -0
- data/ext/ffi_c/libffi/src/m68k/ffi.c +288 -0
- data/ext/ffi_c/libffi/src/m68k/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/m68k/sysv.S +270 -0
- data/ext/ffi_c/libffi/src/mips/ffi.c +1036 -0
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +242 -0
- data/ext/ffi_c/libffi/src/mips/n32.S +591 -0
- data/ext/ffi_c/libffi/src/mips/o32.S +381 -0
- data/ext/ffi_c/libffi/src/moxie/eabi.S +128 -0
- data/ext/ffi_c/libffi/src/moxie/ffi.c +276 -0
- data/ext/ffi_c/libffi/src/pa/ffi.c +719 -0
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +78 -0
- data/ext/ffi_c/libffi/src/pa/hpux32.S +368 -0
- data/ext/ffi_c/libffi/src/pa/linux.S +357 -0
- data/ext/ffi_c/libffi/src/powerpc/aix.S +328 -0
- data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +445 -0
- data/ext/ffi_c/libffi/src/powerpc/asm.h +125 -0
- data/ext/ffi_c/libffi/src/powerpc/darwin.S +383 -0
- data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +575 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +1448 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +1359 -0
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +139 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +187 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +236 -0
- data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +327 -0
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +219 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +177 -0
- data/ext/ffi_c/libffi/src/raw_api.c +254 -0
- data/ext/ffi_c/libffi/src/s390/ffi.c +780 -0
- data/ext/ffi_c/libffi/src/s390/ffitarget.h +62 -0
- data/ext/ffi_c/libffi/src/s390/sysv.S +434 -0
- data/ext/ffi_c/libffi/src/sh/ffi.c +716 -0
- data/ext/ffi_c/libffi/src/sh/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/sh/sysv.S +850 -0
- data/ext/ffi_c/libffi/src/sh64/ffi.c +468 -0
- data/ext/ffi_c/libffi/src/sh64/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/sh64/sysv.S +539 -0
- data/ext/ffi_c/libffi/src/sparc/ffi.c +669 -0
- data/ext/ffi_c/libffi/src/sparc/ffitarget.h +68 -0
- data/ext/ffi_c/libffi/src/sparc/v8.S +313 -0
- data/ext/ffi_c/libffi/src/sparc/v9.S +307 -0
- data/ext/ffi_c/libffi/src/types.c +77 -0
- data/ext/ffi_c/libffi/src/x86/darwin.S +444 -0
- data/ext/ffi_c/libffi/src/x86/darwin64.S +416 -0
- data/ext/ffi_c/libffi/src/x86/ffi.c +644 -0
- data/ext/ffi_c/libffi/src/x86/ffi64.c +635 -0
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +121 -0
- data/ext/ffi_c/libffi/src/x86/freebsd.S +458 -0
- data/ext/ffi_c/libffi/src/x86/sysv.S +468 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +426 -0
- data/ext/ffi_c/libffi/src/x86/win32.S +1065 -0
- data/ext/ffi_c/libffi/src/x86/win64.S +468 -0
- data/ext/ffi_c/libffi/testsuite/Makefile.am +80 -0
- data/ext/ffi_c/libffi/testsuite/Makefile.in +500 -0
- data/ext/ffi_c/libffi/testsuite/config/default.exp +1 -0
- data/ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp +300 -0
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +350 -0
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +263 -0
- data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +45 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +32 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn0.c +89 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn1.c +81 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn2.c +81 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn3.c +82 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn4.c +89 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn5.c +92 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn6.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_loc_fn0.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_stdcall.c +64 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c +94 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c +96 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c +102 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c +89 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c +113 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c +98 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c +109 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c +98 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c +124 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c +113 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c +99 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c +117 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c +97 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c +88 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c +92 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +134 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +117 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c +92 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_dbls_struct.c +66 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c +60 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_float.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c +105 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c +60 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_schar.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshort.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshortchar.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_uchar.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushort.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushortchar.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c +140 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_schar.c +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sint.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sshort.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c +47 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_abi.c +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +26 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +153 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +59 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +58 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +58 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +72 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +62 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c +342 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +69 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_win32.c +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +53 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c +152 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c +161 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c +133 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c +110 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c +111 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c +111 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c +112 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c +131 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c +111 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c +131 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c +131 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/problem1.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c +59 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc-tc.c +114 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +35 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c +35 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +34 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +38 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +38 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +38 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large.c +145 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large2.c +148 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium.c +124 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c +125 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen_win32.c +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +65 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +59 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +65 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +64 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +80 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h +96 -0
- data/ext/ffi_c/libffi/testsuite/libffi.special/special.exp +35 -0
- data/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest.cc +124 -0
- data/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc +53 -0
- data/ext/ffi_c/libffi/texinfo.tex +7210 -0
- data/ext/ffi_c/rbffi.h +57 -0
- data/ext/ffi_c/rbffi_endian.h +59 -0
- data/ext/ffi_c/win32/stdbool.h +8 -0
- data/ext/ffi_c/win32/stdint.h +201 -0
- data/ffi.gemspec +22 -0
- data/gen/Rakefile +30 -0
- data/lib/ffi.rb +28 -0
- data/lib/ffi/autopointer.rb +194 -0
- data/lib/ffi/buffer.rb +4 -0
- data/lib/ffi/callback.rb +4 -0
- data/lib/ffi/enum.rb +173 -0
- data/lib/ffi/errno.rb +43 -0
- data/lib/ffi/ffi.rb +44 -0
- data/lib/ffi/io.rb +62 -0
- data/lib/ffi/library.rb +499 -0
- data/lib/ffi/managedstruct.rb +84 -0
- data/lib/ffi/memorypointer.rb +1 -0
- data/lib/ffi/platform.rb +148 -0
- data/lib/ffi/platform/arm-linux/types.conf +104 -0
- data/lib/ffi/platform/i386-cygwin/types.conf +3 -0
- data/lib/ffi/platform/i386-darwin/types.conf +100 -0
- data/lib/ffi/platform/i386-freebsd/types.conf +152 -0
- data/lib/ffi/platform/i386-gnu/types.conf +107 -0
- data/lib/ffi/platform/i386-linux/types.conf +103 -0
- data/lib/ffi/platform/i386-netbsd/types.conf +126 -0
- data/lib/ffi/platform/i386-openbsd/types.conf +128 -0
- data/lib/ffi/platform/i386-solaris/types.conf +122 -0
- data/lib/ffi/platform/i386-windows/types.conf +105 -0
- data/lib/ffi/platform/ia64-linux/types.conf +104 -0
- data/lib/ffi/platform/mips-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsel-linux/types.conf +102 -0
- data/lib/ffi/platform/powerpc-aix/types.conf +180 -0
- data/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
- data/lib/ffi/platform/powerpc-linux/types.conf +100 -0
- data/lib/ffi/platform/s390-linux/types.conf +102 -0
- data/lib/ffi/platform/s390x-linux/types.conf +102 -0
- data/lib/ffi/platform/sparc-linux/types.conf +102 -0
- data/lib/ffi/platform/sparc-solaris/types.conf +128 -0
- data/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
- data/lib/ffi/platform/x86_64-cygwin/types.conf +3 -0
- data/lib/ffi/platform/x86_64-darwin/types.conf +100 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
- data/lib/ffi/platform/x86_64-linux/types.conf +102 -0
- data/lib/ffi/platform/x86_64-netbsd/types.conf +126 -0
- data/lib/ffi/platform/x86_64-openbsd/types.conf +128 -0
- data/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
- data/lib/ffi/platform/x86_64-windows/types.conf +27 -0
- data/lib/ffi/pointer.rb +134 -0
- data/lib/ffi/struct.rb +367 -0
- data/lib/ffi/struct_layout_builder.rb +222 -0
- data/lib/ffi/tools/const_generator.rb +229 -0
- data/lib/ffi/tools/generator.rb +60 -0
- data/lib/ffi/tools/generator_task.rb +36 -0
- data/lib/ffi/tools/struct_generator.rb +194 -0
- data/lib/ffi/tools/types_generator.rb +135 -0
- data/lib/ffi/types.rb +190 -0
- data/lib/ffi/union.rb +43 -0
- data/lib/ffi/variadic.rb +78 -0
- data/lib/ffi/version.rb +4 -0
- data/lib/ffi_c.so +0 -0
- data/libtest/Benchmark.c +52 -0
- data/libtest/BoolTest.c +34 -0
- data/libtest/BufferTest.c +31 -0
- data/libtest/ClosureTest.c +190 -0
- data/libtest/EnumTest.c +34 -0
- data/libtest/FunctionTest.c +58 -0
- data/libtest/GNUmakefile +149 -0
- data/libtest/GlobalVariable.c +62 -0
- data/libtest/LastErrorTest.c +21 -0
- data/libtest/NumberTest.c +132 -0
- data/libtest/PointerTest.c +63 -0
- data/libtest/ReferenceTest.c +23 -0
- data/libtest/StringTest.c +34 -0
- data/libtest/StructTest.c +243 -0
- data/libtest/UnionTest.c +43 -0
- data/libtest/VariadicTest.c +62 -0
- data/spec/ffi/async_callback_spec.rb +35 -0
- data/spec/ffi/bool_spec.rb +29 -0
- data/spec/ffi/buffer_spec.rb +251 -0
- data/spec/ffi/callback_spec.rb +667 -0
- data/spec/ffi/custom_param_type.rb +36 -0
- data/spec/ffi/custom_type_spec.rb +74 -0
- data/spec/ffi/dup_spec.rb +54 -0
- data/spec/ffi/enum_spec.rb +220 -0
- data/spec/ffi/errno_spec.rb +18 -0
- data/spec/ffi/ffi_spec.rb +29 -0
- data/spec/ffi/function_spec.rb +76 -0
- data/spec/ffi/library_spec.rb +216 -0
- data/spec/ffi/long_double.rb +30 -0
- data/spec/ffi/managed_struct_spec.rb +57 -0
- data/spec/ffi/number_spec.rb +236 -0
- data/spec/ffi/pointer_spec.rb +265 -0
- data/spec/ffi/rbx/attach_function_spec.rb +28 -0
- data/spec/ffi/rbx/memory_pointer_spec.rb +123 -0
- data/spec/ffi/rbx/spec_helper.rb +1 -0
- data/spec/ffi/rbx/struct_spec.rb +13 -0
- data/spec/ffi/spec_helper.rb +33 -0
- data/spec/ffi/string_spec.rb +108 -0
- data/spec/ffi/strptr_spec.rb +50 -0
- data/spec/ffi/struct_by_ref_spec.rb +43 -0
- data/spec/ffi/struct_callback_spec.rb +69 -0
- data/spec/ffi/struct_initialize_spec.rb +35 -0
- data/spec/ffi/struct_packed_spec.rb +51 -0
- data/spec/ffi/struct_spec.rb +748 -0
- data/spec/ffi/typedef_spec.rb +78 -0
- data/spec/ffi/union_spec.rb +65 -0
- data/spec/ffi/variadic_spec.rb +92 -0
- data/spec/spec.opts +4 -0
- metadata +562 -0
@@ -0,0 +1,197 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# ***** BEGIN LICENSE BLOCK *****
|
4
|
+
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
5
|
+
#
|
6
|
+
# The contents of this file are subject to the Mozilla Public License Version
|
7
|
+
# 1.1 (the "License"); you may not use this file except in compliance with
|
8
|
+
# the License. You may obtain a copy of the License at
|
9
|
+
# http://www.mozilla.org/MPL/
|
10
|
+
#
|
11
|
+
# Software distributed under the License is distributed on an "AS IS" basis,
|
12
|
+
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
13
|
+
# for the specific language governing rights and limitations under the
|
14
|
+
# License.
|
15
|
+
#
|
16
|
+
# The Original Code is the MSVC wrappificator.
|
17
|
+
#
|
18
|
+
# The Initial Developer of the Original Code is
|
19
|
+
# Timothy Wall <twalljava@dev.java.net>.
|
20
|
+
# Portions created by the Initial Developer are Copyright (C) 2009
|
21
|
+
# the Initial Developer. All Rights Reserved.
|
22
|
+
#
|
23
|
+
# Contributor(s):
|
24
|
+
# Daniel Witte <dwitte@mozilla.com>
|
25
|
+
#
|
26
|
+
# Alternatively, the contents of this file may be used under the terms of
|
27
|
+
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
28
|
+
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
29
|
+
# in which case the provisions of the GPL or the LGPL are applicable instead
|
30
|
+
# of those above. If you wish to allow use of your version of this file only
|
31
|
+
# under the terms of either the GPL or the LGPL, and not to allow others to
|
32
|
+
# use your version of this file under the terms of the MPL, indicate your
|
33
|
+
# decision by deleting the provisions above and replace them with the notice
|
34
|
+
# and other provisions required by the GPL or the LGPL. If you do not delete
|
35
|
+
# the provisions above, a recipient may use your version of this file under
|
36
|
+
# the terms of any one of the MPL, the GPL or the LGPL.
|
37
|
+
#
|
38
|
+
# ***** END LICENSE BLOCK *****
|
39
|
+
|
40
|
+
#
|
41
|
+
# GCC-compatible wrapper for cl.exe and ml.exe. Arguments are given in GCC
|
42
|
+
# format and translated into something sensible for cl or ml.
|
43
|
+
#
|
44
|
+
|
45
|
+
args="-nologo -W3"
|
46
|
+
md=-MD
|
47
|
+
cl="cl"
|
48
|
+
ml="ml"
|
49
|
+
safeseh="-safeseh"
|
50
|
+
output=
|
51
|
+
|
52
|
+
while [ $# -gt 0 ]
|
53
|
+
do
|
54
|
+
case $1
|
55
|
+
in
|
56
|
+
-fexceptions)
|
57
|
+
# Don't enable exceptions for now.
|
58
|
+
#args="$args -EHac"
|
59
|
+
shift 1
|
60
|
+
;;
|
61
|
+
-m32)
|
62
|
+
shift 1
|
63
|
+
;;
|
64
|
+
-m64)
|
65
|
+
cl="cl" # "$MSVC/x86_amd64/cl"
|
66
|
+
ml="ml64" # "$MSVC/x86_amd64/ml64"
|
67
|
+
safeseh=
|
68
|
+
shift 1
|
69
|
+
;;
|
70
|
+
-O0)
|
71
|
+
args="$args -Od"
|
72
|
+
shift 1
|
73
|
+
;;
|
74
|
+
-O*)
|
75
|
+
# If we're optimizing, make sure we explicitly turn on some optimizations
|
76
|
+
# that are implicitly disabled by debug symbols (-Zi).
|
77
|
+
args="$args $1 -OPT:REF -OPT:ICF -INCREMENTAL:NO"
|
78
|
+
shift 1
|
79
|
+
;;
|
80
|
+
-g)
|
81
|
+
# Enable debug symbol generation.
|
82
|
+
args="$args -Zi -DEBUG"
|
83
|
+
shift 1
|
84
|
+
;;
|
85
|
+
-DFFI_DEBUG)
|
86
|
+
# Link against debug CRT and enable runtime error checks.
|
87
|
+
args="$args -RTC1"
|
88
|
+
defines="$defines $1"
|
89
|
+
md=-MDd
|
90
|
+
shift 1
|
91
|
+
;;
|
92
|
+
-c)
|
93
|
+
args="$args -c"
|
94
|
+
args="$(echo $args | sed 's%/Fe%/Fo%g')"
|
95
|
+
single="-c"
|
96
|
+
shift 1
|
97
|
+
;;
|
98
|
+
-D*=*)
|
99
|
+
name="$(echo $1|sed 's/-D\([^=][^=]*\)=.*/\1/g')"
|
100
|
+
value="$(echo $1|sed 's/-D[^=][^=]*=//g')"
|
101
|
+
args="$args -D${name}='$value'"
|
102
|
+
defines="$defines -D${name}='$value'"
|
103
|
+
shift 1
|
104
|
+
;;
|
105
|
+
-D*)
|
106
|
+
args="$args $1"
|
107
|
+
defines="$defines $1"
|
108
|
+
shift 1
|
109
|
+
;;
|
110
|
+
-I)
|
111
|
+
args="$args -I$2"
|
112
|
+
includes="$includes -I$2"
|
113
|
+
shift 2
|
114
|
+
;;
|
115
|
+
-I*)
|
116
|
+
args="$args $1"
|
117
|
+
includes="$includes $1"
|
118
|
+
shift 1
|
119
|
+
;;
|
120
|
+
-W|-Wextra)
|
121
|
+
# TODO map extra warnings
|
122
|
+
shift 1
|
123
|
+
;;
|
124
|
+
-Wall)
|
125
|
+
# -Wall on MSVC is overzealous, and we already build with -W3. Nothing
|
126
|
+
# to do here.
|
127
|
+
shift 1
|
128
|
+
;;
|
129
|
+
-Werror)
|
130
|
+
args="$args -WX"
|
131
|
+
shift 1
|
132
|
+
;;
|
133
|
+
-W*)
|
134
|
+
# TODO map specific warnings
|
135
|
+
shift 1
|
136
|
+
;;
|
137
|
+
-S)
|
138
|
+
args="$args -FAs"
|
139
|
+
shift 1
|
140
|
+
;;
|
141
|
+
-o)
|
142
|
+
outdir="$(dirname $2)"
|
143
|
+
base="$(basename $2|sed 's/\.[^.]*//g')"
|
144
|
+
if [ -n "$single" ]; then
|
145
|
+
output="-Fo$2"
|
146
|
+
else
|
147
|
+
output="-Fe$2"
|
148
|
+
fi
|
149
|
+
if [ -n "$assembly" ]; then
|
150
|
+
args="$args $output"
|
151
|
+
else
|
152
|
+
args="$args $output -Fd$outdir/$base -Fp$outdir/$base -Fa$outdir/$base"
|
153
|
+
fi
|
154
|
+
shift 2
|
155
|
+
;;
|
156
|
+
*.S)
|
157
|
+
src=$1
|
158
|
+
assembly="true"
|
159
|
+
shift 1
|
160
|
+
;;
|
161
|
+
*.c)
|
162
|
+
args="$args $1"
|
163
|
+
shift 1
|
164
|
+
;;
|
165
|
+
*)
|
166
|
+
# Assume it's an MSVC argument, and pass it through.
|
167
|
+
args="$args $1"
|
168
|
+
shift 1
|
169
|
+
;;
|
170
|
+
esac
|
171
|
+
done
|
172
|
+
|
173
|
+
if [ -n "$assembly" ]; then
|
174
|
+
if [ -z "$outdir" ]; then
|
175
|
+
outdir="."
|
176
|
+
fi
|
177
|
+
ppsrc="$outdir/$(basename $src|sed 's/.S$/.asm/g')"
|
178
|
+
echo "$cl -nologo -EP $includes $defines $src > $ppsrc"
|
179
|
+
"$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $?
|
180
|
+
output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')"
|
181
|
+
args="-nologo $safeseh $single $output $ppsrc"
|
182
|
+
|
183
|
+
echo "$ml $args"
|
184
|
+
eval "\"$ml\" $args"
|
185
|
+
result=$?
|
186
|
+
|
187
|
+
# required to fix ml64 broken output?
|
188
|
+
#mv *.obj $outdir
|
189
|
+
else
|
190
|
+
args="$md $args"
|
191
|
+
echo "$cl $args"
|
192
|
+
eval "\"$cl\" $args"
|
193
|
+
result=$?
|
194
|
+
fi
|
195
|
+
|
196
|
+
exit $result
|
197
|
+
|
@@ -0,0 +1,284 @@
|
|
1
|
+
/* -----------------------------------------------------------------------
|
2
|
+
ffi.c - Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc.
|
3
|
+
|
4
|
+
Alpha Foreign Function Interface
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
``Software''), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included
|
15
|
+
in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
21
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
22
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
24
|
+
DEALINGS IN THE SOFTWARE.
|
25
|
+
----------------------------------------------------------------------- */
|
26
|
+
|
27
|
+
#include <ffi.h>
|
28
|
+
#include <ffi_common.h>
|
29
|
+
#include <stdlib.h>
|
30
|
+
|
31
|
+
/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE;
|
32
|
+
all further uses in this file will refer to the 128-bit type. */
|
33
|
+
#if defined(__LONG_DOUBLE_128__)
|
34
|
+
# if FFI_TYPE_LONGDOUBLE != 4
|
35
|
+
# error FFI_TYPE_LONGDOUBLE out of date
|
36
|
+
# endif
|
37
|
+
#else
|
38
|
+
# undef FFI_TYPE_LONGDOUBLE
|
39
|
+
# define FFI_TYPE_LONGDOUBLE 4
|
40
|
+
#endif
|
41
|
+
|
42
|
+
extern void ffi_call_osf(void *, unsigned long, unsigned, void *, void (*)(void))
|
43
|
+
FFI_HIDDEN;
|
44
|
+
extern void ffi_closure_osf(void) FFI_HIDDEN;
|
45
|
+
|
46
|
+
|
47
|
+
ffi_status
|
48
|
+
ffi_prep_cif_machdep(ffi_cif *cif)
|
49
|
+
{
|
50
|
+
/* Adjust cif->bytes to represent a minimum 6 words for the temporary
|
51
|
+
register argument loading area. */
|
52
|
+
if (cif->bytes < 6*FFI_SIZEOF_ARG)
|
53
|
+
cif->bytes = 6*FFI_SIZEOF_ARG;
|
54
|
+
|
55
|
+
/* Set the return type flag */
|
56
|
+
switch (cif->rtype->type)
|
57
|
+
{
|
58
|
+
case FFI_TYPE_STRUCT:
|
59
|
+
case FFI_TYPE_FLOAT:
|
60
|
+
case FFI_TYPE_DOUBLE:
|
61
|
+
cif->flags = cif->rtype->type;
|
62
|
+
break;
|
63
|
+
|
64
|
+
case FFI_TYPE_LONGDOUBLE:
|
65
|
+
/* 128-bit long double is returned in memory, like a struct. */
|
66
|
+
cif->flags = FFI_TYPE_STRUCT;
|
67
|
+
break;
|
68
|
+
|
69
|
+
default:
|
70
|
+
cif->flags = FFI_TYPE_INT;
|
71
|
+
break;
|
72
|
+
}
|
73
|
+
|
74
|
+
return FFI_OK;
|
75
|
+
}
|
76
|
+
|
77
|
+
|
78
|
+
void
|
79
|
+
ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
|
80
|
+
{
|
81
|
+
unsigned long *stack, *argp;
|
82
|
+
long i, avn;
|
83
|
+
ffi_type **arg_types;
|
84
|
+
|
85
|
+
/* If the return value is a struct and we don't have a return
|
86
|
+
value address then we need to make one. */
|
87
|
+
if (rvalue == NULL && cif->flags == FFI_TYPE_STRUCT)
|
88
|
+
rvalue = alloca(cif->rtype->size);
|
89
|
+
|
90
|
+
/* Allocate the space for the arguments, plus 4 words of temp
|
91
|
+
space for ffi_call_osf. */
|
92
|
+
argp = stack = alloca(cif->bytes + 4*FFI_SIZEOF_ARG);
|
93
|
+
|
94
|
+
if (cif->flags == FFI_TYPE_STRUCT)
|
95
|
+
*(void **) argp++ = rvalue;
|
96
|
+
|
97
|
+
i = 0;
|
98
|
+
avn = cif->nargs;
|
99
|
+
arg_types = cif->arg_types;
|
100
|
+
|
101
|
+
while (i < avn)
|
102
|
+
{
|
103
|
+
size_t size = (*arg_types)->size;
|
104
|
+
|
105
|
+
switch ((*arg_types)->type)
|
106
|
+
{
|
107
|
+
case FFI_TYPE_SINT8:
|
108
|
+
*(SINT64 *) argp = *(SINT8 *)(* avalue);
|
109
|
+
break;
|
110
|
+
|
111
|
+
case FFI_TYPE_UINT8:
|
112
|
+
*(SINT64 *) argp = *(UINT8 *)(* avalue);
|
113
|
+
break;
|
114
|
+
|
115
|
+
case FFI_TYPE_SINT16:
|
116
|
+
*(SINT64 *) argp = *(SINT16 *)(* avalue);
|
117
|
+
break;
|
118
|
+
|
119
|
+
case FFI_TYPE_UINT16:
|
120
|
+
*(SINT64 *) argp = *(UINT16 *)(* avalue);
|
121
|
+
break;
|
122
|
+
|
123
|
+
case FFI_TYPE_SINT32:
|
124
|
+
case FFI_TYPE_UINT32:
|
125
|
+
/* Note that unsigned 32-bit quantities are sign extended. */
|
126
|
+
*(SINT64 *) argp = *(SINT32 *)(* avalue);
|
127
|
+
break;
|
128
|
+
|
129
|
+
case FFI_TYPE_SINT64:
|
130
|
+
case FFI_TYPE_UINT64:
|
131
|
+
case FFI_TYPE_POINTER:
|
132
|
+
*(UINT64 *) argp = *(UINT64 *)(* avalue);
|
133
|
+
break;
|
134
|
+
|
135
|
+
case FFI_TYPE_FLOAT:
|
136
|
+
if (argp - stack < 6)
|
137
|
+
{
|
138
|
+
/* Note the conversion -- all the fp regs are loaded as
|
139
|
+
doubles. The in-register format is the same. */
|
140
|
+
*(double *) argp = *(float *)(* avalue);
|
141
|
+
}
|
142
|
+
else
|
143
|
+
*(float *) argp = *(float *)(* avalue);
|
144
|
+
break;
|
145
|
+
|
146
|
+
case FFI_TYPE_DOUBLE:
|
147
|
+
*(double *) argp = *(double *)(* avalue);
|
148
|
+
break;
|
149
|
+
|
150
|
+
case FFI_TYPE_LONGDOUBLE:
|
151
|
+
/* 128-bit long double is passed by reference. */
|
152
|
+
*(long double **) argp = (long double *)(* avalue);
|
153
|
+
size = sizeof (long double *);
|
154
|
+
break;
|
155
|
+
|
156
|
+
case FFI_TYPE_STRUCT:
|
157
|
+
memcpy(argp, *avalue, (*arg_types)->size);
|
158
|
+
break;
|
159
|
+
|
160
|
+
default:
|
161
|
+
FFI_ASSERT(0);
|
162
|
+
}
|
163
|
+
|
164
|
+
argp += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
|
165
|
+
i++, arg_types++, avalue++;
|
166
|
+
}
|
167
|
+
|
168
|
+
ffi_call_osf(stack, cif->bytes, cif->flags, rvalue, fn);
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
ffi_status
|
173
|
+
ffi_prep_closure_loc (ffi_closure* closure,
|
174
|
+
ffi_cif* cif,
|
175
|
+
void (*fun)(ffi_cif*, void*, void**, void*),
|
176
|
+
void *user_data,
|
177
|
+
void *codeloc)
|
178
|
+
{
|
179
|
+
unsigned int *tramp;
|
180
|
+
|
181
|
+
tramp = (unsigned int *) &closure->tramp[0];
|
182
|
+
tramp[0] = 0x47fb0401; /* mov $27,$1 */
|
183
|
+
tramp[1] = 0xa77b0010; /* ldq $27,16($27) */
|
184
|
+
tramp[2] = 0x6bfb0000; /* jmp $31,($27),0 */
|
185
|
+
tramp[3] = 0x47ff041f; /* nop */
|
186
|
+
*(void **) &tramp[4] = ffi_closure_osf;
|
187
|
+
|
188
|
+
closure->cif = cif;
|
189
|
+
closure->fun = fun;
|
190
|
+
closure->user_data = user_data;
|
191
|
+
|
192
|
+
/* Flush the Icache.
|
193
|
+
|
194
|
+
Tru64 UNIX as doesn't understand the imb mnemonic, so use call_pal
|
195
|
+
instead, since both Compaq as and gas can handle it.
|
196
|
+
|
197
|
+
0x86 is PAL_imb in Tru64 UNIX <alpha/pal.h>. */
|
198
|
+
asm volatile ("call_pal 0x86" : : : "memory");
|
199
|
+
|
200
|
+
return FFI_OK;
|
201
|
+
}
|
202
|
+
|
203
|
+
|
204
|
+
long FFI_HIDDEN
|
205
|
+
ffi_closure_osf_inner(ffi_closure *closure, void *rvalue, unsigned long *argp)
|
206
|
+
{
|
207
|
+
ffi_cif *cif;
|
208
|
+
void **avalue;
|
209
|
+
ffi_type **arg_types;
|
210
|
+
long i, avn, argn;
|
211
|
+
|
212
|
+
cif = closure->cif;
|
213
|
+
avalue = alloca(cif->nargs * sizeof(void *));
|
214
|
+
|
215
|
+
argn = 0;
|
216
|
+
|
217
|
+
/* Copy the caller's structure return address to that the closure
|
218
|
+
returns the data directly to the caller. */
|
219
|
+
if (cif->flags == FFI_TYPE_STRUCT)
|
220
|
+
{
|
221
|
+
rvalue = (void *) argp[0];
|
222
|
+
argn = 1;
|
223
|
+
}
|
224
|
+
|
225
|
+
i = 0;
|
226
|
+
avn = cif->nargs;
|
227
|
+
arg_types = cif->arg_types;
|
228
|
+
|
229
|
+
/* Grab the addresses of the arguments from the stack frame. */
|
230
|
+
while (i < avn)
|
231
|
+
{
|
232
|
+
size_t size = arg_types[i]->size;
|
233
|
+
|
234
|
+
switch (arg_types[i]->type)
|
235
|
+
{
|
236
|
+
case FFI_TYPE_SINT8:
|
237
|
+
case FFI_TYPE_UINT8:
|
238
|
+
case FFI_TYPE_SINT16:
|
239
|
+
case FFI_TYPE_UINT16:
|
240
|
+
case FFI_TYPE_SINT32:
|
241
|
+
case FFI_TYPE_UINT32:
|
242
|
+
case FFI_TYPE_SINT64:
|
243
|
+
case FFI_TYPE_UINT64:
|
244
|
+
case FFI_TYPE_POINTER:
|
245
|
+
case FFI_TYPE_STRUCT:
|
246
|
+
avalue[i] = &argp[argn];
|
247
|
+
break;
|
248
|
+
|
249
|
+
case FFI_TYPE_FLOAT:
|
250
|
+
if (argn < 6)
|
251
|
+
{
|
252
|
+
/* Floats coming from registers need conversion from double
|
253
|
+
back to float format. */
|
254
|
+
*(float *)&argp[argn - 6] = *(double *)&argp[argn - 6];
|
255
|
+
avalue[i] = &argp[argn - 6];
|
256
|
+
}
|
257
|
+
else
|
258
|
+
avalue[i] = &argp[argn];
|
259
|
+
break;
|
260
|
+
|
261
|
+
case FFI_TYPE_DOUBLE:
|
262
|
+
avalue[i] = &argp[argn - (argn < 6 ? 6 : 0)];
|
263
|
+
break;
|
264
|
+
|
265
|
+
case FFI_TYPE_LONGDOUBLE:
|
266
|
+
/* 128-bit long double is passed by reference. */
|
267
|
+
avalue[i] = (long double *) argp[argn];
|
268
|
+
size = sizeof (long double *);
|
269
|
+
break;
|
270
|
+
|
271
|
+
default:
|
272
|
+
abort ();
|
273
|
+
}
|
274
|
+
|
275
|
+
argn += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
|
276
|
+
i++;
|
277
|
+
}
|
278
|
+
|
279
|
+
/* Invoke the closure. */
|
280
|
+
closure->fun (cif, rvalue, avalue, closure->user_data);
|
281
|
+
|
282
|
+
/* Tell ffi_closure_osf how to perform return type promotions. */
|
283
|
+
return cif->rtype->type;
|
284
|
+
}
|