yakg 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.gitignore +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +27 -19
- data/VERSION +1 -1
- data/lib/yakg.rb +6 -6
- data/spec/spec_helper.rb +1 -3
- data/spec/yakg_spec.rb +13 -13
- data/vendor/gems/README.md +26 -20
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/COPYING +49 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/LICENSE +24 -0
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/README.md +7 -7
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/Rakefile +31 -41
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/ffi.gemspec +7 -6
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/autopointer.rb +24 -14
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/enum.rb +34 -22
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/errno.rb +43 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/ffi.rb +44 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/io.rb +62 -0
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/library.rb +79 -44
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/managedstruct.rb +29 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/platform/aarch64-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/platform/mips64el-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc64-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-cygwin/types.conf +3 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-darwin/types.conf +126 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-openbsd/types.conf +128 -0
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/platform.rb +35 -15
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/pointer.rb +22 -10
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/struct.rb +31 -14
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/struct_layout_builder.rb +46 -30
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/types.rb +24 -11
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/union.rb +43 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/variadic.rb +78 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi/version.rb +4 -0
- data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi.rb +1 -9
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/lib/ffi_c.bundle +0 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/Benchmark.c +52 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/BoolTest.c +34 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/BufferTest.c +31 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/ClosureTest.c +205 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/EnumTest.c +51 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/FunctionTest.c +70 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/GNUmakefile +149 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/GlobalVariable.c +62 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/LastErrorTest.c +21 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/NumberTest.c +132 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/PointerTest.c +63 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/ReferenceTest.c +23 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/StringTest.c +34 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/StructTest.c +243 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/UnionTest.c +43 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/VariadicTest.c +62 -0
- data/vendor/gems/ruby/2.0.0/specifications/ffi-1.9.10.gemspec +45 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/CHANGELOG +12 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/LICENSE +8 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/README.md +40 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/array.rb +123 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/base.rb +197 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/boolean.rb +25 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/data.rb +42 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/date.rb +32 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/dictionary.rb +114 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/extensions.rb +158 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/null.rb +11 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/number.rb +98 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/string.rb +91 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation/version.rb +4 -0
- data/vendor/gems/ruby/2.1.0/gems/corefoundation-0.2.0/lib/corefoundation.rb +13 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/COPYING +49 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/LICENSE +24 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/README.md +109 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/Rakefile +210 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/ffi.gemspec +23 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/gen/Rakefile +30 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/autopointer.rb +194 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/buffer.rb +4 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/callback.rb +4 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/enum.rb +174 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/errno.rb +43 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/ffi.rb +44 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/io.rb +62 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/library.rb +524 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/managedstruct.rb +84 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/memorypointer.rb +1 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/aarch64-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/arm-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-cygwin/types.conf +3 -0
- 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
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-freebsd/types.conf +152 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-gnu/types.conf +107 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-linux/types.conf +103 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-openbsd/types.conf +128 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-solaris/types.conf +122 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/i386-windows/types.conf +105 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/ia64-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/mips-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/mips64el-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/mipsel-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc-aix/types.conf +180 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc-linux/types.conf +100 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc64-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/s390-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/s390x-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/sparc-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/sparc-solaris/types.conf +128 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-cygwin/types.conf +3 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-darwin/types.conf +126 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-netbsd/types.conf +128 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-openbsd/types.conf +128 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-windows/types.conf +27 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/platform.rb +159 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/pointer.rb +134 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/struct.rb +373 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/struct_layout_builder.rb +227 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/tools/const_generator.rb +229 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/tools/generator.rb +60 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/tools/generator_task.rb +36 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/tools/struct_generator.rb +194 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/tools/types_generator.rb +135 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/types.rb +190 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/union.rb +43 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/variadic.rb +78 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi/version.rb +4 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi.rb +20 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/lib/ffi_c.bundle +0 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/Benchmark.c +52 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/BoolTest.c +34 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/BufferTest.c +31 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/ClosureTest.c +205 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/EnumTest.c +51 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/FunctionTest.c +70 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/GNUmakefile +149 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/GlobalVariable.c +62 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/LastErrorTest.c +21 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/NumberTest.c +132 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/PointerTest.c +63 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/ReferenceTest.c +23 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/StringTest.c +34 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/StructTest.c +243 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/UnionTest.c +43 -0
- data/vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/VariadicTest.c +62 -0
- data/vendor/gems/ruby/2.1.0/specifications/corefoundation-0.2.0.gemspec +45 -0
- data/vendor/gems/ruby/2.1.0/specifications/ffi-1.9.10.gemspec +49 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/CHANGELOG +12 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/LICENSE +8 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/README.md +40 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/array.rb +123 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/base.rb +197 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/boolean.rb +25 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/data.rb +42 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/date.rb +32 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/dictionary.rb +114 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/extensions.rb +158 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/null.rb +11 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/number.rb +98 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/string.rb +91 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation/version.rb +4 -0
- data/vendor/gems/ruby/2.2.0/gems/corefoundation-0.2.0/lib/corefoundation.rb +13 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/COPYING +49 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/LICENSE +24 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/README.md +109 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/Rakefile +210 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/ffi.gemspec +23 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/gen/Rakefile +30 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/autopointer.rb +194 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/buffer.rb +4 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/callback.rb +4 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/enum.rb +174 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/errno.rb +43 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/ffi.rb +44 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/io.rb +62 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/library.rb +524 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/managedstruct.rb +84 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/memorypointer.rb +1 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/aarch64-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/arm-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-cygwin/types.conf +3 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-darwin/types.conf +100 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-freebsd/types.conf +152 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-gnu/types.conf +107 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-linux/types.conf +103 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-netbsd/types.conf +126 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-openbsd/types.conf +128 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-solaris/types.conf +122 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/i386-windows/types.conf +105 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/ia64-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/mips-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/mips64el-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/mipsel-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc-aix/types.conf +180 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc-linux/types.conf +100 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/powerpc64-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/s390-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/s390x-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/sparc-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/sparc-solaris/types.conf +128 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-cygwin/types.conf +3 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-darwin/types.conf +126 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-netbsd/types.conf +128 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-openbsd/types.conf +128 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform/x86_64-windows/types.conf +27 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/platform.rb +159 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/pointer.rb +134 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/struct.rb +373 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/struct_layout_builder.rb +227 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/tools/const_generator.rb +229 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/tools/generator.rb +60 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/tools/generator_task.rb +36 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/tools/struct_generator.rb +194 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/tools/types_generator.rb +135 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/types.rb +190 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/union.rb +43 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/variadic.rb +78 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi/version.rb +4 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi.rb +20 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/lib/ffi_c.bundle +0 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/Benchmark.c +52 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/BoolTest.c +34 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/BufferTest.c +31 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/ClosureTest.c +205 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/EnumTest.c +51 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/FunctionTest.c +70 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/GNUmakefile +149 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/GlobalVariable.c +62 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/LastErrorTest.c +21 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/NumberTest.c +132 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/PointerTest.c +63 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/ReferenceTest.c +23 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/StringTest.c +34 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/StructTest.c +243 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/UnionTest.c +43 -0
- data/vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/VariadicTest.c +62 -0
- data/vendor/gems/ruby/2.2.0/specifications/corefoundation-0.2.0.gemspec +45 -0
- data/vendor/gems/ruby/2.2.0/specifications/ffi-1.9.10.gemspec +49 -0
- data/yakg.gemspec +3 -3
- metadata +288 -83
- data/vendor/gems/Gemfile +0 -4
- data/vendor/gems/Gemfile.lock +0 -13
- data/vendor/gems/installit.sh +0 -65
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/COPYING +0 -674
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/COPYING.LESSER +0 -165
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/History.txt +0 -1
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/LICENSE +0 -14
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/gen/log +0 -1
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/errno.rb +0 -33
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/ffi.iml +0 -11
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/ffi.rb +0 -33
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/io.rb +0 -52
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/union.rb +0 -32
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/variadic.rb +0 -65
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/version.rb +0 -4
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi_c.bundle +0 -0
- data/vendor/gems/ruby/2.0.0/specifications/ffi-1.9.0.gemspec +0 -42
- /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/gen/Rakefile +0 -0
- /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/buffer.rb +0 -0
- /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/callback.rb +0 -0
- /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/memorypointer.rb +0 -0
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/tools/const_generator.rb +0 -0
- /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/tools/generator.rb +0 -0
- /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/tools/generator_task.rb +0 -0
- /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/tools/struct_generator.rb +0 -0
- /data/vendor/gems/ruby/2.0.0/gems/{ffi-1.9.0 → ffi-1.9.10}/lib/ffi/tools/types_generator.rb +0 -0
- /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,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,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
|
@@ -0,0 +1,91 @@
|
|
1
|
+
module CF
|
2
|
+
typedef :pointer, :cfstringref
|
3
|
+
|
4
|
+
attach_function 'CFStringCreateWithBytes', [:pointer, :buffer_in, :cfindex, :uint, :char], :cfstringref
|
5
|
+
attach_function 'CFStringGetBytes', [:cfstringref, :uint], :pointer
|
6
|
+
attach_function 'CFStringGetMaximumSizeForEncoding', [:cfindex, :uint], :cfindex
|
7
|
+
attach_function 'CFStringGetLength', [:cfstringref], :cfindex
|
8
|
+
|
9
|
+
attach_function 'CFStringGetBytes', [:cfstringref, CF::Range.by_value, :uint, :uchar, :char, :buffer_out, :cfindex, :buffer_out], :cfindex
|
10
|
+
|
11
|
+
attach_function 'CFStringCompare', [:cfstringref, :cfstringref, :cfoptionflags], :cfcomparisonresult
|
12
|
+
|
13
|
+
# Wrapper class for CFString
|
14
|
+
#
|
15
|
+
# Unlike ruby, CFString is not an arbitrary bag of bytes - the data will be converted to a collection of unicode characters
|
16
|
+
class String < Base
|
17
|
+
include Comparable
|
18
|
+
register_type("CFString")
|
19
|
+
|
20
|
+
# The cfstring encoding for UTF8
|
21
|
+
UTF8 = 0x08000100 #From cfstring.h
|
22
|
+
|
23
|
+
# workaround for ruby 1.8.7 compat
|
24
|
+
HAS_ENCODING = "foo".respond_to? "encode"
|
25
|
+
|
26
|
+
# Creates a string from a ruby string
|
27
|
+
# The string must be convertable to UTF-8
|
28
|
+
#
|
29
|
+
# @param [String] s
|
30
|
+
# @return [CF::String]
|
31
|
+
def self.from_string(s, src_encoding='UTF-8')
|
32
|
+
if HAS_ENCODING
|
33
|
+
s_utf = s.encode('UTF-8')
|
34
|
+
else
|
35
|
+
begin
|
36
|
+
s_utf = Iconv.conv('UTF-8', src_encoding, s.to_s)
|
37
|
+
rescue Iconv::IllegalSequence => e
|
38
|
+
return nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
raw = CF.CFStringCreateWithBytes(nil, s_utf, s_utf.bytesize, UTF8, 0)
|
42
|
+
raw.null? ? nil : new(raw).release_on_gc
|
43
|
+
end
|
44
|
+
|
45
|
+
# Returns the length, in unicode characters of the string
|
46
|
+
# @return [Integer]
|
47
|
+
def length
|
48
|
+
CF.CFStringGetLength(self)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Compares the receiver with the argument
|
52
|
+
# @param [CF::String] other
|
53
|
+
# @return [Integer]
|
54
|
+
def <=>(other)
|
55
|
+
Base.check_cftype(other)
|
56
|
+
CF.CFStringCompare(self,other,0)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Converts the CF::String to a UTF-8 ruby string
|
60
|
+
#
|
61
|
+
# @return [String]
|
62
|
+
def to_s
|
63
|
+
max_size = CF.CFStringGetMaximumSizeForEncoding(length, UTF8)
|
64
|
+
range = CF::Range.new
|
65
|
+
range[:location] = 0
|
66
|
+
range[:length] = length
|
67
|
+
buffer = FFI::MemoryPointer.new(:char, max_size)
|
68
|
+
|
69
|
+
cfindex = CF.find_type(:cfindex)
|
70
|
+
bytes_used_buffer = FFI::MemoryPointer.new(cfindex)
|
71
|
+
|
72
|
+
CF.CFStringGetBytes(self, range, UTF8, 0, 0, buffer, max_size, bytes_used_buffer)
|
73
|
+
|
74
|
+
bytes_used = if cfindex == CF.find_type(:long_long)
|
75
|
+
bytes_used_buffer.read_long_long
|
76
|
+
else
|
77
|
+
bytes_used_buffer.read_long
|
78
|
+
end
|
79
|
+
|
80
|
+
if HAS_ENCODING
|
81
|
+
buffer.read_string(bytes_used).force_encoding(Encoding::UTF_8)
|
82
|
+
else
|
83
|
+
buffer.read_string(bytes_used)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
alias_method :to_ruby, :to_s
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'ffi'
|
2
|
+
require 'iconv' if RUBY_VERSION < "1.9"
|
3
|
+
|
4
|
+
require 'corefoundation/base'
|
5
|
+
require 'corefoundation/null'
|
6
|
+
require 'corefoundation/string'
|
7
|
+
require 'corefoundation/array'
|
8
|
+
require 'corefoundation/boolean'
|
9
|
+
require 'corefoundation/data'
|
10
|
+
require 'corefoundation/dictionary'
|
11
|
+
require 'corefoundation/number'
|
12
|
+
require 'corefoundation/date'
|
13
|
+
require 'corefoundation/extensions'
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Copyright (c) 2008-2013, Ruby FFI project contributors
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
* Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
* Neither the name of the Ruby FFI project nor the
|
12
|
+
names of its contributors may be used to endorse or promote products
|
13
|
+
derived from this software without specific prior written permission.
|
14
|
+
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25
|
+
|
26
|
+
libffi, used by this project, is licensed under the MIT license:
|
27
|
+
|
28
|
+
libffi - Copyright (c) 1996-2011 Anthony Green, Red Hat, Inc and others.
|
29
|
+
See source files for details.
|
30
|
+
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
32
|
+
a copy of this software and associated documentation files (the
|
33
|
+
``Software''), to deal in the Software without restriction, including
|
34
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
35
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
36
|
+
permit persons to whom the Software is furnished to do so, subject to
|
37
|
+
the following conditions:
|
38
|
+
|
39
|
+
The above copyright notice and this permission notice shall be
|
40
|
+
included in all copies or substantial portions of the Software.
|
41
|
+
|
42
|
+
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
43
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
44
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
45
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
46
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
47
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
48
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
49
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2008-2013, Ruby FFI project contributors
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
* Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
* Neither the name of the Ruby FFI project nor the
|
12
|
+
names of its contributors may be used to endorse or promote products
|
13
|
+
derived from this software without specific prior written permission.
|
14
|
+
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# ruby-ffi https://wiki.github.com/ffi/ffi [![Build Status](https://travis-ci.org/ffi/ffi.png?branch=master)](https://travis-ci.org/ffi/ffi)
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
Ruby-FFI is a ruby extension for programmatically loading dynamic
|
6
|
+
libraries, binding functions within them, and calling those functions
|
7
|
+
from Ruby code. Moreover, a Ruby-FFI extension works without changes
|
8
|
+
on Ruby and JRuby. [Discover why you should write your next extension
|
9
|
+
using Ruby-FFI](https://wiki.github.com/ffi/ffi/why-use-ffi).
|
10
|
+
|
11
|
+
## Features/problems
|
12
|
+
|
13
|
+
* Intuitive DSL
|
14
|
+
* Supports all C native types
|
15
|
+
* C structs (also nested), enums and global variables
|
16
|
+
* Callbacks from C to ruby
|
17
|
+
* Automatic garbage collection of native memory
|
18
|
+
|
19
|
+
## Synopsis
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require 'ffi'
|
23
|
+
|
24
|
+
module MyLib
|
25
|
+
extend FFI::Library
|
26
|
+
ffi_lib 'c'
|
27
|
+
attach_function :puts, [ :string ], :int
|
28
|
+
end
|
29
|
+
|
30
|
+
MyLib.puts 'Hello, World using libc!'
|
31
|
+
```
|
32
|
+
|
33
|
+
For less minimalistic and more sane examples you may look at:
|
34
|
+
|
35
|
+
* the samples/ folder
|
36
|
+
* the examples on the [wiki](https://wiki.github.com/ffi/ffi)
|
37
|
+
* the projects using FFI listed on this page (https://wiki.github.com/ffi/ffi/projects-using-ffi)
|
38
|
+
|
39
|
+
## Requirements
|
40
|
+
|
41
|
+
You need a sane building environment in order to compile the extension.
|
42
|
+
At a minimum, you will need:
|
43
|
+
* A C compiler (e.g. Xcode on OSX, gcc on everything else)
|
44
|
+
* libffi development library - this is commonly in the libffi-dev or libffi-devel
|
45
|
+
|
46
|
+
## Installation
|
47
|
+
|
48
|
+
From rubygems:
|
49
|
+
|
50
|
+
[sudo] gem install ffi
|
51
|
+
|
52
|
+
or from the git repository on github:
|
53
|
+
|
54
|
+
git clone git://github.com/ffi/ffi.git
|
55
|
+
cd ffi
|
56
|
+
rake gem:install
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
The ffi library is covered by the BSD license, also see the LICENSE file.
|
61
|
+
The specs are shared with Rubyspec and are licensed by the same license
|
62
|
+
as Rubyspec, see the LICENSE.SPECS file.
|
63
|
+
|
64
|
+
## Credits
|
65
|
+
|
66
|
+
The following people have submitted code, bug reports, or otherwise contributed to the success of this project:
|
67
|
+
|
68
|
+
* Alban Peignier <alban.peignier@free.fr>
|
69
|
+
* Aman Gupta <aman@tmm1.net>
|
70
|
+
* Andrea Fazzi <andrea.fazzi@alcacoop.it>
|
71
|
+
* Andreas Niederl <rico32@gmx.net>
|
72
|
+
* Andrew Cholakian <andrew@andrewvc.com>
|
73
|
+
* Antonio Terceiro <terceiro@softwarelivre.org>
|
74
|
+
* Brian Candler <B.Candler@pobox.com>
|
75
|
+
* Brian D. Burns <burns180@gmail.com>
|
76
|
+
* Bryan Kearney <bkearney@redhat.com>
|
77
|
+
* Charlie Savage <cfis@zerista.com>
|
78
|
+
* Chikanaga Tomoyuki <nagachika00@gmail.com>
|
79
|
+
* Hongli Lai <hongli@phusion.nl>
|
80
|
+
* Ian MacLeod <ian@nevir.net>
|
81
|
+
* Jake Douglas <jake@shiftedlabs.com>
|
82
|
+
* Jean-Dominique Morani <jdmorani@mac.com>
|
83
|
+
* Jeremy Hinegardner <jeremy@hinegardner.org>
|
84
|
+
* Jesús García Sáez <blaxter@gmail.com>
|
85
|
+
* Joe Khoobyar <joe@ankhcraft.com>
|
86
|
+
* Jurij Smakov <jurij@wooyd.org>
|
87
|
+
* KISHIMOTO, Makoto <ksmakoto@dd.iij4u.or.jp>
|
88
|
+
* Kim Burgestrand <kim@burgestrand.se>
|
89
|
+
* Lars Kanis <kanis@comcard.de>
|
90
|
+
* Luc Heinrich <luc@honk-honk.com>
|
91
|
+
* Luis Lavena <luislavena@gmail.com>
|
92
|
+
* Matijs van Zuijlen <matijs@matijs.net>
|
93
|
+
* Matthew King <automatthew@gmail.com>
|
94
|
+
* Mike Dalessio <mike.dalessio@gmail.com>
|
95
|
+
* NARUSE, Yui <naruse@airemix.jp>
|
96
|
+
* Park Heesob <phasis@gmail.com>
|
97
|
+
* Shin Yee <shinyee@speedgocomputing.com>
|
98
|
+
* Stephen Bannasch <stephen.bannasch@gmail.com>
|
99
|
+
* Suraj N. Kurapati <sunaku@gmail.com>
|
100
|
+
* Sylvain Daubert <sylvain.daubert@laposte.net>
|
101
|
+
* Victor Costan
|
102
|
+
* beoran@gmail.com
|
103
|
+
* ctide <christide@christide.com>
|
104
|
+
* emboss <Martin.Bosslet@googlemail.com>
|
105
|
+
* hobophobe <unusualtears@gmail.com>
|
106
|
+
* meh <meh@paranoici.org>
|
107
|
+
* postmodern <postmodern.mod3@gmail.com>
|
108
|
+
* wycats@gmail.com <wycats@gmail.com>
|
109
|
+
* Wayne Meissner <wmeissner@gmail.com>
|