ffi 0.2.0 → 0.3.0
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/README.rdoc +19 -0
- data/Rakefile +65 -55
- data/ext/{AbstractMemory.c → ffi_c/AbstractMemory.c} +67 -40
- data/ext/{AbstractMemory.h → ffi_c/AbstractMemory.h} +10 -8
- data/ext/{AutoPointer.c → ffi_c/AutoPointer.c} +17 -8
- data/ext/{AutoPointer.h → ffi_c/AutoPointer.h} +0 -0
- data/ext/ffi_c/Buffer.c +136 -0
- data/ext/{Callback.c → ffi_c/Callback.c} +60 -35
- data/ext/{Callback.h → ffi_c/Callback.h} +1 -7
- data/ext/{Invoker.c → ffi_c/Invoker.c} +472 -102
- data/ext/ffi_c/MemoryPointer.c +146 -0
- data/ext/{MemoryPointer.h → ffi_c/MemoryPointer.h} +2 -7
- data/ext/ffi_c/NativeLibrary.c +149 -0
- data/ext/{NativeLibrary.h → ffi_c/NativeLibrary.h} +0 -0
- data/ext/ffi_c/NullPointer.c +104 -0
- data/ext/{Platform.c → ffi_c/Platform.c} +0 -0
- data/ext/{Platform.h → ffi_c/Platform.h} +0 -7
- data/ext/{Pointer.c → ffi_c/Pointer.c} +35 -15
- data/ext/{Pointer.h → ffi_c/Pointer.h} +4 -2
- data/ext/ffi_c/Struct.c +542 -0
- data/ext/ffi_c/Struct.h +26 -0
- data/ext/ffi_c/Types.c +76 -0
- data/ext/{Types.h → ffi_c/Types.h} +23 -28
- data/ext/{compat.h → ffi_c/compat.h} +2 -2
- data/ext/{extconf.rb → ffi_c/extconf.rb} +12 -7
- data/ext/ffi_c/ffi.c +99 -0
- data/ext/ffi_c/ffi.mk +23 -0
- data/ext/{libffi.darwin.mk → ffi_c/libffi.darwin.mk} +0 -0
- data/ext/ffi_c/libffi.mk +11 -0
- data/ext/{libffi → ffi_c/libffi}/ChangeLog +0 -0
- data/ext/{libffi → ffi_c/libffi}/ChangeLog.libffi +0 -0
- data/ext/{libffi → ffi_c/libffi}/ChangeLog.libgcj +0 -0
- data/ext/{libffi → ffi_c/libffi}/ChangeLog.v1 +0 -0
- data/ext/{libffi → ffi_c/libffi}/LICENSE +0 -0
- data/ext/{libffi → ffi_c/libffi}/Makefile.am +0 -0
- data/ext/{libffi → ffi_c/libffi}/Makefile.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/README +0 -0
- data/ext/{libffi → ffi_c/libffi}/TODO +0 -0
- data/ext/{libffi → ffi_c/libffi}/acinclude.m4 +0 -0
- data/ext/{libffi → ffi_c/libffi}/aclocal.m4 +0 -0
- data/ext/{libffi → ffi_c/libffi}/compile +0 -0
- data/ext/{libffi → ffi_c/libffi}/config.guess +0 -0
- data/ext/{libffi → ffi_c/libffi}/config.sub +0 -0
- data/ext/{libffi → ffi_c/libffi}/configure +0 -0
- data/ext/{libffi → ffi_c/libffi}/configure.ac +0 -0
- data/ext/{libffi → ffi_c/libffi}/configure.host +0 -0
- data/ext/{libffi → ffi_c/libffi}/depcomp +0 -0
- data/ext/{libffi → ffi_c/libffi}/doc/libffi.info +0 -0
- data/ext/{libffi → ffi_c/libffi}/doc/libffi.texi +0 -0
- data/ext/{libffi → ffi_c/libffi}/doc/stamp-vti +0 -0
- data/ext/{libffi → ffi_c/libffi}/doc/version.texi +0 -0
- data/ext/{libffi → ffi_c/libffi}/fficonfig.h.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/include/Makefile.am +0 -0
- data/ext/{libffi → ffi_c/libffi}/include/Makefile.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/include/ffi.h.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/include/ffi_common.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/install-sh +0 -0
- data/ext/{libffi → ffi_c/libffi}/libffi.pc.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/libtool-version +0 -0
- data/ext/{libffi → ffi_c/libffi}/ltcf-c.sh +0 -0
- data/ext/{libffi → ffi_c/libffi}/ltcf-cxx.sh +0 -0
- data/ext/{libffi → ffi_c/libffi}/ltcf-gcj.sh +0 -0
- data/ext/{libffi → ffi_c/libffi}/ltconfig +0 -0
- data/ext/{libffi → ffi_c/libffi}/ltmain.sh +0 -0
- data/ext/{libffi → ffi_c/libffi}/man/Makefile.am +0 -0
- data/ext/{libffi → ffi_c/libffi}/man/Makefile.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/man/ffi.3 +0 -0
- data/ext/{libffi → ffi_c/libffi}/man/ffi_call.3 +0 -0
- data/ext/{libffi → ffi_c/libffi}/man/ffi_prep_cif.3 +0 -0
- data/ext/{libffi → ffi_c/libffi}/mdate-sh +0 -0
- data/ext/{libffi → ffi_c/libffi}/missing +0 -0
- data/ext/{libffi → ffi_c/libffi}/mkinstalldirs +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/alpha/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/alpha/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/alpha/osf.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/arm/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/arm/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/arm/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/closures.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/cris/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/cris/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/cris/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/debug.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/dlmalloc.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/frv/eabi.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/frv/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/frv/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/ia64/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/ia64/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/ia64/ia64_flags.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/ia64/unix.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/java_raw_api.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/m32r/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/m32r/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/m32r/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/m68k/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/m68k/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/m68k/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/mips/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/mips/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/mips/n32.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/mips/o32.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/pa/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/pa/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/pa/hpux32.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/pa/linux.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/aix.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/aix_closure.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/asm.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/darwin.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/darwin_closure.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/ffi_darwin.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/linux64.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/linux64_closure.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/ppc_closure.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/prep_cif.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/raw_api.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/s390/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/s390/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/s390/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sh/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sh/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sh/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sh64/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sh64/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sh64/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sparc/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sparc/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sparc/v8.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sparc/v9.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/types.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/darwin.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/darwin64.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/ffi64.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/freebsd.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/unix64.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/win32.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/Makefile.am +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/Makefile.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/config/default.exp +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/lib/libffi-dg.exp +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/lib/target-libpath.exp +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/lib/wrapper.exp +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/call.exp +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn0.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn3.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn4.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn5.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn6.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_stdcall.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_12byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_16byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_18byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_19byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_1_1byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_20byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_20byte1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_24byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_2byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_3_1byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_3byte1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_3byte2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_4_1byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_4byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_5_1_byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_5byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_64byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_6_1_byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_6byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_7_1_byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_7byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_8byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_9byte1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_9byte2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_double.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_float.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_longdouble.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_pointer.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_sint16.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_sint32.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_sint64.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_uint16.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_uint32.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_uint64.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_double.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_float.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_multi_schar.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_multi_sshort.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_multi_sshortchar.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_multi_uchar.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_multi_ushort.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_multi_ushortchar.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_schar.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_sint.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_sshort.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_uchar.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_uint.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_ulonglong.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_ushort.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/ffitest.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/float.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/float1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/float2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/float3.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/float4.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/many.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/many_win32.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/negint.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct10.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct3.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct4.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct5.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct6.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct7.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct8.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct9.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/problem1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/promotion.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/pyobjc-tc.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_dbl.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_dbl1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_dbl2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_fl.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_fl1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_fl2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_fl3.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_ldl.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_ll.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_ll1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_sc.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_sl.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_uc.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_ul.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/strlen.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/strlen_win32.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct3.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct4.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct5.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct6.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct7.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct8.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct9.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.special/ffitestcxx.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.special/special.exp +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.special/unwindtest.cc +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.special/unwindtest_ffi_call.cc +0 -0
- data/ext/{libffi → ffi_c/libffi}/texinfo.tex +0 -0
- data/ext/{rbffi.h → ffi_c/rbffi.h} +1 -8
- data/lib/ffi/autopointer.rb +7 -7
- data/lib/ffi/buffer.rb +0 -25
- data/lib/ffi/ffi.rb +1 -0
- data/lib/ffi/library.rb +103 -37
- data/lib/ffi/memorypointer.rb +25 -28
- data/lib/ffi/platform.rb +2 -2
- data/lib/ffi/pointer.rb +21 -7
- data/lib/ffi/struct.rb +161 -179
- data/lib/ffi/types.rb +3 -3
- data/lib/ffi/union.rb +17 -0
- data/nbproject/configurations.xml +98 -88
- data/samples/hello.rb +1 -2
- data/samples/sample_helper.rb +6 -0
- data/{specs → spec/ffi}/buffer_spec.rb +0 -0
- data/{specs → spec/ffi}/callback_spec.rb +114 -89
- data/{specs → spec/ffi}/errno_spec.rb +0 -0
- data/spec/ffi/library_spec.rb +144 -0
- data/{specs → spec/ffi}/managed_struct_spec.rb +12 -1
- data/{specs → spec/ffi}/number_spec.rb +34 -16
- data/{specs → spec/ffi}/pointer_spec.rb +46 -2
- data/{specs → spec/ffi}/rbx/attach_function_spec.rb +2 -1
- data/{specs → spec/ffi}/rbx/memory_pointer_spec.rb +19 -19
- data/{specs → spec/ffi}/rbx/spec_helper.rb +0 -0
- data/{specs → spec/ffi}/rbx/struct_spec.rb +0 -0
- data/spec/ffi/spec_helper.rb +13 -0
- data/{specs → spec/ffi}/string_spec.rb +8 -0
- data/spec/ffi/struct_spec.rb +453 -0
- data/{specs → spec/ffi}/typedef_spec.rb +3 -3
- data/spec/ffi/union_spec.rb +60 -0
- data/{specs → spec/ffi}/variadic_spec.rb +0 -0
- data/spec/spec.opts +4 -0
- metadata +356 -334
- data/README +0 -0
- data/ext/Buffer.c +0 -98
- data/ext/MemoryPointer.c +0 -99
- data/ext/NativeLibrary.c +0 -90
- data/ext/Types.c +0 -76
- data/ext/ffi.c +0 -64
- data/ext/ffi.mk +0 -24
- data/ext/libffi.mk +0 -10
- data/gen/Rakefile +0 -12
- data/specs/library_spec.rb +0 -55
- data/specs/spec_helper.rb +0 -9
- data/specs/struct_spec.rb +0 -223
data/ext/libffi.mk
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# -*- makefile -*-
|
2
|
-
|
3
|
-
$(LIBFFI):
|
4
|
-
@mkdir -p $(LIBFFI_BUILD_DIR)
|
5
|
-
@if [ ! -f $(LIBFFI_BUILD_DIR)/Makefile ]; then \
|
6
|
-
echo "Configuring libffi"; \
|
7
|
-
cd $(LIBFFI_BUILD_DIR) && env CC="$(CC)" LD="$(LD)" CFLAGS="$(FFI_CFLAGS)" \
|
8
|
-
$(FFI_CONFIGURE) > /dev/null; \
|
9
|
-
fi
|
10
|
-
cd $(BUILD_DIR)/libffi && $(MAKE)
|
data/gen/Rakefile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require "#{File.join(ENV['RUBYLIBDIR'], 'ffi', 'tools', 'types_generator.rb')}"
|
3
|
-
types_conf = File.join(ENV['RUBYLIBDIR'], 'ffi', 'types.conf')
|
4
|
-
task types_conf do |task|
|
5
|
-
options = {}
|
6
|
-
FileUtils.mkdir_p(File.dirname(task.name), { :mode => 0755 })
|
7
|
-
File.open(task.name, File::CREAT|File::TRUNC|File::RDWR, 0644) do |f|
|
8
|
-
f.puts FFI::TypesGenerator.generate(options)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
task :default => types_conf do
|
12
|
-
end
|
data/specs/library_spec.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
|
-
describe "Library" do
|
3
|
-
it "attach_function with no library specified" do
|
4
|
-
lambda {
|
5
|
-
Module.new do |m|
|
6
|
-
m.extend FFI::Library
|
7
|
-
attach_function :getpid, [ ], :uint
|
8
|
-
end
|
9
|
-
}.should_not raise_error
|
10
|
-
end
|
11
|
-
it "attach_function :getpid from this process" do
|
12
|
-
lambda {
|
13
|
-
Module.new do |m|
|
14
|
-
m.extend FFI::Library
|
15
|
-
attach_function :getpid, [ ], :uint
|
16
|
-
end.getpid.should == Process.pid
|
17
|
-
}.should_not raise_error
|
18
|
-
end
|
19
|
-
it "attach_function :getpid from [ 'c', 'libc.so.6'] " do
|
20
|
-
lambda {
|
21
|
-
Module.new do |m|
|
22
|
-
m.extend FFI::Library
|
23
|
-
ffi_lib 'c', 'libc.so.6'
|
24
|
-
attach_function :getpid, [ ], :uint
|
25
|
-
end.getpid.should == Process.pid
|
26
|
-
}.should_not raise_error
|
27
|
-
end
|
28
|
-
it "attach_function :getpid from [ 'libc.so.6', 'c' ] " do
|
29
|
-
lambda {
|
30
|
-
Module.new do |m|
|
31
|
-
m.extend FFI::Library
|
32
|
-
ffi_lib 'libc.so.6', 'c'
|
33
|
-
attach_function :getpid, [ ], :uint
|
34
|
-
end.getpid.should == Process.pid
|
35
|
-
}.should_not raise_error
|
36
|
-
end
|
37
|
-
it "attach_function :getpid from [ 'libfubar.so.0xdeadbeef', nil, 'c' ] " do
|
38
|
-
lambda {
|
39
|
-
Module.new do |m|
|
40
|
-
m.extend FFI::Library
|
41
|
-
ffi_lib 'libfubar.so.0xdeadbeef', nil, 'c'
|
42
|
-
attach_function :getpid, [ ], :uint
|
43
|
-
end.getpid.should == Process.pid
|
44
|
-
}.should_not raise_error
|
45
|
-
end
|
46
|
-
it "attach_function :getpid from [ 'libfubar.so.0xdeadbeef' ] " do
|
47
|
-
lambda {
|
48
|
-
Module.new do |m|
|
49
|
-
m.extend FFI::Library
|
50
|
-
ffi_lib 'libfubar.so.0xdeadbeef'
|
51
|
-
attach_function :getpid, [ ], :uint
|
52
|
-
end.getpid.should == Process.pid
|
53
|
-
}.should raise_error(LoadError)
|
54
|
-
end
|
55
|
-
end
|
data/specs/spec_helper.rb
DELETED
data/specs/struct_spec.rb
DELETED
@@ -1,223 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
|
-
describe "Struct tests" do
|
3
|
-
include FFI
|
4
|
-
StructTypes = {
|
5
|
-
's8' => :char,
|
6
|
-
's16' => :short,
|
7
|
-
's32' => :int,
|
8
|
-
's64' => :long_long,
|
9
|
-
'long' => :long,
|
10
|
-
'f32' => :float,
|
11
|
-
'f64' => :double
|
12
|
-
}
|
13
|
-
module LibTest
|
14
|
-
extend FFI::Library
|
15
|
-
ffi_lib TestLibrary::PATH
|
16
|
-
attach_function :ptr_ret_pointer, [ :pointer, :int], :string
|
17
|
-
attach_function :ptr_from_address, [ :ulong ], :pointer
|
18
|
-
attach_function :string_equals, [ :string, :string ], :int
|
19
|
-
[ 's8', 's16', 's32', 's64', 'f32', 'f64', 'long' ].each do |t|
|
20
|
-
attach_function "struct_align_#{t}", [ :pointer ], StructTypes[t]
|
21
|
-
end
|
22
|
-
end
|
23
|
-
class PointerMember < FFI::Struct
|
24
|
-
layout :pointer, :pointer
|
25
|
-
end
|
26
|
-
class StringMember < FFI::Struct
|
27
|
-
layout :string, :string
|
28
|
-
end
|
29
|
-
it "Struct#[:pointer]" do
|
30
|
-
magic = 0x12345678
|
31
|
-
mp = MemoryPointer.new :long
|
32
|
-
mp.put_long(0, magic)
|
33
|
-
smp = MemoryPointer.new :pointer
|
34
|
-
smp.put_pointer(0, mp)
|
35
|
-
s = PointerMember.new smp
|
36
|
-
s[:pointer].should == mp
|
37
|
-
end
|
38
|
-
it "Struct#[:pointer].nil? for NULL value" do
|
39
|
-
magic = 0x12345678
|
40
|
-
mp = MemoryPointer.new :long
|
41
|
-
mp.put_long(0, magic)
|
42
|
-
smp = MemoryPointer.new :pointer
|
43
|
-
smp.put_pointer(0, nil)
|
44
|
-
s = PointerMember.new smp
|
45
|
-
s[:pointer].null?.should == true
|
46
|
-
end
|
47
|
-
it "Struct#[:pointer]=" do
|
48
|
-
magic = 0x12345678
|
49
|
-
mp = MemoryPointer.new :long
|
50
|
-
mp.put_long(0, magic)
|
51
|
-
smp = MemoryPointer.new :pointer
|
52
|
-
s = PointerMember.new smp
|
53
|
-
s[:pointer] = mp
|
54
|
-
smp.get_pointer(0).should == mp
|
55
|
-
end
|
56
|
-
it "Struct#[:pointer]=nil" do
|
57
|
-
smp = MemoryPointer.new :pointer
|
58
|
-
s = PointerMember.new smp
|
59
|
-
s[:pointer] = nil
|
60
|
-
smp.get_pointer(0).null?.should == true
|
61
|
-
end
|
62
|
-
it "Struct#[:string]" do
|
63
|
-
magic = "test"
|
64
|
-
mp = MemoryPointer.new 1024
|
65
|
-
mp.put_string(0, magic)
|
66
|
-
smp = MemoryPointer.new :pointer
|
67
|
-
smp.put_pointer(0, mp)
|
68
|
-
s = StringMember.new smp
|
69
|
-
s[:string].should == magic
|
70
|
-
end
|
71
|
-
it "Struct#[:string].nil? for NULL value" do
|
72
|
-
smp = MemoryPointer.new :pointer
|
73
|
-
smp.put_pointer(0, nil)
|
74
|
-
s = StringMember.new smp
|
75
|
-
s[:string].nil?.should == true
|
76
|
-
end
|
77
|
-
it "Struct#layout works with :name, :type pairs" do
|
78
|
-
class PairLayout < FFI::Struct
|
79
|
-
layout :a, :int, :b, :long_long
|
80
|
-
end
|
81
|
-
PairLayout.size.should == 12
|
82
|
-
mp = MemoryPointer.new(12)
|
83
|
-
s = PairLayout.new mp
|
84
|
-
s[:a] = 0x12345678
|
85
|
-
mp.get_int(0).should == 0x12345678
|
86
|
-
s[:b] = 0xfee1deadbeef
|
87
|
-
mp.get_int64(4).should == 0xfee1deadbeef
|
88
|
-
end
|
89
|
-
it "Struct#layout works with :name, :type, offset tuples" do
|
90
|
-
class PairLayout < FFI::Struct
|
91
|
-
layout :a, :int, 0, :b, :long_long, 4
|
92
|
-
end
|
93
|
-
PairLayout.size.should == 12
|
94
|
-
mp = MemoryPointer.new(12)
|
95
|
-
s = PairLayout.new mp
|
96
|
-
s[:a] = 0x12345678
|
97
|
-
mp.get_int(0).should == 0x12345678
|
98
|
-
s[:b] = 0xfee1deadbeef
|
99
|
-
mp.get_int64(4).should == 0xfee1deadbeef
|
100
|
-
end
|
101
|
-
it "Struct#layout works with mixed :name,:type and :name,:type,offset" do
|
102
|
-
class MixedLayout < FFI::Struct
|
103
|
-
layout :a, :int, :b, :long_long, 4
|
104
|
-
end
|
105
|
-
MixedLayout.size.should == 12
|
106
|
-
mp = MemoryPointer.new(12)
|
107
|
-
s = MixedLayout.new mp
|
108
|
-
s[:a] = 0x12345678
|
109
|
-
mp.get_int(0).should == 0x12345678
|
110
|
-
s[:b] = 0xfee1deadbeef
|
111
|
-
mp.get_int64(4).should == 0xfee1deadbeef
|
112
|
-
end
|
113
|
-
rb_maj, rb_min = RUBY_VERSION.split('.')
|
114
|
-
if rb_maj.to_i >= 1 && rb_min.to_i >= 9 || RUBY_PLATFORM =~ /java/
|
115
|
-
it "Struct#layout withs with a hash of :name => type" do
|
116
|
-
class HashLayout < FFI::Struct
|
117
|
-
layout :a => :int, :b => :long_long
|
118
|
-
end
|
119
|
-
HashLayout.size.should == 12
|
120
|
-
mp = MemoryPointer.new(12)
|
121
|
-
s = HashLayout.new mp
|
122
|
-
s[:a] = 0x12345678
|
123
|
-
mp.get_int(0).should == 0x12345678
|
124
|
-
s[:b] = 0xfee1deadbeef
|
125
|
-
mp.get_int64(4).should == 0xfee1deadbeef
|
126
|
-
end
|
127
|
-
end
|
128
|
-
it "Can use Struct subclass as parameter type" do
|
129
|
-
module StructParam
|
130
|
-
extend FFI::Library
|
131
|
-
ffi_lib TestLibrary::PATH
|
132
|
-
class TestStruct < FFI::Struct
|
133
|
-
layout :c, :char
|
134
|
-
end
|
135
|
-
attach_function :struct_field_s8, [ TestStruct ], :char
|
136
|
-
end
|
137
|
-
end
|
138
|
-
it "Can use Struct subclass as IN parameter type" do
|
139
|
-
module StructParam
|
140
|
-
extend FFI::Library
|
141
|
-
ffi_lib TestLibrary::PATH
|
142
|
-
class TestStruct < FFI::Struct
|
143
|
-
layout :c, :char
|
144
|
-
end
|
145
|
-
attach_function :struct_field_s8, [ TestStruct.in ], :char
|
146
|
-
end
|
147
|
-
end
|
148
|
-
it "Can use Struct subclass as OUT parameter type" do
|
149
|
-
module StructParam
|
150
|
-
extend FFI::Library
|
151
|
-
ffi_lib TestLibrary::PATH
|
152
|
-
class TestStruct < FFI::Struct
|
153
|
-
layout :c, :char
|
154
|
-
end
|
155
|
-
attach_function :struct_field_s8, [ TestStruct.out ], :char
|
156
|
-
end
|
157
|
-
end
|
158
|
-
it ":char member aligned correctly" do
|
159
|
-
class AlignChar < FFI::Struct
|
160
|
-
layout :c, :char, :v, :char
|
161
|
-
end
|
162
|
-
s = AlignChar.new
|
163
|
-
s[:v] = 0x12
|
164
|
-
LibTest.struct_align_s8(s.pointer).should == 0x12
|
165
|
-
end
|
166
|
-
it ":short member aligned correctly" do
|
167
|
-
class AlignShort < FFI::Struct
|
168
|
-
layout :c, :char, :v, :short
|
169
|
-
end
|
170
|
-
s = AlignShort.alloc_in
|
171
|
-
s[:v] = 0x1234
|
172
|
-
LibTest.struct_align_s16(s.pointer).should == 0x1234
|
173
|
-
end
|
174
|
-
it ":int member aligned correctly" do
|
175
|
-
class AlignInt < FFI::Struct
|
176
|
-
layout :c, :char, :v, :int
|
177
|
-
end
|
178
|
-
s = AlignInt.alloc_in
|
179
|
-
s[:v] = 0x12345678
|
180
|
-
LibTest.struct_align_s32(s.pointer).should == 0x12345678
|
181
|
-
end
|
182
|
-
it ":long_long member aligned correctly" do
|
183
|
-
class AlignLongLong < FFI::Struct
|
184
|
-
layout :c, :char, :v, :long_long
|
185
|
-
end
|
186
|
-
s = AlignLongLong.alloc_in
|
187
|
-
s[:v] = 0x123456789abcdef0
|
188
|
-
LibTest.struct_align_s64(s.pointer).should == 0x123456789abcdef0
|
189
|
-
end
|
190
|
-
it ":long member aligned correctly" do
|
191
|
-
class AlignLong < FFI::Struct
|
192
|
-
layout :c, :char, :v, :long
|
193
|
-
end
|
194
|
-
s = AlignLong.alloc_in
|
195
|
-
s[:v] = 0x12345678
|
196
|
-
LibTest.struct_align_long(s.pointer).should == 0x12345678
|
197
|
-
end
|
198
|
-
it ":float member aligned correctly" do
|
199
|
-
class AlignFloat < FFI::Struct
|
200
|
-
layout :c, :char, :v, :float
|
201
|
-
end
|
202
|
-
s = AlignFloat.alloc_in
|
203
|
-
s[:v] = 1.23456
|
204
|
-
(LibTest.struct_align_f32(s.pointer) - 1.23456).abs.should < 0.00001
|
205
|
-
end
|
206
|
-
it ":double member aligned correctly" do
|
207
|
-
class AlignDouble < FFI::Struct
|
208
|
-
layout :c, :char, :v, :double
|
209
|
-
end
|
210
|
-
s = AlignDouble.alloc_in
|
211
|
-
s[:v] = 1.23456789
|
212
|
-
(LibTest.struct_align_f64(s.pointer) - 1.23456789).abs.should < 0.00000001
|
213
|
-
end
|
214
|
-
it ":ulong, :pointer struct" do
|
215
|
-
class ULPStruct < FFI::Struct
|
216
|
-
layout :ul, :ulong, :p, :pointer
|
217
|
-
end
|
218
|
-
s = ULPStruct.alloc_in
|
219
|
-
s[:ul] = 0xdeadbeef
|
220
|
-
s[:p] = LibTest.ptr_from_address(0x12345678)
|
221
|
-
s.pointer.get_ulong(0).should == 0xdeadbeef
|
222
|
-
end
|
223
|
-
end
|