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,194 @@
1
+ #
2
+ # Copyright (C) 2008-2010 Wayne Meissner
3
+ # Copyright (C) 2008 Mike Dalessio
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
+ module FFI
33
+ class AutoPointer < Pointer
34
+ extend DataConverter
35
+
36
+ # @overload initialize(pointer, method)
37
+ # @param [Pointer] pointer
38
+ # @param [Method] method
39
+ # @return [self]
40
+ # The passed Method will be invoked at GC time.
41
+ # @overload initialize(pointer, proc)
42
+ # @param [Pointer] pointer
43
+ # @return [self]
44
+ # The passed Proc will be invoked at GC time (SEE WARNING BELOW!)
45
+ # @note WARNING: passing a proc _may_ cause your pointer to never be GC'd, unless you're
46
+ # careful to avoid trapping a reference to the pointer in the proc. See the test
47
+ # specs for examples.
48
+ # @overload initialize(pointer) { |p| ... }
49
+ # @param [Pointer] pointer
50
+ # @yieldparam [Pointer] p +pointer+ passed to the block
51
+ # @return [self]
52
+ # The passed block will be invoked at GC time.
53
+ # @note WARNING: passing a block will cause your pointer to never be GC'd. This is bad.
54
+ # @overload initialize(pointer)
55
+ # @param [Pointer] pointer
56
+ # @return [self]
57
+ # The pointer's release() class method will be invoked at GC time.
58
+ #
59
+ # @note The safest, and therefore preferred, calling
60
+ # idiom is to pass a Method as the second parameter. Example usage:
61
+ #
62
+ # class PointerHelper
63
+ # def self.release(pointer)
64
+ # ...
65
+ # end
66
+ # end
67
+ #
68
+ # p = AutoPointer.new(other_pointer, PointerHelper.method(:release))
69
+ #
70
+ # The above code will cause PointerHelper#release to be invoked at GC time.
71
+ #
72
+ # @note
73
+ # The last calling idiom (only one parameter) is generally only
74
+ # going to be useful if you subclass {AutoPointer}, and override
75
+ # #release, which by default does nothing.
76
+ def initialize(ptr, proc=nil, &block)
77
+ super(ptr.type_size, ptr)
78
+ raise TypeError, "Invalid pointer" if ptr.nil? || !ptr.kind_of?(Pointer) \
79
+ || ptr.kind_of?(MemoryPointer) || ptr.kind_of?(AutoPointer)
80
+
81
+ @releaser = if proc
82
+ raise RuntimeError.new("proc must be callable") unless proc.respond_to?(:call)
83
+ CallableReleaser.new(ptr, proc)
84
+
85
+ else
86
+ raise RuntimeError.new("no release method defined") unless self.class.respond_to?(:release)
87
+ DefaultReleaser.new(ptr, self.class)
88
+ end
89
+
90
+ ObjectSpace.define_finalizer(self, @releaser)
91
+ self
92
+ end
93
+
94
+ # @return [nil]
95
+ # Free the pointer.
96
+ def free
97
+ @releaser.free
98
+ end
99
+
100
+ # @param [Boolean] autorelease
101
+ # @return [Boolean] +autorelease+
102
+ # Set +autorelease+ property. See {Pointer Autorelease section at Pointer}.
103
+ def autorelease=(autorelease)
104
+ @releaser.autorelease=(autorelease)
105
+ end
106
+
107
+ # @return [Boolean] +autorelease+
108
+ # Get +autorelease+ property. See {Pointer Autorelease section at Pointer}.
109
+ def autorelease?
110
+ @releaser.autorelease
111
+ end
112
+
113
+ # @abstract Base class for {AutoPointer}'s releasers.
114
+ #
115
+ # All subclasses of Releaser should define a +#release(ptr)+ method.
116
+ # A releaser is an object in charge of release an {AutoPointer}.
117
+ class Releaser
118
+ attr_accessor :autorelease
119
+
120
+ # @param [Pointer] ptr
121
+ # @param [#call] proc
122
+ # @return [nil]
123
+ # A new instance of Releaser.
124
+ def initialize(ptr, proc)
125
+ @ptr = ptr
126
+ @proc = proc
127
+ @autorelease = true
128
+ end
129
+
130
+ # @return [nil]
131
+ # Free pointer.
132
+ def free
133
+ if @ptr
134
+ release(@ptr)
135
+ @autorelease = false
136
+ @ptr = nil
137
+ @proc = nil
138
+ end
139
+ end
140
+
141
+ # @param args
142
+ # Release pointer if +autorelease+ is set.
143
+ def call(*args)
144
+ release(@ptr) if @autorelease && @ptr
145
+ end
146
+
147
+ end
148
+
149
+ # DefaultReleaser is a {Releaser} used when an {AutoPointer} is defined without Proc
150
+ # or Method. In this case, the pointer to release must be of a class derived from
151
+ # AutoPointer with a +#release+ class method.
152
+ class DefaultReleaser < Releaser
153
+ # @param [Pointer] ptr
154
+ # @return [nil]
155
+ # Release +ptr+ by using his #release class method.
156
+ def release(ptr)
157
+ @proc.release(ptr)
158
+ end
159
+ end
160
+
161
+ # CallableReleaser is a {Releaser} used when an {AutoPointer} is defined with a
162
+ # Proc or a Method.
163
+ class CallableReleaser < Releaser
164
+ # Release +ptr+ by using Proc or Method defined at +ptr+ {AutoPointer#initialize initialization}.
165
+ # @param [Pointer] ptr
166
+ # @return [nil]
167
+ def release(ptr)
168
+ @proc.call(ptr)
169
+ end
170
+ end
171
+
172
+ # Return native type of AutoPointer.
173
+ #
174
+ # Override {DataConverter#native_type}.
175
+ # @return [Type::POINTER]
176
+ # @raise {RuntimeError} if class does not implement a +#release+ method
177
+ def self.native_type
178
+ raise RuntimeError.new("no release method defined for #{self.inspect}") unless self.respond_to?(:release)
179
+ Type::POINTER
180
+ end
181
+
182
+ # Create a new AutoPointer.
183
+ #
184
+ # Override {DataConverter#from_native}.
185
+ # @overload self.from_native(ptr, ctx)
186
+ # @param [Pointer] ptr
187
+ # @param ctx not used. Please set +nil+.
188
+ # @return [AutoPointer]
189
+ def self.from_native(val, ctx)
190
+ self.new(val)
191
+ end
192
+ end
193
+
194
+ end
@@ -0,0 +1,4 @@
1
+ #
2
+ # All the code from this file is now implemented in C. This file remains
3
+ # to satisfy any leftover require 'ffi/buffer' in user code
4
+ #
@@ -0,0 +1,4 @@
1
+ #
2
+ # All the code from this file is now implemented in C. This file remains
3
+ # to satisfy any leftover require 'ffi/callback' in user code
4
+ #
@@ -0,0 +1,174 @@
1
+ #
2
+ # Copyright (C) 2009, 2010 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
+
35
+ # An instance of this class permits to manage {Enum}s. In fact, Enums is a collection of {Enum}s.
36
+ class Enums
37
+
38
+ # @return [nil]
39
+ def initialize
40
+ @all_enums = Array.new
41
+ @tagged_enums = Hash.new
42
+ @symbol_map = Hash.new
43
+ end
44
+
45
+ # @param [Enum] enum
46
+ # Add an {Enum} to the collection.
47
+ def <<(enum)
48
+ @all_enums << enum
49
+ @tagged_enums[enum.tag] = enum unless enum.tag.nil?
50
+ @symbol_map.merge!(enum.symbol_map)
51
+ end
52
+
53
+ # @param query enum tag or part of an enum name
54
+ # @return [Enum]
55
+ # Find a {Enum} in collection.
56
+ def find(query)
57
+ if @tagged_enums.has_key?(query)
58
+ @tagged_enums[query]
59
+ else
60
+ @all_enums.detect { |enum| enum.symbols.include?(query) }
61
+ end
62
+ end
63
+
64
+ # @param symbol a symbol to find in merge symbol maps of all enums.
65
+ # @return a symbol
66
+ def __map_symbol(symbol)
67
+ @symbol_map[symbol]
68
+ end
69
+
70
+ end
71
+
72
+ # Represents a C enum.
73
+ #
74
+ # For a C enum:
75
+ # enum fruits {
76
+ # apple,
77
+ # banana,
78
+ # orange,
79
+ # pineapple
80
+ # };
81
+ # are defined this vocabulary:
82
+ # * a _symbol_ is a word from the enumeration (ie. _apple_, by example);
83
+ # * a _value_ is the value of a symbol in the enumeration (by example, apple has value _0_ and banana _1_).
84
+ class Enum
85
+ include DataConverter
86
+
87
+ attr_reader :tag
88
+ attr_reader :native_type
89
+
90
+ # @overload initialize(info, tag=nil)
91
+ # @param [nil, Enumerable] info
92
+ # @param [nil, Symbol] tag enum tag
93
+ # @overload initialize(native_type, info, tag=nil)
94
+ # @param [FFI::Type] native_type Native type for new Enum
95
+ # @param [nil, Enumerable] info symbols and values for new Enum
96
+ # @param [nil, Symbol] tag name of new Enum
97
+ def initialize(*args)
98
+ @native_type = args.first.kind_of?(FFI::Type) ? args.shift : Type::INT
99
+ info, @tag = *args
100
+ @kv_map = Hash.new
101
+ unless info.nil?
102
+ last_cst = nil
103
+ value = 0
104
+ info.each do |i|
105
+ case i
106
+ when Symbol
107
+ raise ArgumentError, "duplicate enum key" if @kv_map.has_key?(i)
108
+ @kv_map[i] = value
109
+ last_cst = i
110
+ value += 1
111
+ when Integer
112
+ @kv_map[last_cst] = i
113
+ value = i+1
114
+ end
115
+ end
116
+ end
117
+ @vk_map = @kv_map.invert
118
+ end
119
+
120
+ # @return [Array] enum symbol names
121
+ def symbols
122
+ @kv_map.keys
123
+ end
124
+
125
+ # Get a symbol or a value from the enum.
126
+ # @overload [](query)
127
+ # Get enum value from symbol.
128
+ # @param [Symbol] query
129
+ # @return [Integer]
130
+ # @overload [](query)
131
+ # Get enum symbol from value.
132
+ # @param [Integer] query
133
+ # @return [Symbol]
134
+ def [](query)
135
+ case query
136
+ when Symbol
137
+ @kv_map[query]
138
+ when Integer
139
+ @vk_map[query]
140
+ end
141
+ end
142
+ alias find []
143
+
144
+ # Get the symbol map.
145
+ # @return [Hash]
146
+ def symbol_map
147
+ @kv_map
148
+ end
149
+
150
+ alias to_h symbol_map
151
+ alias to_hash symbol_map
152
+
153
+ # @param [Symbol, Integer, #to_int] val
154
+ # @param ctx unused
155
+ # @return [Integer] value of a enum symbol
156
+ def to_native(val, ctx)
157
+ @kv_map[val] || if val.is_a?(Integer)
158
+ val
159
+ elsif val.respond_to?(:to_int)
160
+ val.to_int
161
+ else
162
+ raise ArgumentError, "invalid enum value, #{val.inspect}"
163
+ end
164
+ end
165
+
166
+ # @param val
167
+ # @return symbol name if it exists for +val+.
168
+ def from_native(val, ctx)
169
+ @vk_map[val] || val
170
+ end
171
+
172
+ end
173
+
174
+ end
@@ -0,0 +1,43 @@
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
+ # @return (see FFI::LastError.error)
33
+ # @see FFI::LastError.error
34
+ def self.errno
35
+ FFI::LastError.error
36
+ end
37
+ # @param error (see FFI::LastError.error=)
38
+ # @return (see FFI::LastError.error=)
39
+ # @see FFI::LastError.error=
40
+ def self.errno=(error)
41
+ FFI::LastError.error = error
42
+ end
43
+ end
@@ -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
+