fiddle 1.0.0.beta2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -0
- data/README.md +21 -3
- data/ext/fiddle/extlibs +1 -1
- data/fiddle.gemspec +3 -1
- data/lib/fiddle/cparser.rb +3 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 538e522b63f6cd2ec6ee72c138757966cc6e0aab44b381bb01bc464a740aa3a7
|
4
|
+
data.tar.gz: 3fc2e992e471105c4cadd9ee58234c047e7f8899d38ef8476b05a1640ef40284
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1b2011849c78991b1129999a0469318a60414d3bd5db196cc82a21c86443a6f68cdbce1a3baef1043539e8395641c2ceac121fdf3e712bbc51ad9c2d4dcd12b
|
7
|
+
data.tar.gz: 4a8fc35a372b73f62496760f38f6f0291fe6cbd649c634299b289bf006e46ab585024c7721ef02136f9d2ad45aa1136b6072ab6d7adcbd1bb2081d606cc870fb
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# Fiddle
|
2
2
|
|
3
|
-
|
3
|
+
[![Build Status](https://travis-ci.org/ruby/fiddle.svg?branch=master)](https://travis-ci.org/ruby/fiddle)
|
4
4
|
|
5
|
-
|
5
|
+
A libffi wrapper for Ruby.
|
6
|
+
|
7
|
+
Fiddle is an extension to translate a foreign function interface (FFI) with ruby.
|
8
|
+
|
9
|
+
It wraps [libffi](http://sourceware.org/libffi/), a popular C library which provides a portable interface that allows code written in one language to call code written in another language.
|
6
10
|
|
7
11
|
## Installation
|
8
12
|
|
@@ -22,7 +26,21 @@ Or install it yourself as:
|
|
22
26
|
|
23
27
|
## Usage
|
24
28
|
|
25
|
-
|
29
|
+
Here we will use Fiddle::Function to wrap [floor(3) from libm](http://linux.die.net/man/3/floor)
|
30
|
+
|
31
|
+
```
|
32
|
+
require 'fiddle'
|
33
|
+
|
34
|
+
libm = Fiddle.dlopen('/lib/libm.so.6')
|
35
|
+
|
36
|
+
floor = Fiddle::Function.new(
|
37
|
+
libm['floor'],
|
38
|
+
[Fiddle::TYPE_DOUBLE],
|
39
|
+
Fiddle::TYPE_DOUBLE
|
40
|
+
)
|
41
|
+
|
42
|
+
puts floor.call(3.14159) #=> 3.0
|
43
|
+
```
|
26
44
|
|
27
45
|
## Development
|
28
46
|
|
data/ext/fiddle/extlibs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
http://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz \
|
2
2
|
md5:83b89587607e3eb65c70d361f13bab43 \
|
3
3
|
sha512:980ca30a8d76f963fca722432b1fe5af77d7a4e4d2eac5144fbc5374d4c596609a293440573f4294207e1bdd9fda80ad1e1cafb2ffb543df5a275bc3bd546483 \
|
4
4
|
#
|
data/fiddle.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = "fiddle"
|
4
|
-
spec.version = '1.0.0
|
4
|
+
spec.version = '1.0.0'
|
5
5
|
spec.authors = ["Aaron Patterson", "SHIBATA Hiroshi"]
|
6
6
|
spec.email = ["aaron@tenderlovemaking.com", "hsbt@ruby-lang.org"]
|
7
7
|
|
@@ -15,6 +15,8 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
16
16
|
spec.require_paths = ["lib"]
|
17
17
|
|
18
|
+
spec.required_ruby_version = ">= 2.3.0"
|
19
|
+
|
18
20
|
spec.add_development_dependency "bundler"
|
19
21
|
spec.add_development_dependency "rake"
|
20
22
|
spec.add_development_dependency "rake-compiler"
|
data/lib/fiddle/cparser.rb
CHANGED
@@ -21,6 +21,7 @@ module Fiddle
|
|
21
21
|
# Parses a C struct's members
|
22
22
|
#
|
23
23
|
# Example:
|
24
|
+
# require 'fiddle/import'
|
24
25
|
#
|
25
26
|
# include Fiddle::CParser
|
26
27
|
# #=> Object
|
@@ -66,6 +67,7 @@ module Fiddle
|
|
66
67
|
# be looked up.
|
67
68
|
#
|
68
69
|
# Example:
|
70
|
+
# require 'fiddle/import'
|
69
71
|
#
|
70
72
|
# include Fiddle::CParser
|
71
73
|
# #=> Object
|
@@ -102,6 +104,7 @@ module Fiddle
|
|
102
104
|
# value will be the C type to be looked up.
|
103
105
|
#
|
104
106
|
# Example:
|
107
|
+
# require 'fiddle/import'
|
105
108
|
#
|
106
109
|
# include Fiddle::CParser
|
107
110
|
# #=> Object
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiddle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -107,15 +107,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 2.3.0
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
|
-
- - "
|
113
|
+
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
115
|
+
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.7.3
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: A libffi wrapper for Ruby.
|