hex 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +30 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +42 -0
- data/Rakefile +42 -0
- data/VERSION +1 -0
- data/hex.gemspec +68 -0
- data/lib/wo_oo/electronics/intel_hex_file.rb +69 -0
- data/lib/wo_oo/electronics/intel_hex_grammar.rb +486 -0
- data/lib/wo_oo/electronics/intel_hex_grammar.treetop +56 -0
- data/lib/wo_oo/util/hex.rb +82 -0
- data/spec/hex_util_spec.rb +187 -0
- data/spec/intel_hex_file_spec.rb +42 -0
- data/spec/resources/wikipedia_sample.hex +5 -0
- data/spec/spec_helper.rb +11 -0
- metadata +130 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rspec", "~> 2.6.0"
|
10
|
+
gem "yard", "~> 0.7.1"
|
11
|
+
gem "bundler", "~> 1.0.13"
|
12
|
+
gem "jeweler", "~> 1.6.0"
|
13
|
+
gem "rcov", ">= 0"
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.6.0)
|
7
|
+
bundler (~> 1.0.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rake (0.9.0)
|
11
|
+
rcov (0.9.9)
|
12
|
+
rspec (2.6.0)
|
13
|
+
rspec-core (~> 2.6.0)
|
14
|
+
rspec-expectations (~> 2.6.0)
|
15
|
+
rspec-mocks (~> 2.6.0)
|
16
|
+
rspec-core (2.6.1)
|
17
|
+
rspec-expectations (2.6.0)
|
18
|
+
diff-lcs (~> 1.1.2)
|
19
|
+
rspec-mocks (2.6.0)
|
20
|
+
yard (0.7.1)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
bundler (~> 1.0.13)
|
27
|
+
jeweler (~> 1.6.0)
|
28
|
+
rcov
|
29
|
+
rspec (~> 2.6.0)
|
30
|
+
yard (~> 0.7.1)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Frédéric Mascaro
|
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.rdoc
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
= hex
|
2
|
+
|
3
|
+
== INTEL Hex file
|
4
|
+
|
5
|
+
Read and write Intel HEX file.
|
6
|
+
|
7
|
+
See [[http://en.wikipedia.org/wiki/Intel_hex]].
|
8
|
+
|
9
|
+
== HEX conversion
|
10
|
+
|
11
|
+
HexUtil convert to HEX 8, 16 or 32
|
12
|
+
|
13
|
+
> WOoo::Util::HexUtil.to_hex8(11)
|
14
|
+
"0B"
|
15
|
+
|
16
|
+
> WOoo::Util::HexUtil.to_hex8("11")
|
17
|
+
"0B"
|
18
|
+
|
19
|
+
> WOoo::Util::HexUtil.to_hex8([11, 16, 255])
|
20
|
+
["0B", "10", "FF"]
|
21
|
+
|
22
|
+
> WOoo::Util::HexUtil.to_i("0B")
|
23
|
+
11
|
24
|
+
|
25
|
+
> WOoo::Util::HexUtil.to_i(["0B", "10", "FF"])
|
26
|
+
[11, 16, 255]
|
27
|
+
|
28
|
+
== Contributing to hex
|
29
|
+
|
30
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
31
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
32
|
+
* Fork the project
|
33
|
+
* Start a feature/bugfix branch
|
34
|
+
* Commit and push until you are happy with your contribution
|
35
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
36
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
37
|
+
|
38
|
+
== Copyright
|
39
|
+
|
40
|
+
Copyright (c) 2011 Frédéric Mascaro. See LICENSE.txt for
|
41
|
+
further details.
|
42
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "hex"
|
18
|
+
gem.homepage = "http://github.com/rfred999/hex"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Convert hex data to/from integer, and read/write Intel HEX File.}
|
21
|
+
gem.description = %Q{Convert hex data to/from integer, and read/write Intel HEX File.}
|
22
|
+
gem.email = "frederic.mascaro@wo-oo.com"
|
23
|
+
gem.authors = ["Frédéric Mascaro"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
require 'yard'
|
42
|
+
YARD::Rake::YardocTask.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/hex.gemspec
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{hex}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Frédéric Mascaro"]
|
12
|
+
s.date = %q{2011-05-22}
|
13
|
+
s.description = %q{Convert hex data to/from integer, and read/write Intel HEX File.}
|
14
|
+
s.email = %q{frederic.mascaro@wo-oo.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"hex.gemspec",
|
29
|
+
"lib/wo_oo/electronics/intel_hex_file.rb",
|
30
|
+
"lib/wo_oo/electronics/intel_hex_grammar.rb",
|
31
|
+
"lib/wo_oo/electronics/intel_hex_grammar.treetop",
|
32
|
+
"lib/wo_oo/util/hex.rb",
|
33
|
+
"spec/hex_util_spec.rb",
|
34
|
+
"spec/intel_hex_file_spec.rb",
|
35
|
+
"spec/resources/wikipedia_sample.hex",
|
36
|
+
"spec/spec_helper.rb"
|
37
|
+
]
|
38
|
+
s.homepage = %q{http://github.com/rfred999/hex}
|
39
|
+
s.licenses = ["MIT"]
|
40
|
+
s.require_paths = ["lib"]
|
41
|
+
s.rubygems_version = %q{1.6.2}
|
42
|
+
s.summary = %q{Convert hex data to/from integer, and read/write Intel HEX File.}
|
43
|
+
|
44
|
+
if s.respond_to? :specification_version then
|
45
|
+
s.specification_version = 3
|
46
|
+
|
47
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
|
49
|
+
s.add_development_dependency(%q<yard>, ["~> 0.7.1"])
|
50
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.13"])
|
51
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
|
52
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<rspec>, ["~> 2.6.0"])
|
55
|
+
s.add_dependency(%q<yard>, ["~> 0.7.1"])
|
56
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.13"])
|
57
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
58
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
59
|
+
end
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<rspec>, ["~> 2.6.0"])
|
62
|
+
s.add_dependency(%q<yard>, ["~> 0.7.1"])
|
63
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.13"])
|
64
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
65
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require "wo_oo/electronics/intel_hex_grammar"
|
2
|
+
require "wo_oo/util/hex"
|
3
|
+
require "pp"
|
4
|
+
|
5
|
+
module WOoo
|
6
|
+
module Electronics
|
7
|
+
class IntelHexFile
|
8
|
+
def self.read(path)
|
9
|
+
file_content = File.read(path)
|
10
|
+
|
11
|
+
parser = WOoo::Electronics::IntelHexParser.new
|
12
|
+
result = parser.parse(file_content)
|
13
|
+
|
14
|
+
unless result.nil?
|
15
|
+
hex_data = result.eval
|
16
|
+
|
17
|
+
WOoo::Util::HexUtil.to_i(hex_data.scan(/../))
|
18
|
+
else
|
19
|
+
# TO FIX
|
20
|
+
puts "PARSING ERROR!"
|
21
|
+
puts parser.terminal_failures.join("\n")
|
22
|
+
puts "----"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# ----------------------------------------------------------------
|
27
|
+
|
28
|
+
def self.write(path, data, start_address = 0)
|
29
|
+
next_address = start_address
|
30
|
+
|
31
|
+
File.open(path, "w") do |file|
|
32
|
+
while (line_data = data.slice!(0..16)).size > 0
|
33
|
+
line_size = line_data.size
|
34
|
+
|
35
|
+
file.print ":"
|
36
|
+
|
37
|
+
line = WOoo::Util::HexUtil.to_hex8(line_size)
|
38
|
+
line += WOoo::Util::HexUtil.to_hex16(next_address)
|
39
|
+
line += "00"
|
40
|
+
line += WOoo::Util::HexUtil.to_hex8(line_data).join("")
|
41
|
+
|
42
|
+
file.print line
|
43
|
+
file.print WOoo::Util::HexUtil.to_hex8(checksum(line))
|
44
|
+
|
45
|
+
file.print "\n"
|
46
|
+
|
47
|
+
next_address += line_size
|
48
|
+
end
|
49
|
+
|
50
|
+
file.print ":00000001FF"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# ----------------------------------------------------------------
|
55
|
+
|
56
|
+
def self.checksum(data)
|
57
|
+
checksum = 0
|
58
|
+
|
59
|
+
data.scan(/../).each do |value|
|
60
|
+
checksum += WOoo::Util::HexUtil.to_i(value)
|
61
|
+
end
|
62
|
+
|
63
|
+
checksum = ((checksum & 255) ^ 255) + 1
|
64
|
+
|
65
|
+
checksum
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,486 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
require "treetop"
|
5
|
+
|
6
|
+
module WOoo
|
7
|
+
module Electronics
|
8
|
+
module IntelHex
|
9
|
+
include Treetop::Runtime
|
10
|
+
|
11
|
+
def root
|
12
|
+
@root ||= :file
|
13
|
+
end
|
14
|
+
|
15
|
+
module File0
|
16
|
+
def _lines
|
17
|
+
elements[0]
|
18
|
+
end
|
19
|
+
|
20
|
+
def eof_line
|
21
|
+
elements[1]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module File1
|
26
|
+
def eval
|
27
|
+
data = ""
|
28
|
+
_lines.elements.each do |line|
|
29
|
+
data += line.eval
|
30
|
+
end
|
31
|
+
data
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def _nt_file
|
36
|
+
start_index = index
|
37
|
+
if node_cache[:file].has_key?(index)
|
38
|
+
cached = node_cache[:file][index]
|
39
|
+
if cached
|
40
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
41
|
+
@index = cached.interval.end
|
42
|
+
end
|
43
|
+
return cached
|
44
|
+
end
|
45
|
+
|
46
|
+
i0, s0 = index, []
|
47
|
+
s1, i1 = [], index
|
48
|
+
loop do
|
49
|
+
r2 = _nt_data_line
|
50
|
+
if r2
|
51
|
+
s1 << r2
|
52
|
+
else
|
53
|
+
break
|
54
|
+
end
|
55
|
+
end
|
56
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
57
|
+
s0 << r1
|
58
|
+
if r1
|
59
|
+
r3 = _nt_eof_line
|
60
|
+
s0 << r3
|
61
|
+
end
|
62
|
+
if s0.last
|
63
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
64
|
+
r0.extend(File0)
|
65
|
+
r0.extend(File1)
|
66
|
+
else
|
67
|
+
@index = i0
|
68
|
+
r0 = nil
|
69
|
+
end
|
70
|
+
|
71
|
+
node_cache[:file][start_index] = r0
|
72
|
+
|
73
|
+
r0
|
74
|
+
end
|
75
|
+
|
76
|
+
module DataLine0
|
77
|
+
def _byte_count
|
78
|
+
elements[2]
|
79
|
+
end
|
80
|
+
|
81
|
+
def _address
|
82
|
+
elements[3]
|
83
|
+
end
|
84
|
+
|
85
|
+
def _record_type
|
86
|
+
elements[4]
|
87
|
+
end
|
88
|
+
|
89
|
+
def _data
|
90
|
+
elements[5]
|
91
|
+
end
|
92
|
+
|
93
|
+
def _checksum
|
94
|
+
elements[6]
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
module DataLine1
|
100
|
+
def eval
|
101
|
+
line_data = _data.text_value
|
102
|
+
# unless line_data.size ==
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def _nt_data_line
|
107
|
+
start_index = index
|
108
|
+
if node_cache[:data_line].has_key?(index)
|
109
|
+
cached = node_cache[:data_line][index]
|
110
|
+
if cached
|
111
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
112
|
+
@index = cached.interval.end
|
113
|
+
end
|
114
|
+
return cached
|
115
|
+
end
|
116
|
+
|
117
|
+
i0, s0 = index, []
|
118
|
+
i1 = index
|
119
|
+
r2 = _nt_eof_line
|
120
|
+
if r2
|
121
|
+
r1 = nil
|
122
|
+
else
|
123
|
+
@index = i1
|
124
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
125
|
+
end
|
126
|
+
s0 << r1
|
127
|
+
if r1
|
128
|
+
if has_terminal?(":", false, index)
|
129
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
130
|
+
@index += 1
|
131
|
+
else
|
132
|
+
terminal_parse_failure(":")
|
133
|
+
r3 = nil
|
134
|
+
end
|
135
|
+
s0 << r3
|
136
|
+
if r3
|
137
|
+
r4 = _nt_byte_count
|
138
|
+
s0 << r4
|
139
|
+
if r4
|
140
|
+
r5 = _nt_address
|
141
|
+
s0 << r5
|
142
|
+
if r5
|
143
|
+
r6 = _nt_record_type
|
144
|
+
s0 << r6
|
145
|
+
if r6
|
146
|
+
r7 = _nt_data
|
147
|
+
s0 << r7
|
148
|
+
if r7
|
149
|
+
r8 = _nt_checksum
|
150
|
+
s0 << r8
|
151
|
+
if r8
|
152
|
+
if has_terminal?("\n", false, index)
|
153
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
154
|
+
@index += 1
|
155
|
+
else
|
156
|
+
terminal_parse_failure("\n")
|
157
|
+
r9 = nil
|
158
|
+
end
|
159
|
+
s0 << r9
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
if s0.last
|
168
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
169
|
+
r0.extend(DataLine0)
|
170
|
+
r0.extend(DataLine1)
|
171
|
+
else
|
172
|
+
@index = i0
|
173
|
+
r0 = nil
|
174
|
+
end
|
175
|
+
|
176
|
+
node_cache[:data_line][start_index] = r0
|
177
|
+
|
178
|
+
r0
|
179
|
+
end
|
180
|
+
|
181
|
+
module ByteCount0
|
182
|
+
def hex_value1
|
183
|
+
elements[0]
|
184
|
+
end
|
185
|
+
|
186
|
+
def hex_value2
|
187
|
+
elements[1]
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
def _nt_byte_count
|
192
|
+
start_index = index
|
193
|
+
if node_cache[:byte_count].has_key?(index)
|
194
|
+
cached = node_cache[:byte_count][index]
|
195
|
+
if cached
|
196
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
197
|
+
@index = cached.interval.end
|
198
|
+
end
|
199
|
+
return cached
|
200
|
+
end
|
201
|
+
|
202
|
+
i0, s0 = index, []
|
203
|
+
r1 = _nt_hex_value
|
204
|
+
s0 << r1
|
205
|
+
if r1
|
206
|
+
r2 = _nt_hex_value
|
207
|
+
s0 << r2
|
208
|
+
end
|
209
|
+
if s0.last
|
210
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
211
|
+
r0.extend(ByteCount0)
|
212
|
+
else
|
213
|
+
@index = i0
|
214
|
+
r0 = nil
|
215
|
+
end
|
216
|
+
|
217
|
+
node_cache[:byte_count][start_index] = r0
|
218
|
+
|
219
|
+
r0
|
220
|
+
end
|
221
|
+
|
222
|
+
module Address0
|
223
|
+
def hex_value1
|
224
|
+
elements[0]
|
225
|
+
end
|
226
|
+
|
227
|
+
def hex_value2
|
228
|
+
elements[1]
|
229
|
+
end
|
230
|
+
|
231
|
+
def hex_value3
|
232
|
+
elements[2]
|
233
|
+
end
|
234
|
+
|
235
|
+
def hex_value4
|
236
|
+
elements[3]
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
def _nt_address
|
241
|
+
start_index = index
|
242
|
+
if node_cache[:address].has_key?(index)
|
243
|
+
cached = node_cache[:address][index]
|
244
|
+
if cached
|
245
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
246
|
+
@index = cached.interval.end
|
247
|
+
end
|
248
|
+
return cached
|
249
|
+
end
|
250
|
+
|
251
|
+
i0, s0 = index, []
|
252
|
+
r1 = _nt_hex_value
|
253
|
+
s0 << r1
|
254
|
+
if r1
|
255
|
+
r2 = _nt_hex_value
|
256
|
+
s0 << r2
|
257
|
+
if r2
|
258
|
+
r3 = _nt_hex_value
|
259
|
+
s0 << r3
|
260
|
+
if r3
|
261
|
+
r4 = _nt_hex_value
|
262
|
+
s0 << r4
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
if s0.last
|
267
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
268
|
+
r0.extend(Address0)
|
269
|
+
else
|
270
|
+
@index = i0
|
271
|
+
r0 = nil
|
272
|
+
end
|
273
|
+
|
274
|
+
node_cache[:address][start_index] = r0
|
275
|
+
|
276
|
+
r0
|
277
|
+
end
|
278
|
+
|
279
|
+
module RecordType0
|
280
|
+
def hex_value1
|
281
|
+
elements[0]
|
282
|
+
end
|
283
|
+
|
284
|
+
def hex_value2
|
285
|
+
elements[1]
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
def _nt_record_type
|
290
|
+
start_index = index
|
291
|
+
if node_cache[:record_type].has_key?(index)
|
292
|
+
cached = node_cache[:record_type][index]
|
293
|
+
if cached
|
294
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
295
|
+
@index = cached.interval.end
|
296
|
+
end
|
297
|
+
return cached
|
298
|
+
end
|
299
|
+
|
300
|
+
i0, s0 = index, []
|
301
|
+
r1 = _nt_hex_value
|
302
|
+
s0 << r1
|
303
|
+
if r1
|
304
|
+
r2 = _nt_hex_value
|
305
|
+
s0 << r2
|
306
|
+
end
|
307
|
+
if s0.last
|
308
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
309
|
+
r0.extend(RecordType0)
|
310
|
+
else
|
311
|
+
@index = i0
|
312
|
+
r0 = nil
|
313
|
+
end
|
314
|
+
|
315
|
+
node_cache[:record_type][start_index] = r0
|
316
|
+
|
317
|
+
r0
|
318
|
+
end
|
319
|
+
|
320
|
+
module Data0
|
321
|
+
def hex_value
|
322
|
+
elements[0]
|
323
|
+
end
|
324
|
+
|
325
|
+
end
|
326
|
+
|
327
|
+
def _nt_data
|
328
|
+
start_index = index
|
329
|
+
if node_cache[:data].has_key?(index)
|
330
|
+
cached = node_cache[:data][index]
|
331
|
+
if cached
|
332
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
333
|
+
@index = cached.interval.end
|
334
|
+
end
|
335
|
+
return cached
|
336
|
+
end
|
337
|
+
|
338
|
+
s0, i0 = [], index
|
339
|
+
loop do
|
340
|
+
i1, s1 = index, []
|
341
|
+
r2 = _nt_hex_value
|
342
|
+
s1 << r2
|
343
|
+
if r2
|
344
|
+
i3 = index
|
345
|
+
r4 = _nt_checksum
|
346
|
+
if r4
|
347
|
+
@index = i3
|
348
|
+
r3 = instantiate_node(SyntaxNode,input, index...index)
|
349
|
+
else
|
350
|
+
r3 = nil
|
351
|
+
end
|
352
|
+
s1 << r3
|
353
|
+
end
|
354
|
+
if s1.last
|
355
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
356
|
+
r1.extend(Data0)
|
357
|
+
else
|
358
|
+
@index = i1
|
359
|
+
r1 = nil
|
360
|
+
end
|
361
|
+
if r1
|
362
|
+
s0 << r1
|
363
|
+
else
|
364
|
+
break
|
365
|
+
end
|
366
|
+
end
|
367
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
368
|
+
|
369
|
+
node_cache[:data][start_index] = r0
|
370
|
+
|
371
|
+
r0
|
372
|
+
end
|
373
|
+
|
374
|
+
module Checksum0
|
375
|
+
def hex_value1
|
376
|
+
elements[0]
|
377
|
+
end
|
378
|
+
|
379
|
+
def hex_value2
|
380
|
+
elements[1]
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
def _nt_checksum
|
385
|
+
start_index = index
|
386
|
+
if node_cache[:checksum].has_key?(index)
|
387
|
+
cached = node_cache[:checksum][index]
|
388
|
+
if cached
|
389
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
390
|
+
@index = cached.interval.end
|
391
|
+
end
|
392
|
+
return cached
|
393
|
+
end
|
394
|
+
|
395
|
+
i0, s0 = index, []
|
396
|
+
r1 = _nt_hex_value
|
397
|
+
s0 << r1
|
398
|
+
if r1
|
399
|
+
r2 = _nt_hex_value
|
400
|
+
s0 << r2
|
401
|
+
end
|
402
|
+
if s0.last
|
403
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
404
|
+
r0.extend(Checksum0)
|
405
|
+
else
|
406
|
+
@index = i0
|
407
|
+
r0 = nil
|
408
|
+
end
|
409
|
+
|
410
|
+
node_cache[:checksum][start_index] = r0
|
411
|
+
|
412
|
+
r0
|
413
|
+
end
|
414
|
+
|
415
|
+
def _nt_hex_value
|
416
|
+
start_index = index
|
417
|
+
if node_cache[:hex_value].has_key?(index)
|
418
|
+
cached = node_cache[:hex_value][index]
|
419
|
+
if cached
|
420
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
421
|
+
@index = cached.interval.end
|
422
|
+
end
|
423
|
+
return cached
|
424
|
+
end
|
425
|
+
|
426
|
+
i0 = index
|
427
|
+
if has_terminal?('\G[0-9]', true, index)
|
428
|
+
r1 = true
|
429
|
+
@index += 1
|
430
|
+
else
|
431
|
+
r1 = nil
|
432
|
+
end
|
433
|
+
if r1
|
434
|
+
r0 = r1
|
435
|
+
else
|
436
|
+
if has_terminal?('\G[A-F]', true, index)
|
437
|
+
r2 = true
|
438
|
+
@index += 1
|
439
|
+
else
|
440
|
+
r2 = nil
|
441
|
+
end
|
442
|
+
if r2
|
443
|
+
r0 = r2
|
444
|
+
else
|
445
|
+
@index = i0
|
446
|
+
r0 = nil
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
node_cache[:hex_value][start_index] = r0
|
451
|
+
|
452
|
+
r0
|
453
|
+
end
|
454
|
+
|
455
|
+
def _nt_eof_line
|
456
|
+
start_index = index
|
457
|
+
if node_cache[:eof_line].has_key?(index)
|
458
|
+
cached = node_cache[:eof_line][index]
|
459
|
+
if cached
|
460
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
461
|
+
@index = cached.interval.end
|
462
|
+
end
|
463
|
+
return cached
|
464
|
+
end
|
465
|
+
|
466
|
+
if has_terminal?(":00000001FF", false, index)
|
467
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 11))
|
468
|
+
@index += 11
|
469
|
+
else
|
470
|
+
terminal_parse_failure(":00000001FF")
|
471
|
+
r0 = nil
|
472
|
+
end
|
473
|
+
|
474
|
+
node_cache[:eof_line][start_index] = r0
|
475
|
+
|
476
|
+
r0
|
477
|
+
end
|
478
|
+
|
479
|
+
end
|
480
|
+
|
481
|
+
class IntelHexParser < Treetop::Runtime::CompiledParser
|
482
|
+
include IntelHex
|
483
|
+
end
|
484
|
+
|
485
|
+
end
|
486
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "treetop"
|
2
|
+
|
3
|
+
module WOoo
|
4
|
+
module Electronics
|
5
|
+
grammar IntelHex
|
6
|
+
rule file
|
7
|
+
_lines:data_line* eof_line {
|
8
|
+
def eval
|
9
|
+
data = ""
|
10
|
+
_lines.elements.each do |line|
|
11
|
+
data += line.eval
|
12
|
+
end
|
13
|
+
data
|
14
|
+
end
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
rule data_line
|
19
|
+
!eof_line ":" _byte_count:byte_count _address:address _record_type:record_type _data:data _checksum:checksum "\n" {
|
20
|
+
def eval
|
21
|
+
line_data = _data.text_value
|
22
|
+
# unless line_data.size ==
|
23
|
+
end
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
rule byte_count
|
28
|
+
hex_value hex_value
|
29
|
+
end
|
30
|
+
|
31
|
+
rule address
|
32
|
+
hex_value hex_value hex_value hex_value
|
33
|
+
end
|
34
|
+
|
35
|
+
rule record_type
|
36
|
+
hex_value hex_value
|
37
|
+
end
|
38
|
+
|
39
|
+
rule data
|
40
|
+
(hex_value &checksum)*
|
41
|
+
end
|
42
|
+
|
43
|
+
rule checksum
|
44
|
+
hex_value hex_value
|
45
|
+
end
|
46
|
+
|
47
|
+
rule hex_value
|
48
|
+
[0-9] / [A-F]
|
49
|
+
end
|
50
|
+
|
51
|
+
rule eof_line
|
52
|
+
":00000001FF"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module WOoo
|
2
|
+
module Util
|
3
|
+
# HexUtil convert to HEX 8, 16 or 32
|
4
|
+
#
|
5
|
+
# > WOoo::Util::HexUtil.to_hex8(11)
|
6
|
+
# "0B"
|
7
|
+
#
|
8
|
+
# > WOoo::Util::HexUtil.to_hex8("11")
|
9
|
+
# "0B"
|
10
|
+
#
|
11
|
+
# > WOoo::Util::HexUtil.to_hex8([11, 16, 255])
|
12
|
+
# ["0B", "10", "FF"]
|
13
|
+
#
|
14
|
+
# > WOoo::Util::HexUtil.to_i("0B")
|
15
|
+
# 11
|
16
|
+
#
|
17
|
+
# > WOoo::Util::HexUtil.to_i(["0B", "10", "FF"])
|
18
|
+
# [11, 16, 255]
|
19
|
+
#
|
20
|
+
module HexUtil
|
21
|
+
HEX_8 = 0
|
22
|
+
HEX_16 = 1
|
23
|
+
HEX_32 = 2
|
24
|
+
|
25
|
+
SPRINTF_CONFIGURATION = ["%.2x", "%.4x", "%.8x"]
|
26
|
+
|
27
|
+
def self.to_hex8(values)
|
28
|
+
case values
|
29
|
+
when Integer
|
30
|
+
to_hex(values, HEX_8)
|
31
|
+
when Array
|
32
|
+
values.map { |value| to_hex8(value) }
|
33
|
+
when String
|
34
|
+
to_hex(values.to_i, HEX_8)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# ----------------------------------------------------------------
|
39
|
+
|
40
|
+
def self.to_hex16(values)
|
41
|
+
case values
|
42
|
+
when Integer
|
43
|
+
to_hex(values, HEX_16)
|
44
|
+
when Array
|
45
|
+
values.map { |value| to_hex16(value) }
|
46
|
+
when String
|
47
|
+
to_hex(values.to_i, HEX_16)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# ----------------------------------------------------------------
|
52
|
+
|
53
|
+
def self.to_hex32(values)
|
54
|
+
case values
|
55
|
+
when Integer
|
56
|
+
to_hex(values, HEX_32)
|
57
|
+
when Array
|
58
|
+
values.map { |value| to_hex32(value) }
|
59
|
+
when String
|
60
|
+
to_hex(values.to_i, HEX_32)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# ----------------------------------------------------------------
|
65
|
+
|
66
|
+
def self.to_hex(value, size = HEX_8)
|
67
|
+
sprintf(SPRINTF_CONFIGURATION[size], value).upcase
|
68
|
+
end
|
69
|
+
|
70
|
+
# ----------------------------------------------------------------
|
71
|
+
|
72
|
+
def self.to_i(values)
|
73
|
+
case values
|
74
|
+
when String
|
75
|
+
values.downcase.to_i(16)
|
76
|
+
when Array
|
77
|
+
values.map { |value| to_i(value) }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,187 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require "wo_oo/util/hex"
|
3
|
+
|
4
|
+
describe WOoo::Util::HexUtil do
|
5
|
+
context "HEX 8" do
|
6
|
+
before(:all) do
|
7
|
+
@data = {
|
8
|
+
1 => "01",
|
9
|
+
11 => "0B",
|
10
|
+
15 => "0F",
|
11
|
+
16 => "10",
|
12
|
+
255 => "FF"
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
it "convert integer to hex" do
|
18
|
+
@data.each do |byte, hex|
|
19
|
+
WOoo::Util::HexUtil.to_hex8(byte).should == hex
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
it "convert array of integers to array of hex" do
|
26
|
+
values = @data.keys
|
27
|
+
expected_results = @data.values
|
28
|
+
|
29
|
+
WOoo::Util::HexUtil.to_hex8(values).should == expected_results
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
it "convert string to hex" do
|
35
|
+
@data.map{ |key, value| [key.to_s, value] }.each do |byte, hex|
|
36
|
+
WOoo::Util::HexUtil.to_hex8(byte).should == hex
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
it "convert hex to integer" do
|
43
|
+
@data.each do |byte, hex|
|
44
|
+
WOoo::Util::HexUtil.to_i(hex).should == byte
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
it "convert array of hex to array of integer" do
|
51
|
+
values = @data.values
|
52
|
+
expected_results = @data.keys
|
53
|
+
|
54
|
+
WOoo::Util::HexUtil.to_i(values).should == expected_results
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
# ----------------------------------------------------------------
|
60
|
+
# ----------------------------------------------------------------
|
61
|
+
|
62
|
+
|
63
|
+
context "HEX 16" do
|
64
|
+
before(:all) do
|
65
|
+
@data = {
|
66
|
+
1 => "0001",
|
67
|
+
11 => "000B",
|
68
|
+
15 => "000F",
|
69
|
+
16 => "0010",
|
70
|
+
255 => "00FF",
|
71
|
+
256 => "0100",
|
72
|
+
437 => "01B5",
|
73
|
+
512 => "0200",
|
74
|
+
4096 => "1000",
|
75
|
+
20284 => "4F3C",
|
76
|
+
65535 => "FFFF"
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
it "convert integer to hex" do
|
81
|
+
@data.each do |byte, hex|
|
82
|
+
WOoo::Util::HexUtil.to_hex16(byte).should == hex
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
it "convert array of integers to array of hex" do
|
89
|
+
values = @data.keys
|
90
|
+
expected_results = @data.values
|
91
|
+
|
92
|
+
WOoo::Util::HexUtil.to_hex16(values).should == expected_results
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
it "convert string to hex" do
|
98
|
+
@data.map{ |key, value| [key.to_s, value] }.each do |byte, hex|
|
99
|
+
WOoo::Util::HexUtil.to_hex16(byte).should == hex
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
it "convert hex to integer" do
|
106
|
+
@data.each do |byte, hex|
|
107
|
+
WOoo::Util::HexUtil.to_i(hex).should == byte
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
it "convert array of hex to array of integer" do
|
114
|
+
values = @data.values
|
115
|
+
expected_results = @data.keys
|
116
|
+
|
117
|
+
WOoo::Util::HexUtil.to_i(values).should == expected_results
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
|
122
|
+
# ----------------------------------------------------------------
|
123
|
+
# ----------------------------------------------------------------
|
124
|
+
|
125
|
+
|
126
|
+
context "HEX 32" do
|
127
|
+
before(:all) do
|
128
|
+
@data = {
|
129
|
+
1 => "00000001",
|
130
|
+
11 => "0000000B",
|
131
|
+
15 => "0000000F",
|
132
|
+
16 => "00000010",
|
133
|
+
255 => "000000FF",
|
134
|
+
256 => "00000100",
|
135
|
+
437 => "000001B5",
|
136
|
+
512 => "00000200",
|
137
|
+
4096 => "00001000",
|
138
|
+
20284 => "00004F3C",
|
139
|
+
65535 => "0000FFFF",
|
140
|
+
65536 => "00010000",
|
141
|
+
65567 => "0001001F",
|
142
|
+
3833132 => "003A7D2C",
|
143
|
+
4294967295 => "FFFFFFFF"
|
144
|
+
}
|
145
|
+
end
|
146
|
+
|
147
|
+
it "convert integer to hex" do
|
148
|
+
@data.each do |byte, hex|
|
149
|
+
WOoo::Util::HexUtil.to_hex32(byte).should == hex
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
it "convert array of integers to array of hex" do
|
156
|
+
values = @data.keys
|
157
|
+
expected_results = @data.values
|
158
|
+
|
159
|
+
WOoo::Util::HexUtil.to_hex32(values).should == expected_results
|
160
|
+
end
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
it "convert string to hex" do
|
165
|
+
@data.map{ |key, value| [key.to_s, value] }.each do |byte, hex|
|
166
|
+
WOoo::Util::HexUtil.to_hex32(byte).should == hex
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
it "convert hex to integer" do
|
173
|
+
@data.each do |byte, hex|
|
174
|
+
WOoo::Util::HexUtil.to_i(hex).should == byte
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
it "convert array of hex to array of integer" do
|
181
|
+
values = @data.values
|
182
|
+
expected_results = @data.keys
|
183
|
+
|
184
|
+
WOoo::Util::HexUtil.to_i(values).should == expected_results
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require "wo_oo/electronics/intel_hex_file"
|
3
|
+
require "tmpdir"
|
4
|
+
|
5
|
+
SAMPLE_HEX_DATA = "214601360121470136007EFE09D219012146017EB7C20001FF5F160021480119194E79234623965778239EDA3F01B2CA3F0156702B5E712B722B732146013421"
|
6
|
+
SAMPLE_BIN_DATA = [33, 70, 1, 54, 1, 33, 71, 1, 54, 0, 126, 254, 9, 210, 25, 1, 33, 70, 1, 126, 183, 194, 0, 1, 255, 95, 22, 0, 33, 72, 1, 25, 25, 78, 121, 35, 70, 35, 150, 87, 120, 35, 158, 218, 63, 1, 178, 202, 63, 1, 86, 112, 43, 94, 113, 43, 114, 43, 115, 33, 70, 1, 52, 33]
|
7
|
+
|
8
|
+
describe WOoo::Util::HexUtil do
|
9
|
+
before(:all) do
|
10
|
+
@sample_file_path = File.expand_path(File.dirname(__FILE__) + "/resources/wikipedia_sample.hex")
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
@temp_file_path = File.join(Dir.tmpdir, "output.hex")
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
after(:each) do
|
22
|
+
File.delete(@temp_file_path) if File.exists?(@temp_file_path)
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
it "loads an intel hex file 8-bits" do
|
28
|
+
WOoo::Electronics::IntelHexFile.read(@sample_file_path).should == SAMPLE_BIN_DATA
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
it "writes to an intel hex file 8-bits" do
|
34
|
+
start_address = 256
|
35
|
+
WOoo::Electronics::IntelHexFile.write(@temp_file_path, SAMPLE_BIN_DATA, start_address)
|
36
|
+
|
37
|
+
content = File.read(@temp_file_path)
|
38
|
+
expected_content = File.read(@sample_file_path)
|
39
|
+
|
40
|
+
content.should == expected_content
|
41
|
+
end
|
42
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
|
5
|
+
# Requires supporting files with custom matchers and macros, etc,
|
6
|
+
# in ./support/ and its subdirectories.
|
7
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
|
11
|
+
end
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hex
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- "Fr\xC3\xA9d\xC3\xA9ric Mascaro"
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-05-22 00:00:00 +02:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rspec
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.6.0
|
24
|
+
type: :development
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: yard
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.7.1
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: bundler
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.0.13
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: jeweler
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.6.0
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: rcov
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: *id005
|
71
|
+
description: Convert hex data to/from integer, and read/write Intel HEX File.
|
72
|
+
email: frederic.mascaro@wo-oo.com
|
73
|
+
executables: []
|
74
|
+
|
75
|
+
extensions: []
|
76
|
+
|
77
|
+
extra_rdoc_files:
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.rdoc
|
80
|
+
files:
|
81
|
+
- .document
|
82
|
+
- .rspec
|
83
|
+
- Gemfile
|
84
|
+
- Gemfile.lock
|
85
|
+
- LICENSE.txt
|
86
|
+
- README.rdoc
|
87
|
+
- Rakefile
|
88
|
+
- VERSION
|
89
|
+
- hex.gemspec
|
90
|
+
- lib/wo_oo/electronics/intel_hex_file.rb
|
91
|
+
- lib/wo_oo/electronics/intel_hex_grammar.rb
|
92
|
+
- lib/wo_oo/electronics/intel_hex_grammar.treetop
|
93
|
+
- lib/wo_oo/util/hex.rb
|
94
|
+
- spec/hex_util_spec.rb
|
95
|
+
- spec/intel_hex_file_spec.rb
|
96
|
+
- spec/resources/wikipedia_sample.hex
|
97
|
+
- spec/spec_helper.rb
|
98
|
+
has_rdoc: true
|
99
|
+
homepage: http://github.com/rfred999/hex
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: -3815648496608125443
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
version: "0"
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: "0"
|
122
|
+
requirements: []
|
123
|
+
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 1.6.2
|
126
|
+
signing_key:
|
127
|
+
specification_version: 3
|
128
|
+
summary: Convert hex data to/from integer, and read/write Intel HEX File.
|
129
|
+
test_files: []
|
130
|
+
|