ffi-libc 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour --format documentation
data/ChangeLog.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 0.0.4 / 2011-02-03
2
+
3
+ * Require ffi >= 0.6.0, <= 1.1.0:
4
+ * JRuby requires ffi >= 1.0.0.
5
+ * A lot of projects still require ffi ~> 0.6.0.
6
+ * Added `stdin`.
7
+ * Added `stdout`.
8
+ * Added `stderr`.
9
+
1
10
  ### 0.0.3 / 2010-08-03
2
11
 
3
12
  * Load libc from the current process.
data/LICENSE.txt CHANGED
@@ -1,7 +1,4 @@
1
-
2
- The MIT License
3
-
4
- Copyright (c) 2010 Hal Brodigan
1
+ Copyright (c) 2010-2011 Hal Brodigan
5
2
 
6
3
  Permission is hereby granted, free of charge, to any person obtaining
7
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # ffi-libc
2
2
 
3
- * [github.com/postmodern/ffi-libc](http://github.com/postmodern/ffi-libc/)
4
- * [github.com/postmodern/ffi-libc/issues](http://github.com/postmodern/ffi-libc/issues)
5
- * Postmodern (postmodern.mod3 at gmail.com)
3
+ * [Source](http://github.com/postmodern/ffi-libc/)
4
+ * [Issues](http://github.com/postmodern/ffi-libc/issues)
5
+ * [Documentation](http://rubydoc.info/gems/ffi-libc)
6
+ * [Email](postmodern.mod3 at gmail.com)
6
7
 
7
8
  ## Description
8
9
 
@@ -10,12 +11,90 @@ Useful Ruby FFI bindings for `libc`.
10
11
 
11
12
  ## Features
12
13
 
13
- * Provides common Structs used in `libc`.
14
- * Binds to common functions and global variables in `libc`.
14
+ * Provides common Structs used in `libc`:
15
+ * {FFI::LibC::In6Addr}
16
+ * {FFI::LibC::InAddr}
17
+ * {FFI::LibC::SockAddrDL}
18
+ * {FFI::LibC::SockAddrFamily}
19
+ * {FFI::LibC::SockAddrIn6}
20
+ * {FFI::LibC::SockAddrIn}
21
+ * {FFI::LibC::SockAddr}
22
+ * {FFI::LibC::Timeval}
23
+ * {FFI::LibC::Timezone}
24
+ * Binds to common functions and global variables in `libc`:
25
+ * `errno.h`:
26
+ * `sys_errlist`
27
+ * `sys_nerr`
28
+ * `errno`
29
+ * `unistd.h`:
30
+ * `brk`
31
+ * `sbrk`
32
+ * `getpid`
33
+ * `getppid`
34
+ * `getuid`
35
+ * `geteuid`
36
+ * `getgid`
37
+ * `getegid`
38
+ * `stdlib.h`:
39
+ * `calloc`
40
+ * `malloc`
41
+ * `free`
42
+ * `realloc`
43
+ * `getenv`
44
+ * `putenv`
45
+ * `unsetenv`
46
+ * `clearenv`
47
+ * `time.h`:
48
+ * `time`
49
+ * `sys/time.h`:
50
+ * `gettimeofday`
51
+ * `settimeofday`
52
+ * `sys/mman.h`:
53
+ * `mmap`
54
+ * `munmap`
55
+ * `string.h`:
56
+ * `bzero`
57
+ * `memset`
58
+ * `memcpy`
59
+ * `memcmp`
60
+ * `memchr`
61
+ * `memrchr`
62
+ * `strcpy`
63
+ * `strncpy`
64
+ * `strlen`
65
+ * `index`
66
+ * `rindex`
67
+ * `strchr`
68
+ * `strrchr`
69
+ * `strstr`
70
+ * `strerror`
71
+ * `stdio.h`:
72
+ * `stdin`
73
+ * `stdout`
74
+ * `stderr`
75
+ * `fopen`
76
+ * `fdopen`
77
+ * `freopen`
78
+ * `fseek`
79
+ * `ftell`
80
+ * `rewind`
81
+ * `fread`
82
+ * `fwrite`
83
+ * `fgetc`
84
+ * `fgets`
85
+ * `fputc`
86
+ * `fputs`
87
+ * `fflush`
88
+ * `fclose`
89
+ * `clearerr`
90
+ * `feof`
91
+ * `ferror`
92
+ * `fileno`
93
+ * `perror`
15
94
 
16
95
  ## Requirements
17
96
 
18
- * [ffi](http://github.com/ffi/ffi) ~> 0.6.0
97
+ * [ffi](http://github.com/ffi/ffi) >= 0.6.0, <= 1.1.0
19
98
 
20
99
  ## Install
21
100
 
@@ -23,5 +102,6 @@ Useful Ruby FFI bindings for `libc`.
23
102
 
24
103
  ## License
25
104
 
26
- See {file:LICENSE.txt} for license information.
105
+ Copyright (c) 2010-2011 Hal Brodigan
27
106
 
107
+ See {file:LICENSE.txt} for license information.
data/Rakefile CHANGED
@@ -1,38 +1,35 @@
1
1
  require 'rubygems'
2
- require 'bundler'
2
+ require 'rake'
3
3
 
4
4
  begin
5
- Bundler.setup(:development, :doc)
6
- rescue Bundler::BundlerError => e
5
+ gem 'ore-tasks', '~> 0.3.0'
6
+ require 'ore/tasks'
7
+
8
+ Ore::Tasks.new
9
+ rescue LoadError => e
7
10
  STDERR.puts e.message
8
- STDERR.puts "Run `bundle install` to install missing gems"
9
- exit e.status_code
11
+ STDERR.puts "Run `gem install ore-tasks` to install 'ore/tasks'."
10
12
  end
11
13
 
12
- require 'rake'
13
- require 'rake/clean'
14
- require 'jeweler'
14
+ begin
15
+ gem 'rspec', '~> 2.4.0'
16
+ require 'rspec/core/rake_task'
15
17
 
16
- Jeweler::Tasks.new do |gem|
17
- gem.name = 'ffi-libc'
18
- gem.licenses = ['MIT']
19
- gem.summary = %Q{Useful FFI bindings for libc}
20
- gem.email = 'postmodern.mod3@gmail.com'
21
- gem.homepage = %Q{http://github.com/postmodern/ffi-libc}
22
- gem.description = %Q{Useful Ruby FFI bindings for libc.}
23
- gem.authors = ['Postmodern']
24
- gem.has_rdoc = 'yard'
18
+ RSpec::Core::RakeTask.new
19
+ rescue LoadError => e
20
+ task :spec do
21
+ abort "Please run `gem install rspec` to install RSpec."
22
+ end
25
23
  end
24
+ task :default => :spec
26
25
 
27
- require 'spec/rake/spectask'
26
+ begin
27
+ gem 'yard', '~> 0.6.0'
28
+ require 'yard'
28
29
 
29
- desc "Run all specifications"
30
- Spec::Rake::SpecTask.new(:spec) do |spec|
31
- spec.libs += ['lib', 'spec']
32
- spec.spec_files = FileList['spec/**/*_spec.rb']
33
- spec.spec_opts = ['--options', '.specopts']
30
+ YARD::Rake::YardocTask.new
31
+ rescue LoadError => e
32
+ task :yard do
33
+ abort "Please run `gem install yard` to install YARD."
34
+ end
34
35
  end
35
- task :default => :spec
36
-
37
- require 'yard'
38
- YARD::Rake::YardocTask.new
data/ffi-libc.gemspec CHANGED
@@ -1,77 +1,15 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
5
2
 
6
- Gem::Specification.new do |s|
7
- s.name = %q{ffi-libc}
8
- s.version = "0.0.3"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Postmodern"]
12
- s.date = %q{2010-08-03}
13
- s.description = %q{Useful Ruby FFI bindings for libc.}
14
- s.email = %q{postmodern.mod3@gmail.com}
15
- s.extra_rdoc_files = [
16
- "ChangeLog.md",
17
- "LICENSE.txt",
18
- "README.md"
19
- ]
20
- s.files = [
21
- ".gitignore",
22
- ".specopts",
23
- ".yardopts",
24
- "ChangeLog.md",
25
- "Gemfile",
26
- "LICENSE.txt",
27
- "README.md",
28
- "Rakefile",
29
- "VERSION",
30
- "ffi-libc.gemspec",
31
- "lib/ffi/libc.rb",
32
- "lib/ffi/libc/af.rb",
33
- "lib/ffi/libc/in6_addr.rb",
34
- "lib/ffi/libc/in_addr.rb",
35
- "lib/ffi/libc/libc.rb",
36
- "lib/ffi/libc/sock_addr.rb",
37
- "lib/ffi/libc/sock_addr_dl.rb",
38
- "lib/ffi/libc/sock_addr_family.rb",
39
- "lib/ffi/libc/sock_addr_in.rb",
40
- "lib/ffi/libc/sock_addr_in6.rb",
41
- "lib/ffi/libc/timeval.rb",
42
- "lib/ffi/libc/timezone.rb",
43
- "lib/ffi/libc/types.rb"
44
- ]
45
- s.has_rdoc = %q{yard}
46
- s.homepage = %q{http://github.com/postmodern/ffi-libc}
47
- s.licenses = ["MIT"]
48
- s.require_paths = ["lib"]
49
- s.rubygems_version = %q{1.3.7}
50
- s.summary = %q{Useful FFI bindings for libc}
51
-
52
- if s.respond_to? :specification_version then
53
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
- s.specification_version = 3
55
-
56
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
- s.add_runtime_dependency(%q<ffi>, ["~> 0.6.0"])
58
- s.add_development_dependency(%q<bundler>, ["~> 0.9.25"])
59
- s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
60
- s.add_development_dependency(%q<jeweler>, ["~> 1.4.0"])
61
- s.add_development_dependency(%q<rspec>, ["~> 1.3.0"])
62
- else
63
- s.add_dependency(%q<ffi>, ["~> 0.6.0"])
64
- s.add_dependency(%q<bundler>, ["~> 0.9.25"])
65
- s.add_dependency(%q<rake>, ["~> 0.8.7"])
66
- s.add_dependency(%q<jeweler>, ["~> 1.4.0"])
67
- s.add_dependency(%q<rspec>, ["~> 1.3.0"])
68
- end
69
- else
70
- s.add_dependency(%q<ffi>, ["~> 0.6.0"])
71
- s.add_dependency(%q<bundler>, ["~> 0.9.25"])
72
- s.add_dependency(%q<rake>, ["~> 0.8.7"])
73
- s.add_dependency(%q<jeweler>, ["~> 1.4.0"])
74
- s.add_dependency(%q<rspec>, ["~> 1.3.0"])
3
+ begin
4
+ Ore::Specification.new do |gemspec|
5
+ # custom logic here
6
+ end
7
+ rescue NameError
8
+ begin
9
+ require 'ore/specification'
10
+ retry
11
+ rescue LoadError
12
+ STDERR.puts "The 'ffi-libc.gemspec' file requires Ore."
13
+ STDERR.puts "Run `gem install ore-core` to install Ore."
75
14
  end
76
15
  end
77
-
data/gemspec.yml ADDED
@@ -0,0 +1,17 @@
1
+ name: ffi-libc
2
+ version: 0.0.4
3
+ summary: Useful FFI bindings for libc
4
+ description: Useful Ruby FFI bindings for libc.
5
+ license: MIT
6
+ authors: Postmodern
7
+ email: postmodern.mod3@gmail.com
8
+ homepage: http://github.com/postmodern/ffi-libc
9
+ has_yard: true
10
+
11
+ dependencies:
12
+ ffi: >= 0.6.0, <= 1.1.0
13
+
14
+ development_dependencies:
15
+ ore-tasks: ~> 0.3.0
16
+ rspec: ~> 2.4.0
17
+ yard: ~> 0.6.0
data/lib/ffi/libc/libc.rb CHANGED
@@ -64,6 +64,10 @@ module FFI
64
64
  attach_function :strerror, [:int], :string
65
65
 
66
66
  # stdio.h
67
+ attach_variable :stdin, :pointer
68
+ attach_variable :stdout, :pointer
69
+ attach_variable :stderr, :pointer
70
+
67
71
  attach_function :fopen, [:string, :string], :FILE
68
72
  attach_function :fdopen, [:int, :string], :FILE
69
73
  attach_function :freopen, [:string, :string, :FILE], :FILE
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-libc
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 3
9
- version: 0.0.3
4
+ prerelease:
5
+ version: 0.0.4
10
6
  platform: ruby
11
7
  authors:
12
8
  - Postmodern
@@ -14,84 +10,56 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-08-03 00:00:00 -07:00
13
+ date: 2011-02-03 00:00:00 -08:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
21
17
  name: ffi
18
+ prerelease: false
22
19
  requirement: &id001 !ruby/object:Gem::Requirement
23
20
  none: false
24
21
  requirements:
25
- - - ~>
22
+ - - ">="
26
23
  - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 6
30
- - 0
31
24
  version: 0.6.0
25
+ - - <=
26
+ - !ruby/object:Gem::Version
27
+ version: 1.1.0
32
28
  type: :runtime
33
- prerelease: false
34
29
  version_requirements: *id001
35
30
  - !ruby/object:Gem::Dependency
36
- name: bundler
31
+ name: ore-tasks
32
+ prerelease: false
37
33
  requirement: &id002 !ruby/object:Gem::Requirement
38
34
  none: false
39
35
  requirements:
40
36
  - - ~>
41
37
  - !ruby/object:Gem::Version
42
- segments:
43
- - 0
44
- - 9
45
- - 25
46
- version: 0.9.25
38
+ version: 0.3.0
47
39
  type: :development
48
- prerelease: false
49
40
  version_requirements: *id002
50
41
  - !ruby/object:Gem::Dependency
51
- name: rake
42
+ name: rspec
43
+ prerelease: false
52
44
  requirement: &id003 !ruby/object:Gem::Requirement
53
45
  none: false
54
46
  requirements:
55
47
  - - ~>
56
48
  - !ruby/object:Gem::Version
57
- segments:
58
- - 0
59
- - 8
60
- - 7
61
- version: 0.8.7
49
+ version: 2.4.0
62
50
  type: :development
63
- prerelease: false
64
51
  version_requirements: *id003
65
52
  - !ruby/object:Gem::Dependency
66
- name: jeweler
53
+ name: yard
54
+ prerelease: false
67
55
  requirement: &id004 !ruby/object:Gem::Requirement
68
56
  none: false
69
57
  requirements:
70
58
  - - ~>
71
59
  - !ruby/object:Gem::Version
72
- segments:
73
- - 1
74
- - 4
75
- - 0
76
- version: 1.4.0
60
+ version: 0.6.0
77
61
  type: :development
78
- prerelease: false
79
62
  version_requirements: *id004
80
- - !ruby/object:Gem::Dependency
81
- name: rspec
82
- requirement: &id005 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ~>
86
- - !ruby/object:Gem::Version
87
- segments:
88
- - 1
89
- - 3
90
- - 0
91
- version: 1.3.0
92
- type: :development
93
- prerelease: false
94
- version_requirements: *id005
95
63
  description: Useful Ruby FFI bindings for libc.
96
64
  email: postmodern.mod3@gmail.com
97
65
  executables: []
@@ -99,20 +67,16 @@ executables: []
99
67
  extensions: []
100
68
 
101
69
  extra_rdoc_files:
102
- - ChangeLog.md
103
- - LICENSE.txt
104
70
  - README.md
105
71
  files:
106
- - .gitignore
107
- - .specopts
72
+ - .rspec
108
73
  - .yardopts
109
74
  - ChangeLog.md
110
- - Gemfile
111
75
  - LICENSE.txt
112
76
  - README.md
113
77
  - Rakefile
114
- - VERSION
115
78
  - ffi-libc.gemspec
79
+ - gemspec.yml
116
80
  - lib/ffi/libc.rb
117
81
  - lib/ffi/libc/af.rb
118
82
  - lib/ffi/libc/in6_addr.rb
@@ -126,7 +90,7 @@ files:
126
90
  - lib/ffi/libc/timeval.rb
127
91
  - lib/ffi/libc/timezone.rb
128
92
  - lib/ffi/libc/types.rb
129
- has_rdoc: yard
93
+ has_rdoc: true
130
94
  homepage: http://github.com/postmodern/ffi-libc
131
95
  licenses:
132
96
  - MIT
@@ -140,22 +104,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
104
  requirements:
141
105
  - - ">="
142
106
  - !ruby/object:Gem::Version
143
- hash: -2959684172308845082
144
- segments:
145
- - 0
146
107
  version: "0"
147
108
  required_rubygems_version: !ruby/object:Gem::Requirement
148
109
  none: false
149
110
  requirements:
150
111
  - - ">="
151
112
  - !ruby/object:Gem::Version
152
- segments:
153
- - 0
154
113
  version: "0"
155
114
  requirements: []
156
115
 
157
- rubyforge_project:
158
- rubygems_version: 1.3.7
116
+ rubyforge_project: ffi-libc
117
+ rubygems_version: 1.5.0
159
118
  signing_key:
160
119
  specification_version: 3
161
120
  summary: Useful FFI bindings for libc
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- doc
2
- pkg
3
- .bundle
4
- .yardoc
data/.specopts DELETED
@@ -1 +0,0 @@
1
- --colour --format specdoc
data/Gemfile DELETED
@@ -1,24 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- group(:runtime) do
4
- gem 'ffi', '~> 0.6.0'
5
- end
6
-
7
- group(:development) do
8
- gem 'bundler', '~> 0.9.25'
9
- gem 'rake', '~> 0.8.7'
10
- gem 'jeweler', '~> 1.4.0', :git => 'git://github.com/technicalpickles/jeweler.git'
11
- end
12
-
13
- group(:doc) do
14
- case RUBY_PLATFORM
15
- when 'java'
16
- gem 'maruku', '~> 0.6.0'
17
- else
18
- gem 'rdiscount', '~> 1.6.3'
19
- end
20
-
21
- gem 'yard', '~> 0.5.3'
22
- end
23
-
24
- gem 'rspec', '~> 1.3.0', :group => [:development, :test]
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.3