ghazel-ffi_gen 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +83 -0
- data/lib/ffi_gen/clang.rb +5932 -0
- data/lib/ffi_gen/empty.h +0 -0
- data/lib/ffi_gen/java_enum.java +3 -0
- data/lib/ffi_gen/java_output.rb +324 -0
- data/lib/ffi_gen/java_pre.java +35 -0
- data/lib/ffi_gen/ruby_output.rb +302 -0
- data/lib/ffi_gen.rb +763 -0
- metadata +67 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8a6fd9f6a4be7633dcb73b531d9fbed87c571c9d
|
4
|
+
data.tar.gz: d83e65baa61764622e44c5a5605e139a1aa7a767
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7c7253dc0955031e6dddf511969f19459d8ba2cab12e78554c59761b01b4fab6fb5a16b6114f2ca4bb50939abdfa9518c146099c20bf26d193d0e3a48b4334f0
|
7
|
+
data.tar.gz: 79e0d47b1ccf464ac7b72eaa4996c22addd79e47f8f8270bfc9b507bdf1f0847264378a1cbb278272a25dbec7c425d96c3be085086805fae6ea4d59d6be274c3
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Richard Musiol
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# A generator for Ruby FFI bindings
|
2
|
+
|
3
|
+
*Author:* Richard Musiol
|
4
|
+
*Contributors:* Jeremy Voorhis (thanks for the initial idea)
|
5
|
+
*License:* MIT (see LICENSE)
|
6
|
+
|
7
|
+
|
8
|
+
## Features
|
9
|
+
|
10
|
+
* Generation of FFI methods, structures, unions, enumerations and callbacks
|
11
|
+
* Generation of YARD documentation comments
|
12
|
+
* Tested with headers of the following libraries:
|
13
|
+
* Cairo
|
14
|
+
* CEF (Chromium Embedded Framework)
|
15
|
+
* Clang
|
16
|
+
* LibSSH2
|
17
|
+
* LLVM
|
18
|
+
* OpenGL
|
19
|
+
* SQLite3
|
20
|
+
|
21
|
+
|
22
|
+
## Requirements
|
23
|
+
|
24
|
+
* Ruby 1.9
|
25
|
+
* Clang 3.5 or later ([Download](http://llvm.org/releases/download.html#3.5) the binaries or
|
26
|
+
build from source configured with ``--enable-shared``)
|
27
|
+
|
28
|
+
*These requirements are only for running the generator. The generated files are Ruby 1.8 compatible and do not need Clang.*
|
29
|
+
|
30
|
+
|
31
|
+
## Example
|
32
|
+
|
33
|
+
Use the following interface in a script or Rake task:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
require "ffi_gen"
|
37
|
+
|
38
|
+
FFIGen.generate(
|
39
|
+
module_name: "Clang",
|
40
|
+
ffi_lib: "clang",
|
41
|
+
headers: ["clang-c/Index.h"],
|
42
|
+
cflags: `llvm-config --cflags`.split(" "),
|
43
|
+
prefixes: ["clang_", "CX"],
|
44
|
+
output: "clang-c/index.rb"
|
45
|
+
)
|
46
|
+
```
|
47
|
+
|
48
|
+
Output: [clang-c/index.rb](https://github.com/neelance/ffi_gen/blob/master/test/output/clang-c/Index.rb)
|
49
|
+
|
50
|
+
Other generated files can be found in the [test/output](https://github.com/neelance/ffi_gen/tree/master/test/output) directory.
|
51
|
+
|
52
|
+
|
53
|
+
## Hints
|
54
|
+
|
55
|
+
You may need to set additional include directories:
|
56
|
+
|
57
|
+
```
|
58
|
+
export CPATH=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/include
|
59
|
+
```
|
60
|
+
|
61
|
+
Your GCC include paths can be seen with:
|
62
|
+
|
63
|
+
```
|
64
|
+
`gcc -print-prog-name=cc1` -v
|
65
|
+
```
|
66
|
+
|
67
|
+
|
68
|
+
## Projects using ffi_gen
|
69
|
+
|
70
|
+
* https://github.com/jvoorhis/ruby-llvm
|
71
|
+
|
72
|
+
|
73
|
+
## Roadmap
|
74
|
+
|
75
|
+
* Support for more libraries:
|
76
|
+
* (Write me if you have a whish)
|
77
|
+
* Automatic generation of object oriented wrappers
|
78
|
+
* Polish YARD documentation comments some more
|
79
|
+
|
80
|
+
|
81
|
+
## Feedback
|
82
|
+
|
83
|
+
Please use GitHub's issue tracker for problems or suggestions. Pull requests are welcome, too.
|