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,44 @@
1
+ #
2
+ # Copyright (C) 2008-2010 JRuby project
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
+ require 'ffi/platform'
32
+ require 'ffi/types'
33
+ require 'ffi/library'
34
+ require 'ffi/errno'
35
+ require 'ffi/pointer'
36
+ require 'ffi/memorypointer'
37
+ require 'ffi/struct'
38
+ require 'ffi/union'
39
+ require 'ffi/managedstruct'
40
+ require 'ffi/callback'
41
+ require 'ffi/io'
42
+ require 'ffi/autopointer'
43
+ require 'ffi/variadic'
44
+ require 'ffi/enum'
@@ -0,0 +1,62 @@
1
+ #
2
+ # Copyright (C) 2008, 2009 Wayne Meissner
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
+ module FFI
32
+
33
+ # This module implements a couple of class methods to play with IO.
34
+ module IO
35
+ # @param [Integer] fd file decriptor
36
+ # @param [String] mode mode string
37
+ # @return [::IO]
38
+ # Synonym for IO::for_fd.
39
+ def self.for_fd(fd, mode = "r")
40
+ ::IO.for_fd(fd, mode)
41
+ end
42
+
43
+ # @param [#read] io io to read from
44
+ # @param [AbstractMemory] buf destination for data read from +io+
45
+ # @param [nil, Numeric] len maximul number of bytes to read from +io+. If +nil+,
46
+ # read until end of file.
47
+ # @return [Numeric] length really read, in bytes
48
+ #
49
+ # A version of IO#read that reads data from an IO and put then into a native buffer.
50
+ #
51
+ # This will be optimized at some future time to eliminate the double copy.
52
+ #
53
+ def self.native_read(io, buf, len)
54
+ tmp = io.read(len)
55
+ return -1 unless tmp
56
+ buf.put_bytes(0, tmp)
57
+ tmp.length
58
+ end
59
+
60
+ end
61
+ end
62
+
@@ -0,0 +1,524 @@
1
+ #
2
+ # Copyright (C) 2008-2010 Wayne Meissner
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
+ module FFI
32
+ CURRENT_PROCESS = USE_THIS_PROCESS_AS_LIBRARY = Object.new
33
+
34
+ # @param [#to_s] lib library name
35
+ # @return [String] library name formatted for current platform
36
+ # Transform a generic library name to a platform library name
37
+ # @example
38
+ # # Linux
39
+ # FFI.map_library_name 'c' # -> "libc.so.6"
40
+ # FFI.map_library_name 'jpeg' # -> "libjpeg.so"
41
+ # # Windows
42
+ # FFI.map_library_name 'c' # -> "msvcrt.dll"
43
+ # FFI.map_library_name 'jpeg' # -> "jpeg.dll"
44
+ def self.map_library_name(lib)
45
+ # Mangle the library name to reflect the native library naming conventions
46
+ lib = lib.to_s unless lib.kind_of?(String)
47
+ lib = Library::LIBC if lib == 'c'
48
+
49
+ if lib && File.basename(lib) == lib
50
+ lib = Platform::LIBPREFIX + lib unless lib =~ /^#{Platform::LIBPREFIX}/
51
+ r = Platform::IS_GNU ? "\\.so($|\\.[1234567890]+)" : "\\.#{Platform::LIBSUFFIX}$"
52
+ lib += ".#{Platform::LIBSUFFIX}" unless lib =~ /#{r}/
53
+ end
54
+
55
+ lib
56
+ end
57
+
58
+ # Exception raised when a function is not found in libraries
59
+ class NotFoundError < LoadError
60
+ def initialize(function, *libraries)
61
+ super("Function '#{function}' not found in [#{libraries[0].nil? ? 'current process' : libraries.join(", ")}]")
62
+ end
63
+ end
64
+
65
+ # This module is the base to use native functions.
66
+ #
67
+ # A basic usage may be:
68
+ # require 'ffi'
69
+ #
70
+ # module Hello
71
+ # extend FFI::Library
72
+ # ffi_lib FFI::Library::LIBC
73
+ # attach_function 'puts', [ :string ], :int
74
+ # end
75
+ #
76
+ # Hello.puts("Hello, World")
77
+ #
78
+ #
79
+ module Library
80
+ CURRENT_PROCESS = FFI::CURRENT_PROCESS
81
+ LIBC = FFI::Platform::LIBC
82
+
83
+ # @param mod extended object
84
+ # @return [nil]
85
+ # @raise {RuntimeError} if +mod+ is not a Module
86
+ # Test if extended object is a Module. If not, raise RuntimeError.
87
+ def self.extended(mod)
88
+ raise RuntimeError.new("must only be extended by module") unless mod.kind_of?(Module)
89
+ end
90
+
91
+
92
+ # @param [Array] names names of libraries to load
93
+ # @return [Array<DynamicLibrary>]
94
+ # @raise {LoadError} if a library cannot be opened
95
+ # Load native libraries.
96
+ def ffi_lib(*names)
97
+ raise LoadError.new("library names list must not be empty") if names.empty?
98
+
99
+ lib_flags = defined?(@ffi_lib_flags) ? @ffi_lib_flags : FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_LOCAL
100
+ ffi_libs = names.map do |name|
101
+
102
+ if name == FFI::CURRENT_PROCESS
103
+ FFI::DynamicLibrary.open(nil, FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_LOCAL)
104
+
105
+ else
106
+ libnames = (name.is_a?(::Array) ? name : [ name ]).map { |n| [ n, FFI.map_library_name(n) ].uniq }.flatten.compact
107
+ lib = nil
108
+ errors = {}
109
+
110
+ libnames.each do |libname|
111
+ begin
112
+ lib = FFI::DynamicLibrary.open(libname, lib_flags)
113
+ break if lib
114
+
115
+ rescue Exception => ex
116
+ ldscript = false
117
+ if ex.message =~ /(([^ \t()])+\.so([^ \t:()])*):([ \t])*(invalid ELF header|file too short|invalid file format)/
118
+ if File.read($1) =~ /(?:GROUP|INPUT) *\( *([^ \)]+)/
119
+ libname = $1
120
+ ldscript = true
121
+ end
122
+ end
123
+
124
+ if ldscript
125
+ retry
126
+ else
127
+ errors[libname] = ex
128
+ end
129
+ end
130
+ end
131
+
132
+ if lib.nil?
133
+ raise LoadError.new(errors.values.join(".\n"))
134
+ end
135
+
136
+ # return the found lib
137
+ lib
138
+ end
139
+ end
140
+
141
+ @ffi_libs = ffi_libs
142
+ end
143
+
144
+ # Set the calling convention for {#attach_function} and {#callback}
145
+ #
146
+ # @see http://en.wikipedia.org/wiki/Stdcall#stdcall
147
+ # @note +:stdcall+ is typically used for attaching Windows API functions
148
+ #
149
+ # @param [Symbol] convention one of +:default+, +:stdcall+
150
+ # @return [Symbol] the new calling convention
151
+ def ffi_convention(convention = nil)
152
+ @ffi_convention ||= :default
153
+ @ffi_convention = convention if convention
154
+ @ffi_convention
155
+ end
156
+
157
+ # @see #ffi_lib
158
+ # @return [Array<FFI::DynamicLibrary>] array of currently loaded FFI libraries
159
+ # @raise [LoadError] if no libraries have been loaded (using {#ffi_lib})
160
+ # Get FFI libraries loaded using {#ffi_lib}.
161
+ def ffi_libraries
162
+ raise LoadError.new("no library specified") if !defined?(@ffi_libs) || @ffi_libs.empty?
163
+ @ffi_libs
164
+ end
165
+
166
+ # Flags used in {#ffi_lib}.
167
+ #
168
+ # This map allows you to supply symbols to {#ffi_lib_flags} instead of
169
+ # the actual constants.
170
+ FlagsMap = {
171
+ :global => DynamicLibrary::RTLD_GLOBAL,
172
+ :local => DynamicLibrary::RTLD_LOCAL,
173
+ :lazy => DynamicLibrary::RTLD_LAZY,
174
+ :now => DynamicLibrary::RTLD_NOW
175
+ }
176
+
177
+ # Sets library flags for {#ffi_lib}.
178
+ #
179
+ # @example
180
+ # ffi_lib_flags(:lazy, :local) # => 5
181
+ #
182
+ # @param [Symbol, …] flags (see {FlagsMap})
183
+ # @return [Fixnum] the new value
184
+ def ffi_lib_flags(*flags)
185
+ @ffi_lib_flags = flags.inject(0) { |result, f| result | FlagsMap[f] }
186
+ end
187
+
188
+
189
+ ##
190
+ # @overload attach_function(func, args, returns, options = {})
191
+ # @example attach function without an explicit name
192
+ # module Foo
193
+ # extend FFI::Library
194
+ # ffi_lib FFI::Library::LIBC
195
+ # attach_function :malloc, [:size_t], :pointer
196
+ # end
197
+ # # now callable via Foo.malloc
198
+ # @overload attach_function(name, func, args, returns, options = {})
199
+ # @example attach function with an explicit name
200
+ # module Bar
201
+ # extend FFI::Library
202
+ # ffi_lib FFI::Library::LIBC
203
+ # attach_function :c_malloc, :malloc, [:size_t], :pointer
204
+ # end
205
+ # # now callable via Bar.c_malloc
206
+ #
207
+ # Attach C function +func+ to this module.
208
+ #
209
+ #
210
+ # @param [#to_s] name name of ruby method to attach as
211
+ # @param [#to_s] func name of C function to attach
212
+ # @param [Array<Symbol>] args an array of types
213
+ # @param [Symbol] returns type of return value
214
+ # @option options [Boolean] :blocking (@blocking) set to true if the C function is a blocking call
215
+ # @option options [Symbol] :convention (:default) calling convention (see {#ffi_convention})
216
+ # @option options [FFI::Enums] :enums
217
+ # @option options [Hash] :type_map
218
+ #
219
+ # @return [FFI::VariadicInvoker]
220
+ #
221
+ # @raise [FFI::NotFoundError] if +func+ cannot be found in the attached libraries (see {#ffi_lib})
222
+ def attach_function(name, func, args, returns = nil, options = nil)
223
+ mname, a2, a3, a4, a5 = name, func, args, returns, options
224
+ cname, arg_types, ret_type, opts = (a4 && (a2.is_a?(String) || a2.is_a?(Symbol))) ? [ a2, a3, a4, a5 ] : [ mname.to_s, a2, a3, a4 ]
225
+
226
+ # Convert :foo to the native type
227
+ arg_types = arg_types.map { |e| find_type(e) }
228
+ options = {
229
+ :convention => ffi_convention,
230
+ :type_map => defined?(@ffi_typedefs) ? @ffi_typedefs : nil,
231
+ :blocking => defined?(@blocking) && @blocking,
232
+ :enums => defined?(@ffi_enums) ? @ffi_enums : nil,
233
+ }
234
+
235
+ @blocking = false
236
+ options.merge!(opts) if opts && opts.is_a?(Hash)
237
+
238
+ # Try to locate the function in any of the libraries
239
+ invokers = []
240
+ ffi_libraries.each do |lib|
241
+ if invokers.empty?
242
+ begin
243
+ function = nil
244
+ function_names(cname, arg_types).find do |fname|
245
+ function = lib.find_function(fname)
246
+ end
247
+ raise LoadError unless function
248
+
249
+ invokers << if arg_types.length > 0 && arg_types[arg_types.length - 1] == FFI::NativeType::VARARGS
250
+ VariadicInvoker.new(function, arg_types, find_type(ret_type), options)
251
+
252
+ else
253
+ Function.new(find_type(ret_type), arg_types, function, options)
254
+ end
255
+
256
+ rescue LoadError
257
+ end
258
+ end
259
+ end
260
+ invoker = invokers.compact.shift
261
+ raise FFI::NotFoundError.new(cname.to_s, ffi_libraries.map { |lib| lib.name }) unless invoker
262
+
263
+ invoker.attach(self, mname.to_s)
264
+ invoker
265
+ end
266
+
267
+ # @param [#to_s] name function name
268
+ # @param [Array] arg_types function's argument types
269
+ # @return [Array<String>]
270
+ # This function returns a list of possible names to lookup.
271
+ # @note Function names on windows may be decorated if they are using stdcall. See
272
+ # * http://en.wikipedia.org/wiki/Name_mangling#C_name_decoration_in_Microsoft_Windows
273
+ # * http://msdn.microsoft.com/en-us/library/zxk0tw93%28v=VS.100%29.aspx
274
+ # * http://en.wikibooks.org/wiki/X86_Disassembly/Calling_Conventions#STDCALL
275
+ # Note that decorated names can be overridden via def files. Also note that the
276
+ # windows api, although using, doesn't have decorated names.
277
+ def function_names(name, arg_types)
278
+ result = [name.to_s]
279
+ if ffi_convention == :stdcall
280
+ # Get the size of each parameter
281
+ size = arg_types.inject(0) do |mem, arg|
282
+ size = arg.size
283
+ # The size must be a multiple of 4
284
+ size += (4 - size) % 4
285
+ mem + size
286
+ end
287
+
288
+ result << "_#{name.to_s}@#{size}" # win32
289
+ result << "#{name.to_s}@#{size}" # win64
290
+ end
291
+ result
292
+ end
293
+
294
+ # @overload attach_variable(mname, cname, type)
295
+ # @param [#to_s] mname name of ruby method to attach as
296
+ # @param [#to_s] cname name of C variable to attach
297
+ # @param [DataConverter, Struct, Symbol, Type] type C variable's type
298
+ # @example
299
+ # module Bar
300
+ # extend FFI::Library
301
+ # ffi_lib 'my_lib'
302
+ # attach_variable :c_myvar, :myvar, :long
303
+ # end
304
+ # # now callable via Bar.c_myvar
305
+ # @overload attach_variable(cname, type)
306
+ # @param [#to_s] mname name of ruby method to attach as
307
+ # @param [DataConverter, Struct, Symbol, Type] type C variable's type
308
+ # @example
309
+ # module Bar
310
+ # extend FFI::Library
311
+ # ffi_lib 'my_lib'
312
+ # attach_variable :myvar, :long
313
+ # end
314
+ # # now callable via Bar.myvar
315
+ # @return [DynamicLibrary::Symbol]
316
+ # @raise {FFI::NotFoundError} if +cname+ cannot be found in libraries
317
+ #
318
+ # Attach C variable +cname+ to this module.
319
+ def attach_variable(mname, a1, a2 = nil)
320
+ cname, type = a2 ? [ a1, a2 ] : [ mname.to_s, a1 ]
321
+ address = nil
322
+ ffi_libraries.each do |lib|
323
+ begin
324
+ address = lib.find_variable(cname.to_s)
325
+ break unless address.nil?
326
+ rescue LoadError
327
+ end
328
+ end
329
+
330
+ raise FFI::NotFoundError.new(cname, ffi_libraries) if address.nil? || address.null?
331
+ if type.is_a?(Class) && type < FFI::Struct
332
+ # If it is a global struct, just attach directly to the pointer
333
+ s = type.new(address)
334
+ self.module_eval <<-code, __FILE__, __LINE__
335
+ @@ffi_gvar_#{mname} = s
336
+ def self.#{mname}
337
+ @@ffi_gvar_#{mname}
338
+ end
339
+ code
340
+
341
+ else
342
+ sc = Class.new(FFI::Struct)
343
+ sc.layout :gvar, find_type(type)
344
+ s = sc.new(address)
345
+ #
346
+ # Attach to this module as mname/mname=
347
+ #
348
+ self.module_eval <<-code, __FILE__, __LINE__
349
+ @@ffi_gvar_#{mname} = s
350
+ def self.#{mname}
351
+ @@ffi_gvar_#{mname}[:gvar]
352
+ end
353
+ def self.#{mname}=(value)
354
+ @@ffi_gvar_#{mname}[:gvar] = value
355
+ end
356
+ code
357
+
358
+ end
359
+
360
+ address
361
+ end
362
+
363
+
364
+ # @overload callback(name, params, ret)
365
+ # @param name callback name to add to type map
366
+ # @param [Array] params array of parameters' types
367
+ # @param [DataConverter, Struct, Symbol, Type] ret callback return type
368
+ # @overload callback(params, ret)
369
+ # @param [Array] params array of parameters' types
370
+ # @param [DataConverter, Struct, Symbol, Type] ret callback return type
371
+ # @return [FFI::CallbackInfo]
372
+ def callback(*args)
373
+ raise ArgumentError, "wrong number of arguments" if args.length < 2 || args.length > 3
374
+ name, params, ret = if args.length == 3
375
+ args
376
+ else
377
+ [ nil, args[0], args[1] ]
378
+ end
379
+
380
+ native_params = params.map { |e| find_type(e) }
381
+ raise ArgumentError, "callbacks cannot have variadic parameters" if native_params.include?(FFI::Type::VARARGS)
382
+ options = Hash.new
383
+ options[:convention] = ffi_convention
384
+ options[:enums] = @ffi_enums if defined?(@ffi_enums)
385
+ cb = FFI::CallbackInfo.new(find_type(ret), native_params, options)
386
+
387
+ # Add to the symbol -> type map (unless there was no name)
388
+ unless name.nil?
389
+ typedef cb, name
390
+ end
391
+
392
+ cb
393
+ end
394
+
395
+ # Register or get an already registered type definition.
396
+ #
397
+ # To register a new type definition, +old+ should be a {FFI::Type}. +add+
398
+ # is in this case the type definition.
399
+ #
400
+ # If +old+ is a {DataConverter}, a {Type::Mapped} is returned.
401
+ #
402
+ # If +old+ is +:enum+
403
+ # * and +add+ is an +Array+, a call to {#enum} is made with +add+ as single parameter;
404
+ # * in others cases, +info+ is used to create a named enum.
405
+ #
406
+ # If +old+ is a key for type map, #typedef get +old+ type definition.
407
+ #
408
+ # @param [DataConverter, Symbol, Type] old
409
+ # @param [Symbol] add
410
+ # @param [Symbol] info
411
+ # @return [FFI::Enum, FFI::Type]
412
+ def typedef(old, add, info=nil)
413
+ @ffi_typedefs = Hash.new unless defined?(@ffi_typedefs)
414
+
415
+ @ffi_typedefs[add] = if old.kind_of?(FFI::Type)
416
+ old
417
+
418
+ elsif @ffi_typedefs.has_key?(old)
419
+ @ffi_typedefs[old]
420
+
421
+ elsif old.is_a?(DataConverter)
422
+ FFI::Type::Mapped.new(old)
423
+
424
+ elsif old == :enum
425
+ if add.kind_of?(Array)
426
+ self.enum(add)
427
+ else
428
+ self.enum(info, add)
429
+ end
430
+
431
+ else
432
+ FFI.find_type(old)
433
+ end
434
+ end
435
+
436
+ # @overload enum(name, values)
437
+ # Create a named enum.
438
+ # @example
439
+ # enum :foo, [:zero, :one, :two] # named enum
440
+ # @param [Symbol] name name for new enum
441
+ # @param [Array] values values for enum
442
+ # @overload enum(*args)
443
+ # Create an unnamed enum.
444
+ # @example
445
+ # enum :zero, :one, :two # unnamed enum
446
+ # @param args values for enum
447
+ # @overload enum(values)
448
+ # Create an unnamed enum.
449
+ # @example
450
+ # enum [:zero, :one, :two] # unnamed enum, equivalent to above example
451
+ # @param [Array] values values for enum
452
+ # @overload enum(native_type, name, values)
453
+ # Create a named enum and specify the native type.
454
+ # @example
455
+ # enum FFI::Type::UINT64, :foo, [:zero, :one, :two] # named enum
456
+ # @param [FFI::Type] native_type native type for new enum
457
+ # @param [Symbol] name name for new enum
458
+ # @param [Array] values values for enum
459
+ # @overload enum(native_type, *args)
460
+ # Create an unnamed enum and specify the native type.
461
+ # @example
462
+ # enum FFI::Type::UINT64, :zero, :one, :two # unnamed enum
463
+ # @param [FFI::Type] native_type native type for new enum
464
+ # @param args values for enum
465
+ # @overload enum(native_type, values)
466
+ # Create an unnamed enum and specify the native type.
467
+ # @example
468
+ # enum Type::UINT64, [:zero, :one, :two] # unnamed enum, equivalent to above example
469
+ # @param [FFI::Type] native_type native type for new enum
470
+ # @param [Array] values values for enum
471
+ # @return [FFI::Enum]
472
+ # Create a new {FFI::Enum}.
473
+ def enum(*args)
474
+ native_type = args.first.kind_of?(FFI::Type) ? args.shift : nil
475
+ name, values = if args[0].kind_of?(Symbol) && args[1].kind_of?(Array)
476
+ [ args[0], args[1] ]
477
+ elsif args[0].kind_of?(Array)
478
+ [ nil, args[0] ]
479
+ else
480
+ [ nil, args ]
481
+ end
482
+ @ffi_enums = FFI::Enums.new unless defined?(@ffi_enums)
483
+ @ffi_enums << (e = native_type ? FFI::Enum.new(native_type, values, name) : FFI::Enum.new(values, name))
484
+
485
+ # If called as enum :foo, [ :zero, :one, :two ], add a typedef alias
486
+ typedef(e, name) if name
487
+ e
488
+ end
489
+
490
+ # @param name
491
+ # @return [FFI::Enum]
492
+ # Find an enum by name.
493
+ def enum_type(name)
494
+ @ffi_enums.find(name) if defined?(@ffi_enums)
495
+ end
496
+
497
+ # @param symbol
498
+ # @return [FFI::Enum]
499
+ # Find an enum by a symbol it contains.
500
+ def enum_value(symbol)
501
+ @ffi_enums.__map_symbol(symbol)
502
+ end
503
+
504
+ # @param [DataConverter, Type, Struct, Symbol] t type to find
505
+ # @return [Type]
506
+ # Find a type definition.
507
+ def find_type(t)
508
+ if t.kind_of?(Type)
509
+ t
510
+
511
+ elsif defined?(@ffi_typedefs) && @ffi_typedefs.has_key?(t)
512
+ @ffi_typedefs[t]
513
+
514
+ elsif t.is_a?(Class) && t < Struct
515
+ Type::POINTER
516
+
517
+ elsif t.is_a?(DataConverter)
518
+ # Add a typedef so next time the converter is used, it hits the cache
519
+ typedef Type::Mapped.new(t), t
520
+
521
+ end || FFI.find_type(t)
522
+ end
523
+ end
524
+ end