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/Thread.c
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2010 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
|
-
#include <stddef.h>
|
|
31
|
-
#include <stdbool.h>
|
|
32
|
-
|
|
33
|
-
#if defined(__CYGWIN__) || !defined(_WIN32)
|
|
34
|
-
# include <pthread.h>
|
|
35
|
-
# include <errno.h>
|
|
36
|
-
# include <signal.h>
|
|
37
|
-
# include <unistd.h>
|
|
38
|
-
#else
|
|
39
|
-
# include <winsock2.h>
|
|
40
|
-
# define _WINSOCKAPI_
|
|
41
|
-
# include <windows.h>
|
|
42
|
-
#endif
|
|
43
|
-
#include <fcntl.h>
|
|
44
|
-
#include "Thread.h"
|
|
45
|
-
|
|
46
|
-
#ifdef _WIN32
|
|
47
|
-
static volatile DWORD frame_thread_key = TLS_OUT_OF_INDEXES;
|
|
48
|
-
#else
|
|
49
|
-
static pthread_key_t thread_data_key;
|
|
50
|
-
struct thread_data {
|
|
51
|
-
rbffi_frame_t* frame;
|
|
52
|
-
};
|
|
53
|
-
static inline struct thread_data* thread_data_get(void);
|
|
54
|
-
|
|
55
|
-
#endif
|
|
56
|
-
|
|
57
|
-
rbffi_frame_t*
|
|
58
|
-
rbffi_frame_current(void)
|
|
59
|
-
{
|
|
60
|
-
#ifdef _WIN32
|
|
61
|
-
return (rbffi_frame_t *) TlsGetValue(frame_thread_key);
|
|
62
|
-
#else
|
|
63
|
-
struct thread_data* td = (struct thread_data *) pthread_getspecific(thread_data_key);
|
|
64
|
-
return td != NULL ? td->frame : NULL;
|
|
65
|
-
#endif
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
void
|
|
69
|
-
rbffi_frame_push(rbffi_frame_t* frame)
|
|
70
|
-
{
|
|
71
|
-
memset(frame, 0, sizeof(*frame));
|
|
72
|
-
frame->exc = Qnil;
|
|
73
|
-
|
|
74
|
-
#ifdef _WIN32
|
|
75
|
-
frame->prev = TlsGetValue(frame_thread_key);
|
|
76
|
-
TlsSetValue(frame_thread_key, frame);
|
|
77
|
-
#else
|
|
78
|
-
frame->td = thread_data_get();
|
|
79
|
-
frame->prev = frame->td->frame;
|
|
80
|
-
frame->td->frame = frame;
|
|
81
|
-
#endif
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
void
|
|
85
|
-
rbffi_frame_pop(rbffi_frame_t* frame)
|
|
86
|
-
{
|
|
87
|
-
#ifdef _WIN32
|
|
88
|
-
TlsSetValue(frame_thread_key, frame->prev);
|
|
89
|
-
#else
|
|
90
|
-
frame->td->frame = frame->prev;
|
|
91
|
-
#endif
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
#ifndef _WIN32
|
|
95
|
-
static struct thread_data* thread_data_init(void);
|
|
96
|
-
|
|
97
|
-
static inline struct thread_data*
|
|
98
|
-
thread_data_get(void)
|
|
99
|
-
{
|
|
100
|
-
struct thread_data* td = (struct thread_data *) pthread_getspecific(thread_data_key);
|
|
101
|
-
return td != NULL ? td : thread_data_init();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
static struct thread_data*
|
|
105
|
-
thread_data_init(void)
|
|
106
|
-
{
|
|
107
|
-
struct thread_data* td = calloc(1, sizeof(struct thread_data));
|
|
108
|
-
|
|
109
|
-
pthread_setspecific(thread_data_key, td);
|
|
110
|
-
|
|
111
|
-
return td;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
static void
|
|
115
|
-
thread_data_free(void *ptr)
|
|
116
|
-
{
|
|
117
|
-
free(ptr);
|
|
118
|
-
}
|
|
119
|
-
#endif
|
|
120
|
-
|
|
121
|
-
void
|
|
122
|
-
rbffi_Thread_Init(VALUE moduleFFI)
|
|
123
|
-
{
|
|
124
|
-
#ifdef _WIN32
|
|
125
|
-
frame_thread_key = TlsAlloc();
|
|
126
|
-
#else
|
|
127
|
-
pthread_key_create(&thread_data_key, thread_data_free);
|
|
128
|
-
#endif
|
|
129
|
-
}
|
data/ext/ffi_c/Thread.h
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2010 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_THREAD_H
|
|
31
|
-
#define RBFFI_THREAD_H
|
|
32
|
-
|
|
33
|
-
#include <stdbool.h>
|
|
34
|
-
#include <ruby.h>
|
|
35
|
-
#include "extconf.h"
|
|
36
|
-
|
|
37
|
-
#ifdef __cplusplus
|
|
38
|
-
extern "C" {
|
|
39
|
-
#endif
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
#ifdef _WIN32
|
|
43
|
-
# include <windows.h>
|
|
44
|
-
#else
|
|
45
|
-
# include <pthread.h>
|
|
46
|
-
#endif
|
|
47
|
-
|
|
48
|
-
typedef struct {
|
|
49
|
-
#ifdef _WIN32
|
|
50
|
-
DWORD id;
|
|
51
|
-
#else
|
|
52
|
-
pthread_t id;
|
|
53
|
-
#endif
|
|
54
|
-
bool valid;
|
|
55
|
-
bool has_gvl;
|
|
56
|
-
VALUE exc;
|
|
57
|
-
} rbffi_thread_t;
|
|
58
|
-
|
|
59
|
-
typedef struct rbffi_frame {
|
|
60
|
-
#ifndef _WIN32
|
|
61
|
-
struct thread_data* td;
|
|
62
|
-
#endif
|
|
63
|
-
struct rbffi_frame* prev;
|
|
64
|
-
VALUE exc;
|
|
65
|
-
} rbffi_frame_t;
|
|
66
|
-
|
|
67
|
-
rbffi_frame_t* rbffi_frame_current(void);
|
|
68
|
-
void rbffi_frame_push(rbffi_frame_t* frame);
|
|
69
|
-
void rbffi_frame_pop(rbffi_frame_t* frame);
|
|
70
|
-
|
|
71
|
-
#ifdef __cplusplus
|
|
72
|
-
}
|
|
73
|
-
#endif
|
|
74
|
-
|
|
75
|
-
#endif /* RBFFI_THREAD_H */
|
|
76
|
-
|
data/ext/ffi_c/Type.c
DELETED
|
@@ -1,447 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 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 _MSC_VER
|
|
31
|
-
# include <sys/param.h>
|
|
32
|
-
#endif
|
|
33
|
-
|
|
34
|
-
#include <sys/types.h>
|
|
35
|
-
#include <ruby.h>
|
|
36
|
-
#if HAVE_RB_EXT_RACTOR_SAFE
|
|
37
|
-
#include <ruby/ractor.h>
|
|
38
|
-
#endif
|
|
39
|
-
#include <ffi.h>
|
|
40
|
-
#include "rbffi.h"
|
|
41
|
-
#include "compat.h"
|
|
42
|
-
#include "Types.h"
|
|
43
|
-
#include "Type.h"
|
|
44
|
-
|
|
45
|
-
static size_t type_memsize(const void *);
|
|
46
|
-
|
|
47
|
-
typedef struct BuiltinType_ {
|
|
48
|
-
Type type;
|
|
49
|
-
const char* name;
|
|
50
|
-
} BuiltinType;
|
|
51
|
-
|
|
52
|
-
static size_t builtin_type_memsize(const void *);
|
|
53
|
-
|
|
54
|
-
VALUE rbffi_TypeClass = Qnil;
|
|
55
|
-
|
|
56
|
-
static VALUE classBuiltinType = Qnil;
|
|
57
|
-
static VALUE moduleNativeType = Qnil;
|
|
58
|
-
static VALUE typeMap = Qnil;
|
|
59
|
-
static ID id_type_size = 0, id_size = 0;
|
|
60
|
-
#if HAVE_RB_EXT_RACTOR_SAFE
|
|
61
|
-
static rb_ractor_local_key_t custom_typedefs_key;
|
|
62
|
-
#endif
|
|
63
|
-
|
|
64
|
-
const rb_data_type_t rbffi_type_data_type = { /* extern */
|
|
65
|
-
.wrap_struct_name = "FFI::Type",
|
|
66
|
-
.function = {
|
|
67
|
-
.dmark = NULL,
|
|
68
|
-
.dfree = RUBY_TYPED_DEFAULT_FREE,
|
|
69
|
-
.dsize = type_memsize,
|
|
70
|
-
},
|
|
71
|
-
// IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
|
|
72
|
-
// macro to update VALUE references, as to trigger write barriers.
|
|
73
|
-
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | FFI_RUBY_TYPED_FROZEN_SHAREABLE
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
static const rb_data_type_t builtin_type_data_type = {
|
|
77
|
-
.wrap_struct_name = "FFI::Type::Builtin",
|
|
78
|
-
.function = {
|
|
79
|
-
.dmark = NULL,
|
|
80
|
-
.dfree = RUBY_TYPED_DEFAULT_FREE,
|
|
81
|
-
.dsize = builtin_type_memsize,
|
|
82
|
-
},
|
|
83
|
-
.parent = &rbffi_type_data_type,
|
|
84
|
-
// IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
|
|
85
|
-
// macro to update VALUE references, as to trigger write barriers.
|
|
86
|
-
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | FFI_RUBY_TYPED_FROZEN_SHAREABLE
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
static size_t
|
|
90
|
-
type_memsize(const void *data)
|
|
91
|
-
{
|
|
92
|
-
return sizeof(Type);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
static VALUE
|
|
96
|
-
type_allocate(VALUE klass)
|
|
97
|
-
{
|
|
98
|
-
Type* type;
|
|
99
|
-
VALUE obj = TypedData_Make_Struct(klass, Type, &rbffi_type_data_type, type);
|
|
100
|
-
|
|
101
|
-
type->nativeType = -1;
|
|
102
|
-
type->ffiType = &ffi_type_void;
|
|
103
|
-
|
|
104
|
-
return obj;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/*
|
|
108
|
-
* Document-method: initialize
|
|
109
|
-
* call-seq: initialize(value)
|
|
110
|
-
* @param [Fixnum,Type] value
|
|
111
|
-
* @return [self]
|
|
112
|
-
*/
|
|
113
|
-
static VALUE
|
|
114
|
-
type_initialize(VALUE self, VALUE value)
|
|
115
|
-
{
|
|
116
|
-
Type* type;
|
|
117
|
-
Type* other;
|
|
118
|
-
|
|
119
|
-
TypedData_Get_Struct(self, Type, &rbffi_type_data_type, type);
|
|
120
|
-
|
|
121
|
-
if (FIXNUM_P(value)) {
|
|
122
|
-
type->nativeType = FIX2INT(value);
|
|
123
|
-
} else if (rb_obj_is_kind_of(value, rbffi_TypeClass)) {
|
|
124
|
-
TypedData_Get_Struct(value, Type, &rbffi_type_data_type, other);
|
|
125
|
-
type->nativeType = other->nativeType;
|
|
126
|
-
type->ffiType = other->ffiType;
|
|
127
|
-
} else {
|
|
128
|
-
rb_raise(rb_eArgError, "wrong type");
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
rb_obj_freeze(self);
|
|
132
|
-
|
|
133
|
-
return self;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/*
|
|
137
|
-
* call-seq: type.size
|
|
138
|
-
* @return [Fixnum]
|
|
139
|
-
* Return type's size, in bytes.
|
|
140
|
-
*/
|
|
141
|
-
static VALUE
|
|
142
|
-
type_size(VALUE self)
|
|
143
|
-
{
|
|
144
|
-
Type *type;
|
|
145
|
-
|
|
146
|
-
TypedData_Get_Struct(self, Type, &rbffi_type_data_type, type);
|
|
147
|
-
|
|
148
|
-
return INT2FIX(type->ffiType->size);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/*
|
|
152
|
-
* call-seq: type.alignment
|
|
153
|
-
* @return [Fixnum]
|
|
154
|
-
* Get Type alignment.
|
|
155
|
-
*/
|
|
156
|
-
static VALUE
|
|
157
|
-
type_alignment(VALUE self)
|
|
158
|
-
{
|
|
159
|
-
Type *type;
|
|
160
|
-
|
|
161
|
-
TypedData_Get_Struct(self, Type, &rbffi_type_data_type, type);
|
|
162
|
-
|
|
163
|
-
return INT2FIX(type->ffiType->alignment);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/*
|
|
167
|
-
* call-seq: type.inspect
|
|
168
|
-
* @return [String]
|
|
169
|
-
* Inspect {Type} object.
|
|
170
|
-
*/
|
|
171
|
-
static VALUE
|
|
172
|
-
type_inspect(VALUE self)
|
|
173
|
-
{
|
|
174
|
-
char buf[100];
|
|
175
|
-
Type *type;
|
|
176
|
-
|
|
177
|
-
TypedData_Get_Struct(self, Type, &rbffi_type_data_type, type);
|
|
178
|
-
|
|
179
|
-
snprintf(buf, sizeof(buf), "#<%s::%p size=%d alignment=%d>",
|
|
180
|
-
rb_obj_classname(self), type, (int) type->ffiType->size, (int) type->ffiType->alignment);
|
|
181
|
-
|
|
182
|
-
return rb_str_new2(buf);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
static VALUE
|
|
186
|
-
builtin_type_new(VALUE klass, int nativeType, ffi_type* ffiType, const char* name)
|
|
187
|
-
{
|
|
188
|
-
BuiltinType* type;
|
|
189
|
-
VALUE obj = Qnil;
|
|
190
|
-
|
|
191
|
-
obj = TypedData_Make_Struct(klass, BuiltinType, &builtin_type_data_type, type);
|
|
192
|
-
|
|
193
|
-
type->name = name;
|
|
194
|
-
type->type.nativeType = nativeType;
|
|
195
|
-
type->type.ffiType = ffiType;
|
|
196
|
-
|
|
197
|
-
rb_obj_freeze(obj);
|
|
198
|
-
|
|
199
|
-
return obj;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
static size_t
|
|
203
|
-
builtin_type_memsize(const void *data)
|
|
204
|
-
{
|
|
205
|
-
return sizeof(BuiltinType) + sizeof(ffi_type);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/*
|
|
209
|
-
* call-seq: type.inspect
|
|
210
|
-
* @return [String]
|
|
211
|
-
* Inspect {Type::Builtin} object.
|
|
212
|
-
*/
|
|
213
|
-
static VALUE
|
|
214
|
-
builtin_type_inspect(VALUE self)
|
|
215
|
-
{
|
|
216
|
-
char buf[100];
|
|
217
|
-
BuiltinType *type;
|
|
218
|
-
|
|
219
|
-
TypedData_Get_Struct(self, BuiltinType, &builtin_type_data_type, type);
|
|
220
|
-
snprintf(buf, sizeof(buf), "#<%s::%s size=%d alignment=%d>",
|
|
221
|
-
rb_obj_classname(self), type->name, (int) type->type.ffiType->size, type->type.ffiType->alignment);
|
|
222
|
-
|
|
223
|
-
return rb_str_new2(buf);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
int
|
|
227
|
-
rbffi_type_size(VALUE type)
|
|
228
|
-
{
|
|
229
|
-
int t = TYPE(type);
|
|
230
|
-
|
|
231
|
-
if (t == T_FIXNUM || t == T_BIGNUM) {
|
|
232
|
-
return NUM2INT(type);
|
|
233
|
-
|
|
234
|
-
} else if (t == T_SYMBOL) {
|
|
235
|
-
/*
|
|
236
|
-
* Try looking up directly in the type map
|
|
237
|
-
*/
|
|
238
|
-
VALUE nType;
|
|
239
|
-
if ((nType = rb_hash_lookup(typeMap, type)) != Qnil) {
|
|
240
|
-
if (rb_obj_is_kind_of(nType, rbffi_TypeClass)) {
|
|
241
|
-
Type* type;
|
|
242
|
-
TypedData_Get_Struct(nType, Type, &rbffi_type_data_type, type);
|
|
243
|
-
return (int) type->ffiType->size;
|
|
244
|
-
|
|
245
|
-
} else if (rb_respond_to(nType, id_size)) {
|
|
246
|
-
return NUM2INT(rb_funcall2(nType, id_size, 0, NULL));
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/* Not found - call up to the ruby version to resolve */
|
|
251
|
-
return NUM2INT(rb_funcall2(rbffi_FFIModule, id_type_size, 1, &type));
|
|
252
|
-
|
|
253
|
-
} else {
|
|
254
|
-
return NUM2INT(rb_funcall2(type, id_size, 0, NULL));
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
static VALUE
|
|
259
|
-
custom_typedefs(VALUE self)
|
|
260
|
-
{
|
|
261
|
-
#if HAVE_RB_EXT_RACTOR_SAFE
|
|
262
|
-
VALUE hash = rb_ractor_local_storage_value(custom_typedefs_key);
|
|
263
|
-
if (hash == Qnil) {
|
|
264
|
-
hash = rb_hash_new();
|
|
265
|
-
rb_ractor_local_storage_value_set(custom_typedefs_key, hash);
|
|
266
|
-
}
|
|
267
|
-
#else
|
|
268
|
-
static VALUE hash = Qundef;
|
|
269
|
-
if (hash == Qundef) {
|
|
270
|
-
rb_global_variable(&hash);
|
|
271
|
-
hash = rb_hash_new();
|
|
272
|
-
}
|
|
273
|
-
#endif
|
|
274
|
-
return hash;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
VALUE
|
|
278
|
-
rbffi_Type_Lookup(VALUE name)
|
|
279
|
-
{
|
|
280
|
-
int t = TYPE(name);
|
|
281
|
-
if (t == T_SYMBOL || t == T_STRING) {
|
|
282
|
-
/*
|
|
283
|
-
* Try looking up directly in the type map
|
|
284
|
-
*/
|
|
285
|
-
VALUE nType;
|
|
286
|
-
VALUE cust = custom_typedefs(Qnil);
|
|
287
|
-
|
|
288
|
-
if ((nType = rb_hash_lookup(cust, name)) != Qnil && rb_obj_is_kind_of(nType, rbffi_TypeClass)) {
|
|
289
|
-
return nType;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
if ((nType = rb_hash_lookup(typeMap, name)) != Qnil && rb_obj_is_kind_of(nType, rbffi_TypeClass)) {
|
|
293
|
-
return nType;
|
|
294
|
-
}
|
|
295
|
-
} else if (rb_obj_is_kind_of(name, rbffi_TypeClass)) {
|
|
296
|
-
|
|
297
|
-
return name;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/* Nothing found - let caller handle raising exceptions */
|
|
301
|
-
return Qnil;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
void
|
|
305
|
-
rbffi_Type_Init(VALUE moduleFFI)
|
|
306
|
-
{
|
|
307
|
-
/*
|
|
308
|
-
* Document-class: FFI::Type
|
|
309
|
-
* This class manages C types.
|
|
310
|
-
*
|
|
311
|
-
* It embbed {FFI::Type::Builtin} objects as constants (for names,
|
|
312
|
-
* see {FFI::NativeType}).
|
|
313
|
-
*/
|
|
314
|
-
rbffi_TypeClass = rb_define_class_under(moduleFFI, "Type", rb_cObject);
|
|
315
|
-
|
|
316
|
-
/*
|
|
317
|
-
* Document-constant: FFI::TypeDefs
|
|
318
|
-
*/
|
|
319
|
-
rb_define_const(moduleFFI, "TypeDefs", typeMap = rb_hash_new());
|
|
320
|
-
rb_global_variable(&typeMap);
|
|
321
|
-
id_type_size = rb_intern("type_size");
|
|
322
|
-
id_size = rb_intern("size");
|
|
323
|
-
|
|
324
|
-
#if HAVE_RB_EXT_RACTOR_SAFE
|
|
325
|
-
custom_typedefs_key = rb_ractor_local_storage_value_newkey();
|
|
326
|
-
#endif
|
|
327
|
-
rb_define_module_function(moduleFFI, "custom_typedefs", custom_typedefs, 0);
|
|
328
|
-
|
|
329
|
-
/*
|
|
330
|
-
* Document-class: FFI::Type::Builtin
|
|
331
|
-
* Class for Built-in types.
|
|
332
|
-
*/
|
|
333
|
-
classBuiltinType = rb_define_class_under(rbffi_TypeClass, "Builtin", rbffi_TypeClass);
|
|
334
|
-
/*
|
|
335
|
-
* Document-module: FFI::NativeType
|
|
336
|
-
* This module defines constants for native (C) types.
|
|
337
|
-
*
|
|
338
|
-
* ==Native type constants
|
|
339
|
-
* Native types are defined by constants :
|
|
340
|
-
* * INT8, SCHAR, CHAR
|
|
341
|
-
* * UINT8, UCHAR
|
|
342
|
-
* * INT16, SHORT, SSHORT
|
|
343
|
-
* * UINT16, USHORT
|
|
344
|
-
* * INT32,, INT, SINT
|
|
345
|
-
* * UINT32, UINT
|
|
346
|
-
* * INT64, LONG_LONG, SLONG_LONG
|
|
347
|
-
* * UINT64, ULONG_LONG
|
|
348
|
-
* * LONG, SLONG
|
|
349
|
-
* * ULONG
|
|
350
|
-
* * FLOAT32, FLOAT
|
|
351
|
-
* * FLOAT64, DOUBLE
|
|
352
|
-
* * POINTER
|
|
353
|
-
* * CALLBACK
|
|
354
|
-
* * FUNCTION
|
|
355
|
-
* * CHAR_ARRAY
|
|
356
|
-
* * BOOL
|
|
357
|
-
* * STRING (immutable string, nul terminated)
|
|
358
|
-
* * STRUCT (struct-b-value param or result)
|
|
359
|
-
* * ARRAY (array type definition)
|
|
360
|
-
* * MAPPED (custom native type)
|
|
361
|
-
* For function return type only :
|
|
362
|
-
* * VOID
|
|
363
|
-
* For function argument type only :
|
|
364
|
-
* * BUFFER_IN
|
|
365
|
-
* * BUFFER_OUT
|
|
366
|
-
* * VARARGS (function takes a variable number of arguments)
|
|
367
|
-
*
|
|
368
|
-
* All these constants are exported to {FFI} module prefixed with "TYPE_".
|
|
369
|
-
* They are objets from {FFI::Type::Builtin} class.
|
|
370
|
-
*/
|
|
371
|
-
moduleNativeType = rb_define_module_under(moduleFFI, "NativeType");
|
|
372
|
-
|
|
373
|
-
/*
|
|
374
|
-
* Document-global: FFI::Type
|
|
375
|
-
*/
|
|
376
|
-
rb_global_variable(&rbffi_TypeClass);
|
|
377
|
-
rb_global_variable(&classBuiltinType);
|
|
378
|
-
rb_global_variable(&moduleNativeType);
|
|
379
|
-
|
|
380
|
-
rb_define_alloc_func(rbffi_TypeClass, type_allocate);
|
|
381
|
-
rb_define_method(rbffi_TypeClass, "initialize", type_initialize, 1);
|
|
382
|
-
rb_define_method(rbffi_TypeClass, "size", type_size, 0);
|
|
383
|
-
rb_define_method(rbffi_TypeClass, "alignment", type_alignment, 0);
|
|
384
|
-
rb_define_method(rbffi_TypeClass, "inspect", type_inspect, 0);
|
|
385
|
-
|
|
386
|
-
/* Make Type::Builtin non-allocatable */
|
|
387
|
-
rb_undef_method(CLASS_OF(classBuiltinType), "new");
|
|
388
|
-
rb_define_method(classBuiltinType, "inspect", builtin_type_inspect, 0);
|
|
389
|
-
|
|
390
|
-
rb_global_variable(&rbffi_TypeClass);
|
|
391
|
-
rb_global_variable(&classBuiltinType);
|
|
392
|
-
|
|
393
|
-
/* Define all the builtin types */
|
|
394
|
-
#define T(x, ffiType) do { \
|
|
395
|
-
VALUE t = Qnil; \
|
|
396
|
-
rb_define_const(rbffi_TypeClass, #x, t = builtin_type_new(classBuiltinType, NATIVE_##x, ffiType, #x)); \
|
|
397
|
-
rb_define_const(moduleNativeType, #x, t); \
|
|
398
|
-
rb_define_const(moduleFFI, "TYPE_" #x, t); \
|
|
399
|
-
} while(0)
|
|
400
|
-
|
|
401
|
-
#define A(old_type, new_type) do { \
|
|
402
|
-
VALUE t = rb_const_get(rbffi_TypeClass, rb_intern(#old_type)); \
|
|
403
|
-
rb_const_set(rbffi_TypeClass, rb_intern(#new_type), t); \
|
|
404
|
-
} while(0)
|
|
405
|
-
|
|
406
|
-
/*
|
|
407
|
-
* Document-constant: FFI::Type::Builtin::VOID
|
|
408
|
-
*/
|
|
409
|
-
T(VOID, &ffi_type_void);
|
|
410
|
-
T(INT8, &ffi_type_sint8);
|
|
411
|
-
A(INT8, SCHAR);
|
|
412
|
-
A(INT8, CHAR);
|
|
413
|
-
T(UINT8, &ffi_type_uint8);
|
|
414
|
-
A(UINT8, UCHAR);
|
|
415
|
-
|
|
416
|
-
T(INT16, &ffi_type_sint16);
|
|
417
|
-
A(INT16, SHORT);
|
|
418
|
-
A(INT16, SSHORT);
|
|
419
|
-
T(UINT16, &ffi_type_uint16);
|
|
420
|
-
A(UINT16, USHORT);
|
|
421
|
-
T(INT32, &ffi_type_sint32);
|
|
422
|
-
A(INT32, INT);
|
|
423
|
-
A(INT32, SINT);
|
|
424
|
-
T(UINT32, &ffi_type_uint32);
|
|
425
|
-
A(UINT32, UINT);
|
|
426
|
-
T(INT64, &ffi_type_sint64);
|
|
427
|
-
A(INT64, LONG_LONG);
|
|
428
|
-
A(INT64, SLONG_LONG);
|
|
429
|
-
T(UINT64, &ffi_type_uint64);
|
|
430
|
-
A(UINT64, ULONG_LONG);
|
|
431
|
-
T(LONG, &ffi_type_slong);
|
|
432
|
-
A(LONG, SLONG);
|
|
433
|
-
T(ULONG, &ffi_type_ulong);
|
|
434
|
-
T(FLOAT32, &ffi_type_float);
|
|
435
|
-
A(FLOAT32, FLOAT);
|
|
436
|
-
T(FLOAT64, &ffi_type_double);
|
|
437
|
-
A(FLOAT64, DOUBLE);
|
|
438
|
-
T(LONGDOUBLE, &ffi_type_longdouble);
|
|
439
|
-
T(POINTER, &ffi_type_pointer);
|
|
440
|
-
T(STRING, &ffi_type_pointer);
|
|
441
|
-
T(BUFFER_IN, &ffi_type_pointer);
|
|
442
|
-
T(BUFFER_OUT, &ffi_type_pointer);
|
|
443
|
-
T(BUFFER_INOUT, &ffi_type_pointer);
|
|
444
|
-
T(BOOL, &ffi_type_uchar);
|
|
445
|
-
T(VARARGS, &ffi_type_void);
|
|
446
|
-
}
|
|
447
|
-
|
data/ext/ffi_c/Type.h
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2009, Wayne Meissner
|
|
3
|
-
* Copyright (C) 2009 Luc Heinrich <luc@honk-honk.com>
|
|
4
|
-
*
|
|
5
|
-
* This file is part of ruby-ffi.
|
|
6
|
-
*
|
|
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
|
-
*
|
|
12
|
-
* * Redistributions of source code must retain the above copyright notice, this
|
|
13
|
-
* list of conditions and the following disclaimer.
|
|
14
|
-
* * Redistributions in binary form must reproduce the above copyright notice
|
|
15
|
-
* this list of conditions and the following disclaimer in the documentation
|
|
16
|
-
* and/or other materials provided with the distribution.
|
|
17
|
-
* * Neither the name of the Evan Phoenix nor the names of its contributors
|
|
18
|
-
* may be used to endorse or promote products derived from this software
|
|
19
|
-
* without specific prior written permission.
|
|
20
|
-
*
|
|
21
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
22
|
-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
25
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
27
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
28
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
29
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
#ifndef RBFFI_TYPE_H
|
|
35
|
-
#define RBFFI_TYPE_H
|
|
36
|
-
|
|
37
|
-
#include <ruby.h>
|
|
38
|
-
#include <ffi.h>
|
|
39
|
-
|
|
40
|
-
#ifdef __cplusplus
|
|
41
|
-
extern "C" {
|
|
42
|
-
#endif
|
|
43
|
-
|
|
44
|
-
typedef struct Type_ Type;
|
|
45
|
-
|
|
46
|
-
#include "Types.h"
|
|
47
|
-
|
|
48
|
-
struct Type_ {
|
|
49
|
-
NativeType nativeType;
|
|
50
|
-
ffi_type* ffiType;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
extern VALUE rbffi_TypeClass;
|
|
54
|
-
extern VALUE rbffi_Type_Lookup(VALUE type);
|
|
55
|
-
|
|
56
|
-
extern const rb_data_type_t rbffi_type_data_type;
|
|
57
|
-
|
|
58
|
-
#ifdef __cplusplus
|
|
59
|
-
}
|
|
60
|
-
#endif
|
|
61
|
-
|
|
62
|
-
#endif /* RBFFI_TYPE_H */
|
|
63
|
-
|