revdev 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7cf0af1c22d35685502d3d9f8882e3e0a73a81c7
4
+ data.tar.gz: 40c4fbe3006a77521cc5d0510bfd367ebeb95afa
5
+ SHA512:
6
+ metadata.gz: 7c1ba6a8015a9c304bfbc8fd9c4ac6703a2d4dab132f9adebc79b0c3c2b2386e29fcd229187a10de00a84bc29d4dc9f0a3c11136b9c4499c212d987b7e2dc25b
7
+ data.tar.gz: 4ee011c5ea3bc0f24955d9320af1c5b1d236023866746fa3fc471af2ddcf37d14d995e48c3848ff16ef239bff457bd81e912f2251747bf1672e00a7990f43ee7
data/README.md CHANGED
@@ -42,6 +42,6 @@ Contributing
42
42
  1. Fork it
43
43
  2. Create your feature branch (`git checkout -b my-new-feature`)
44
44
  3. Commit your changes (`git commit -am 'Added some feature'`)
45
- * Please check with `test` to execute `$ rake`
45
+ * Please check tests to execute `$ rake`
46
46
  4. Push to the branch (`git push origin my-new-feature`)
47
47
  5. Create new Pull Request
@@ -1,18 +1,31 @@
1
1
  require "mkmf"
2
2
 
3
- # version => micro
4
- map = {
5
- '1.8.' => 'RUBY_1_8',
6
- '1.9.' => 'RUBY_1_9',
7
- }
8
- version, micro = map.find do |v, m|
9
- RUBY_VERSION.start_with? v
10
- end
3
+ $v = RUBY_VERSION.split('.').map{|s| s.to_i}
4
+
5
+ def chk_ver b, e=nil
6
+ b.zip($v).all? do |bv, vv|
7
+ bv ||= 0; vv ||= 0
8
+ if bv < vv then break true
9
+ elsif bv == vv then next true
10
+ else break false
11
+ end
12
+ end or return false
11
13
 
12
- if micro.nil?
13
- abort "Not supported ruby-version: #{RUBY_VERSION}"
14
- else
15
- $defs << "-D#{micro}"
14
+ e.nil? or $v.zip(e).any? do |vv, ev|
15
+ vv ||= 0; ev ||= 0
16
+ if vv < ev then break true
17
+ elsif vv == ev then next false
18
+ else break false
19
+ end
20
+ end
16
21
  end
17
22
 
23
+ micro =
24
+ if chk_ver([1, 8, 6], [1, 9]) then 'RUBY_1_8'
25
+ elsif chk_ver([1, 9, 1] ) then 'RUBY_1_9'
26
+ else abort "Not supported ruby-version: #{RUBY_VERSION}"
27
+ end
28
+
29
+ $defs << "-D#{micro}"
30
+
18
31
  create_makefile "revdev/revdev"
@@ -40,10 +40,12 @@ VALUE class_ff_effect;
40
40
 
41
41
  VALUE input_event_raw_initialize(VALUE self, VALUE byte)
42
42
  {
43
+ char *p;
43
44
  struct input_event *ie;
44
45
  struct timeval t;
45
46
 
46
- ie = RSTRING_PTR(byte);
47
+ p = RSTRING_PTR(byte);
48
+ ie = (struct input_event *) p;
47
49
  t = ie->time;
48
50
 
49
51
  rb_iv_set(self, "@time", rb_time_new(t.tv_sec, t.tv_usec));
@@ -56,6 +58,7 @@ VALUE input_event_raw_initialize(VALUE self, VALUE byte)
56
58
 
57
59
  VALUE input_event_to_byte_string(VALUE self)
58
60
  {
61
+ const char *cp;
59
62
  struct input_event ie;
60
63
  #ifdef RUBY_1_8
61
64
  struct timeval *t;
@@ -70,13 +73,16 @@ VALUE input_event_to_byte_string(VALUE self)
70
73
  ie.code = FIX2UINT(rb_iv_get(self, "@code"));
71
74
  ie.value = NUM2LONG(rb_iv_get(self, "@value"));
72
75
 
73
- return rb_str_new(&ie, sizeof(struct input_event));
76
+ cp = (const char*) &ie;
77
+ return rb_str_new(cp, sizeof(struct input_event));
74
78
  }
75
79
 
76
80
  VALUE input_id_raw_initialize(VALUE self, VALUE byte)
77
81
  {
82
+ char *p;
78
83
  struct input_id *ii;
79
- ii = RSTRING_PTR(byte);
84
+ p = RSTRING_PTR(byte);
85
+ ii = (struct input_id *) p;
80
86
 
81
87
  rb_iv_set(self, "@bustype", INT2FIX(ii->bustype));
82
88
  rb_iv_set(self, "@vendor", INT2FIX(ii->vendor));
@@ -87,6 +93,7 @@ VALUE input_id_raw_initialize(VALUE self, VALUE byte)
87
93
  }
88
94
  VALUE input_id_to_byte_string(VALUE self)
89
95
  {
96
+ const char *cp;
90
97
  struct input_id ii;
91
98
 
92
99
  ii.bustype = FIX2UINT(rb_iv_get(self, "@bustype"));
@@ -94,7 +101,8 @@ VALUE input_id_to_byte_string(VALUE self)
94
101
  ii.product = FIX2UINT(rb_iv_get(self, "@product"));
95
102
  ii.version = FIX2UINT(rb_iv_get(self, "@version"));
96
103
 
97
- return rb_str_new(&ii, sizeof(struct input_id));
104
+ cp = (const char *) &ii;
105
+ return rb_str_new(cp, sizeof(struct input_id));
98
106
  }
99
107
 
100
108
  void Init_revdev(void)
@@ -1,3 +1,3 @@
1
1
  module Revdev
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revdev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 0.2.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Keiichiro Ui
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-17 00:00:00.000000000 Z
11
+ date: 2013-07-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: revdev is a ruby binding to handling event devices.
@@ -75,27 +70,26 @@ files:
75
70
  - test/test_revdev.rb
76
71
  homepage: https://rubygems.org/gems/revdev
77
72
  licenses: []
73
+ metadata: {}
78
74
  post_install_message:
79
75
  rdoc_options: []
80
76
  require_paths:
81
77
  - lib
82
78
  required_ruby_version: !ruby/object:Gem::Requirement
83
- none: false
84
79
  requirements:
85
- - - ! '>='
80
+ - - '>='
86
81
  - !ruby/object:Gem::Version
87
82
  version: '0'
88
83
  required_rubygems_version: !ruby/object:Gem::Requirement
89
- none: false
90
84
  requirements:
91
- - - ! '>='
85
+ - - '>='
92
86
  - !ruby/object:Gem::Version
93
87
  version: '0'
94
88
  requirements: []
95
89
  rubyforge_project:
96
- rubygems_version: 1.8.23
90
+ rubygems_version: 2.0.0
97
91
  signing_key:
98
- specification_version: 3
92
+ specification_version: 4
99
93
  summary: ruby binding to handling event devices.
100
94
  test_files:
101
95
  - test/test_event_device.rb