ffi 1.1.6.pre2-x86-mingw32 → 1.2.0.pre2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ffi might be problematic. Click here for more details.

Files changed (50) hide show
  1. data/COPYING +674 -0
  2. data/COPYING.LESSER +165 -0
  3. data/README.md +104 -0
  4. data/Rakefile +36 -43
  5. data/ext/ffi_c/LongDouble.c +4 -0
  6. data/ext/ffi_c/LongDouble.c.orig +65 -0
  7. data/ext/ffi_c/MethodHandle.c +1 -1
  8. data/ext/ffi_c/Types.h +1 -0
  9. data/ext/ffi_c/Variadic.c +4 -0
  10. data/ext/ffi_c/extconf.rb +1 -0
  11. data/ext/ffi_c/libffi.bsd.mk +1 -1
  12. data/ext/ffi_c/libffi.darwin.mk +6 -4
  13. data/ext/ffi_c/libffi.mk +1 -1
  14. data/lib/1.8/ffi_c.so +0 -0
  15. data/lib/1.9/ffi_c.so +0 -0
  16. data/lib/ffi/autopointer.rb +9 -8
  17. data/lib/ffi/enum.rb +2 -1
  18. data/libtest/Benchmark.c +66 -0
  19. data/libtest/BoolTest.c +45 -0
  20. data/libtest/BufferTest.c +45 -0
  21. data/libtest/ClosureTest.c +204 -0
  22. data/libtest/EnumTest.c +48 -0
  23. data/libtest/FunctionTest.c +72 -0
  24. data/libtest/GNUmakefile +149 -0
  25. data/libtest/GlobalVariable.c +76 -0
  26. data/libtest/LastErrorTest.c +35 -0
  27. data/libtest/NumberTest.c +146 -0
  28. data/libtest/PointerTest.c +77 -0
  29. data/libtest/ReferenceTest.c +37 -0
  30. data/libtest/StringTest.c +48 -0
  31. data/libtest/StructTest.c +254 -0
  32. data/libtest/UnionTest.c +57 -0
  33. data/libtest/VariadicTest.c +76 -0
  34. data/spec/ffi/enum_spec.rb +4 -0
  35. data/spec/ffi/pointer_spec.rb +17 -0
  36. metadata +85 -40
  37. data/README.rdoc +0 -102
  38. data/tasks/ann.rake +0 -80
  39. data/tasks/extension.rake +0 -32
  40. data/tasks/gem.rake +0 -199
  41. data/tasks/git.rake +0 -41
  42. data/tasks/notes.rake +0 -27
  43. data/tasks/post_load.rake +0 -34
  44. data/tasks/rdoc.rake +0 -50
  45. data/tasks/rubyforge.rake +0 -55
  46. data/tasks/setup.rb +0 -301
  47. data/tasks/spec.rake +0 -54
  48. data/tasks/svn.rake +0 -47
  49. data/tasks/test.rake +0 -40
  50. data/tasks/yard.rake +0 -11
@@ -0,0 +1,76 @@
1
+ /*
2
+ * Copyright (c) 2008 Wayne Meissner. All rights reserved.
3
+ *
4
+ * All rights reserved.
5
+ *
6
+ * This file is part of ruby-ffi.
7
+ *
8
+ * This code is free software: you can redistribute it and/or modify it under
9
+ * the terms of the GNU Lesser General Public License version 3 only, as
10
+ * published by the Free Software Foundation.
11
+ *
12
+ * This code is distributed in the hope that it will be useful, but WITHOUT
13
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15
+ * version 3 for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+ #include <sys/types.h>
22
+ #include <stdio.h>
23
+ #include <stdint.h>
24
+ #include <string.h>
25
+ #include <stdarg.h>
26
+
27
+ typedef int8_t s8;
28
+ typedef uint8_t u8;
29
+ typedef int16_t s16;
30
+ typedef uint16_t u16;
31
+ typedef int32_t s32;
32
+ typedef uint32_t u32;
33
+ typedef int64_t s64;
34
+ typedef uint64_t u64;
35
+ typedef signed long sL;
36
+ typedef unsigned long uL;
37
+ typedef float F;
38
+ typedef double D;
39
+
40
+ void pack_varargs(s64* buf, const char* fmt, ...)
41
+ {
42
+ va_list ap;
43
+ int c;
44
+ double d;
45
+ va_start(ap, fmt);
46
+ while ((c = *fmt++)) {
47
+ switch (c) {
48
+ case 'c':
49
+ case 's':
50
+ case 'i':
51
+ *buf++ = va_arg(ap, s32);
52
+ break;
53
+ case 'l':
54
+ *buf++ = va_arg(ap, long);
55
+ break;
56
+ case 'j':
57
+ *buf++ = va_arg(ap, s64);
58
+ break;
59
+ case 'f':
60
+ case 'd':
61
+ d = va_arg(ap, double);
62
+ memcpy(buf++, &d, sizeof(d));
63
+ break;
64
+ case 'C':
65
+ case 'S':
66
+ case 'I':
67
+ *buf++ = va_arg(ap, u32);
68
+ break;
69
+ case 'L':
70
+ *buf++ = va_arg(ap, unsigned long);
71
+ break;
72
+ }
73
+ }
74
+ va_end(ap);
75
+ }
76
+
@@ -224,4 +224,8 @@ describe "All enums" do
224
224
  enum[42424241].should eq nil
225
225
  enum[42424243].should eq nil
226
226
  end
227
+
228
+ it "duplicate enum keys rejected" do
229
+ lambda { enum [ :a, 0xfee1dead, :b, 0xdeadbeef, :a, 0 ] }.should raise_error
230
+ end
227
231
  end
@@ -210,5 +210,22 @@ describe "AutoPointer" do
210
210
  end
211
211
 
212
212
  end
213
+
214
+ describe "#autorelease?" do
215
+ ptr_class = Class.new(FFI::AutoPointer) do
216
+ def self.release(ptr); end
217
+ end
218
+
219
+ it "should be true by default" do
220
+ ptr_class.new(FFI::Pointer.new(0xdeadbeef)).autorelease?.should be_true
221
+ end
222
+
223
+ it "should return false when autorelease=(false)" do
224
+ ptr = ptr_class.new(FFI::Pointer.new(0xdeadbeef))
225
+ ptr.autorelease = false
226
+ ptr.autorelease?.should be_false
227
+ end
228
+ end
229
+
213
230
  end
214
231
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 68069361
4
+ hash: -1308335528
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
- - 1
9
- - 6
8
+ - 2
9
+ - 0
10
10
  - pre
11
11
  - 2
12
- version: 1.1.6.pre2
12
+ version: 1.2.0.pre2
13
13
  platform: x86-mingw32
14
14
  authors:
15
15
  - Wayne Meissner
@@ -17,28 +17,66 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-09-15 00:00:00 +10:00
21
- default_executable:
22
- dependencies: []
23
-
24
- description: |-
25
- Ruby-FFI is a ruby extension for programmatically loading dynamic
26
- libraries, binding functions within them, and calling those functions
27
- from Ruby code. Moreover, a Ruby-FFI extension works without changes
28
- on Ruby and JRuby. Discover why should you write your next extension
29
- using Ruby-FFI here[http://wiki.github.com/ffi/ffi/why-use-ffi].
20
+ date: 2012-11-07 00:00:00 Z
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ name: rake
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 7
44
+ segments:
45
+ - 0
46
+ - 6
47
+ - 0
48
+ version: 0.6.0
49
+ type: :development
50
+ name: rake-compiler
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :development
64
+ name: rspec
65
+ version_requirements: *id003
66
+ description: Ruby FFI library
30
67
  email: wmeissner@gmail.com
31
68
  executables: []
32
69
 
33
70
  extensions: []
34
71
 
35
- extra_rdoc_files:
36
- - README.rdoc
37
- - LICENSE
72
+ extra_rdoc_files: []
73
+
38
74
  files:
39
75
  - History.txt
40
76
  - LICENSE
41
- - README.rdoc
77
+ - COPYING
78
+ - COPYING.LESSER
79
+ - README.md
42
80
  - Rakefile
43
81
  - ext/ffi_c/AbstractMemory.c
44
82
  - ext/ffi_c/AbstractMemory.h
@@ -339,6 +377,7 @@ files:
339
377
  - ext/ffi_c/libffi.vc.mk
340
378
  - ext/ffi_c/libffi.vc64.mk
341
379
  - ext/ffi_c/LongDouble.c
380
+ - ext/ffi_c/LongDouble.c.orig
342
381
  - ext/ffi_c/LongDouble.h
343
382
  - ext/ffi_c/MappedType.c
344
383
  - ext/ffi_c/MappedType.h
@@ -451,39 +490,45 @@ files:
451
490
  - spec/ffi/union_spec.rb
452
491
  - spec/ffi/variadic_spec.rb
453
492
  - spec/spec.opts
454
- - tasks/ann.rake
455
- - tasks/extension.rake
456
- - tasks/gem.rake
457
- - tasks/git.rake
458
- - tasks/notes.rake
459
- - tasks/post_load.rake
460
- - tasks/rdoc.rake
461
- - tasks/rubyforge.rake
462
- - tasks/setup.rb
463
- - tasks/spec.rake
464
- - tasks/svn.rake
465
- - tasks/test.rake
466
- - tasks/yard.rake
493
+ - libtest/Benchmark.c
494
+ - libtest/BoolTest.c
495
+ - libtest/BufferTest.c
496
+ - libtest/ClosureTest.c
497
+ - libtest/EnumTest.c
498
+ - libtest/FunctionTest.c
499
+ - libtest/GlobalVariable.c
500
+ - libtest/GNUmakefile
501
+ - libtest/LastErrorTest.c
502
+ - libtest/NumberTest.c
503
+ - libtest/PointerTest.c
504
+ - libtest/ReferenceTest.c
505
+ - libtest/StringTest.c
506
+ - libtest/StructTest.c
507
+ - libtest/UnionTest.c
508
+ - libtest/VariadicTest.c
467
509
  - lib/1.8/ffi_c.so
468
510
  - lib/1.9/ffi_c.so
469
- has_rdoc: true
470
511
  homepage: http://wiki.github.com/ffi/ffi
471
- licenses: []
472
-
512
+ licenses:
513
+ - LGPL-3
473
514
  post_install_message:
474
515
  rdoc_options: []
475
516
 
476
517
  require_paths:
477
518
  - lib
519
+ - lib/ffi
520
+ - ext/ffi_c
478
521
  required_ruby_version: !ruby/object:Gem::Requirement
479
522
  none: false
480
523
  requirements:
481
524
  - - ">="
482
525
  - !ruby/object:Gem::Version
483
- hash: 3
526
+ hash: 57
484
527
  segments:
485
- - 0
486
- version: "0"
528
+ - 1
529
+ - 8
530
+ - 7
531
+ version: 1.8.7
487
532
  required_rubygems_version: !ruby/object:Gem::Requirement
488
533
  none: false
489
534
  requirements:
@@ -497,10 +542,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
497
542
  version: 1.3.1
498
543
  requirements: []
499
544
 
500
- rubyforge_project: ffi
501
- rubygems_version: 1.6.2
545
+ rubyforge_project:
546
+ rubygems_version: 1.8.24
502
547
  signing_key:
503
548
  specification_version: 3
504
- summary: Ruby-FFI is a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling those functions from Ruby code
549
+ summary: Ruby FFI
505
550
  test_files: []
506
551
 
@@ -1,102 +0,0 @@
1
- ruby-ffi
2
- http://wiki.github.com/ffi/ffi
3
-
4
- == DESCRIPTION:
5
-
6
- Ruby-FFI is a ruby extension for programmatically loading dynamic
7
- libraries, binding functions within them, and calling those functions
8
- from Ruby code. Moreover, a Ruby-FFI extension works without changes
9
- on Ruby and JRuby. Discover why should you write your next extension
10
- using Ruby-FFI here[http://wiki.github.com/ffi/ffi/why-use-ffi].
11
-
12
- == FEATURES/PROBLEMS:
13
-
14
- * It has a very intuitive DSL
15
- * It supports all C native types
16
- * It supports C structs (also nested), enums and global variables
17
- * It supports callbacks
18
- * It has smart methods to handle memory management of pointers and structs
19
-
20
- == SYNOPSIS:
21
-
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
- For less minimalistic and more sane examples you may look at:
33
-
34
- * the samples/ folder
35
- * the examples on the wiki[http://wiki.github.com/ffi/ffi]
36
- * the projects using FFI listed on this page[http://wiki.github.com/ffi/ffi/projects-using-ffi]
37
-
38
- == REQUIREMENTS:
39
-
40
- * You need a sane building environment in order to compile the extension.
41
-
42
- == DOWNLOAD/INSTALL:
43
-
44
- From rubyforge:
45
-
46
- [sudo] gem install ffi
47
-
48
- or from the git repository on github:
49
-
50
- git clone git://github.com/ffi/ffi.git
51
- cd ffi
52
- rake gem:install
53
-
54
- == LICENSE:
55
-
56
- See LICENSE file.
57
-
58
- == CREDITS
59
-
60
- The following people have submitted code, bug reports, or otherwide contributed to the success of this project:
61
-
62
- Alban Peignier <alban.peignier@free.fr>
63
- Aman Gupta <aman@tmm1.net>
64
- Andrea Fazzi <andrea.fazzi@alcacoop.it>
65
- Andreas Niederl <rico32@gmx.net>
66
- Andrew Cholakian <andrew@andrewvc.com>
67
- Antonio Terceiro <terceiro@softwarelivre.org>
68
- Brian Candler <B.Candler@pobox.com>
69
- Brian D. Burns <burns180@gmail.com>
70
- Bryan Kearney <bkearney@redhat.com>
71
- Charlie Savage <cfis@zerista.com>
72
- Chikanaga Tomoyuki <nagachika00@gmail.com>
73
- Hongli Lai <hongli@phusion.nl>
74
- Ian MacLeod <ian@nevir.net>
75
- Jake Douglas <jake@shiftedlabs.com>
76
- Jean-Dominique Morani <jdmorani@mac.com>
77
- Jeremy Hinegardner <jeremy@hinegardner.org>
78
- Jesús García Sáez <blaxter@gmail.com>
79
- Joe Khoobyar <joe@ankhcraft.com>
80
- Jurij Smakov <jurij@wooyd.org>
81
- KISHIMOTO, Makoto <ksmakoto@dd.iij4u.or.jp>
82
- Kim Burgestrand <kim@burgestrand.se>
83
- Lars Kanis <kanis@comcard.de>
84
- Luc Heinrich <luc@honk-honk.com>
85
- Luis Lavena <luislavena@gmail.com>
86
- Matijs van Zuijlen <matijs@matijs.net>
87
- Matthew King <automatthew@gmail.com>
88
- Mike Dalessio <mike.dalessio@gmail.com>
89
- NARUSE, Yui <naruse@airemix.jp>
90
- Park Heesob <phasis@gmail.com>
91
- Shin Yee <shinyee@speedgocomputing.com>
92
- Stephen Bannasch <stephen.bannasch@gmail.com>
93
- Suraj N. Kurapati <sunaku@gmail.com>
94
- Sylvain Daubert <sylvain.daubert@laposte.net>
95
- Victor Costan
96
- beoran@gmail.com
97
- ctide <christide@christide.com>
98
- emboss <Martin.Bosslet@googlemail.com>
99
- hobophobe <unusualtears@gmail.com>
100
- meh <meh@paranoici.org>
101
- postmodern <postmodern.mod3@gmail.com>
102
- wycats@gmail.com <wycats@gmail.com>
@@ -1,80 +0,0 @@
1
-
2
- begin
3
- require 'bones/smtp_tls'
4
- rescue LoadError
5
- require 'net/smtp'
6
- end
7
- require 'time'
8
-
9
- namespace :ann do
10
-
11
- # A prerequisites task that all other tasks depend upon
12
- task :prereqs
13
-
14
- file PROJ.ann.file do
15
- ann = PROJ.ann
16
- puts "Generating #{ann.file}"
17
- File.open(ann.file,'w') do |fd|
18
- fd.puts("#{PROJ.name} version #{PROJ.version}")
19
- fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
20
- fd.puts(" #{PROJ.url}") if PROJ.url.valid?
21
- fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
22
- fd.puts
23
- fd.puts("== DESCRIPTION")
24
- fd.puts
25
- fd.puts(PROJ.description)
26
- fd.puts
27
- fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
28
- fd.puts
29
- ann.paragraphs.each do |p|
30
- fd.puts "== #{p.upcase}"
31
- fd.puts
32
- fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
33
- fd.puts
34
- end
35
- fd.puts ann.text if ann.text
36
- end
37
- end
38
-
39
- desc "Create an announcement file"
40
- task :announcement => ['ann:prereqs', PROJ.ann.file]
41
-
42
- desc "Send an email announcement"
43
- task :email => ['ann:prereqs', PROJ.ann.file] do
44
- ann = PROJ.ann
45
- from = ann.email[:from] || Array(PROJ.authors).first || PROJ.email
46
- to = Array(ann.email[:to])
47
-
48
- ### build a mail header for RFC 822
49
- rfc822msg = "From: #{from}\n"
50
- rfc822msg << "To: #{to.join(',')}\n"
51
- rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
52
- rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
53
- rfc822msg << "\n"
54
- rfc822msg << "Date: #{Time.new.rfc822}\n"
55
- rfc822msg << "Message-Id: "
56
- rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{ann.email[:domain]}>\n\n"
57
- rfc822msg << File.read(ann.file)
58
-
59
- params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
60
- ann.email[key]
61
- end
62
-
63
- params[3] = (PROJ.ann.email[:from] || PROJ.email) if params[3].nil?
64
-
65
- if params[4].nil?
66
- STDOUT.write "Please enter your e-mail password (#{params[3]}): "
67
- params[4] = STDIN.gets.chomp
68
- end
69
-
70
- ### send email
71
- Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
72
- end
73
- end # namespace :ann
74
-
75
- desc 'Alias to ann:announcement'
76
- task :ann => 'ann:announcement'
77
-
78
- CLOBBER << PROJ.ann.file
79
-
80
- # EOF