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,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>
|
@@ -0,0 +1,210 @@
|
|
1
|
+
require 'rubygems/tasks'
|
2
|
+
require 'rbconfig'
|
3
|
+
require 'rake/clean'
|
4
|
+
require File.expand_path("./lib/ffi/version")
|
5
|
+
|
6
|
+
USE_RAKE_COMPILER = (RUBY_PLATFORM =~ /java/) ? false : true
|
7
|
+
if USE_RAKE_COMPILER
|
8
|
+
require 'rake/extensiontask'
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'date'
|
12
|
+
require 'fileutils'
|
13
|
+
require 'rbconfig'
|
14
|
+
require 'rspec/core/rake_task'
|
15
|
+
require 'rubygems/package_task'
|
16
|
+
|
17
|
+
LIBEXT = case RbConfig::CONFIG['host_os'].downcase
|
18
|
+
when /darwin/
|
19
|
+
"dylib"
|
20
|
+
when /mswin|mingw/
|
21
|
+
"dll"
|
22
|
+
else
|
23
|
+
RbConfig::CONFIG['DLEXT']
|
24
|
+
end
|
25
|
+
|
26
|
+
CPU = case RbConfig::CONFIG['host_cpu'].downcase
|
27
|
+
when /i[3456]86/
|
28
|
+
# Darwin always reports i686, even when running in 64bit mode
|
29
|
+
if RbConfig::CONFIG['host_os'] =~ /darwin/ && 0xfee1deadbeef.is_a?(Fixnum)
|
30
|
+
"x86_64"
|
31
|
+
else
|
32
|
+
"i386"
|
33
|
+
end
|
34
|
+
|
35
|
+
when /amd64|x86_64/
|
36
|
+
"x86_64"
|
37
|
+
|
38
|
+
when /ppc64|powerpc64/
|
39
|
+
"powerpc64"
|
40
|
+
|
41
|
+
when /ppc|powerpc/
|
42
|
+
"powerpc"
|
43
|
+
|
44
|
+
when /^arm/
|
45
|
+
"arm"
|
46
|
+
|
47
|
+
else
|
48
|
+
RbConfig::CONFIG['host_cpu']
|
49
|
+
end
|
50
|
+
|
51
|
+
OS = case RbConfig::CONFIG['host_os'].downcase
|
52
|
+
when /linux/
|
53
|
+
"linux"
|
54
|
+
when /darwin/
|
55
|
+
"darwin"
|
56
|
+
when /freebsd/
|
57
|
+
"freebsd"
|
58
|
+
when /openbsd/
|
59
|
+
"openbsd"
|
60
|
+
when /sunos|solaris/
|
61
|
+
"solaris"
|
62
|
+
when /mswin|mingw/
|
63
|
+
"win32"
|
64
|
+
else
|
65
|
+
RbConfig::CONFIG['host_os'].downcase
|
66
|
+
end
|
67
|
+
|
68
|
+
GMAKE = system('which gmake >/dev/null') && 'gmake' || 'make'
|
69
|
+
|
70
|
+
LIBTEST = "build/libtest.#{LIBEXT}"
|
71
|
+
BUILD_DIR = "build"
|
72
|
+
BUILD_EXT_DIR = File.join(BUILD_DIR, "#{RbConfig::CONFIG['arch']}", 'ffi_c', RUBY_VERSION)
|
73
|
+
|
74
|
+
def gem_spec
|
75
|
+
@gem_spec ||= Gem::Specification.load('ffi.gemspec')
|
76
|
+
end
|
77
|
+
|
78
|
+
TEST_DEPS = [ LIBTEST ]
|
79
|
+
if RUBY_PLATFORM == "java"
|
80
|
+
RSpec::Core::RakeTask.new(:spec) do |config|
|
81
|
+
config.rspec_opts = YAML.load_file 'spec/spec.opts'
|
82
|
+
end
|
83
|
+
else
|
84
|
+
RSpec::Core::RakeTask.new(:spec => :compile) do |config|
|
85
|
+
config.rspec_opts = YAML.load_file 'spec/spec.opts'
|
86
|
+
end
|
87
|
+
|
88
|
+
TEST_DEPS.unshift :compile
|
89
|
+
end
|
90
|
+
|
91
|
+
desc "Build all packages"
|
92
|
+
task :package => 'gem:package'
|
93
|
+
|
94
|
+
CLOBBER.include 'lib/ffi/types.conf'
|
95
|
+
CLOBBER.include 'pkg'
|
96
|
+
|
97
|
+
CLEAN.include 'build'
|
98
|
+
CLEAN.include 'conftest.dSYM'
|
99
|
+
CLEAN.include 'spec/ffi/fixtures/libtest.{dylib,so,dll}'
|
100
|
+
CLEAN.include 'spec/ffi/fixtures/*.o'
|
101
|
+
CLEAN.include "pkg/ffi-#{FFI::VERSION}-*-mingw32"
|
102
|
+
CLEAN.include "pkg/ffi-#{FFI::VERSION}-java"
|
103
|
+
CLEAN.include 'lib/1.*'
|
104
|
+
CLEAN.include 'lib/2.*'
|
105
|
+
CLEAN.include 'bin'
|
106
|
+
|
107
|
+
task :distclean => :clobber
|
108
|
+
|
109
|
+
desc "Build the native test lib"
|
110
|
+
file "build/libtest.#{LIBEXT}" => FileList['libtest/**/*.[ch]'] do
|
111
|
+
sh %{#{GMAKE} -f libtest/GNUmakefile CPU=#{CPU} OS=#{OS} }
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
desc "Build test helper lib"
|
116
|
+
task :libtest => "build/libtest.#{LIBEXT}"
|
117
|
+
|
118
|
+
desc "Test the extension"
|
119
|
+
task :test => [ :spec ]
|
120
|
+
|
121
|
+
|
122
|
+
namespace :bench do
|
123
|
+
ITER = ENV['ITER'] ? ENV['ITER'].to_i : 100000
|
124
|
+
bench_libs = "-Ilib -I#{BUILD_DIR}" unless RUBY_PLATFORM == "java"
|
125
|
+
bench_files = Dir["bench/bench_*.rb"].reject { |f| f == "bench_helper.rb" }
|
126
|
+
bench_files.each do |bench|
|
127
|
+
task File.basename(bench, ".rb")[6..-1] => TEST_DEPS do
|
128
|
+
sh %{#{Gem.ruby} #{bench_libs} #{bench} #{ITER}}
|
129
|
+
end
|
130
|
+
end
|
131
|
+
task :all => TEST_DEPS do
|
132
|
+
bench_files.each do |bench|
|
133
|
+
sh %{#{Gem.ruby} #{bench_libs} #{bench}}
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
task 'spec:run' => TEST_DEPS
|
139
|
+
task 'spec:specdoc' => TEST_DEPS
|
140
|
+
|
141
|
+
task :default => :specs
|
142
|
+
|
143
|
+
namespace 'java' do
|
144
|
+
|
145
|
+
java_gem_spec = Gem::Specification.new do |s|
|
146
|
+
s.name = gem_spec.name
|
147
|
+
s.version = gem_spec.version
|
148
|
+
s.author = gem_spec.author
|
149
|
+
s.email = gem_spec.email
|
150
|
+
s.homepage = gem_spec.homepage
|
151
|
+
s.summary = gem_spec.summary
|
152
|
+
s.description = gem_spec.description
|
153
|
+
s.files = %w(LICENSE COPYING README.md Rakefile)
|
154
|
+
s.has_rdoc = false
|
155
|
+
s.license = gem_spec.license
|
156
|
+
s.platform = 'java'
|
157
|
+
end
|
158
|
+
|
159
|
+
Gem::PackageTask.new(java_gem_spec) do |pkg|
|
160
|
+
pkg.need_zip = true
|
161
|
+
pkg.need_tar = true
|
162
|
+
pkg.package_dir = 'pkg'
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
task 'gem:java' => 'java:gem'
|
167
|
+
|
168
|
+
|
169
|
+
if USE_RAKE_COMPILER
|
170
|
+
Rake::ExtensionTask.new('ffi_c', gem_spec) do |ext|
|
171
|
+
ext.name = 'ffi_c' # indicate the name of the extension.
|
172
|
+
# ext.lib_dir = BUILD_DIR # put binaries into this folder.
|
173
|
+
ext.tmp_dir = BUILD_DIR # temporary folder used during compilation.
|
174
|
+
ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
|
175
|
+
ext.cross_platform = %w[i386-mingw32 x64-mingw32] # forces the Windows platform instead of the default one
|
176
|
+
end
|
177
|
+
|
178
|
+
ENV['RUBY_CC_VERSION'] ||= '1.8.7:1.9.3:2.0.0:2.1.5:2.2.1'
|
179
|
+
|
180
|
+
ENV['RUBY_CC_VERSION'].to_s.split(':').each do |ruby_version|
|
181
|
+
task "copy:ffi_c:i386-mingw32:#{ruby_version}" do |t|
|
182
|
+
sh "i686-w64-mingw32-strip -S #{BUILD_DIR}/i386-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so"
|
183
|
+
end
|
184
|
+
|
185
|
+
task "copy:ffi_c:x64-mingw32:#{ruby_version}" do |t|
|
186
|
+
sh "x86_64-w64-mingw32-strip -S #{BUILD_DIR}/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so"
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
desc "build a windows gem without all the ceremony."
|
191
|
+
task "gem:windows" do
|
192
|
+
require "rake_compiler_dock"
|
193
|
+
RakeCompilerDock.sh "bundle && rake cross native gem MAKE='nice make -j`nproc`'"
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
Gem::Tasks.new do |t|
|
198
|
+
t.scm.tag.format = '%s'
|
199
|
+
end
|
200
|
+
|
201
|
+
begin
|
202
|
+
require 'yard'
|
203
|
+
|
204
|
+
namespace :doc do
|
205
|
+
YARD::Rake::YardocTask.new do |yard|
|
206
|
+
end
|
207
|
+
end
|
208
|
+
rescue LoadError
|
209
|
+
warn "[warn] YARD unavailable"
|
210
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path("../lib/#{File.basename(__FILE__, '.gemspec')}/version", __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'ffi'
|
5
|
+
s.version = FFI::VERSION
|
6
|
+
s.author = 'Wayne Meissner'
|
7
|
+
s.email = 'wmeissner@gmail.com'
|
8
|
+
s.homepage = 'http://wiki.github.com/ffi/ffi'
|
9
|
+
s.summary = 'Ruby FFI'
|
10
|
+
s.description = 'Ruby FFI library'
|
11
|
+
s.files = %w(ffi.gemspec LICENSE COPYING README.md Rakefile) + Dir.glob("{ext,gen,lib,spec,libtest}/**/*").reject { |f| f =~ /(lib\/[12]\.[089]|\.s?[ao]$|\.bundle|\.dylib$)/ }
|
12
|
+
s.extensions << 'ext/ffi_c/extconf.rb'
|
13
|
+
s.has_rdoc = false
|
14
|
+
s.rdoc_options = %w[--exclude=ext/ffi_c/.*\.o$ --exclude=ffi_c\.(bundle|so)$]
|
15
|
+
s.license = 'BSD'
|
16
|
+
s.require_paths << 'ext/ffi_c'
|
17
|
+
s.required_ruby_version = '>= 1.8.7'
|
18
|
+
s.add_development_dependency 'rake', '~> 10.1'
|
19
|
+
s.add_development_dependency 'rake-compiler', '~> 0.9'
|
20
|
+
s.add_development_dependency 'rake-compiler-dock', '~> 0.4.0'
|
21
|
+
s.add_development_dependency 'rspec', '~> 2.14.1'
|
22
|
+
s.add_development_dependency 'rubygems-tasks', "~> 0.2.4"
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
2
|
+
require 'fileutils'
|
3
|
+
require 'ffi'
|
4
|
+
require 'ffi/platform'
|
5
|
+
require 'ffi/tools/types_generator'
|
6
|
+
types_conf = File.expand_path(File.join(FFI::Platform::CONF_DIR, 'types.conf'))
|
7
|
+
|
8
|
+
logfile = File.join(File.dirname(__FILE__), 'log')
|
9
|
+
|
10
|
+
file types_conf do |task|
|
11
|
+
options = {}
|
12
|
+
FileUtils.mkdir_p(File.dirname(task.name), { :mode => 0755 })
|
13
|
+
File.open(task.name, File::CREAT|File::TRUNC|File::RDWR, 0644) do |f|
|
14
|
+
f.puts FFI::TypesGenerator.generate(options)
|
15
|
+
end
|
16
|
+
File.open(logfile, 'w') do |log|
|
17
|
+
log.puts(types_conf)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
task :default => types_conf do
|
22
|
+
end
|
23
|
+
|
24
|
+
task :clean do
|
25
|
+
File.readlines(logfile).each do |file|
|
26
|
+
file.strip!
|
27
|
+
rm_f file
|
28
|
+
end
|
29
|
+
rm_f logfile
|
30
|
+
end
|