ffi 1.16.3 → 1.17.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +42 -0
- data/Gemfile +9 -2
- data/README.md +1 -1
- data/Rakefile +17 -5
- data/lib/ffi/autopointer.rb +1 -9
- data/lib/ffi/dynamic_library.rb +34 -5
- data/lib/ffi/enum.rb +0 -1
- data/lib/ffi/function.rb +1 -1
- data/lib/ffi/io.rb +2 -2
- data/lib/ffi/library.rb +23 -23
- data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
- data/lib/ffi/pointer.rb +6 -6
- data/lib/ffi/struct.rb +4 -4
- data/lib/ffi/struct_layout.rb +2 -2
- data/lib/ffi/struct_layout_builder.rb +8 -8
- data/lib/ffi/types.rb +51 -49
- data/lib/ffi/version.rb +1 -1
- data/sig/ffi/abstract_memory.rbs +165 -0
- data/sig/ffi/auto_pointer.rbs +27 -0
- data/sig/ffi/buffer.rbs +18 -0
- data/sig/ffi/data_converter.rbs +10 -0
- data/sig/ffi/dynamic_library.rbs +9 -0
- data/sig/ffi/enum.rbs +38 -0
- data/sig/ffi/function.rbs +39 -0
- data/sig/ffi/library.rbs +42 -0
- data/sig/ffi/native_type.rbs +86 -0
- data/sig/ffi/pointer.rbs +42 -0
- data/sig/ffi/struct.rbs +76 -0
- data/sig/ffi/struct_by_reference.rbs +11 -0
- data/sig/ffi/struct_by_value.rbs +7 -0
- data/sig/ffi/struct_layout.rbs +9 -0
- data/sig/ffi/struct_layout_builder.rbs +5 -0
- data/sig/ffi/type.rbs +39 -0
- data/sig/ffi.rbs +26 -0
- data.tar.gz.sig +0 -0
- metadata +34 -532
- metadata.gz.sig +0 -0
- data/ext/ffi_c/AbstractMemory.c +0 -1128
- data/ext/ffi_c/AbstractMemory.h +0 -176
- data/ext/ffi_c/ArrayType.c +0 -198
- data/ext/ffi_c/ArrayType.h +0 -60
- data/ext/ffi_c/Buffer.c +0 -417
- data/ext/ffi_c/Call.c +0 -498
- data/ext/ffi_c/Call.h +0 -107
- data/ext/ffi_c/ClosurePool.c +0 -333
- data/ext/ffi_c/ClosurePool.h +0 -59
- data/ext/ffi_c/DynamicLibrary.c +0 -397
- data/ext/ffi_c/DynamicLibrary.h +0 -98
- data/ext/ffi_c/Function.c +0 -1063
- data/ext/ffi_c/Function.h +0 -84
- data/ext/ffi_c/FunctionInfo.c +0 -322
- data/ext/ffi_c/LastError.c +0 -243
- data/ext/ffi_c/LastError.h +0 -47
- data/ext/ffi_c/LongDouble.c +0 -65
- data/ext/ffi_c/LongDouble.h +0 -47
- data/ext/ffi_c/MappedType.c +0 -211
- data/ext/ffi_c/MappedType.h +0 -57
- data/ext/ffi_c/MemoryPointer.c +0 -219
- data/ext/ffi_c/MemoryPointer.h +0 -49
- data/ext/ffi_c/MethodHandle.c +0 -350
- data/ext/ffi_c/MethodHandle.h +0 -56
- data/ext/ffi_c/Platform.c +0 -78
- data/ext/ffi_c/Platform.h +0 -45
- data/ext/ffi_c/Pointer.c +0 -546
- data/ext/ffi_c/Pointer.h +0 -60
- data/ext/ffi_c/Struct.c +0 -897
- data/ext/ffi_c/Struct.h +0 -115
- data/ext/ffi_c/StructByValue.c +0 -177
- data/ext/ffi_c/StructByValue.h +0 -55
- data/ext/ffi_c/StructLayout.c +0 -769
- data/ext/ffi_c/Thread.c +0 -129
- data/ext/ffi_c/Thread.h +0 -76
- data/ext/ffi_c/Type.c +0 -447
- data/ext/ffi_c/Type.h +0 -63
- data/ext/ffi_c/Types.c +0 -138
- data/ext/ffi_c/Types.h +0 -88
- data/ext/ffi_c/Variadic.c +0 -345
- data/ext/ffi_c/compat.h +0 -82
- data/ext/ffi_c/extconf.rb +0 -115
- data/ext/ffi_c/ffi.c +0 -97
- data/ext/ffi_c/libffi/.appveyor/site.exp +0 -16
- data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +0 -7
- data/ext/ffi_c/libffi/.appveyor.yml +0 -84
- data/ext/ffi_c/libffi/.ci/ar-lib +0 -270
- data/ext/ffi_c/libffi/.ci/bfin-sim.exp +0 -58
- data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +0 -18
- data/ext/ffi_c/libffi/.ci/build-in-container.sh +0 -10
- data/ext/ffi_c/libffi/.ci/build.sh +0 -124
- data/ext/ffi_c/libffi/.ci/compile +0 -351
- data/ext/ffi_c/libffi/.ci/install.sh +0 -78
- data/ext/ffi_c/libffi/.ci/m32r-sim.exp +0 -58
- data/ext/ffi_c/libffi/.ci/moxie-sim.exp +0 -60
- data/ext/ffi_c/libffi/.ci/msvs-detect +0 -1103
- data/ext/ffi_c/libffi/.ci/or1k-sim.exp +0 -58
- data/ext/ffi_c/libffi/.ci/powerpc-eabisim.exp +0 -58
- data/ext/ffi_c/libffi/.ci/site.exp +0 -29
- data/ext/ffi_c/libffi/.ci/wine-sim.exp +0 -55
- data/ext/ffi_c/libffi/.circleci/config.yml +0 -156
- data/ext/ffi_c/libffi/.gitattributes +0 -4
- data/ext/ffi_c/libffi/.github/issue_template.md +0 -10
- data/ext/ffi_c/libffi/.github/workflows/build.yml +0 -460
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +0 -171
- data/ext/ffi_c/libffi/.gitignore +0 -46
- data/ext/ffi_c/libffi/ChangeLog.old +0 -7407
- data/ext/ffi_c/libffi/LICENSE +0 -21
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +0 -353
- data/ext/ffi_c/libffi/Makefile.am +0 -157
- data/ext/ffi_c/libffi/Makefile.in +0 -2127
- data/ext/ffi_c/libffi/README.md +0 -526
- data/ext/ffi_c/libffi/acinclude.m4 +0 -377
- data/ext/ffi_c/libffi/autogen.sh +0 -2
- data/ext/ffi_c/libffi/compile +0 -348
- data/ext/ffi_c/libffi/config.guess +0 -1754
- data/ext/ffi_c/libffi/config.sub +0 -1892
- data/ext/ffi_c/libffi/configure +0 -22791
- data/ext/ffi_c/libffi/configure.ac +0 -451
- data/ext/ffi_c/libffi/configure.host +0 -337
- data/ext/ffi_c/libffi/doc/Makefile.am +0 -3
- data/ext/ffi_c/libffi/doc/Makefile.in +0 -818
- data/ext/ffi_c/libffi/doc/libffi.texi +0 -1046
- data/ext/ffi_c/libffi/doc/version.texi +0 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +0 -188
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +0 -312
- data/ext/ffi_c/libffi/include/Makefile.am +0 -9
- data/ext/ffi_c/libffi/include/Makefile.in +0 -609
- data/ext/ffi_c/libffi/include/ffi.h.in +0 -527
- data/ext/ffi_c/libffi/include/ffi_cfi.h +0 -76
- data/ext/ffi_c/libffi/include/ffi_common.h +0 -182
- data/ext/ffi_c/libffi/include/tramp.h +0 -45
- data/ext/ffi_c/libffi/install-sh +0 -541
- data/ext/ffi_c/libffi/libffi.map.in +0 -76
- data/ext/ffi_c/libffi/libffi.pc.in +0 -11
- data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +0 -997
- data/ext/ffi_c/libffi/libtool-ldflags +0 -106
- data/ext/ffi_c/libffi/libtool-version +0 -29
- data/ext/ffi_c/libffi/ltmain.sh +0 -11448
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +0 -13
- data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +0 -50
- data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +0 -198
- data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +0 -158
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +0 -53
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +0 -119
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +0 -49
- data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +0 -302
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +0 -267
- data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +0 -89
- data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +0 -51
- data/ext/ffi_c/libffi/m4/ax_require_defined.m4 +0 -37
- data/ext/ffi_c/libffi/make_sunver.pl +0 -333
- data/ext/ffi_c/libffi/man/Makefile.am +0 -8
- data/ext/ffi_c/libffi/man/Makefile.in +0 -565
- data/ext/ffi_c/libffi/man/ffi.3 +0 -41
- data/ext/ffi_c/libffi/man/ffi_call.3 +0 -103
- data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +0 -68
- data/ext/ffi_c/libffi/man/ffi_prep_cif_var.3 +0 -73
- data/ext/ffi_c/libffi/missing +0 -215
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +0 -33
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +0 -130
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +0 -57
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +0 -4
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +0 -511
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/fficonfig.h +0 -219
- data/ext/ffi_c/libffi/msvcc.sh +0 -353
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +0 -1129
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +0 -97
- data/ext/ffi_c/libffi/src/aarch64/internal.h +0 -100
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +0 -543
- data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +0 -506
- data/ext/ffi_c/libffi/src/alpha/ffi.c +0 -521
- data/ext/ffi_c/libffi/src/alpha/ffitarget.h +0 -57
- data/ext/ffi_c/libffi/src/alpha/internal.h +0 -23
- data/ext/ffi_c/libffi/src/alpha/osf.S +0 -282
- data/ext/ffi_c/libffi/src/arc/arcompact.S +0 -210
- data/ext/ffi_c/libffi/src/arc/ffi.c +0 -443
- data/ext/ffi_c/libffi/src/arc/ffitarget.h +0 -67
- data/ext/ffi_c/libffi/src/arm/ffi.c +0 -921
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +0 -89
- data/ext/ffi_c/libffi/src/arm/internal.h +0 -17
- data/ext/ffi_c/libffi/src/arm/sysv.S +0 -456
- data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +0 -311
- data/ext/ffi_c/libffi/src/avr32/ffi.c +0 -423
- data/ext/ffi_c/libffi/src/avr32/ffitarget.h +0 -55
- data/ext/ffi_c/libffi/src/avr32/sysv.S +0 -208
- data/ext/ffi_c/libffi/src/bfin/ffi.c +0 -196
- data/ext/ffi_c/libffi/src/bfin/ffitarget.h +0 -43
- data/ext/ffi_c/libffi/src/bfin/sysv.S +0 -179
- data/ext/ffi_c/libffi/src/closures.c +0 -1107
- data/ext/ffi_c/libffi/src/cris/ffi.c +0 -386
- data/ext/ffi_c/libffi/src/cris/ffitarget.h +0 -56
- data/ext/ffi_c/libffi/src/cris/sysv.S +0 -215
- data/ext/ffi_c/libffi/src/csky/ffi.c +0 -395
- data/ext/ffi_c/libffi/src/csky/ffitarget.h +0 -63
- data/ext/ffi_c/libffi/src/csky/sysv.S +0 -371
- data/ext/ffi_c/libffi/src/debug.c +0 -64
- data/ext/ffi_c/libffi/src/dlmalloc.c +0 -5171
- data/ext/ffi_c/libffi/src/frv/eabi.S +0 -128
- data/ext/ffi_c/libffi/src/frv/ffi.c +0 -292
- data/ext/ffi_c/libffi/src/frv/ffitarget.h +0 -62
- data/ext/ffi_c/libffi/src/ia64/ffi.c +0 -616
- data/ext/ffi_c/libffi/src/ia64/ffitarget.h +0 -56
- data/ext/ffi_c/libffi/src/ia64/ia64_flags.h +0 -40
- data/ext/ffi_c/libffi/src/ia64/unix.S +0 -585
- data/ext/ffi_c/libffi/src/java_raw_api.c +0 -374
- data/ext/ffi_c/libffi/src/kvx/asm.h +0 -5
- data/ext/ffi_c/libffi/src/kvx/ffi.c +0 -273
- data/ext/ffi_c/libffi/src/kvx/ffitarget.h +0 -75
- data/ext/ffi_c/libffi/src/kvx/sysv.S +0 -127
- data/ext/ffi_c/libffi/src/loongarch64/ffi.c +0 -621
- data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +0 -82
- data/ext/ffi_c/libffi/src/loongarch64/sysv.S +0 -327
- data/ext/ffi_c/libffi/src/m32r/ffi.c +0 -249
- data/ext/ffi_c/libffi/src/m32r/ffitarget.h +0 -53
- data/ext/ffi_c/libffi/src/m32r/sysv.S +0 -121
- data/ext/ffi_c/libffi/src/m68k/ffi.c +0 -362
- data/ext/ffi_c/libffi/src/m68k/ffitarget.h +0 -54
- data/ext/ffi_c/libffi/src/m68k/sysv.S +0 -357
- data/ext/ffi_c/libffi/src/m88k/ffi.c +0 -400
- data/ext/ffi_c/libffi/src/m88k/ffitarget.h +0 -49
- data/ext/ffi_c/libffi/src/m88k/obsd.S +0 -209
- data/ext/ffi_c/libffi/src/metag/ffi.c +0 -330
- data/ext/ffi_c/libffi/src/metag/ffitarget.h +0 -53
- data/ext/ffi_c/libffi/src/metag/sysv.S +0 -311
- data/ext/ffi_c/libffi/src/microblaze/ffi.c +0 -321
- data/ext/ffi_c/libffi/src/microblaze/ffitarget.h +0 -53
- data/ext/ffi_c/libffi/src/microblaze/sysv.S +0 -302
- data/ext/ffi_c/libffi/src/mips/ffi.c +0 -1309
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +0 -251
- data/ext/ffi_c/libffi/src/mips/n32.S +0 -772
- data/ext/ffi_c/libffi/src/mips/o32.S +0 -561
- data/ext/ffi_c/libffi/src/moxie/eabi.S +0 -101
- data/ext/ffi_c/libffi/src/moxie/ffi.c +0 -310
- data/ext/ffi_c/libffi/src/moxie/ffitarget.h +0 -52
- data/ext/ffi_c/libffi/src/nios2/ffi.c +0 -304
- data/ext/ffi_c/libffi/src/nios2/ffitarget.h +0 -52
- data/ext/ffi_c/libffi/src/nios2/sysv.S +0 -136
- data/ext/ffi_c/libffi/src/or1k/ffi.c +0 -341
- data/ext/ffi_c/libffi/src/or1k/ffitarget.h +0 -58
- data/ext/ffi_c/libffi/src/or1k/sysv.S +0 -107
- data/ext/ffi_c/libffi/src/pa/ffi.c +0 -673
- data/ext/ffi_c/libffi/src/pa/ffi64.c +0 -614
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +0 -94
- data/ext/ffi_c/libffi/src/pa/hpux32.S +0 -417
- data/ext/ffi_c/libffi/src/pa/hpux64.S +0 -681
- data/ext/ffi_c/libffi/src/pa/linux.S +0 -427
- data/ext/ffi_c/libffi/src/powerpc/aix.S +0 -566
- data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +0 -694
- data/ext/ffi_c/libffi/src/powerpc/asm.h +0 -125
- data/ext/ffi_c/libffi/src/powerpc/darwin.S +0 -378
- data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +0 -571
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +0 -175
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +0 -1452
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +0 -1153
- data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +0 -105
- data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +0 -923
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +0 -204
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +0 -293
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +0 -566
- data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +0 -397
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +0 -173
- data/ext/ffi_c/libffi/src/powerpc/t-aix +0 -5
- data/ext/ffi_c/libffi/src/prep_cif.c +0 -283
- data/ext/ffi_c/libffi/src/raw_api.c +0 -267
- data/ext/ffi_c/libffi/src/riscv/ffi.c +0 -514
- data/ext/ffi_c/libffi/src/riscv/ffitarget.h +0 -69
- data/ext/ffi_c/libffi/src/riscv/sysv.S +0 -293
- data/ext/ffi_c/libffi/src/s390/ffi.c +0 -756
- data/ext/ffi_c/libffi/src/s390/ffitarget.h +0 -70
- data/ext/ffi_c/libffi/src/s390/internal.h +0 -11
- data/ext/ffi_c/libffi/src/s390/sysv.S +0 -325
- data/ext/ffi_c/libffi/src/sh/ffi.c +0 -717
- data/ext/ffi_c/libffi/src/sh/ffitarget.h +0 -54
- data/ext/ffi_c/libffi/src/sh/sysv.S +0 -850
- data/ext/ffi_c/libffi/src/sh64/ffi.c +0 -469
- data/ext/ffi_c/libffi/src/sh64/ffitarget.h +0 -58
- data/ext/ffi_c/libffi/src/sh64/sysv.S +0 -539
- data/ext/ffi_c/libffi/src/sparc/ffi.c +0 -468
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +0 -624
- data/ext/ffi_c/libffi/src/sparc/ffitarget.h +0 -81
- data/ext/ffi_c/libffi/src/sparc/internal.h +0 -26
- data/ext/ffi_c/libffi/src/sparc/v8.S +0 -443
- data/ext/ffi_c/libffi/src/sparc/v9.S +0 -440
- data/ext/ffi_c/libffi/src/tile/ffi.c +0 -355
- data/ext/ffi_c/libffi/src/tile/ffitarget.h +0 -65
- data/ext/ffi_c/libffi/src/tile/tile.S +0 -360
- data/ext/ffi_c/libffi/src/tramp.c +0 -716
- data/ext/ffi_c/libffi/src/types.c +0 -108
- data/ext/ffi_c/libffi/src/vax/elfbsd.S +0 -195
- data/ext/ffi_c/libffi/src/vax/ffi.c +0 -276
- data/ext/ffi_c/libffi/src/vax/ffitarget.h +0 -49
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +0 -934
- data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +0 -62
- data/ext/ffi_c/libffi/src/x86/asmnames.h +0 -30
- data/ext/ffi_c/libffi/src/x86/ffi.c +0 -832
- data/ext/ffi_c/libffi/src/x86/ffi64.c +0 -950
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +0 -164
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +0 -361
- data/ext/ffi_c/libffi/src/x86/internal.h +0 -43
- data/ext/ffi_c/libffi/src/x86/internal64.h +0 -36
- data/ext/ffi_c/libffi/src/x86/sysv.S +0 -1272
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +0 -998
- data/ext/ffi_c/libffi/src/x86/unix64.S +0 -711
- data/ext/ffi_c/libffi/src/x86/win64.S +0 -254
- data/ext/ffi_c/libffi/src/x86/win64_intel.S +0 -238
- data/ext/ffi_c/libffi/src/xtensa/ffi.c +0 -306
- data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +0 -57
- data/ext/ffi_c/libffi/src/xtensa/sysv.S +0 -268
- data/ext/ffi_c/libffi/stamp-h.in +0 -1
- data/ext/ffi_c/libffi/testsuite/Makefile.am +0 -135
- data/ext/ffi_c/libffi/testsuite/Makefile.in +0 -664
- data/ext/ffi_c/libffi/testsuite/config/default.exp +0 -1
- data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +0 -54
- data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +0 -63
- data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +0 -80
- data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +0 -48
- data/ext/ffi_c/libffi/testsuite/emscripten/test.html +0 -7
- data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +0 -51
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +0 -682
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +0 -283
- data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +0 -45
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +0 -28
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +0 -50
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +0 -63
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +0 -1746
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +0 -2885
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +0 -747
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +0 -41
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +0 -54
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +0 -26
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +0 -163
- data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +0 -59
- data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +0 -60
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +0 -61
- data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +0 -74
- data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +0 -62
- data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +0 -110
- data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +0 -59
- data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +0 -57
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +0 -70
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +0 -52
- data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +0 -127
- data/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c +0 -59
- data/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc_tc.c +0 -114
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c +0 -43
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c +0 -35
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +0 -34
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c +0 -41
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +0 -48
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +0 -38
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +0 -60
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +0 -43
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +0 -55
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +0 -57
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +0 -60
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +0 -64
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +0 -66
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +0 -64
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +0 -74
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +0 -81
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +0 -68
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +0 -63
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +0 -65
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +0 -65
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +0 -93
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +0 -61
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +0 -63
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +0 -61
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +0 -220
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +0 -154
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +0 -134
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +0 -134
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +0 -140
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn0.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn1.c +0 -83
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn2.c +0 -83
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn3.c +0 -102
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn4.c +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn5.c +0 -94
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn6.c +0 -92
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_loc_fn0.c +0 -96
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_simple.c +0 -61
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_12byte.c +0 -112
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_16byte.c +0 -117
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_18byte.c +0 -120
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_19byte.c +0 -131
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_1_1byte.c +0 -93
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte.c +0 -109
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte1.c +0 -113
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_24byte.c +0 -145
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_2byte.c +0 -103
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3_1byte.c +0 -114
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte1.c +0 -103
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte2.c +0 -103
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +0 -113
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4_1byte.c +0 -120
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4byte.c +0 -103
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5_1_byte.c +0 -137
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5byte.c +0 -116
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_64byte.c +0 -148
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6_1_byte.c +0 -140
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6byte.c +0 -121
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7_1_byte.c +0 -155
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7byte.c +0 -121
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_8byte.c +0 -102
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte1.c +0 -103
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte2.c +0 -103
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_double.c +0 -111
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_float.c +0 -109
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble.c +0 -111
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split.c +0 -147
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split2.c +0 -152
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_pointer.c +0 -113
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint16.c +0 -108
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint32.c +0 -106
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint64.c +0 -109
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint16.c +0 -108
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint32.c +0 -109
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint64.c +0 -111
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +0 -68
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double.c +0 -43
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double_va.c +0 -69
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_float.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble.c +0 -115
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble_va.c +0 -80
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_args.c +0 -70
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_float_double.c +0 -55
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_schar.c +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshort.c +0 -79
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +0 -94
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_uchar.c +0 -99
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushort.c +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +0 -94
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer.c +0 -79
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer_stack.c +0 -152
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_schar.c +0 -47
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sint.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sshort.c +0 -45
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +0 -125
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar.c +0 -45
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint.c +0 -47
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulonglong.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.closures/err_bad_abi.c +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +0 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +0 -343
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct.c +0 -175
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct1.c +0 -161
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct10.c +0 -146
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +0 -137
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +0 -86
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +0 -115
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct2.c +0 -119
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct3.c +0 -120
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct4.c +0 -120
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct5.c +0 -121
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct6.c +0 -142
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct7.c +0 -120
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct8.c +0 -142
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct9.c +0 -142
- data/ext/ffi_c/libffi/testsuite/libffi.closures/problem1.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +0 -86
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +0 -102
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +0 -101
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_large.c +0 -145
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_large2.c +0 -148
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium.c +0 -124
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium2.c +0 -125
- data/ext/ffi_c/libffi/testsuite/libffi.closures/testclosure.c +0 -75
- data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +0 -118
- data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +0 -55
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +0 -71
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +0 -80
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +0 -16
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.exp +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +0 -51
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +0 -7
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +0 -7
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +0 -7
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +0 -86
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +0 -1
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +0 -37
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +0 -41
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +0 -34
- data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +0 -28
- data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +0 -1
- data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +0 -19
- data/ext/ffi_c/libffi.bsd.mk +0 -40
- data/ext/ffi_c/libffi.darwin.mk +0 -105
- data/ext/ffi_c/libffi.gnu.mk +0 -32
- data/ext/ffi_c/libffi.mk +0 -18
- data/ext/ffi_c/libffi.vc.mk +0 -26
- data/ext/ffi_c/libffi.vc64.mk +0 -26
- data/ext/ffi_c/rbffi.h +0 -55
- data/ext/ffi_c/rbffi_endian.h +0 -59
data/ext/ffi_c/Types.c
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2009, Wayne Meissner
|
|
3
|
-
* Copyright (c) 2009, Luc Heinrich
|
|
4
|
-
* Copyright (c) 2009, Aman Gupta.
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2008-2013, Ruby FFI project contributors
|
|
7
|
-
* All rights reserved.
|
|
8
|
-
*
|
|
9
|
-
* Redistribution and use in source and binary forms, with or without
|
|
10
|
-
* modification, are permitted provided that the following conditions are met:
|
|
11
|
-
* * Redistributions of source code must retain the above copyright
|
|
12
|
-
* notice, this list of conditions and the following disclaimer.
|
|
13
|
-
* * Redistributions in binary form must reproduce the above copyright
|
|
14
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
15
|
-
* documentation and/or other materials provided with the distribution.
|
|
16
|
-
* * Neither the name of the Ruby FFI project nor the
|
|
17
|
-
* names of its contributors may be used to endorse or promote products
|
|
18
|
-
* derived from this software without specific prior written permission.
|
|
19
|
-
*
|
|
20
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
21
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
22
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
-
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
24
|
-
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
25
|
-
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
26
|
-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
27
|
-
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
29
|
-
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
#include <ruby.h>
|
|
33
|
-
#include "Pointer.h"
|
|
34
|
-
#include "rbffi.h"
|
|
35
|
-
#include "Function.h"
|
|
36
|
-
#include "StructByValue.h"
|
|
37
|
-
#include "Types.h"
|
|
38
|
-
#include "Struct.h"
|
|
39
|
-
#include "MappedType.h"
|
|
40
|
-
#include "MemoryPointer.h"
|
|
41
|
-
#include "LongDouble.h"
|
|
42
|
-
|
|
43
|
-
static ID id_from_native = 0;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
VALUE
|
|
47
|
-
rbffi_NativeValue_ToRuby(Type* type, VALUE rbType, const void* ptr)
|
|
48
|
-
{
|
|
49
|
-
switch (type->nativeType) {
|
|
50
|
-
case NATIVE_VOID:
|
|
51
|
-
return Qnil;
|
|
52
|
-
case NATIVE_INT8:
|
|
53
|
-
return INT2NUM((signed char) *(ffi_sarg *) ptr);
|
|
54
|
-
case NATIVE_INT16:
|
|
55
|
-
return INT2NUM((signed short) *(ffi_sarg *) ptr);
|
|
56
|
-
case NATIVE_INT32:
|
|
57
|
-
return INT2NUM((signed int) *(ffi_sarg *) ptr);
|
|
58
|
-
case NATIVE_LONG:
|
|
59
|
-
return LONG2NUM((signed long) *(ffi_sarg *) ptr);
|
|
60
|
-
case NATIVE_INT64:
|
|
61
|
-
return LL2NUM(*(signed long long *) ptr);
|
|
62
|
-
|
|
63
|
-
case NATIVE_UINT8:
|
|
64
|
-
return UINT2NUM((unsigned char) *(ffi_arg *) ptr);
|
|
65
|
-
case NATIVE_UINT16:
|
|
66
|
-
return UINT2NUM((unsigned short) *(ffi_arg *) ptr);
|
|
67
|
-
case NATIVE_UINT32:
|
|
68
|
-
return UINT2NUM((unsigned int) *(ffi_arg *) ptr);
|
|
69
|
-
case NATIVE_ULONG:
|
|
70
|
-
return ULONG2NUM((unsigned long) *(ffi_arg *) ptr);
|
|
71
|
-
case NATIVE_UINT64:
|
|
72
|
-
return ULL2NUM(*(unsigned long long *) ptr);
|
|
73
|
-
|
|
74
|
-
case NATIVE_FLOAT32:
|
|
75
|
-
return rb_float_new(*(float *) ptr);
|
|
76
|
-
case NATIVE_FLOAT64:
|
|
77
|
-
return rb_float_new(*(double *) ptr);
|
|
78
|
-
|
|
79
|
-
case NATIVE_LONGDOUBLE:
|
|
80
|
-
return rbffi_longdouble_new(*(long double *) ptr);
|
|
81
|
-
|
|
82
|
-
case NATIVE_STRING:
|
|
83
|
-
return (*(void **) ptr != NULL) ? rb_str_new2(*(char **) ptr) : Qnil;
|
|
84
|
-
case NATIVE_POINTER:
|
|
85
|
-
return rbffi_Pointer_NewInstance(*(void **) ptr);
|
|
86
|
-
case NATIVE_BOOL:
|
|
87
|
-
return ((unsigned char) *(ffi_arg *) ptr) ? Qtrue : Qfalse;
|
|
88
|
-
|
|
89
|
-
case NATIVE_FUNCTION: {
|
|
90
|
-
return *(void **) ptr != NULL
|
|
91
|
-
? rbffi_Function_NewInstance(rbType, rbffi_Pointer_NewInstance(*(void **) ptr))
|
|
92
|
-
: Qnil;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
case NATIVE_STRUCT: {
|
|
96
|
-
StructByValue* sbv = (StructByValue *)type;
|
|
97
|
-
AbstractMemory* mem;
|
|
98
|
-
VALUE rbMemory = rbffi_MemoryPointer_NewInstance(1, sbv->base.ffiType->size, false);
|
|
99
|
-
|
|
100
|
-
TypedData_Get_Struct(rbMemory, AbstractMemory, &rbffi_abstract_memory_data_type, mem);
|
|
101
|
-
memcpy(mem->address, ptr, sbv->base.ffiType->size);
|
|
102
|
-
RB_GC_GUARD(rbMemory);
|
|
103
|
-
RB_GC_GUARD(rbType);
|
|
104
|
-
|
|
105
|
-
return rb_class_new_instance(1, &rbMemory, sbv->rbStructClass);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
case NATIVE_MAPPED: {
|
|
109
|
-
/*
|
|
110
|
-
* For mapped types, first convert to the real native type, then upcall to
|
|
111
|
-
* ruby to convert to the expected return type
|
|
112
|
-
*/
|
|
113
|
-
MappedType* m = (MappedType *) type;
|
|
114
|
-
VALUE values[2], rbReturnValue;
|
|
115
|
-
|
|
116
|
-
values[0] = rbffi_NativeValue_ToRuby(m->type, m->rbType, ptr);
|
|
117
|
-
values[1] = Qnil;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
rbReturnValue = rb_funcall2(m->rbConverter, id_from_native, 2, values);
|
|
121
|
-
RB_GC_GUARD(values[0]);
|
|
122
|
-
RB_GC_GUARD(rbType);
|
|
123
|
-
|
|
124
|
-
return rbReturnValue;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
default:
|
|
128
|
-
rb_raise(rb_eRuntimeError, "Unknown type: %d", type->nativeType);
|
|
129
|
-
return Qnil;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
void
|
|
134
|
-
rbffi_Types_Init(VALUE moduleFFI)
|
|
135
|
-
{
|
|
136
|
-
id_from_native = rb_intern("from_native");
|
|
137
|
-
}
|
|
138
|
-
|
data/ext/ffi_c/Types.h
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2008, 2009, Wayne Meissner
|
|
3
|
-
* Copyright (c) 2009, Luc Heinrich <luc@honk-honk.com>
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2008-2013, Ruby FFI project contributors
|
|
6
|
-
* All rights reserved.
|
|
7
|
-
*
|
|
8
|
-
* Redistribution and use in source and binary forms, with or without
|
|
9
|
-
* modification, are permitted provided that the following conditions are met:
|
|
10
|
-
* * Redistributions of source code must retain the above copyright
|
|
11
|
-
* notice, this list of conditions and the following disclaimer.
|
|
12
|
-
* * Redistributions in binary form must reproduce the above copyright
|
|
13
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
14
|
-
* documentation and/or other materials provided with the distribution.
|
|
15
|
-
* * Neither the name of the Ruby FFI project nor the
|
|
16
|
-
* names of its contributors may be used to endorse or promote products
|
|
17
|
-
* derived from this software without specific prior written permission.
|
|
18
|
-
*
|
|
19
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
20
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
21
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
-
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
23
|
-
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
24
|
-
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
25
|
-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
26
|
-
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
27
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
28
|
-
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
#ifndef RBFFI_TYPES_H
|
|
32
|
-
#define RBFFI_TYPES_H
|
|
33
|
-
|
|
34
|
-
#ifdef __cplusplus
|
|
35
|
-
extern "C" {
|
|
36
|
-
#endif
|
|
37
|
-
|
|
38
|
-
typedef enum {
|
|
39
|
-
NATIVE_VOID,
|
|
40
|
-
NATIVE_INT8,
|
|
41
|
-
NATIVE_UINT8,
|
|
42
|
-
NATIVE_INT16,
|
|
43
|
-
NATIVE_UINT16,
|
|
44
|
-
NATIVE_INT32,
|
|
45
|
-
NATIVE_UINT32,
|
|
46
|
-
NATIVE_INT64,
|
|
47
|
-
NATIVE_UINT64,
|
|
48
|
-
NATIVE_LONG,
|
|
49
|
-
NATIVE_ULONG,
|
|
50
|
-
NATIVE_FLOAT32,
|
|
51
|
-
NATIVE_FLOAT64,
|
|
52
|
-
NATIVE_LONGDOUBLE,
|
|
53
|
-
NATIVE_POINTER,
|
|
54
|
-
NATIVE_FUNCTION,
|
|
55
|
-
NATIVE_BUFFER_IN,
|
|
56
|
-
NATIVE_BUFFER_OUT,
|
|
57
|
-
NATIVE_BUFFER_INOUT,
|
|
58
|
-
NATIVE_CHAR_ARRAY,
|
|
59
|
-
NATIVE_BOOL,
|
|
60
|
-
|
|
61
|
-
/** An immutable string. Nul terminated, but only copies in to the native function */
|
|
62
|
-
NATIVE_STRING,
|
|
63
|
-
|
|
64
|
-
/** The function takes a variable number of arguments */
|
|
65
|
-
NATIVE_VARARGS,
|
|
66
|
-
|
|
67
|
-
/** Struct-by-value param or result */
|
|
68
|
-
NATIVE_STRUCT,
|
|
69
|
-
|
|
70
|
-
/** An array type definition */
|
|
71
|
-
NATIVE_ARRAY,
|
|
72
|
-
|
|
73
|
-
/** Custom native type */
|
|
74
|
-
NATIVE_MAPPED,
|
|
75
|
-
} NativeType;
|
|
76
|
-
|
|
77
|
-
#include <ffi.h>
|
|
78
|
-
#include "Type.h"
|
|
79
|
-
|
|
80
|
-
VALUE rbffi_NativeValue_ToRuby(Type* type, VALUE rbType, const void* ptr);
|
|
81
|
-
void rbffi_Types_Init(VALUE moduleFFI);
|
|
82
|
-
|
|
83
|
-
#ifdef __cplusplus
|
|
84
|
-
}
|
|
85
|
-
#endif
|
|
86
|
-
|
|
87
|
-
#endif /* RBFFI_TYPES_H */
|
|
88
|
-
|
data/ext/ffi_c/Variadic.c
DELETED
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2008-2010 Wayne Meissner
|
|
3
|
-
* Copyright (C) 2009 Andrea Fazzi <andrea.fazzi@alcacoop.it>
|
|
4
|
-
* Copyright (c) 2008-2013, Ruby FFI project contributors
|
|
5
|
-
* All rights reserved.
|
|
6
|
-
*
|
|
7
|
-
* Redistribution and use in source and binary forms, with or without
|
|
8
|
-
* modification, are permitted provided that the following conditions are met:
|
|
9
|
-
* * Redistributions of source code must retain the above copyright
|
|
10
|
-
* notice, this list of conditions and the following disclaimer.
|
|
11
|
-
* * Redistributions in binary form must reproduce the above copyright
|
|
12
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
13
|
-
* documentation and/or other materials provided with the distribution.
|
|
14
|
-
* * Neither the name of the Ruby FFI project nor the
|
|
15
|
-
* names of its contributors may be used to endorse or promote products
|
|
16
|
-
* derived from this software without specific prior written permission.
|
|
17
|
-
*
|
|
18
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
19
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
20
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
-
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
22
|
-
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
23
|
-
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24
|
-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
25
|
-
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
27
|
-
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
#ifndef _MSC_VER
|
|
31
|
-
#include <sys/param.h>
|
|
32
|
-
#endif
|
|
33
|
-
#include <sys/types.h>
|
|
34
|
-
|
|
35
|
-
#include <stdio.h>
|
|
36
|
-
#include <stdint.h>
|
|
37
|
-
#include <stdbool.h>
|
|
38
|
-
#include <ruby.h>
|
|
39
|
-
#if HAVE_RB_EXT_RACTOR_SAFE
|
|
40
|
-
#include <ruby/ractor.h>
|
|
41
|
-
#endif
|
|
42
|
-
|
|
43
|
-
#include <ffi.h>
|
|
44
|
-
#include "rbffi.h"
|
|
45
|
-
#include "compat.h"
|
|
46
|
-
|
|
47
|
-
#include "AbstractMemory.h"
|
|
48
|
-
#include "Pointer.h"
|
|
49
|
-
#include "Types.h"
|
|
50
|
-
#include "Type.h"
|
|
51
|
-
#include "LastError.h"
|
|
52
|
-
#include "MethodHandle.h"
|
|
53
|
-
#include "Call.h"
|
|
54
|
-
#include "Thread.h"
|
|
55
|
-
|
|
56
|
-
typedef struct VariadicInvoker_ {
|
|
57
|
-
VALUE rbAddress;
|
|
58
|
-
VALUE rbReturnType;
|
|
59
|
-
VALUE rbEnums;
|
|
60
|
-
|
|
61
|
-
Type* returnType;
|
|
62
|
-
ffi_abi abi;
|
|
63
|
-
void* function;
|
|
64
|
-
int paramCount;
|
|
65
|
-
bool blocking;
|
|
66
|
-
} VariadicInvoker;
|
|
67
|
-
|
|
68
|
-
static VALUE variadic_allocate(VALUE klass);
|
|
69
|
-
static VALUE variadic_initialize(VALUE self, VALUE rbFunction, VALUE rbParameterTypes,
|
|
70
|
-
VALUE rbReturnType, VALUE options);
|
|
71
|
-
static void variadic_mark(void *);
|
|
72
|
-
static void variadic_compact(void *);
|
|
73
|
-
static size_t variadic_memsize(const void *);
|
|
74
|
-
|
|
75
|
-
static VALUE classVariadicInvoker = Qnil;
|
|
76
|
-
|
|
77
|
-
static const rb_data_type_t variadic_data_type = {
|
|
78
|
-
.wrap_struct_name = "FFI::VariadicInvoker",
|
|
79
|
-
.function = {
|
|
80
|
-
.dmark = variadic_mark,
|
|
81
|
-
.dfree = RUBY_TYPED_DEFAULT_FREE,
|
|
82
|
-
.dsize = variadic_memsize,
|
|
83
|
-
ffi_compact_callback( variadic_compact )
|
|
84
|
-
},
|
|
85
|
-
// IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
|
|
86
|
-
// macro to update VALUE references, as to trigger write barriers.
|
|
87
|
-
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | FFI_RUBY_TYPED_FROZEN_SHAREABLE
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
static VALUE
|
|
92
|
-
variadic_allocate(VALUE klass)
|
|
93
|
-
{
|
|
94
|
-
VariadicInvoker *invoker;
|
|
95
|
-
VALUE obj = TypedData_Make_Struct(klass, VariadicInvoker, &variadic_data_type, invoker);
|
|
96
|
-
|
|
97
|
-
RB_OBJ_WRITE(obj, &invoker->rbAddress, Qnil);
|
|
98
|
-
RB_OBJ_WRITE(obj, &invoker->rbEnums, Qnil);
|
|
99
|
-
RB_OBJ_WRITE(obj, &invoker->rbReturnType, Qnil);
|
|
100
|
-
invoker->blocking = false;
|
|
101
|
-
|
|
102
|
-
return obj;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
static void
|
|
106
|
-
variadic_mark(void *data)
|
|
107
|
-
{
|
|
108
|
-
VariadicInvoker *invoker = (VariadicInvoker *)data;
|
|
109
|
-
rb_gc_mark_movable(invoker->rbEnums);
|
|
110
|
-
rb_gc_mark_movable(invoker->rbAddress);
|
|
111
|
-
rb_gc_mark_movable(invoker->rbReturnType);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
static void
|
|
115
|
-
variadic_compact(void *data)
|
|
116
|
-
{
|
|
117
|
-
VariadicInvoker *invoker = (VariadicInvoker *)data;
|
|
118
|
-
ffi_gc_location(invoker->rbEnums);
|
|
119
|
-
ffi_gc_location(invoker->rbAddress);
|
|
120
|
-
ffi_gc_location(invoker->rbReturnType);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
static size_t
|
|
124
|
-
variadic_memsize(const void *data)
|
|
125
|
-
{
|
|
126
|
-
return sizeof(VariadicInvoker);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
static VALUE
|
|
130
|
-
variadic_initialize(VALUE self, VALUE rbFunction, VALUE rbParameterTypes, VALUE rbReturnType, VALUE options)
|
|
131
|
-
{
|
|
132
|
-
VariadicInvoker* invoker = NULL;
|
|
133
|
-
VALUE retval = Qnil;
|
|
134
|
-
VALUE convention = Qnil;
|
|
135
|
-
VALUE fixed = Qnil;
|
|
136
|
-
#if defined(X86_WIN32)
|
|
137
|
-
VALUE rbConventionStr;
|
|
138
|
-
#endif
|
|
139
|
-
int i;
|
|
140
|
-
|
|
141
|
-
Check_Type(options, T_HASH);
|
|
142
|
-
convention = rb_hash_aref(options, ID2SYM(rb_intern("convention")));
|
|
143
|
-
|
|
144
|
-
TypedData_Get_Struct(self, VariadicInvoker, &variadic_data_type, invoker);
|
|
145
|
-
RB_OBJ_WRITE(self, &invoker->rbEnums, rb_hash_aref(options, ID2SYM(rb_intern("enums"))));
|
|
146
|
-
RB_OBJ_WRITE(self, &invoker->rbAddress, rbFunction);
|
|
147
|
-
invoker->function = rbffi_AbstractMemory_Cast(rbFunction, &rbffi_pointer_data_type)->address;
|
|
148
|
-
invoker->blocking = RTEST(rb_hash_aref(options, ID2SYM(rb_intern("blocking"))));
|
|
149
|
-
|
|
150
|
-
#if defined(X86_WIN32)
|
|
151
|
-
rbConventionStr = rb_funcall2(convention, rb_intern("to_s"), 0, NULL);
|
|
152
|
-
invoker->abi = (RTEST(convention) && strcmp(StringValueCStr(rbConventionStr), "stdcall") == 0)
|
|
153
|
-
? FFI_STDCALL : FFI_DEFAULT_ABI;
|
|
154
|
-
#else
|
|
155
|
-
invoker->abi = FFI_DEFAULT_ABI;
|
|
156
|
-
#endif
|
|
157
|
-
|
|
158
|
-
RB_OBJ_WRITE(self, &invoker->rbReturnType, rbffi_Type_Lookup(rbReturnType));
|
|
159
|
-
if (!RTEST(invoker->rbReturnType)) {
|
|
160
|
-
VALUE typeName = rb_funcall2(rbReturnType, rb_intern("inspect"), 0, NULL);
|
|
161
|
-
rb_raise(rb_eTypeError, "Invalid return type (%s)", RSTRING_PTR(typeName));
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
TypedData_Get_Struct(rbReturnType, Type, &rbffi_type_data_type, invoker->returnType);
|
|
165
|
-
|
|
166
|
-
invoker->paramCount = -1;
|
|
167
|
-
|
|
168
|
-
fixed = rb_ary_new2(RARRAY_LEN(rbParameterTypes) - 1);
|
|
169
|
-
for (i = 0; i < RARRAY_LEN(rbParameterTypes); ++i) {
|
|
170
|
-
VALUE entry = rb_ary_entry(rbParameterTypes, i);
|
|
171
|
-
VALUE rbType = rbffi_Type_Lookup(entry);
|
|
172
|
-
Type* type;
|
|
173
|
-
|
|
174
|
-
if (!RTEST(rbType)) {
|
|
175
|
-
VALUE typeName = rb_funcall2(entry, rb_intern("inspect"), 0, NULL);
|
|
176
|
-
rb_raise(rb_eTypeError, "Invalid parameter type (%s)", RSTRING_PTR(typeName));
|
|
177
|
-
}
|
|
178
|
-
TypedData_Get_Struct(rbType, Type, &rbffi_type_data_type, type);
|
|
179
|
-
if (type->nativeType != NATIVE_VARARGS) {
|
|
180
|
-
rb_ary_push(fixed, entry);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
/*
|
|
184
|
-
* @fixed and @type_map are used by the parameter mangling ruby code
|
|
185
|
-
*/
|
|
186
|
-
rb_iv_set(self, "@fixed", rb_obj_freeze(fixed));
|
|
187
|
-
rb_iv_set(self, "@type_map", rb_hash_aref(options, ID2SYM(rb_intern("type_map"))));
|
|
188
|
-
|
|
189
|
-
return retval;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
static VALUE
|
|
193
|
-
variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
|
|
194
|
-
{
|
|
195
|
-
VariadicInvoker* invoker;
|
|
196
|
-
FFIStorage* params;
|
|
197
|
-
void* retval;
|
|
198
|
-
ffi_cif cif;
|
|
199
|
-
void** ffiValues;
|
|
200
|
-
ffi_type** ffiParamTypes;
|
|
201
|
-
ffi_type* ffiReturnType;
|
|
202
|
-
Type** paramTypes;
|
|
203
|
-
VALUE* argv;
|
|
204
|
-
VALUE* callbackParameters;
|
|
205
|
-
int paramCount = 0, fixedCount = 0, callbackCount = 0, i;
|
|
206
|
-
ffi_status ffiStatus;
|
|
207
|
-
rbffi_frame_t frame = { 0 };
|
|
208
|
-
|
|
209
|
-
Check_Type(parameterTypes, T_ARRAY);
|
|
210
|
-
Check_Type(parameterValues, T_ARRAY);
|
|
211
|
-
|
|
212
|
-
TypedData_Get_Struct(self, VariadicInvoker, &variadic_data_type, invoker);
|
|
213
|
-
paramCount = (int) RARRAY_LEN(parameterTypes);
|
|
214
|
-
paramTypes = ALLOCA_N(Type *, paramCount);
|
|
215
|
-
ffiParamTypes = ALLOCA_N(ffi_type *, paramCount);
|
|
216
|
-
params = ALLOCA_N(FFIStorage, paramCount);
|
|
217
|
-
ffiValues = ALLOCA_N(void*, paramCount);
|
|
218
|
-
argv = ALLOCA_N(VALUE, paramCount);
|
|
219
|
-
callbackParameters = ALLOCA_N(VALUE, paramCount);
|
|
220
|
-
retval = alloca(MAX(invoker->returnType->ffiType->size, FFI_SIZEOF_ARG));
|
|
221
|
-
|
|
222
|
-
for (i = 0; i < paramCount; ++i) {
|
|
223
|
-
VALUE rbType = rb_ary_entry(parameterTypes, i);
|
|
224
|
-
|
|
225
|
-
if (!rb_obj_is_kind_of(rbType, rbffi_TypeClass)) {
|
|
226
|
-
rb_raise(rb_eTypeError, "wrong type. Expected (FFI::Type)");
|
|
227
|
-
}
|
|
228
|
-
TypedData_Get_Struct(rbType, Type, &rbffi_type_data_type, paramTypes[i]);
|
|
229
|
-
|
|
230
|
-
switch (paramTypes[i]->nativeType) {
|
|
231
|
-
case NATIVE_INT8:
|
|
232
|
-
case NATIVE_INT16:
|
|
233
|
-
case NATIVE_INT32:
|
|
234
|
-
rbType = rb_const_get(rbffi_TypeClass, rb_intern("INT32"));
|
|
235
|
-
TypedData_Get_Struct(rbType, Type, &rbffi_type_data_type, paramTypes[i]);
|
|
236
|
-
break;
|
|
237
|
-
case NATIVE_UINT8:
|
|
238
|
-
case NATIVE_UINT16:
|
|
239
|
-
case NATIVE_UINT32:
|
|
240
|
-
rbType = rb_const_get(rbffi_TypeClass, rb_intern("UINT32"));
|
|
241
|
-
TypedData_Get_Struct(rbType, Type, &rbffi_type_data_type, paramTypes[i]);
|
|
242
|
-
break;
|
|
243
|
-
|
|
244
|
-
case NATIVE_FLOAT32:
|
|
245
|
-
rbType = rb_const_get(rbffi_TypeClass, rb_intern("DOUBLE"));
|
|
246
|
-
TypedData_Get_Struct(rbType, Type, &rbffi_type_data_type, paramTypes[i]);
|
|
247
|
-
break;
|
|
248
|
-
|
|
249
|
-
case NATIVE_FUNCTION:
|
|
250
|
-
if (!rb_obj_is_kind_of(rbType, rbffi_FunctionTypeClass)) {
|
|
251
|
-
VALUE typeName = rb_funcall2(rbType, rb_intern("inspect"), 0, NULL);
|
|
252
|
-
rb_raise(rb_eTypeError, "Incorrect parameter type (%s)", RSTRING_PTR(typeName));
|
|
253
|
-
}
|
|
254
|
-
callbackParameters[callbackCount++] = rbType;
|
|
255
|
-
break;
|
|
256
|
-
|
|
257
|
-
default:
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
ffiParamTypes[i] = paramTypes[i]->ffiType;
|
|
263
|
-
if (ffiParamTypes[i] == NULL) {
|
|
264
|
-
rb_raise(rb_eArgError, "Invalid parameter type #%x", paramTypes[i]->nativeType);
|
|
265
|
-
}
|
|
266
|
-
argv[i] = rb_ary_entry(parameterValues, i);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
ffiReturnType = invoker->returnType->ffiType;
|
|
270
|
-
if (ffiReturnType == NULL) {
|
|
271
|
-
rb_raise(rb_eArgError, "Invalid return type");
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/*Get the number of fixed args from @fixed array*/
|
|
275
|
-
fixedCount = RARRAY_LEN(rb_iv_get(self, "@fixed"));
|
|
276
|
-
|
|
277
|
-
#ifdef HAVE_FFI_PREP_CIF_VAR
|
|
278
|
-
ffiStatus = ffi_prep_cif_var(&cif, invoker->abi, fixedCount, paramCount, ffiReturnType, ffiParamTypes);
|
|
279
|
-
#else
|
|
280
|
-
ffiStatus = ffi_prep_cif(&cif, invoker->abi, paramCount, ffiReturnType, ffiParamTypes);
|
|
281
|
-
#endif
|
|
282
|
-
switch (ffiStatus) {
|
|
283
|
-
case FFI_BAD_ABI:
|
|
284
|
-
rb_raise(rb_eArgError, "Invalid ABI specified");
|
|
285
|
-
case FFI_BAD_TYPEDEF:
|
|
286
|
-
rb_raise(rb_eArgError, "Invalid argument type specified");
|
|
287
|
-
case FFI_OK:
|
|
288
|
-
break;
|
|
289
|
-
default:
|
|
290
|
-
rb_raise(rb_eArgError, "Unknown FFI error");
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
rbffi_SetupCallParams(paramCount, argv, -1, paramTypes, params,
|
|
294
|
-
ffiValues, callbackParameters, callbackCount, invoker->rbEnums);
|
|
295
|
-
|
|
296
|
-
rbffi_frame_push(&frame);
|
|
297
|
-
|
|
298
|
-
if(unlikely(invoker->blocking)) {
|
|
299
|
-
rbffi_blocking_call_t* bc;
|
|
300
|
-
bc = ALLOCA_N(rbffi_blocking_call_t, 1);
|
|
301
|
-
bc->retval = retval;
|
|
302
|
-
bc->function = invoker->function;
|
|
303
|
-
bc->ffiValues = ffiValues;
|
|
304
|
-
bc->params = params;
|
|
305
|
-
bc->frame = &frame;
|
|
306
|
-
bc->cif = cif;
|
|
307
|
-
|
|
308
|
-
rb_rescue2(rbffi_do_blocking_call, (VALUE) bc, rbffi_save_frame_exception, (VALUE) &frame, rb_eException, (VALUE) 0);
|
|
309
|
-
} else {
|
|
310
|
-
ffi_call(&cif, FFI_FN(invoker->function), retval, ffiValues);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
rbffi_frame_pop(&frame);
|
|
314
|
-
|
|
315
|
-
rbffi_save_errno();
|
|
316
|
-
|
|
317
|
-
if (RTEST(frame.exc) && frame.exc != Qnil) {
|
|
318
|
-
rb_exc_raise(frame.exc);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
return rbffi_NativeValue_ToRuby(invoker->returnType, invoker->rbReturnType, retval);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
static VALUE
|
|
325
|
-
variadic_return_type(VALUE self)
|
|
326
|
-
{
|
|
327
|
-
VariadicInvoker* invoker;
|
|
328
|
-
|
|
329
|
-
TypedData_Get_Struct(self, VariadicInvoker, &variadic_data_type, invoker);
|
|
330
|
-
return invoker->rbReturnType;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
void
|
|
334
|
-
rbffi_Variadic_Init(VALUE moduleFFI)
|
|
335
|
-
{
|
|
336
|
-
classVariadicInvoker = rb_define_class_under(moduleFFI, "VariadicInvoker", rb_cObject);
|
|
337
|
-
rb_global_variable(&classVariadicInvoker);
|
|
338
|
-
|
|
339
|
-
rb_define_alloc_func(classVariadicInvoker, variadic_allocate);
|
|
340
|
-
|
|
341
|
-
rb_define_method(classVariadicInvoker, "initialize", variadic_initialize, 4);
|
|
342
|
-
rb_define_method(classVariadicInvoker, "invoke", variadic_invoke, 2);
|
|
343
|
-
rb_define_method(classVariadicInvoker, "return_type", variadic_return_type, 0);
|
|
344
|
-
}
|
|
345
|
-
|
data/ext/ffi_c/compat.h
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2008, 2009, Wayne Meissner
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2008-2013, Ruby FFI project contributors
|
|
5
|
-
* All rights reserved.
|
|
6
|
-
*
|
|
7
|
-
* Redistribution and use in source and binary forms, with or without
|
|
8
|
-
* modification, are permitted provided that the following conditions are met:
|
|
9
|
-
* * Redistributions of source code must retain the above copyright
|
|
10
|
-
* notice, this list of conditions and the following disclaimer.
|
|
11
|
-
* * Redistributions in binary form must reproduce the above copyright
|
|
12
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
13
|
-
* documentation and/or other materials provided with the distribution.
|
|
14
|
-
* * Neither the name of the Ruby FFI project nor the
|
|
15
|
-
* names of its contributors may be used to endorse or promote products
|
|
16
|
-
* derived from this software without specific prior written permission.
|
|
17
|
-
*
|
|
18
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
19
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
20
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
-
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
22
|
-
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
23
|
-
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24
|
-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
25
|
-
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
27
|
-
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
#ifndef RBFFI_COMPAT_H
|
|
31
|
-
#define RBFFI_COMPAT_H
|
|
32
|
-
|
|
33
|
-
#include <ruby.h>
|
|
34
|
-
|
|
35
|
-
#ifndef roundup
|
|
36
|
-
# define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
|
|
37
|
-
#endif
|
|
38
|
-
|
|
39
|
-
#ifdef __GNUC__
|
|
40
|
-
# define likely(x) __builtin_expect((x), 1)
|
|
41
|
-
# define unlikely(x) __builtin_expect((x), 0)
|
|
42
|
-
#else
|
|
43
|
-
# define likely(x) (x)
|
|
44
|
-
# define unlikely(x) (x)
|
|
45
|
-
#endif
|
|
46
|
-
|
|
47
|
-
#ifdef _MSC_VER
|
|
48
|
-
#define ffi_type_longdouble ffi_type_double
|
|
49
|
-
#endif
|
|
50
|
-
|
|
51
|
-
#ifndef MAX
|
|
52
|
-
# define MAX(a, b) ((a) < (b) ? (b) : (a))
|
|
53
|
-
#endif
|
|
54
|
-
#ifndef MIN
|
|
55
|
-
# define MIN(a, b) ((a) < (b) ? (a) : (b))
|
|
56
|
-
#endif
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/* For compatibility with ruby < 2.7 */
|
|
61
|
-
#ifdef HAVE_RB_GC_MARK_MOVABLE
|
|
62
|
-
#define ffi_compact_callback(x) .dcompact = (x),
|
|
63
|
-
#define ffi_gc_location(x) x = rb_gc_location(x)
|
|
64
|
-
#else
|
|
65
|
-
#define rb_gc_mark_movable(x) rb_gc_mark(x)
|
|
66
|
-
#define ffi_compact_callback(x)
|
|
67
|
-
#define ffi_gc_location(x)
|
|
68
|
-
#endif
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/* For compatibility with ruby < 3.0 */
|
|
72
|
-
#ifndef RUBY_TYPED_FROZEN_SHAREABLE
|
|
73
|
-
#define FFI_RUBY_TYPED_FROZEN_SHAREABLE 0
|
|
74
|
-
#else
|
|
75
|
-
#define FFI_RUBY_TYPED_FROZEN_SHAREABLE RUBY_TYPED_FROZEN_SHAREABLE
|
|
76
|
-
#endif
|
|
77
|
-
|
|
78
|
-
#ifndef HAVE_RB_EXT_RACTOR_SAFE
|
|
79
|
-
#define rb_ractor_make_shareable(self) rb_obj_freeze(self);
|
|
80
|
-
#endif
|
|
81
|
-
|
|
82
|
-
#endif /* RBFFI_COMPAT_H */
|