ffi 1.10.0 → 1.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{appveyor.yml → .appveyor.yml} +9 -1
- data/.github/workflows/ci.yml +64 -0
- data/.gitignore +3 -0
- data/.gitmodules +1 -0
- data/.travis.yml +35 -20
- data/CHANGELOG.md +124 -0
- data/Gemfile +6 -4
- data/README.md +29 -17
- data/Rakefile +29 -120
- data/ext/ffi_c/AbstractMemory.c +5 -9
- data/ext/ffi_c/Buffer.c +2 -2
- data/ext/ffi_c/Call.c +14 -41
- data/ext/ffi_c/Call.h +4 -7
- data/ext/ffi_c/ClosurePool.c +11 -14
- data/ext/ffi_c/DynamicLibrary.c +1 -1
- data/ext/ffi_c/Function.c +18 -117
- data/ext/ffi_c/FunctionInfo.c +1 -2
- data/ext/ffi_c/LongDouble.c +12 -10
- data/ext/ffi_c/LongDouble.h +0 -4
- data/ext/ffi_c/MemoryPointer.c +1 -1
- data/ext/ffi_c/MethodHandle.c +18 -24
- data/ext/ffi_c/MethodHandle.h +3 -2
- data/ext/ffi_c/Platform.c +1 -47
- data/ext/ffi_c/Pointer.c +1 -1
- data/ext/ffi_c/Struct.c +47 -51
- data/ext/ffi_c/Struct.h +12 -6
- data/ext/ffi_c/StructLayout.c +20 -14
- data/ext/ffi_c/Thread.c +4 -223
- data/ext/ffi_c/Thread.h +0 -14
- data/ext/ffi_c/Type.c +0 -18
- data/ext/ffi_c/Type.h +0 -1
- data/ext/ffi_c/Types.c +1 -1
- data/ext/ffi_c/Variadic.c +9 -15
- data/ext/ffi_c/compat.h +4 -0
- data/ext/ffi_c/extconf.rb +36 -26
- data/ext/ffi_c/ffi.c +3 -8
- data/ext/ffi_c/libffi.darwin.mk +1 -1
- data/ext/ffi_c/libffi/.appveyor.yml +29 -13
- data/ext/ffi_c/libffi/.gitattributes +4 -0
- data/ext/ffi_c/libffi/.travis.yml +51 -2
- data/ext/ffi_c/libffi/.travis/bfin-sim.exp +58 -0
- data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +14 -0
- data/ext/ffi_c/libffi/.travis/build-in-container.sh +12 -0
- data/ext/ffi_c/libffi/.travis/build.sh +116 -8
- data/ext/ffi_c/libffi/.travis/install.sh +65 -16
- data/ext/ffi_c/libffi/.travis/m32r-sim.exp +58 -0
- data/ext/ffi_c/libffi/.travis/or1k-sim.exp +58 -0
- data/ext/ffi_c/libffi/.travis/powerpc-eabisim.exp +58 -0
- data/ext/ffi_c/libffi/.travis/site.exp +10 -1
- data/ext/ffi_c/libffi/.travis/wine-sim.exp +55 -0
- data/ext/ffi_c/libffi/{ChangeLog.libffi-3.1 → ChangeLog.old} +1407 -0
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +5 -4
- data/ext/ffi_c/libffi/Makefile.am +35 -41
- data/ext/ffi_c/libffi/README.md +29 -8
- data/ext/ffi_c/libffi/configure.ac +31 -11
- data/ext/ffi_c/libffi/configure.host +26 -9
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +1 -3
- data/ext/ffi_c/libffi/include/ffi.h.in +19 -7
- data/ext/ffi_c/libffi/include/ffi_common.h +5 -1
- data/ext/ffi_c/libffi/libffi.map.in +8 -12
- data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +2 -48
- data/ext/ffi_c/libffi/libtool-version +1 -1
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +1 -1
- data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +2 -1
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +7 -3
- data/ext/ffi_c/libffi/make_sunver.pl +333 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +33 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +130 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +57 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +4 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +511 -0
- data/ext/ffi_c/libffi/msvcc.sh +27 -2
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +132 -58
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +13 -2
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +21 -8
- data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +40 -5
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +8 -1
- data/ext/ffi_c/libffi/src/arm/sysv.S +2 -0
- data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
- data/ext/ffi_c/libffi/src/closures.c +51 -13
- data/ext/ffi_c/libffi/src/frv/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/metag/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/mips/o32.S +2 -0
- data/ext/ffi_c/libffi/src/moxie/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/pa/ffi.c +46 -91
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +1 -6
- data/ext/ffi_c/libffi/src/pa/hpux32.S +4 -2
- data/ext/ffi_c/libffi/src/pa/linux.S +27 -4
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +6 -4
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +211 -32
- data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +18 -7
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +10 -4
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +83 -28
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +68 -4
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +5 -7
- data/ext/ffi_c/libffi/src/prep_cif.c +4 -2
- data/ext/ffi_c/libffi/src/riscv/ffi.c +42 -6
- data/ext/ffi_c/libffi/src/riscv/ffitarget.h +1 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +86 -7
- data/ext/ffi_c/libffi/src/x86/ffi.c +21 -10
- data/ext/ffi_c/libffi/src/x86/ffi64.c +15 -11
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +15 -2
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +15 -10
- data/ext/ffi_c/libffi/src/x86/sysv.S +103 -8
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +995 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +99 -2
- data/ext/ffi_c/libffi/src/x86/win64.S +9 -1
- data/ext/ffi_c/libffi/testsuite/Makefile.am +114 -109
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +26 -22
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +7 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +12 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +67 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn0.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn3.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn4.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn5.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn6.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_loc_fn0.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_simple.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3float.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_float.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_args.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_float_double.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_schar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshort.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshortchar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_uchar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushort.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushortchar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_schar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sint.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sshort.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_struct_va1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulong_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/err_bad_abi.c +0 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +138 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/huge_struct.c +1 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct11.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest.cc +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest_ffi_call.cc +0 -0
- data/ext/ffi_c/rbffi.h +0 -2
- data/ffi.gemspec +12 -5
- data/lib/ffi.rb +10 -2
- data/lib/ffi/data_converter.rb +67 -0
- data/lib/ffi/ffi.rb +2 -0
- data/lib/ffi/library.rb +10 -6
- data/lib/ffi/platform.rb +12 -3
- data/lib/ffi/platform/aarch64-freebsd/types.conf +89 -89
- data/lib/ffi/platform/aarch64-freebsd12/types.conf +89 -89
- data/lib/ffi/platform/aarch64-linux/types.conf +81 -81
- data/lib/ffi/platform/arm-freebsd/types.conf +87 -87
- data/lib/ffi/platform/arm-freebsd12/types.conf +87 -87
- data/lib/ffi/platform/arm-linux/types.conf +110 -82
- data/lib/ffi/platform/i386-cygwin/types.conf +1 -1
- data/lib/ffi/platform/i386-darwin/types.conf +63 -63
- data/lib/ffi/platform/i386-freebsd/types.conf +87 -87
- data/lib/ffi/platform/i386-freebsd12/types.conf +87 -87
- data/lib/ffi/platform/i386-gnu/types.conf +84 -84
- data/lib/ffi/platform/i386-linux/types.conf +77 -77
- data/lib/ffi/platform/i386-netbsd/types.conf +87 -87
- data/lib/ffi/platform/i386-openbsd/types.conf +89 -89
- data/lib/ffi/platform/i386-solaris/types.conf +96 -96
- data/lib/ffi/platform/i386-windows/types.conf +43 -96
- data/lib/ffi/platform/ia64-linux/types.conf +79 -79
- data/lib/ffi/platform/mips-linux/types.conf +79 -79
- data/lib/ffi/platform/mips64-linux/types.conf +81 -81
- data/lib/ffi/platform/mips64el-linux/types.conf +81 -81
- data/lib/ffi/platform/mipsel-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa32r6-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa64r6-linux/types.conf +81 -81
- data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +81 -81
- data/lib/ffi/platform/powerpc-aix/types.conf +155 -155
- data/lib/ffi/platform/powerpc-darwin/types.conf +63 -63
- data/lib/ffi/platform/powerpc-linux/types.conf +108 -78
- data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
- data/lib/ffi/platform/powerpc64-linux/types.conf +81 -81
- data/lib/ffi/platform/s390-linux/types.conf +79 -79
- data/lib/ffi/platform/s390x-linux/types.conf +79 -79
- data/lib/ffi/platform/sparc-linux/types.conf +79 -79
- data/lib/ffi/platform/sparc-solaris/types.conf +103 -103
- data/lib/ffi/platform/sparc64-linux/types.conf +79 -79
- data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
- data/lib/ffi/platform/sparcv9-solaris/types.conf +103 -103
- data/lib/ffi/platform/x86_64-cygwin/types.conf +1 -1
- data/lib/ffi/platform/x86_64-darwin/types.conf +88 -84
- data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +130 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +89 -89
- data/lib/ffi/platform/x86_64-freebsd12/types.conf +139 -109
- data/lib/ffi/platform/x86_64-linux/types.conf +107 -77
- data/lib/ffi/platform/x86_64-netbsd/types.conf +89 -89
- data/lib/ffi/platform/x86_64-openbsd/types.conf +86 -86
- data/lib/ffi/platform/x86_64-solaris/types.conf +96 -96
- data/lib/ffi/platform/x86_64-windows/types.conf +42 -110
- data/lib/ffi/pointer.rb +20 -13
- data/lib/ffi/struct.rb +13 -68
- data/lib/ffi/struct_by_reference.rb +72 -0
- data/lib/ffi/struct_layout.rb +96 -0
- data/lib/ffi/tools/const_generator.rb +5 -4
- data/lib/ffi/tools/generator.rb +47 -2
- data/lib/ffi/tools/generator_task.rb +13 -17
- data/lib/ffi/tools/struct_generator.rb +4 -4
- data/lib/ffi/tools/types_generator.rb +7 -4
- data/lib/ffi/types.rb +1 -1
- data/lib/ffi/version.rb +1 -1
- data/samples/getlogin.rb +1 -1
- data/samples/getpid.rb +1 -1
- data/samples/gettimeofday.rb +8 -8
- data/samples/hello.rb +2 -1
- data/samples/inotify.rb +1 -1
- data/samples/pty.rb +1 -2
- data/samples/qsort.rb +0 -1
- metadata +141 -116
- data/ext/ffi_c/DataConverter.c +0 -91
- data/ext/ffi_c/StructByReference.c +0 -190
- data/ext/ffi_c/StructByReference.h +0 -50
- data/ext/ffi_c/libffi/ChangeLog.libffi +0 -584
- data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
- data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
- data/samples/sample_helper.rb +0 -6
@@ -1,122 +1,122 @@
|
|
1
|
-
rbx.platform.typedef
|
2
|
-
rbx.platform.typedef.
|
1
|
+
rbx.platform.typedef.*caddr_t = char
|
2
|
+
rbx.platform.typedef.blkcnt64_t = long
|
3
|
+
rbx.platform.typedef.blkcnt_t = long
|
4
|
+
rbx.platform.typedef.blksize_t = int
|
5
|
+
rbx.platform.typedef.clock_t = long
|
6
|
+
rbx.platform.typedef.clockid_t = int
|
7
|
+
rbx.platform.typedef.cnt_t = short
|
8
|
+
rbx.platform.typedef.cpu_flag_t = ushort
|
9
|
+
rbx.platform.typedef.ctid_t = int
|
10
|
+
rbx.platform.typedef.daddr_t = long
|
11
|
+
rbx.platform.typedef.datalink_id_t = uint
|
12
|
+
rbx.platform.typedef.dev_t = ulong
|
13
|
+
rbx.platform.typedef.diskaddr_t = ulong_long
|
14
|
+
rbx.platform.typedef.disp_lock_t = uchar
|
15
|
+
rbx.platform.typedef.fd_mask = long
|
16
|
+
rbx.platform.typedef.fds_mask = long
|
17
|
+
rbx.platform.typedef.fsblkcnt64_t = ulong
|
18
|
+
rbx.platform.typedef.fsblkcnt_t = ulong
|
19
|
+
rbx.platform.typedef.fsfilcnt64_t = ulong
|
20
|
+
rbx.platform.typedef.fsfilcnt_t = ulong
|
21
|
+
rbx.platform.typedef.gid_t = uint
|
22
|
+
rbx.platform.typedef.hrtime_t = long_long
|
23
|
+
rbx.platform.typedef.id_t = int
|
24
|
+
rbx.platform.typedef.in_addr_t = uint
|
25
|
+
rbx.platform.typedef.in_port_t = ushort
|
26
|
+
rbx.platform.typedef.index_t = short
|
27
|
+
rbx.platform.typedef.ino64_t = ulong
|
28
|
+
rbx.platform.typedef.ino_t = ulong
|
3
29
|
rbx.platform.typedef.int16_t = short
|
4
30
|
rbx.platform.typedef.int32_t = int
|
5
31
|
rbx.platform.typedef.int64_t = long
|
6
|
-
rbx.platform.typedef.
|
7
|
-
rbx.platform.typedef.uint16_t = ushort
|
8
|
-
rbx.platform.typedef.uint32_t = uint
|
9
|
-
rbx.platform.typedef.uint64_t = ulong
|
10
|
-
rbx.platform.typedef.intmax_t = long
|
11
|
-
rbx.platform.typedef.uintmax_t = ulong
|
12
|
-
rbx.platform.typedef.intptr_t = long
|
13
|
-
rbx.platform.typedef.uintptr_t = ulong
|
14
|
-
rbx.platform.typedef.int_fast8_t = char
|
32
|
+
rbx.platform.typedef.int8_t = char
|
15
33
|
rbx.platform.typedef.int_fast16_t = int
|
16
34
|
rbx.platform.typedef.int_fast32_t = int
|
17
35
|
rbx.platform.typedef.int_fast64_t = long
|
18
|
-
rbx.platform.typedef.
|
19
|
-
rbx.platform.typedef.uint_fast16_t = uint
|
20
|
-
rbx.platform.typedef.uint_fast32_t = uint
|
21
|
-
rbx.platform.typedef.uint_fast64_t = ulong
|
22
|
-
rbx.platform.typedef.int_least8_t = char
|
36
|
+
rbx.platform.typedef.int_fast8_t = char
|
23
37
|
rbx.platform.typedef.int_least16_t = short
|
24
38
|
rbx.platform.typedef.int_least32_t = int
|
25
39
|
rbx.platform.typedef.int_least64_t = long
|
26
|
-
rbx.platform.typedef.
|
27
|
-
rbx.platform.typedef.
|
28
|
-
rbx.platform.typedef.
|
29
|
-
rbx.platform.typedef.
|
30
|
-
rbx.platform.typedef.longlong_t = long_long
|
31
|
-
rbx.platform.typedef.u_longlong_t = ulong_long
|
32
|
-
rbx.platform.typedef.t_scalar_t = int
|
33
|
-
rbx.platform.typedef.t_uscalar_t = uint
|
34
|
-
rbx.platform.typedef.uchar_t = uchar
|
35
|
-
rbx.platform.typedef.ushort_t = ushort
|
36
|
-
rbx.platform.typedef.uint_t = uint
|
37
|
-
rbx.platform.typedef.ulong_t = ulong
|
38
|
-
rbx.platform.typedef.*caddr_t = char
|
39
|
-
rbx.platform.typedef.daddr_t = long
|
40
|
-
rbx.platform.typedef.cnt_t = short
|
41
|
-
rbx.platform.typedef.ptrdiff_t = long
|
42
|
-
rbx.platform.typedef.pfn_t = ulong
|
43
|
-
rbx.platform.typedef.pgcnt_t = ulong
|
44
|
-
rbx.platform.typedef.spgcnt_t = long
|
45
|
-
rbx.platform.typedef.use_t = uchar
|
46
|
-
rbx.platform.typedef.sysid_t = short
|
47
|
-
rbx.platform.typedef.index_t = short
|
48
|
-
rbx.platform.typedef.off_t = long
|
49
|
-
rbx.platform.typedef.off64_t = long
|
50
|
-
rbx.platform.typedef.ino_t = ulong
|
51
|
-
rbx.platform.typedef.blkcnt_t = long
|
52
|
-
rbx.platform.typedef.fsblkcnt_t = ulong
|
53
|
-
rbx.platform.typedef.fsfilcnt_t = ulong
|
54
|
-
rbx.platform.typedef.ino64_t = ulong
|
55
|
-
rbx.platform.typedef.blkcnt64_t = long
|
56
|
-
rbx.platform.typedef.fsblkcnt64_t = ulong
|
57
|
-
rbx.platform.typedef.fsfilcnt64_t = ulong
|
58
|
-
rbx.platform.typedef.blksize_t = int
|
59
|
-
rbx.platform.typedef.pad64_t = long
|
60
|
-
rbx.platform.typedef.upad64_t = ulong
|
61
|
-
rbx.platform.typedef.offset_t = long_long
|
62
|
-
rbx.platform.typedef.u_offset_t = ulong_long
|
63
|
-
rbx.platform.typedef.len_t = ulong_long
|
64
|
-
rbx.platform.typedef.diskaddr_t = ulong_long
|
40
|
+
rbx.platform.typedef.int_least8_t = char
|
41
|
+
rbx.platform.typedef.intmax_t = long
|
42
|
+
rbx.platform.typedef.intptr_t = long
|
43
|
+
rbx.platform.typedef.ipaddr_t = uint
|
65
44
|
rbx.platform.typedef.k_fltset_t = uint
|
66
|
-
rbx.platform.typedef.
|
45
|
+
rbx.platform.typedef.key_t = int
|
46
|
+
rbx.platform.typedef.len_t = ulong_long
|
67
47
|
rbx.platform.typedef.lgrp_id_t = int
|
68
|
-
rbx.platform.typedef.
|
69
|
-
rbx.platform.typedef.
|
48
|
+
rbx.platform.typedef.lock_t = uchar
|
49
|
+
rbx.platform.typedef.longlong_t = long_long
|
70
50
|
rbx.platform.typedef.major_t = uint
|
71
51
|
rbx.platform.typedef.minor_t = uint
|
72
|
-
rbx.platform.typedef.
|
73
|
-
rbx.platform.typedef.
|
74
|
-
rbx.platform.typedef.
|
52
|
+
rbx.platform.typedef.mode_t = uint
|
53
|
+
rbx.platform.typedef.model_t = uint
|
54
|
+
rbx.platform.typedef.nfds_t = ulong
|
55
|
+
rbx.platform.typedef.nlink_t = uint
|
75
56
|
rbx.platform.typedef.o_dev_t = short
|
76
|
-
rbx.platform.typedef.o_uid_t = ushort
|
77
57
|
rbx.platform.typedef.o_gid_t = ushort
|
58
|
+
rbx.platform.typedef.o_ino_t = ushort
|
59
|
+
rbx.platform.typedef.o_mode_t = ushort
|
78
60
|
rbx.platform.typedef.o_nlink_t = short
|
79
61
|
rbx.platform.typedef.o_pid_t = short
|
80
|
-
rbx.platform.typedef.
|
81
|
-
rbx.platform.typedef.
|
82
|
-
rbx.platform.typedef.
|
83
|
-
rbx.platform.typedef.
|
84
|
-
rbx.platform.typedef.
|
85
|
-
rbx.platform.typedef.
|
86
|
-
rbx.platform.typedef.
|
87
|
-
rbx.platform.typedef.
|
62
|
+
rbx.platform.typedef.o_uid_t = ushort
|
63
|
+
rbx.platform.typedef.off64_t = long
|
64
|
+
rbx.platform.typedef.off_t = long
|
65
|
+
rbx.platform.typedef.offset_t = long_long
|
66
|
+
rbx.platform.typedef.pad64_t = long
|
67
|
+
rbx.platform.typedef.pfn_t = ulong
|
68
|
+
rbx.platform.typedef.pgcnt_t = ulong
|
69
|
+
rbx.platform.typedef.pid_t = int
|
88
70
|
rbx.platform.typedef.poolid_t = int
|
89
|
-
rbx.platform.typedef.
|
90
|
-
rbx.platform.typedef.
|
91
|
-
rbx.platform.typedef.pthread_t = uint
|
71
|
+
rbx.platform.typedef.pri_t = short
|
72
|
+
rbx.platform.typedef.projid_t = int
|
92
73
|
rbx.platform.typedef.pthread_key_t = uint
|
93
|
-
rbx.platform.typedef.
|
94
|
-
rbx.platform.typedef.
|
95
|
-
rbx.platform.typedef.
|
74
|
+
rbx.platform.typedef.pthread_t = uint
|
75
|
+
rbx.platform.typedef.ptrdiff_t = long
|
76
|
+
rbx.platform.typedef.rlim64_t = ulong_long
|
77
|
+
rbx.platform.typedef.rlim_t = ulong
|
78
|
+
rbx.platform.typedef.sa_family_t = ushort
|
96
79
|
rbx.platform.typedef.size_t = ulong
|
80
|
+
rbx.platform.typedef.socklen_t = uint
|
81
|
+
rbx.platform.typedef.spgcnt_t = long
|
97
82
|
rbx.platform.typedef.ssize_t = long
|
83
|
+
rbx.platform.typedef.suseconds_t = long
|
84
|
+
rbx.platform.typedef.sysid_t = short
|
85
|
+
rbx.platform.typedef.t_scalar_t = int
|
86
|
+
rbx.platform.typedef.t_uscalar_t = uint
|
87
|
+
rbx.platform.typedef.taskid_t = int
|
98
88
|
rbx.platform.typedef.time_t = long
|
99
|
-
rbx.platform.typedef.clock_t = long
|
100
|
-
rbx.platform.typedef.clockid_t = int
|
101
89
|
rbx.platform.typedef.timer_t = int
|
102
|
-
rbx.platform.typedef.unchar = uchar
|
103
|
-
rbx.platform.typedef.ushort = ushort
|
104
|
-
rbx.platform.typedef.uint = uint
|
105
|
-
rbx.platform.typedef.ulong = ulong
|
106
90
|
rbx.platform.typedef.u_char = uchar
|
107
|
-
rbx.platform.typedef.u_short = ushort
|
108
91
|
rbx.platform.typedef.u_int = uint
|
109
92
|
rbx.platform.typedef.u_long = ulong
|
110
|
-
rbx.platform.typedef.
|
111
|
-
rbx.platform.typedef.
|
112
|
-
rbx.platform.typedef.
|
113
|
-
rbx.platform.typedef.
|
114
|
-
rbx.platform.typedef.
|
115
|
-
rbx.platform.typedef.
|
116
|
-
rbx.platform.typedef.
|
117
|
-
rbx.platform.typedef.
|
118
|
-
rbx.platform.typedef.
|
119
|
-
rbx.platform.typedef.
|
120
|
-
rbx.platform.typedef.
|
121
|
-
rbx.platform.typedef.
|
122
|
-
rbx.platform.typedef.
|
93
|
+
rbx.platform.typedef.u_longlong_t = ulong_long
|
94
|
+
rbx.platform.typedef.u_offset_t = ulong_long
|
95
|
+
rbx.platform.typedef.u_short = ushort
|
96
|
+
rbx.platform.typedef.uchar_t = uchar
|
97
|
+
rbx.platform.typedef.uid_t = uint
|
98
|
+
rbx.platform.typedef.uint = uint
|
99
|
+
rbx.platform.typedef.uint16_t = ushort
|
100
|
+
rbx.platform.typedef.uint32_t = uint
|
101
|
+
rbx.platform.typedef.uint64_t = ulong
|
102
|
+
rbx.platform.typedef.uint8_t = uchar
|
103
|
+
rbx.platform.typedef.uint_fast16_t = uint
|
104
|
+
rbx.platform.typedef.uint_fast32_t = uint
|
105
|
+
rbx.platform.typedef.uint_fast64_t = ulong
|
106
|
+
rbx.platform.typedef.uint_fast8_t = uchar
|
107
|
+
rbx.platform.typedef.uint_least16_t = ushort
|
108
|
+
rbx.platform.typedef.uint_least32_t = uint
|
109
|
+
rbx.platform.typedef.uint_least64_t = ulong
|
110
|
+
rbx.platform.typedef.uint_least8_t = uchar
|
111
|
+
rbx.platform.typedef.uint_t = uint
|
112
|
+
rbx.platform.typedef.uintmax_t = ulong
|
113
|
+
rbx.platform.typedef.uintptr_t = ulong
|
114
|
+
rbx.platform.typedef.ulong = ulong
|
115
|
+
rbx.platform.typedef.ulong_t = ulong
|
116
|
+
rbx.platform.typedef.unchar = uchar
|
117
|
+
rbx.platform.typedef.upad64_t = ulong
|
118
|
+
rbx.platform.typedef.use_t = uchar
|
119
|
+
rbx.platform.typedef.useconds_t = uint
|
120
|
+
rbx.platform.typedef.ushort = ushort
|
121
|
+
rbx.platform.typedef.ushort_t = ushort
|
122
|
+
rbx.platform.typedef.zoneid_t = int
|
@@ -1,120 +1,52 @@
|
|
1
|
-
rbx.platform.typedef.
|
2
|
-
rbx.platform.typedef.
|
3
|
-
rbx.platform.typedef.
|
4
|
-
rbx.platform.typedef.
|
5
|
-
rbx.platform.typedef.
|
6
|
-
rbx.platform.typedef.__uint_least16_t = ushort
|
7
|
-
rbx.platform.typedef.__int32_t = int
|
8
|
-
rbx.platform.typedef.__uint32_t = uint
|
9
|
-
rbx.platform.typedef.__int_least32_t = int
|
10
|
-
rbx.platform.typedef.__uint_least32_t = uint
|
11
|
-
rbx.platform.typedef.__int64_t = long_long
|
12
|
-
rbx.platform.typedef.__uint64_t = ulong_long
|
13
|
-
rbx.platform.typedef._off_t = long
|
14
|
-
rbx.platform.typedef.__dev_t = short
|
15
|
-
rbx.platform.typedef.__uid_t = ushort
|
16
|
-
rbx.platform.typedef.__gid_t = ushort
|
1
|
+
rbx.platform.typedef.__time32_t = long
|
2
|
+
rbx.platform.typedef.__time64_t = long_long
|
3
|
+
rbx.platform.typedef._dev_t = uint
|
4
|
+
rbx.platform.typedef._ino_t = ushort
|
5
|
+
rbx.platform.typedef._mode_t = ushort
|
17
6
|
rbx.platform.typedef._off64_t = long_long
|
18
|
-
rbx.platform.typedef.
|
19
|
-
rbx.platform.typedef.
|
20
|
-
rbx.platform.typedef.
|
21
|
-
rbx.platform.typedef.
|
22
|
-
rbx.platform.typedef.
|
23
|
-
rbx.platform.typedef.
|
24
|
-
rbx.platform.typedef.wctype_t = ushort
|
25
|
-
rbx.platform.typedef.ptrdiff_t = long_long
|
26
|
-
rbx.platform.typedef.size_t = ulong_long
|
27
|
-
rbx.platform.typedef.__off_t = long
|
28
|
-
rbx.platform.typedef.__pid_t = int
|
29
|
-
rbx.platform.typedef.__loff_t = long_long
|
30
|
-
rbx.platform.typedef.u_char = uchar
|
31
|
-
rbx.platform.typedef.u_short = ushort
|
32
|
-
rbx.platform.typedef.u_int = uint
|
33
|
-
rbx.platform.typedef.u_long = ulong
|
34
|
-
rbx.platform.typedef.ushort = ushort
|
35
|
-
rbx.platform.typedef.uint = uint
|
36
|
-
rbx.platform.typedef.ulong = ulong
|
37
|
-
rbx.platform.typedef.clock_t = ulong
|
38
|
-
rbx.platform.typedef.time_t = long_long
|
39
|
-
rbx.platform.typedef.daddr_t = long
|
40
|
-
rbx.platform.typedef.caddr_t = string
|
41
|
-
rbx.platform.typedef.pid_t = int
|
42
|
-
rbx.platform.typedef.ssize_t = int
|
43
|
-
rbx.platform.typedef.nlink_t = ushort
|
44
|
-
rbx.platform.typedef.fd_mask = long
|
45
|
-
rbx.platform.typedef.clockid_t = ulong
|
46
|
-
rbx.platform.typedef.timer_t = ulong
|
47
|
-
rbx.platform.typedef.useconds_t = ulong
|
48
|
-
rbx.platform.typedef.suseconds_t = long
|
49
|
-
rbx.platform.typedef.int8_t = char
|
7
|
+
rbx.platform.typedef._off_t = long
|
8
|
+
rbx.platform.typedef._pid_t = long_long
|
9
|
+
rbx.platform.typedef._sigset_t = ulong_long
|
10
|
+
rbx.platform.typedef.dev_t = uint
|
11
|
+
rbx.platform.typedef.errno_t = int
|
12
|
+
rbx.platform.typedef.ino_t = ushort
|
50
13
|
rbx.platform.typedef.int16_t = short
|
51
14
|
rbx.platform.typedef.int32_t = int
|
52
15
|
rbx.platform.typedef.int64_t = long_long
|
53
|
-
rbx.platform.typedef.
|
54
|
-
rbx.platform.typedef.
|
55
|
-
rbx.platform.typedef.
|
56
|
-
rbx.platform.typedef.
|
57
|
-
rbx.platform.typedef.
|
16
|
+
rbx.platform.typedef.int8_t = char
|
17
|
+
rbx.platform.typedef.int_fast16_t = short
|
18
|
+
rbx.platform.typedef.int_fast32_t = int
|
19
|
+
rbx.platform.typedef.int_fast64_t = long_long
|
20
|
+
rbx.platform.typedef.int_fast8_t = char
|
58
21
|
rbx.platform.typedef.int_least16_t = short
|
59
22
|
rbx.platform.typedef.int_least32_t = int
|
60
23
|
rbx.platform.typedef.int_least64_t = long_long
|
61
|
-
rbx.platform.typedef.
|
62
|
-
rbx.platform.typedef.
|
63
|
-
rbx.platform.typedef.
|
64
|
-
rbx.platform.typedef.
|
65
|
-
rbx.platform.typedef.
|
66
|
-
rbx.platform.typedef.
|
67
|
-
rbx.platform.typedef.
|
68
|
-
rbx.platform.typedef.
|
69
|
-
rbx.platform.typedef.
|
70
|
-
rbx.platform.typedef.
|
24
|
+
rbx.platform.typedef.int_least8_t = char
|
25
|
+
rbx.platform.typedef.intmax_t = long_long
|
26
|
+
rbx.platform.typedef.intptr_t = long_long
|
27
|
+
rbx.platform.typedef.mode_t = ushort
|
28
|
+
rbx.platform.typedef.off32_t = long
|
29
|
+
rbx.platform.typedef.off64_t = long_long
|
30
|
+
rbx.platform.typedef.off_t = long_long
|
31
|
+
rbx.platform.typedef.pid_t = long_long
|
32
|
+
rbx.platform.typedef.ptrdiff_t = long_long
|
33
|
+
rbx.platform.typedef.rsize_t = ulong_long
|
34
|
+
rbx.platform.typedef.size_t = ulong_long
|
35
|
+
rbx.platform.typedef.ssize_t = long_long
|
36
|
+
rbx.platform.typedef.time_t = long_long
|
37
|
+
rbx.platform.typedef.uint16_t = ushort
|
38
|
+
rbx.platform.typedef.uint64_t = ulong_long
|
39
|
+
rbx.platform.typedef.uint8_t = uchar
|
40
|
+
rbx.platform.typedef.uint_fast16_t = ushort
|
71
41
|
rbx.platform.typedef.uint_fast32_t = uint
|
72
42
|
rbx.platform.typedef.uint_fast64_t = ulong_long
|
73
|
-
rbx.platform.typedef.
|
74
|
-
rbx.platform.typedef.
|
75
|
-
rbx.platform.typedef.
|
43
|
+
rbx.platform.typedef.uint_fast8_t = uchar
|
44
|
+
rbx.platform.typedef.uint_least16_t = ushort
|
45
|
+
rbx.platform.typedef.uint_least64_t = ulong_long
|
46
|
+
rbx.platform.typedef.uint_least8_t = uchar
|
76
47
|
rbx.platform.typedef.uintmax_t = ulong_long
|
77
|
-
rbx.platform.typedef.
|
78
|
-
rbx.platform.typedef.
|
79
|
-
rbx.platform.typedef.
|
80
|
-
rbx.platform.typedef.
|
81
|
-
rbx.platform.typedef.
|
82
|
-
rbx.platform.typedef.dev_t = uint
|
83
|
-
rbx.platform.typedef.blksize_t = long
|
84
|
-
rbx.platform.typedef.__blkcnt32_t = long
|
85
|
-
rbx.platform.typedef.__blkcnt64_t = long_long
|
86
|
-
rbx.platform.typedef.blkcnt_t = long_long
|
87
|
-
rbx.platform.typedef.fsblkcnt_t = ulong
|
88
|
-
rbx.platform.typedef.fsfilcnt_t = ulong
|
89
|
-
rbx.platform.typedef.__uid16_t = ushort
|
90
|
-
rbx.platform.typedef.__uid32_t = ulong
|
91
|
-
rbx.platform.typedef.uid_t = ulong
|
92
|
-
rbx.platform.typedef.__gid16_t = ushort
|
93
|
-
rbx.platform.typedef.__gid32_t = ulong
|
94
|
-
rbx.platform.typedef.gid_t = ulong
|
95
|
-
rbx.platform.typedef.__ino32_t = ulong
|
96
|
-
rbx.platform.typedef.__ino64_t = ulong_long
|
97
|
-
rbx.platform.typedef.ino_t = ushort
|
98
|
-
rbx.platform.typedef._ino_t = ushort
|
99
|
-
rbx.platform.typedef.id_t = ulong
|
100
|
-
rbx.platform.typedef.key_t = long_long
|
101
|
-
rbx.platform.typedef.vm_offset_t = ulong
|
102
|
-
rbx.platform.typedef.vm_size_t = ulong
|
103
|
-
rbx.platform.typedef.u_int8_t = uchar
|
104
|
-
rbx.platform.typedef.u_int16_t = ushort
|
105
|
-
rbx.platform.typedef.u_int32_t = uint
|
106
|
-
rbx.platform.typedef.u_int64_t = ulong_long
|
107
|
-
rbx.platform.typedef.register_t = int
|
108
|
-
rbx.platform.typedef.*addr_t = char
|
109
|
-
rbx.platform.typedef.socklen_t = int
|
110
|
-
rbx.platform.typedef.sa_family_t = ushort
|
111
|
-
rbx.platform.typedef.__ULong = ulong
|
112
|
-
rbx.platform.typedef.sigset_t = ulong
|
113
|
-
rbx.platform.typedef.sig_atomic_t = int
|
114
|
-
rbx.platform.typedef.rlim_t = ulong
|
115
|
-
rbx.platform.typedef._sigset_t = ulong_long
|
116
|
-
rbx.platform.typedef.__time32_t = long
|
117
|
-
rbx.platform.typedef.__time64_t = long_long
|
118
|
-
rbx.platform.typedef.errno_t = int
|
119
|
-
rbx.platform.typedef._mode_t = ushort
|
120
|
-
rbx.platform.typedef.mode_t = ushort
|
48
|
+
rbx.platform.typedef.uintptr_t = ulong_long
|
49
|
+
rbx.platform.typedef.useconds_t = uint
|
50
|
+
rbx.platform.typedef.wchar_t = ushort
|
51
|
+
rbx.platform.typedef.wctype_t = ushort
|
52
|
+
rbx.platform.typedef.wint_t = ushort
|
data/lib/ffi/pointer.rb
CHANGED
@@ -31,17 +31,24 @@
|
|
31
31
|
#
|
32
32
|
|
33
33
|
require 'ffi/platform'
|
34
|
+
|
35
|
+
# NOTE: all method definitions in this file are conditional on
|
36
|
+
# whether they are not already defined. This is needed because
|
37
|
+
# some Ruby implementations (e.g., TruffleRuby) might already
|
38
|
+
# provide these methods due to using FFI internally, and we
|
39
|
+
# should not override them to avoid warnings.
|
40
|
+
|
34
41
|
module FFI
|
35
42
|
class Pointer
|
36
43
|
|
37
44
|
# Pointer size
|
38
|
-
SIZE = Platform::ADDRESS_SIZE / 8
|
45
|
+
SIZE = Platform::ADDRESS_SIZE / 8 unless const_defined?(:SIZE)
|
39
46
|
|
40
47
|
# Return the size of a pointer on the current platform, in bytes
|
41
48
|
# @return [Numeric]
|
42
49
|
def self.size
|
43
50
|
SIZE
|
44
|
-
end
|
51
|
+
end unless respond_to?(:size)
|
45
52
|
|
46
53
|
# @param [nil,Numeric] len length of string to return
|
47
54
|
# @return [String]
|
@@ -49,12 +56,12 @@ module FFI
|
|
49
56
|
# equivalent string if +len+ is not +nil+.
|
50
57
|
def read_string(len=nil)
|
51
58
|
if len
|
52
|
-
return '' if len == 0
|
59
|
+
return ''.b if len == 0
|
53
60
|
get_bytes(0, len)
|
54
61
|
else
|
55
62
|
get_string(0)
|
56
63
|
end
|
57
|
-
end
|
64
|
+
end unless method_defined?(:read_string)
|
58
65
|
|
59
66
|
# @param [Numeric] len length of string to return
|
60
67
|
# @return [String]
|
@@ -64,7 +71,7 @@ module FFI
|
|
64
71
|
# ptr.read_string(len) # with len not nil
|
65
72
|
def read_string_length(len)
|
66
73
|
get_bytes(0, len)
|
67
|
-
end
|
74
|
+
end unless method_defined?(:read_string_length)
|
68
75
|
|
69
76
|
# @return [String]
|
70
77
|
# Read pointer's contents as a string.
|
@@ -73,7 +80,7 @@ module FFI
|
|
73
80
|
# ptr.read_string # with no len
|
74
81
|
def read_string_to_null
|
75
82
|
get_string(0)
|
76
|
-
end
|
83
|
+
end unless method_defined?(:read_string_to_null)
|
77
84
|
|
78
85
|
# @param [String] str string to write
|
79
86
|
# @param [Numeric] len length of string to return
|
@@ -84,7 +91,7 @@ module FFI
|
|
84
91
|
# ptr.write_string(str, len) # with len not nil
|
85
92
|
def write_string_length(str, len)
|
86
93
|
put_bytes(0, str, 0, len)
|
87
|
-
end
|
94
|
+
end unless method_defined?(:write_string_length)
|
88
95
|
|
89
96
|
# @param [String] str string to write
|
90
97
|
# @param [Numeric] len length of string to return
|
@@ -95,7 +102,7 @@ module FFI
|
|
95
102
|
len = str.bytesize unless len
|
96
103
|
# Write the string data without NUL termination
|
97
104
|
put_bytes(0, str, 0, len)
|
98
|
-
end
|
105
|
+
end unless method_defined?(:write_string)
|
99
106
|
|
100
107
|
# @param [Type] type type of data to read from pointer's contents
|
101
108
|
# @param [Symbol] reader method to send to +self+ to read +type+
|
@@ -113,7 +120,7 @@ module FFI
|
|
113
120
|
tmp += size unless j == length-1 # avoid OOB
|
114
121
|
}
|
115
122
|
ary
|
116
|
-
end
|
123
|
+
end unless method_defined?(:read_array_of_type)
|
117
124
|
|
118
125
|
# @param [Type] type type of data to write to pointer's contents
|
119
126
|
# @param [Symbol] writer method to send to +self+ to write +type+
|
@@ -129,12 +136,12 @@ module FFI
|
|
129
136
|
self.send(writer, i * size, val)
|
130
137
|
}
|
131
138
|
self
|
132
|
-
end
|
139
|
+
end unless method_defined?(:write_array_of_type)
|
133
140
|
|
134
141
|
# @return [self]
|
135
142
|
def to_ptr
|
136
143
|
self
|
137
|
-
end
|
144
|
+
end unless method_defined?(:to_ptr)
|
138
145
|
|
139
146
|
# @param [Symbol,Type] type of data to read
|
140
147
|
# @return [Object]
|
@@ -144,7 +151,7 @@ module FFI
|
|
144
151
|
# ptr.get(type, 0)
|
145
152
|
def read(type)
|
146
153
|
get(type, 0)
|
147
|
-
end
|
154
|
+
end unless method_defined?(:read)
|
148
155
|
|
149
156
|
# @param [Symbol,Type] type of data to read
|
150
157
|
# @param [Object] value to write
|
@@ -155,6 +162,6 @@ module FFI
|
|
155
162
|
# ptr.put(type, 0)
|
156
163
|
def write(type, value)
|
157
164
|
put(type, 0, value)
|
158
|
-
end
|
165
|
+
end unless method_defined?(:write)
|
159
166
|
end
|
160
167
|
end
|