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,197 @@
1
+
2
+ # The top level namespace for the corefoundation library. The raw FFI generated methods are attached here
3
+ #
4
+ #
5
+ module CF
6
+ extend FFI::Library
7
+ ffi_lib '/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation'
8
+
9
+ if FFI::Platform::ARCH == 'x86_64'
10
+ typedef :long_long, :cfindex
11
+ typedef :long_long, :cfcomparisonresult
12
+ typedef :ulong_long, :cfoptionflags
13
+ typedef :ulong_long, :cftypeid
14
+ typedef :ulong_long, :cfhashcode
15
+ else
16
+ typedef :long, :cfindex
17
+ typedef :long, :cfcomparisonresult
18
+ typedef :ulong, :cfoptionflags
19
+ typedef :ulong, :cftypeid
20
+ typedef :ulong, :cfhashcode
21
+ end
22
+
23
+
24
+ # @private
25
+ class Range < FFI::Struct
26
+ layout :location, :cfindex,
27
+ :length, :cfindex
28
+ end
29
+
30
+ typedef :pointer, :cftyperef
31
+
32
+ #general utility functions
33
+ attach_function :show, 'CFShow', [:cftyperef], :void
34
+ attach_function :release, 'CFRelease', [:cftyperef], :void
35
+ attach_function :retain, 'CFRetain', [:cftyperef], :cftyperef
36
+ attach_function 'CFEqual', [:cftyperef, :cftyperef], :char
37
+ attach_function 'CFHash', [:cftyperef], :cfhashcode
38
+ attach_function 'CFCopyDescription', [:cftyperef], :cftyperef
39
+ attach_function 'CFGetTypeID', [:cftyperef], :cftypeid
40
+
41
+ # The base class for all of the wrapper classes
42
+ #
43
+ # @abstract
44
+ class Base
45
+ @@type_map = {}
46
+
47
+ # @private
48
+ class Releaser
49
+ def initialize(ptr)
50
+ @address = ptr.address
51
+ end
52
+
53
+ def call *ignored
54
+ if @address != 0
55
+ CF.release(@address)
56
+ @address = 0
57
+ end
58
+ end
59
+ end
60
+
61
+ class << self
62
+ # Raises an exception if the argument does not inherit from CF::Base
63
+ #
64
+ # @param cftyperef object to check
65
+ def check_cftype(cftyperef)
66
+ raise TypeError, "#{cftyperef.inspect} is not a cftype" unless cftyperef.is_a?(CF::Base)
67
+ end
68
+
69
+ # Wraps an FFI::Pointer with the appropriate subclass of CF::Base
70
+ # If the pointer is not a CFTypeRef behaviour is undefined
71
+ # @param [FFI::Pointer] cftyperef Object to wrap
72
+ # @return A wrapper object inheriting from CF::Base
73
+ def typecast(cftyperef)
74
+ klass = klass_from_cf_type cftyperef
75
+ klass.new(cftyperef)
76
+ end
77
+
78
+ private
79
+ def klass_from_cf_type cftyperef
80
+ klass = @@type_map[CF.CFGetTypeID(cftyperef)]
81
+ if !klass
82
+ raise TypeError, "No class registered for cf type #{cftyperef.inspect}"
83
+ end
84
+ klass
85
+ end
86
+
87
+ def register_type(type_name)
88
+ CF.attach_function "#{type_name}GetTypeID", [], :cftypeid
89
+ @@type_map[CF.send("#{type_name}GetTypeID")] = self
90
+ end
91
+
92
+ end
93
+
94
+ #
95
+ #
96
+ # @param [FFI::Pointer] ptr The pointer to wrap
97
+ def initialize(ptr)
98
+ @ptr = FFI::Pointer.new(ptr)
99
+ end
100
+
101
+ # Whether the instance is the CFNull singleton
102
+ #
103
+ # @return [Boolean]
104
+ def null?
105
+ equals?(CF::NULL)
106
+ end
107
+
108
+ # Returns the wrapped pointer
109
+ # @return [FFI::Pointer]
110
+ def to_ptr
111
+ @ptr
112
+ end
113
+
114
+ # Sets the wrapper pointer. You should only do this rarely. If you have used release_on_gc then that
115
+ # finalizer will still be called on the original pointer value
116
+ #
117
+ def ptr= ptr
118
+ @ptr = ptr
119
+ end
120
+
121
+ # Calls CFRetain on the wrapped pointer
122
+ # @return Returns self
123
+ def retain
124
+ CF.retain(self)
125
+ self
126
+ end
127
+
128
+ # Calls CFRelease on the wrapped pointer
129
+ # @return Returns self
130
+ def release
131
+ CF.release(self)
132
+ self
133
+ end
134
+
135
+ # Installs a finalizer on the wrapper object that will cause it to call CFRelease on the pointer
136
+ # when the wrapper is garbage collected
137
+ # @return Returns self
138
+ def release_on_gc
139
+ ObjectSpace.define_finalizer(@ptr, Releaser.new(@ptr))
140
+ self
141
+ end
142
+
143
+ # Returns a ruby string containing the output of CFCopyDescription for the wrapped object
144
+ #
145
+ # @return [String]
146
+ def inspect
147
+ cf = CF::String.new(CF.CFCopyDescription(self))
148
+ cf.to_s.tap {cf.release}
149
+ end
150
+
151
+ # Uses CFHash to return a hash code
152
+ #
153
+ # @return [Integer]
154
+ def hash
155
+ CF.CFHash(self)
156
+ end
157
+
158
+ # eql? (and ==) are implemented using CFEqual
159
+ #
160
+ #
161
+ def eql?(other)
162
+ if other.is_a?(CF::Base)
163
+ CF.CFEqual(self, other) != 0
164
+ else
165
+ false
166
+ end
167
+ end
168
+
169
+ # equals? is defined as returning true if the wrapped pointer is the same
170
+ #
171
+ #
172
+ def equals?(other)
173
+ if other.is_a?(CF::Base)
174
+ @ptr.address == other.to_ptr.address
175
+ else
176
+ false
177
+ end
178
+ end
179
+
180
+ alias_method :==, :eql?
181
+
182
+ # Converts the CF object into a ruby object. Subclasses typically override this to return
183
+ # an appropriate object (for example CF::String returns a String)
184
+ #
185
+ def to_ruby
186
+ self
187
+ end
188
+
189
+ # to_cf is a no-op on CF::Base and its descendants - it always returns self
190
+ #
191
+ #
192
+ def to_cf
193
+ self
194
+ end
195
+ end
196
+
197
+ end
@@ -0,0 +1,25 @@
1
+ module CF
2
+ attach_variable 'kCFBooleanTrue', :pointer
3
+ attach_variable 'kCFBooleanFalse', :pointer
4
+ attach_function 'CFBooleanGetValue', [:pointer], :uchar
5
+
6
+ # Wrapper for CFBooleanRef.
7
+ # Typically you use the CF::Boolean::TRUE and CF::Boolean::FALSE constants
8
+ #
9
+ class Boolean < Base
10
+ register_type("CFBoolean")
11
+ # A constant containing kCFBooleanTrue
12
+ TRUE = new(CF.kCFBooleanTrue)
13
+ # A constant containing kCFBooleanFalse
14
+ FALSE = new(CF.kCFBooleanFalse)
15
+
16
+ # returns a ruby true/false value
17
+ #
18
+ # @return [Boolean]
19
+ def value
20
+ CF.CFBooleanGetValue(self) != 0
21
+ end
22
+
23
+ alias_method :to_ruby, :value
24
+ end
25
+ end
@@ -0,0 +1,42 @@
1
+ module CF
2
+ typedef :pointer, :cfdataref
3
+
4
+ attach_function 'CFDataCreate', [:pointer, :buffer_in, :cfindex], :cfdataref
5
+ attach_function 'CFDataGetLength', [:cfdataref], :cfindex
6
+ attach_function 'CFDataGetBytePtr', [:cfdataref], :pointer
7
+
8
+ # Wrapper for CFData
9
+ #
10
+ #
11
+ class Data < Base
12
+ register_type("CFData")
13
+
14
+ # Creates a CFData from a ruby string
15
+ # @param [String] s the string to use
16
+ # @return [CF::Data]
17
+ def self.from_string(s)
18
+ new(CF.CFDataCreate(nil, s, s.bytesize)).release_on_gc
19
+ end
20
+
21
+ # Creates a ruby string from the wrapped data. The encoding will always be ASCII_8BIT
22
+ #
23
+ # @return [String]
24
+ def to_s
25
+ ptr = CF.CFDataGetBytePtr(self)
26
+ if CF::String::HAS_ENCODING
27
+ ptr.read_string(CF.CFDataGetLength(self)).force_encoding(Encoding::ASCII_8BIT)
28
+ else
29
+ ptr.read_string(CF.CFDataGetLength(self))
30
+ end
31
+ end
32
+
33
+ # The size in bytes of the CFData
34
+ # @return [Integer]
35
+ def size
36
+ CF.CFDataGetLength(self)
37
+ end
38
+
39
+ alias_method :to_ruby, :to_s
40
+ end
41
+ end
42
+
@@ -0,0 +1,32 @@
1
+ module CF
2
+ typedef :pointer, :cfdateref
3
+ typedef :double, :cfabsolutetime
4
+
5
+ attach_function :CFDateCreate, [:pointer, :cfabsolutetime], :cfdateref
6
+ attach_function :CFDateGetAbsoluteTime, [:cfdateref], :cfabsolutetime
7
+ attach_variable :kCFAbsoluteTimeIntervalSince1970, :double
8
+
9
+ # Wrapper for CFDateRef
10
+ #
11
+ #
12
+ class Date < Base
13
+ register_type 'CFDate'
14
+
15
+ # constructs a CF::Date from a ruby time
16
+ #
17
+ # @param [Time] time
18
+ # @return [CF::Date] a CF::Date instance that will be released on garbage collection
19
+ def self.from_time(time)
20
+ new(CF.CFDateCreate(nil, time.to_f - CF.kCFAbsoluteTimeIntervalSince1970)).release_on_gc
21
+ end
22
+
23
+ # returns a ruby Time instance corresponding to the same point in time
24
+ #
25
+ # @return [Time]
26
+ def to_time
27
+ Time.at(CF.CFDateGetAbsoluteTime(self) + CF.kCFAbsoluteTimeIntervalSince1970)
28
+ end
29
+
30
+ alias_method :to_ruby, :to_time
31
+ end
32
+ end
@@ -0,0 +1,114 @@
1
+ module CF
2
+ # @private
3
+ class DictionaryKeyCallbacks < FFI::Struct
4
+ layout :version, :cfindex,
5
+ :retain, :pointer,
6
+ :release, :pointer,
7
+ :copyDescription, :pointer,
8
+ :equal, :pointer,
9
+ :hash, :pointer
10
+ end
11
+ # @private
12
+ class DictionaryValueCallbacks < FFI::Struct
13
+ layout :version, :cfindex,
14
+ :retain, :pointer,
15
+ :release, :pointer,
16
+ :copyDescription, :pointer,
17
+ :equal, :pointer
18
+ end
19
+
20
+ typedef :pointer, :cfdictionaryref
21
+ attach_variable :kCFTypeDictionaryKeyCallBacks, DictionaryKeyCallbacks
22
+ attach_variable :kCFTypeDictionaryValueCallBacks, DictionaryValueCallbacks
23
+ attach_function :CFDictionaryCreateMutable, [:pointer, :cfindex, :pointer, :pointer], :cfdictionaryref
24
+
25
+ attach_function :CFDictionarySetValue, [:cfdictionaryref, :pointer, :pointer], :void
26
+ attach_function :CFDictionaryGetValue, [:cfdictionaryref, :pointer], :pointer
27
+
28
+ attach_function :CFDictionaryGetValue, [:cfdictionaryref, :pointer], :pointer
29
+ attach_function :CFDictionaryGetCount, [:cfdictionaryref], :cfindex
30
+
31
+ callback :each_applier, [:pointer, :pointer, :pointer], :void
32
+
33
+ attach_function :CFDictionaryApplyFunction, [:cfdictionaryref, :each_applier, :pointer], :void
34
+
35
+ # Wrapper class for CFDictionary. It implements Enumerable.
36
+ #
37
+ # Values returned by the accessor methods or yielded by the block are retained and marked as releasable on garbage collection
38
+ # This means you can safely use the returned values even if the CFDictionary itself has been destroyed
39
+ #
40
+ class Dictionary < Base
41
+ register_type("CFDictionary")
42
+ include Enumerable
43
+
44
+ # Return a new, empty mutable CF::Dictionary
45
+ #
46
+ #
47
+ # @return [CF::Dictionary]
48
+ def self.mutable
49
+ new(CF.CFDictionaryCreateMutable nil, 0, CF.kCFTypeDictionaryKeyCallBacks.to_ptr, CF.kCFTypeDictionaryValueCallBacks.to_ptr).release_on_gc
50
+ end
51
+
52
+ # Iterates over the array yielding the value to the block
53
+ # The value is wrapped in the appropriate CF::Base subclass and retained (but marked for releasing upon garbage collection)
54
+ # @return self
55
+
56
+ def each
57
+ callback = lambda do |key, value, _|
58
+ yield [Base.typecast(key).retain.release_on_gc, Base.typecast(value).retain.release_on_gc]
59
+ end
60
+ CF.CFDictionaryApplyFunction(self, callback, nil)
61
+ self
62
+ end
63
+
64
+ # Returns the value associated with the key, or nil
65
+ # The key should be a CF::Base instance. As a convenience, instances of string will be converted to CF::String
66
+ # @param [CF::Base, String] key the key to access
67
+ # @return [CF::Base, nil]
68
+
69
+ def [](key)
70
+ key = CF::String.from_string(key) if key.is_a?(::String)
71
+ self.class.check_cftype(key)
72
+ raw = CF.CFDictionaryGetValue(self, key)
73
+ raw.null? ? nil : self.class.typecast(raw).retain.release_on_gc
74
+ end
75
+
76
+ # Sets the value associated with the key, or nil
77
+ # The key should be a CF::Base instance. As a convenience, instances of string will be converted to CF::String
78
+ # @param [CF::Base, String] key the key to access
79
+ # @param [CF::Base] value the value to set
80
+ # @return [CF::Base] the value that was set
81
+ def []=(key, value)
82
+ key = CF::String.from_string(key) if key.is_a?(::String)
83
+ self.class.check_cftype(key)
84
+ self.class.check_cftype(value)
85
+ CF.CFDictionarySetValue(self, key, value)
86
+ value
87
+ end
88
+
89
+ # Adds the key value pairs from the argument to self
90
+ #
91
+ # @param [CF::Dictionary] other
92
+ # @return self
93
+ def merge!(other)
94
+ other.each do |k,v|
95
+ self[k] = v
96
+ end
97
+ self
98
+ end
99
+
100
+ # Returns the number of key value pairs in the dictionary
101
+ # @return [Integer]
102
+ def length
103
+ CF.CFDictionaryGetCount(self)
104
+ end
105
+
106
+ # Returns a ruby hash constructed by calling `to_ruby` on each key and value
107
+ #
108
+ # @return [Hash]
109
+ def to_ruby
110
+ Hash[collect {|k,v| [k.to_ruby, v.to_ruby]}]
111
+ end
112
+ alias_method :size, :length
113
+ end
114
+ end
@@ -0,0 +1,158 @@
1
+ # Rubyinteger
2
+ class Integer
3
+ # Converts the Integer to a {CF::Number} using {CF::Number.from_i}
4
+ # @return [CF::Number]
5
+ def to_cf
6
+ CF::Number.from_i(self)
7
+ end
8
+ end
9
+
10
+ # Ruby float class
11
+ class Float
12
+ # Converts the Float to a {CF::Number} using {CF::Number.from_f}
13
+ # @return [CF::Number]
14
+ def to_cf
15
+ CF::Number.from_f(self)
16
+ end
17
+ end
18
+
19
+ # Ruby array class
20
+ class Array
21
+ # Converts the Array to an immutable {CF::Array} by calling `to_cf` on each element it contains
22
+ # @return [CF::Number]
23
+ def to_cf
24
+ CF::Array.immutable(collect(&:to_cf))
25
+ end
26
+ end
27
+
28
+ # Ruby true class
29
+ class TrueClass
30
+ # Returns a CF::Boolean object representing true
31
+ # @return [CF::Boolean]
32
+ def to_cf
33
+ CF::Boolean::TRUE
34
+ end
35
+ end
36
+
37
+ # Ruby false class
38
+ class FalseClass
39
+ # Returns a CF::Boolean object representing false
40
+ # @return [CF::Boolean]
41
+ def to_cf
42
+ CF::Boolean::FALSE
43
+ end
44
+ end
45
+
46
+ # Ruby String class
47
+ class String
48
+ # Returns a {CF::String} or {CF::Data} representing the string.
49
+ # If {#binary?} returns true a {CF::Data} is returned, if not a {CF::String} is returned
50
+ #
51
+ # If you want a {CF::Data} with the contents of a non binary string, use {#to_cf_data}
52
+ #
53
+ # @return [CF::String, CF::Data]
54
+ def to_cf
55
+ self.binary? ? self.to_cf_data : self.to_cf_string
56
+ end
57
+
58
+ # @!method binary?
59
+ #
60
+ # used to determine whether {#to_cf} should return a {CF::String} or a {CF::Data}. On ruby 1.9 and above this simply
61
+ # checks whether the encoding is ascii-8bit or not.
62
+ #
63
+ # On ruby 1.8.7
64
+ #
65
+ # - A string is binary if you call {#binary!} with the default argument of true
66
+ # - A string is not binary if you call {#binary!} with the argument false
67
+ #
68
+ # If you have never called {#binary!} then a string is binary if Iconv does not think it is valid utf-8
69
+ # @return whether the string is handled as binary data or not
70
+ #
71
+ if '<3'.respond_to? :encoding
72
+ def binary?
73
+ encoding == Encoding::ASCII_8BIT
74
+ end
75
+ else
76
+ def binary?
77
+ unless defined? @cf_is_binary
78
+ begin
79
+ ::Iconv.conv('UTF-8', 'UTF-8', self)
80
+ return false if self.frozen?
81
+ @cf_is_binary = false
82
+ rescue Iconv::IllegalSequence
83
+ return true if self.frozen?
84
+ @cf_is_binary = true
85
+ end
86
+ end
87
+ @cf_is_binary
88
+ end
89
+ end
90
+
91
+ if '<3'.respond_to? :encoding
92
+ # On ruby 1.8.7 sets or clears the flag used by {#binary?}. On ruby 1.9 the string's encoding is forced.
93
+ # @see #binary?
94
+ #
95
+ # @note There is no advantage to using this over the standard encoding methods unless you wish to retain 1.8.7 compatibility
96
+ #
97
+ # @param [optional, Boolean, Encoding] bin On ruby 1.8.7 only boolean values are admissible. On ruby 1.9 you can pass a specific encoding to force.
98
+ # If you pass `true` then `Encoding::ASCII_BIT` is used, if you pass `false` then `Encoding::UTF_8`
99
+ #
100
+ def binary!(bin=true)
101
+ if bin == true
102
+ self.force_encoding Encoding::ASCII_8BIT
103
+ else
104
+ # default to utf-8
105
+ self.force_encoding( (bin == false) ? "UTF-8" : bin)
106
+ end
107
+ self
108
+ end
109
+ else
110
+ # On ruby 1.8.7 sets or clears the flag used by {#binary?}. On ruby 1.9 the string's encoding is forced.
111
+ # @see #binary?
112
+ #
113
+ # @note There is no advantage to using this over the standard encoding methods unless you wish to retain 1.8.7 compatibility
114
+ #
115
+ # @param [optional, Boolean, Encoding] bin On ruby 1.8.7 only boolean values are admissible. On ruby 1.9 you can pass a specific encoding to force.
116
+ # If you pass `true` then `Encoding::ASCII_BIT` is used, if you pass `false` then `Encoding::UTF_8`
117
+ #
118
+ def binary!(bin=true)
119
+ @cf_is_binary = !! bin
120
+ self
121
+ end
122
+ end
123
+
124
+ # Returns a {CF::String} representing the string
125
+ # @return [CF::String]
126
+ def to_cf_string
127
+ CF::String.from_string self
128
+ end
129
+
130
+ # Returns a {CF::Data} representing the string
131
+ # @return [CF::Data]
132
+ def to_cf_data
133
+ CF::Data.from_string self
134
+ end
135
+
136
+ end
137
+
138
+ # Ruby Time class
139
+ class Time
140
+ # Returns a {CF::Date} representing the time.
141
+ # @return [CF::Date]
142
+ def to_cf
143
+ CF::Date.from_time(self)
144
+ end
145
+ end
146
+
147
+ # Ruby Hash class
148
+ class Hash
149
+ # Converts the Hash to an mutable {CF::Dictionary} by calling `to_cf` on each key and value it contains
150
+ # @return [CF::Dictionary]
151
+ def to_cf
152
+ CF::Dictionary.mutable.tap do |r|
153
+ each do |k,v|
154
+ r[k.to_cf] = v.to_cf
155
+ end
156
+ end
157
+ end
158
+ end
@@ -0,0 +1,11 @@
1
+ module CF
2
+ attach_variable 'kCFNull', :pointer
3
+
4
+ # Wrapper class for the cf null class
5
+ class Null < Base
6
+ register_type 'CFNull'
7
+ end
8
+
9
+ #The singleton CFNull instance
10
+ NULL = Null.new(CF.kCFNull)
11
+ end
@@ -0,0 +1,98 @@
1
+ module CF
2
+ typedef :pointer, :cfnumberref
3
+ enum :cf_number_type, [
4
+ :kCFNumberSInt8Type,1,
5
+ :kCFNumberSInt16Type,2,
6
+ :kCFNumberSInt32Type,3,
7
+ :kCFNumberSInt64Type,4,
8
+ :kCFNumberFloat32Type,5,
9
+ :kCFNumberFloat64Type,6,
10
+ :kCFNumberCharType,7,
11
+ :kCFNumberShortType,8,
12
+ :kCFNumberIntType,9,
13
+ :kCFNumberLongType,10,
14
+ :kCFNumberLongLongType,11,
15
+ :kCFNumberFloatType,12,
16
+ :kCFNumberDoubleType,13,
17
+ :kCFNumberCFIndexType,14,
18
+ :kCFNumberNSIntegerType,15,
19
+ :kCFNumberCGFloatType,16,
20
+ :kCFNumberMaxType,16
21
+ ]
22
+
23
+ attach_function 'CFNumberGetValue', [:cfnumberref, :cf_number_type, :pointer], :uchar
24
+ attach_function 'CFNumberCreate', [:pointer, :cf_number_type, :pointer], :cfnumberref
25
+ attach_function 'CFNumberIsFloatType', [:pointer], :uchar
26
+ attach_function 'CFNumberCompare', [:cfnumberref, :cfnumberref, :pointer], :cfcomparisonresult
27
+
28
+ # Wrapper for CFNumberRef
29
+ #
30
+ #
31
+ class Number < Base
32
+ register_type 'CFNumber'
33
+ include Comparable
34
+
35
+
36
+ # Constructs a CF::Number from a float
37
+ # @param [Float] float
38
+ # @return [CF::Number]
39
+ def self.from_f(float)
40
+ p = FFI::MemoryPointer.new(:double)
41
+ p.write_double(float.to_f)
42
+ new(CF.CFNumberCreate(nil, :kCFNumberDoubleType, p)).release_on_gc
43
+ end
44
+
45
+ # Constructs a CF::Number from an integer
46
+ # @param [Integer] int
47
+ # @return [CF::Number]
48
+ def self.from_i(int)
49
+ p = FFI::MemoryPointer.new(:int64)
50
+ p.put_int64(0,int.to_i)
51
+ new(CF.CFNumberCreate(nil, :kCFNumberSInt64Type, p)).release_on_gc
52
+ end
53
+
54
+ # Compares the receiver with the argument
55
+ # @param [CF::Number] other
56
+ # @return [Integer]
57
+ def <=>(other)
58
+ raise TypeError, "argument should be CF::Number" unless other.is_a?(CF::Number)
59
+ CF.CFNumberCompare(self,other,nil)
60
+ end
61
+
62
+
63
+ # Converts the CF::Number to either an Integer or a Float, depending on the result of CFNumberIsFloatType
64
+ #
65
+ # @return [Integer, Float]
66
+ def to_ruby
67
+ if CF.CFNumberIsFloatType(self) == 0
68
+ to_i
69
+ else
70
+ to_f
71
+ end
72
+ end
73
+
74
+ # Converts the CF::Number to an integer
75
+ # May raise if the conversion cannot be done without loss of precision
76
+ # @return [Integer]
77
+ def to_i
78
+ p = FFI::MemoryPointer.new(:int64)
79
+ if CF.CFNumberGetValue(self, :kCFNumberSInt64Type, p) != 0
80
+ p.get_int64 0
81
+ else
82
+ raise "CF.CFNumberGetValue failed to convert #{self.inspect} to kCFNumberSInt64Type"
83
+ end
84
+ end
85
+
86
+ # Converts the CF::Number to a float
87
+ # May raise if the conversion cannot be done without loss of precision
88
+ # @return [Float]
89
+ def to_f
90
+ p = FFI::MemoryPointer.new(:double)
91
+ if CF.CFNumberGetValue(self, :kCFNumberDoubleType, p) != 0
92
+ p.read_double
93
+ else
94
+ raise "CF.CFNumberGetValue failed to convert #{self.inspect} to kCFNumberDoubleType"
95
+ end
96
+ end
97
+ end
98
+ end