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.
Files changed (550) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +42 -0
  4. data/Gemfile +9 -2
  5. data/README.md +1 -1
  6. data/Rakefile +17 -5
  7. data/lib/ffi/autopointer.rb +1 -9
  8. data/lib/ffi/dynamic_library.rb +34 -5
  9. data/lib/ffi/enum.rb +0 -1
  10. data/lib/ffi/function.rb +1 -1
  11. data/lib/ffi/io.rb +2 -2
  12. data/lib/ffi/library.rb +23 -23
  13. data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
  14. data/lib/ffi/pointer.rb +6 -6
  15. data/lib/ffi/struct.rb +4 -4
  16. data/lib/ffi/struct_layout.rb +2 -2
  17. data/lib/ffi/struct_layout_builder.rb +8 -8
  18. data/lib/ffi/types.rb +51 -49
  19. data/lib/ffi/version.rb +1 -1
  20. data/sig/ffi/abstract_memory.rbs +165 -0
  21. data/sig/ffi/auto_pointer.rbs +27 -0
  22. data/sig/ffi/buffer.rbs +18 -0
  23. data/sig/ffi/data_converter.rbs +10 -0
  24. data/sig/ffi/dynamic_library.rbs +9 -0
  25. data/sig/ffi/enum.rbs +38 -0
  26. data/sig/ffi/function.rbs +39 -0
  27. data/sig/ffi/library.rbs +42 -0
  28. data/sig/ffi/native_type.rbs +86 -0
  29. data/sig/ffi/pointer.rbs +42 -0
  30. data/sig/ffi/struct.rbs +76 -0
  31. data/sig/ffi/struct_by_reference.rbs +11 -0
  32. data/sig/ffi/struct_by_value.rbs +7 -0
  33. data/sig/ffi/struct_layout.rbs +9 -0
  34. data/sig/ffi/struct_layout_builder.rbs +5 -0
  35. data/sig/ffi/type.rbs +39 -0
  36. data/sig/ffi.rbs +26 -0
  37. data.tar.gz.sig +0 -0
  38. metadata +34 -532
  39. metadata.gz.sig +0 -0
  40. data/ext/ffi_c/AbstractMemory.c +0 -1128
  41. data/ext/ffi_c/AbstractMemory.h +0 -176
  42. data/ext/ffi_c/ArrayType.c +0 -198
  43. data/ext/ffi_c/ArrayType.h +0 -60
  44. data/ext/ffi_c/Buffer.c +0 -417
  45. data/ext/ffi_c/Call.c +0 -498
  46. data/ext/ffi_c/Call.h +0 -107
  47. data/ext/ffi_c/ClosurePool.c +0 -333
  48. data/ext/ffi_c/ClosurePool.h +0 -59
  49. data/ext/ffi_c/DynamicLibrary.c +0 -397
  50. data/ext/ffi_c/DynamicLibrary.h +0 -98
  51. data/ext/ffi_c/Function.c +0 -1063
  52. data/ext/ffi_c/Function.h +0 -84
  53. data/ext/ffi_c/FunctionInfo.c +0 -322
  54. data/ext/ffi_c/LastError.c +0 -243
  55. data/ext/ffi_c/LastError.h +0 -47
  56. data/ext/ffi_c/LongDouble.c +0 -65
  57. data/ext/ffi_c/LongDouble.h +0 -47
  58. data/ext/ffi_c/MappedType.c +0 -211
  59. data/ext/ffi_c/MappedType.h +0 -57
  60. data/ext/ffi_c/MemoryPointer.c +0 -219
  61. data/ext/ffi_c/MemoryPointer.h +0 -49
  62. data/ext/ffi_c/MethodHandle.c +0 -350
  63. data/ext/ffi_c/MethodHandle.h +0 -56
  64. data/ext/ffi_c/Platform.c +0 -78
  65. data/ext/ffi_c/Platform.h +0 -45
  66. data/ext/ffi_c/Pointer.c +0 -546
  67. data/ext/ffi_c/Pointer.h +0 -60
  68. data/ext/ffi_c/Struct.c +0 -897
  69. data/ext/ffi_c/Struct.h +0 -115
  70. data/ext/ffi_c/StructByValue.c +0 -177
  71. data/ext/ffi_c/StructByValue.h +0 -55
  72. data/ext/ffi_c/StructLayout.c +0 -769
  73. data/ext/ffi_c/Thread.c +0 -129
  74. data/ext/ffi_c/Thread.h +0 -76
  75. data/ext/ffi_c/Type.c +0 -447
  76. data/ext/ffi_c/Type.h +0 -63
  77. data/ext/ffi_c/Types.c +0 -138
  78. data/ext/ffi_c/Types.h +0 -88
  79. data/ext/ffi_c/Variadic.c +0 -345
  80. data/ext/ffi_c/compat.h +0 -82
  81. data/ext/ffi_c/extconf.rb +0 -115
  82. data/ext/ffi_c/ffi.c +0 -97
  83. data/ext/ffi_c/libffi/.appveyor/site.exp +0 -16
  84. data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +0 -7
  85. data/ext/ffi_c/libffi/.appveyor.yml +0 -84
  86. data/ext/ffi_c/libffi/.ci/ar-lib +0 -270
  87. data/ext/ffi_c/libffi/.ci/bfin-sim.exp +0 -58
  88. data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +0 -18
  89. data/ext/ffi_c/libffi/.ci/build-in-container.sh +0 -10
  90. data/ext/ffi_c/libffi/.ci/build.sh +0 -124
  91. data/ext/ffi_c/libffi/.ci/compile +0 -351
  92. data/ext/ffi_c/libffi/.ci/install.sh +0 -78
  93. data/ext/ffi_c/libffi/.ci/m32r-sim.exp +0 -58
  94. data/ext/ffi_c/libffi/.ci/moxie-sim.exp +0 -60
  95. data/ext/ffi_c/libffi/.ci/msvs-detect +0 -1103
  96. data/ext/ffi_c/libffi/.ci/or1k-sim.exp +0 -58
  97. data/ext/ffi_c/libffi/.ci/powerpc-eabisim.exp +0 -58
  98. data/ext/ffi_c/libffi/.ci/site.exp +0 -29
  99. data/ext/ffi_c/libffi/.ci/wine-sim.exp +0 -55
  100. data/ext/ffi_c/libffi/.circleci/config.yml +0 -156
  101. data/ext/ffi_c/libffi/.gitattributes +0 -4
  102. data/ext/ffi_c/libffi/.github/issue_template.md +0 -10
  103. data/ext/ffi_c/libffi/.github/workflows/build.yml +0 -460
  104. data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +0 -171
  105. data/ext/ffi_c/libffi/.gitignore +0 -46
  106. data/ext/ffi_c/libffi/ChangeLog.old +0 -7407
  107. data/ext/ffi_c/libffi/LICENSE +0 -21
  108. data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +0 -353
  109. data/ext/ffi_c/libffi/Makefile.am +0 -157
  110. data/ext/ffi_c/libffi/Makefile.in +0 -2127
  111. data/ext/ffi_c/libffi/README.md +0 -526
  112. data/ext/ffi_c/libffi/acinclude.m4 +0 -377
  113. data/ext/ffi_c/libffi/autogen.sh +0 -2
  114. data/ext/ffi_c/libffi/compile +0 -348
  115. data/ext/ffi_c/libffi/config.guess +0 -1754
  116. data/ext/ffi_c/libffi/config.sub +0 -1892
  117. data/ext/ffi_c/libffi/configure +0 -22791
  118. data/ext/ffi_c/libffi/configure.ac +0 -451
  119. data/ext/ffi_c/libffi/configure.host +0 -337
  120. data/ext/ffi_c/libffi/doc/Makefile.am +0 -3
  121. data/ext/ffi_c/libffi/doc/Makefile.in +0 -818
  122. data/ext/ffi_c/libffi/doc/libffi.texi +0 -1046
  123. data/ext/ffi_c/libffi/doc/version.texi +0 -4
  124. data/ext/ffi_c/libffi/fficonfig.h.in +0 -188
  125. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +0 -312
  126. data/ext/ffi_c/libffi/include/Makefile.am +0 -9
  127. data/ext/ffi_c/libffi/include/Makefile.in +0 -609
  128. data/ext/ffi_c/libffi/include/ffi.h.in +0 -527
  129. data/ext/ffi_c/libffi/include/ffi_cfi.h +0 -76
  130. data/ext/ffi_c/libffi/include/ffi_common.h +0 -182
  131. data/ext/ffi_c/libffi/include/tramp.h +0 -45
  132. data/ext/ffi_c/libffi/install-sh +0 -541
  133. data/ext/ffi_c/libffi/libffi.map.in +0 -76
  134. data/ext/ffi_c/libffi/libffi.pc.in +0 -11
  135. data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +0 -997
  136. data/ext/ffi_c/libffi/libtool-ldflags +0 -106
  137. data/ext/ffi_c/libffi/libtool-version +0 -29
  138. data/ext/ffi_c/libffi/ltmain.sh +0 -11448
  139. data/ext/ffi_c/libffi/m4/asmcfi.m4 +0 -13
  140. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +0 -50
  141. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +0 -198
  142. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +0 -158
  143. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +0 -53
  144. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +0 -119
  145. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +0 -49
  146. data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +0 -302
  147. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +0 -267
  148. data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +0 -89
  149. data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +0 -51
  150. data/ext/ffi_c/libffi/m4/ax_require_defined.m4 +0 -37
  151. data/ext/ffi_c/libffi/make_sunver.pl +0 -333
  152. data/ext/ffi_c/libffi/man/Makefile.am +0 -8
  153. data/ext/ffi_c/libffi/man/Makefile.in +0 -565
  154. data/ext/ffi_c/libffi/man/ffi.3 +0 -41
  155. data/ext/ffi_c/libffi/man/ffi_call.3 +0 -103
  156. data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +0 -68
  157. data/ext/ffi_c/libffi/man/ffi_prep_cif_var.3 +0 -73
  158. data/ext/ffi_c/libffi/missing +0 -215
  159. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +0 -33
  160. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +0 -130
  161. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +0 -57
  162. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +0 -4
  163. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +0 -511
  164. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/fficonfig.h +0 -219
  165. data/ext/ffi_c/libffi/msvcc.sh +0 -353
  166. data/ext/ffi_c/libffi/src/aarch64/ffi.c +0 -1129
  167. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +0 -97
  168. data/ext/ffi_c/libffi/src/aarch64/internal.h +0 -100
  169. data/ext/ffi_c/libffi/src/aarch64/sysv.S +0 -543
  170. data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +0 -506
  171. data/ext/ffi_c/libffi/src/alpha/ffi.c +0 -521
  172. data/ext/ffi_c/libffi/src/alpha/ffitarget.h +0 -57
  173. data/ext/ffi_c/libffi/src/alpha/internal.h +0 -23
  174. data/ext/ffi_c/libffi/src/alpha/osf.S +0 -282
  175. data/ext/ffi_c/libffi/src/arc/arcompact.S +0 -210
  176. data/ext/ffi_c/libffi/src/arc/ffi.c +0 -443
  177. data/ext/ffi_c/libffi/src/arc/ffitarget.h +0 -67
  178. data/ext/ffi_c/libffi/src/arm/ffi.c +0 -921
  179. data/ext/ffi_c/libffi/src/arm/ffitarget.h +0 -89
  180. data/ext/ffi_c/libffi/src/arm/internal.h +0 -17
  181. data/ext/ffi_c/libffi/src/arm/sysv.S +0 -456
  182. data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +0 -311
  183. data/ext/ffi_c/libffi/src/avr32/ffi.c +0 -423
  184. data/ext/ffi_c/libffi/src/avr32/ffitarget.h +0 -55
  185. data/ext/ffi_c/libffi/src/avr32/sysv.S +0 -208
  186. data/ext/ffi_c/libffi/src/bfin/ffi.c +0 -196
  187. data/ext/ffi_c/libffi/src/bfin/ffitarget.h +0 -43
  188. data/ext/ffi_c/libffi/src/bfin/sysv.S +0 -179
  189. data/ext/ffi_c/libffi/src/closures.c +0 -1107
  190. data/ext/ffi_c/libffi/src/cris/ffi.c +0 -386
  191. data/ext/ffi_c/libffi/src/cris/ffitarget.h +0 -56
  192. data/ext/ffi_c/libffi/src/cris/sysv.S +0 -215
  193. data/ext/ffi_c/libffi/src/csky/ffi.c +0 -395
  194. data/ext/ffi_c/libffi/src/csky/ffitarget.h +0 -63
  195. data/ext/ffi_c/libffi/src/csky/sysv.S +0 -371
  196. data/ext/ffi_c/libffi/src/debug.c +0 -64
  197. data/ext/ffi_c/libffi/src/dlmalloc.c +0 -5171
  198. data/ext/ffi_c/libffi/src/frv/eabi.S +0 -128
  199. data/ext/ffi_c/libffi/src/frv/ffi.c +0 -292
  200. data/ext/ffi_c/libffi/src/frv/ffitarget.h +0 -62
  201. data/ext/ffi_c/libffi/src/ia64/ffi.c +0 -616
  202. data/ext/ffi_c/libffi/src/ia64/ffitarget.h +0 -56
  203. data/ext/ffi_c/libffi/src/ia64/ia64_flags.h +0 -40
  204. data/ext/ffi_c/libffi/src/ia64/unix.S +0 -585
  205. data/ext/ffi_c/libffi/src/java_raw_api.c +0 -374
  206. data/ext/ffi_c/libffi/src/kvx/asm.h +0 -5
  207. data/ext/ffi_c/libffi/src/kvx/ffi.c +0 -273
  208. data/ext/ffi_c/libffi/src/kvx/ffitarget.h +0 -75
  209. data/ext/ffi_c/libffi/src/kvx/sysv.S +0 -127
  210. data/ext/ffi_c/libffi/src/loongarch64/ffi.c +0 -621
  211. data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +0 -82
  212. data/ext/ffi_c/libffi/src/loongarch64/sysv.S +0 -327
  213. data/ext/ffi_c/libffi/src/m32r/ffi.c +0 -249
  214. data/ext/ffi_c/libffi/src/m32r/ffitarget.h +0 -53
  215. data/ext/ffi_c/libffi/src/m32r/sysv.S +0 -121
  216. data/ext/ffi_c/libffi/src/m68k/ffi.c +0 -362
  217. data/ext/ffi_c/libffi/src/m68k/ffitarget.h +0 -54
  218. data/ext/ffi_c/libffi/src/m68k/sysv.S +0 -357
  219. data/ext/ffi_c/libffi/src/m88k/ffi.c +0 -400
  220. data/ext/ffi_c/libffi/src/m88k/ffitarget.h +0 -49
  221. data/ext/ffi_c/libffi/src/m88k/obsd.S +0 -209
  222. data/ext/ffi_c/libffi/src/metag/ffi.c +0 -330
  223. data/ext/ffi_c/libffi/src/metag/ffitarget.h +0 -53
  224. data/ext/ffi_c/libffi/src/metag/sysv.S +0 -311
  225. data/ext/ffi_c/libffi/src/microblaze/ffi.c +0 -321
  226. data/ext/ffi_c/libffi/src/microblaze/ffitarget.h +0 -53
  227. data/ext/ffi_c/libffi/src/microblaze/sysv.S +0 -302
  228. data/ext/ffi_c/libffi/src/mips/ffi.c +0 -1309
  229. data/ext/ffi_c/libffi/src/mips/ffitarget.h +0 -251
  230. data/ext/ffi_c/libffi/src/mips/n32.S +0 -772
  231. data/ext/ffi_c/libffi/src/mips/o32.S +0 -561
  232. data/ext/ffi_c/libffi/src/moxie/eabi.S +0 -101
  233. data/ext/ffi_c/libffi/src/moxie/ffi.c +0 -310
  234. data/ext/ffi_c/libffi/src/moxie/ffitarget.h +0 -52
  235. data/ext/ffi_c/libffi/src/nios2/ffi.c +0 -304
  236. data/ext/ffi_c/libffi/src/nios2/ffitarget.h +0 -52
  237. data/ext/ffi_c/libffi/src/nios2/sysv.S +0 -136
  238. data/ext/ffi_c/libffi/src/or1k/ffi.c +0 -341
  239. data/ext/ffi_c/libffi/src/or1k/ffitarget.h +0 -58
  240. data/ext/ffi_c/libffi/src/or1k/sysv.S +0 -107
  241. data/ext/ffi_c/libffi/src/pa/ffi.c +0 -673
  242. data/ext/ffi_c/libffi/src/pa/ffi64.c +0 -614
  243. data/ext/ffi_c/libffi/src/pa/ffitarget.h +0 -94
  244. data/ext/ffi_c/libffi/src/pa/hpux32.S +0 -417
  245. data/ext/ffi_c/libffi/src/pa/hpux64.S +0 -681
  246. data/ext/ffi_c/libffi/src/pa/linux.S +0 -427
  247. data/ext/ffi_c/libffi/src/powerpc/aix.S +0 -566
  248. data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +0 -694
  249. data/ext/ffi_c/libffi/src/powerpc/asm.h +0 -125
  250. data/ext/ffi_c/libffi/src/powerpc/darwin.S +0 -378
  251. data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +0 -571
  252. data/ext/ffi_c/libffi/src/powerpc/ffi.c +0 -175
  253. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +0 -1452
  254. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +0 -1153
  255. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +0 -105
  256. data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +0 -923
  257. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +0 -204
  258. data/ext/ffi_c/libffi/src/powerpc/linux64.S +0 -293
  259. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +0 -566
  260. data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +0 -397
  261. data/ext/ffi_c/libffi/src/powerpc/sysv.S +0 -173
  262. data/ext/ffi_c/libffi/src/powerpc/t-aix +0 -5
  263. data/ext/ffi_c/libffi/src/prep_cif.c +0 -283
  264. data/ext/ffi_c/libffi/src/raw_api.c +0 -267
  265. data/ext/ffi_c/libffi/src/riscv/ffi.c +0 -514
  266. data/ext/ffi_c/libffi/src/riscv/ffitarget.h +0 -69
  267. data/ext/ffi_c/libffi/src/riscv/sysv.S +0 -293
  268. data/ext/ffi_c/libffi/src/s390/ffi.c +0 -756
  269. data/ext/ffi_c/libffi/src/s390/ffitarget.h +0 -70
  270. data/ext/ffi_c/libffi/src/s390/internal.h +0 -11
  271. data/ext/ffi_c/libffi/src/s390/sysv.S +0 -325
  272. data/ext/ffi_c/libffi/src/sh/ffi.c +0 -717
  273. data/ext/ffi_c/libffi/src/sh/ffitarget.h +0 -54
  274. data/ext/ffi_c/libffi/src/sh/sysv.S +0 -850
  275. data/ext/ffi_c/libffi/src/sh64/ffi.c +0 -469
  276. data/ext/ffi_c/libffi/src/sh64/ffitarget.h +0 -58
  277. data/ext/ffi_c/libffi/src/sh64/sysv.S +0 -539
  278. data/ext/ffi_c/libffi/src/sparc/ffi.c +0 -468
  279. data/ext/ffi_c/libffi/src/sparc/ffi64.c +0 -624
  280. data/ext/ffi_c/libffi/src/sparc/ffitarget.h +0 -81
  281. data/ext/ffi_c/libffi/src/sparc/internal.h +0 -26
  282. data/ext/ffi_c/libffi/src/sparc/v8.S +0 -443
  283. data/ext/ffi_c/libffi/src/sparc/v9.S +0 -440
  284. data/ext/ffi_c/libffi/src/tile/ffi.c +0 -355
  285. data/ext/ffi_c/libffi/src/tile/ffitarget.h +0 -65
  286. data/ext/ffi_c/libffi/src/tile/tile.S +0 -360
  287. data/ext/ffi_c/libffi/src/tramp.c +0 -716
  288. data/ext/ffi_c/libffi/src/types.c +0 -108
  289. data/ext/ffi_c/libffi/src/vax/elfbsd.S +0 -195
  290. data/ext/ffi_c/libffi/src/vax/ffi.c +0 -276
  291. data/ext/ffi_c/libffi/src/vax/ffitarget.h +0 -49
  292. data/ext/ffi_c/libffi/src/wasm32/ffi.c +0 -934
  293. data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +0 -62
  294. data/ext/ffi_c/libffi/src/x86/asmnames.h +0 -30
  295. data/ext/ffi_c/libffi/src/x86/ffi.c +0 -832
  296. data/ext/ffi_c/libffi/src/x86/ffi64.c +0 -950
  297. data/ext/ffi_c/libffi/src/x86/ffitarget.h +0 -164
  298. data/ext/ffi_c/libffi/src/x86/ffiw64.c +0 -361
  299. data/ext/ffi_c/libffi/src/x86/internal.h +0 -43
  300. data/ext/ffi_c/libffi/src/x86/internal64.h +0 -36
  301. data/ext/ffi_c/libffi/src/x86/sysv.S +0 -1272
  302. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +0 -998
  303. data/ext/ffi_c/libffi/src/x86/unix64.S +0 -711
  304. data/ext/ffi_c/libffi/src/x86/win64.S +0 -254
  305. data/ext/ffi_c/libffi/src/x86/win64_intel.S +0 -238
  306. data/ext/ffi_c/libffi/src/xtensa/ffi.c +0 -306
  307. data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +0 -57
  308. data/ext/ffi_c/libffi/src/xtensa/sysv.S +0 -268
  309. data/ext/ffi_c/libffi/stamp-h.in +0 -1
  310. data/ext/ffi_c/libffi/testsuite/Makefile.am +0 -135
  311. data/ext/ffi_c/libffi/testsuite/Makefile.in +0 -664
  312. data/ext/ffi_c/libffi/testsuite/config/default.exp +0 -1
  313. data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +0 -54
  314. data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +0 -63
  315. data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +0 -80
  316. data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +0 -48
  317. data/ext/ffi_c/libffi/testsuite/emscripten/test.html +0 -7
  318. data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +0 -51
  319. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +0 -682
  320. data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +0 -283
  321. data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +0 -45
  322. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +0 -28
  323. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +0 -78
  324. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +0 -50
  325. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +0 -63
  326. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +0 -1746
  327. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +0 -2885
  328. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +0 -747
  329. data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +0 -46
  330. data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +0 -46
  331. data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +0 -41
  332. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +0 -54
  333. data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +0 -26
  334. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +0 -163
  335. data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +0 -59
  336. data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +0 -60
  337. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +0 -61
  338. data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +0 -74
  339. data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +0 -62
  340. data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +0 -110
  341. data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +0 -59
  342. data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +0 -57
  343. data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +0 -70
  344. data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +0 -78
  345. data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +0 -52
  346. data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +0 -46
  347. data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +0 -127
  348. data/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c +0 -59
  349. data/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc_tc.c +0 -114
  350. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +0 -36
  351. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c +0 -43
  352. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c +0 -42
  353. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c +0 -35
  354. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c +0 -36
  355. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c +0 -49
  356. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c +0 -42
  357. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +0 -34
  358. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c +0 -41
  359. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +0 -48
  360. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +0 -36
  361. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +0 -42
  362. data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +0 -38
  363. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +0 -42
  364. data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +0 -60
  365. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +0 -43
  366. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +0 -49
  367. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +0 -49
  368. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +0 -55
  369. data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +0 -67
  370. data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +0 -57
  371. data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +0 -67
  372. data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +0 -60
  373. data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +0 -64
  374. data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +0 -66
  375. data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +0 -64
  376. data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +0 -74
  377. data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +0 -81
  378. data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +0 -68
  379. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +0 -63
  380. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +0 -65
  381. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +0 -65
  382. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +0 -67
  383. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +0 -67
  384. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +0 -93
  385. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +0 -61
  386. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +0 -63
  387. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +0 -90
  388. data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +0 -61
  389. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +0 -78
  390. data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +0 -220
  391. data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +0 -154
  392. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +0 -134
  393. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +0 -134
  394. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +0 -140
  395. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +0 -67
  396. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn0.c +0 -90
  397. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn1.c +0 -83
  398. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn2.c +0 -83
  399. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn3.c +0 -102
  400. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn4.c +0 -91
  401. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn5.c +0 -94
  402. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn6.c +0 -92
  403. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_loc_fn0.c +0 -96
  404. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_simple.c +0 -61
  405. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_12byte.c +0 -112
  406. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_16byte.c +0 -117
  407. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_18byte.c +0 -120
  408. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_19byte.c +0 -131
  409. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_1_1byte.c +0 -93
  410. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte.c +0 -109
  411. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte1.c +0 -113
  412. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_24byte.c +0 -145
  413. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_2byte.c +0 -103
  414. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3_1byte.c +0 -114
  415. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte1.c +0 -103
  416. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte2.c +0 -103
  417. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +0 -113
  418. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4_1byte.c +0 -120
  419. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4byte.c +0 -103
  420. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5_1_byte.c +0 -137
  421. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5byte.c +0 -116
  422. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_64byte.c +0 -148
  423. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6_1_byte.c +0 -140
  424. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6byte.c +0 -121
  425. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7_1_byte.c +0 -155
  426. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7byte.c +0 -121
  427. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_8byte.c +0 -102
  428. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte1.c +0 -103
  429. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte2.c +0 -103
  430. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_double.c +0 -111
  431. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_float.c +0 -109
  432. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble.c +0 -111
  433. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split.c +0 -147
  434. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split2.c +0 -152
  435. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_pointer.c +0 -113
  436. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint16.c +0 -108
  437. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint32.c +0 -106
  438. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint64.c +0 -109
  439. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint16.c +0 -108
  440. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint32.c +0 -109
  441. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint64.c +0 -111
  442. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +0 -68
  443. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double.c +0 -43
  444. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double_va.c +0 -69
  445. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_float.c +0 -46
  446. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble.c +0 -115
  447. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble_va.c +0 -80
  448. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_args.c +0 -70
  449. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_float_double.c +0 -55
  450. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_schar.c +0 -78
  451. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshort.c +0 -79
  452. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +0 -94
  453. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_uchar.c +0 -99
  454. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushort.c +0 -78
  455. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +0 -94
  456. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer.c +0 -79
  457. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer_stack.c +0 -152
  458. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_schar.c +0 -47
  459. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sint.c +0 -44
  460. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sshort.c +0 -45
  461. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +0 -125
  462. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar.c +0 -45
  463. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint.c +0 -47
  464. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +0 -49
  465. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +0 -49
  466. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulonglong.c +0 -49
  467. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort.c +0 -46
  468. data/ext/ffi_c/libffi/testsuite/libffi.closures/err_bad_abi.c +0 -36
  469. data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +0 -1
  470. data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +0 -343
  471. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct.c +0 -175
  472. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct1.c +0 -161
  473. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct10.c +0 -146
  474. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +0 -137
  475. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +0 -86
  476. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +0 -115
  477. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct2.c +0 -119
  478. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct3.c +0 -120
  479. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct4.c +0 -120
  480. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct5.c +0 -121
  481. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct6.c +0 -142
  482. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct7.c +0 -120
  483. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct8.c +0 -142
  484. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct9.c +0 -142
  485. data/ext/ffi_c/libffi/testsuite/libffi.closures/problem1.c +0 -90
  486. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +0 -86
  487. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +0 -102
  488. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +0 -101
  489. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_large.c +0 -145
  490. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_large2.c +0 -148
  491. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium.c +0 -124
  492. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium2.c +0 -125
  493. data/ext/ffi_c/libffi/testsuite/libffi.closures/testclosure.c +0 -75
  494. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +0 -118
  495. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +0 -55
  496. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +0 -91
  497. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +0 -10
  498. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +0 -10
  499. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +0 -10
  500. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +0 -42
  501. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +0 -10
  502. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +0 -10
  503. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +0 -10
  504. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +0 -71
  505. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +0 -10
  506. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +0 -10
  507. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +0 -10
  508. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +0 -80
  509. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +0 -10
  510. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +0 -16
  511. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +0 -10
  512. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.exp +0 -36
  513. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +0 -51
  514. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +0 -7
  515. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +0 -7
  516. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +0 -7
  517. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +0 -10
  518. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +0 -10
  519. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +0 -86
  520. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +0 -10
  521. data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +0 -1
  522. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +0 -78
  523. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +0 -10
  524. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +0 -10
  525. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +0 -10
  526. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +0 -37
  527. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +0 -41
  528. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +0 -10
  529. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +0 -10
  530. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +0 -10
  531. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +0 -44
  532. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +0 -10
  533. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +0 -10
  534. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +0 -10
  535. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +0 -10
  536. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +0 -10
  537. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +0 -10
  538. data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +0 -34
  539. data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +0 -28
  540. data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +0 -1
  541. data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +0 -36
  542. data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +0 -19
  543. data/ext/ffi_c/libffi.bsd.mk +0 -40
  544. data/ext/ffi_c/libffi.darwin.mk +0 -105
  545. data/ext/ffi_c/libffi.gnu.mk +0 -32
  546. data/ext/ffi_c/libffi.mk +0 -18
  547. data/ext/ffi_c/libffi.vc.mk +0 -26
  548. data/ext/ffi_c/libffi.vc64.mk +0 -26
  549. data/ext/ffi_c/rbffi.h +0 -55
  550. data/ext/ffi_c/rbffi_endian.h +0 -59
@@ -1,65 +0,0 @@
1
- #include "LongDouble.h"
2
- #include <stdio.h>
3
- #include <stdarg.h>
4
- #include <float.h>
5
-
6
- #if defined (__CYGWIN__) || defined(__INTERIX) || defined(_MSC_VER)
7
- # define strtold(str, endptr) ((long double) strtod((str), (endptr)))
8
- #endif /* defined (__CYGWIN__) */
9
-
10
- static VALUE rb_cBigDecimal = Qnil;
11
- static VALUE bigdecimal_load(VALUE unused);
12
- static VALUE bigdecimal_failed(VALUE value, VALUE exc);
13
-
14
- VALUE
15
- rbffi_longdouble_new(long double ld)
16
- {
17
- if (!RTEST(rb_cBigDecimal)) {
18
- /* allow fallback if the bigdecimal library is unavailable in future ruby versions */
19
- rb_cBigDecimal = rb_rescue(bigdecimal_load, Qnil, bigdecimal_failed, rb_cObject);
20
- }
21
-
22
- if (RTEST(rb_cBigDecimal) && rb_cBigDecimal != rb_cObject) {
23
- char buf[128];
24
- return rb_funcall(rb_mKernel, rb_intern("BigDecimal"), 1, rb_str_new(buf, sprintf(buf, "%.35Le", ld)));
25
- }
26
-
27
- /* Fall through to handling as a float */
28
- return rb_float_new(ld);
29
- }
30
-
31
- long double
32
- rbffi_num2longdouble(VALUE value)
33
- {
34
- if (TYPE(value) == T_FLOAT) {
35
- return rb_num2dbl(value);
36
- }
37
-
38
- if (!RTEST(rb_cBigDecimal) && rb_const_defined(rb_cObject, rb_intern("BigDecimal"))) {
39
- rb_cBigDecimal = rb_const_get(rb_cObject, rb_intern("BigDecimal"));
40
- }
41
-
42
- if (RTEST(rb_cBigDecimal) && rb_cBigDecimal != rb_cObject && RTEST(rb_obj_is_kind_of(value, rb_cBigDecimal))) {
43
- VALUE s = rb_funcall(value, rb_intern("to_s"), 1, rb_str_new2("E"));
44
- long double ret = strtold(RSTRING_PTR(s), NULL);
45
- RB_GC_GUARD(s);
46
- return ret;
47
- }
48
-
49
- /* Fall through to handling as a float */
50
- return rb_num2dbl(value);
51
- }
52
-
53
-
54
- static VALUE
55
- bigdecimal_load(VALUE unused)
56
- {
57
- rb_require("bigdecimal");
58
- return rb_const_get(rb_cObject, rb_intern("BigDecimal"));
59
- }
60
-
61
- static VALUE
62
- bigdecimal_failed(VALUE value, VALUE exc)
63
- {
64
- return value;
65
- }
@@ -1,47 +0,0 @@
1
- /*
2
- * Copyright (c) 2012, 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_LONGDOUBLE_H
31
- #define RBFFI_LONGDOUBLE_H
32
-
33
- #include <ruby.h>
34
-
35
- #ifdef __cplusplus
36
- extern "C" {
37
- #endif
38
-
39
- extern VALUE rbffi_longdouble_new(long double ld);
40
- extern long double rbffi_num2longdouble(VALUE value);
41
-
42
- #ifdef __cplusplus
43
- }
44
- #endif
45
-
46
- #endif /* RBFFI_LONGDOUBLE_H */
47
-
@@ -1,211 +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 <ruby.h>
31
-
32
- #include <ffi.h>
33
- #include "rbffi.h"
34
- #include "compat.h"
35
-
36
- #include "Type.h"
37
- #include "MappedType.h"
38
-
39
-
40
- static VALUE mapped_allocate(VALUE);
41
- static VALUE mapped_initialize(VALUE, VALUE);
42
- static void mapped_mark(void *);
43
- static void mapped_compact(void *);
44
- static size_t mapped_memsize(const void *);
45
- static ID id_native_type, id_to_native, id_from_native;
46
-
47
- VALUE rbffi_MappedTypeClass = Qnil;
48
-
49
- static const rb_data_type_t mapped_type_data_type = {
50
- .wrap_struct_name = "FFI::Type::Mapped",
51
- .function = {
52
- .dmark = mapped_mark,
53
- .dfree = RUBY_TYPED_DEFAULT_FREE,
54
- .dsize = mapped_memsize,
55
- ffi_compact_callback( mapped_compact )
56
- },
57
- .parent = &rbffi_type_data_type,
58
- // IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
59
- // macro to update VALUE references, as to trigger write barriers.
60
- .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | FFI_RUBY_TYPED_FROZEN_SHAREABLE
61
- };
62
-
63
-
64
- static VALUE
65
- mapped_allocate(VALUE klass)
66
- {
67
- MappedType* m;
68
-
69
- VALUE obj = TypedData_Make_Struct(klass, MappedType, &mapped_type_data_type, m);
70
-
71
- RB_OBJ_WRITE(obj, &m->rbConverter, Qnil);
72
- RB_OBJ_WRITE(obj, &m->rbType, Qnil);
73
- m->type = NULL;
74
- m->base.nativeType = NATIVE_MAPPED;
75
- m->base.ffiType = &ffi_type_void;
76
-
77
- return obj;
78
- }
79
-
80
- /*
81
- * call-seq: initialize(converter)
82
- * @param [#native_type, #to_native, #from_native] converter +converter+ must respond to
83
- * all these methods
84
- * @return [self]
85
- */
86
- static VALUE
87
- mapped_initialize(VALUE self, VALUE rbConverter)
88
- {
89
- MappedType* m = NULL;
90
-
91
- if (!rb_respond_to(rbConverter, id_native_type)) {
92
- rb_raise(rb_eNoMethodError, "native_type method not implemented");
93
- }
94
-
95
- if (!rb_respond_to(rbConverter, id_to_native)) {
96
- rb_raise(rb_eNoMethodError, "to_native method not implemented");
97
- }
98
-
99
- if (!rb_respond_to(rbConverter, id_from_native)) {
100
- rb_raise(rb_eNoMethodError, "from_native method not implemented");
101
- }
102
-
103
- TypedData_Get_Struct(self, MappedType, &mapped_type_data_type, m);
104
- RB_OBJ_WRITE(self, &m->rbType, rb_funcall2(rbConverter, id_native_type, 0, NULL));
105
- if (!(rb_obj_is_kind_of(m->rbType, rbffi_TypeClass))) {
106
- rb_raise(rb_eTypeError, "native_type did not return instance of FFI::Type");
107
- }
108
-
109
- RB_OBJ_WRITE(self, &m->rbConverter, rbConverter);
110
- TypedData_Get_Struct(m->rbType, Type, &rbffi_type_data_type, m->type);
111
- m->base.ffiType = m->type->ffiType;
112
-
113
- rb_obj_freeze(self);
114
-
115
- return self;
116
- }
117
-
118
- static void
119
- mapped_mark(void* data)
120
- {
121
- MappedType* m = (MappedType*)data;
122
- rb_gc_mark_movable(m->rbType);
123
- rb_gc_mark_movable(m->rbConverter);
124
- }
125
-
126
- static void
127
- mapped_compact(void* data)
128
- {
129
- MappedType* m = (MappedType*)data;
130
- ffi_gc_location(m->rbType);
131
- ffi_gc_location(m->rbConverter);
132
- }
133
-
134
- static size_t
135
- mapped_memsize(const void *data)
136
- {
137
- return sizeof(MappedType);
138
- }
139
-
140
- /*
141
- * call-seq: mapped_type.native_type
142
- * @return [Type]
143
- * Get native type of mapped type.
144
- */
145
- static VALUE
146
- mapped_native_type(VALUE self)
147
- {
148
- MappedType*m = NULL;
149
- TypedData_Get_Struct(self, MappedType, &mapped_type_data_type, m);
150
-
151
- return m->rbType;
152
- }
153
-
154
- /*
155
- * call-seq: mapped_type.to_native(*args)
156
- * @param args depends on {FFI::DataConverter} used to initialize +self+
157
- */
158
- static VALUE
159
- mapped_to_native(int argc, VALUE* argv, VALUE self)
160
- {
161
- MappedType*m = NULL;
162
- TypedData_Get_Struct(self, MappedType, &mapped_type_data_type, m);
163
-
164
- return rb_funcall2(m->rbConverter, id_to_native, argc, argv);
165
- }
166
-
167
- /*
168
- * call-seq: mapped_type.from_native(*args)
169
- * @param args depends on {FFI::DataConverter} used to initialize +self+
170
- */
171
- static VALUE
172
- mapped_from_native(int argc, VALUE* argv, VALUE self)
173
- {
174
- MappedType*m = NULL;
175
- TypedData_Get_Struct(self, MappedType, &mapped_type_data_type, m);
176
-
177
- return rb_funcall2(m->rbConverter, id_from_native, argc, argv);
178
- }
179
-
180
- static VALUE
181
- mapped_converter(VALUE self)
182
- {
183
- MappedType*m = NULL;
184
- TypedData_Get_Struct(self, MappedType, &mapped_type_data_type, m);
185
-
186
- return m->rbConverter;
187
- }
188
-
189
- void
190
- rbffi_MappedType_Init(VALUE moduleFFI)
191
- {
192
- /*
193
- * Document-class: FFI::Type::Mapped < FFI::Type
194
- */
195
- rbffi_MappedTypeClass = rb_define_class_under(rbffi_TypeClass, "Mapped", rbffi_TypeClass);
196
-
197
- rb_global_variable(&rbffi_MappedTypeClass);
198
-
199
- id_native_type = rb_intern("native_type");
200
- id_to_native = rb_intern("to_native");
201
- id_from_native = rb_intern("from_native");
202
-
203
- rb_define_alloc_func(rbffi_MappedTypeClass, mapped_allocate);
204
- rb_define_method(rbffi_MappedTypeClass, "initialize", mapped_initialize, 1);
205
- rb_define_method(rbffi_MappedTypeClass, "type", mapped_native_type, 0);
206
- rb_define_method(rbffi_MappedTypeClass, "native_type", mapped_native_type, 0);
207
- rb_define_method(rbffi_MappedTypeClass, "to_native", mapped_to_native, -1);
208
- rb_define_method(rbffi_MappedTypeClass, "from_native", mapped_from_native, -1);
209
- rb_define_method(rbffi_MappedTypeClass, "converter", mapped_converter, 0);
210
- }
211
-
@@ -1,57 +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_MAPPEDTYPE_H
31
- #define RBFFI_MAPPEDTYPE_H
32
-
33
-
34
- #include <ruby.h>
35
-
36
- #ifdef __cplusplus
37
- extern "C" {
38
- #endif
39
-
40
-
41
- typedef struct MappedType_ {
42
- Type base;
43
- Type* type;
44
- VALUE rbConverter;
45
- VALUE rbType;
46
- } MappedType;
47
-
48
- void rbffi_MappedType_Init(VALUE moduleFFI);
49
-
50
- extern VALUE rbffi_MappedTypeClass;
51
-
52
- #ifdef __cplusplus
53
- }
54
- #endif
55
-
56
- #endif /* RBFFI_MAPPEDTYPE_H */
57
-
@@ -1,219 +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
- #include <stdbool.h>
32
- #include <stdint.h>
33
- #include <limits.h>
34
- #include <ruby.h>
35
- #include "rbffi.h"
36
- #include "AbstractMemory.h"
37
- #include "Pointer.h"
38
- #include "MemoryPointer.h"
39
-
40
-
41
- static VALUE memptr_allocate(VALUE klass);
42
- static void memptr_release(void *data);
43
- static size_t memptr_memsize(const void *data);
44
- static VALUE memptr_malloc(VALUE self, long size, long count, bool clear);
45
- static VALUE memptr_free(VALUE self);
46
-
47
- VALUE rbffi_MemoryPointerClass;
48
-
49
- #define MEMPTR(obj) ((MemoryPointer *) rbffi_AbstractMemory_Cast(obj, &memory_pointer_data_type))
50
-
51
- VALUE
52
- rbffi_MemoryPointer_NewInstance(long size, long count, bool clear)
53
- {
54
- return memptr_malloc(memptr_allocate(rbffi_MemoryPointerClass), size, count, clear);
55
- }
56
-
57
- static const rb_data_type_t memory_pointer_data_type = {
58
- .wrap_struct_name = "FFI::MemoryPointer",
59
- .function = {
60
- .dmark = NULL,
61
- .dfree = memptr_release,
62
- .dsize = memptr_memsize,
63
- },
64
- .parent = &rbffi_pointer_data_type,
65
- // IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
66
- // macro to update VALUE references, as to trigger write barriers.
67
- .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | FFI_RUBY_TYPED_FROZEN_SHAREABLE
68
- };
69
-
70
- static VALUE
71
- memptr_allocate(VALUE klass)
72
- {
73
- Pointer* p;
74
- VALUE obj = TypedData_Make_Struct(klass, Pointer, &memory_pointer_data_type, p);
75
- RB_OBJ_WRITE(obj, &p->rbParent, Qnil);
76
- p->memory.flags = MEM_RD | MEM_WR;
77
-
78
- return obj;
79
- }
80
-
81
- /*
82
- * call-seq: initialize(size, count=1, clear=true)
83
- * @param [Fixnum, Bignum, Symbol, FFI::Type] size size of a memory cell (in bytes, or type whom size will be used)
84
- * @param [Numeric] count number of cells in memory
85
- * @param [Boolean] clear set memory to all-zero if +true+
86
- * @return [self]
87
- * A new instance of FFI::MemoryPointer.
88
- */
89
- static VALUE
90
- memptr_initialize(int argc, VALUE* argv, VALUE self)
91
- {
92
- VALUE size = Qnil, count = Qnil, clear = Qnil;
93
- int nargs = rb_scan_args(argc, argv, "12", &size, &count, &clear);
94
-
95
- memptr_malloc(self, rbffi_type_size(size), nargs > 1 ? NUM2LONG(count) : 1,
96
- RTEST(clear) || clear == Qnil);
97
-
98
- if (rb_block_given_p()) {
99
- return rb_ensure(rb_yield, self, memptr_free, self);
100
- }
101
-
102
- return self;
103
- }
104
-
105
- static VALUE
106
- memptr_malloc(VALUE self, long size, long count, bool clear)
107
- {
108
- Pointer* p;
109
- unsigned long msize;
110
-
111
- TypedData_Get_Struct(self, Pointer, &memory_pointer_data_type, p);
112
-
113
- msize = size * count;
114
-
115
- p->storage = xmalloc(msize + 7);
116
- if (p->storage == NULL) {
117
- rb_raise(rb_eNoMemError, "Failed to allocate memory size=%ld bytes", msize);
118
- return Qnil;
119
- }
120
- p->autorelease = true;
121
- p->memory.typeSize = (int) size;
122
- p->memory.size = msize;
123
- /* ensure the memory is aligned on at least a 8 byte boundary */
124
- p->memory.address = (char *) (((uintptr_t) p->storage + 0x7) & (uintptr_t) ~0x7ULL);
125
- p->allocated = true;
126
-
127
- if (clear && p->memory.size > 0) {
128
- memset(p->memory.address, 0, p->memory.size);
129
- }
130
-
131
- return self;
132
- }
133
-
134
- static VALUE
135
- memptr_free(VALUE self)
136
- {
137
- Pointer* ptr;
138
-
139
- rb_check_frozen(self);
140
- TypedData_Get_Struct(self, Pointer, &memory_pointer_data_type, ptr);
141
-
142
- if (ptr->allocated) {
143
- if (ptr->storage != NULL) {
144
- xfree(ptr->storage);
145
- ptr->storage = NULL;
146
- }
147
- ptr->allocated = false;
148
- }
149
-
150
- return self;
151
- }
152
-
153
- static void
154
- memptr_release(void *data)
155
- {
156
- Pointer *ptr = (Pointer *)data;
157
- if (ptr->autorelease && ptr->allocated && ptr->storage != NULL) {
158
- xfree(ptr->storage);
159
- ptr->storage = NULL;
160
- }
161
- xfree(ptr);
162
- }
163
-
164
- static size_t
165
- memptr_memsize(const void *data)
166
- {
167
- const Pointer *ptr = (const Pointer *)data;
168
- size_t memsize = sizeof(Pointer);
169
- if (ptr->allocated) {
170
- memsize += ptr->memory.size;
171
- }
172
- return memsize;
173
- }
174
-
175
- /*
176
- * call-seq: from_string(s)
177
- * @param [String] s string
178
- * @return [MemoryPointer]
179
- * Create a {MemoryPointer} with +s+ inside.
180
- */
181
- static VALUE
182
- memptr_s_from_string(VALUE klass, VALUE to_str)
183
- {
184
- VALUE s = StringValue(to_str);
185
- VALUE args[] = { INT2FIX(1), LONG2NUM(RSTRING_LEN(s) + 1), Qfalse };
186
- VALUE obj = rb_class_new_instance(3, args, klass);
187
- rb_funcall(obj, rb_intern("put_string"), 2, INT2FIX(0), s);
188
-
189
- return obj;
190
- }
191
-
192
- void
193
- rbffi_MemoryPointer_Init(VALUE moduleFFI)
194
- {
195
- VALUE ffi_Pointer;
196
-
197
- ffi_Pointer = rbffi_PointerClass;
198
-
199
- /*
200
- * Document-class: FFI::MemoryPointer < FFI::Pointer
201
- * A MemoryPointer is a specific {Pointer}. It points to a memory composed of cells. All cells have the
202
- * same size.
203
- *
204
- * @example Create a new MemoryPointer
205
- * mp = FFI::MemoryPointer.new(:long, 16) # Create a pointer on a memory of 16 long ints.
206
- * @example Create a new MemoryPointer from a String
207
- * mp1 = FFI::MemoryPointer.from_string("this is a string")
208
- * # same as:
209
- * mp2 = FFI::MemoryPointer.new(:char,16)
210
- * mp2.put_string("this is a string")
211
- */
212
- rbffi_MemoryPointerClass = rb_define_class_under(moduleFFI, "MemoryPointer", ffi_Pointer);
213
- rb_global_variable(&rbffi_MemoryPointerClass);
214
-
215
- rb_define_alloc_func(rbffi_MemoryPointerClass, memptr_allocate);
216
- rb_define_method(rbffi_MemoryPointerClass, "initialize", memptr_initialize, -1);
217
- rb_define_singleton_method(rbffi_MemoryPointerClass, "from_string", memptr_s_from_string, 1);
218
- }
219
-
@@ -1,49 +0,0 @@
1
- /*
2
- * Copyright (c) 2008, 2009, Wayne Meissner
3
- * Copyright (c) 2008, 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_MEMORYPOINTER_H
32
- #define RBFFI_MEMORYPOINTER_H
33
-
34
- # include <stdbool.h>
35
- #include <ruby.h>
36
-
37
- #ifdef __cplusplus
38
- extern "C" {
39
- #endif
40
-
41
- extern void rbffi_MemoryPointer_Init(VALUE moduleFFI);
42
- extern VALUE rbffi_MemoryPointerClass;
43
- extern VALUE rbffi_MemoryPointer_NewInstance(long size, long count, bool clear);
44
- #ifdef __cplusplus
45
- }
46
- #endif
47
-
48
- #endif /* RBFFI_MEMORYPOINTER_H */
49
-