yakg 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile.lock +1 -1
- data/LICENSE +14 -0
- data/VERSION +1 -1
- data/vendor/gems/ruby/2.0.0/build_info/corefoundation-0.2.0.info +1 -0
- data/vendor/gems/ruby/2.0.0/build_info/ffi-1.8.1.info +1 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/CHANGELOG +12 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/LICENSE +8 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/README.md +40 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/array.rb +123 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/base.rb +197 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/boolean.rb +25 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/data.rb +42 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/date.rb +32 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/dictionary.rb +114 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/extensions.rb +158 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/null.rb +11 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/number.rb +98 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/string.rb +91 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/version.rb +4 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation.rb +13 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/array_spec.rb +92 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/boolean_spec.rb +24 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/data_spec.rb +30 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/date_spec.rb +25 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/dictionary_spec.rb +81 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/extensions_spec.rb +127 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/null_spec.rb +7 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/number_spec.rb +52 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/spec_helper.rb +10 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/string_spec.rb +48 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/COPYING +674 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/COPYING.LESSER +165 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/History.txt +1 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/LICENSE +14 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/README.md +109 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/Rakefile +219 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/ffi.gemspec +22 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/gen/Rakefile +30 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/gen/log +1 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/autopointer.rb +184 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/buffer.rb +4 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/callback.rb +4 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/enum.rb +162 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/errno.rb +33 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/ffi.iml +11 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/ffi.rb +33 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/io.rb +52 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/library.rb +489 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/managedstruct.rb +55 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/memorypointer.rb +1 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/arm-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-cygwin/types.conf +3 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-darwin/types.conf +100 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-freebsd/types.conf +152 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-linux/types.conf +103 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-netbsd/types.conf +126 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-openbsd/types.conf +126 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-solaris/types.conf +122 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-windows/types.conf +105 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i486-gnu/types.conf +107 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/ia64-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/mips-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/mipsel-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/powerpc-aix/types.conf +180 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/powerpc-linux/types.conf +100 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/s390-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/s390x-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/sparc-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/sparc-solaris/types.conf +128 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-darwin/types.conf +100 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-netbsd/types.conf +126 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-openbsd/types.conf +126 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-windows/types.conf +27 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform.rb +139 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/pointer.rb +122 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/struct.rb +356 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/struct_layout_builder.rb +211 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/tools/const_generator.rb +229 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/tools/generator.rb +60 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/tools/generator_task.rb +36 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/tools/struct_generator.rb +194 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/tools/types_generator.rb +135 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/types.rb +177 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/union.rb +32 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/variadic.rb +65 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/version.rb +4 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi.rb +28 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi_c.bundle +0 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/Benchmark.c +52 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/BoolTest.c +31 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/BufferTest.c +31 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/ClosureTest.c +190 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/EnumTest.c +34 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/FunctionTest.c +58 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/GNUmakefile +149 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/GlobalVariable.c +62 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/LastErrorTest.c +21 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/NumberTest.c +132 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/PointerTest.c +63 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/ReferenceTest.c +23 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/StringTest.c +34 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/StructTest.c +240 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/UnionTest.c +43 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/VariadicTest.c +62 -0
- data/vendor/gems/ruby/2.0.0/specifications/corefoundation-0.2.0.gemspec +42 -0
- data/vendor/gems/ruby/2.0.0/specifications/ffi-1.8.1.gemspec +42 -0
- data/yakg.gemspec +3 -2
- metadata +167 -76
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
@@ -0,0 +1 @@
|
|
1
|
+
== See git log
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Copyright (c) 2008-2012 Ruby-FFI contributors
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
This code is free software: you can redistribute it and/or modify it under
|
5
|
+
the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
published by the Free Software Foundation.
|
7
|
+
|
8
|
+
This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
version 3 for more details.
|
12
|
+
|
13
|
+
You should have received a copy of the GNU Lesser General Public License
|
14
|
+
version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# ruby-ffi http://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 should you write your next extension
|
9
|
+
using Ruby-FFI [here](http://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](http://wiki.github.com/ffi/ffi)
|
37
|
+
* the projects using FFI listed on this page (http://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 LGPL3 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 otherwide 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,219 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubygems/package_task'
|
3
|
+
require 'rubygems/tasks'
|
4
|
+
require 'rbconfig'
|
5
|
+
|
6
|
+
USE_RAKE_COMPILER = (RUBY_PLATFORM =~ /java/) ? false : true
|
7
|
+
if USE_RAKE_COMPILER
|
8
|
+
gem 'rake-compiler', '>=0.6.0'
|
9
|
+
require 'rake/extensiontask'
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
require 'fileutils'
|
14
|
+
require 'rbconfig'
|
15
|
+
|
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
|
+
desc "Run all specs"
|
81
|
+
task :specs => TEST_DEPS do
|
82
|
+
sh %{#{Gem.ruby} -w -S rspec #{Dir["spec/ffi/*_spec.rb"].join(" ")} -fs --color}
|
83
|
+
end
|
84
|
+
desc "Run rubinius specs"
|
85
|
+
task :rbxspecs => TEST_DEPS do
|
86
|
+
sh %{#{Gem.ruby} -w -S rspec #{Dir["spec/ffi/rbx/*_spec.rb"].join(" ")} -fs --color}
|
87
|
+
end
|
88
|
+
else
|
89
|
+
TEST_DEPS.unshift :compile
|
90
|
+
desc "Run all specs"
|
91
|
+
task :specs => TEST_DEPS do
|
92
|
+
ENV["MRI_FFI"] = "1"
|
93
|
+
sh %{#{Gem.ruby} -w -Ilib -I#{BUILD_EXT_DIR} -S rspec #{Dir["spec/ffi/*_spec.rb"].join(" ")} -fs --color}
|
94
|
+
end
|
95
|
+
desc "Run rubinius specs"
|
96
|
+
task :rbxspecs => TEST_DEPS do
|
97
|
+
ENV["MRI_FFI"] = "1"
|
98
|
+
sh %{#{Gem.ruby} -w -Ilib -I#{BUILD_EXT_DIR} -S rspec #{Dir["spec/ffi/rbx/*_spec.rb"].join(" ")} -fs --color}
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
desc "Build all packages"
|
103
|
+
task :package => 'gem:package'
|
104
|
+
|
105
|
+
|
106
|
+
CLOBBER.include 'build'
|
107
|
+
CLOBBER.include FileList['lib/**/ffi_c.so']
|
108
|
+
CLOBBER.include FileList["lib/**/ffi_c.#{RbConfig::CONFIG['DLEXT']}"]
|
109
|
+
CLOBBER.include 'lib/ffi/types.conf'
|
110
|
+
CLOBBER.include 'conftest.dSYM'
|
111
|
+
CLOBBER.include 'pkg'
|
112
|
+
|
113
|
+
task :distclean => :clobber
|
114
|
+
|
115
|
+
desc "Build the native test lib"
|
116
|
+
file "build/libtest.#{LIBEXT}" => FileList['libtest/**/*.[ch]'] do
|
117
|
+
sh %{#{GMAKE} -f libtest/GNUmakefile CPU=#{CPU} OS=#{OS} }
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
desc "Build test helper lib"
|
122
|
+
task :libtest => "build/libtest.#{LIBEXT}"
|
123
|
+
|
124
|
+
desc "Test the extension"
|
125
|
+
task :test => [ :specs, :rbxspecs ]
|
126
|
+
|
127
|
+
|
128
|
+
namespace :bench do
|
129
|
+
ITER = ENV['ITER'] ? ENV['ITER'].to_i : 100000
|
130
|
+
bench_libs = "-Ilib -I#{BUILD_DIR}" unless RUBY_PLATFORM == "java"
|
131
|
+
bench_files = Dir["bench/bench_*.rb"].reject { |f| f == "bench_helper.rb" }
|
132
|
+
bench_files.each do |bench|
|
133
|
+
task File.basename(bench, ".rb")[6..-1] => TEST_DEPS do
|
134
|
+
sh %{#{Gem.ruby} #{bench_libs} #{bench} #{ITER}}
|
135
|
+
end
|
136
|
+
end
|
137
|
+
task :all => TEST_DEPS do
|
138
|
+
bench_files.each do |bench|
|
139
|
+
sh %{#{Gem.ruby} #{bench_libs} #{bench}}
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
task 'spec:run' => TEST_DEPS
|
145
|
+
task 'spec:specdoc' => TEST_DEPS
|
146
|
+
|
147
|
+
task :default => :specs
|
148
|
+
|
149
|
+
task 'gem:win32' do
|
150
|
+
sh("rake cross native gem RUBY_CC_VERSION='1.8.7:1.9.3:2.0.0'") || raise("win32 build failed!")
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
namespace 'java' do
|
155
|
+
|
156
|
+
java_gem_spec = Gem::Specification.new do |s|
|
157
|
+
s.name = gem_spec.name
|
158
|
+
s.version = gem_spec.version
|
159
|
+
s.author = gem_spec.author
|
160
|
+
s.email = gem_spec.email
|
161
|
+
s.homepage = gem_spec.homepage
|
162
|
+
s.summary = gem_spec.summary
|
163
|
+
s.description = gem_spec.description
|
164
|
+
s.files = %w(History.txt LICENSE COPYING COPYING.LESSER README.md Rakefile)
|
165
|
+
s.has_rdoc = false
|
166
|
+
s.license = gem_spec.license
|
167
|
+
s.platform = 'java'
|
168
|
+
end
|
169
|
+
|
170
|
+
Gem::PackageTask.new(java_gem_spec) do |pkg|
|
171
|
+
pkg.need_zip = true
|
172
|
+
pkg.need_tar = true
|
173
|
+
pkg.package_dir = 'pkg'
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
task 'gem:java' => 'java:gem'
|
178
|
+
|
179
|
+
|
180
|
+
if USE_RAKE_COMPILER
|
181
|
+
Rake::ExtensionTask.new('ffi_c', gem_spec) do |ext|
|
182
|
+
ext.name = 'ffi_c' # indicate the name of the extension.
|
183
|
+
# ext.lib_dir = BUILD_DIR # put binaries into this folder.
|
184
|
+
ext.tmp_dir = BUILD_DIR # temporary folder used during compilation.
|
185
|
+
ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
|
186
|
+
ext.cross_platform = %w[i386-mingw32 x64-mingw32] # forces the Windows platform instead of the default one
|
187
|
+
end
|
188
|
+
|
189
|
+
ENV['RUBY_CC_VERSION'].to_s.split(':').each do |ruby_version|
|
190
|
+
task "copy:ffi_c:i386-mingw32:#{ruby_version}" do |t|
|
191
|
+
%w[lib #{BUILD_DIR}/i386-mingw32/stage/lib].each do |dir|
|
192
|
+
if File.exists?("#{dir}/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so")
|
193
|
+
sh "i686-w64-mingw32-strip -S #{dir}/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so"
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
task "copy:ffi_c:x64-mingw32:#{ruby_version}" do |t|
|
199
|
+
if File.exists?("#{BUILD_DIR}/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so")
|
200
|
+
sh "x86_64-w64-mingw32-strip -S #{dir}/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so"
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
Gem::Tasks.new do |t|
|
207
|
+
t.scm.tag.format = '%s'
|
208
|
+
end
|
209
|
+
|
210
|
+
begin
|
211
|
+
require 'yard'
|
212
|
+
|
213
|
+
namespace :doc do
|
214
|
+
YARD::Rake::YardocTask.new do |yard|
|
215
|
+
end
|
216
|
+
end
|
217
|
+
rescue LoadError
|
218
|
+
warn "[warn] YARD unavailable"
|
219
|
+
end
|
@@ -0,0 +1,22 @@
|
|
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 History.txt LICENSE COPYING COPYING.LESSER README.md Rakefile) + Dir.glob("{ext,gen,lib,spec,libtest}/**/*").reject { |f| f =~ /lib\/[12]\.[089]/}
|
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 = 'LGPL-3'
|
16
|
+
s.require_paths << 'ext/ffi_c'
|
17
|
+
s.required_ruby_version = '>= 1.8.7'
|
18
|
+
s.add_development_dependency 'rake'
|
19
|
+
s.add_development_dependency 'rake-compiler', '>=0.6.0'
|
20
|
+
s.add_development_dependency 'rspec'
|
21
|
+
s.add_development_dependency 'rubygems-tasks'
|
22
|
+
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
|
@@ -0,0 +1 @@
|
|
1
|
+
/Users/wayne/src/ruby-ffi/lib/ffi/platform/x86_64-darwin/types.conf
|