yakg 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (300) hide show
  1. checksums.yaml +6 -14
  2. data/.gitignore +1 -0
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +27 -19
  5. data/VERSION +1 -1
  6. data/lib/yakg.rb +6 -6
  7. data/spec/spec_helper.rb +1 -3
  8. data/spec/yakg_spec.rb +13 -13
  9. data/vendor/gems/README.md +26 -20
  10. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/COPYING +49 -0
  11. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/LICENSE +24 -0
  12. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/README.md +7 -7
  13. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/Rakefile +31 -41
  14. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/ffi.gemspec +7 -6
  15. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/autopointer.rb +24 -14
  16. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/enum.rb +34 -22
  17. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/errno.rb +43 -0
  18. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/ffi.rb +44 -0
  19. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/io.rb +62 -0
  20. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/library.rb +79 -44
  21. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/managedstruct.rb +29 -0
  22. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/platform/aarch64-linux/types.conf +104 -0
  23. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/platform/mips64el-linux/types.conf +104 -0
  24. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc64-linux/types.conf +104 -0
  25. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-cygwin/types.conf +3 -0
  26. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-darwin/types.conf +126 -0
  27. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-openbsd/types.conf +128 -0
  28. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform.rb +35 -15
  29. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/pointer.rb +22 -10
  30. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/struct.rb +31 -14
  31. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/struct_layout_builder.rb +46 -30
  32. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/types.rb +24 -11
  33. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/union.rb +43 -0
  34. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/variadic.rb +78 -0
  35. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/version.rb +4 -0
  36. data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi.rb +1 -9
  37. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi_c.bundle +0 -0
  38. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/Benchmark.c +52 -0
  39. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/BoolTest.c +34 -0
  40. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/BufferTest.c +31 -0
  41. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/ClosureTest.c +205 -0
  42. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/EnumTest.c +51 -0
  43. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/FunctionTest.c +70 -0
  44. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/GNUmakefile +149 -0
  45. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/GlobalVariable.c +62 -0
  46. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/LastErrorTest.c +21 -0
  47. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/NumberTest.c +132 -0
  48. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/PointerTest.c +63 -0
  49. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/ReferenceTest.c +23 -0
  50. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/StringTest.c +34 -0
  51. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/StructTest.c +243 -0
  52. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/UnionTest.c +43 -0
  53. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/VariadicTest.c +62 -0
  54. data/vendor/gems/ruby/2.0.0/specifications/ffi-1.9.10.gemspec +45 -0
  55. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/CHANGELOG +12 -0
  56. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/LICENSE +8 -0
  57. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/README.md +40 -0
  58. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/array.rb +123 -0
  59. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/base.rb +197 -0
  60. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/boolean.rb +25 -0
  61. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/data.rb +42 -0
  62. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/date.rb +32 -0
  63. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/dictionary.rb +114 -0
  64. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/extensions.rb +158 -0
  65. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/null.rb +11 -0
  66. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/number.rb +98 -0
  67. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/string.rb +91 -0
  68. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/version.rb +4 -0
  69. data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation.rb +13 -0
  70. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/COPYING +49 -0
  71. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/LICENSE +24 -0
  72. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/README.md +109 -0
  73. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/Rakefile +210 -0
  74. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/ffi.gemspec +23 -0
  75. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/gen/Rakefile +30 -0
  76. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/autopointer.rb +194 -0
  77. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/buffer.rb +4 -0
  78. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/callback.rb +4 -0
  79. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/enum.rb +174 -0
  80. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/errno.rb +43 -0
  81. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/ffi.rb +44 -0
  82. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/io.rb +62 -0
  83. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/library.rb +524 -0
  84. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/managedstruct.rb +84 -0
  85. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/memorypointer.rb +1 -0
  86. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/aarch64-linux/types.conf +104 -0
  87. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/arm-linux/types.conf +104 -0
  88. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-cygwin/types.conf +3 -0
  89. data/vendor/gems/ruby/{2.0.0/gems/ffi-1.9.0/lib/ffi/platform/x86_64-darwin → 2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-darwin}/types.conf +2 -2
  90. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-freebsd/types.conf +152 -0
  91. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-gnu/types.conf +107 -0
  92. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-linux/types.conf +103 -0
  93. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-openbsd/types.conf +128 -0
  94. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-solaris/types.conf +122 -0
  95. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-windows/types.conf +105 -0
  96. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/ia64-linux/types.conf +104 -0
  97. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/mips-linux/types.conf +102 -0
  98. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/mips64el-linux/types.conf +104 -0
  99. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/mipsel-linux/types.conf +102 -0
  100. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc-aix/types.conf +180 -0
  101. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
  102. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc-linux/types.conf +100 -0
  103. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc64-linux/types.conf +104 -0
  104. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/s390-linux/types.conf +102 -0
  105. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/s390x-linux/types.conf +102 -0
  106. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/sparc-linux/types.conf +102 -0
  107. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/sparc-solaris/types.conf +128 -0
  108. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
  109. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-cygwin/types.conf +3 -0
  110. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-darwin/types.conf +126 -0
  111. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
  112. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-linux/types.conf +102 -0
  113. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-netbsd/types.conf +128 -0
  114. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-openbsd/types.conf +128 -0
  115. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
  116. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-windows/types.conf +27 -0
  117. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform.rb +159 -0
  118. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/pointer.rb +134 -0
  119. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/struct.rb +373 -0
  120. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/struct_layout_builder.rb +227 -0
  121. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/tools/const_generator.rb +229 -0
  122. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/tools/generator.rb +60 -0
  123. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/tools/generator_task.rb +36 -0
  124. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/tools/struct_generator.rb +194 -0
  125. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/tools/types_generator.rb +135 -0
  126. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/types.rb +190 -0
  127. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/union.rb +43 -0
  128. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/variadic.rb +78 -0
  129. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/version.rb +4 -0
  130. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi.rb +20 -0
  131. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi_c.bundle +0 -0
  132. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/Benchmark.c +52 -0
  133. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/BoolTest.c +34 -0
  134. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/BufferTest.c +31 -0
  135. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/ClosureTest.c +205 -0
  136. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/EnumTest.c +51 -0
  137. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/FunctionTest.c +70 -0
  138. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/GNUmakefile +149 -0
  139. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/GlobalVariable.c +62 -0
  140. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/LastErrorTest.c +21 -0
  141. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/NumberTest.c +132 -0
  142. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/PointerTest.c +63 -0
  143. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/ReferenceTest.c +23 -0
  144. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/StringTest.c +34 -0
  145. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/StructTest.c +243 -0
  146. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/UnionTest.c +43 -0
  147. data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/VariadicTest.c +62 -0
  148. data/vendor/gems/ruby/2.1.0/specifications/corefoundation-0.2.0.gemspec +45 -0
  149. data/vendor/gems/ruby/2.1.0/specifications/ffi-1.9.10.gemspec +49 -0
  150. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/CHANGELOG +12 -0
  151. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/LICENSE +8 -0
  152. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/README.md +40 -0
  153. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/array.rb +123 -0
  154. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/base.rb +197 -0
  155. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/boolean.rb +25 -0
  156. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/data.rb +42 -0
  157. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/date.rb +32 -0
  158. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/dictionary.rb +114 -0
  159. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/extensions.rb +158 -0
  160. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/null.rb +11 -0
  161. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/number.rb +98 -0
  162. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/string.rb +91 -0
  163. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/version.rb +4 -0
  164. data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation.rb +13 -0
  165. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/COPYING +49 -0
  166. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/LICENSE +24 -0
  167. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/README.md +109 -0
  168. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/Rakefile +210 -0
  169. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/ffi.gemspec +23 -0
  170. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/gen/Rakefile +30 -0
  171. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/autopointer.rb +194 -0
  172. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/buffer.rb +4 -0
  173. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/callback.rb +4 -0
  174. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/enum.rb +174 -0
  175. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/errno.rb +43 -0
  176. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/ffi.rb +44 -0
  177. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/io.rb +62 -0
  178. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/library.rb +524 -0
  179. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/managedstruct.rb +84 -0
  180. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/memorypointer.rb +1 -0
  181. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/aarch64-linux/types.conf +104 -0
  182. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/arm-linux/types.conf +104 -0
  183. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-cygwin/types.conf +3 -0
  184. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-darwin/types.conf +100 -0
  185. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-freebsd/types.conf +152 -0
  186. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-gnu/types.conf +107 -0
  187. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-linux/types.conf +103 -0
  188. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-netbsd/types.conf +126 -0
  189. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-openbsd/types.conf +128 -0
  190. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-solaris/types.conf +122 -0
  191. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-windows/types.conf +105 -0
  192. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/ia64-linux/types.conf +104 -0
  193. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/mips-linux/types.conf +102 -0
  194. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/mips64el-linux/types.conf +104 -0
  195. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/mipsel-linux/types.conf +102 -0
  196. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc-aix/types.conf +180 -0
  197. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
  198. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc-linux/types.conf +100 -0
  199. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc64-linux/types.conf +104 -0
  200. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/s390-linux/types.conf +102 -0
  201. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/s390x-linux/types.conf +102 -0
  202. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/sparc-linux/types.conf +102 -0
  203. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/sparc-solaris/types.conf +128 -0
  204. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
  205. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-cygwin/types.conf +3 -0
  206. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-darwin/types.conf +126 -0
  207. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
  208. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-linux/types.conf +102 -0
  209. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-netbsd/types.conf +128 -0
  210. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-openbsd/types.conf +128 -0
  211. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
  212. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-windows/types.conf +27 -0
  213. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform.rb +159 -0
  214. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/pointer.rb +134 -0
  215. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/struct.rb +373 -0
  216. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/struct_layout_builder.rb +227 -0
  217. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/tools/const_generator.rb +229 -0
  218. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/tools/generator.rb +60 -0
  219. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/tools/generator_task.rb +36 -0
  220. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/tools/struct_generator.rb +194 -0
  221. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/tools/types_generator.rb +135 -0
  222. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/types.rb +190 -0
  223. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/union.rb +43 -0
  224. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/variadic.rb +78 -0
  225. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/version.rb +4 -0
  226. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi.rb +20 -0
  227. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi_c.bundle +0 -0
  228. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/Benchmark.c +52 -0
  229. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/BoolTest.c +34 -0
  230. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/BufferTest.c +31 -0
  231. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/ClosureTest.c +205 -0
  232. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/EnumTest.c +51 -0
  233. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/FunctionTest.c +70 -0
  234. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/GNUmakefile +149 -0
  235. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/GlobalVariable.c +62 -0
  236. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/LastErrorTest.c +21 -0
  237. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/NumberTest.c +132 -0
  238. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/PointerTest.c +63 -0
  239. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/ReferenceTest.c +23 -0
  240. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/StringTest.c +34 -0
  241. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/StructTest.c +243 -0
  242. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/UnionTest.c +43 -0
  243. data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/VariadicTest.c +62 -0
  244. data/vendor/gems/ruby/2.2.0/specifications/corefoundation-0.2.0.gemspec +45 -0
  245. data/vendor/gems/ruby/2.2.0/specifications/ffi-1.9.10.gemspec +49 -0
  246. data/yakg.gemspec +3 -3
  247. metadata +288 -83
  248. data/vendor/gems/Gemfile +0 -4
  249. data/vendor/gems/Gemfile.lock +0 -13
  250. data/vendor/gems/installit.sh +0 -65
  251. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/COPYING +0 -674
  252. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/COPYING.LESSER +0 -165
  253. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/History.txt +0 -1
  254. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/LICENSE +0 -14
  255. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/gen/log +0 -1
  256. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/errno.rb +0 -33
  257. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/ffi.iml +0 -11
  258. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/ffi.rb +0 -33
  259. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/io.rb +0 -52
  260. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/union.rb +0 -32
  261. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/variadic.rb +0 -65
  262. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/version.rb +0 -4
  263. data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi_c.bundle +0 -0
  264. data/vendor/gems/ruby/2.0.0/specifications/ffi-1.9.0.gemspec +0 -42
  265. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/gen/Rakefile +0 -0
  266. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/buffer.rb +0 -0
  267. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/callback.rb +0 -0
  268. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/memorypointer.rb +0 -0
  269. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/arm-linux/types.conf +0 -0
  270. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/i386-cygwin/types.conf +0 -0
  271. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/i386-darwin/types.conf +0 -0
  272. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/i386-freebsd/types.conf +0 -0
  273. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/i386-gnu/types.conf +0 -0
  274. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/i386-linux/types.conf +0 -0
  275. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/i386-netbsd/types.conf +0 -0
  276. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/i386-openbsd/types.conf +0 -0
  277. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/i386-solaris/types.conf +0 -0
  278. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/i386-windows/types.conf +0 -0
  279. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/ia64-linux/types.conf +0 -0
  280. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/mips-linux/types.conf +0 -0
  281. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/mipsel-linux/types.conf +0 -0
  282. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/powerpc-aix/types.conf +0 -0
  283. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/powerpc-darwin/types.conf +0 -0
  284. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/powerpc-linux/types.conf +0 -0
  285. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/s390-linux/types.conf +0 -0
  286. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/s390x-linux/types.conf +0 -0
  287. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/sparc-linux/types.conf +0 -0
  288. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/sparc-solaris/types.conf +0 -0
  289. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/sparcv9-solaris/types.conf +0 -0
  290. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/x86_64-freebsd/types.conf +0 -0
  291. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/x86_64-linux/types.conf +0 -0
  292. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0/lib/ffi/platform/x86_64-openbsd → ffi-1.9.10/lib/ffi/platform/x86_64-netbsd}/types.conf +0 -0
  293. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/x86_64-solaris/types.conf +0 -0
  294. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform/x86_64-windows/types.conf +0 -0
  295. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/tools/const_generator.rb +0 -0
  296. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/tools/generator.rb +0 -0
  297. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/tools/generator_task.rb +0 -0
  298. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/tools/struct_generator.rb +0 -0
  299. /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/tools/types_generator.rb +0 -0
  300. /data/vendor/gems/ruby/{2.0.0/gems/ffi-1.9.0/lib/ffi/platform/x86_64-netbsd → 2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-netbsd}/types.conf +0 -0
@@ -0,0 +1,190 @@
1
+ #
2
+ # Copyright (C) 2008-2010 Wayne Meissner
3
+ # Copyright (c) 2007, 2008 Evan Phoenix
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 Ruby FFI project 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
+ # see {file:README}
34
+ module FFI
35
+
36
+ # @param [Type, DataConverter, Symbol] old type definition used by {FFI.find_type}
37
+ # @param [Symbol] add new type definition's name to add
38
+ # @return [Type]
39
+ # Add a definition type to type definitions.
40
+ def self.typedef(old, add)
41
+ TypeDefs[add] = self.find_type(old)
42
+ end
43
+
44
+ # (see FFI.typedef)
45
+ def self.add_typedef(old, add)
46
+ typedef old, add
47
+ end
48
+
49
+
50
+ # @param [Type, DataConverter, Symbol] name
51
+ # @param [Hash] type_map if nil, {FFI::TypeDefs} is used
52
+ # @return [Type]
53
+ # Find a type in +type_map+ ({FFI::TypeDefs}, by default) from
54
+ # a type objet, a type name (symbol). If +name+ is a {DataConverter},
55
+ # a new {Type::Mapped} is created.
56
+ def self.find_type(name, type_map = nil)
57
+ if name.is_a?(Type)
58
+ name
59
+
60
+ elsif type_map && type_map.has_key?(name)
61
+ type_map[name]
62
+
63
+ elsif TypeDefs.has_key?(name)
64
+ TypeDefs[name]
65
+
66
+ elsif name.is_a?(DataConverter)
67
+ (type_map || TypeDefs)[name] = Type::Mapped.new(name)
68
+
69
+ else
70
+ raise TypeError, "unable to resolve type '#{name}'"
71
+ end
72
+ end
73
+
74
+ # List of type definitions
75
+ TypeDefs.merge!({
76
+ # The C void type; only useful for function return types
77
+ :void => Type::VOID,
78
+
79
+ # C boolean type
80
+ :bool => Type::BOOL,
81
+
82
+ # C nul-terminated string
83
+ :string => Type::STRING,
84
+
85
+ # C signed char
86
+ :char => Type::CHAR,
87
+ # C unsigned char
88
+ :uchar => Type::UCHAR,
89
+
90
+ # C signed short
91
+ :short => Type::SHORT,
92
+ # C unsigned short
93
+ :ushort => Type::USHORT,
94
+
95
+ # C signed int
96
+ :int => Type::INT,
97
+ # C unsigned int
98
+ :uint => Type::UINT,
99
+
100
+ # C signed long
101
+ :long => Type::LONG,
102
+
103
+ # C unsigned long
104
+ :ulong => Type::ULONG,
105
+
106
+ # C signed long long integer
107
+ :long_long => Type::LONG_LONG,
108
+
109
+ # C unsigned long long integer
110
+ :ulong_long => Type::ULONG_LONG,
111
+
112
+ # C single precision float
113
+ :float => Type::FLOAT,
114
+
115
+ # C double precision float
116
+ :double => Type::DOUBLE,
117
+
118
+ # C long double
119
+ :long_double => Type::LONGDOUBLE,
120
+
121
+ # Native memory address
122
+ :pointer => Type::POINTER,
123
+
124
+ # 8 bit signed integer
125
+ :int8 => Type::INT8,
126
+ # 8 bit unsigned integer
127
+ :uint8 => Type::UINT8,
128
+
129
+ # 16 bit signed integer
130
+ :int16 => Type::INT16,
131
+ # 16 bit unsigned integer
132
+ :uint16 => Type::UINT16,
133
+
134
+ # 32 bit signed integer
135
+ :int32 => Type::INT32,
136
+ # 32 bit unsigned integer
137
+ :uint32 => Type::UINT32,
138
+
139
+ # 64 bit signed integer
140
+ :int64 => Type::INT64,
141
+ # 64 bit unsigned integer
142
+ :uint64 => Type::UINT64,
143
+
144
+ :buffer_in => Type::BUFFER_IN,
145
+ :buffer_out => Type::BUFFER_OUT,
146
+ :buffer_inout => Type::BUFFER_INOUT,
147
+
148
+ # Used in function prototypes to indicate the arguments are variadic
149
+ :varargs => Type::VARARGS,
150
+ })
151
+
152
+
153
+ class StrPtrConverter
154
+ extend DataConverter
155
+ native_type Type::POINTER
156
+
157
+ # @param [Pointer] val
158
+ # @param ctx
159
+ # @return [Array(String, Pointer)]
160
+ # Returns a [ String, Pointer ] tuple so the C memory for the string can be freed
161
+ def self.from_native(val, ctx)
162
+ [ val.null? ? nil : val.get_string(0), val ]
163
+ end
164
+
165
+ end
166
+
167
+ typedef(StrPtrConverter, :strptr)
168
+
169
+ # @param type +type+ is an instance of class accepted by {FFI.find_type}
170
+ # @return [Numeric]
171
+ # Get +type+ size, in bytes.
172
+ def self.type_size(type)
173
+ find_type(type).size
174
+ end
175
+
176
+ # Load all the platform dependent types
177
+ begin
178
+ File.open(File.join(Platform::CONF_DIR, 'types.conf'), "r") do |f|
179
+ prefix = "rbx.platform.typedef."
180
+ f.each_line { |line|
181
+ if line.index(prefix) == 0
182
+ new_type, orig_type = line.chomp.slice(prefix.length..-1).split(/\s*=\s*/)
183
+ typedef(orig_type.to_sym, new_type.to_sym)
184
+ end
185
+ }
186
+ end
187
+ typedef :pointer, :caddr_t
188
+ rescue Errno::ENOENT
189
+ end
190
+ end
@@ -0,0 +1,43 @@
1
+ #
2
+ # Copyright (C) 2009 Andrea Fazzi <andrea.fazzi@alcacoop.it>
3
+ #
4
+ # This file is part of ruby-ffi.
5
+ #
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
+ #
11
+ # * Redistributions of source code must retain the above copyright notice, this
12
+ # list of conditions and the following disclaimer.
13
+ # * Redistributions in binary form must reproduce the above copyright notice
14
+ # this list of conditions and the following disclaimer in the documentation
15
+ # and/or other materials provided with the distribution.
16
+ # * Neither the name of the Ruby FFI project nor the names of its contributors
17
+ # may be used to endorse or promote products derived from this software
18
+ # without specific prior written permission.
19
+ #
20
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
24
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ #
31
+
32
+ require 'ffi/struct'
33
+
34
+ module FFI
35
+
36
+ class Union < FFI::Struct
37
+ def self.builder
38
+ b = StructLayoutBuilder.new
39
+ b.union = true
40
+ b
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,78 @@
1
+ #
2
+ # Copyright (C) 2008, 2009 Wayne Meissner
3
+ # Copyright (C) 2009 Luc Heinrich
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 Ruby FFI project 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
+ module FFI
34
+ class VariadicInvoker
35
+ def init(arg_types, type_map)
36
+ @fixed = Array.new
37
+ @type_map = type_map
38
+ arg_types.each_with_index do |type, i|
39
+ @fixed << type unless type == Type::VARARGS
40
+ end
41
+ end
42
+
43
+
44
+ def call(*args, &block)
45
+ param_types = Array.new(@fixed)
46
+ param_values = Array.new
47
+ @fixed.each_with_index do |t, i|
48
+ param_values << args[i]
49
+ end
50
+ i = @fixed.length
51
+ while i < args.length
52
+ param_types << FFI.find_type(args[i], @type_map)
53
+ param_values << args[i + 1]
54
+ i += 2
55
+ end
56
+ invoke(param_types, param_values, &block)
57
+ end
58
+
59
+ #
60
+ # Attach the invoker to module +mod+ as +mname+
61
+ #
62
+ def attach(mod, mname)
63
+ invoker = self
64
+ params = "*args"
65
+ call = "call"
66
+ mod.module_eval <<-code
67
+ @@#{mname} = invoker
68
+ def self.#{mname}(#{params})
69
+ @@#{mname}.#{call}(#{params})
70
+ end
71
+ def #{mname}(#{params})
72
+ @@#{mname}.#{call}(#{params})
73
+ end
74
+ code
75
+ invoker
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,4 @@
1
+ module FFI
2
+ VERSION = '1.9.10'
3
+ end
4
+
@@ -0,0 +1,20 @@
1
+ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
2
+ Object.send(:remove_const, :FFI) if defined?(::FFI)
3
+ begin
4
+ require RUBY_VERSION.split('.')[0, 2].join('.') + '/ffi_c'
5
+ rescue Exception
6
+ require 'ffi_c'
7
+ end
8
+
9
+ require 'ffi/ffi'
10
+
11
+ elsif defined?(RUBY_ENGINE)
12
+ # Remove the ffi gem dir from the load path, then reload the internal ffi implementation
13
+ $LOAD_PATH.delete(File.dirname(__FILE__))
14
+ $LOAD_PATH.delete(File.join(File.dirname(__FILE__), 'ffi'))
15
+ unless $LOADED_FEATURES.nil?
16
+ $LOADED_FEATURES.delete(__FILE__)
17
+ $LOADED_FEATURES.delete('ffi.rb')
18
+ end
19
+ require 'ffi.rb'
20
+ end
@@ -0,0 +1,52 @@
1
+ /*
2
+ * Copyright (c) 2007 Wayne Meissner. All rights reserved.
3
+ *
4
+ * For licensing, see LICENSE.SPECS
5
+ */
6
+ #include <sys/types.h>
7
+ #include <stdint.h>
8
+
9
+ void returnVoid() {
10
+
11
+ }
12
+
13
+ void returnVoidI(int arg) {
14
+
15
+ }
16
+ int returnInt() {
17
+ return 0;
18
+ }
19
+
20
+ int returnIntI(int arg) {
21
+ return arg;
22
+ }
23
+
24
+ typedef int8_t s8;
25
+ typedef uint8_t u8;
26
+ typedef int16_t s16;
27
+ typedef uint16_t u16;
28
+ typedef int32_t s32;
29
+ typedef uint32_t u32;
30
+ typedef int64_t s64;
31
+ typedef uint64_t u64;
32
+ typedef float f32;
33
+ typedef double f64;
34
+ typedef void v;
35
+ typedef char* S;
36
+ typedef void* P;
37
+
38
+ #define B6(R, T1, T2, T3, T4, T5, T6) R bench_##T1##T2##T3##T4##T5##T6##_##R(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) {}
39
+ #define B5(R, T1, T2, T3, T4, T5) R bench_##T1##T2##T3##T4##T5##_##R(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {}
40
+ #define B4(R, T1, T2, T3, T4) R bench_##T1##T2##T3##T4##_##R(T1 a1, T2 a2, T3 a3, T4 a4) {}
41
+ #define B3(R, T1, T2, T3) R bench_##T1##T2##T3##_##R(T1 a1, T2 a2, T3 a3) {}
42
+ #define B2(R, T1, T2) R bench_##T1##T2##_##R(T1 a1, T2 a2) {}
43
+ #define B1(R, T1) R bench_##T1##_##R(T1 a1) {}
44
+ #define BrV(T) B1(v, T); B2(v, T, T); B3(v, T, T, T); B4(v, T, T, T, T); B5(v, T, T, T, T, T); B6(v, T, T, T, T, T, T);
45
+ BrV(u32);
46
+ BrV(s32);
47
+ BrV(s64);
48
+ BrV(u64);
49
+ BrV(f32);
50
+ BrV(f64);
51
+ BrV(S);
52
+ BrV(P);
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright (c) 2007 Wayne Meissner.
3
+ * Copyright (c) 2009 Aman Gupta.
4
+ *
5
+ * All rights reserved.
6
+ *
7
+ * For licensing, see LICENSE.SPECS
8
+ */
9
+
10
+ #include <stdbool.h>
11
+
12
+ bool
13
+ bool_return_true()
14
+ {
15
+ return true;
16
+ }
17
+
18
+ bool
19
+ bool_return_false()
20
+ {
21
+ return false;
22
+ }
23
+
24
+ bool
25
+ bool_return_val(bool value)
26
+ {
27
+ return value;
28
+ }
29
+
30
+ bool
31
+ bool_reverse_val(bool value)
32
+ {
33
+ return value ? false : true;
34
+ }
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Copyright (c) 2007 Wayne Meissner. All rights reserved.
3
+ *
4
+ * For licensing, see LICENSE.SPECS
5
+ */
6
+
7
+
8
+ #define MEMSET(buf, value, size) do { \
9
+ int i; for (i = 0; i < size; ++i) buf[i] = value; \
10
+ } while(0)
11
+ #define MEMCPY(dst, src, size) do { \
12
+ int i; for (i = 0; i < size; ++i) dst[i] = src[i]; \
13
+ } while(0)
14
+
15
+ #define FILL(JTYPE, CTYPE) \
16
+ void fill##JTYPE##Buffer(CTYPE* buf, CTYPE value, int size) { MEMSET(buf, value, size); }
17
+
18
+ #define COPY(JTYPE, CTYPE) \
19
+ void copy##JTYPE##Buffer(CTYPE* dst, CTYPE* src, int size) { MEMCPY(dst, src, size); }
20
+
21
+ #define FUNC(JTYPE, CTYPE) \
22
+ FILL(JTYPE, CTYPE); \
23
+ COPY(JTYPE, CTYPE)
24
+
25
+ FUNC(Byte, char);
26
+ FUNC(Short, short);
27
+ FUNC(Int, int);
28
+ FUNC(Long, long long);
29
+ FUNC(Float, float);
30
+ FUNC(Double, double);
31
+
@@ -0,0 +1,205 @@
1
+ /*
2
+ * Copyright (c) 2007 Wayne Meissner. All rights reserved.
3
+ *
4
+ * For licensing, see LICENSE.SPECS
5
+ */
6
+
7
+ #include <stdlib.h>
8
+ #include <stdbool.h>
9
+ #ifndef _WIN32
10
+ # include <pthread.h>
11
+ #else
12
+ # include <windows.h>
13
+ # include <process.h>
14
+ #endif
15
+
16
+ #define R(T, rtype) rtype testClosureVr##T(rtype (*closure)(void)) { \
17
+ return closure != NULL ? (*closure)() : (rtype) 0; \
18
+ }
19
+
20
+ #define P(T, ptype) void testClosure##T##rV(void (*closure)(ptype), ptype a1) { \
21
+ if (closure != NULL) (*closure)(a1); \
22
+ }
23
+
24
+ void testClosureVrV(void (*closure)(void))
25
+ {
26
+ (*closure)();
27
+ }
28
+
29
+ R(Z, bool);
30
+ R(B, char);
31
+ R(S, short);
32
+ R(I, int);
33
+ R(L, long);
34
+ R(J, long long);
35
+ R(LL, long long);
36
+ R(F, float);
37
+ R(D, double);
38
+ R(P, const void*);
39
+
40
+
41
+ P(Z, bool);
42
+ P(B, char);
43
+ P(S, short);
44
+ P(I, int);
45
+ P(L, long);
46
+ P(J, long long);
47
+ P(LL, long long);
48
+ P(F, float);
49
+ P(D, double);
50
+ P(P, const void*);
51
+ P(UL, unsigned long);
52
+
53
+ #if defined(_WIN32) && !defined(_WIN64)
54
+ bool __stdcall testClosureStdcall(long *a1, void __stdcall(*closure)(void *, long), long a2) { \
55
+ void* sp_pre;
56
+ void* sp_post;
57
+
58
+ asm volatile (" movl %%esp,%0" : "=g" (sp_pre));
59
+ (*closure)(a1, a2);
60
+ asm volatile (" movl %%esp,%0" : "=g" (sp_post));
61
+
62
+ /* %esp before pushing parameters on the stack and after the call returns
63
+ * should be equal, if both sides respects the stdcall convention */
64
+ return sp_pre == sp_post;
65
+ }
66
+ #endif
67
+
68
+ void testOptionalClosureBrV(void (*closure)(char), char a1)
69
+ {
70
+ if (closure) {
71
+ (*closure)(a1);
72
+ }
73
+ }
74
+
75
+
76
+ struct ThreadVrV {
77
+ void (*closure)(void);
78
+ int count;
79
+ };
80
+
81
+ static void *
82
+ threadVrV(void *arg)
83
+ {
84
+ struct ThreadVrV* t = (struct ThreadVrV *) arg;
85
+
86
+ int i;
87
+ for (i = 0; i < t->count; i++) {
88
+ (*t->closure)();
89
+ }
90
+
91
+ return NULL;
92
+ }
93
+
94
+ void testThreadedClosureVrV(void (*closure)(void), int n)
95
+ {
96
+ struct ThreadVrV arg = {closure, n};
97
+ #ifndef _WIN32
98
+ pthread_t t;
99
+ pthread_create(&t, NULL, threadVrV, &arg);
100
+ pthread_join(t, NULL);
101
+ #else
102
+ HANDLE hThread = (HANDLE) _beginthread((void (*)(void *))threadVrV, 0, &arg);
103
+ WaitForSingleObject(hThread, INFINITE);
104
+ #endif
105
+ }
106
+
107
+ struct s8f32s32 {
108
+ char s8;
109
+ float f32;
110
+ int s32;
111
+ };
112
+
113
+ // Takes a struct argument
114
+ void testClosureTrV(void (*closure)(struct s8f32s32 s), struct s8f32s32* s)
115
+ {
116
+ (*closure)(*s);
117
+ }
118
+
119
+ // Returns a struct value
120
+ struct s8f32s32 testClosureVrT(struct s8f32s32 (*closure)())
121
+ {
122
+ return (*closure)();
123
+ }
124
+
125
+ typedef int (*returnTypeClosure_t)(int) ;
126
+ typedef returnTypeClosure_t (*lookupClosure_t)();
127
+
128
+ int testReturnsClosure(lookupClosure_t lookup, int val)
129
+ {
130
+ returnTypeClosure_t func = lookup ? (*lookup)() : NULL;
131
+ return func ? (*func)(val) : 0;
132
+ }
133
+
134
+ static int multiplyByTwo(int value)
135
+ {
136
+ return value * 2;
137
+ }
138
+
139
+ returnTypeClosure_t testReturnsFunctionPointer()
140
+ {
141
+ return multiplyByTwo;
142
+ }
143
+
144
+ typedef int (*argumentClosure_t)(int);
145
+ typedef int (*withArgumentClosure_t)(argumentClosure_t, int);
146
+
147
+ int testArgumentClosure(withArgumentClosure_t closure_with, argumentClosure_t closure_arg, int val)
148
+ {
149
+ return (*closure_with)(closure_arg, val);
150
+ }
151
+
152
+
153
+ //
154
+ // These macros produce functions of the form:
155
+ // testClosureBIrV(void (*closure)(char, int), char a1, int a2) {}
156
+ //
157
+ #define C2_(J1, J2, N1, N2) \
158
+ void testClosure##J1##J2##rV(void (*closure)(N1, N2), N1 a1, N2 a2) \
159
+ { \
160
+ if (closure != NULL) (*closure)(a1, a2); \
161
+ }
162
+
163
+ #define C2(J, N) \
164
+ C2_(B, J, char, N) \
165
+ C2_(S, J, short, N) \
166
+ C2_(I, J, int, N) \
167
+ C2_(LL, J, long long, N) \
168
+ C2_(F, J, float, N) \
169
+ C2_(D, J, double, N) \
170
+
171
+
172
+ C2(B, char);
173
+ C2(S, short);
174
+ C2(I, int);
175
+ C2(LL, long long);
176
+ C2(F, float);
177
+ C2(D, double);
178
+
179
+ #define C3_(J1, J2, J3, N1, N2, N3) \
180
+ void testClosure##J1##J2##J3##rV(void (*closure)(N1, N2, N3), N1 a1, N2 a2, N3 a3) \
181
+ { \
182
+ (*closure)(a1, a2, a3); \
183
+ }
184
+
185
+
186
+ #define C3(J, N) \
187
+ C3_(B, J, B, char, N, char) \
188
+ C3_(S, J, S, short, N, short) \
189
+ C3_(I, J, I, int, N, int) \
190
+ C3_(LL, J, LL, long long, N, long long) \
191
+ C3_(F, J, F, float, N, float) \
192
+ C3_(D, J, D, double, N, double) \
193
+
194
+ C3(B, char);
195
+ C3(S, short);
196
+ C3(I, int);
197
+ C3(LL, long long);
198
+ C3(F, float);
199
+ C3(D, double);
200
+ C3_(B, S, I, char, short, int);
201
+ C3_(B, S, LL, char, short, long long);
202
+ C3_(LL, S, B, long long, short, char);
203
+ C3_(LL, B, S, long long, char, short);
204
+
205
+